/src/libreoffice/oox/source/helper/propertymap.cxx
Line | Count | Source |
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 <oox/helper/propertymap.hxx> |
21 | | |
22 | | #if OSL_DEBUG_LEVEL > 0 |
23 | | # include <cstdio> |
24 | | # include <com/sun/star/style/LineSpacing.hpp> |
25 | | # include <com/sun/star/text/WritingMode.hpp> |
26 | | using ::com::sun::star::style::LineSpacing; |
27 | | using ::com::sun::star::text::WritingMode; |
28 | | #include <comphelper/anytostring.hxx> |
29 | | #include <iostream> |
30 | | #endif |
31 | | |
32 | | #include <com/sun/star/beans/PropertyValue.hpp> |
33 | | #include <com/sun/star/beans/XPropertySet.hpp> |
34 | | #include <com/sun/star/beans/XPropertySetInfo.hpp> |
35 | | #include <com/sun/star/container/XIndexReplace.hpp> |
36 | | #include <com/sun/star/awt/Rectangle.hpp> |
37 | | #include <com/sun/star/awt/Size.hpp> |
38 | | #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> |
39 | | #include <com/sun/star/drawing/TextVerticalAdjust.hpp> |
40 | | #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> |
41 | | #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> |
42 | | #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> |
43 | | #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> |
44 | | #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> |
45 | | #include <com/sun/star/drawing/HomogenMatrix3.hpp> |
46 | | #include <cppuhelper/implbase.hxx> |
47 | | #include <osl/diagnose.h> |
48 | | #include <mutex> |
49 | | #include <sal/log.hxx> |
50 | | #include <oox/token/properties.hxx> |
51 | | #include <oox/token/propertynames.hxx> |
52 | | using ::com::sun::star::uno::Any; |
53 | | using ::com::sun::star::uno::Reference; |
54 | | using ::com::sun::star::uno::Sequence; |
55 | | using ::com::sun::star::beans::Property; |
56 | | using ::com::sun::star::beans::PropertyValue; |
57 | | using ::com::sun::star::beans::UnknownPropertyException; |
58 | | using ::com::sun::star::beans::XPropertyChangeListener; |
59 | | using ::com::sun::star::beans::XPropertySet; |
60 | | using ::com::sun::star::beans::XPropertySetInfo; |
61 | | using ::com::sun::star::beans::XVetoableChangeListener; |
62 | | using ::com::sun::star::container::XIndexReplace; |
63 | | |
64 | | #if OSL_DEBUG_LEVEL > 0 |
65 | | #define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr() |
66 | | using namespace ::com::sun::star; |
67 | | using namespace ::com::sun::star::drawing; |
68 | | using namespace ::com::sun::star::uno; |
69 | | using ::com::sun::star::style::LineSpacing; |
70 | | using ::com::sun::star::text::WritingMode; |
71 | | using ::com::sun::star::drawing::TextHorizontalAdjust; |
72 | | using ::com::sun::star::drawing::TextVerticalAdjust; |
73 | | #endif |
74 | | |
75 | | namespace oox { |
76 | | |
77 | | using namespace ::com::sun::star::beans; |
78 | | using namespace ::com::sun::star::lang; |
79 | | using namespace ::com::sun::star::drawing; |
80 | | using namespace ::com::sun::star::uno; |
81 | | |
82 | | namespace { |
83 | | |
84 | | /** This class implements a generic XPropertySet. |
85 | | |
86 | | Properties of all names and types can be set and later retrieved. |
87 | | TODO: move this to comphelper or better find an existing implementation |
88 | | */ |
89 | | class GenericPropertySet : public ::cppu::WeakImplHelper< XPropertySet, XPropertySetInfo > |
90 | | { |
91 | | public: |
92 | | explicit GenericPropertySet( const PropertyMap& rPropMap ); |
93 | | |
94 | | // XPropertySet |
95 | | virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() override; |
96 | | virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) override; |
97 | | virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; |
98 | | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) override; |
99 | | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& aListener ) override; |
100 | | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) override; |
101 | | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) override; |
102 | | |
103 | | // XPropertySetInfo |
104 | | virtual Sequence< Property > SAL_CALL getProperties() override; |
105 | | virtual Property SAL_CALL getPropertyByName( const OUString& aName ) override; |
106 | | virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override; |
107 | | |
108 | | private: |
109 | | std::mutex mMutex; |
110 | | PropertyNameMap maPropMap; |
111 | | }; |
112 | | |
113 | | GenericPropertySet::GenericPropertySet( const PropertyMap& rPropMap ) |
114 | 6.51k | { |
115 | 6.51k | rPropMap.fillPropertyNameMap(maPropMap); |
116 | 6.51k | } |
117 | | |
118 | | Reference< XPropertySetInfo > SAL_CALL GenericPropertySet::getPropertySetInfo() |
119 | 6.51k | { |
120 | 6.51k | return this; |
121 | 6.51k | } |
122 | | |
123 | | void SAL_CALL GenericPropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue ) |
124 | 0 | { |
125 | 0 | std::scoped_lock aGuard( mMutex ); |
126 | 0 | maPropMap[ rPropertyName ] = rValue; |
127 | 0 | } |
128 | | |
129 | | Any SAL_CALL GenericPropertySet::getPropertyValue( const OUString& rPropertyName ) |
130 | 19.7k | { |
131 | 19.7k | PropertyNameMap::iterator aIt = maPropMap.find( rPropertyName ); |
132 | 19.7k | if( aIt == maPropMap.end() ) |
133 | 0 | throw UnknownPropertyException(rPropertyName); |
134 | 19.7k | return aIt->second; |
135 | 19.7k | } |
136 | | |
137 | | // listeners are not supported by this implementation |
138 | 0 | void SAL_CALL GenericPropertySet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) {} |
139 | 0 | void SAL_CALL GenericPropertySet::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) {} |
140 | 0 | void SAL_CALL GenericPropertySet::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) {} |
141 | 0 | void SAL_CALL GenericPropertySet::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) {} |
142 | | |
143 | | // XPropertySetInfo |
144 | | Sequence< Property > SAL_CALL GenericPropertySet::getProperties() |
145 | 0 | { |
146 | 0 | Sequence< Property > aSeq( static_cast< sal_Int32 >( maPropMap.size() ) ); |
147 | 0 | Property* pProperty = aSeq.getArray(); |
148 | 0 | for (auto const& prop : maPropMap) |
149 | 0 | { |
150 | 0 | pProperty->Name = prop.first; |
151 | 0 | pProperty->Handle = 0; |
152 | 0 | pProperty->Type = prop.second.getValueType(); |
153 | 0 | pProperty->Attributes = 0; |
154 | 0 | ++pProperty; |
155 | 0 | } |
156 | 0 | return aSeq; |
157 | 0 | } |
158 | | |
159 | | Property SAL_CALL GenericPropertySet::getPropertyByName( const OUString& rPropertyName ) |
160 | 0 | { |
161 | 0 | PropertyNameMap::iterator aIt = maPropMap.find( rPropertyName ); |
162 | 0 | if( aIt == maPropMap.end() ) |
163 | 0 | throw UnknownPropertyException(rPropertyName); |
164 | 0 | Property aProperty; |
165 | 0 | aProperty.Name = aIt->first; |
166 | 0 | aProperty.Handle = 0; |
167 | 0 | aProperty.Type = aIt->second.getValueType(); |
168 | 0 | aProperty.Attributes = 0; |
169 | 0 | return aProperty; |
170 | 0 | } |
171 | | |
172 | | sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& rPropertyName ) |
173 | 208k | { |
174 | 208k | return maPropMap.contains(rPropertyName); |
175 | 208k | } |
176 | | |
177 | | } // namespace |
178 | | |
179 | | PropertyMap::PropertyMap() : |
180 | 23.3M | mpPropNames( &GetPropertyNameVector() ) // pointer instead reference to get compiler generated copy c'tor and operator= |
181 | 23.3M | { |
182 | 23.3M | } |
183 | | |
184 | | bool PropertyMap::hasProperty( sal_Int32 nPropId ) const |
185 | 585k | { |
186 | 585k | return maProperties.find( nPropId ) != maProperties.end(); |
187 | 585k | } |
188 | | |
189 | | bool PropertyMap::setAnyProperty( sal_Int32 nPropId, const Any& rValue ) |
190 | 542k | { |
191 | 542k | if( nPropId < 0 ) |
192 | 0 | return false; |
193 | | |
194 | 542k | maProperties[ nPropId ] = rValue; |
195 | 542k | return true; |
196 | 542k | } |
197 | | |
198 | | Any PropertyMap::getProperty( sal_Int32 nPropId ) const |
199 | 412k | { |
200 | 412k | auto it = maProperties.find(nPropId); |
201 | 412k | if (it != maProperties.end()) |
202 | 154k | return it->second; |
203 | 258k | return Any(); |
204 | 412k | } |
205 | | |
206 | | void PropertyMap::erase( sal_Int32 nPropId ) |
207 | 731 | { |
208 | 731 | maProperties.erase(nPropId); |
209 | 731 | } |
210 | | |
211 | | bool PropertyMap::empty() const |
212 | 1.10M | { |
213 | 1.10M | return maProperties.empty(); |
214 | 1.10M | } |
215 | | |
216 | | void PropertyMap::assignUsed( const PropertyMap& rPropMap ) |
217 | 6.66M | { |
218 | 6.66M | maProperties.insert(rPropMap.maProperties.begin(), rPropMap.maProperties.end()); |
219 | 6.66M | } |
220 | | |
221 | | const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId ) |
222 | 1.84M | { |
223 | 1.84M | OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" ); |
224 | 1.84M | return GetPropertyNameVector()[ nPropId ]; |
225 | 1.84M | } |
226 | | |
227 | | sal_Int32 PropertyMap::getPropertyId( std::u16string_view sPropName ) |
228 | 0 | { |
229 | | // This may use a std::map to get faster from String to ID in the |
230 | | // future, inside the [0..PROP_COUNT[ entries. Since it is currently |
231 | | // only used for Diagram re-creation I opted for less memory usage here |
232 | 0 | if(sPropName.empty()) |
233 | 0 | return -1; |
234 | | |
235 | 0 | const std::vector<OUString>& rVec(GetPropertyNameVector()); |
236 | 0 | for(size_t a(0); a < rVec.size(); a++) |
237 | 0 | if(rVec[a] == sPropName) |
238 | 0 | return a; |
239 | | |
240 | 0 | return -1; |
241 | 0 | } |
242 | | |
243 | | void PropertyMap::assignAll( const PropertyMap& rPropMap ) |
244 | 5.93M | { |
245 | 5.93M | for (auto const& prop : rPropMap.maProperties) |
246 | 6.18M | maProperties[prop.first] = prop.second; |
247 | 5.93M | } |
248 | | |
249 | | Sequence< PropertyValue > PropertyMap::makePropertyValueSequence() const |
250 | 135k | { |
251 | 135k | Sequence< PropertyValue > aSeq( static_cast< sal_Int32 >( maProperties.size() ) ); |
252 | 135k | PropertyValue* pValues = aSeq.getArray(); |
253 | 135k | for (auto const& prop : maProperties) |
254 | 879k | { |
255 | 879k | OSL_ENSURE( (0 <= prop.first) && (prop.first < PROP_COUNT), "PropertyMap::makePropertyValueSequence - invalid property identifier" ); |
256 | 879k | pValues->Name = (*mpPropNames)[ prop.first ]; |
257 | 879k | pValues->Value = prop.second; |
258 | 879k | pValues->State = PropertyState_DIRECT_VALUE; |
259 | 879k | ++pValues; |
260 | 879k | } |
261 | 135k | return aSeq; |
262 | 135k | } |
263 | | |
264 | | void PropertyMap::fillSequences( Sequence< OUString >& rNames, Sequence< Any >& rValues ) const |
265 | 706k | { |
266 | 706k | rNames.realloc( static_cast< sal_Int32 >( maProperties.size() ) ); |
267 | 706k | rValues.realloc( static_cast< sal_Int32 >( maProperties.size() ) ); |
268 | 706k | if( maProperties.empty() ) |
269 | 0 | return; |
270 | | |
271 | 706k | OUString* pNames = rNames.getArray(); |
272 | 706k | Any* pValues = rValues.getArray(); |
273 | 706k | for (auto const& prop : maProperties) |
274 | 11.3M | { |
275 | 11.3M | OSL_ENSURE( (0 <= prop.first) && (prop.first < PROP_COUNT), "PropertyMap::fillSequences - invalid property identifier" ); |
276 | 11.3M | *pNames = (*mpPropNames)[ prop.first ]; |
277 | 11.3M | *pValues = prop.second; |
278 | 11.3M | ++pNames; |
279 | 11.3M | ++pValues; |
280 | 11.3M | } |
281 | 706k | } |
282 | | |
283 | | void PropertyMap::fillPropertyNameMap(PropertyNameMap& rMap) const |
284 | 6.51k | { |
285 | 6.51k | for (auto const& prop : maProperties) |
286 | 19.7k | { |
287 | 19.7k | rMap.insert(std::pair<OUString, Any>((*mpPropNames)[prop.first], prop.second)); |
288 | 19.7k | } |
289 | 6.51k | } |
290 | | |
291 | | Reference< XPropertySet > PropertyMap::makePropertySet() const |
292 | 6.51k | { |
293 | 6.51k | return new GenericPropertySet( *this ); |
294 | 6.51k | } |
295 | | |
296 | | #if OSL_DEBUG_LEVEL > 0 |
297 | | static void lclDumpAnyValue( const Any& value) |
298 | | { |
299 | | OUString strValue; |
300 | | Sequence< OUString > strArray; |
301 | | Sequence< Any > anyArray; |
302 | | Sequence< PropertyValue > propArray; |
303 | | Sequence< Sequence< PropertyValue > > propArrayArray; |
304 | | Sequence< EnhancedCustomShapeAdjustmentValue > adjArray; |
305 | | Sequence< EnhancedCustomShapeSegment > segArray; |
306 | | Sequence< EnhancedCustomShapeParameterPair > ppArray; |
307 | | EnhancedCustomShapeSegment segment; |
308 | | EnhancedCustomShapeParameterPair pp; |
309 | | EnhancedCustomShapeParameter par; |
310 | | HomogenMatrix3 aMatrix; |
311 | | sal_Int32 intValue = 0; |
312 | | sal_uInt32 uintValue = 0; |
313 | | sal_Int16 int16Value = 0; |
314 | | sal_uInt16 uint16Value = 0; |
315 | | float floatValue = 0; |
316 | | bool boolValue = false; |
317 | | LineSpacing spacing; |
318 | | // RectanglePoint pointValue; |
319 | | WritingMode aWritingMode; |
320 | | TextVerticalAdjust aTextVertAdj; |
321 | | TextHorizontalAdjust aTextHorizAdj; |
322 | | Reference< XIndexReplace > xNumRule; |
323 | | |
324 | | if( value >>= strValue ) |
325 | | fprintf (stderr,"\"%s\"\n", USS( strValue ) ); |
326 | | else if( value >>= strArray ) { |
327 | | fprintf (stderr,"%s\n", USS(value.getValueTypeName())); |
328 | | for( int i=0; i<strArray.getLength(); i++ ) |
329 | | fprintf (stderr,"\t\t\t[%3d] \"%s\"\n", i, USS( strArray[i] ) ); |
330 | | } else if( value >>= propArray ) { |
331 | | fprintf (stderr,"%s\n", USS(value.getValueTypeName())); |
332 | | for( int i=0; i<propArray.getLength(); i++ ) { |
333 | | fprintf (stderr,"\t\t\t[%3d] %s (%s) ", i, USS( propArray[i].Name ), USS(propArray[i].Value.getValueTypeName()) ); |
334 | | lclDumpAnyValue( propArray[i].Value ); |
335 | | } |
336 | | } else if( value >>= propArrayArray ) { |
337 | | fprintf (stderr,"%s\n", USS(value.getValueTypeName())); |
338 | | for( int i=0; i<propArrayArray.getLength(); i++ ) { |
339 | | fprintf (stderr,"\t\t\t[%3d] ", i); |
340 | | lclDumpAnyValue( Any (propArrayArray[i]) ); |
341 | | } |
342 | | } else if( value >>= anyArray ) { |
343 | | fprintf (stderr,"%s\n", USS(value.getValueTypeName())); |
344 | | for( int i=0; i<anyArray.getLength(); i++ ) { |
345 | | fprintf (stderr,"\t\t\t[%3d] (%s) ", i, USS(value.getValueTypeName()) ); |
346 | | lclDumpAnyValue( anyArray[i] ); |
347 | | } |
348 | | } else if( value >>= adjArray ) { |
349 | | fprintf (stderr,"%s\n", USS(value.getValueTypeName())); |
350 | | for( int i=0; i<adjArray.getLength(); i++ ) { |
351 | | fprintf (stderr,"\t\t\t[%3d] (%s) ", i, USS(adjArray[i].Value.getValueTypeName()) ); |
352 | | lclDumpAnyValue( adjArray[i].Value ); |
353 | | } |
354 | | } else if( value >>= segArray ) { |
355 | | fprintf (stderr,"%s\n", USS(value.getValueTypeName())); |
356 | | for( int i=0; i<segArray.getLength(); i++ ) { |
357 | | fprintf (stderr,"\t\t\t[%3d] ", i ); |
358 | | lclDumpAnyValue( Any( segArray[i] ) ); |
359 | | } |
360 | | } else if( value >>= ppArray ) { |
361 | | fprintf (stderr,"%s\n", USS(value.getValueTypeName())); |
362 | | for( int i=0; i<ppArray.getLength(); i++ ) { |
363 | | fprintf (stderr,"\t\t\t[%3d] ", i ); |
364 | | lclDumpAnyValue( Any( ppArray[i] ) ); |
365 | | } |
366 | | } else if( value >>= segment ) { |
367 | | fprintf (stderr,"Command: %d Count: %d\n", segment.Command, segment.Count); |
368 | | } else if( value >>= pp ) { |
369 | | fprintf (stderr,"First: "); |
370 | | lclDumpAnyValue( Any (pp.First) ); |
371 | | fprintf (stderr,"\t\t\t Second: "); |
372 | | lclDumpAnyValue( Any (pp.Second) ); |
373 | | } else if( value >>= par ) { |
374 | | fprintf (stderr,"Parameter (%s): ", USS(par.Value.getValueTypeName())); |
375 | | lclDumpAnyValue( par.Value ); |
376 | | } else if( value >>= aMatrix ) { |
377 | | fprintf (stderr,"Matrix\n%f %f %f\n%f %f %f\n%f %f %f\n", aMatrix.Line1.Column1, aMatrix.Line1.Column2, aMatrix.Line1.Column3, aMatrix.Line2.Column1, aMatrix.Line2.Column2, aMatrix.Line2.Column3, aMatrix.Line3.Column1, aMatrix.Line3.Column2, aMatrix.Line3.Column3); |
378 | | } else if( value >>= intValue ) |
379 | | fprintf (stderr,"%-10" SAL_PRIdINT32 " (hex: %" SAL_PRIxUINT32 ")\n", intValue, intValue); |
380 | | else if( value >>= uintValue ) |
381 | | fprintf (stderr,"%-10" SAL_PRIuUINT32 " (hex: %" SAL_PRIxUINT32 ")\n", uintValue, uintValue); |
382 | | else if( value >>= int16Value ) |
383 | | fprintf (stderr,"%-10d (hex: %x)\n", int16Value, int16Value); |
384 | | else if( value >>= uint16Value ) |
385 | | fprintf (stderr,"%-10d (hex: %x)\n", uint16Value, uint16Value); |
386 | | else if( value >>= floatValue ) |
387 | | fprintf (stderr,"%f\n", floatValue); |
388 | | else if( value >>= boolValue ) |
389 | | fprintf (stderr,"%-10d (bool)\n", boolValue); |
390 | | else if( value >>= xNumRule ) { |
391 | | fprintf (stderr, "XIndexReplace\n"); |
392 | | if (xNumRule.is()) { |
393 | | for (int k=0; k<xNumRule->getCount(); k++) { |
394 | | Sequence< PropertyValue > aBulletPropSeq; |
395 | | fprintf (stderr, "level %d\n", k); |
396 | | if (xNumRule->getByIndex (k) >>= aBulletPropSeq) { |
397 | | for (const PropertyValue& rProp : aBulletPropSeq) { |
398 | | fprintf(stderr, "%46s = ", USS (rProp.Name)); |
399 | | lclDumpAnyValue (rProp.Value); |
400 | | } |
401 | | } |
402 | | } |
403 | | } else { |
404 | | fprintf (stderr, "empty reference\n"); |
405 | | } |
406 | | } else if( value >>= aWritingMode ) |
407 | | fprintf(stderr, "%d writing mode\n", static_cast<int>(aWritingMode)); |
408 | | else if( value >>= aTextVertAdj ) { |
409 | | const char* s = "unknown"; |
410 | | switch( aTextVertAdj ) { |
411 | | case TextVerticalAdjust_TOP: |
412 | | s = "top"; |
413 | | break; |
414 | | case TextVerticalAdjust_CENTER: |
415 | | s = "center"; |
416 | | break; |
417 | | case TextVerticalAdjust_BOTTOM: |
418 | | s = "bottom"; |
419 | | break; |
420 | | case TextVerticalAdjust_BLOCK: |
421 | | s = "block"; |
422 | | break; |
423 | | case TextVerticalAdjust::TextVerticalAdjust_MAKE_FIXED_SIZE: |
424 | | s = "make_fixed_size"; |
425 | | break; |
426 | | } |
427 | | fprintf (stderr, "%s\n", s); |
428 | | } else if( value >>= aTextHorizAdj ) { |
429 | | const char* s = "unknown"; |
430 | | switch( aTextHorizAdj ) { |
431 | | case TextHorizontalAdjust_LEFT: |
432 | | s = "left"; |
433 | | break; |
434 | | case TextHorizontalAdjust_CENTER: |
435 | | s = "center"; |
436 | | break; |
437 | | case TextHorizontalAdjust_RIGHT: |
438 | | s = "right"; |
439 | | break; |
440 | | case TextHorizontalAdjust_BLOCK: |
441 | | s = "block"; |
442 | | break; |
443 | | case TextHorizontalAdjust::TextHorizontalAdjust_MAKE_FIXED_SIZE: |
444 | | s = "make_fixed_size"; |
445 | | break; |
446 | | } |
447 | | fprintf (stderr, "%s\n", s); |
448 | | } else if( value >>= spacing ) { |
449 | | fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height); |
450 | | } else if( value.isExtractableTo(::cppu::UnoType<sal_Int32>::get())) { |
451 | | fprintf (stderr,"is extractable to int32\n"); |
452 | | } |
453 | | // else if( value >>= pointValue ) |
454 | | // fprintf (stderr,"%d (RectanglePoint)\n", pointValue); |
455 | | else |
456 | | fprintf (stderr,"??? <unhandled type %s>\n", USS(value.getValueTypeName())); |
457 | | } |
458 | | |
459 | | #ifdef DBG_UTIL |
460 | | void PropertyMap::dump( const Reference< XPropertySet >& rXPropSet ) |
461 | | { |
462 | | Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo (); |
463 | | const Sequence< Property > props = info->getProperties (); |
464 | | |
465 | | SAL_INFO("oox", "dump props, len: " << props.getLength ()); |
466 | | |
467 | | for (Property const & prop : props) { |
468 | | OString name = OUStringToOString( prop.Name, RTL_TEXTENCODING_UTF8); |
469 | | fprintf (stderr,"%30s = ", name.getStr() ); |
470 | | |
471 | | try { |
472 | | lclDumpAnyValue (rXPropSet->getPropertyValue( prop.Name )); |
473 | | } catch (const Exception&) { |
474 | | fprintf (stderr,"unable to get '%s' value\n", USS(prop.Name)); |
475 | | } |
476 | | } |
477 | | } |
478 | | #endif |
479 | | |
480 | | static void printLevel (int level) |
481 | | { |
482 | | for (int i=0; i<level; i++) |
483 | | fprintf (stderr, " "); |
484 | | } |
485 | | |
486 | | static const char *lclGetEnhancedParameterType( sal_uInt16 nType ) |
487 | | { |
488 | | const char* type; |
489 | | switch (nType) { |
490 | | case EnhancedCustomShapeParameterType::NORMAL: |
491 | | type = "EnhancedCustomShapeParameterType::NORMAL"; |
492 | | break; |
493 | | case EnhancedCustomShapeParameterType::EQUATION: |
494 | | type = "EnhancedCustomShapeParameterType::EQUATION"; |
495 | | break; |
496 | | case EnhancedCustomShapeParameterType::ADJUSTMENT: |
497 | | type = "EnhancedCustomShapeParameterType::ADJUSTMENT"; |
498 | | break; |
499 | | case EnhancedCustomShapeParameterType::LEFT: |
500 | | type = "EnhancedCustomShapeParameterType::LEFT"; |
501 | | break; |
502 | | case EnhancedCustomShapeParameterType::TOP: |
503 | | type = "EnhancedCustomShapeParameterType::TOP"; |
504 | | break; |
505 | | case EnhancedCustomShapeParameterType::RIGHT: |
506 | | type = "EnhancedCustomShapeParameterType::RIGHT"; |
507 | | break; |
508 | | case EnhancedCustomShapeParameterType::BOTTOM: |
509 | | type = "EnhancedCustomShapeParameterType::BOTTOM"; |
510 | | break; |
511 | | case EnhancedCustomShapeParameterType::XSTRETCH: |
512 | | type = "EnhancedCustomShapeParameterType::XSTRETCH"; |
513 | | break; |
514 | | case EnhancedCustomShapeParameterType::YSTRETCH: |
515 | | type = "EnhancedCustomShapeParameterType::YSTRETCH"; |
516 | | break; |
517 | | case EnhancedCustomShapeParameterType::HASSTROKE: |
518 | | type = "EnhancedCustomShapeParameterType::HASSTROKE"; |
519 | | break; |
520 | | case EnhancedCustomShapeParameterType::HASFILL: |
521 | | type = "EnhancedCustomShapeParameterType::HASFILL"; |
522 | | break; |
523 | | case EnhancedCustomShapeParameterType::WIDTH: |
524 | | type = "EnhancedCustomShapeParameterType::WIDTH"; |
525 | | break; |
526 | | case EnhancedCustomShapeParameterType::HEIGHT: |
527 | | type = "EnhancedCustomShapeParameterType::HEIGHT"; |
528 | | break; |
529 | | case EnhancedCustomShapeParameterType::LOGWIDTH: |
530 | | type = "EnhancedCustomShapeParameterType::LOGWIDTH"; |
531 | | break; |
532 | | case EnhancedCustomShapeParameterType::LOGHEIGHT: |
533 | | type = "EnhancedCustomShapeParameterType::LOGHEIGHT"; |
534 | | break; |
535 | | default: |
536 | | type = "unknown"; |
537 | | break; |
538 | | } |
539 | | return type; |
540 | | } |
541 | | |
542 | | static void printParameterPairData(int level, EnhancedCustomShapeParameterPair const &pp) |
543 | | { |
544 | | // These are always sal_Int32s so let's depend on that for our packing... |
545 | | sal_Int32 nFirstValue = {}; |
546 | | sal_Int32 nSecondValue = {}; // spurious -Werror=maybe-uninitialized |
547 | | if (!(pp.First.Value >>= nFirstValue)) |
548 | | assert (false); |
549 | | if (!(pp.Second.Value >>= nSecondValue)) |
550 | | assert (false); |
551 | | |
552 | | printLevel (level); |
553 | | fprintf (stderr, "{\n"); |
554 | | printLevel (level + 1); |
555 | | fprintf (stderr, "%s,\n", lclGetEnhancedParameterType(pp.First.Type)); |
556 | | printLevel (level + 1); |
557 | | fprintf (stderr, "%s,\n", lclGetEnhancedParameterType(pp.Second.Type)); |
558 | | printLevel (level + 1); |
559 | | fprintf (stderr, "%d, %d\n", static_cast<int>(nFirstValue), static_cast<int>(nSecondValue)); |
560 | | printLevel (level); |
561 | | fprintf (stderr, "}"); |
562 | | } |
563 | | |
564 | | static const char* lclDumpAnyValueCode( const Any& value, int level) |
565 | | { |
566 | | OUString strValue; |
567 | | Sequence< OUString > strArray; |
568 | | Sequence< Any > anyArray; |
569 | | Sequence< awt::Size > sizeArray; |
570 | | Sequence< PropertyValue > propArray; |
571 | | Sequence< Sequence< PropertyValue > > propArrayArray; |
572 | | Sequence< EnhancedCustomShapeAdjustmentValue > adjArray; |
573 | | Sequence< EnhancedCustomShapeTextFrame > segTextFrame; |
574 | | Sequence< EnhancedCustomShapeSegment > segArray; |
575 | | Sequence< EnhancedCustomShapeParameterPair > ppArray; |
576 | | EnhancedCustomShapeSegment segment; |
577 | | EnhancedCustomShapeTextFrame textFrame; |
578 | | EnhancedCustomShapeParameterPair pp; |
579 | | EnhancedCustomShapeParameter par; |
580 | | awt::Rectangle rect; |
581 | | awt::Size size; |
582 | | sal_Int32 intValue; |
583 | | sal_uInt32 uintValue; |
584 | | sal_Int16 int16Value; |
585 | | sal_uInt16 uint16Value; |
586 | | sal_Int64 int64Value; |
587 | | float floatValue = 0; |
588 | | bool boolValue; |
589 | | LineSpacing spacing; |
590 | | // RectanglePoint pointValue; |
591 | | WritingMode aWritingMode; |
592 | | TextVerticalAdjust aTextVertAdj; |
593 | | TextHorizontalAdjust aTextHorizAdj; |
594 | | Reference< XIndexReplace > xNumRule; |
595 | | |
596 | | if( value >>= strValue ) |
597 | | { |
598 | | printLevel (level); |
599 | | fprintf (stderr,"OUString str = \"%s\";\n", USS( strValue ) ); |
600 | | return "Any (str)"; |
601 | | } |
602 | | else if( value >>= strArray ) |
603 | | { |
604 | | if (strArray.getLength() == 0) |
605 | | return "Sequence< OUString >(0)"; |
606 | | |
607 | | printLevel (level); |
608 | | fprintf (stderr,"static const char *aStrings[] = {\n"); |
609 | | for( int i=0; i<strArray.getLength(); i++ ) { |
610 | | printLevel (level + 1); |
611 | | fprintf (stderr,"\"%s\"%s\n", USS( strArray[i] ), i < strArray.getLength() - 1 ? "," : "" ); |
612 | | } |
613 | | printLevel (level); |
614 | | fprintf (stderr,"};\n"); |
615 | | return "createStringSequence( SAL_N_ELEMENTS( aStrings ), aStrings )"; |
616 | | } |
617 | | else if( value >>= propArray ) |
618 | | { |
619 | | printLevel (level); |
620 | | fprintf (stderr,"Sequence< PropertyValue > aPropSequence (%" SAL_PRIdINT32 ");\n", propArray.getLength()); |
621 | | for( int i=0; i<propArray.getLength(); i++ ) { |
622 | | printLevel (level); |
623 | | fprintf (stderr, "{\n"); |
624 | | printLevel (level + 1); |
625 | | fprintf (stderr, "aPropSequence [%d].Name = \"%s\";\n", i, USS( propArray[i].Name )); |
626 | | const char *var = lclDumpAnyValueCode( propArray[i].Value, level + 1 ); |
627 | | printLevel (level + 1); |
628 | | fprintf (stderr, "aPropSequence [%d].Value = makeAny (%s);\n", i, var); |
629 | | printLevel (level); |
630 | | fprintf (stderr, "}\n"); |
631 | | } |
632 | | return "aPropSequence"; |
633 | | } |
634 | | else if( value >>= sizeArray ) |
635 | | { |
636 | | printLevel (level); |
637 | | fprintf (stderr, "Sequence< awt::Size > aSizeSequence (%" SAL_PRIdINT32 ");\n", sizeArray.getLength()); |
638 | | for( int i=0; i<sizeArray.getLength(); i++ ) { |
639 | | printLevel (level); |
640 | | fprintf (stderr, "{\n"); |
641 | | const char *var = lclDumpAnyValueCode (Any (sizeArray[i]), level + 1); |
642 | | printLevel (level + 1); |
643 | | fprintf (stderr, "aSizeSequence [%d] = %s;\n", i, var); |
644 | | printLevel (level); |
645 | | fprintf (stderr, "}\n"); |
646 | | } |
647 | | return "aSizeSequence"; |
648 | | } |
649 | | else if( value >>= propArrayArray ) |
650 | | { |
651 | | printLevel (level); |
652 | | fprintf (stderr,"Sequence< Sequence < PropertyValue > > aPropSequenceSequence (%" SAL_PRIdINT32 ");\n", propArrayArray.getLength()); |
653 | | for( int i=0; i<propArrayArray.getLength(); i++ ) { |
654 | | printLevel (level); |
655 | | fprintf (stderr, "{\n"); |
656 | | const char *var = lclDumpAnyValueCode( Any (propArrayArray[i]), level + 1 ); |
657 | | printLevel (level + 1); |
658 | | fprintf (stderr, "aPropSequenceSequence [%d] = %s;\n", i, var); |
659 | | printLevel (level); |
660 | | fprintf (stderr, "}\n"); |
661 | | } |
662 | | return "aPropSequenceSequence"; |
663 | | } |
664 | | else if( value >>= anyArray ) |
665 | | { |
666 | | fprintf (stderr,"%s\n", USS(value.getValueTypeName())); |
667 | | for( int i=0; i<anyArray.getLength(); i++ ) { |
668 | | fprintf (stderr,"\t\t\t[%3d] (%s) ", i, USS(value.getValueTypeName()) ); |
669 | | lclDumpAnyValue( anyArray[i] ); |
670 | | } |
671 | | } |
672 | | else if( value >>= adjArray ) |
673 | | { |
674 | | printLevel (level); |
675 | | fprintf (stderr,"Sequence< EnhancedCustomShapeAdjustmentValue > aAdjSequence (%" SAL_PRIdINT32 ");\n", adjArray.getLength()); |
676 | | for( int i=0; i<adjArray.getLength(); i++ ) { |
677 | | printLevel (level); |
678 | | fprintf (stderr, "{\n"); |
679 | | const char *var = lclDumpAnyValueCode( adjArray[i].Value, level + 1 ); |
680 | | printLevel (level + 1); |
681 | | fprintf (stderr, "aAdjSequence [%d].Value = %s;\n", i, var); |
682 | | if (adjArray[i].Name.getLength() > 0) { |
683 | | printLevel (level + 1); |
684 | | fprintf (stderr, "aAdjSequence [%d].Name = \"%s\";\n", i, USS (adjArray[i].Name)); |
685 | | } |
686 | | printLevel (level); |
687 | | fprintf (stderr, "}\n"); |
688 | | } |
689 | | return "aAdjSequence"; |
690 | | } |
691 | | else if( value >>= segArray ) |
692 | | { |
693 | | if (segArray.getLength() == 0) |
694 | | return "Sequence< EnhancedCustomShapeSegment >(0)"; |
695 | | |
696 | | printLevel (level); |
697 | | fprintf (stderr,"static const sal_uInt16 nValues[] = {\n"); |
698 | | printLevel (level); |
699 | | fprintf (stderr,"// Command, Count\n"); |
700 | | for( int i = 0; i < segArray.getLength(); i++ ) { |
701 | | printLevel (level + 1); |
702 | | fprintf (stderr,"%d,%d%s\n", segArray[i].Command, |
703 | | segArray[i].Count, i < segArray.getLength() - 1 ? "," : ""); |
704 | | } |
705 | | printLevel (level); |
706 | | fprintf (stderr,"};\n"); |
707 | | return "createSegmentSequence( SAL_N_ELEMENTS( nValues ), nValues )"; |
708 | | } |
709 | | else if( value >>= segTextFrame ) |
710 | | { |
711 | | printLevel (level); |
712 | | fprintf (stderr, "Sequence< EnhancedCustomShapeTextFrame > aTextFrameSeq (%" SAL_PRIdINT32 ");\n", segTextFrame.getLength()); |
713 | | for( int i=0; i<segTextFrame.getLength(); i++ ) { |
714 | | printLevel (level); |
715 | | fprintf (stderr, "{\n"); |
716 | | const char *var = lclDumpAnyValueCode (Any (segTextFrame[i]), level + 1); |
717 | | printLevel (level + 1); |
718 | | fprintf (stderr, "aTextFrameSeq [%d] = %s;\n", i, var); |
719 | | printLevel (level); |
720 | | fprintf (stderr, "}\n"); |
721 | | } |
722 | | return "aTextFrameSeq"; |
723 | | } |
724 | | else if( value >>= ppArray ) |
725 | | { |
726 | | printLevel (level); |
727 | | if (ppArray.getLength() == 0) |
728 | | return "Sequence< EnhancedCustomShapeParameterPair >(0)"; |
729 | | |
730 | | fprintf (stderr, "static const CustomShapeProvider::ParameterPairData aData[] = {\n"); |
731 | | for( int i = 0; i < ppArray.getLength(); i++ ) { |
732 | | printParameterPairData(level + 1, ppArray[i]); |
733 | | fprintf (stderr,"%s\n", i < ppArray.getLength() - 1 ? "," : ""); |
734 | | } |
735 | | printLevel (level); |
736 | | fprintf (stderr,"};\n"); |
737 | | |
738 | | return "createParameterPairSequence(SAL_N_ELEMENTS(aData), aData)"; |
739 | | } |
740 | | else if( value >>= segment ) |
741 | | { |
742 | | printLevel (level); |
743 | | fprintf (stderr, "EnhancedCustomShapeSegment aSegment;\n"); |
744 | | printLevel (level); |
745 | | // TODO: use EnhancedCustomShapeSegmentCommand constants |
746 | | fprintf (stderr, "aSegment.Command = %d;\n", segment.Command); |
747 | | printLevel (level); |
748 | | fprintf (stderr, "aSegment.Count = %d;\n", segment.Count); |
749 | | return "aSegment"; |
750 | | } |
751 | | else if( value >>= textFrame ) |
752 | | { |
753 | | printLevel (level); |
754 | | fprintf (stderr, "EnhancedCustomShapeTextFrame aTextFrame;\n"); |
755 | | printLevel (level); |
756 | | fprintf (stderr, "{\n"); |
757 | | { |
758 | | const char* var = lclDumpAnyValueCode( Any (textFrame.TopLeft), level + 1 ); |
759 | | printLevel (level + 1); |
760 | | fprintf (stderr, "aTextFrame.TopLeft = %s;\n", var); |
761 | | } |
762 | | printLevel (level); |
763 | | fprintf (stderr, "}\n"); |
764 | | |
765 | | printLevel (level); |
766 | | fprintf (stderr, "{\n"); |
767 | | { |
768 | | const char* var = lclDumpAnyValueCode( Any (textFrame.BottomRight), level + 1 ); |
769 | | printLevel (level + 1); |
770 | | fprintf (stderr, "aTextFrame.BottomRight = %s;\n", var); |
771 | | } |
772 | | printLevel (level); |
773 | | fprintf (stderr, "}\n"); |
774 | | |
775 | | return "aTextFrame"; |
776 | | } |
777 | | else if( value >>= pp ) |
778 | | { |
779 | | printLevel (level); |
780 | | fprintf (stderr, "static const CustomShapeProvider::ParameterPairData aData =\n"); |
781 | | printParameterPairData(level, pp); |
782 | | fprintf (stderr, ";\n"); |
783 | | |
784 | | return "createParameterPair(&aData)"; |
785 | | } |
786 | | else if( value >>= par ) |
787 | | { |
788 | | printLevel (level); |
789 | | fprintf (stderr,"EnhancedCustomShapeParameter aParameter;\n"); |
790 | | const char* var = lclDumpAnyValueCode( par.Value, level ); |
791 | | printLevel (level); |
792 | | fprintf (stderr,"aParameter.Value = %s;\n", var); |
793 | | printLevel (level); |
794 | | fprintf (stderr,"aParameter.Type = %s;\n", |
795 | | lclGetEnhancedParameterType(par.Type)); |
796 | | return "aParameter"; |
797 | | } |
798 | | else if( value >>= int64Value ) |
799 | | { |
800 | | printLevel (level); |
801 | | fprintf (stderr,"Any aAny ((sal_Int64) %" SAL_PRIdINT64 ");\n", int64Value); |
802 | | return "aAny"; |
803 | | } |
804 | | else if( value >>= intValue ) |
805 | | fprintf (stderr,"%" SAL_PRIdINT32 " (hex: %" SAL_PRIxUINT32 ")\n", intValue, intValue); |
806 | | else if( value >>= uintValue ) |
807 | | fprintf (stderr,"%" SAL_PRIdINT32 " (hex: %" SAL_PRIxUINT32 ")\n", uintValue, uintValue); |
808 | | else if( value >>= int16Value ) |
809 | | fprintf (stderr,"%d (hex: %x)\n", int16Value, int16Value); |
810 | | else if( value >>= uint16Value ) |
811 | | fprintf (stderr,"%d (hex: %x)\n", uint16Value, uint16Value); |
812 | | else if( value >>= floatValue ) |
813 | | fprintf (stderr,"%f\n", floatValue); |
814 | | else if( value >>= boolValue ) { |
815 | | if (boolValue) |
816 | | return "(sal_Bool) sal_True"; |
817 | | else |
818 | | return "(sal_Bool) sal_False"; |
819 | | } |
820 | | else if( value >>= xNumRule ) { |
821 | | fprintf (stderr, "XIndexReplace\n"); |
822 | | for (int k=0; k<xNumRule->getCount(); k++) { |
823 | | Sequence< PropertyValue > aBulletPropSeq; |
824 | | fprintf (stderr, "level %d\n", k); |
825 | | if (xNumRule->getByIndex (k) >>= aBulletPropSeq) { |
826 | | for (const PropertyValue& rProp : aBulletPropSeq) { |
827 | | fprintf(stderr, "%46s = ", USS (rProp.Name)); |
828 | | lclDumpAnyValue (rProp.Value); |
829 | | } |
830 | | } |
831 | | } |
832 | | } |
833 | | else if( value >>= aWritingMode ) |
834 | | fprintf (stderr, "%d writing mode\n", static_cast<int>(aWritingMode)); |
835 | | else if( value >>= aTextVertAdj ) { |
836 | | const char* s = "unknown"; |
837 | | switch( aTextVertAdj ) { |
838 | | case TextVerticalAdjust_TOP: |
839 | | s = "top"; |
840 | | break; |
841 | | case TextVerticalAdjust_CENTER: |
842 | | s = "center"; |
843 | | break; |
844 | | case TextVerticalAdjust_BOTTOM: |
845 | | s = "bottom"; |
846 | | break; |
847 | | case TextVerticalAdjust_BLOCK: |
848 | | s = "block"; |
849 | | break; |
850 | | case TextVerticalAdjust::TextVerticalAdjust_MAKE_FIXED_SIZE: |
851 | | s = "make_fixed_size"; |
852 | | break; |
853 | | } |
854 | | fprintf (stderr, "%s\n", s); |
855 | | } |
856 | | else if( value >>= aTextHorizAdj ) { |
857 | | const char* s = "unknown"; |
858 | | switch( aTextHorizAdj ) { |
859 | | case TextHorizontalAdjust_LEFT: |
860 | | s = "left"; |
861 | | break; |
862 | | case TextHorizontalAdjust_CENTER: |
863 | | s = "center"; |
864 | | break; |
865 | | case TextHorizontalAdjust_RIGHT: |
866 | | s = "right"; |
867 | | break; |
868 | | case TextHorizontalAdjust_BLOCK: |
869 | | s = "block"; |
870 | | break; |
871 | | case TextHorizontalAdjust::TextHorizontalAdjust_MAKE_FIXED_SIZE: |
872 | | s = "make_fixed_size"; |
873 | | break; |
874 | | } |
875 | | fprintf (stderr, "%s\n", s); |
876 | | } |
877 | | else if( value >>= spacing ) { |
878 | | fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height); |
879 | | } |
880 | | else if( value >>= rect ) { |
881 | | printLevel (level); |
882 | | fprintf (stderr, "awt::Rectangle aRectangle;\n"); |
883 | | printLevel (level); |
884 | | fprintf (stderr, "aRectangle.X = %" SAL_PRIdINT32 ";\n", rect.X); |
885 | | printLevel (level); |
886 | | fprintf (stderr, "aRectangle.Y = %" SAL_PRIdINT32 ";\n", rect.Y); |
887 | | printLevel (level); |
888 | | fprintf (stderr, "aRectangle.Width = %" SAL_PRIdINT32 ";\n", rect.Width); |
889 | | printLevel (level); |
890 | | fprintf (stderr, "aRectangle.Height = %" SAL_PRIdINT32 ";\n", rect.Height); |
891 | | return "aRectangle"; |
892 | | } |
893 | | else if( value >>= size ) { |
894 | | printLevel (level); |
895 | | fprintf (stderr, "awt::Size aSize;\n"); |
896 | | printLevel (level); |
897 | | fprintf (stderr, "aSize.Width = %" SAL_PRIdINT32 ";\n", size.Width); |
898 | | printLevel (level); |
899 | | fprintf (stderr, "aSize.Height = %" SAL_PRIdINT32 ";\n", size.Height); |
900 | | return "aSize"; |
901 | | } |
902 | | else if( value.isExtractableTo(::cppu::UnoType<sal_Int32>::get())) { |
903 | | fprintf (stderr,"is extractable to int32\n"); |
904 | | } |
905 | | else |
906 | | fprintf (stderr,"??? <unhandled type %s>\n", USS(value.getValueTypeName())); |
907 | | |
908 | | return ""; |
909 | | } |
910 | | |
911 | | void PropertyMap::dumpCode( const Reference< XPropertySet >& rXPropSet ) |
912 | | { |
913 | | Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo (); |
914 | | const Sequence< Property > props = info->getProperties (); |
915 | | static constexpr OUStringLiteral sType = u"Type"; |
916 | | |
917 | | for (const Property& rProp : props) { |
918 | | |
919 | | // ignore Type, it is set elsewhere |
920 | | if (rProp.Name == sType) |
921 | | continue; |
922 | | |
923 | | OString name = OUStringToOString( rProp.Name, RTL_TEXTENCODING_UTF8); |
924 | | |
925 | | try { |
926 | | int level = 1; |
927 | | printLevel (level); |
928 | | fprintf (stderr, "{\n"); |
929 | | const char* var = lclDumpAnyValueCode (rXPropSet->getPropertyValue (rProp.Name), level + 1); |
930 | | printLevel (level + 1); |
931 | | fprintf (stderr,"aPropertyMap.setProperty(PROP_%s, %s);\n", name.getStr(), var); |
932 | | printLevel (level); |
933 | | fprintf (stderr, "}\n"); |
934 | | } catch (const Exception&) { |
935 | | fprintf (stderr,"unable to get '%s' value\n", USS(rProp.Name)); |
936 | | } |
937 | | } |
938 | | } |
939 | | |
940 | | void PropertyMap::dumpData(const Reference<XPropertySet>& xPropertySet) |
941 | | { |
942 | | Reference<XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo(); |
943 | | const Sequence<Property> aProperties = xPropertySetInfo->getProperties(); |
944 | | |
945 | | for (const Property& rProp : aProperties) |
946 | | { |
947 | | std::cerr << rProp.Name << std::endl; |
948 | | std::cerr << comphelper::anyToString(xPropertySet->getPropertyValue(rProp.Name)) << std::endl; |
949 | | } |
950 | | } |
951 | | |
952 | | #endif |
953 | | |
954 | | } // namespace oox |
955 | | |
956 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |