26#include "../pdfiadaptor.hxx"
29#include <osl/process.h>
37using namespace ::
pdfi;
49 OUString aBaseURL, aTmpURL, aSrcURL, aDstURL;
52 if( rtl_str_compare(argv[1],
"-writer") == 0 )
54 else if( rtl_str_compare(argv[1],
"-draw") == 0 )
56 else if( rtl_str_compare(argv[1],
"-impress") == 0 )
61 osl_getProcessWorkingDir(&aBaseURL.pData);
62 osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[2]).
pData,
64 osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aSrcURL.pData);
66 osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[3]).
pData,
68 osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData);
71 uno::Reference< uno::XComponentContext > xContext(
73 uno::Reference<lang::XMultiComponentFactory>
xFactory(xContext->getServiceManager());
74 uno::Reference<lang::XMultiServiceFactory> xSM(
xFactory, uno::UNO_QUERY_THROW);
81 xAdaptor->setTreeVisitorFactory(pTreeFactory);
82 nRet = xAdaptor->odfConvert(aSrcURL,
new OutputWrap(aDstURL),
nullptr) ? 0 : 1;
84 catch (
const uno::Exception&)
89 catch (
const std::exception& e)
91 SAL_WARN(
"vcl.app",
"Fatal: " << e.what());
Adapts raw pdf import to XImportFilter interface.
virtual void setUp() override
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XSingleServiceFactory > xFactory
#define SAL_WARN(area, stream)
std::unique_ptr< sal_Int32[]> pData
void setProcessServiceFactory(const Reference< XMultiServiceFactory > &xSMgr)
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext()
std::shared_ptr< TreeVisitorFactory > TreeVisitorFactorySharedPtr
TreeVisitorFactorySharedPtr createWriterTreeVisitorFactory()
TreeVisitorFactorySharedPtr createDrawTreeVisitorFactory()
TreeVisitorFactorySharedPtr createImpressTreeVisitorFactory()
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)