LCOV - code coverage report
Current view: top level - writerfilter/unocomponent/debugservices/ooxml - OOXMLTestService.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-08-25 Functions: 0 7 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                 :            :  * 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                 :            : #include <cppuhelper/implbase1.hxx>
      21                 :            : #include <com/sun/star/lang/XMain.hpp>
      22                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      23                 :            : #include <comphelper/processfactory.hxx>
      24                 :            : 
      25                 :            : #include "OOXMLTestService.hxx"
      26                 :            : #include <stdio.h>
      27                 :            : #include <wchar.h>
      28                 :            : #include <com/sun/star/io/XStream.hpp>
      29                 :            : #include <com/sun/star/io/XInputStream.hpp>
      30                 :            : #include <com/sun/star/io/XSeekable.hpp>
      31                 :            : #include <com/sun/star/io/XTruncate.hpp>
      32                 :            : #include <com/sun/star/task/XStatusIndicator.hpp>
      33                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      34                 :            : #include <ucbhelper/contentbroker.hxx>
      35                 :            : #include <com/sun/star/ucb/SimpleFileAccess.hpp>
      36                 :            : #include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
      37                 :            : #include <osl/process.h>
      38                 :            : #include <rtl/string.hxx>
      39                 :            : #include <boost/unordered_set.hpp>
      40                 :            : #include <assert.h>
      41                 :            : #include <cppuhelper/implbase2.hxx>
      42                 :            : #include <cppuhelper/bootstrap.hxx>
      43                 :            : #include <com/sun/star/embed/XTransactedObject.hpp>
      44                 :            : #include <com/sun/star/embed/XStorage.hpp>
      45                 :            : #include <com/sun/star/util/XCloseable.hpp>
      46                 :            : #include <comphelper/storagehelper.hxx>
      47                 :            : #include <com/sun/star/beans/PropertyValue.hpp>
      48                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      49                 :            : #include <comphelper/seqstream.hxx>
      50                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      51                 :            : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
      52                 :            : #include <com/sun/star/uno/Any.hxx>
      53                 :            : #include <com/sun/star/text/XTextDocument.hpp>
      54                 :            : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
      55                 :            : #include <ooxml/OOXMLDocument.hxx>
      56                 :            : #include <resourcemodel/TagLogger.hxx>
      57                 :            : 
      58                 :            : #include <ctype.h>
      59                 :            : 
      60                 :            : using namespace ::com::sun::star;
      61                 :            : 
      62                 :            : namespace writerfilter { namespace ooxmltest  {
      63                 :            : 
      64                 :            : const sal_Char ScannerTestService::SERVICE_NAME[40] = "debugservices.ooxml.ScannerTestService";
      65                 :            : const sal_Char ScannerTestService::IMPLEMENTATION_NAME[40] = "debugservices.ooxml.ScannerTestService";
      66                 :            : 
      67                 :            : 
      68                 :            : 
      69                 :            : 
      70                 :          0 : ScannerTestService::ScannerTestService(const uno::Reference< uno::XComponentContext > &xContext_) :
      71                 :          0 : xContext( xContext_ )
      72                 :            : {
      73                 :          0 : }
      74                 :            : 
      75                 :          0 : sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< OUString >& aArguments ) throw (uno::RuntimeException)
      76                 :            : {
      77                 :          0 :     uno::Sequence<uno::Any> aUcbInitSequence(2);
      78                 :          0 :     aUcbInitSequence[0] <<= OUString("Local");
      79                 :          0 :     aUcbInitSequence[1] <<= OUString("Office");
      80                 :          0 :     uno::Reference<lang::XMultiServiceFactory> xServiceFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
      81                 :          0 :     uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW );
      82                 :          0 :     if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence))
      83                 :            :     {
      84                 :            : #ifdef DEBUG_ELEMENT
      85                 :            :         writerfilter::TagLogger::Pointer_t debugLogger
      86                 :            :         (writerfilter::TagLogger::getInstance("DEBUG"));
      87                 :            :         debugLogger->startDocument();
      88                 :            : #endif
      89                 :            : 
      90                 :          0 :         OUString arg=aArguments[0];
      91                 :            : 
      92                 :          0 :         ::comphelper::setProcessServiceFactory(xServiceFactory);
      93                 :            : 
      94                 :          0 :         uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
      95                 :            : 
      96                 :          0 :         rtl_uString *dir=NULL;
      97                 :          0 :         osl_getProcessWorkingDir(&dir);
      98                 :          0 :         OUString absFileUrl;
      99                 :          0 :         osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
     100                 :          0 :         rtl_uString_release(dir);
     101                 :            : 
     102                 :            :         uno::Reference<io::XInputStream> xInputStream =
     103                 :          0 :             xFileAccess->openFileRead(absFileUrl);
     104                 :            :         ooxml::OOXMLStream::Pointer_t pDocStream =
     105                 :          0 :             ooxml::OOXMLDocumentFactory::createStream(xContext, xInputStream);
     106                 :            : 
     107                 :            :         ooxml::OOXMLDocument::Pointer_t pDocument
     108                 :          0 :             (ooxml::OOXMLDocumentFactory::createDocument(pDocStream));
     109                 :            : 
     110                 :          0 :         Stream::Pointer_t pStream = createStreamHandler();
     111                 :          0 :         pDocument->resolve(*pStream);
     112                 :            : 
     113                 :            : #ifdef DEBUG_ELEMENT
     114                 :            :         debugLogger->endDocument();
     115                 :            : #endif
     116                 :            : 
     117                 :          0 :         ::ucbhelper::ContentBroker::deinitialize();
     118                 :            :     }
     119                 :            :     else
     120                 :            :     {
     121                 :          0 :         fprintf(stderr, "can't initialize UCB");
     122                 :            :     }
     123                 :          0 :     return 0;
     124                 :            : }
     125                 :            : 
     126                 :          0 : OUString ScannerTestService_getImplementationName ()
     127                 :            : {
     128                 :          0 :     return OUString(ScannerTestService::IMPLEMENTATION_NAME );
     129                 :            : }
     130                 :            : 
     131                 :          0 : uno::Sequence< OUString > SAL_CALL ScannerTestService_getSupportedServiceNames(  ) throw (uno::RuntimeException)
     132                 :            : {
     133                 :          0 :     uno::Sequence < OUString > aRet(1);
     134                 :          0 :     OUString* pArray = aRet.getArray();
     135                 :          0 :     pArray[0] =  OUString(ScannerTestService::SERVICE_NAME );
     136                 :          0 :     return aRet;
     137                 :            : }
     138                 :            : 
     139                 :          0 : uno::Reference< uno::XInterface > SAL_CALL ScannerTestService_createInstance( const uno::Reference< uno::XComponentContext > & xContext) throw( uno::Exception )
     140                 :            : {
     141                 :          0 :     return (cppu::OWeakObject*) new ScannerTestService( xContext );
     142                 :            : }
     143                 :            : 
     144                 :          0 : } } /* end namespace writerfilter::ooxml */
     145                 :            : 
     146                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10