LCOV - code coverage report
Current view: top level - chart2/source/model/inc - XMLFilter.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 20 15.0 %
Date: 2012-08-25 Functions: 2 10 20.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 6 16.7 %

           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                 :            : #ifndef CHART2_XMLFILTER_HXX
      20                 :            : #define CHART2_XMLFILTER_HXX
      21                 :            : 
      22                 :            : #include <cppuhelper/implbase4.hxx>
      23                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      24                 :            : #include <com/sun/star/document/XFilter.hpp>
      25                 :            : #include <com/sun/star/document/XImporter.hpp>
      26                 :            : #include <com/sun/star/document/XExporter.hpp>
      27                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      28                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      29                 :            : #include <com/sun/star/io/XActiveDataSource.hpp>
      30                 :            : #include <osl/mutex.hxx>
      31                 :            : 
      32                 :            : // for APPHELPER_... macros
      33                 :            : #include "ServiceMacros.hxx"
      34                 :            : 
      35                 :            : namespace com { namespace sun { namespace star {
      36                 :            : namespace embed
      37                 :            : {
      38                 :            :     class XStorage;
      39                 :            : }
      40                 :            : namespace xml { namespace sax
      41                 :            : {
      42                 :            :     class XParser;
      43                 :            : }}
      44                 :            : namespace document
      45                 :            : {
      46                 :            :     class XGraphicObjectResolver;
      47                 :            : }
      48                 :            : }}}
      49                 :            : 
      50                 :            : namespace chart
      51                 :            : {
      52                 :            : 
      53                 :            : class XMLFilter : public
      54                 :            :     ::cppu::WeakImplHelper4<
      55                 :            :         ::com::sun::star::document::XFilter,
      56                 :            :         ::com::sun::star::document::XExporter,
      57                 :            :         ::com::sun::star::document::XImporter,
      58                 :            :         ::com::sun::star::lang::XServiceInfo >
      59                 :            : {
      60                 :            : public:
      61                 :            :     explicit XMLFilter( ::com::sun::star::uno::Reference<
      62                 :            :                             ::com::sun::star::uno::XComponentContext > const & xContext );
      63                 :            :     virtual ~XMLFilter();
      64                 :            : 
      65                 :            :     /// establish methods for factory instatiation
      66         [ +  - ]:         21 :     APPHELPER_SERVICE_FACTORY_HELPER( XMLFilter )
      67                 :            :     /// XServiceInfo declarations
      68                 :            :     APPHELPER_XSERVICEINFO_DECL()
      69                 :            : 
      70                 :            : protected:
      71                 :            :     // ____ XFilter ____
      72                 :            :     virtual sal_Bool SAL_CALL filter(
      73                 :            :         const ::com::sun::star::uno::Sequence<
      74                 :            :             ::com::sun::star::beans::PropertyValue >& aDescriptor )
      75                 :            :         throw (::com::sun::star::uno::RuntimeException);
      76                 :            :     virtual void SAL_CALL cancel()
      77                 :            :         throw (::com::sun::star::uno::RuntimeException);
      78                 :            : 
      79                 :            :     // ____ XImporter ____
      80                 :            :     virtual void SAL_CALL setTargetDocument(
      81                 :            :         const ::com::sun::star::uno::Reference<
      82                 :            :             ::com::sun::star::lang::XComponent >& Document )
      83                 :            :         throw (::com::sun::star::lang::IllegalArgumentException,
      84                 :            :                ::com::sun::star::uno::RuntimeException);
      85                 :            : 
      86                 :            :     // ____ XExporter ____
      87                 :            :     virtual void SAL_CALL setSourceDocument(
      88                 :            :         const ::com::sun::star::uno::Reference<
      89                 :            :             ::com::sun::star::lang::XComponent >& Document )
      90                 :            :         throw (::com::sun::star::lang::IllegalArgumentException,
      91                 :            :                ::com::sun::star::uno::RuntimeException);
      92                 :            : 
      93                 :            :     inline ::rtl::OUString getDocumentHandler() const { return m_sDocumentHandler; }
      94                 :          0 :     inline void setDocumentHandler(const ::rtl::OUString& _sDocumentHandler) { m_sDocumentHandler = _sDocumentHandler; }
      95                 :            : 
      96                 :            :     virtual ::rtl::OUString getMediaType(bool _bOasis);
      97                 :            : 
      98                 :            :     /** fills the oasis flag only when a filtername was set
      99                 :            :     *
     100                 :            :     * \param _rMediaDescriptor
     101                 :            :     * \param _rOutOASIS
     102                 :            :     */
     103                 :            :     virtual void isOasisFormat(const ::com::sun::star::uno::Sequence<
     104                 :            :             ::com::sun::star::beans::PropertyValue >& _rMediaDescriptor, bool & _rOutOASIS );
     105                 :            : 
     106                 :            : private:
     107                 :            :     // methods
     108                 :            : 
     109                 :            :     /// @return a warning code, or 0 for successful operation
     110                 :            :     sal_Int32 impl_Import( const ::com::sun::star::uno::Reference<
     111                 :            :                                ::com::sun::star::lang::XComponent > & xDocumentComp,
     112                 :            :                            const ::com::sun::star::uno::Sequence<
     113                 :            :                                ::com::sun::star::beans::PropertyValue > & aMediaDescriptor );
     114                 :            :     /// @return a warning code, or 0 for successful operation
     115                 :            :     sal_Int32 impl_ImportStream(
     116                 :            :         const ::rtl::OUString & rStreamName,
     117                 :            :         const ::rtl::OUString & rServiceName,
     118                 :            :         const ::com::sun::star::uno::Reference<
     119                 :            :             ::com::sun::star::embed::XStorage > & xStorage,
     120                 :            :         const ::com::sun::star::uno::Reference<
     121                 :            :             ::com::sun::star::xml::sax::XParser > & xParser,
     122                 :            :         const ::com::sun::star::uno::Reference<
     123                 :            :             ::com::sun::star::lang::XMultiComponentFactory > & xFactory,
     124                 :            :         const ::com::sun::star::uno::Reference<
     125                 :            :             ::com::sun::star::document::XGraphicObjectResolver > & xGraphicObjectResolver,
     126                 :            :         ::com::sun::star::uno::Reference<
     127                 :            :             ::com::sun::star::beans::XPropertySet >& xPropSet );
     128                 :            : 
     129                 :            :     /// @return a warning code, or 0 for successful operation
     130                 :            :     sal_Int32 impl_Export( const ::com::sun::star::uno::Reference<
     131                 :            :                                ::com::sun::star::lang::XComponent > & xDocumentComp,
     132                 :            :                            const ::com::sun::star::uno::Sequence<
     133                 :            :                                ::com::sun::star::beans::PropertyValue > & aMediaDescriptor );
     134                 :            :     /// @return a warning code, or 0 for successful operation
     135                 :            :     sal_Int32 impl_ExportStream(
     136                 :            :         const ::rtl::OUString & rStreamName,
     137                 :            :         const ::rtl::OUString & rServiceName,
     138                 :            :         const ::com::sun::star::uno::Reference<
     139                 :            :             ::com::sun::star::embed::XStorage > & xStorage,
     140                 :            :         const ::com::sun::star::uno::Reference<
     141                 :            :             ::com::sun::star::io::XActiveDataSource >& xActiveDataSource,
     142                 :            :         const ::com::sun::star::uno::Reference<
     143                 :            :             ::com::sun::star::lang::XMultiServiceFactory > & xFactory,
     144                 :            :         const ::com::sun::star::uno::Sequence<
     145                 :            :             ::com::sun::star::uno::Any > & rFilterProperties );
     146                 :            : 
     147                 :            :     // members
     148                 :            :     ::com::sun::star::uno::Reference<
     149                 :            :         ::com::sun::star::uno::XComponentContext > m_xContext;
     150                 :            :     ::com::sun::star::uno::Reference<
     151                 :            :         ::com::sun::star::lang::XComponent >       m_xTargetDoc;
     152                 :            :     ::com::sun::star::uno::Reference<
     153                 :            :         ::com::sun::star::lang::XComponent >       m_xSourceDoc;
     154                 :            :     ::rtl::OUString                                m_sDocumentHandler; // when set it will be set as doc handler
     155                 :            : 
     156                 :            :     volatile bool                                  m_bCancelOperation;
     157                 :            :     ::osl::Mutex                                   m_aMutex;
     158                 :            : };
     159                 :            : 
     160                 :            : // =============================================================================
     161         [ #  # ]:          0 : class XMLReportFilterHelper : public XMLFilter
     162                 :            : {
     163                 :            :     virtual void isOasisFormat(const ::com::sun::star::uno::Sequence<
     164                 :            :                                     ::com::sun::star::beans::PropertyValue >& _rMediaDescriptor, bool & _rOutOASIS );
     165                 :            : public:
     166                 :          0 :     explicit XMLReportFilterHelper( ::com::sun::star::uno::Reference<
     167                 :            :                             ::com::sun::star::uno::XComponentContext > const & _xContext )
     168                 :          0 :                             :XMLFilter(_xContext)
     169                 :          0 :     {}
     170                 :            :     /// establish methods for factory instatiation
     171                 :          0 :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL   create(
     172                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext) throw(::com::sun::star::uno::Exception)
     173                 :            :     {
     174         [ #  # ]:          0 :         return (::cppu::OWeakObject *)new XMLReportFilterHelper( xContext );
     175                 :            :     }
     176                 :        173 :     static ::rtl::OUString getImplementationName_Static()
     177                 :            :     {
     178                 :        173 :         return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.chart2.report.XMLFilter" ));
     179                 :            :     }
     180                 :            : protected:
     181                 :            :     virtual ::rtl::OUString SAL_CALL
     182                 :          0 :         getImplementationName()
     183                 :            :             throw( ::com::sun::star::uno::RuntimeException )
     184                 :            :     {
     185                 :          0 :         return getImplementationName_Static();
     186                 :            :     }
     187                 :            :     // ____ XImporter ____
     188                 :          0 :     virtual void SAL_CALL setTargetDocument(
     189                 :            :         const ::com::sun::star::uno::Reference<
     190                 :            :             ::com::sun::star::lang::XComponent >& Document )
     191                 :            :         throw (::com::sun::star::lang::IllegalArgumentException,
     192                 :            :                ::com::sun::star::uno::RuntimeException)
     193                 :            :     {
     194                 :          0 :         setDocumentHandler(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.ImportDocumentHandler")));
     195                 :          0 :         XMLFilter::setTargetDocument(Document);
     196                 :          0 :     }
     197                 :            : 
     198                 :            :     // ____ XExporter ____
     199                 :          0 :     virtual void SAL_CALL setSourceDocument(
     200                 :            :         const ::com::sun::star::uno::Reference<
     201                 :            :             ::com::sun::star::lang::XComponent >& Document )
     202                 :            :         throw (::com::sun::star::lang::IllegalArgumentException,
     203                 :            :                ::com::sun::star::uno::RuntimeException)
     204                 :            :     {
     205                 :          0 :         setDocumentHandler(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.ExportDocumentHandler")));
     206                 :          0 :         XMLFilter::setSourceDocument(Document);
     207                 :          0 :     }
     208                 :            : 
     209                 :            :     virtual ::rtl::OUString getMediaType(bool _bOasis);
     210                 :            : };
     211                 :            : 
     212                 :            : } //  namespace chart
     213                 :            : 
     214                 :            : // CHART2_XMLFILTER_HXX
     215                 :            : #endif
     216                 :            : 
     217                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10