« Return to Thread: porting the code from SDK 2.4.1 to SDK 3.1

Re: porting the code from SDK 2.4.1 to SDK 3.1

by Alain Rist :: Rate this Message:

Reply to Author | View in Thread

Hi Lorean,

I wrote a script to generate the cpp files from the OOo 3.* SDK (and a little more for Windows VC++ users) at
 http://www.codeproject.com/KB/wtl/Wtl_OOo.aspx .

cheers,
AR
  ----- Original Message -----
  From: Loredan Neagu
  To: dev@...
  Sent: Sunday, June 21, 2009 8:40 AM
  Subject: [api-dev] porting the code from SDK 2.4.1 to SDK 3.1


  Hello,

   

  A few months ago I developed a Windows application based on OpenOffice.org SDK 2.4.1 that supposed to convert any *.odt files to .pdf format. The application was written in C++ and I was very excited because actually it worked very well.

   

  Recently, I have upgraded to OpenOffice.org 3.1 and installed the latest SDK. First, I have discovered that when using cppumaker application to install C++ headers, some of the .hpp and .hdl files were missing.

  To install the C++ headers in includecpp folder I have used the following command:

   

  cppumaker -BUCR -O <oo_sdk_path>\includecpp <oo_root>\URE\misc\types.rdb

   

  My application uses XComponentLoader and XStorable interfaces. As the XComponentLoader.hpp  and XStorable.hpp  files were missing, I tried to compile the XComponentLoader.idl and XStorable.idl files respectively using the following command script:

   

  idlc -C -I..\idl ...\idl\com\sun\star\frame\XComponentLoader.idl

  regmerge XComponentLoader.rdb /UCR <oo_sdk_path>\idl\com\sun\star\frame\XComponentLoader.urd

  cppumaker -BUCR -O <oo_sdk_path>\includecpp <oo_root>\URE\misc\types.rdb <oo_root>\URE\bin\XComponentLoader.rdb

   

  idlc -C -I..\idl ...\idl\com\sun\star\frame\XStorable.idl

  regmerge XStorable.rdb /UCR <oo_sdk_path>\idl\com\sun\star\frame\ XStorable.urd

  cppumaker -BUCR -O <oo_sdk_path>\includecpp <oo_root>\URE\misc\types.rdb <oo_root>\URE\bin\XStorable.rdb

   

  Finally, I got the files needed for my application to compile into the includecpp folder:

  #include <com/sun/star/frame/XComponentLoader.hpp>

  #include <com/sun/star/frame/XStorable.hpp>

   

  Now, I'm experiencing some run-time problems when trying to query for XComponentLoader interface:

   

  //get the desktop service

  Reference< XInterface > Desktop = OfficeServiceManager->createInstance(OUString::createFromAscii("com.sun.star.frame.Desktop"));

  if(Desktop == NULL || !Desktop.is())

  {

     OutputDebugString(_T("Couldn't get the desktop service"));

     return false;

  }

   

  //query for the XComponentLoader interface

  Reference< XComponentLoader > rComponentLoader(Desktop, UNO_QUERY);

   

  Error message:

  First-chance exception at 0x7c812afb in odt2pdf.exe: Microsoft C++ exception: com::sun::star::container::NoSuchElementException at memory location 0x0121f4e0..

  First-chance exception at 0x7c812afb in odt2pdf.exe: Microsoft C++ exception: com::sun::star::container::NoSuchElementException at memory location 0x0121f570..

  First-chance exception at 0x7c812afb in odt2pdf.exe: Microsoft C++ exception: com::sun::star::container::NoSuchElementException at memory location 0x0121f404..

  First-chance exception at 0x7c812afb in odt2pdf.exe: Microsoft C++ exception: com::sun::star::container::NoSuchElementException at memory location 0x0121f494..

  First-chance exception at 0x7c812afb in odt2pdf.exe: Microsoft C++ exception: com::sun::star::container::NoSuchElementException at memory location 0x0121f408..

  First-chance exception at 0x7c812afb in odt2pdf.exe: Microsoft C++ exception: com::sun::star::container::NoSuchElementException at memory location 0x0121f498..

   

  Furthermore, when I validate the result:

   

  if(rComponentLoader == NULL || !rComponentLoader.is())

  {

     OutputDebugString(_T("Error: XComponentLoader unsuccessfully instanciated\n"));

     return false;

  }

   

  the application freezes and a stack overflow error message pops up:



   

  Is there any SDK installation/configuration step that I have missed?

  I really need to fix this issue as soon as possible, so any advice will be very much appreciated.

   

  Also, is there any way to generate all the C++ source code files from the UNO IDL definitions?

   

  Thank you for your support,

  Loredan Neagu

  Software developer

 « Return to Thread: porting the code from SDK 2.4.1 to SDK 3.1