LibreOffice Module reportdesign (master) 1
xmlExport.hxx
Go to the documentation of this file.
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 INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLEXPORT_HXX
21#define INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_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/beans/XPropertySet.hpp>
27#include <com/sun/star/report/XReportDefinition.hpp>
28#include <com/sun/star/report/XSection.hpp>
29#include <com/sun/star/report/XReportControlModel.hpp>
30#include <com/sun/star/report/XFormattedField.hpp>
31#include <com/sun/star/lang/XComponent.hpp>
32#include <xmloff/xmlexp.hxx>
33#include <xmloff/xmlexppr.hxx>
34#include <xmloff/prhdlfac.hxx>
35#include <xmloff/xmlprmap.hxx>
36#include <com/sun/star/uno/XComponentContext.hpp>
37#include <memory>
38
39namespace rptxml
40{
41using namespace ::xmloff::token;
42using namespace css::uno;
43using namespace css::container;
44using namespace css::lang;
45using namespace css::beans;
46using namespace css::document;
47using namespace css::text;
48using namespace css::report;
49using namespace css::io;
50using namespace css::xml::sax;
51
52
53class ORptExport : public SvXMLExport
54{
55public:
56 struct TCell
57 {
58 sal_Int32 nColSpan;
59 sal_Int32 nRowSpan;
60 Reference<XReportComponent> xElement;
61 bool bSet;
62 TCell( sal_Int32 _nColSpan,
63 sal_Int32 _nRowSpan,
64 Reference<XReportComponent> const & _xElement = Reference<XReportComponent>()) :
65 nColSpan(_nColSpan)
66 ,nRowSpan(_nRowSpan)
67 ,xElement(_xElement)
68 ,bSet(xElement.is())
69 {}
70
71 TCell( ) :
72 nColSpan(1)
73 ,nRowSpan(1)
74 ,bSet(true)
75 {}
76 };
77 typedef ::std::pair< OUString ,OUString> TStringPair;
78 typedef ::std::map< Reference<XPropertySet> ,OUString > TPropertyStyleMap;
79 typedef ::std::map< Reference<XPropertySet> , std::vector<OUString>> TGridStyleMap;
80 typedef ::std::vector< TCell > TRow;
81 typedef ::std::vector< ::std::pair< bool, TRow > > TGrid;
82 typedef ::std::map< Reference<XPropertySet> ,TGrid > TSectionsGrid;
83 typedef ::std::map< Reference<XGroup> ,Reference<XFunction> > TGroupFunctionMap;
84private:
86
91
92 OUString m_sTableStyle;
93 OUString m_sCellStyle;
100
102 Reference<XReportDefinition> m_xReportDefinition;
104
105 void exportReport(const Reference<XReportDefinition>& _xReportDefinition);
106 void exportReportAttributes(const Reference<XReportDefinition>& _xReport);
107 void exportFunctions(const Reference<XIndexAccess>& _xFunctions);
108 void exportFunction(const Reference< XFunction>& _xFunction);
109 void exportMasterDetailFields(const Reference<XReportComponent>& _xReportComponent);
110 void exportComponent(const Reference<XReportComponent>& _xReportComponent);
111 void exportGroup(const Reference<XReportDefinition>& _xReportDefinition,sal_Int32 _nPos,bool _bExportAutoStyle = false);
112 void exportStyleName(XPropertySet* _xProp,comphelper::AttributeList& _rAtt,const OUString& _sName);
113 void exportSection(const Reference<XSection>& _xProp,bool bHeader = false);
114 void exportContainer(const Reference< XSection>& _xSection);
115 void exportShapes(const Reference< XSection>& _xSection,bool _bAddParagraph = true);
116 void exportTableColumns(const Reference< XSection>& _xSection);
117 void exportSectionAutoStyle(const Reference<XSection>& _xProp);
118 void exportReportElement(const Reference<XReportControlModel>& _xReportElement);
119 void exportFormatConditions(const Reference<XReportControlModel>& _xReportElement);
120 void exportAutoStyle(XPropertySet* _xProp,const Reference<XFormattedField>& _xParentFormattedField = Reference<XFormattedField>());
121 void exportAutoStyle(const Reference<XSection>& _xProp);
122 void exportReportComponentAutoStyles(const Reference<XSection>& _xProp);
124 void collectStyleNames(XmlStyleFamily _nFamily,const ::std::vector< sal_Int32>& _aSize, std::vector<OUString>& _rStyleNames);
125 void collectStyleNames(XmlStyleFamily _nFamily,const ::std::vector< sal_Int32>& _aSize, const ::std::vector< sal_Int32>& _aSizeAutoGrow, std::vector<OUString>& _rStyleNames);
126 void exportParagraph(const Reference< XReportControlModel >& _xReportElement);
127 bool exportFormula(enum ::xmloff::token::XMLTokenEnum eName,const OUString& _sFormula);
128 void exportGroupsExpressionAsFunction(const Reference< XGroups>& _xGroups);
129 static OUString convertFormula(const OUString& _sFormula);
130
131 virtual void SetBodyAttributes() override;
132
133protected:
134
135 virtual void ExportStyles_( bool bUsed ) override;
136 virtual void ExportAutoStyles_() override;
137 virtual void ExportContent_() override;
138 virtual void ExportMasterStyles_() override;
139 virtual void ExportFontDecls_() override;
140 virtual SvXMLAutoStylePoolP* CreateAutoStylePool() override;
141 virtual XMLShapeExport* CreateShapeExport() override;
142
143 virtual ~ORptExport() override {};
144public:
145
146 ORptExport(const Reference< XComponentContext >& _rxContext, OUString const & implementationName, SvXMLExportFlags nExportFlag);
147
148 // XExporter
149 virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
150
151 const Reference<XReportDefinition>& getReportDefinition() const { return m_xReportDefinition; }
152
154};
155
156
157} // rptxml
158
159#endif // INCLUDED_REPORTDESIGN_SOURCE_FILTER_XML_XMLEXPORT_HXX
160
161/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::map< Reference< XPropertySet >,OUString > TPropertyStyleMap
Definition: xmlExport.hxx:78
rtl::Reference< SvXMLExportPropertyMapper > m_xRowStylesExportPropertySetMapper
Definition: xmlExport.hxx:97
rtl::Reference< SvXMLExportPropertyMapper > m_xCellStylesExportPropertySetMapper
Definition: xmlExport.hxx:95
rtl::Reference< XMLPropertySetMapper > m_xCellStylesPropertySetMapper
Definition: xmlExport.hxx:101
const Reference< XReportDefinition > & getReportDefinition() const
Definition: xmlExport.hxx:151
::std::vector< ::std::pair< bool, TRow > > TGrid
Definition: xmlExport.hxx:81
const rtl::Reference< XMLPropertySetMapper > & GetCellStylePropertyMapper() const
Definition: xmlExport.hxx:153
void exportComponent(const Reference< XReportComponent > &_xReportComponent)
Definition: xmlExport.cxx:376
void collectComponentStyles()
Definition: xmlExport.cxx:1269
virtual void ExportStyles_(bool bUsed) override
Definition: xmlExport.cxx:1316
virtual void ExportAutoStyles_() override
Definition: xmlExport.cxx:1296
virtual void ExportFontDecls_() override
Definition: xmlExport.cxx:1335
virtual ~ORptExport() override
Definition: xmlExport.hxx:143
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: xmlExport.cxx:1329
OUString m_sTableStyle
Definition: xmlExport.hxx:92
Reference< XReportDefinition > m_xReportDefinition
Definition: xmlExport.hxx:102
ORptExport(const Reference< XComponentContext > &_rxContext, OUString const &implementationName, SvXMLExportFlags nExportFlag)
Definition: xmlExport.cxx:180
void exportContainer(const Reference< XSection > &_xSection)
Definition: xmlExport.cxx:741
::std::map< Reference< XPropertySet >,TGrid > TSectionsGrid
Definition: xmlExport.hxx:82
virtual void ExportContent_() override
Definition: xmlExport.cxx:1259
TGroupFunctionMap m_aGroupFunctionMap
Definition: xmlExport.hxx:90
virtual XMLShapeExport * CreateShapeExport() override
Definition: xmlExport.cxx:1397
static OUString convertFormula(const OUString &_sFormula)
Definition: xmlExport.cxx:974
void exportSection(const Reference< XSection > &_xProp, bool bHeader=false)
Definition: xmlExport.cxx:688
rtl::Reference< XMLPropertyHandlerFactory > m_xPropHdlFactory
Definition: xmlExport.hxx:99
void exportGroupsExpressionAsFunction(const Reference< XGroups > &_xGroups)
Definition: xmlExport.cxx:1434
virtual SvXMLAutoStylePoolP * CreateAutoStylePool() override
Definition: xmlExport.cxx:1324
void exportFormatConditions(const Reference< XReportControlModel > &_xReportElement)
Definition: xmlExport.cxx:387
TSectionsGrid m_aSectionsGrid
Definition: xmlExport.hxx:85
TPropertyStyleMap m_aAutoStyleNames
Definition: xmlExport.hxx:87
void exportShapes(const Reference< XSection > &_xSection, bool _bAddParagraph=true)
Definition: xmlExport.cxx:1403
void exportGroup(const Reference< XReportDefinition > &_xReportDefinition, sal_Int32 _nPos, bool _bExportAutoStyle=false)
Definition: xmlExport.cxx:1006
void exportReportAttributes(const Reference< XReportDefinition > &_xReport)
<element name="office:report">
Definition: xmlExport.cxx:1227
::std::map< Reference< XPropertySet >, std::vector< OUString > > TGridStyleMap
Definition: xmlExport.hxx:79
::std::map< Reference< XGroup >,Reference< XFunction > > TGroupFunctionMap
Definition: xmlExport.hxx:83
void exportReport(const Reference< XReportDefinition > &_xReportDefinition)
Definition: xmlExport.cxx:332
virtual void ExportMasterStyles_() override
Definition: xmlExport.cxx:1264
rtl::Reference< SvXMLExportPropertyMapper > m_xParaPropMapper
Definition: xmlExport.hxx:98
void exportSectionAutoStyle(const Reference< XSection > &_xProp)
Definition: xmlExport.cxx:491
OUString m_sCellStyle
Definition: xmlExport.hxx:93
void exportReportComponentAutoStyles(const Reference< XSection > &_xProp)
Definition: xmlExport.cxx:649
TGridStyleMap m_aRowStyleNames
Definition: xmlExport.hxx:89
void exportMasterDetailFields(const Reference< XReportComponent > &_xReportComponent)
Definition: xmlExport.cxx:310
void exportStyleName(XPropertySet *_xProp, comphelper::AttributeList &_rAtt, const OUString &_sName)
Definition: xmlExport.cxx:994
::std::pair< OUString,OUString > TStringPair
Definition: xmlExport.hxx:77
void exportParagraph(const Reference< XReportControlModel > &_xReportElement)
Definition: xmlExport.cxx:1342
bool exportFormula(enum ::xmloff::token::XMLTokenEnum eName, const OUString &_sFormula)
Definition: xmlExport.cxx:982
void collectStyleNames(XmlStyleFamily _nFamily, const ::std::vector< sal_Int32 > &_aSize, std::vector< OUString > &_rStyleNames)
Definition: xmlExport.cxx:455
void exportAutoStyle(XPropertySet *_xProp, const Reference< XFormattedField > &_xParentFormattedField=Reference< XFormattedField >())
Definition: xmlExport.cxx:1089
::std::vector< TCell > TRow
Definition: xmlExport.hxx:80
TGridStyleMap m_aColumnStyleNames
Definition: xmlExport.hxx:88
rtl::Reference< SvXMLExportPropertyMapper > m_xTableStylesExportPropertySetMapper
Definition: xmlExport.hxx:94
void exportReportElement(const Reference< XReportControlModel > &_xReportElement)
Definition: xmlExport.cxx:411
void exportFunctions(const Reference< XIndexAccess > &_xFunctions)
Definition: xmlExport.cxx:285
void exportFunction(const Reference< XFunction > &_xFunction)
<ref name="rpt-function">
Definition: xmlExport.cxx:295
virtual void SetBodyAttributes() override
Definition: xmlExport.cxx:1221
void exportTableColumns(const Reference< XSection > &_xSection)
Definition: xmlExport.cxx:726
rtl::Reference< SvXMLExportPropertyMapper > m_xColumnStylesExportPropertySetMapper
Definition: xmlExport.hxx:96
XmlStyleFamily
TCell(sal_Int32 _nColSpan, sal_Int32 _nRowSpan, Reference< XReportComponent > const &_xElement=Reference< XReportComponent >())
Definition: xmlExport.hxx:62
Reference< XReportComponent > xElement
Definition: xmlExport.hxx:60
SvXMLExportFlags