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