LCOV - code coverage report
Current view: top level - reportdesign/source/filter/xml - xmlExport.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 10 0.0 %
Date: 2014-04-11 Functions: 0 9 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             : 
      20             : #ifndef RPT_XMLEXPORT_HXX
      21             : #define RPT_XMLEXPORT_HXX
      22             : 
      23             : #include <com/sun/star/container/XNamed.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/XInitialization.hpp>
      28             : #include <com/sun/star/lang/XServiceInfo.hpp>
      29             : #include <com/sun/star/beans/XPropertySet.hpp>
      30             : #include <com/sun/star/report/XReportDefinition.hpp>
      31             : #include <com/sun/star/report/XSection.hpp>
      32             : #include <com/sun/star/report/XReportControlModel.hpp>
      33             : #include <com/sun/star/report/XFormattedField.hpp>
      34             : #include <com/sun/star/lang/XComponent.hpp>
      35             : #include <cppuhelper/implbase1.hxx>
      36             : #include <cppuhelper/implbase5.hxx>
      37             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      38             : #include <com/sun/star/io/XActiveDataSource.hpp>
      39             : #include <osl/diagnose.h>
      40             : #include <unotools/tempfile.hxx>
      41             : #include <unotools/localfilehelper.hxx>
      42             : #include <unotools/ucbstreamhelper.hxx>
      43             : #include <xmloff/xmlexp.hxx>
      44             : #include <xmloff/xmlimp.hxx>
      45             : #include <com/sun/star/uno/XComponentContext.hpp>
      46             : #include <memory>
      47             : 
      48             : namespace rptxml
      49             : {
      50             : using namespace ::xmloff::token;
      51             : using namespace ::com::sun::star::uno;
      52             : using namespace ::com::sun::star::container;
      53             : using namespace ::com::sun::star::lang;
      54             : using namespace ::com::sun::star::beans;
      55             : using namespace ::com::sun::star::document;
      56             : using namespace ::com::sun::star::text;
      57             : using namespace ::com::sun::star::report;
      58             : using namespace ::com::sun::star::io;
      59             : using namespace ::com::sun::star::xml::sax;
      60             : 
      61             : // - ORptExport -
      62             : 
      63             : #define PROGRESS_BAR_STEP 20
      64             : 
      65             : class ORptExport : public SvXMLExport
      66             : {
      67             : public:
      68           0 :     struct TCell
      69             :     {
      70             :         sal_Int32 nWidth;
      71             :         sal_Int32 nHeight;
      72             :         sal_Int32 nColSpan;
      73             :         sal_Int32 nRowSpan;
      74             :         Reference<XReportComponent> xElement;
      75             :         bool      bSet;
      76           0 :         TCell(  sal_Int32 _nWidth,
      77             :                 sal_Int32 _nHeight,
      78             :                 sal_Int32 _nColSpan,
      79             :                 sal_Int32 _nRowSpan,
      80             :                 Reference<XReportComponent> _xElement = Reference<XReportComponent>()) :
      81             :         nWidth(_nWidth)
      82             :         ,nHeight(_nHeight)
      83             :         ,nColSpan(_nColSpan)
      84             :         ,nRowSpan(_nRowSpan)
      85             :         ,xElement(_xElement)
      86           0 :         ,bSet(xElement.is())
      87           0 :         {}
      88             : 
      89           0 :         TCell( ) :
      90             :         nWidth(0)
      91             :         ,nHeight(0)
      92             :         ,nColSpan(1)
      93             :         ,nRowSpan(1)
      94           0 :         ,bSet(true)
      95           0 :         {}
      96             :     };
      97             :     typedef ::std::pair< OUString ,OUString> TStringPair;
      98             :     typedef struct
      99             :     {
     100             :         OUString sText;
     101             :         OUString sField;
     102             :         OUString sDecimal;
     103             :         OUString sThousand;
     104           0 :     } TDelimiter;
     105             :     typedef ::std::vector< OUString>                         TStringVec;
     106             :     typedef ::std::map< Reference<XPropertySet> ,OUString >  TPropertyStyleMap;
     107             :     typedef ::std::map< Reference<XPropertySet> ,  TStringVec>      TGridStyleMap;
     108             :     typedef ::std::vector< TCell >                                  TRow;
     109             :     typedef ::std::vector< ::std::pair< sal_Bool, TRow > >          TGrid;
     110             :     typedef ::std::map< Reference<XPropertySet> ,TGrid >            TSectionsGrid;
     111             :     typedef ::std::map< Reference<XGroup> ,Reference<XFunction> >   TGroupFunctionMap;
     112             : private:
     113             :     ::std::auto_ptr< TStringPair >                  m_aAutoIncrement;
     114             :     ::std::auto_ptr< TDelimiter >                   m_aDelimiter;
     115             :     ::std::vector< Any >                            m_aDataSourceSettings;
     116             :     TSectionsGrid                                   m_aSectionsGrid;
     117             : 
     118             :     TPropertyStyleMap                               m_aAutoStyleNames;
     119             :     TGridStyleMap                                   m_aColumnStyleNames;
     120             :     TGridStyleMap                                   m_aRowStyleNames;
     121             :     TGroupFunctionMap                               m_aGroupFunctionMap;
     122             : 
     123             :     OUString                                 m_sCharSet;
     124             :     OUString                                 m_sTableStyle;
     125             :     OUString                                 m_sCellStyle;
     126             :     OUString                                 m_sColumnStyle;
     127             :     Any                                             m_aPreviewMode;
     128             :     UniReference < SvXMLExportPropertyMapper>       m_xExportHelper;
     129             :     UniReference < SvXMLExportPropertyMapper>       m_xSectionPropMapper;
     130             :     UniReference < SvXMLExportPropertyMapper>       m_xTableStylesExportPropertySetMapper;
     131             :     UniReference < SvXMLExportPropertyMapper>       m_xCellStylesExportPropertySetMapper;
     132             :     UniReference < SvXMLExportPropertyMapper>       m_xColumnStylesExportPropertySetMapper;
     133             :     UniReference < SvXMLExportPropertyMapper>       m_xRowStylesExportPropertySetMapper;
     134             :     UniReference < SvXMLExportPropertyMapper >      m_xParaPropMapper;
     135             :     UniReference < XMLPropertyHandlerFactory >      m_xPropHdlFactory;
     136             : 
     137             :     mutable UniReference < XMLPropertySetMapper >   m_xControlStylePropertyMapper;
     138             :     mutable UniReference < XMLPropertySetMapper >   m_xColumnStylesPropertySetMapper;
     139             :     mutable UniReference < XMLPropertySetMapper >   m_xCellStylesPropertySetMapper;
     140             :     Reference<XReportDefinition>                    m_xReportDefinition;
     141             :     sal_Bool                                        m_bAllreadyFilled;
     142             : 
     143             :     void                    exportReport(const Reference<XReportDefinition>& _xReportDefinition); /// <element name="office:report">
     144             :     void                    exportReportAttributes(const Reference<XReportDefinition>& _xReport);
     145             :     void                    exportFunctions(const Reference<XIndexAccess>& _xFunctions); /// <ref name="rpt-function"/>
     146             :     void                    exportFunction(const Reference< XFunction>& _xFunction);
     147             :     void                    exportMasterDetailFields(const Reference<XReportComponent>& _xReportComponet);
     148             :     void                    exportComponent(const Reference<XReportComponent>& _xReportComponent);
     149             :     sal_Bool                exportGroup(const Reference<XReportDefinition>& _xReportDefinition,sal_Int32 _nPos,sal_Bool _bExportAutoStyle = sal_False);
     150             :     void                    exportStyleName(XPropertySet* _xProp,SvXMLAttributeList& _rAtt,const OUString& _sName);
     151             :     void                    exportSection(const Reference<XSection>& _xProp,bool bHeader = false);
     152             :     void                    exportContainer(const Reference< XSection>& _xSection);
     153             :     void                    exportShapes(const Reference< XSection>& _xSection,bool _bAddParagraph = true);
     154             :     void                    exportTableColumns(const Reference< XSection>& _xSection);
     155             :     void                    exportSectionAutoStyle(const Reference<XSection>& _xProp);
     156             :     void                    exportReportElement(const Reference<XReportControlModel>& _xReportElement);
     157             :     void                    exportFormatConditions(const Reference<XReportControlModel>& _xReportElement);
     158             :     void                    exportAutoStyle(XPropertySet* _xProp,const Reference<XFormattedField>& _xParentFormattedField = Reference<XFormattedField>());
     159             :     void                    exportAutoStyle(const Reference<XSection>& _xProp);
     160             :     void                    exportReportComponentAutoStyles(const Reference<XSection>& _xProp);
     161             :     void                    collectComponentStyles();
     162             :     void                    collectStyleNames(sal_Int32 _nFamily,const ::std::vector< sal_Int32>& _aSize, ORptExport::TStringVec& _rStyleNames);
     163             :     void                    exportParagraph(const Reference< XReportControlModel >& _xReportElement);
     164             :     bool                    exportFormula(enum ::xmloff::token::XMLTokenEnum eName,const OUString& _sFormula);
     165             :     void                    exportGroupsExpressionAsFunction(const Reference< XGroups>& _xGroups);
     166             :     OUString         convertFormula(const OUString& _sFormula);
     167             : 
     168             :     OUString         implConvertNumber(sal_Int32 _nValue);
     169             : 
     170             : private:
     171             :                                     ORptExport();
     172             :     virtual void                    SetBodyAttributes() SAL_OVERRIDE;
     173             : protected:
     174             : 
     175             :     virtual void                    _ExportStyles( bool bUsed ) SAL_OVERRIDE;
     176             :     virtual void                    _ExportAutoStyles() SAL_OVERRIDE;
     177             :     virtual void                    _ExportContent() SAL_OVERRIDE;
     178             :     virtual void                    _ExportMasterStyles() SAL_OVERRIDE;
     179             :     virtual void                    _ExportFontDecls() SAL_OVERRIDE;
     180             :     virtual sal_uInt32              exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) SAL_OVERRIDE;
     181             :     virtual SvXMLAutoStylePoolP*    CreateAutoStylePool() SAL_OVERRIDE;
     182             :     virtual XMLShapeExport*         CreateShapeExport() SAL_OVERRIDE;
     183             : 
     184           0 :     virtual                 ~ORptExport(){};
     185             : public:
     186             : 
     187             :     ORptExport(const Reference< XComponentContext >& _rxContext, OUString const & implementationName, sal_uInt16 nExportFlag);
     188             : 
     189             :     static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
     190             :     static OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException );
     191             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     192             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     193             : 
     194             :     // XExporter
     195             :     virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     196             : 
     197           0 :     inline Reference<XReportDefinition> getReportDefinition() const { return m_xReportDefinition; }
     198             : 
     199             :     UniReference < XMLPropertySetMapper > GetCellStylePropertyMapper() const;
     200             : };
     201             : 
     202             : /** Exports only settings
     203             :  * \ingroup reportdesign_source_filter_xml
     204             :  *
     205             :  */
     206             : class ORptExportHelper
     207             : {
     208             : public:
     209             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     210             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     211             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     212             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     213             : };
     214             : 
     215             : /** Exports only content
     216             :  * \ingroup reportdesign_source_filter_xml
     217             :  *
     218             :  */
     219             : class ORptContentExportHelper
     220             : {
     221             : public:
     222             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     223             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     224             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     225             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     226             : };
     227             : 
     228             : /** Exports only styles
     229             :  * \ingroup reportdesign_source_filter_xml
     230             :  *
     231             :  */
     232             : class ORptStylesExportHelper
     233             : {
     234             : public:
     235             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     236             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     237             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     238             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     239             : };
     240             : 
     241             : /** Exports only meta data
     242             :  * \ingroup reportdesign_source_filter_xml
     243             :  *
     244             :  */
     245             : class ORptMetaExportHelper
     246             : {
     247             : public:
     248             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     249             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     250             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     251             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     252             : };
     253             : /** Exports all
     254             :  * \ingroup reportdesign_source_filter_xml
     255             :  *
     256             :  */
     257             : class ODBFullExportHelper
     258             : {
     259             : public:
     260             :     static OUString getImplementationName_Static(  ) throw (::com::sun::star::uno::RuntimeException);
     261             :     static Sequence< OUString > getSupportedServiceNames_Static(  ) throw(::com::sun::star::uno::RuntimeException);
     262             :     static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
     263             :         create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
     264             : };
     265             : 
     266             : } // rptxml
     267             : 
     268             : #endif // RPT_XMLEXPORT_HXX
     269             : 
     270             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10