[dev] help with filters in format convertion

2011-06-27 Thread wanglei
hi, all. i found your email addresses on the wiki of openoffice documentation 
project, and now trying to get some help from you guys.
i work for a mailing service provider, and right now i'm making a format 
converting tool, which can convert pdf doc[x] ppt[x] xls[x] to html, so that 
attachments in those formats could be viewed online, regardless of the user's 
envirenment. i can convert doc[x] and xls[x] to html now, but found some 
trouble with the ppt[x] and pdf. my code is like the following(based on the 
code found on the wiki and sdk examples). when converting ppt and pdf, there is 
always an error, but get no message information. the output would be like:

[root@M5 CppBinding]# make clean; make ; make office_connect.run 
cd /root/unoout/openoffice.org3.1_sdk/LINUXexample.out/bin  office_connect
Connected sucessfully to the office
XComponentloader successfully instanciated
xcomponent load ok
XStorable successfully instanciated
start to save file
readonly:0
haslocation:1
found a error
An error occurred: 
make: *** [office_connect.run] Error 1

questions:
1.is this caused by chosing the wrong export filter type? 
2.what filter type should i use to export html from ppt[x] and pdf? 
3.no import filter type is specified, but it worked with doc[x] and xls[x], is 
this ok? should i specify one anyway?
4.and how can i make sure the file is of doc format? eg i change whatever a 
file's name into *.doc on purpose and use this tool to convert it to html, this 
surely will cause some problem, right? can i determine whether the file to be 
imported is of the specified format or what format is the file to be imported 
is of? how could i do this?

i know i  asked a lot of questions, this might take you some time to answer, 
i'm very sorry to bother you guys, but i can not find another way to solve this 
problem. best wishes for you all, looking forward to your replies or please 
forward this mail to someone who can help. PLEASE, SO MANY THANKS.

Jack from CHINA.

INFO:
my code is based on sdk examples in the dir of 
openoffice.org/basis3.1/sdk/examples/DevelopersGuide/ProfUNO/CppBinding

[root@M5 sdk]# ./setsdkenv_unix
 
 *
 * SDK environment is prepared for Linux
 *
 * SDK = /usr/lib64/openoffice.org/basis3.1/sdk
 * Office = /usr/lib64/openoffice.org3
 * Office Base = /usr/lib64/openoffice.org/basis3.1
 * URE = /usr/lib64/openoffice.org/ure
 * Make = /usr/bin
 * Zip = /usr/bin
 * C++ Compiler = /usr/bin
 * Java = /usr/local/jdk1.6.0_18/
 * SDK Output directory = /root/unoout/openoffice.org3.1_sdk
 * Auto deployment = YES
 *
 



