LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlfilter.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 5 0.0 %
Date: 2014-11-03 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, sal_uInt16 nImportFlags = IMPORT_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(void) throw( ::com::sun::star::uno::RuntimeException );
     126             :     static OUString getImplementationName_Static(void) 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(void)
     140             :         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     141             :     virtual void SAL_CALL endDocument(void)
     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             :     virtual SvXMLImport&                getGlobalContext();
     172             : 
     173             :     virtual void                        enterEventContext();
     174             :     virtual void                        leaveEventContext();
     175             : 
     176             :     bool                            isOldFormat() const;
     177             : };
     178             : 
     179             : /** Imports only settings
     180             :  * \ingroup reportdesign_source_filter_xml
     181             :  *
     182             :  */
     183             : class ORptImportHelper
     184             : {
     185             : public:
     186             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     187             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     188             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     189             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     190             : };
     191             : 
     192             : /** Imports only content
     193             :  * \ingroup reportdesign_source_filter_xml
     194             :  *
     195             :  */
     196             : class ORptContentImportHelper
     197             : {
     198             : public:
     199             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     200             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     201             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     202             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     203             : };
     204             : 
     205             : /** Imports only styles
     206             :  * \ingroup reportdesign_source_filter_xml
     207             :  *
     208             :  */
     209             : class ORptStylesImportHelper
     210             : {
     211             : public:
     212             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     213             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     214             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     215             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     216             : };
     217             : 
     218             : /** Imports only meta data
     219             :  * \ingroup reportdesign_source_filter_xml
     220             :  *
     221             :  */
     222             : class ORptMetaImportHelper
     223             : {
     224             : public:
     225             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     226             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     227             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     228             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     229             : };
     230             : 
     231             : 
     232             : } // rptxml
     233             : 
     234             : #endif // INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLFILTER_HXX
     235             : 
     236             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10