Make pdf2xml usable at least from within buildenv again.
Seems this had bitrotted quite a lot. Calling it now like a cppunit test works again. Change-Id: I27479c3c3e1c1fe0639629e9bf8844456e0b0515
This commit is contained in:
@@ -26,6 +26,8 @@ $(eval $(call gb_Executable_use_libraries,pdf2xml,\
|
|||||||
vcl \
|
vcl \
|
||||||
comphelper \
|
comphelper \
|
||||||
cppu \
|
cppu \
|
||||||
|
unotest \
|
||||||
|
test \
|
||||||
cppuhelper \
|
cppuhelper \
|
||||||
sal \
|
sal \
|
||||||
))
|
))
|
||||||
|
@@ -27,17 +27,16 @@
|
|||||||
|
|
||||||
#include <sal/main.h>
|
#include <sal/main.h>
|
||||||
#include <osl/process.h>
|
#include <osl/process.h>
|
||||||
#include <rtl/bootstrap.hxx>
|
#include <unotest/bootstrapfixturebase.hxx>
|
||||||
|
|
||||||
#include <cppuhelper/bootstrap.hxx>
|
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
|
#include <cppuhelper/bootstrap.hxx>
|
||||||
|
|
||||||
using namespace ::pdfi;
|
using namespace ::pdfi;
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
|
|
||||||
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
|
SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
|
||||||
{
|
{
|
||||||
if( argc != 5 )
|
if( argc < 4 )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
OUString aBaseURL, aTmpURL, aSrcURL, aDstURL, aIniUrl;
|
OUString aBaseURL, aTmpURL, aSrcURL, aDstURL, aIniUrl;
|
||||||
@@ -61,32 +60,17 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
|
|||||||
&aTmpURL.pData );
|
&aTmpURL.pData );
|
||||||
osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData);
|
osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData);
|
||||||
|
|
||||||
osl_getFileURLFromSystemPath( OUString::createFromAscii(argv[4]).pData,
|
|
||||||
&aTmpURL.pData );
|
|
||||||
osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aIniUrl.pData);
|
|
||||||
|
|
||||||
// bootstrap UNO
|
// bootstrap UNO
|
||||||
uno::Reference< lang::XMultiServiceFactory > xFactory;
|
uno::Reference< uno::XComponentContext > xContext(
|
||||||
uno::Reference< uno::XComponentContext > xCtx;
|
cppu::defaultBootstrap_InitialComponentContext() );
|
||||||
try
|
uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager());
|
||||||
{
|
uno::Reference<lang::XMultiServiceFactory> xSM(xFactory, uno::UNO_QUERY_THROW);
|
||||||
xCtx = ::cppu::defaultBootstrap_InitialComponentContext(aIniUrl);
|
comphelper::setProcessServiceFactory(xSM);
|
||||||
xFactory = uno::Reference< lang::XMultiServiceFactory >( xCtx->getServiceManager(),
|
|
||||||
uno::UNO_QUERY );
|
|
||||||
if( xFactory.is() )
|
|
||||||
::comphelper::setProcessServiceFactory( xFactory );
|
|
||||||
}
|
|
||||||
catch( uno::Exception& )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !xFactory.is() )
|
test::BootstrapFixtureBase aEnv;
|
||||||
{
|
aEnv.setUp();
|
||||||
OSL_TRACE( "Could not bootstrap UNO, installation must be in disorder. Exiting." );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
pdfi::PDFIRawAdaptor aAdaptor( xCtx );
|
pdfi::PDFIRawAdaptor aAdaptor( aEnv.getComponentContext() );
|
||||||
aAdaptor.setTreeVisitorFactory(pTreeFactory);
|
aAdaptor.setTreeVisitorFactory(pTreeFactory);
|
||||||
aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL );
|
aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user