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

Generated by: LCOV version 1.10