LCOV - code coverage report
Current view: top level - filter/source/placeware - filter.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 46 0.0 %
Date: 2014-11-03 Functions: 0 13 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             : #include <com/sun/star/document/XFilter.hpp>
      21             : #include <com/sun/star/document/XExporter.hpp>
      22             : #include <com/sun/star/lang/XInitialization.hpp>
      23             : #include <com/sun/star/lang/XServiceInfo.hpp>
      24             : #include <cppuhelper/implbase4.hxx>
      25             : #include <cppuhelper/supportsservice.hxx>
      26             : #include <comphelper/processfactory.hxx>
      27             : 
      28             : #include "exporter.hxx"
      29             : #include "filter.hxx"
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::lang;
      33             : 
      34             : using ::com::sun::star::lang::XComponent;
      35             : using ::com::sun::star::beans::PropertyValue;
      36             : using ::com::sun::star::io::XOutputStream;
      37             : using ::com::sun::star::task::XStatusIndicator;
      38             : 
      39             : namespace pwp {
      40             : 
      41             : 
      42             : 
      43           0 : class PlaceWareExportFilter : public cppu::WeakImplHelper4
      44             : <
      45             :     com::sun::star::document::XFilter,
      46             :     com::sun::star::document::XExporter,
      47             :     com::sun::star::lang::XInitialization,
      48             :     com::sun::star::lang::XServiceInfo
      49             : >
      50             : {
      51             :     Reference< XComponent > mxDoc;
      52             :     Reference< XComponentContext > mxContext;
      53             : 
      54             : public:
      55             :     PlaceWareExportFilter( const Reference< XComponentContext > &rxContext);
      56             : 
      57             :     // XFilter
      58             :     virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
      59             :     virtual void SAL_CALL cancel( ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
      60             : 
      61             :     // XExporter
      62             :     virtual void SAL_CALL setSourceDocument( const Reference< XComponent >& xDoc ) throw(IllegalArgumentException, RuntimeException, std::exception) SAL_OVERRIDE;
      63             : 
      64             :     // XInitialization
      65             :     virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException, std::exception) SAL_OVERRIDE;
      66             : 
      67             :     // XServiceInfo
      68             :     virtual OUString SAL_CALL getImplementationName() throw(RuntimeException, std::exception) SAL_OVERRIDE;
      69             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
      70             :     virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()  throw(RuntimeException, std::exception) SAL_OVERRIDE;
      71             : };
      72             : 
      73             : 
      74             : 
      75           0 : PlaceWareExportFilter::PlaceWareExportFilter(const Reference< XComponentContext > &rxContext)
      76           0 : :   mxContext( rxContext )
      77             : {
      78           0 : }
      79             : 
      80             : 
      81             : 
      82           0 : sal_Bool SAL_CALL PlaceWareExportFilter::filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
      83             :     throw (RuntimeException, std::exception)
      84             : {
      85           0 :     sal_Int32 nLength = aDescriptor.getLength();
      86           0 :     const PropertyValue * pValue = aDescriptor.getConstArray();
      87           0 :     OUString sURL;
      88           0 :     Reference < XInterface > xInteractionHandler;
      89           0 :     Reference < XOutputStream > xOutputStream;
      90           0 :     Reference < XStatusIndicator > xStatusIndicator;
      91           0 :     for ( sal_Int32 i = 0 ; i < nLength; i++)
      92             :     {
      93           0 :         if ( pValue[i].Name == "OutputStream" )
      94             :         {
      95           0 :             pValue[i].Value >>= xOutputStream;
      96             :         }
      97           0 :         else if( pValue[i].Name == "URL" )
      98             :         {
      99           0 :             pValue[i].Value >>= sURL;
     100             :         }
     101           0 :         else if( pValue[i].Name == "InteractionHandler" )
     102             :         {
     103           0 :             pValue[i].Value >>= xInteractionHandler;
     104             :         }
     105           0 :         else if ( pValue[i].Name == "StatusIndicator" )
     106             :         {
     107           0 :             pValue[i].Value >>= xStatusIndicator;
     108             :         }
     109             :     }
     110           0 :     if ( !xOutputStream.is() )
     111             :     {
     112             :         OSL_ASSERT ( false );
     113           0 :         return sal_False;
     114             :     }
     115             : 
     116           0 :     PlaceWareExporter aExporter( mxContext );
     117           0 :     return aExporter.doExport( mxDoc, xOutputStream, sURL, xInteractionHandler, xStatusIndicator );
     118             : }
     119             : 
     120             : 
     121             : 
     122           0 : void SAL_CALL PlaceWareExportFilter::cancel(  )
     123             :     throw (RuntimeException, std::exception)
     124             : {
     125           0 : }
     126             : 
     127             : 
     128             : 
     129             : // XExporter
     130           0 : void SAL_CALL PlaceWareExportFilter::setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
     131             :     throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException, std::exception)
     132             : {
     133           0 :     mxDoc = xDoc;
     134           0 : }
     135             : 
     136             : 
     137             : 
     138             : // XInitialization
     139           0 : void SAL_CALL PlaceWareExportFilter::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& /* aArguments */ )
     140             :     throw (Exception, RuntimeException, std::exception)
     141             : {
     142           0 : }
     143             : 
     144           0 : OUString PlaceWareExportFilter_getImplementationName ()
     145             :     throw (RuntimeException)
     146             : {
     147           0 :     return OUString( "com.sun.star.comp.Impress.PlaceWareExportFilter" );
     148             : }
     149             : 
     150           0 : Sequence< OUString > SAL_CALL PlaceWareExportFilter_getSupportedServiceNames(  )
     151             :     throw (RuntimeException)
     152             : {
     153           0 :     Sequence < OUString > aRet(1);
     154           0 :     OUString* pArray = aRet.getArray();
     155           0 :     pArray[0] =  "com.sun.star.document.ExportFilter";
     156           0 :     return aRet;
     157             : }
     158             : 
     159           0 : Reference< XInterface > SAL_CALL PlaceWareExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
     160             :     throw( Exception )
     161             : {
     162           0 :     return (cppu::OWeakObject*) new PlaceWareExportFilter( comphelper::getComponentContext(rSMgr) );
     163             : }
     164             : 
     165             : // XServiceInfo
     166           0 : OUString SAL_CALL PlaceWareExportFilter::getImplementationName(  )
     167             :     throw (RuntimeException, std::exception)
     168             : {
     169           0 :     return PlaceWareExportFilter_getImplementationName();
     170             : }
     171             : 
     172           0 : sal_Bool SAL_CALL PlaceWareExportFilter::supportsService( const OUString& rServiceName )
     173             :     throw (RuntimeException, std::exception)
     174             : {
     175           0 :     return cppu::supportsService( this, rServiceName );
     176             : }
     177             : 
     178           0 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL PlaceWareExportFilter::getSupportedServiceNames(  )
     179             :     throw (RuntimeException, std::exception)
     180             : {
     181           0 :     return PlaceWareExportFilter_getSupportedServiceNames();
     182             : }
     183             : 
     184             : 
     185             : 
     186             : }
     187             : 
     188             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10