LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlfilter.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 5 0.0 %
Date: 2012-08-25 Functions: 0 5 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                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef RPT_XMLFILTER_HXX
      29                 :            : #define RPT_XMLFILTER_HXX
      30                 :            : 
      31                 :            : #include <com/sun/star/container/XNamed.hpp>
      32                 :            : #include <com/sun/star/document/XFilter.hpp>
      33                 :            : #include <com/sun/star/document/XImporter.hpp>
      34                 :            : #include <com/sun/star/document/XExporter.hpp>
      35                 :            : #include <com/sun/star/lang/XInitialization.hpp>
      36                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      37                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      38                 :            : #include <com/sun/star/lang/XComponent.hpp>
      39                 :            : #include <cppuhelper/implbase1.hxx>
      40                 :            : #include <cppuhelper/implbase5.hxx>
      41                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      42                 :            : #include <com/sun/star/io/XActiveDataSource.hpp>
      43                 :            : #include <com/sun/star/report/XReportDefinition.hpp>
      44                 :            : #include <osl/diagnose.h>
      45                 :            : #include <unotools/tempfile.hxx>
      46                 :            : #include <unotools/localfilehelper.hxx>
      47                 :            : #include <unotools/ucbstreamhelper.hxx>
      48                 :            : #include <xmloff/xmlimp.hxx>
      49                 :            : #include <comphelper/stl_types.hxx>
      50                 :            : #include <comphelper/sequence.hxx>
      51                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      52                 :            : #include <memory>
      53                 :            : #include <boost/shared_ptr.hpp>
      54                 :            : #include <xmloff/prhdlfac.hxx>
      55                 :            : #include <xmloff/xmlprmap.hxx>
      56                 :            : 
      57                 :            : namespace rptui
      58                 :            : {
      59                 :            :     class OReportModel;
      60                 :            : }
      61                 :            : namespace rptxml
      62                 :            : {
      63                 :            : using namespace ::xmloff::token;
      64                 :            : using namespace ::com::sun::star::uno;
      65                 :            : using namespace ::com::sun::star::container;
      66                 :            : using namespace ::com::sun::star::lang;
      67                 :            : using namespace ::com::sun::star::beans;
      68                 :            : using namespace ::com::sun::star::document;
      69                 :            : using namespace ::com::sun::star::text;
      70                 :            : using namespace ::com::sun::star::io;
      71                 :            : using namespace ::com::sun::star::report;
      72                 :            : using namespace ::com::sun::star::xml::sax;
      73                 :            : 
      74                 :            : // -------------
      75                 :            : // - ORptFilter -
      76                 :            : // -------------
      77                 :            : class ORptFilter : public SvXMLImport
      78                 :            : {
      79                 :            : public:
      80                 :            :     DECLARE_STL_USTRINGACCESS_MAP(Sequence<PropertyValue>,TPropertyNameMap);
      81                 :            :     DECLARE_STL_USTRINGACCESS_MAP( Reference<XFunction> ,TGroupFunctionMap);
      82                 :            : private:
      83                 :            : 
      84                 :            :     TGroupFunctionMap                               m_aFunctions;
      85                 :            :     com::sun::star::uno::Any                        m_aViewSettings;
      86                 :            :     Reference< XComponent >                         m_xSrcDoc;
      87                 :            : 
      88                 :            :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
      89                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pDocElemTokenMap;
      90                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pReportElemTokenMap;
      91                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pGroupsElemTokenMap;
      92                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pGroupElemTokenMap;
      93                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pSectionElemTokenMap;
      94                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pComponentElemTokenMap;
      95                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pElemTokenMap;
      96                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pControlElemTokenMap;
      97                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pFunctionElemTokenMap;
      98                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pSubDocumentElemTokenMap;
      99                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pFormatElemTokenMap;
     100                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pColumnTokenMap;
     101                 :            :     mutable ::std::auto_ptr<SvXMLTokenMap>          m_pCellElemTokenMap;
     102                 :            :     SAL_WNODEPRECATED_DECLARATIONS_POP
     103                 :            : 
     104                 :            :     UniReference < XMLPropertyHandlerFactory >      m_xPropHdlFactory;
     105                 :            :     UniReference < XMLPropertySetMapper >           m_xCellStylesPropertySetMapper;
     106                 :            :     UniReference < XMLPropertySetMapper >           m_xColumnStylesPropertySetMapper;
     107                 :            :     UniReference < XMLPropertySetMapper >           m_xRowStylesPropertySetMapper;
     108                 :            :     UniReference < XMLPropertySetMapper >           m_xTableStylesPropertySetMapper;
     109                 :            : 
     110                 :            :     Reference<XReportDefinition>                    m_xReportDefinition;
     111                 :            :     ::boost::shared_ptr<rptui::OReportModel>        m_pReportModel;
     112                 :            : 
     113                 :            :     sal_Bool                            implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
     114                 :            : 
     115                 :            :     SvXMLImportContext* CreateStylesContext(const ::rtl::OUString& rLocalName,
     116                 :            :                                      const Reference< XAttributeList>& xAttrList, sal_Bool bIsAutoStyle );
     117                 :            :     SvXMLImportContext* CreateMetaContext(const ::rtl::OUString& rLocalName,
     118                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     119                 :            :     SvXMLImportContext* CreateFontDeclsContext(const ::rtl::OUString& rLocalName,
     120                 :            :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     121                 :            : protected:
     122                 :            :     // SvXMLImport
     123                 :            :     virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
     124                 :            :                                       const ::rtl::OUString& rLocalName,
     125                 :            :                                       const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
     126                 :            : 
     127                 :            :     virtual XMLShapeImportHelper* CreateShapeImport();
     128                 :            : 
     129                 :            :     virtual ~ORptFilter()  throw();
     130                 :            : public:
     131                 :            : 
     132                 :            :     ORptFilter( const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nImportFlags = IMPORT_ALL );
     133                 :            : 
     134                 :            :     // XFilter
     135                 :            :     virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException);
     136                 :            : 
     137                 :            :     // ::com::sun::star::lang::XServiceInfo
     138                 :            :     virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
     139                 :            :     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
     140                 :            :     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
     141                 :            : 
     142                 :            :     static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
     143                 :            :     static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
     144                 :            :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     145                 :            :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     146                 :            : 
     147                 :            :     inline Reference< XMultiServiceFactory > getORB() { return SvXMLImport::getServiceFactory(); }
     148                 :          0 :     inline Reference<XReportDefinition> getReportDefinition() const { return m_xReportDefinition; }
     149                 :            :     /** return the SdrModel of the real model
     150                 :            :     *
     151                 :            :     * \return
     152                 :            :     */
     153                 :            :     ::boost::shared_ptr<rptui::OReportModel> getSdrModel() const { return m_pReportModel; }
     154                 :            :     void FinishStyles();
     155                 :            : 
     156                 :            :     virtual void SAL_CALL startDocument(void)
     157                 :            :         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
     158                 :            :     virtual void SAL_CALL endDocument(void)
     159                 :            :         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
     160                 :            : 
     161                 :            :     const SvXMLTokenMap& GetDocElemTokenMap() const;
     162                 :            :     const SvXMLTokenMap& GetReportElemTokenMap() const;
     163                 :            :     const SvXMLTokenMap& GetGroupElemTokenMap() const;
     164                 :            :     const SvXMLTokenMap& GetSectionElemTokenMap() const;
     165                 :            :     const SvXMLTokenMap& GetComponentElemTokenMap() const;
     166                 :            :     const SvXMLTokenMap& GetReportElementElemTokenMap() const;
     167                 :            :     const SvXMLTokenMap& GetControlElemTokenMap() const;
     168                 :            :     const SvXMLTokenMap& GetControlPropertyElemTokenMap() const;
     169                 :            :     const SvXMLTokenMap& GetFunctionElemTokenMap() const;
     170                 :            :     const SvXMLTokenMap& GetFormatElemTokenMap() const;
     171                 :            :     const SvXMLTokenMap& GetSubDocumentElemTokenMap() const;
     172                 :            :     const SvXMLTokenMap& GetColumnTokenMap() const;
     173                 :            :     const SvXMLTokenMap& GetCellElemTokenMap() const;
     174                 :            : 
     175                 :          0 :     inline UniReference < XMLPropertySetMapper > GetCellStylesPropertySetMapper()      const   { return m_xCellStylesPropertySetMapper;    }
     176                 :          0 :     inline UniReference < XMLPropertySetMapper > GetColumnStylesPropertySetMapper()    const   { return m_xColumnStylesPropertySetMapper;  }
     177                 :          0 :     inline UniReference < XMLPropertySetMapper > GetRowStylesPropertySetMapper()       const   { return m_xRowStylesPropertySetMapper;     }
     178                 :            :     inline UniReference < XMLPropertySetMapper > GetTableStylesPropertySetMapper()     const   { return m_xTableStylesPropertySetMapper;   }
     179                 :            :     static ::rtl::OUString convertFormula(const ::rtl::OUString& _sFormula);
     180                 :            :     /** inserts a new function
     181                 :            :     *
     182                 :            :     * \param _xFunction
     183                 :            :     */
     184                 :            :     void insertFunction(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction > & _xFunction);
     185                 :            :     void removeFunction(const ::rtl::OUString& _sFunctionName);
     186                 :          0 :     inline const TGroupFunctionMap& getFunctions() const { return m_aFunctions; }
     187                 :            : 
     188                 :            :     virtual SvXMLImport&                getGlobalContext();
     189                 :            : 
     190                 :            :     virtual void                        enterEventContext();
     191                 :            :     virtual void                        leaveEventContext();
     192                 :            : 
     193                 :            :     sal_Bool                            isOldFormat() const;
     194                 :            : };
     195                 :            : 
     196                 :            : /** Imports only settings
     197                 :            :  * \ingroup reportdesign_source_filter_xml
     198                 :            :  *
     199                 :            :  */
     200                 :            : class ORptImportHelper
     201                 :            : {
     202                 :            : public:
     203                 :            :     static ::rtl::OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     204                 :            :     static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     205                 :            :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     206                 :            :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     207                 :            : };
     208                 :            : 
     209                 :            : /** Imports only content
     210                 :            :  * \ingroup reportdesign_source_filter_xml
     211                 :            :  *
     212                 :            :  */
     213                 :            : class ORptContentImportHelper
     214                 :            : {
     215                 :            : public:
     216                 :            :     static ::rtl::OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     217                 :            :     static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     218                 :            :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     219                 :            :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     220                 :            : };
     221                 :            : 
     222                 :            : /** Imports only styles
     223                 :            :  * \ingroup reportdesign_source_filter_xml
     224                 :            :  *
     225                 :            :  */
     226                 :            : class ORptStylesImportHelper
     227                 :            : {
     228                 :            : public:
     229                 :            :     static ::rtl::OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     230                 :            :     static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     231                 :            :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     232                 :            :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     233                 :            : };
     234                 :            : 
     235                 :            : /** Imports only meta data
     236                 :            :  * \ingroup reportdesign_source_filter_xml
     237                 :            :  *
     238                 :            :  */
     239                 :            : class ORptMetaImportHelper
     240                 :            : {
     241                 :            : public:
     242                 :            :     static ::rtl::OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     243                 :            :     static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     244                 :            :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     245                 :            :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     246                 :            : };
     247                 :            : 
     248                 :            : // -----------------------------------------------------------------------------
     249                 :            : } // rptxml
     250                 :            : // -----------------------------------------------------------------------------
     251                 :            : #endif // RPT_XMLFILTER_HXX
     252                 :            : 
     253                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10