LCOV - code coverage report
Current view: top level - filter/source/xmlfilteradaptor - XmlFilterAdaptor.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 4 100.0 %
Date: 2015-06-13 12:38:46 Functions: 3 3 100.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             : #ifndef INCLUDED_FILTER_SOURCE_XMLFILTERADAPTOR_XMLFILTERADAPTOR_HXX
      21             : #define INCLUDED_FILTER_SOURCE_XMLFILTERADAPTOR_XMLFILTERADAPTOR_HXX
      22             : 
      23             : 
      24             : #include <com/sun/star/document/XFilter.hpp>
      25             : #include <com/sun/star/document/XExporter.hpp>
      26             : #include <com/sun/star/document/XImporter.hpp>
      27             : #include <com/sun/star/lang/XInitialization.hpp>
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      30             : #include <com/sun/star/uno/XComponentContext.hpp>
      31             : #include <cppuhelper/implbase5.hxx>
      32             : 
      33             : 
      34             : 
      35             : enum FilterType
      36             : {
      37             :     FILTER_IMPORT,
      38             :     FILTER_EXPORT
      39             : };
      40             : 
      41             : /* This component will be instantiated for both import or export. Whether it calls
      42             :  * setSourceDocument or setTargetDocument determines which Impl function the filter
      43             :  * member calls */
      44             : 
      45             : class XmlFilterAdaptor : public cppu::WeakImplHelper5
      46             : <
      47             :     com::sun::star::document::XFilter,
      48             :     com::sun::star::document::XExporter,
      49             :     com::sun::star::document::XImporter,
      50             :     com::sun::star::lang::XInitialization,
      51             :     com::sun::star::lang::XServiceInfo
      52             : >
      53             : {
      54             : 
      55             : protected:
      56             : 
      57             :   ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
      58             : 
      59             :   ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
      60             : 
      61             :   OUString msFilterName;
      62             : 
      63             :   ::com::sun::star::uno::Sequence< OUString > msUserData;
      64             : 
      65             :    OUString msTemplateName;
      66             : 
      67             :     FilterType meType;
      68             : 
      69             :     bool SAL_CALL exportImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
      70             :         throw (::com::sun::star::uno::RuntimeException);
      71             : 
      72             :     bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
      73             :         throw (::com::sun::star::uno::RuntimeException);
      74             : 
      75             : 
      76             : 
      77             : public:
      78             : 
      79          18 :     XmlFilterAdaptor( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext)
      80             :         : mxContext(rxContext)
      81          18 :         , meType(FILTER_IMPORT)
      82             :     {
      83          18 :     }
      84             : 
      85          36 :     virtual ~XmlFilterAdaptor() {}
      86             : 
      87             : 
      88             : 
      89             :     // XFilter
      90             : 
      91             :     virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
      92             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             : 
      94             :     virtual void SAL_CALL cancel(  )
      95             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             : 
      97             : 
      98             : 
      99             :     // XExporter
     100             : 
     101             :     virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
     102             :         throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             : 
     104             : 
     105             : 
     106             :     // XImporter
     107             : 
     108             :     virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
     109             : 
     110             :         throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             : 
     112             : 
     113             : 
     114             :     // XInitialization
     115             : 
     116             :     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
     117             : 
     118             :         throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     119             : 
     120             : 
     121             : 
     122             :     // XServiceInfo
     123             : 
     124             :     virtual OUString SAL_CALL getImplementationName(  )
     125             : 
     126             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     127             : 
     128             :     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
     129             : 
     130             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     131             : 
     132             :     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  )
     133             : 
     134             :         throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     135             : 
     136             : };
     137             : 
     138             : 
     139             : 
     140             : OUString XmlFilterAdaptor_getImplementationName()
     141             :     throw ( ::com::sun::star::uno::RuntimeException );
     142             : 
     143             : 
     144             : 
     145             : bool SAL_CALL XmlFilterAdaptor_supportsService( const OUString& ServiceName )
     146             :     throw ( ::com::sun::star::uno::RuntimeException );
     147             : 
     148             : 
     149             : 
     150             : ::com::sun::star::uno::Sequence< OUString > SAL_CALL XmlFilterAdaptor_getSupportedServiceNames(  )
     151             :     throw ( ::com::sun::star::uno::RuntimeException );
     152             : 
     153             : 
     154             : 
     155             : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
     156             : 
     157             : SAL_CALL XmlFilterAdaptor_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
     158             : 
     159             :     throw ( ::com::sun::star::uno::Exception );
     160             : 
     161             : 
     162             : 
     163             : #endif
     164             : 
     165             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11