LCOV - code coverage report
Current view: top level - sdext/source/pdfimport/test - pdf2xml.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-08-25 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "outputwrap.hxx"
      31                 :            : #include "contentsink.hxx"
      32                 :            : #include "pdfihelper.hxx"
      33                 :            : #include "wrapper.hxx"
      34                 :            : #include "pdfparse.hxx"
      35                 :            : #include "../pdfiadaptor.hxx"
      36                 :            : 
      37                 :            : #include <sal/main.h>
      38                 :            : #include <osl/process.h>
      39                 :            : #include <rtl/bootstrap.hxx>
      40                 :            : 
      41                 :            : #include <cppuhelper/bootstrap.hxx>
      42                 :            : #include <cppuhelper/servicefactory.hxx>
      43                 :            : #include <comphelper/processfactory.hxx>
      44                 :            : 
      45                 :            : using namespace ::pdfi;
      46                 :            : using namespace ::com::sun::star;
      47                 :            : 
      48                 :          0 : SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
      49                 :            : {
      50                 :          0 :     if( argc != 5 )
      51                 :          0 :         return 1;
      52                 :            : 
      53                 :          0 :     ::rtl::OUString aBaseURL, aTmpURL, aSrcURL, aDstURL, aIniUrl;
      54                 :            : 
      55                 :          0 :     TreeVisitorFactorySharedPtr pTreeFactory;
      56                 :          0 :     if( rtl_str_compare(argv[1], "-writer") == 0 )
      57                 :          0 :         pTreeFactory = createWriterTreeVisitorFactory();
      58                 :          0 :     else if( rtl_str_compare(argv[1], "-draw") == 0 )
      59                 :          0 :         pTreeFactory = createDrawTreeVisitorFactory();
      60                 :          0 :     else if( rtl_str_compare(argv[1], "-impress") == 0 )
      61                 :          0 :         pTreeFactory = createImpressTreeVisitorFactory();
      62                 :            :     else
      63                 :          0 :         return 1;
      64                 :            : 
      65                 :          0 :     osl_getProcessWorkingDir(&aBaseURL.pData);
      66                 :          0 :     osl_getFileURLFromSystemPath( rtl::OUString::createFromAscii(argv[2]).pData,
      67                 :          0 :                                   &aTmpURL.pData );
      68                 :          0 :     osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aSrcURL.pData);
      69                 :            : 
      70                 :          0 :     osl_getFileURLFromSystemPath( rtl::OUString::createFromAscii(argv[3]).pData,
      71                 :          0 :                                   &aTmpURL.pData );
      72                 :          0 :     osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aDstURL.pData);
      73                 :            : 
      74                 :          0 :     osl_getFileURLFromSystemPath( rtl::OUString::createFromAscii(argv[4]).pData,
      75                 :          0 :                                 &aTmpURL.pData );
      76                 :          0 :     osl_getAbsoluteFileURL(aBaseURL.pData,aTmpURL.pData,&aIniUrl.pData);
      77                 :            : 
      78                 :            :     // bootstrap UNO
      79                 :          0 :     uno::Reference< lang::XMultiServiceFactory > xFactory;
      80                 :          0 :     uno::Reference< uno::XComponentContext > xCtx;
      81                 :            :     try
      82                 :            :     {
      83                 :          0 :         xCtx = ::cppu::defaultBootstrap_InitialComponentContext(aIniUrl);
      84                 :          0 :         xFactory = uno::Reference< lang::XMultiServiceFactory >(  xCtx->getServiceManager(),
      85                 :          0 :                                                                   uno::UNO_QUERY );
      86                 :          0 :         if( xFactory.is() )
      87                 :          0 :             ::comphelper::setProcessServiceFactory( xFactory );
      88                 :            :     }
      89                 :          0 :     catch( uno::Exception& )
      90                 :            :     {
      91                 :            :     }
      92                 :            : 
      93                 :          0 :     if( !xFactory.is() )
      94                 :            :     {
      95                 :            :         OSL_TRACE( "Could not bootstrap UNO, installation must be in disorder. Exiting." );
      96                 :          0 :         return 1;
      97                 :            :     }
      98                 :            : 
      99                 :          0 :     pdfi::PDFIRawAdaptor aAdaptor( xCtx );
     100                 :          0 :     aAdaptor.setTreeVisitorFactory(pTreeFactory);
     101                 :          0 :     aAdaptor.odfConvert( aSrcURL, new OutputWrap(aDstURL), NULL );
     102                 :            : 
     103                 :          0 :     return 0;
     104                 :            : }
     105                 :            : 
     106                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10