LCOV - code coverage report
Current view: top level - libreoffice/sdext/source/pdfimport/test - pdf2xml.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-17 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "outputwrap.hxx"
      22             : #include "contentsink.hxx"
      23             : #include "pdfihelper.hxx"
      24             : #include "wrapper.hxx"
      25             : #include "pdfparse.hxx"
      26             : #include "../pdfiadaptor.hxx"
      27             : 
      28             : #include <sal/main.h>
      29             : #include <osl/process.h>
      30             : #include <rtl/bootstrap.hxx>
      31             : 
      32             : #include <cppuhelper/bootstrap.hxx>
      33             : #include <cppuhelper/servicefactory.hxx>
      34             : #include <comphelper/processfactory.hxx>
      35             : 
      36             : using namespace ::pdfi;
      37             : using namespace ::com::sun::star;
      38             : 
      39           0 : SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
      40             : {
      41           0 :     if( argc != 5 )
      42           0 :         return 1;
      43             : 
      44           0 :     ::rtl::OUString aBaseURL, aTmpURL, aSrcURL, aDstURL, aIniUrl;
      45             : 
      46           0 :     TreeVisitorFactorySharedPtr pTreeFactory;
      47           0 :     if( rtl_str_compare(argv[1], "-writer") == 0 )
      48           0 :         pTreeFactory = createWriterTreeVisitorFactory();
      49           0 :     else if( rtl_str_compare(argv[1], "-draw") == 0 )
      50           0 :         pTreeFactory = createDrawTreeVisitorFactory();
      51           0 :     else if( rtl_str_compare(argv[1], "-impress") == 0 )
      52           0 :         pTreeFactory = createImpressTreeVisitorFactory();
      53             :     else
      54           0 :         return 1;
      55             : 
      56           0 :     osl_getProcessWorkingDir(&aBaseURL.pData);
      57           0 :     osl_getFileURLFromSystemPath( rtl::OUString::createFromAscii(argv[2]).pData,
      58           0 :                                   &aTmpURL.pData );
      59           0 :     osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aSrcURL.pData);
      60             : 
      61           0 :     osl_getFileURLFromSystemPath( rtl::OUString::createFromAscii(argv[3]).pData,
      62           0 :                                   &aTmpURL.pData );
      63           0 :     osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData);
      64             : 
      65           0 :     osl_getFileURLFromSystemPath( rtl::OUString::createFromAscii(argv[4]).pData,
      66           0 :                                 &aTmpURL.pData );
      67           0 :     osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aIniUrl.pData);
      68             : 
      69             :     // bootstrap UNO
      70           0 :     uno::Reference< lang::XMultiServiceFactory > xFactory;
      71           0 :     uno::Reference< uno::XComponentContext > xCtx;
      72             :     try
      73             :     {
      74           0 :         xCtx = ::cppu::defaultBootstrap_InitialComponentContext(aIniUrl);
      75           0 :         xFactory = uno::Reference< lang::XMultiServiceFactory >(  xCtx->getServiceManager(),
      76           0 :                                                                   uno::UNO_QUERY );
      77           0 :         if( xFactory.is() )
      78           0 :             ::comphelper::setProcessServiceFactory( xFactory );
      79             :     }
      80           0 :     catch( uno::Exception& )
      81             :     {
      82             :     }
      83             : 
      84           0 :     if( !xFactory.is() )
      85             :     {
      86             :         OSL_TRACE( "Could not bootstrap UNO, installation must be in disorder. Exiting." );
      87           0 :         return 1;
      88             :     }
      89             : 
      90           0 :     pdfi::PDFIRawAdaptor aAdaptor( xCtx );
      91           0 :     aAdaptor.setTreeVisitorFactory(pTreeFactory);
      92           0 :     aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL );
      93             : 
      94           0 :     return 0;
      95             : }
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10