19e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
39e0e4191SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
49e0e4191SAndrew Rist * or more contributor license agreements. See the NOTICE file
59e0e4191SAndrew Rist * distributed with this work for additional information
69e0e4191SAndrew Rist * regarding copyright ownership. The ASF licenses this file
79e0e4191SAndrew Rist * to you under the Apache License, Version 2.0 (the
89e0e4191SAndrew Rist * "License"); you may not use this file except in compliance
99e0e4191SAndrew Rist * with the License. You may obtain a copy of the License at
109e0e4191SAndrew Rist *
119e0e4191SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
129e0e4191SAndrew Rist *
139e0e4191SAndrew Rist * Unless required by applicable law or agreed to in writing,
149e0e4191SAndrew Rist * software distributed under the License is distributed on an
159e0e4191SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169e0e4191SAndrew Rist * KIND, either express or implied. See the License for the
179e0e4191SAndrew Rist * specific language governing permissions and limitations
189e0e4191SAndrew Rist * under the License.
199e0e4191SAndrew Rist *
209e0e4191SAndrew Rist *************************************************************/
219e0e4191SAndrew Rist
229e0e4191SAndrew Rist
23*b63233d8Sdamjan #include "precompiled_rptxml.hxx"
24cdf0e10cSrcweir #include "xmlHelper.hxx"
25cdf0e10cSrcweir #include <xmloff/xmlnmspe.hxx>
26cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
27cdf0e10cSrcweir #include <xmloff/families.hxx>
28cdf0e10cSrcweir #include <xmloff/controlpropertyhdl.hxx>
29cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
30cdf0e10cSrcweir #include <comphelper/propertysethelper.hxx>
31cdf0e10cSrcweir #include <comphelper/mediadescriptor.hxx>
32cdf0e10cSrcweir #include <comphelper/genericpropertyset.hxx>
33cdf0e10cSrcweir #include <com/sun/star/style/ParagraphAdjust.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/TextAlign.hpp>
35cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
36cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp>
37cdf0e10cSrcweir #include <com/sun/star/awt/TextAlign.hpp>
38cdf0e10cSrcweir #include <com/sun/star/awt/ImagePosition.hpp>
39cdf0e10cSrcweir #include <com/sun/star/awt/ImageScaleMode.hpp>
40cdf0e10cSrcweir #include <xmloff/prstylei.hxx>
41cdf0e10cSrcweir #include "xmlstrings.hrc"
42cdf0e10cSrcweir #include "xmlEnums.hxx"
43cdf0e10cSrcweir #include <xmloff/contextid.hxx>
44cdf0e10cSrcweir #include <xmloff/txtprmap.hxx>
45cdf0e10cSrcweir #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
46cdf0e10cSrcweir #include <com/sun/star/table/BorderLine.hpp>
47cdf0e10cSrcweir #include <xmloff/XMLConstantsPropertyHandler.hxx>
48cdf0e10cSrcweir #include <com/sun/star/report/ForceNewPage.hpp>
49cdf0e10cSrcweir #include <com/sun/star/report/ReportPrintOption.hpp>
50cdf0e10cSrcweir #include <com/sun/star/report/GroupOn.hpp>
51cdf0e10cSrcweir #include <com/sun/star/report/KeepTogether.hpp>
52cdf0e10cSrcweir #include <xmloff/xmlement.hxx>
53cdf0e10cSrcweir #include <com/sun/star/report/XReportControlFormat.hpp>
54cdf0e10cSrcweir #include <com/sun/star/form/ListSourceType.hpp>
55cdf0e10cSrcweir #include <com/sun/star/sdb/CommandType.hpp>
56cdf0e10cSrcweir #include <com/sun/star/style/VerticalAlignment.hpp>
57cdf0e10cSrcweir #include <xmloff/EnumPropertyHdl.hxx>
58cdf0e10cSrcweir
59cdf0e10cSrcweir #define XML_RPT_ALGINMENT (XML_DB_TYPES_START+1)
60cdf0e10cSrcweir namespace rptxml
61cdf0e10cSrcweir {
62cdf0e10cSrcweir using namespace ::xmloff::token;
63cdf0e10cSrcweir using namespace ::com::sun::star::awt;
64cdf0e10cSrcweir using namespace ::com::sun::star;
65cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
66cdf0e10cSrcweir using namespace ::com::sun::star::form;
67cdf0e10cSrcweir using namespace ::com::sun::star::beans;
DBG_NAME(rpt_OPropertyHandlerFactory)68cdf0e10cSrcweir DBG_NAME(rpt_OPropertyHandlerFactory)
69cdf0e10cSrcweir OPropertyHandlerFactory::OPropertyHandlerFactory()
70cdf0e10cSrcweir {
71cdf0e10cSrcweir DBG_CTOR(rpt_OPropertyHandlerFactory,NULL);
72cdf0e10cSrcweir }
73cdf0e10cSrcweir // -----------------------------------------------------------------------------
~OPropertyHandlerFactory()74cdf0e10cSrcweir OPropertyHandlerFactory::~OPropertyHandlerFactory()
75cdf0e10cSrcweir {
76cdf0e10cSrcweir DBG_DTOR(rpt_OPropertyHandlerFactory,NULL);
77cdf0e10cSrcweir }
78cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetPropertyHandler(sal_Int32 _nType) const79cdf0e10cSrcweir const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32 _nType) const
80cdf0e10cSrcweir {
81cdf0e10cSrcweir const XMLPropertyHandler* pHandler = NULL;
82cdf0e10cSrcweir sal_Int32 nType = _nType;
83cdf0e10cSrcweir nType &= MID_FLAG_MASK;
84cdf0e10cSrcweir
85cdf0e10cSrcweir switch(nType)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir case XML_RPT_ALGINMENT:
88cdf0e10cSrcweir {
89cdf0e10cSrcweir static SvXMLEnumMapEntry __READONLY_DATA pXML_VerticalAlign_Enum[] =
90cdf0e10cSrcweir {
91cdf0e10cSrcweir { XML_TOP, style::VerticalAlignment_TOP },
92cdf0e10cSrcweir { XML_MIDDLE, style::VerticalAlignment_MIDDLE },
93cdf0e10cSrcweir { XML_BOTTOM, style::VerticalAlignment_BOTTOM },
94cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 }
95cdf0e10cSrcweir };
96cdf0e10cSrcweir
97cdf0e10cSrcweir pHandler = new XMLEnumPropertyHdl( pXML_VerticalAlign_Enum, ::getCppuType((const com::sun::star::style::VerticalAlignment*)0) );
98cdf0e10cSrcweir }
99cdf0e10cSrcweir break;
100cdf0e10cSrcweir case (XML_SD_TYPES_START+34):
101cdf0e10cSrcweir pHandler = new xmloff::ImageScaleModeHandler();
102cdf0e10cSrcweir default:
103cdf0e10cSrcweir ;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir
106cdf0e10cSrcweir if ( !pHandler )
107cdf0e10cSrcweir pHandler = OControlPropertyHandlerFactory::GetPropertyHandler(_nType);
108cdf0e10cSrcweir else
109cdf0e10cSrcweir PutHdlCache(nType, pHandler);
110cdf0e10cSrcweir return pHandler;
111cdf0e10cSrcweir }
112cdf0e10cSrcweir // -----------------------------------------------------------------------------
113cdf0e10cSrcweir #define MAP_CONST( name, prefix, token, type, context ) { name.ascii, name.length, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TEXT, context, SvtSaveOptions::ODFVER_010 }
114cdf0e10cSrcweir #define MAP_CONST_T( name, prefix, token, type, context ) { name.ascii, name.length, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TABLE, context, SvtSaveOptions::ODFVER_010 }
115cdf0e10cSrcweir #define MAP_CONST_ASCII_T( name, prefix, token, type, context ) { name, sizeof(name)-1,XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TABLE, context, SvtSaveOptions::ODFVER_010 }
116cdf0e10cSrcweir #define MAP_CONST_P( name, prefix, token, type, context ) { name.ascii, name.length, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_PARAGRAPH, context, SvtSaveOptions::ODFVER_010 }
117cdf0e10cSrcweir #define MAP_CONST_S( name, prefix, token, type, context ) { name, sizeof(name)-1, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_SECTION, context, SvtSaveOptions::ODFVER_010 }
118cdf0e10cSrcweir #define MAP_CONST_ASCII( name, prefix, token, type, context ) { name, sizeof(name)-1, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TEXT, context, SvtSaveOptions::ODFVER_010 }
119cdf0e10cSrcweir #define GMAP( name, prefix, token, type, context ) { name.ascii, name.length, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_GRAPHIC, context, SvtSaveOptions::ODFVER_010 }
120cdf0e10cSrcweir #define MAP_CONST_C_ASCII( name, prefix, token, type, context ) { name, sizeof(name)-1, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TABLE_CELL, context, SvtSaveOptions::ODFVER_010 }
12146914292SHerbert Dürr #define MAP_CONST_C( name, prefix, token, type, context ) { name, name.length, XML_NAMESPACE_##prefix, XML_##token, static_cast<sal_Int32>(type|XML_TYPE_PROP_TABLE_CELL), context, SvtSaveOptions::ODFVER_010 }
122cdf0e10cSrcweir #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0 ,0, SvtSaveOptions::ODFVER_010}
123cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetCellStylePropertyMap(bool _bOldFormat)124cdf0e10cSrcweir UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _bOldFormat)
125cdf0e10cSrcweir {
126cdf0e10cSrcweir if ( _bOldFormat )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir static const XMLPropertyMapEntry s_aXMLCellStylesProperties[] =
129cdf0e10cSrcweir {
130cdf0e10cSrcweir MAP_CONST_C( PROPERTY_FORMATKEY, STYLE, DATA_STYLE_NAME, XML_TYPE_NUMBER | MID_FLAG_SPECIAL_ITEM, CTF_RPT_NUMBERFORMAT ),
131cdf0e10cSrcweir
132cdf0e10cSrcweir MAP_CONST_C( PROPERTY_CONTROLBACKGROUND,
133cdf0e10cSrcweir FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
134cdf0e10cSrcweir MAP_CONST_C( PROPERTY_VERTICALALIGN, STYLE, VERTICAL_ALIGN, XML_RPT_ALGINMENT, 0 ),
135cdf0e10cSrcweir MAP_CONST_C( PROPERTY_CONTROLBACKGROUNDTRANSPARENT,
136cdf0e10cSrcweir FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
137cdf0e10cSrcweir MAP_CONST_P( PROPERTY_CONTROLBACKGROUND,
138cdf0e10cSrcweir FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
139cdf0e10cSrcweir MAP_CONST_P( PROPERTY_CONTROLBACKGROUNDTRANSPARENT,
140cdf0e10cSrcweir FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
141cdf0e10cSrcweir MAP_CONST_C_ASCII( "BorderLeft", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ),
142cdf0e10cSrcweir MAP_CONST_C_ASCII( "BorderRight", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ),
143cdf0e10cSrcweir MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ),
144cdf0e10cSrcweir MAP_CONST_C_ASCII( "BorderBottom", FO, BORDER_BOTTOM, XML_TYPE_BORDER, 0 ),
145cdf0e10cSrcweir MAP_END()
146cdf0e10cSrcweir };
147cdf0e10cSrcweir return new XMLPropertySetMapper((XMLPropertyMapEntry*)s_aXMLCellStylesProperties,new OPropertyHandlerFactory());
148cdf0e10cSrcweir }
149cdf0e10cSrcweir else
150cdf0e10cSrcweir {
151cdf0e10cSrcweir static const XMLPropertyMapEntry s_aXMLCellStylesProperties[] =
152cdf0e10cSrcweir {
153cdf0e10cSrcweir MAP_CONST_C( PROPERTY_FORMATKEY, STYLE, DATA_STYLE_NAME, XML_TYPE_NUMBER | MID_FLAG_SPECIAL_ITEM, CTF_RPT_NUMBERFORMAT ),
154cdf0e10cSrcweir
155cdf0e10cSrcweir MAP_CONST_C( PROPERTY_CONTROLBACKGROUND,
156cdf0e10cSrcweir FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
157cdf0e10cSrcweir MAP_CONST_C( PROPERTY_CONTROLBACKGROUNDTRANSPARENT,
158cdf0e10cSrcweir FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT|MID_FLAG_MERGE_ATTRIBUTE, 0 ),
159cdf0e10cSrcweir MAP_CONST_C( PROPERTY_VERTICALALIGN,
160cdf0e10cSrcweir STYLE, VERTICAL_ALIGN, XML_RPT_ALGINMENT, 0 ),
161cdf0e10cSrcweir MAP_CONST_C_ASCII( "BorderLeft", FO, BORDER_LEFT, XML_TYPE_BORDER, 0 ),
162cdf0e10cSrcweir MAP_CONST_C_ASCII( "BorderRight", FO, BORDER_RIGHT, XML_TYPE_BORDER, 0 ),
163cdf0e10cSrcweir MAP_CONST_C_ASCII( "BorderTop", FO, BORDER_TOP, XML_TYPE_BORDER, 0 ),
164cdf0e10cSrcweir MAP_CONST_C_ASCII( "BorderBottom", FO, BORDER_BOTTOM, XML_TYPE_BORDER, 0 ),
165cdf0e10cSrcweir MAP_END()
166cdf0e10cSrcweir };
167cdf0e10cSrcweir return new XMLPropertySetMapper((XMLPropertyMapEntry*)s_aXMLCellStylesProperties,new OPropertyHandlerFactory());
168cdf0e10cSrcweir }
169cdf0e10cSrcweir }
170cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetTableStyleProps()171cdf0e10cSrcweir const XMLPropertyMapEntry* OXMLHelper::GetTableStyleProps()
172cdf0e10cSrcweir {
173cdf0e10cSrcweir static const XMLPropertyMapEntry aXMLTableStylesProperties[] =
174cdf0e10cSrcweir {
175cdf0e10cSrcweir MAP_CONST_T( PROPERTY_BACKCOLOR, FO, BACKGROUND_COLOR, XML_TYPE_COLORTRANSPARENT|MID_FLAG_MULTI_PROPERTY, 0 ),
176cdf0e10cSrcweir MAP_CONST_T( PROPERTY_BACKTRANSPARENT,FO, BACKGROUND_COLOR, XML_TYPE_ISTRANSPARENT | MID_FLAG_MERGE_ATTRIBUTE, 0 ),
177cdf0e10cSrcweir // MAP_CONST_T( PROPERTY_KEEPTOGETHER, STYLE, MAY_BREAK_BETWEEN_ROWS, XML_TYPE_BOOL , 0 ),
178cdf0e10cSrcweir MAP_END()
179cdf0e10cSrcweir };
180cdf0e10cSrcweir return aXMLTableStylesProperties;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetRowStyleProps()183cdf0e10cSrcweir const XMLPropertyMapEntry* OXMLHelper::GetRowStyleProps()
184cdf0e10cSrcweir {
185cdf0e10cSrcweir static const XMLPropertyMapEntry aXMLStylesProperties[] =
186cdf0e10cSrcweir {
187cdf0e10cSrcweir MAP_CONST_S( "Height", STYLE, ROW_HEIGHT, XML_TYPE_PROP_TABLE_ROW|XML_TYPE_MEASURE, 0),
188cdf0e10cSrcweir MAP_END()
189cdf0e10cSrcweir };
190cdf0e10cSrcweir return aXMLStylesProperties;
191cdf0e10cSrcweir }
192cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetColumnStyleProps()193cdf0e10cSrcweir const XMLPropertyMapEntry* OXMLHelper::GetColumnStyleProps()
194cdf0e10cSrcweir {
195cdf0e10cSrcweir static const XMLPropertyMapEntry aXMLColumnStylesProperties[] =
196cdf0e10cSrcweir {
197cdf0e10cSrcweir //MAP( "IsManualPageBreak", XML_NAMESPACE_FO, XML_BREAK_BEFORE, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_BREAKBEFORE, 0),
198cdf0e10cSrcweir //MAP( "IsVisible", XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TYPE_PROP_TABLE_COLUMN|XML_SC_TYPE_EQUAL|MID_FLAG_SPECIAL_ITEM, CTF_SC_ISVISIBLE ),
199cdf0e10cSrcweir MAP_CONST_S( "Width", STYLE, COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_MEASURE, 0 ),
200cdf0e10cSrcweir // MAP( "OptimalWidth", XML_NAMESPACE_STYLE, XML_USE_OPTIMAL_COLUMN_WIDTH, XML_TYPE_PROP_TABLE_COLUMN|XML_TYPE_BOOL, 0),
201cdf0e10cSrcweir MAP_END()
202cdf0e10cSrcweir };
203cdf0e10cSrcweir return aXMLColumnStylesProperties;
204cdf0e10cSrcweir }
205cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetReportPrintOptions()206cdf0e10cSrcweir const SvXMLEnumMapEntry* OXMLHelper::GetReportPrintOptions()
207cdf0e10cSrcweir {
208cdf0e10cSrcweir static SvXMLEnumMapEntry s_aXML_EnumMap[] =
209cdf0e10cSrcweir {
210cdf0e10cSrcweir // { XML_ALL_PAGES, report::ReportPrintOption::ALL_PAGES }, // default
211cdf0e10cSrcweir { XML_NOT_WITH_REPORT_HEADER, report::ReportPrintOption::NOT_WITH_REPORT_HEADER },
212cdf0e10cSrcweir { XML_NOT_WITH_REPORT_FOOTER, report::ReportPrintOption::NOT_WITH_REPORT_FOOTER },
213cdf0e10cSrcweir { XML_NOT_WITH_REPORT_HEADER_NOR_FOOTER, report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER },
214cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 }
215cdf0e10cSrcweir };
216cdf0e10cSrcweir return s_aXML_EnumMap;
217cdf0e10cSrcweir }
218cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetForceNewPageOptions()219cdf0e10cSrcweir const SvXMLEnumMapEntry* OXMLHelper::GetForceNewPageOptions()
220cdf0e10cSrcweir {
221cdf0e10cSrcweir static SvXMLEnumMapEntry s_aXML_EnumMap[] =
222cdf0e10cSrcweir {
223cdf0e10cSrcweir // { XML_NONE, report::ForceNewPage::NONE }, // default
224cdf0e10cSrcweir { XML_BEFORE_SECTION, report::ForceNewPage::BEFORE_SECTION },
225cdf0e10cSrcweir { XML_AFTER_SECTION, report::ForceNewPage::AFTER_SECTION },
226cdf0e10cSrcweir { XML_BEFORE_AFTER_SECTION, report::ForceNewPage::BEFORE_AFTER_SECTION },
227cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 }
228cdf0e10cSrcweir };
229cdf0e10cSrcweir return s_aXML_EnumMap;
230cdf0e10cSrcweir }
231cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetKeepTogetherOptions()232cdf0e10cSrcweir const SvXMLEnumMapEntry* OXMLHelper::GetKeepTogetherOptions()
233cdf0e10cSrcweir {
234cdf0e10cSrcweir static SvXMLEnumMapEntry s_aXML_EnumMap[] =
235cdf0e10cSrcweir {
236cdf0e10cSrcweir // { XML_NO, report::KeepTogether::NO }, // default
237cdf0e10cSrcweir { XML_WHOLE_GROUP, report::KeepTogether::WHOLE_GROUP },
238cdf0e10cSrcweir { XML_WITH_FIRST_DETAIL, report::KeepTogether::WITH_FIRST_DETAIL },
239cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 }
240cdf0e10cSrcweir };
241cdf0e10cSrcweir return s_aXML_EnumMap;
242cdf0e10cSrcweir }
243cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetCommandTypeOptions()244cdf0e10cSrcweir const SvXMLEnumMapEntry* OXMLHelper::GetCommandTypeOptions()
245cdf0e10cSrcweir {
246cdf0e10cSrcweir static SvXMLEnumMapEntry s_aXML_EnumMap[] =
247cdf0e10cSrcweir {
248cdf0e10cSrcweir { XML_TABLE, CommandType::TABLE },
249cdf0e10cSrcweir { XML_QUERY, CommandType::QUERY },
250cdf0e10cSrcweir // { XML_COMMAND, CommandType::COMMAND }, // default
251cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 }
252cdf0e10cSrcweir };
253cdf0e10cSrcweir return s_aXML_EnumMap;
254cdf0e10cSrcweir }
255cdf0e10cSrcweir // -----------------------------------------------------------------------------
256cdf0e10cSrcweir #define PROPERTY_ID_FONTNAME 1
257cdf0e10cSrcweir #define PROPERTY_ID_FONTHEIGHT 2
258cdf0e10cSrcweir #define PROPERTY_ID_FONTWIDTH 3
259cdf0e10cSrcweir #define PROPERTY_ID_FONTSTYLENAME 4
260cdf0e10cSrcweir #define PROPERTY_ID_FONTFAMILY 5
261cdf0e10cSrcweir #define PROPERTY_ID_FONTCHARSET 6
262cdf0e10cSrcweir #define PROPERTY_ID_FONTPITCH 7
263cdf0e10cSrcweir #define PROPERTY_ID_FONTCHARWIDTH 8
264cdf0e10cSrcweir #define PROPERTY_ID_FONTWEIGHT 9
265cdf0e10cSrcweir #define PROPERTY_ID_FONTSLANT 10
266cdf0e10cSrcweir #define PROPERTY_ID_FONTUNDERLINE 11
267cdf0e10cSrcweir #define PROPERTY_ID_FONTSTRIKEOUT 12
268cdf0e10cSrcweir #define PROPERTY_ID_FONTORIENTATION 13
269cdf0e10cSrcweir #define PROPERTY_ID_FONTKERNING 14
270cdf0e10cSrcweir #define PROPERTY_ID_FONTWORDLINEMODE 15
271cdf0e10cSrcweir #define PROPERTY_ID_FONTTYPE 16
copyStyleElements(const bool _bOld,const::rtl::OUString & _sStyleName,const SvXMLStylesContext * _pAutoStyles,const uno::Reference<beans::XPropertySet> & _xProp)272cdf0e10cSrcweir void OXMLHelper::copyStyleElements(const bool _bOld,const ::rtl::OUString& _sStyleName,const SvXMLStylesContext* _pAutoStyles,const uno::Reference<beans::XPropertySet>& _xProp)
273cdf0e10cSrcweir {
274cdf0e10cSrcweir if ( !_xProp.is() || !_sStyleName.getLength() || !_pAutoStyles )
275cdf0e10cSrcweir return;
276cdf0e10cSrcweir XMLPropStyleContext* pAutoStyle = PTR_CAST(XMLPropStyleContext,_pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_TABLE_CELL,_sStyleName));
277cdf0e10cSrcweir if ( pAutoStyle )
278cdf0e10cSrcweir {
279cdf0e10cSrcweir ::com::sun::star::awt::FontDescriptor aFont;
280cdf0e10cSrcweir static comphelper::PropertyMapEntry pMap[] =
281cdf0e10cSrcweir {
282cdf0e10cSrcweir {PROPERTY_FONTNAME, static_cast<sal_uInt16>(PROPERTY_FONTNAME.length), PROPERTY_ID_FONTNAME, &::getCppuType(&aFont.Name) ,PropertyAttribute::BOUND,0},
283cdf0e10cSrcweir {PROPERTY_CHARFONTHEIGHT, static_cast<sal_uInt16>(PROPERTY_CHARFONTHEIGHT.length), PROPERTY_ID_FONTHEIGHT, &::getCppuType(&aFont.Height) ,PropertyAttribute::BOUND,0},
284cdf0e10cSrcweir {PROPERTY_FONTWIDTH, static_cast<sal_uInt16>(PROPERTY_FONTWIDTH.length), PROPERTY_ID_FONTWIDTH, &::getCppuType(&aFont.Width) ,PropertyAttribute::BOUND,0},
285cdf0e10cSrcweir {PROPERTY_FONTSTYLENAME, static_cast<sal_uInt16>(PROPERTY_FONTSTYLENAME.length), PROPERTY_ID_FONTSTYLENAME, &::getCppuType(&aFont.StyleName) ,PropertyAttribute::BOUND,0},
286cdf0e10cSrcweir {PROPERTY_FONTFAMILY, static_cast<sal_uInt16>(PROPERTY_FONTFAMILY.length), PROPERTY_ID_FONTFAMILY, &::getCppuType(&aFont.Family) ,PropertyAttribute::BOUND,0},
287cdf0e10cSrcweir {PROPERTY_FONTCHARSET, static_cast<sal_uInt16>(PROPERTY_FONTCHARSET.length), PROPERTY_ID_FONTCHARSET, &::getCppuType(&aFont.CharSet) ,PropertyAttribute::BOUND,0},
288cdf0e10cSrcweir {PROPERTY_FONTPITCH, static_cast<sal_uInt16>(PROPERTY_FONTPITCH.length), PROPERTY_ID_FONTPITCH, &::getCppuType(&aFont.Pitch) ,PropertyAttribute::BOUND,0},
289cdf0e10cSrcweir {PROPERTY_FONTCHARWIDTH, static_cast<sal_uInt16>(PROPERTY_FONTCHARWIDTH.length), PROPERTY_ID_FONTCHARWIDTH, &::getCppuType(&aFont.CharacterWidth),PropertyAttribute::BOUND,0},
290cdf0e10cSrcweir {PROPERTY_FONTWEIGHT, static_cast<sal_uInt16>(PROPERTY_FONTWEIGHT.length), PROPERTY_ID_FONTWEIGHT, &::getCppuType(&aFont.Weight) ,PropertyAttribute::BOUND,0},
291cdf0e10cSrcweir {PROPERTY_CHARPOSTURE, static_cast<sal_uInt16>(PROPERTY_CHARPOSTURE.length), PROPERTY_ID_FONTSLANT, &::getCppuType(&aFont.Slant) ,PropertyAttribute::BOUND,0},
292cdf0e10cSrcweir {PROPERTY_FONTUNDERLINE, static_cast<sal_uInt16>(PROPERTY_FONTUNDERLINE.length), PROPERTY_ID_FONTUNDERLINE, &::getCppuType(&aFont.Underline) ,PropertyAttribute::BOUND,0},
293cdf0e10cSrcweir {PROPERTY_CHARSTRIKEOUT, static_cast<sal_uInt16>(PROPERTY_CHARSTRIKEOUT.length), PROPERTY_ID_FONTSTRIKEOUT, &::getCppuType(&aFont.Strikeout) ,PropertyAttribute::BOUND,0},
294cdf0e10cSrcweir {PROPERTY_FONTORIENTATION, static_cast<sal_uInt16>(PROPERTY_FONTORIENTATION.length), PROPERTY_ID_FONTORIENTATION, &::getCppuType(&aFont.Orientation) ,PropertyAttribute::BOUND,0},
295cdf0e10cSrcweir {PROPERTY_FONTKERNING, static_cast<sal_uInt16>(PROPERTY_FONTKERNING.length), PROPERTY_ID_FONTKERNING, &::getCppuType(&aFont.Kerning) ,PropertyAttribute::BOUND,0},
296cdf0e10cSrcweir {PROPERTY_CHARWORDMODE, static_cast<sal_uInt16>(PROPERTY_CHARWORDMODE.length), PROPERTY_ID_FONTWORDLINEMODE, &::getCppuType(&aFont.WordLineMode) ,PropertyAttribute::BOUND,0},
297cdf0e10cSrcweir {PROPERTY_FONTTYPE, static_cast<sal_uInt16>(PROPERTY_FONTTYPE.length), PROPERTY_ID_FONTTYPE, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0},
298cdf0e10cSrcweir //{PROPERTY_BACKGROUNDCOLOR, static_cast<sal_uInt16>(PROPERTY_BACKGROUNDCOLOR.length), PROPERTY_ID_BACKGROUNDCOLOR, &::getCppuType(&nBackgroundColor) ,PropertyAttribute::BOUND,0},,
299cdf0e10cSrcweir //{PROPERTY_PARAADJUST, static_cast<sal_uInt16>(PROPERTY_PARAADJUST.length), PROPERTY_ID_ALIGN, &::getCppuType(&nAlign) ,PropertyAttribute::BOUND,0},,
300cdf0e10cSrcweir //{PROPERTY_CONTROLBORDER, static_cast<sal_uInt16>(PROPERTY_CONTROLBORDER.length), PROPERTY_ID_BORDER, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0},,
301cdf0e10cSrcweir //{PROPERTY_CONTROLBORDERCOLOR, static_cast<sal_uInt16>(PROPERTY_CONTROLBORDERCOLOR.length), PROPERTY_ID_BORDERCOLOR, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0},,
302cdf0e10cSrcweir //{PROPERTY_CHARCOLOR, static_cast<sal_uInt16>(PROPERTY_TEXTCOLOR.length), PROPERTY_ID_TEXTCOLOR, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0},,
303cdf0e10cSrcweir //{PROPERTY_FORMATKEY, static_cast<sal_uInt16>(PROPERTY_FORMATKEY.length), PROPERTY_ID_FORMATKEY, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0},,
304cdf0e10cSrcweir //{PROPERTY_CHARUNDERLINECOLOR, static_cast<sal_uInt16>(PROPERTY_CHARUNDERLINECOLOR.length), PROPERTY_ID_TEXTLINECOLOR, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0},,
305cdf0e10cSrcweir { NULL, 0, 0, NULL, 0, 0 }
306cdf0e10cSrcweir };
307cdf0e10cSrcweir try
308cdf0e10cSrcweir {
309cdf0e10cSrcweir pAutoStyle->FillPropertySet(_xProp);
310cdf0e10cSrcweir if ( _bOld && _xProp->getPropertySetInfo()->hasPropertyByName(PROPERTY_CHARHIDDEN) )
311cdf0e10cSrcweir _xProp->setPropertyValue(PROPERTY_CHARHIDDEN,uno::makeAny(sal_False));
312cdf0e10cSrcweir
313cdf0e10cSrcweir uno::Reference<beans::XPropertySet> xProp = comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap));
314cdf0e10cSrcweir pAutoStyle->FillPropertySet(xProp);
315cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTNAME) >>= aFont.Name;
316cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_CHARFONTHEIGHT) >>= aFont.Height;
317cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTWIDTH) >>= aFont.Width;
318cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTSTYLENAME) >>= aFont.StyleName;
319cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTFAMILY) >>= aFont.Family;
320cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTCHARSET) >>= aFont.CharSet;
321cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTPITCH) >>= aFont.Pitch;
322cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTCHARWIDTH) >>= aFont.CharacterWidth;
323cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTWEIGHT) >>= aFont.Weight;
324cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_CHARPOSTURE) >>= aFont.Slant;
325cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTUNDERLINE) >>= aFont.Underline;
326cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_CHARSTRIKEOUT) >>= aFont.Strikeout;
327cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTORIENTATION) >>= aFont.Orientation;
328cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTKERNING) >>= aFont.Kerning;
329cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_CHARWORDMODE) >>= aFont.WordLineMode;
330cdf0e10cSrcweir xProp->getPropertyValue(PROPERTY_FONTTYPE) >>= aFont.Type;
331cdf0e10cSrcweir uno::Reference<report::XReportControlFormat> xReportControlModel(_xProp,uno::UNO_QUERY);
332cdf0e10cSrcweir if ( xReportControlModel.is() && aFont.Name.getLength() )
333cdf0e10cSrcweir {
334cdf0e10cSrcweir try
335cdf0e10cSrcweir {
336cdf0e10cSrcweir xReportControlModel->setFontDescriptor(aFont);
337cdf0e10cSrcweir }
338cdf0e10cSrcweir catch(beans::UnknownPropertyException){}
339cdf0e10cSrcweir }
340cdf0e10cSrcweir }
341cdf0e10cSrcweir catch(uno::Exception&)
342cdf0e10cSrcweir {
343cdf0e10cSrcweir OSL_ENSURE(0,"OXMLHelper::copyStyleElements -> exception catched");
344cdf0e10cSrcweir }
345cdf0e10cSrcweir }
346cdf0e10cSrcweir }
347cdf0e10cSrcweir // -----------------------------------------------------------------------------
createBorderPropertySet()348cdf0e10cSrcweir uno::Reference<beans::XPropertySet> OXMLHelper::createBorderPropertySet()
349cdf0e10cSrcweir {
350cdf0e10cSrcweir static comphelper::PropertyMapEntry pMap[] =
351cdf0e10cSrcweir {
352cdf0e10cSrcweir {PROPERTY_BORDERLEFT, static_cast<sal_uInt16>(PROPERTY_BORDERLEFT.length), 0, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0},
353cdf0e10cSrcweir {PROPERTY_BORDERRIGHT, static_cast<sal_uInt16>(PROPERTY_BORDERRIGHT.length), 1, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0},
354cdf0e10cSrcweir {PROPERTY_BORDERTOP, static_cast<sal_uInt16>(PROPERTY_BORDERTOP.length), 2, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0},
355cdf0e10cSrcweir {PROPERTY_BORDERBOTTOM, static_cast<sal_uInt16>(PROPERTY_BORDERBOTTOM.length), 3, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0},
356cdf0e10cSrcweir { NULL, 0, 0, NULL, 0, 0 }
357cdf0e10cSrcweir };
358cdf0e10cSrcweir return comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap));
359cdf0e10cSrcweir }
360cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetReportElemTokenMap()361cdf0e10cSrcweir SvXMLTokenMap* OXMLHelper::GetReportElemTokenMap()
362cdf0e10cSrcweir {
363cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aElemTokenMap[]=
364cdf0e10cSrcweir {
365cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_REPORT_HEADER, XML_TOK_REPORT_HEADER },
366cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_PAGE_HEADER , XML_TOK_PAGE_HEADER },
367cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_GROUP, XML_TOK_GROUP },
368cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_DETAIL , XML_TOK_DETAIL },
369cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_PAGE_FOOTER , XML_TOK_PAGE_FOOTER },
370cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_REPORT_FOOTER, XML_TOK_REPORT_FOOTER },
371cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_HEADER_ON_NEW_PAGE, XML_TOK_HEADER_ON_NEW_PAGE },
372cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_FOOTER_ON_NEW_PAGE, XML_TOK_FOOTER_ON_NEW_PAGE },
373cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_COMMAND_TYPE, XML_TOK_COMMAND_TYPE },
374cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_COMMAND, XML_TOK_COMMAND },
375cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_FILTER, XML_TOK_FILTER },
376cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_CAPTION, XML_TOK_CAPTION },
377cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_ESCAPE_PROCESSING, XML_TOK_ESCAPE_PROCESSING },
378cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_FUNCTION, XML_TOK_REPORT_FUNCTION },
379cdf0e10cSrcweir { XML_NAMESPACE_OFFICE, XML_MIMETYPE, XML_TOK_REPORT_MIMETYPE },
380cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_REPORT_NAME },
381cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_MASTER_DETAIL_FIELDS, XML_TOK_MASTER_DETAIL_FIELDS },
382cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_FRAME, XML_TOK_SUB_FRAME },
383cdf0e10cSrcweir XML_TOKEN_MAP_END
384cdf0e10cSrcweir };
385cdf0e10cSrcweir return new SvXMLTokenMap( aElemTokenMap );
386cdf0e10cSrcweir }
387cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetSubDocumentElemTokenMap()388cdf0e10cSrcweir SvXMLTokenMap* OXMLHelper::GetSubDocumentElemTokenMap()
389cdf0e10cSrcweir {
390cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aElemTokenMap[]=
391cdf0e10cSrcweir {
392cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_MASTER_DETAIL_FIELD, XML_TOK_MASTER_DETAIL_FIELD},
393cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_MASTER, XML_TOK_MASTER},
394cdf0e10cSrcweir { XML_NAMESPACE_REPORT, XML_DETAIL, XML_TOK_SUB_DETAIL},
395cdf0e10cSrcweir XML_TOKEN_MAP_END
396cdf0e10cSrcweir };
397cdf0e10cSrcweir return new SvXMLTokenMap( aElemTokenMap );
398cdf0e10cSrcweir }
399cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetImageScaleOptions()400cdf0e10cSrcweir const SvXMLEnumMapEntry* OXMLHelper::GetImageScaleOptions()
401cdf0e10cSrcweir {
402cdf0e10cSrcweir static SvXMLEnumMapEntry s_aXML_EnumMap[] =
403cdf0e10cSrcweir {
404b6dc695eSAriel Constenla-Haile // { XML_NONE, awt::ImageScaleMode::NONE }, // default
405b6dc695eSAriel Constenla-Haile { XML_ISOTROPIC, awt::ImageScaleMode::ISOTROPIC },
406b6dc695eSAriel Constenla-Haile { XML_ANISOTROPIC, awt::ImageScaleMode::ANISOTROPIC },
407cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 }
408cdf0e10cSrcweir };
409cdf0e10cSrcweir return s_aXML_EnumMap;
410cdf0e10cSrcweir }
411cdf0e10cSrcweir // -----------------------------------------------------------------------------
412cdf0e10cSrcweir // -----------------------------------------------------------------------------
413cdf0e10cSrcweir } // rptxml
414cdf0e10cSrcweir // -----------------------------------------------------------------------------
415