Branch data 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 : : #include "PropertyMapper.hxx"
21 : : #include "ContainerHelper.hxx"
22 : : #include "macros.hxx"
23 : :
24 : : #include <com/sun/star/beans/XMultiPropertySet.hpp>
25 : : #include <com/sun/star/drawing/LineStyle.hpp>
26 : : #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
27 : : #include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
28 : : #include <com/sun/star/drawing/LineJoint.hpp>
29 : :
30 : : //.............................................................................
31 : : namespace chart
32 : : {
33 : : //.............................................................................
34 : : using namespace ::com::sun::star;
35 : :
36 : : namespace
37 : : {
38 : :
39 : 152 : void lcl_overwriteOrAppendValues(
40 : : tPropertyNameValueMap &rMap, const tPropertyNameValueMap& rOverwriteMap )
41 : : {
42 : 152 : tPropertyNameValueMap::const_iterator aIt( rOverwriteMap.begin() );
43 : 152 : tPropertyNameValueMap::const_iterator aEnd( rOverwriteMap.end() );
44 : :
45 [ + + ]: 304 : for( ; aIt != aEnd; ++aIt )
46 [ + - ]: 152 : rMap[ aIt->first ] = aIt->second;
47 : 152 : }
48 : :
49 : : } // anonymous namespace
50 : :
51 : 14302 : void PropertyMapper::setMappedProperties(
52 : : const uno::Reference< beans::XPropertySet >& xTarget
53 : : , const uno::Reference< beans::XPropertySet >& xSource
54 : : , const tPropertyNameMap& rMap
55 : : , tPropertyNameValueMap* pOverwriteMap )
56 : : {
57 [ + - ][ - + ]: 14302 : if( !xTarget.is() || !xSource.is() )
[ + - ]
58 : 14302 : return;
59 : :
60 [ + - ]: 14302 : tNameSequence aNames;
61 [ + - ]: 14302 : tAnySequence aValues;
62 [ + - ]: 14302 : getMultiPropertyLists(aNames, aValues, xSource, rMap );
63 [ + + ][ + - ]: 14302 : if(pOverwriteMap && (aNames.getLength() == aValues.getLength()))
[ + + ]
64 : : {
65 [ + - ]: 152 : tPropertyNameValueMap aNewMap;
66 [ + + ]: 2736 : for( sal_Int32 nI=0; nI<aNames.getLength(); ++nI )
67 [ + - ][ + - ]: 2584 : aNewMap[ aNames[nI] ] = aValues[nI];
[ + - ]
68 [ + - ]: 152 : lcl_overwriteOrAppendValues( aNewMap, *pOverwriteMap );
69 [ + - ][ + - ]: 152 : aNames = ContainerHelper::MapKeysToSequence( aNewMap );
[ + - ]
70 [ + - ][ + - ]: 152 : aValues = ContainerHelper::MapValuesToSequence( aNewMap );
[ + - ]
71 : : }
72 : :
73 [ + - ][ + - ]: 14302 : PropertyMapper::setMultiProperties( aNames, aValues, xTarget );
[ + - ]
74 : : }
75 : :
76 : 25234 : void PropertyMapper::getValueMap(
77 : : tPropertyNameValueMap& rValueMap
78 : : , const tPropertyNameMap& rNameMap
79 : : , const uno::Reference< beans::XPropertySet >& xSourceProp
80 : : )
81 : : {
82 : 25234 : tPropertyNameMap::const_iterator aIt( rNameMap.begin() );
83 : 25234 : tPropertyNameMap::const_iterator aEnd( rNameMap.end() );
84 : :
85 [ + + ]: 707829 : for( ; aIt != aEnd; ++aIt )
86 : : {
87 : 682595 : rtl::OUString aTarget = aIt->first;
88 : 682595 : rtl::OUString aSource = aIt->second;
89 : : try
90 : : {
91 [ + - ][ + - ]: 682595 : uno::Any aAny( xSourceProp->getPropertyValue(aSource) );
92 [ + + ]: 682595 : if( aAny.hasValue() )
93 [ + - ][ # # ]: 682595 : rValueMap.insert( tPropertyNameValueMap::value_type( aTarget, aAny ) );
94 : : }
95 [ # # ]: 0 : catch( const uno::Exception& e )
96 : : {
97 : : ASSERT_EXCEPTION( e );
98 : : }
99 : 682595 : }
100 : 25234 : }
101 : :
102 : 14302 : void PropertyMapper::getMultiPropertyLists(
103 : : tNameSequence& rNames
104 : : , tAnySequence& rValues
105 : : , const uno::Reference< beans::XPropertySet >& xSourceProp
106 : : , const tPropertyNameMap& rNameMap
107 : : )
108 : : {
109 [ + - ]: 14302 : tPropertyNameValueMap aValueMap;
110 [ + - ]: 14302 : getValueMap( aValueMap, rNameMap, xSourceProp );
111 [ + - ]: 14302 : getMultiPropertyListsFromValueMap( rNames, rValues, aValueMap );
112 : 14302 : }
113 : :
114 : 25234 : void PropertyMapper::getMultiPropertyListsFromValueMap(
115 : : tNameSequence& rNames
116 : : , tAnySequence& rValues
117 : : , const tPropertyNameValueMap& rValueMap
118 : : )
119 : : {
120 : 25234 : sal_Int32 nPropertyCount = rValueMap.size();
121 [ + - ]: 25234 : rNames.realloc(nPropertyCount);
122 [ + - ]: 25234 : rValues.realloc(nPropertyCount);
123 : :
124 : : //fill sequences
125 : 25234 : tPropertyNameValueMap::const_iterator aValueIt( rValueMap.begin() );
126 : 25234 : tPropertyNameValueMap::const_iterator aValueEnd( rValueMap.end() );
127 : 25234 : sal_Int32 nN=0;
128 [ + + ]: 636166 : for( ; aValueIt != aValueEnd; ++aValueIt )
129 : : {
130 : 610932 : const uno::Any& rAny = aValueIt->second;
131 [ + - ]: 610932 : if( rAny.hasValue() )
132 : : {
133 : : //do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
134 [ + - ]: 610932 : rNames[nN] = aValueIt->first;
135 [ + - ]: 610932 : rValues[nN] = rAny;
136 : 610932 : ++nN;
137 : : }
138 : : }
139 : : //reduce to real property count
140 [ + - ]: 25234 : rNames.realloc(nN);
141 [ + - ]: 25234 : rValues.realloc(nN);
142 : 25234 : }
143 : :
144 : 22385 : uno::Any* PropertyMapper::getValuePointer( tAnySequence& rPropValues
145 : : , const tNameSequence& rPropNames
146 : : , const rtl::OUString& rPropName )
147 : : {
148 : 22385 : sal_Int32 nCount = rPropNames.getLength();
149 [ + + ]: 800191 : for( sal_Int32 nN = 0; nN < nCount; nN++ )
150 : : {
151 [ + + ]: 796871 : if(rPropNames[nN].equals(rPropName))
152 : 19065 : return &rPropValues[nN];
153 : : }
154 : 22385 : return NULL;
155 : : }
156 : :
157 : 3420 : uno::Any* PropertyMapper::getValuePointerForLimitedSpace( tAnySequence& rPropValues
158 : : , const tNameSequence& rPropNames
159 : : , bool bLimitedHeight)
160 : : {
161 : : return PropertyMapper::getValuePointer( rPropValues, rPropNames
162 [ + + ][ + - ]: 3420 : , bLimitedHeight ? C2U("TextMaximumFrameHeight") : C2U("TextMaximumFrameWidth") );
163 : : }
164 : :
165 : 5692 : const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForCharacterProperties()
166 : : {
167 : : //shape property -- chart model object property
168 : : static tMakePropertyNameMap m_aShapePropertyMapForCharacterProperties =
169 : : tMakePropertyNameMap
170 : : ( "CharColor", "CharColor" )
171 [ + - ][ + - ]: 24 : ( "CharContoured", "CharContoured" )
172 [ + - ]: 36 : ( "CharEmphasis", "CharEmphasis" )//the service style::CharacterProperties describes a property called 'CharEmphasize' wich is nowhere implemented
173 : :
174 [ + - ]: 36 : ( "CharFontFamily", "CharFontFamily" )
175 [ + - ]: 36 : ( "CharFontFamilyAsian", "CharFontFamilyAsian" )
176 [ + - ]: 36 : ( "CharFontFamilyComplex", "CharFontFamilyComplex" )
177 [ + - ]: 36 : ( "CharFontCharSet", "CharFontCharSet" )
178 [ + - ]: 36 : ( "CharFontCharSetAsian", "CharFontCharSetAsian" )
179 [ + - ]: 36 : ( "CharFontCharSetComplex", "CharFontCharSetComplex" )
180 [ + - ]: 36 : ( "CharFontName", "CharFontName" )
181 [ + - ]: 36 : ( "CharFontNameAsian", "CharFontNameAsian" )
182 [ + - ]: 36 : ( "CharFontNameComplex", "CharFontNameComplex" )
183 [ + - ]: 36 : ( "CharFontPitch", "CharFontPitch" )
184 [ + - ]: 36 : ( "CharFontPitchAsian", "CharFontPitchAsian" )
185 [ + - ]: 36 : ( "CharFontPitchComplex", "CharFontPitchComplex" )
186 [ + - ]: 36 : ( "CharFontStyleName", "CharFontStyleName" )
187 [ + - ]: 36 : ( "CharFontStyleNameAsian", "CharFontStyleNameAsian" )
188 [ + - ]: 36 : ( "CharFontStyleNameComplex", "CharFontStyleNameComplex" )
189 : :
190 [ + - ]: 36 : ( "CharHeight", "CharHeight" )
191 [ + - ]: 36 : ( "CharHeightAsian", "CharHeightAsian" )
192 [ + - ]: 36 : ( "CharHeightComplex", "CharHeightComplex" )
193 [ + - ]: 36 : ( "CharKerning", "CharKerning" )
194 [ + - ]: 36 : ( "CharLocale", "CharLocale" )
195 [ + - ]: 36 : ( "CharLocaleAsian", "CharLocaleAsian" )
196 [ + - ]: 36 : ( "CharLocaleComplex", "CharLocaleComplex" )
197 [ + - ]: 36 : ( "CharPosture", "CharPosture" )
198 [ + - ]: 36 : ( "CharPostureAsian", "CharPostureAsian" )
199 [ + - ]: 36 : ( "CharPostureComplex", "CharPostureComplex" )
200 [ + - ]: 36 : ( "CharRelief", "CharRelief" )
201 [ + - ]: 36 : ( "CharShadowed", "CharShadowed" )
202 [ + - ]: 36 : ( "CharStrikeout", "CharStrikeout" )
203 [ + - ]: 36 : ( "CharUnderline", "CharUnderline" )
204 [ + - ]: 36 : ( "CharUnderlineColor", "CharUnderlineColor" )
205 [ + - ]: 36 : ( "CharUnderlineHasColor", "CharUnderlineHasColor" )
206 [ + - ]: 36 : ( "CharOverline", "CharOverline" )
207 [ + - ]: 36 : ( "CharOverlineColor", "CharOverlineColor" )
208 [ + - ]: 36 : ( "CharOverlineHasColor", "CharOverlineHasColor" )
209 [ + - ]: 36 : ( "CharWeight", "CharWeight" )
210 [ + - ]: 36 : ( "CharWeightAsian", "CharWeightAsian" )
211 [ + - ]: 36 : ( "CharWeightComplex", "CharWeightComplex" )
212 [ + - ]: 36 : ( "CharWordMode", "CharWordMode" )
213 : :
214 [ + - ]: 36 : ( "WritingMode", "WritingMode" )
215 : :
216 [ + + ][ + - ]: 5716 : ( "ParaIsCharacterDistance", "ParaIsCharacterDistance" )
[ + - ][ + - ]
[ # # ]
217 : : ;
218 : 5692 : return m_aShapePropertyMapForCharacterProperties;
219 : : }
220 : :
221 : 916 : const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForParagraphProperties()
222 : : {
223 : : //shape property -- chart model object property
224 : : static tMakePropertyNameMap m_aShapePropertyMapForParagraphProperties =
225 : : tMakePropertyNameMap
226 : : ( "ParaAdjust", "ParaAdjust" )
227 [ + - ][ + - ]: 10 : ( "ParaBottomMargin", "ParaBottomMargin" )
228 [ + - ]: 15 : ( "ParaIsHyphenation", "ParaIsHyphenation" )
229 [ + - ]: 15 : ( "ParaLastLineAdjust", "ParaLastLineAdjust" )
230 [ + - ]: 15 : ( "ParaLeftMargin", "ParaLeftMargin" )
231 [ + - ]: 15 : ( "ParaRightMargin", "ParaRightMargin" )
232 [ + + ][ + - ]: 926 : ( "ParaTopMargin", "ParaTopMargin" )
[ + - ][ + - ]
[ # # ]
233 : : ;
234 : 916 : return m_aShapePropertyMapForParagraphProperties;
235 : : }
236 : :
237 : 3217 : const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFillProperties()
238 : : {
239 : : //shape property -- chart model object property
240 : : static tMakePropertyNameMap m_aShapePropertyMapForFillProperties =
241 : : tMakePropertyNameMap
242 : : ( "FillBackground", "FillBackground" )
243 [ + - ][ + - ]: 24 : ( "FillBitmapName", "FillBitmapName" )
244 [ + - ]: 36 : ( "FillColor", "FillColor" )
245 [ + - ]: 36 : ( "FillGradientName", "FillGradientName" )
246 [ + - ]: 36 : ( "FillGradientStepCount", "FillGradientStepCount" )
247 [ + - ]: 36 : ( "FillHatchName", "FillHatchName" )
248 [ + - ]: 36 : ( "FillStyle", "FillStyle" )
249 [ + - ]: 36 : ( "FillTransparence", "FillTransparence" )
250 [ + - ]: 36 : ( "FillTransparenceGradientName", "FillTransparenceGradientName" )
251 : : //bitmap properties
252 [ + - ]: 36 : ( "FillBitmapMode", "FillBitmapMode" )
253 [ + - ]: 36 : ( "FillBitmapSizeX", "FillBitmapSizeX" )
254 [ + - ]: 36 : ( "FillBitmapSizeY", "FillBitmapSizeY" )
255 [ + - ]: 36 : ( "FillBitmapLogicalSize", "FillBitmapLogicalSize" )
256 [ + - ]: 36 : ( "FillBitmapOffsetX", "FillBitmapOffsetX" )
257 [ + - ]: 36 : ( "FillBitmapOffsetY", "FillBitmapOffsetY" )
258 [ + - ]: 36 : ( "FillBitmapRectanglePoint", "FillBitmapRectanglePoint" )
259 [ + - ]: 36 : ( "FillBitmapPositionOffsetX", "FillBitmapPositionOffsetX" )
260 [ + + ][ + - ]: 3241 : ( "FillBitmapPositionOffsetY", "FillBitmapPositionOffsetY" )
[ + - ][ + - ]
[ # # ]
261 : : ;
262 : 3217 : return m_aShapePropertyMapForFillProperties;
263 : : }
264 : :
265 : 3724 : const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForLineProperties()
266 : : {
267 : : //shape property -- chart model object property
268 : : static tMakePropertyNameMap m_aShapePropertyMapForLineProperties =
269 : : tMakePropertyNameMap
270 : : ( "LineColor", "LineColor" )
271 [ + - ][ + - ]: 24 : ( "LineDashName", "LineDashName" )
272 [ + - ]: 36 : ( "LineJoint", "LineJoint" )
273 [ + - ]: 36 : ( "LineStyle", "LineStyle" )
274 [ + - ]: 36 : ( "LineTransparence", "LineTransparence" )
275 [ + + ][ + - ]: 3748 : ( "LineWidth", "LineWidth" )
[ + - ][ + - ]
[ # # ]
276 : : ;
277 : 3724 : return m_aShapePropertyMapForLineProperties;
278 : : }
279 : :
280 : 7177 : const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFillAndLineProperties()
281 : : {
282 : : static tMakePropertyNameMap m_aShapePropertyMapForFillAndLineProperties =
283 : : tMakePropertyNameMap
284 [ + - ]: 12 : ( PropertyMapper::getPropertyNameMapForFillProperties() )
285 [ + + ][ + - ]: 7189 : ( PropertyMapper::getPropertyNameMapForLineProperties() )
[ + - ][ + - ]
[ + - ][ + - ]
[ # # ]
286 : : ;
287 : :
288 : 7177 : return m_aShapePropertyMapForFillAndLineProperties;
289 : : }
290 : :
291 : 0 : const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForTextShapeProperties()
292 : : {
293 : : static tMakePropertyNameMap m_aShapePropertyMapForTextShapeProperties =
294 : : tMakePropertyNameMap
295 [ # # ]: 0 : ( PropertyMapper::getPropertyNameMapForCharacterProperties() )
296 [ # # ][ # # ]: 0 : ( PropertyMapper::getPropertyNameMapForFillProperties() )
[ # # ]
297 [ # # ][ # # ]: 0 : ( PropertyMapper::getPropertyNameMapForLineProperties() );
[ # # ][ # # ]
[ # # ][ # # ]
298 : :
299 : 0 : return m_aShapePropertyMapForTextShapeProperties;
300 : : }
301 : :
302 : 3564 : const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForLineSeriesProperties()
303 : : {
304 : : //shape property -- chart model object property
305 : : static tMakePropertyNameMap m_aShapePropertyMapForLineSeriesProperties =
306 : : tMakePropertyNameMap
307 : : ( "LineColor", "Color" )
308 [ + - ][ + - ]: 24 : ( "LineDashName", "LineDashName" )
309 [ + - ]: 36 : ( "LineStyle", "LineStyle" )
310 [ + - ]: 36 : ( "LineTransparence", "Transparency" )
311 [ + + ][ + - ]: 3588 : ( "LineWidth", "LineWidth" )
[ + - ][ + - ]
[ # # ]
312 : :
313 : : ;
314 : 3564 : return m_aShapePropertyMapForLineSeriesProperties;
315 : : }
316 : :
317 : 14704 : const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFilledSeriesProperties()
318 : : {
319 : : //shape property -- chart model object property
320 : : static tMakePropertyNameMap m_aShapePropertyMapForFilledSeriesProperties =
321 : : tMakePropertyNameMap
322 : : ( "FillBackground", "FillBackground" )
323 [ + - ][ + - ]: 24 : ( "FillBitmapName", "FillBitmapName" )
324 [ + - ]: 36 : ( "FillColor", "Color" )
325 [ + - ]: 36 : ( "FillGradientName", "GradientName" )
326 [ + - ]: 36 : ( "FillGradientStepCount", "GradientStepCount" )
327 [ + - ]: 36 : ( "FillHatchName", "HatchName" )
328 [ + - ]: 36 : ( "FillStyle", "FillStyle" )
329 [ + - ]: 36 : ( "FillTransparence", "Transparency" )
330 [ + - ]: 36 : ( "FillTransparenceGradientName", "TransparencyGradientName" )
331 : : //bitmap properties
332 [ + - ]: 36 : ( "FillBitmapMode", "FillBitmapMode" )
333 [ + - ]: 36 : ( "FillBitmapSizeX", "FillBitmapSizeX" )
334 [ + - ]: 36 : ( "FillBitmapSizeY", "FillBitmapSizeY" )
335 [ + - ]: 36 : ( "FillBitmapLogicalSize", "FillBitmapLogicalSize" )
336 [ + - ]: 36 : ( "FillBitmapOffsetX", "FillBitmapOffsetX" )
337 [ + - ]: 36 : ( "FillBitmapOffsetY", "FillBitmapOffsetY" )
338 [ + - ]: 36 : ( "FillBitmapRectanglePoint", "FillBitmapRectanglePoint" )
339 [ + - ]: 36 : ( "FillBitmapPositionOffsetX", "FillBitmapPositionOffsetX" )
340 [ + - ]: 36 : ( "FillBitmapPositionOffsetY", "FillBitmapPositionOffsetY" )
341 : : //line properties
342 [ + - ]: 36 : ( "LineColor", "BorderColor" )
343 [ + - ]: 36 : ( "LineDashName", "BorderDashName" )
344 [ + - ]: 36 : ( "LineStyle", "BorderStyle" )
345 [ + - ]: 36 : ( "LineTransparence", "BorderTransparency" )
346 [ + + ][ + - ]: 14728 : ( "LineWidth", "BorderWidth" )
[ + - ][ + - ]
[ # # ]
347 : : ;
348 : 14704 : return m_aShapePropertyMapForFilledSeriesProperties;
349 : : }
350 : :
351 : 41860 : void PropertyMapper::setMultiProperties(
352 : : const tNameSequence& rNames
353 : : , const tAnySequence& rValues
354 : : , const ::com::sun::star::uno::Reference<
355 : : ::com::sun::star::beans::XPropertySet >& xTarget )
356 : : {
357 : 41860 : bool bSuccess = false;
358 : : try
359 : : {
360 [ + - ]: 41860 : uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY );
361 [ + - ]: 41860 : if( xShapeMultiProp.is() )
362 : : {
363 [ + - ][ + - ]: 41860 : xShapeMultiProp->setPropertyValues( rNames, rValues );
364 : 41860 : bSuccess = true;
365 [ # # ]: 41860 : }
366 : : }
367 : 0 : catch( const uno::Exception& e )
368 : : {
369 : : ASSERT_EXCEPTION( e ); //if this occurs more often think of removing the XMultiPropertySet completly for better performance
370 : : }
371 : :
372 [ - + ]: 41860 : if(!bSuccess)
373 : : try
374 : : {
375 [ # # # # ]: 0 : sal_Int32 nCount = std::max( rNames.getLength(), rValues.getLength() );
376 : 0 : rtl::OUString aPropName;
377 : 0 : uno::Any aValue;
378 [ # # ]: 0 : for( sal_Int32 nN = 0; nN < nCount; nN++ )
379 : : {
380 : 0 : aPropName = rNames[nN];
381 : 0 : aValue = rValues[nN];
382 : :
383 : : try
384 : : {
385 [ # # ][ # # ]: 0 : xTarget->setPropertyValue( aPropName, aValue );
386 : : }
387 [ # # ]: 0 : catch( const uno::Exception& e )
388 : : {
389 : : ASSERT_EXCEPTION( e );
390 : : }
391 [ # # ]: 0 : }
392 : : }
393 : 0 : catch( const uno::Exception& e )
394 : : {
395 : : ASSERT_EXCEPTION( e );
396 : : }
397 : 41860 : }
398 : :
399 : 3820 : void PropertyMapper::getTextLabelMultiPropertyLists(
400 : : const uno::Reference< beans::XPropertySet >& xSourceProp
401 : : , tNameSequence& rPropNames, tAnySequence& rPropValues
402 : : , bool bName
403 : : , sal_Int32 nLimitedSpace
404 : : , bool bLimitedHeight )
405 : : {
406 : : //fill character properties into the ValueMap
407 [ + - ]: 3820 : tPropertyNameValueMap aValueMap;
408 : : PropertyMapper::getValueMap( aValueMap
409 [ + - ]: 3820 : , PropertyMapper::getPropertyNameMapForCharacterProperties()
410 [ + - ]: 3820 : , xSourceProp );
411 : :
412 : : //some more shape properties apart from character properties, position-matrix and label string
413 [ + - ][ + - ]: 3820 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("LineStyle"), uno::makeAny(drawing::LineStyle_NONE) ) ); // drawing::LineStyle
[ + - ]
414 [ + - ][ + - ]: 3820 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextHorizontalAdjust"), uno::makeAny(drawing::TextHorizontalAdjust_CENTER) ) ); // drawing::TextHorizontalAdjust - needs to be overwritten
[ + - ]
415 [ + - ][ + - ]: 3820 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextVerticalAdjust"), uno::makeAny(drawing::TextVerticalAdjust_CENTER) ) ); //drawing::TextVerticalAdjust - needs to be overwritten
[ + - ]
416 [ + - ][ + - ]: 3820 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowHeight"), uno::makeAny(sal_True) ) ); // sal_Bool
[ + - ]
417 [ + - ][ + - ]: 3820 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowWidth"), uno::makeAny(sal_True) ) ); // sal_Bool
[ + - ]
418 [ + + ]: 3820 : if( bName )
419 [ + - ][ + - ]: 400 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("Name"), uno::makeAny( rtl::OUString() ) ) ); //CID rtl::OUString - needs to be overwritten for each point
[ + - ]
420 : :
421 [ + + ]: 3820 : if( nLimitedSpace > 0 )
422 : : {
423 [ - + ]: 100 : if(bLimitedHeight)
424 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextMaximumFrameHeight"), uno::makeAny(nLimitedSpace) ) ); //sal_Int32
[ # # ]
425 : : else
426 [ + - ][ + - ]: 100 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextMaximumFrameWidth"), uno::makeAny(nLimitedSpace) ) ); //sal_Int32
[ + - ]
427 [ + - ][ + - ]: 100 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("ParaIsHyphenation"), uno::makeAny(sal_True) ) );
[ + - ]
428 : : }
429 : :
430 [ + - ]: 3820 : PropertyMapper::getMultiPropertyListsFromValueMap( rPropNames, rPropValues, aValueMap );
431 : 3820 : }
432 : :
433 : 0 : void PropertyMapper::getPreparedTextShapePropertyLists(
434 : : const uno::Reference< beans::XPropertySet >& xSourceProp
435 : : , tNameSequence& rPropNames, tAnySequence& rPropValues )
436 : : {
437 : : //fill character, line and fill properties into the ValueMap
438 [ # # ]: 0 : tPropertyNameValueMap aValueMap;
439 : : PropertyMapper::getValueMap( aValueMap
440 [ # # ]: 0 : , PropertyMapper::getPropertyNameMapForTextShapeProperties()
441 [ # # ]: 0 : , xSourceProp );
442 : :
443 : : // auto-grow makes sure the shape has the correct size after setting text
444 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextHorizontalAdjust"), uno::makeAny( drawing::TextHorizontalAdjust_CENTER )));
[ # # ]
445 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextVerticalAdjust"), uno::makeAny( drawing::TextVerticalAdjust_CENTER )));
[ # # ]
446 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowHeight"), uno::makeAny( true )));
[ # # ]
447 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextAutoGrowWidth"), uno::makeAny( true )));
[ # # ]
448 : :
449 : : // set some distance to the border, in case it is shown
450 : 0 : const sal_Int32 nWidthDist = 250;
451 : 0 : const sal_Int32 nHeightDist = 125;
452 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextLeftDistance"), uno::makeAny( nWidthDist )));
[ # # ]
453 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextRightDistance"), uno::makeAny( nWidthDist )));
[ # # ]
454 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextUpperDistance"), uno::makeAny( nHeightDist )));
[ # # ]
455 [ # # ][ # # ]: 0 : aValueMap.insert( tPropertyNameValueMap::value_type( C2U("TextLowerDistance"), uno::makeAny( nHeightDist )));
[ # # ]
456 : :
457 : : // use a line-joint showing the border of thick lines like two rectangles
458 : : // filled in between.
459 [ # # ][ # # ]: 0 : aValueMap[C2U("LineJoint")] <<= drawing::LineJoint_ROUND;
[ # # ]
460 : :
461 [ # # ]: 0 : PropertyMapper::getMultiPropertyListsFromValueMap( rPropNames, rPropValues, aValueMap );
462 : 0 : }
463 : :
464 : : //.............................................................................
465 : : } //namespace chart
466 : : //.............................................................................
467 : :
468 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|