LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlfilter.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 5 0.0 %
Date: 2015-06-13 12:38:46 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 INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLFILTER_HXX
      20             : #define INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_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/sequence.hxx>
      41             : #include <com/sun/star/uno/XComponentContext.hpp>
      42             : #include <map>
      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             :     typedef std::map< OUString, Sequence<PropertyValue> > TPropertyNameMap;
      72             :     typedef std::map< OUString, Reference<XFunction> > TGroupFunctionMap;
      73             : private:
      74             : 
      75             :     TGroupFunctionMap                               m_aFunctions;
      76             :     Reference< XComponent >                         m_xSrcDoc;
      77             : 
      78             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pDocElemTokenMap;
      79             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pReportElemTokenMap;
      80             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pGroupsElemTokenMap;
      81             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pGroupElemTokenMap;
      82             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pSectionElemTokenMap;
      83             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pComponentElemTokenMap;
      84             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pElemTokenMap;
      85             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pControlElemTokenMap;
      86             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pFunctionElemTokenMap;
      87             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pSubDocumentElemTokenMap;
      88             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pFormatElemTokenMap;
      89             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pColumnTokenMap;
      90             :     mutable ::std::unique_ptr<SvXMLTokenMap>        m_pCellElemTokenMap;
      91             : 
      92             :     rtl::Reference < XMLPropertyHandlerFactory >      m_xPropHdlFactory;
      93             :     rtl::Reference < XMLPropertySetMapper >           m_xCellStylesPropertySetMapper;
      94             :     rtl::Reference < XMLPropertySetMapper >           m_xColumnStylesPropertySetMapper;
      95             :     rtl::Reference < XMLPropertySetMapper >           m_xRowStylesPropertySetMapper;
      96             :     rtl::Reference < XMLPropertySetMapper >           m_xTableStylesPropertySetMapper;
      97             : 
      98             :     Reference<XReportDefinition>                    m_xReportDefinition;
      99             :     ::boost::shared_ptr<rptui::OReportModel>        m_pReportModel;
     100             : 
     101             :     bool                            implImport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
     102             : 
     103             :     SvXMLImportContext* CreateStylesContext(const OUString& rLocalName,
     104             :                                      const Reference< XAttributeList>& xAttrList, bool bIsAutoStyle );
     105             :     SvXMLImportContext* CreateMetaContext(const OUString& rLocalName,
     106             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     107             :     SvXMLImportContext* CreateFontDeclsContext(const OUString& rLocalName,
     108             :             const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
     109             : protected:
     110             :     // SvXMLImport
     111             :     virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix,
     112             :                                       const OUString& rLocalName,
     113             :                                       const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) SAL_OVERRIDE;
     114             : 
     115             :     virtual XMLShapeImportHelper* CreateShapeImport() SAL_OVERRIDE;
     116             : 
     117             :     virtual ~ORptFilter()  throw();
     118             : public:
     119             : 
     120             :     ORptFilter( const Reference< XComponentContext >& _rxContext, SvXMLImportFlags nImportFlags = SvXMLImportFlags::ALL );
     121             : 
     122             :     // XFilter
     123             :     virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException, std::exception) SAL_OVERRIDE;
     124             : 
     125             :     static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw( ::com::sun::star::uno::RuntimeException );
     126             :     static OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
     127             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     128             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     129             : 
     130             :     inline Reference< XComponentContext > getORB() { return SvXMLImport::GetComponentContext(); }
     131           0 :     inline Reference<XReportDefinition> getReportDefinition() const { return m_xReportDefinition; }
     132             :     /** return the SdrModel of the real model
     133             :     *
     134             :     * \return
     135             :     */
     136             :     ::boost::shared_ptr<rptui::OReportModel> getSdrModel() const { return m_pReportModel; }
     137             :     void FinishStyles();
     138             : 
     139             :     virtual void SAL_CALL startDocument()
     140             :         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     141             :     virtual void SAL_CALL endDocument()
     142             :         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     143             : 
     144             :     const SvXMLTokenMap& GetDocElemTokenMap() const;
     145             :     const SvXMLTokenMap& GetReportElemTokenMap() const;
     146             :     const SvXMLTokenMap& GetGroupElemTokenMap() const;
     147             :     const SvXMLTokenMap& GetSectionElemTokenMap() const;
     148             :     const SvXMLTokenMap& GetComponentElemTokenMap() const;
     149             :     const SvXMLTokenMap& GetReportElementElemTokenMap() const;
     150             :     const SvXMLTokenMap& GetControlElemTokenMap() const;
     151             :     const SvXMLTokenMap& GetControlPropertyElemTokenMap() const;
     152             :     const SvXMLTokenMap& GetFunctionElemTokenMap() const;
     153             :     const SvXMLTokenMap& GetFormatElemTokenMap() const;
     154             :     const SvXMLTokenMap& GetSubDocumentElemTokenMap() const;
     155             :     const SvXMLTokenMap& GetColumnTokenMap() const;
     156             :     const SvXMLTokenMap& GetCellElemTokenMap() const;
     157             : 
     158           0 :     inline rtl::Reference < XMLPropertySetMapper > GetCellStylesPropertySetMapper()      const   { return m_xCellStylesPropertySetMapper;    }
     159           0 :     inline rtl::Reference < XMLPropertySetMapper > GetColumnStylesPropertySetMapper()    const   { return m_xColumnStylesPropertySetMapper;  }
     160           0 :     inline rtl::Reference < XMLPropertySetMapper > GetRowStylesPropertySetMapper()       const   { return m_xRowStylesPropertySetMapper;     }
     161             :     inline rtl::Reference < XMLPropertySetMapper > GetTableStylesPropertySetMapper()     const   { return m_xTableStylesPropertySetMapper;   }
     162             :     static OUString convertFormula(const OUString& _sFormula);
     163             :     /** inserts a new function
     164             :     *
     165             :     * \param _xFunction
     166             :     */
     167             :     void insertFunction(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction > & _xFunction);
     168             :     void removeFunction(const OUString& _sFunctionName);
     169           0 :     inline const TGroupFunctionMap& getFunctions() const { return m_aFunctions; }
     170             : 
     171             :     bool                        isOldFormat() const;
     172             : };
     173             : 
     174             : /** Imports only settings
     175             :  * \ingroup reportdesign_source_filter_xml
     176             :  *
     177             :  */
     178             : class ORptImportHelper
     179             : {
     180             : public:
     181             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     182             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     183             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     184             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     185             : };
     186             : 
     187             : /** Imports only content
     188             :  * \ingroup reportdesign_source_filter_xml
     189             :  *
     190             :  */
     191             : class ORptContentImportHelper
     192             : {
     193             : public:
     194             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     195             :     static Sequence< 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 styles
     201             :  * \ingroup reportdesign_source_filter_xml
     202             :  *
     203             :  */
     204             : class ORptStylesImportHelper
     205             : {
     206             : public:
     207             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     208             :     static Sequence< 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 meta data
     214             :  * \ingroup reportdesign_source_filter_xml
     215             :  *
     216             :  */
     217             : class ORptMetaImportHelper
     218             : {
     219             : public:
     220             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     221             :     static Sequence< 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             : 
     227             : } // rptxml
     228             : 
     229             : #endif // INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLFILTER_HXX
     230             : 
     231             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11