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

Generated by: LCOV version 1.10