code start=
#include stdio.h
#include cppuhelper/bootstrap.hxx
#include com/sun/star/bridge/XUnoUrlResolver.hpp
#include com/sun/star/lang/XMultiServiceFactory.hpp
#include com/sun/star/lang/XMultiComponentFactory.hpp
#include com/sun/star/frame/XComponentLoader.hpp
#include com/sun/star/frame/XDesktop.hpp
#include com/sun/star/frame/XStorable.hpp
#include com/sun/star/beans/PropertyValue.hpp
using namespace std;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::bridge;
using namespace com::sun::star::io;
using namespace com::sun::star::beans;
using namespace com::sun::star::frame;
using namespace rtl;
using namespace cppu;
Reference XMultiServiceFactory  ooConnect(){
   // create the initial component context
   Reference XComponentContext  rComponentContext = 
defaultBootstrap_InitialComponentContext();

   // retrieve the servicemanager from the context
   Reference XMultiComponentFactory  rServiceManager = 
rComponentContext-getServiceManager();

   // instantiate a sample service with the servicemanager.
   Reference XInterface  rInstance =  
rServiceManager-createInstanceWithContext(
 OUString::createFromAscii(com.sun.star.bridge.UnoUrlResolver 
),rComponentContext );

   // Query for the XUnoUrlResolver interface
   Reference XUnoUrlResolver  rResolver( rInstance, UNO_QUERY );
   if( ! rResolver.is() ){
  printf( Error: Couldn't instantiate com.sun.star.bridge.UnoUrlResolver 
service\n );
  return NULL;
   }
   try {
  // resolve the uno-url
  rInstance = rResolver-resolve( OUString::createFromAscii(
 uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager ) 
);

  if( ! rInstance.is() ){
 printf( StarOffice.ServiceManager is not exported from remote 
counterpart\n );
 return NULL;
  }

  // query for the simpler XMultiServiceFactory interface, sufficient for 
scripting
  Reference XMultiServiceFactory  rOfficeServiceManager (rInstance, 
UNO_QUERY);

  if( ! rOfficeServiceManager.is() ){
printf( XMultiServiceFactory interface is not exported for 
StarOffice.ServiceManager\n );
return NULL;
}   
return rOfficeServiceManager;
   

[dev] help with filters in format convertion

2011-06-27 Thread wanglei
hi, all. i found your email addresses on the wiki of openoffice documentation 
project, and now trying to get some help from you guys.
i work for a mailing service provider, and right now i'm making a format 
converting tool, which can convert pdf doc[x] ppt[x] xls[x] to html, so that 
attachments in those formats could be viewed online, regardless of the user's 
envirenment. i can convert doc[x] and xls[x] to html now, but found some 
trouble with the ppt[x] and pdf. my code is like the following(based on the 
code found on the wiki and sdk examples). when converting ppt and pdf, there is 
always an error, but get no message information. the output would be like:

[root@M5 CppBinding]# make clean; make ; make office_connect.run 
cd /root/unoout/openoffice.org3.1_sdk/LINUXexample.out/bin  office_connect
Connected sucessfully to the office
XComponentloader successfully instanciated
xcomponent load ok
XStorable successfully instanciated
start to save file
readonly:0
haslocation:1
found a error
An error occurred: 
make: *** [office_connect.run] Error 1

questions:
1.is this caused by chosing the wrong export filter type? 
2.what filter type should i use to export html from ppt[x] and pdf? 
3.no import filter type is specified, but it worked with doc[x] and xls[x], is 
this ok? should i specify one anyway?
4.and how can i make sure the file is of doc format? eg i change whatever a 
file's name into *.doc on purpose and use this tool to convert it to html, this 
surely will cause some problem, right? can i determine whether the file to be 
imported is of the specified format or what format is the file to be imported 
is of? how could i do this?

i know i  asked a lot of questions, this might take you some time to answer, 
i'm very sorry to bother you guys, but i can not find another way to solve this 
problem. best wishes for you all, looking forward to your replies or please 
forward this mail to someone who can help. PLEASE, SO MANY THANKS.

Jack from CHINA.

INFO:
my code is based on sdk examples in the dir of 
openoffice.org/basis3.1/sdk/examples/DevelopersGuide/ProfUNO/CppBinding

[root@M5 sdk]# ./setsdkenv_unix
 
 *
 * SDK environment is prepared for Linux
 *
 * SDK = /usr/lib64/openoffice.org/basis3.1/sdk
 * Office = /usr/lib64/openoffice.org3
 * Office Base = /usr/lib64/openoffice.org/basis3.1
 * URE = /usr/lib64/openoffice.org/ure
 * Make = /usr/bin
 * Zip = /usr/bin
 * C++ Compiler = /usr/bin
 * Java = /usr/local/jdk1.6.0_18/
 * SDK Output directory = /root/unoout/openoffice.org3.1_sdk
 * Auto deployment = YES
 *
 



code start=
#include stdio.h
#include cppuhelper/bootstrap.hxx
#include com/sun/star/bridge/XUnoUrlResolver.hpp
#include com/sun/star/lang/XMultiServiceFactory.hpp
#include com/sun/star/lang/XMultiComponentFactory.hpp
#include com/sun/star/frame/XComponentLoader.hpp
#include com/sun/star/frame/XDesktop.hpp
#include com/sun/star/frame/XStorable.hpp
#include com/sun/star/beans/PropertyValue.hpp
using namespace std;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::bridge;
using namespace com::sun::star::io;
using namespace com::sun::star::beans;
using namespace com::sun::star::frame;
using namespace rtl;
using namespace cppu;
Reference XMultiServiceFactory  ooConnect(){
   // create the initial component context
   Reference XComponentContext  rComponentContext = 
defaultBootstrap_InitialComponentContext();

   // retrieve the servicemanager from the context
   Reference XMultiComponentFactory  rServiceManager = 
rComponentContext-getServiceManager();

   // instantiate a sample service with the servicemanager.
   Reference XInterface  rInstance =  
rServiceManager-createInstanceWithContext(
 OUString::createFromAscii(com.sun.star.bridge.UnoUrlResolver 
),rComponentContext );

   // Query for the XUnoUrlResolver interface
   Reference XUnoUrlResolver  rResolver( rInstance, UNO_QUERY );
   if( ! rResolver.is() ){
  printf( Error: Couldn't instantiate com.sun.star.bridge.UnoUrlResolver 
service\n );
  return NULL;
   }
   try {
  // resolve the uno-url
  rInstance = rResolver-resolve( OUString::createFromAscii(
 uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager ) 
);

  if( ! rInstance.is() ){
 printf( StarOffice.ServiceManager is not exported from remote 
counterpart\n );
 return NULL;
  }

  // query for the simpler XMultiServiceFactory interface, sufficient for 
scripting
  Reference XMultiServiceFactory  rOfficeServiceManager (rInstance, 
UNO_QUERY);

  if( ! rOfficeServiceManager.is() ){
printf( XMultiServiceFactory interface is not exported for 
StarOffice.ServiceManager\n );
return NULL;
}   
return rOfficeServiceManager;
   

[dev] help with filters in format convertion

2011-06-27 Thread wanglei
hi, all. i found your email addresses on the wiki of openoffice documentation 
project, and now trying to get some help from you guys.
i work for a mailing service provider, and right now i'm making a format 
converting tool, which can convert pdf doc[x] ppt[x] xls[x] to html, so that 
attachments in those formats could be viewed online, regardless of the user's 
envirenment. i can convert doc[x] and xls[x] to html now, but found some 
trouble with the ppt[x] and pdf. my code is like the following(based on the 
code found on the wiki and sdk examples). when converting ppt and pdf, there is 
always an error, but get no message information. the output would be like:

[root@M5 CppBinding]# make clean; make ; make office_connect.run 
cd /root/unoout/openoffice.org3.1_sdk/LINUXexample.out/bin  office_connect
Connected sucessfully to the office
XComponentloader successfully instanciated
xcomponent load ok
XStorable successfully instanciated
start to save file
readonly:0
haslocation:1
found a error
An error occurred: 
make: *** [office_connect.run] Error 1

questions:
1.is this caused by chosing the wrong export filter type? 
2.what filter type should i use to export html from ppt[x] and pdf? 
3.no import filter type is specified, but it worked with doc[x] and xls[x], is 
this ok? should i specify one anyway?
4.and how can i make sure the file is of doc format? eg i change whatever a 
file's name into *.doc on purpose and use this tool to convert it to html, this 
surely will cause some problem, right? can i determine whether the file to be 
imported is of the specified format or what format is the file to be imported 
is of? how could i do this?

i know i  asked a lot of questions, this might take you some time to answer, 
i'm very sorry to bother you guys, but i can not find another way to solve this 
problem. best wishes for you all, looking forward to your replies or please 
forward this mail to someone who can help. PLEASE, SO MANY THANKS.

Jack from CHINA.

INFO:
my code is based on sdk examples in the dir of 
openoffice.org/basis3.1/sdk/examples/DevelopersGuide/ProfUNO/CppBinding

[root@M5 sdk]# ./setsdkenv_unix
 
 *
 * SDK environment is prepared for Linux
 *
 * SDK = /usr/lib64/openoffice.org/basis3.1/sdk
 * Office = /usr/lib64/openoffice.org3
 * Office Base = /usr/lib64/openoffice.org/basis3.1
 * URE = /usr/lib64/openoffice.org/ure
 * Make = /usr/bin
 * Zip = /usr/bin
 * C++ Compiler = /usr/bin
 * Java = /usr/local/jdk1.6.0_18/
 * SDK Output directory = /root/unoout/openoffice.org3.1_sdk
 * Auto deployment = YES
 *
 



code start=
#include stdio.h
#include cppuhelper/bootstrap.hxx
#include com/sun/star/bridge/XUnoUrlResolver.hpp
#include com/sun/star/lang/XMultiServiceFactory.hpp
#include com/sun/star/lang/XMultiComponentFactory.hpp
#include com/sun/star/frame/XComponentLoader.hpp
#include com/sun/star/frame/XDesktop.hpp
#include com/sun/star/frame/XStorable.hpp
#include com/sun/star/beans/PropertyValue.hpp
using namespace std;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::bridge;
using namespace com::sun::star::io;
using namespace com::sun::star::beans;
using namespace com::sun::star::frame;
using namespace rtl;
using namespace cppu;
Reference XMultiServiceFactory  ooConnect(){
   // create the initial component context
   Reference XComponentContext  rComponentContext = 
defaultBootstrap_InitialComponentContext();

   // retrieve the servicemanager from the context
   Reference XMultiComponentFactory  rServiceManager = 
rComponentContext-getServiceManager();

   // instantiate a sample service with the servicemanager.
   Reference XInterface  rInstance =  
rServiceManager-createInstanceWithContext(
 OUString::createFromAscii(com.sun.star.bridge.UnoUrlResolver 
),rComponentContext );

   // Query for the XUnoUrlResolver interface
   Reference XUnoUrlResolver  rResolver( rInstance, UNO_QUERY );
   if( ! rResolver.is() ){
  printf( Error: Couldn't instantiate com.sun.star.bridge.UnoUrlResolver 
service\n );
  return NULL;
   }
   try {
  // resolve the uno-url
  rInstance = rResolver-resolve( OUString::createFromAscii(
 uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager ) 
);

  if( ! rInstance.is() ){
 printf( StarOffice.ServiceManager is not exported from remote 
counterpart\n );
 return NULL;
  }

  // query for the simpler XMultiServiceFactory interface, sufficient for 
scripting
  Reference XMultiServiceFactory  rOfficeServiceManager (rInstance, 
UNO_QUERY);

  if( ! rOfficeServiceManager.is() ){
printf( XMultiServiceFactory interface is not exported for 
StarOffice.ServiceManager\n );
return NULL;
}   
return rOfficeServiceManager;