Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <com/sun/star/graphic/XGraphic.hpp>
31 : : #include <com/sun/star/graphic/GraphicProvider.hpp>
32 : : #include <com/sun/star/graphic/XGraphicProvider.hpp>
33 : : #include <com/sun/star/embed/ElementModes.hpp>
34 : : #include <com/sun/star/embed/XTransactedObject.hpp>
35 : : #include <com/sun/star/io/XSeekableInputStream.hpp>
36 : : #include <com/sun/star/drawing/HomogenMatrix.hpp>
37 : : #include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
38 : : #include <com/sun/star/drawing/ProjectionMode.hpp>
39 : : #include <com/sun/star/drawing/ShadeMode.hpp>
40 : : #include <com/sun/star/drawing/Direction3D.hpp>
41 : : #include <com/sun/star/drawing/Position3D.hpp>
42 : : #include <com/sun/star/drawing/CameraGeometry.hpp>
43 : : #include <com/sun/star/drawing/DoubleSequence.hpp>
44 : :
45 : : #include <com/sun/star/table/XColumnRowRange.hpp>
46 : :
47 : : #include <sax/tools/converter.hxx>
48 : :
49 : : #include <xmloff/shapeexport.hxx>
50 : : #include "sdpropls.hxx"
51 : : #include <tools/debug.hxx>
52 : : #include <rtl/ustrbuf.hxx>
53 : : #include <xmloff/xmlexp.hxx>
54 : : #include <xmloff/xmluconv.hxx>
55 : : #include "xexptran.hxx"
56 : : #include <xmloff/xmltoken.hxx>
57 : : #include "EnhancedCustomShapeToken.hxx"
58 : : #include <com/sun/star/container/XIdentifierContainer.hpp>
59 : : #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
60 : : #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
61 : : #include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
62 : : #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
63 : : #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
64 : : #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
65 : : #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
66 : : #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
67 : : #include <com/sun/star/beans/PropertyValues.hpp>
68 : : #include <rtl/math.hxx>
69 : : #include <basegfx/vector/b3dvector.hxx>
70 : :
71 : : #include "xmloff/xmlnmspe.hxx"
72 : : #include "XMLBase64Export.hxx"
73 : : #include <comphelper/componentcontext.hxx>
74 : :
75 : : using ::rtl::OUString;
76 : : using ::rtl::OUStringBuffer;
77 : :
78 : : using namespace ::com::sun::star;
79 : : using namespace ::com::sun::star::io;
80 : : using namespace ::xmloff::token;
81 : : using namespace ::xmloff::EnhancedCustomShapeToken;
82 : :
83 : : using ::com::sun::star::embed::XStorage;
84 : : using ::com::sun::star::uno::UNO_QUERY;
85 : : using ::com::sun::star::uno::UNO_QUERY_THROW;
86 : : using ::com::sun::star::uno::Reference;
87 : : using ::com::sun::star::uno::Sequence;
88 : :
89 : : //////////////////////////////////////////////////////////////////////////////
90 : :
91 : 0 : void ExportParameter( rtl::OUStringBuffer& rStrBuffer, const com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter )
92 : : {
93 [ # # ]: 0 : if ( rStrBuffer.getLength() )
94 : 0 : rStrBuffer.append( (sal_Unicode)' ' );
95 [ # # ]: 0 : if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
96 : : {
97 : 0 : double fNumber = 0.0;
98 : 0 : rParameter.Value >>= fNumber;
99 : 0 : ::rtl::math::doubleToUStringBuffer( rStrBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True );
100 : : }
101 : : else
102 : : {
103 : 0 : sal_Int32 nValue = 0;
104 : 0 : rParameter.Value >>= nValue;
105 : :
106 [ # # # # : 0 : switch( rParameter.Type )
# # # # #
# # # # #
# ]
107 : : {
108 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION :
109 : : {
110 [ # # ]: 0 : rStrBuffer.append( (sal_Unicode)'?' );
111 [ # # ]: 0 : rStrBuffer.append( (sal_Unicode)'f' );
112 [ # # ]: 0 : rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
113 : : }
114 : 0 : break;
115 : :
116 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT :
117 : : {
118 [ # # ]: 0 : rStrBuffer.append( (sal_Unicode)'$' );
119 [ # # ]: 0 : rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
120 : : }
121 : 0 : break;
122 : :
123 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM :
124 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_BOTTOM ) ); break;
125 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT :
126 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_RIGHT ) ); break;
127 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP :
128 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_TOP ) ); break;
129 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT :
130 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_LEFT ) ); break;
131 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH :
132 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_XSTRETCH ) ); break;
133 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH :
134 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_YSTRETCH ) ); break;
135 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE :
136 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_HASSTROKE ) ); break;
137 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL :
138 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_HASFILL ) ); break;
139 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH :
140 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_WIDTH ) ); break;
141 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT :
142 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_HEIGHT ) ); break;
143 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH :
144 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_LOGWIDTH ) ); break;
145 : : case com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT :
146 [ # # ][ # # ]: 0 : rStrBuffer.append( GetXMLToken( XML_LOGHEIGHT ) ); break;
147 : : default :
148 [ # # ]: 0 : rStrBuffer.append( rtl::OUString::valueOf( nValue ) );
149 : : }
150 : : }
151 : 0 : }
152 : :
153 : 0 : void ImpExportEquations( SvXMLExport& rExport, const uno::Sequence< rtl::OUString >& rEquations )
154 : : {
155 : : sal_Int32 i;
156 [ # # ]: 0 : for ( i = 0; i < rEquations.getLength(); i++ )
157 : : {
158 : 0 : rtl::OUString aStr(static_cast<sal_Unicode>('f'));
159 : 0 : aStr += rtl::OUString::valueOf( i );
160 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aStr );
161 : :
162 : 0 : aStr = rEquations[ i ];
163 : 0 : sal_Int32 nIndex = 0;
164 [ # # ]: 0 : do
165 : : {
166 : 0 : nIndex = aStr.indexOf( (sal_Unicode)'?', nIndex );
167 [ # # ]: 0 : if ( nIndex != -1 )
168 : : {
169 : 0 : rtl::OUString aNew( aStr.copy( 0, nIndex + 1 ) );
170 : 0 : aNew += rtl::OUString(static_cast<sal_Unicode>('f'));
171 : 0 : aNew += aStr.copy( nIndex + 1, ( aStr.getLength() - nIndex ) - 1 );
172 : 0 : aStr = aNew;
173 : 0 : nIndex++;
174 : : }
175 : : } while( nIndex != -1 );
176 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FORMULA, aStr );
177 [ # # ]: 0 : SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_EQUATION, sal_True, sal_True );
178 [ # # ]: 0 : }
179 : 0 : }
180 : :
181 : 0 : void ImpExportHandles( SvXMLExport& rExport, const uno::Sequence< beans::PropertyValues >& rHandles )
182 : : {
183 : 0 : sal_uInt32 i, j, nElements = rHandles.getLength();
184 [ # # ]: 0 : if ( nElements )
185 : : {
186 : 0 : rtl::OUString aStr;
187 : 0 : rtl::OUStringBuffer aStrBuffer;
188 : :
189 [ # # ]: 0 : for ( i = 0; i < nElements; i++ )
190 : : {
191 : 0 : sal_Bool bPosition = sal_False;
192 : 0 : const uno::Sequence< beans::PropertyValue >& rPropSeq = rHandles[ i ];
193 [ # # ]: 0 : for ( j = 0; j < (sal_uInt32)rPropSeq.getLength(); j++ )
194 : : {
195 : 0 : const beans::PropertyValue& rPropVal = rPropSeq[ j ];
196 [ # # # # : 0 : switch( EASGet( rPropVal.Name ) )
# # # # #
# # # ]
[ # # ]
197 : : {
198 : : case EAS_Position :
199 : : {
200 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition;
201 [ # # ][ # # ]: 0 : if ( rPropVal.Value >>= aPosition )
202 : : {
203 [ # # ]: 0 : ExportParameter( aStrBuffer, aPosition.First );
204 [ # # ]: 0 : ExportParameter( aStrBuffer, aPosition.Second );
205 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
206 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_POSITION, aStr );
207 : 0 : bPosition = sal_True;
208 : 0 : }
209 : : }
210 : 0 : break;
211 : : case EAS_MirroredX :
212 : : {
213 : 0 : sal_Bool bMirroredX = sal_Bool();
214 [ # # ]: 0 : if ( rPropVal.Value >>= bMirroredX )
215 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_MIRROR_HORIZONTAL,
216 [ # # ][ # # ]: 0 : bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
217 : : }
218 : 0 : break;
219 : : case EAS_MirroredY :
220 : : {
221 : 0 : sal_Bool bMirroredY = sal_Bool();
222 [ # # ]: 0 : if ( rPropVal.Value >>= bMirroredY )
223 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_MIRROR_VERTICAL,
224 [ # # ][ # # ]: 0 : bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
225 : : }
226 : 0 : break;
227 : : case EAS_Switched :
228 : : {
229 : 0 : sal_Bool bSwitched = sal_Bool();
230 [ # # ]: 0 : if ( rPropVal.Value >>= bSwitched )
231 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_SWITCHED,
232 [ # # ][ # # ]: 0 : bSwitched ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
233 : : }
234 : 0 : break;
235 : : case EAS_Polar :
236 : : {
237 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar;
238 [ # # ][ # # ]: 0 : if ( rPropVal.Value >>= aPolar )
239 : : {
240 [ # # ]: 0 : ExportParameter( aStrBuffer, aPolar.First );
241 [ # # ]: 0 : ExportParameter( aStrBuffer, aPolar.Second );
242 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
243 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_POLAR, aStr );
244 : 0 : }
245 : : }
246 : 0 : break;
247 : : case EAS_RadiusRangeMinimum :
248 : : {
249 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum;
250 [ # # ][ # # ]: 0 : if ( rPropVal.Value >>= aRadiusRangeMinimum )
251 : : {
252 [ # # ]: 0 : ExportParameter( aStrBuffer, aRadiusRangeMinimum );
253 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
254 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RADIUS_RANGE_MINIMUM, aStr );
255 : 0 : }
256 : : }
257 : 0 : break;
258 : : case EAS_RadiusRangeMaximum :
259 : : {
260 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum;
261 [ # # ][ # # ]: 0 : if ( rPropVal.Value >>= aRadiusRangeMaximum )
262 : : {
263 [ # # ]: 0 : ExportParameter( aStrBuffer, aRadiusRangeMaximum );
264 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
265 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RADIUS_RANGE_MAXIMUM, aStr );
266 : 0 : }
267 : : }
268 : 0 : break;
269 : : case EAS_RangeXMinimum :
270 : : {
271 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum;
272 [ # # ][ # # ]: 0 : if ( rPropVal.Value >>= aXRangeMinimum )
273 : : {
274 [ # # ]: 0 : ExportParameter( aStrBuffer, aXRangeMinimum );
275 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
276 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_X_MINIMUM, aStr );
277 : 0 : }
278 : : }
279 : 0 : break;
280 : : case EAS_RangeXMaximum :
281 : : {
282 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum;
283 [ # # ][ # # ]: 0 : if ( rPropVal.Value >>= aXRangeMaximum )
284 : : {
285 [ # # ]: 0 : ExportParameter( aStrBuffer, aXRangeMaximum );
286 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
287 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_X_MAXIMUM, aStr );
288 : 0 : }
289 : : }
290 : 0 : break;
291 : : case EAS_RangeYMinimum :
292 : : {
293 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum;
294 [ # # ][ # # ]: 0 : if ( rPropVal.Value >>= aYRangeMinimum )
295 : : {
296 [ # # ]: 0 : ExportParameter( aStrBuffer, aYRangeMinimum );
297 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
298 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_Y_MINIMUM, aStr );
299 : 0 : }
300 : : }
301 : 0 : break;
302 : : case EAS_RangeYMaximum :
303 : : {
304 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum;
305 [ # # ][ # # ]: 0 : if ( rPropVal.Value >>= aYRangeMaximum )
306 : : {
307 [ # # ]: 0 : ExportParameter( aStrBuffer, aYRangeMaximum );
308 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
309 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_Y_MAXIMUM, aStr );
310 : 0 : }
311 : : }
312 : 0 : break;
313 : : default:
314 : 0 : break;
315 : : }
316 : : }
317 [ # # ]: 0 : if ( bPosition )
318 [ # # ][ # # ]: 0 : SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_HANDLE, sal_True, sal_True );
319 : : else
320 [ # # ]: 0 : rExport.ClearAttrList();
321 : 0 : }
322 : : }
323 : 0 : }
324 : :
325 : 0 : void ImpExportEnhancedPath( SvXMLExport& rExport,
326 : : const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rCoordinates,
327 : : const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments,
328 : : bool bExtended = false )
329 : : {
330 : :
331 : 0 : rtl::OUString aStr;
332 : 0 : rtl::OUStringBuffer aStrBuffer;
333 : 0 : bool bNeedExtended = false;
334 : :
335 : : sal_Int32 i, j, k, l;
336 : :
337 : 0 : sal_Int32 nCoords = rCoordinates.getLength();
338 : 0 : sal_Int32 nSegments = rSegments.getLength();
339 : 0 : sal_Bool bSimpleSegments = nSegments == 0;
340 [ # # ]: 0 : if ( bSimpleSegments )
341 : 0 : nSegments = 4;
342 [ # # ]: 0 : for ( j = i = 0; j < nSegments; j++ )
343 : : {
344 : 0 : com::sun::star::drawing::EnhancedCustomShapeSegment aSegment;
345 [ # # ]: 0 : if ( bSimpleSegments )
346 : : {
347 : : // if there are not enough segments we will default them
348 [ # # # # : 0 : switch( j )
# ]
349 : : {
350 : : case 0 :
351 : : {
352 : 0 : aSegment.Count = 1;
353 : 0 : aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO;
354 : : }
355 : 0 : break;
356 : : case 1 :
357 : : {
358 : 0 : aSegment.Count = (sal_Int16)Min( nCoords - 1, (sal_Int32)32767 );
359 : 0 : aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
360 : : }
361 : 0 : break;
362 : : case 2 :
363 : : {
364 : 0 : aSegment.Count = 1;
365 : 0 : aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
366 : : }
367 : 0 : break;
368 : : case 3 :
369 : : {
370 : 0 : aSegment.Count = 1;
371 : 0 : aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
372 : : }
373 : 0 : break;
374 : : }
375 : : }
376 : : else
377 : 0 : aSegment = rSegments[ j ];
378 : :
379 [ # # ]: 0 : if ( aStrBuffer.getLength() )
380 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)' ' );
381 : :
382 : 0 : sal_Int32 nParameter = 0;
383 [ # # # # : 0 : switch( aSegment.Command )
# # # # #
# # # # #
# # # # ]
384 : : {
385 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH :
386 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'Z' ); break;
387 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH :
388 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'N' ); break;
389 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL :
390 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'F' ); break;
391 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE :
392 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'S' ); break;
393 : :
394 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO :
395 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'M' ); nParameter = 1; break;
396 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO :
397 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'L' ); nParameter = 1; break;
398 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO :
399 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'C' ); nParameter = 3; break;
400 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO :
401 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'T' ); nParameter = 3; break;
402 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE :
403 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'U' ); nParameter = 3; break;
404 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO :
405 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'A' ); nParameter = 4; break;
406 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC :
407 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'B' ); nParameter = 4; break;
408 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO :
409 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'W' ); nParameter = 4; break;
410 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC :
411 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'V' ); nParameter = 4; break;
412 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX :
413 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'X' ); nParameter = 1; break;
414 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY :
415 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'Y' ); nParameter = 1; break;
416 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO :
417 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'Q' ); nParameter = 2; break;
418 : : case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCANGLETO :
419 [ # # ]: 0 : if ( bExtended ) {
420 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'G' );
421 : 0 : nParameter = 2;
422 : : } else {
423 [ # # ]: 0 : aStrBuffer.setLength( aStrBuffer.getLength() - 1);
424 : 0 : bNeedExtended = true;
425 : 0 : i += 2;
426 : : }
427 : 0 : break;
428 : : default : // ups, seems to be something wrong
429 : : {
430 : 0 : aSegment.Count = 1;
431 : 0 : aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO;
432 : : }
433 : 0 : break;
434 : : }
435 [ # # ]: 0 : if ( nParameter )
436 : : {
437 [ # # ]: 0 : for ( k = 0; k < aSegment.Count; k++ )
438 : : {
439 [ # # ]: 0 : if ( ( i + nParameter ) <= nCoords )
440 : : {
441 [ # # ]: 0 : for ( l = 0; l < nParameter; l++ )
442 : : {
443 [ # # ]: 0 : ExportParameter( aStrBuffer, rCoordinates[ i ].First );
444 [ # # ]: 0 : ExportParameter( aStrBuffer, rCoordinates[ i++ ].Second );
445 : : }
446 : : }
447 : : else
448 : : {
449 : 0 : j = nSegments; // error -> exiting
450 : 0 : break;
451 : : }
452 : : }
453 : : }
454 : : }
455 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
456 [ # # ][ # # ]: 0 : rExport.AddAttribute( bExtended ? XML_NAMESPACE_DRAW_EXT : XML_NAMESPACE_DRAW, XML_ENHANCED_PATH, aStr );
457 [ # # ][ # # ]: 0 : if ( !bExtended && bNeedExtended )
458 [ # # ]: 0 : ImpExportEnhancedPath( rExport, rCoordinates, rSegments, true );
459 : 0 : }
460 : :
461 : 0 : void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< beans::XPropertySet >& xPropSet )
462 : : {
463 : 0 : sal_Bool bEquations = sal_False;
464 [ # # ]: 0 : uno::Sequence< rtl::OUString > aEquations;
465 : :
466 : 0 : sal_Bool bHandles = sal_False;
467 [ # # ]: 0 : uno::Sequence< beans::PropertyValues > aHandles;
468 : :
469 : 0 : sal_Bool bCoordinates = sal_False;
470 [ # # ]: 0 : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments;
471 [ # # ]: 0 : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates;
472 : :
473 [ # # ]: 0 : uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues;
474 : :
475 : 0 : rtl::OUString aStr;
476 : 0 : rtl::OUStringBuffer aStrBuffer;
477 : 0 : SvXMLUnitConverter& rUnitConverter = rExport.GetMM100UnitConverter();
478 : :
479 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
480 : :
481 : : // geometry
482 [ # # ]: 0 : const rtl::OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
483 [ # # ][ # # ]: 0 : if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) )
[ # # ][ # # ]
[ # # ]
484 : : {
485 [ # # ][ # # ]: 0 : uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) );
486 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aGeoPropSeq;
487 : :
488 [ # # ][ # # ]: 0 : if ( aGeoPropSet >>= aGeoPropSeq )
489 : : {
490 [ # # ]: 0 : const rtl::OUString sCustomShapeType( RTL_CONSTASCII_USTRINGPARAM( "NonPrimitive" ) );
491 : 0 : rtl::OUString aCustomShapeType( sCustomShapeType );
492 : :
493 : 0 : sal_Int32 j, nGeoPropCount = aGeoPropSeq.getLength();
494 [ # # ]: 0 : for ( j = 0; j < nGeoPropCount; j++ )
495 : : {
496 [ # # ]: 0 : const beans::PropertyValue& rGeoProp = aGeoPropSeq[ j ];
497 [ # # ][ # # : 0 : switch( EASGet( rGeoProp.Name ) )
# # # # #
# # # #
# ]
498 : : {
499 : : case EAS_Type :
500 : : {
501 : 0 : rGeoProp.Value >>= aCustomShapeType;
502 : : }
503 : 0 : break;
504 : : case EAS_MirroredX :
505 : : {
506 : 0 : sal_Bool bMirroredX = sal_Bool();
507 [ # # ]: 0 : if ( rGeoProp.Value >>= bMirroredX )
508 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIRROR_HORIZONTAL,
509 [ # # ][ # # ]: 0 : bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
510 : : }
511 : 0 : break;
512 : : case EAS_MirroredY :
513 : : {
514 : 0 : sal_Bool bMirroredY = sal_Bool();
515 [ # # ]: 0 : if ( rGeoProp.Value >>= bMirroredY )
516 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIRROR_VERTICAL,
517 [ # # ][ # # ]: 0 : bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
518 : : }
519 : 0 : break;
520 : : case EAS_ViewBox :
521 : : {
522 : 0 : awt::Rectangle aRect;
523 [ # # ][ # # ]: 0 : if ( rGeoProp.Value >>= aRect )
524 : : {
525 [ # # ]: 0 : SdXMLImExViewBox aViewBox( aRect.X, aRect.Y, aRect.Width, aRect.Height );
526 [ # # ][ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString() );
527 : : }
528 : : }
529 : 0 : break;
530 : : case EAS_TextRotateAngle :
531 : : {
532 : 0 : double fTextRotateAngle = 0;
533 [ # # ]: 0 : if ( rGeoProp.Value >>= fTextRotateAngle )
534 : : {
535 : : ::sax::Converter::convertDouble(
536 [ # # ]: 0 : aStrBuffer, fTextRotateAngle );
537 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
538 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_ROTATE_ANGLE, aStr );
539 : : }
540 : : }
541 : 0 : break;
542 : : case EAS_Extrusion :
543 : : {
544 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aExtrusionPropSeq;
545 [ # # ][ # # ]: 0 : if ( rGeoProp.Value >>= aExtrusionPropSeq )
546 : : {
547 : 0 : sal_Int32 i, nCount = aExtrusionPropSeq.getLength();
548 [ # # ]: 0 : for ( i = 0; i < nCount; i++ )
549 : : {
550 [ # # ]: 0 : const beans::PropertyValue& rProp = aExtrusionPropSeq[ i ];
551 [ # # ][ # # : 0 : switch( EASGet( rProp.Name ) )
# # # # #
# # # # #
# # # # #
# # # # #
# # ]
552 : : {
553 : : case EAS_Extrusion :
554 : : {
555 : 0 : sal_Bool bExtrusionOn = sal_Bool();
556 [ # # ]: 0 : if ( rProp.Value >>= bExtrusionOn )
557 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION,
558 [ # # ][ # # ]: 0 : bExtrusionOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
559 : : }
560 : 0 : break;
561 : : case EAS_Brightness :
562 : : {
563 : 0 : double fExtrusionBrightness = 0;
564 [ # # ]: 0 : if ( rProp.Value >>= fExtrusionBrightness )
565 : : {
566 : : ::sax::Converter::convertDouble(
567 : : aStrBuffer,
568 : : fExtrusionBrightness,
569 : : false,
570 : : util::MeasureUnit::PERCENT,
571 [ # # ]: 0 : util::MeasureUnit::PERCENT);
572 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'%' );
573 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
574 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_BRIGHTNESS, aStr );
575 : : }
576 : : }
577 : 0 : break;
578 : : case EAS_Depth :
579 : : {
580 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair;
581 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aDepthParaPair )
582 : : {
583 : 0 : double fDepth = 0;
584 [ # # ]: 0 : if ( aDepthParaPair.First.Value >>= fDepth )
585 : : {
586 [ # # ]: 0 : rExport.GetMM100UnitConverter().convertDouble( aStrBuffer, fDepth, sal_True );
587 [ # # ]: 0 : ExportParameter( aStrBuffer, aDepthParaPair.Second );
588 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
589 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DEPTH, aStr );
590 : : }
591 : 0 : }
592 : : }
593 : 0 : break;
594 : : case EAS_Diffusion :
595 : : {
596 : 0 : double fExtrusionDiffusion = 0;
597 [ # # ]: 0 : if ( rProp.Value >>= fExtrusionDiffusion )
598 : : {
599 : : ::sax::Converter::convertDouble(
600 : : aStrBuffer,
601 : : fExtrusionDiffusion,
602 : : false,
603 : : util::MeasureUnit::PERCENT,
604 [ # # ]: 0 : util::MeasureUnit::PERCENT);
605 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'%' );
606 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
607 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DIFFUSION, aStr );
608 : : }
609 : : }
610 : 0 : break;
611 : : case EAS_NumberOfLineSegments :
612 : : {
613 : 0 : sal_Int32 nExtrusionNumberOfLineSegments = 0;
614 [ # # ]: 0 : if ( rProp.Value >>= nExtrusionNumberOfLineSegments )
615 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS, rtl::OUString::valueOf( nExtrusionNumberOfLineSegments ) );
616 : : }
617 : 0 : break;
618 : : case EAS_LightFace :
619 : : {
620 : 0 : sal_Bool bExtrusionLightFace = sal_Bool();
621 [ # # ]: 0 : if ( rProp.Value >>= bExtrusionLightFace )
622 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_LIGHT_FACE,
623 [ # # ][ # # ]: 0 : bExtrusionLightFace ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
624 : : }
625 : 0 : break;
626 : : case EAS_FirstLightHarsh :
627 : : {
628 : 0 : sal_Bool bExtrusionFirstLightHarsh = sal_Bool();
629 [ # # ]: 0 : if ( rProp.Value >>= bExtrusionFirstLightHarsh )
630 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_HARSH,
631 [ # # ][ # # ]: 0 : bExtrusionFirstLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
632 : : }
633 : 0 : break;
634 : : case EAS_SecondLightHarsh :
635 : : {
636 : 0 : sal_Bool bExtrusionSecondLightHarsh = sal_Bool();
637 [ # # ]: 0 : if ( rProp.Value >>= bExtrusionSecondLightHarsh )
638 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_HARSH,
639 [ # # ][ # # ]: 0 : bExtrusionSecondLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
640 : : }
641 : 0 : break;
642 : : case EAS_FirstLightLevel :
643 : : {
644 : 0 : double fExtrusionFirstLightLevel = 0;
645 [ # # ]: 0 : if ( rProp.Value >>= fExtrusionFirstLightLevel )
646 : : {
647 : : ::sax::Converter::convertDouble(
648 : : aStrBuffer,
649 : : fExtrusionFirstLightLevel,
650 : : false,
651 : : util::MeasureUnit::PERCENT,
652 [ # # ]: 0 : util::MeasureUnit::PERCENT);
653 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'%' );
654 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
655 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_LEVEL, aStr );
656 : : }
657 : : }
658 : 0 : break;
659 : : case EAS_SecondLightLevel :
660 : : {
661 : 0 : double fExtrusionSecondLightLevel = 0;
662 [ # # ]: 0 : if ( rProp.Value >>= fExtrusionSecondLightLevel )
663 : : {
664 : : ::sax::Converter::convertDouble(
665 : : aStrBuffer,
666 : : fExtrusionSecondLightLevel,
667 : : false,
668 : : util::MeasureUnit::PERCENT,
669 [ # # ]: 0 : util::MeasureUnit::PERCENT);
670 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'%' );
671 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
672 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_LEVEL, aStr );
673 : : }
674 : : }
675 : 0 : break;
676 : : case EAS_FirstLightDirection :
677 : : {
678 : 0 : drawing::Direction3D aExtrusionFirstLightDirection;
679 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aExtrusionFirstLightDirection )
680 : : {
681 : : ::basegfx::B3DVector aVec3D( aExtrusionFirstLightDirection.DirectionX, aExtrusionFirstLightDirection.DirectionY,
682 : 0 : aExtrusionFirstLightDirection.DirectionZ );
683 [ # # ]: 0 : rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
684 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
685 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_DIRECTION, aStr );
686 : : }
687 : : }
688 : 0 : break;
689 : : case EAS_SecondLightDirection :
690 : : {
691 : 0 : drawing::Direction3D aExtrusionSecondLightDirection;
692 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aExtrusionSecondLightDirection )
693 : : {
694 : : ::basegfx::B3DVector aVec3D( aExtrusionSecondLightDirection.DirectionX, aExtrusionSecondLightDirection.DirectionY,
695 : 0 : aExtrusionSecondLightDirection.DirectionZ );
696 [ # # ]: 0 : rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
697 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
698 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_DIRECTION, aStr );
699 : : }
700 : : }
701 : 0 : break;
702 : : case EAS_Metal :
703 : : {
704 : 0 : sal_Bool bExtrusionMetal = sal_Bool();
705 [ # # ]: 0 : if ( rProp.Value >>= bExtrusionMetal )
706 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_METAL,
707 [ # # ][ # # ]: 0 : bExtrusionMetal ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
708 : : }
709 : 0 : break;
710 : : case EAS_ShadeMode :
711 : : {
712 : : // shadeMode
713 : : drawing::ShadeMode eShadeMode;
714 [ # # ][ # # ]: 0 : if( rProp.Value >>= eShadeMode )
715 : : {
716 [ # # ]: 0 : if( eShadeMode == drawing::ShadeMode_FLAT )
717 [ # # ]: 0 : aStr = GetXMLToken( XML_FLAT );
718 [ # # ]: 0 : else if( eShadeMode == drawing::ShadeMode_PHONG )
719 [ # # ]: 0 : aStr = GetXMLToken( XML_PHONG );
720 [ # # ]: 0 : else if( eShadeMode == drawing::ShadeMode_SMOOTH )
721 [ # # ]: 0 : aStr = GetXMLToken( XML_GOURAUD );
722 : : else
723 [ # # ]: 0 : aStr = GetXMLToken( XML_DRAFT );
724 : : }
725 : : else
726 : : {
727 : : // ShadeMode enum not there, write default
728 [ # # ]: 0 : aStr = GetXMLToken( XML_FLAT);
729 : : }
730 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DR3D, XML_SHADE_MODE, aStr );
731 : : }
732 : 0 : break;
733 : : case EAS_RotateAngle :
734 : : {
735 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair;
736 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aRotateAngleParaPair )
737 : : {
738 [ # # ]: 0 : ExportParameter( aStrBuffer, aRotateAngleParaPair.First );
739 [ # # ]: 0 : ExportParameter( aStrBuffer, aRotateAngleParaPair.Second );
740 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
741 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ROTATION_ANGLE, aStr );
742 : 0 : }
743 : : }
744 : 0 : break;
745 : : case EAS_RotationCenter :
746 : : {
747 : 0 : drawing::Direction3D aExtrusionRotationCenter;
748 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aExtrusionRotationCenter )
749 : : {
750 : : ::basegfx::B3DVector aVec3D( aExtrusionRotationCenter.DirectionX, aExtrusionRotationCenter.DirectionY,
751 : 0 : aExtrusionRotationCenter.DirectionZ );
752 [ # # ]: 0 : rUnitConverter.convertB3DVector( aStrBuffer, aVec3D );
753 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
754 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ROTATION_CENTER, aStr );
755 : : }
756 : : }
757 : 0 : break;
758 : : case EAS_Shininess :
759 : : {
760 : 0 : double fExtrusionShininess = 0;
761 [ # # ]: 0 : if ( rProp.Value >>= fExtrusionShininess )
762 : : {
763 : : ::sax::Converter::convertDouble(
764 : : aStrBuffer,
765 : : fExtrusionShininess,
766 : : false,
767 : : util::MeasureUnit::PERCENT,
768 [ # # ]: 0 : util::MeasureUnit::PERCENT);
769 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'%' );
770 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
771 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SHININESS, aStr );
772 : : }
773 : : }
774 : 0 : break;
775 : : case EAS_Skew :
776 : : {
777 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkewParaPair;
778 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aSkewParaPair )
779 : : {
780 [ # # ]: 0 : ExportParameter( aStrBuffer, aSkewParaPair.First );
781 [ # # ]: 0 : ExportParameter( aStrBuffer, aSkewParaPair.Second );
782 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
783 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SKEW, aStr );
784 : 0 : }
785 : : }
786 : 0 : break;
787 : : case EAS_Specularity :
788 : : {
789 : 0 : double fExtrusionSpecularity = 0;
790 [ # # ]: 0 : if ( rProp.Value >>= fExtrusionSpecularity )
791 : : {
792 : : ::sax::Converter::convertDouble(
793 : : aStrBuffer,
794 : : fExtrusionSpecularity,
795 : : false,
796 : : util::MeasureUnit::PERCENT,
797 [ # # ]: 0 : util::MeasureUnit::PERCENT);
798 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)'%' );
799 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
800 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SPECULARITY, aStr );
801 : : }
802 : : }
803 : 0 : break;
804 : : case EAS_ProjectionMode :
805 : : {
806 : : drawing::ProjectionMode eProjectionMode;
807 [ # # ][ # # ]: 0 : if ( rProp.Value >>= eProjectionMode )
808 : : rExport.AddAttribute( XML_NAMESPACE_DR3D, XML_PROJECTION,
809 [ # # ][ # # ]: 0 : eProjectionMode == drawing::ProjectionMode_PARALLEL ? GetXMLToken( XML_PARALLEL ) : GetXMLToken( XML_PERSPECTIVE ) );
[ # # ][ # # ]
810 : : }
811 : 0 : break;
812 : : case EAS_ViewPoint :
813 : : {
814 : 0 : drawing::Position3D aExtrusionViewPoint;
815 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aExtrusionViewPoint )
816 : : {
817 [ # # ]: 0 : rUnitConverter.convertPosition3D( aStrBuffer, aExtrusionViewPoint );
818 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
819 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_VIEWPOINT, aStr );
820 : : }
821 : : }
822 : 0 : break;
823 : : case EAS_Origin :
824 : : {
825 : 0 : com::sun::star::drawing::EnhancedCustomShapeParameterPair aOriginParaPair;
826 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aOriginParaPair )
827 : : {
828 [ # # ]: 0 : ExportParameter( aStrBuffer, aOriginParaPair.First );
829 [ # # ]: 0 : ExportParameter( aStrBuffer, aOriginParaPair.Second );
830 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
831 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ORIGIN, aStr );
832 : 0 : }
833 : : }
834 : 0 : break;
835 : : case EAS_Color :
836 : : {
837 : 0 : sal_Bool bExtrusionColor = sal_Bool();
838 [ # # ]: 0 : if ( rProp.Value >>= bExtrusionColor )
839 : : {
840 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_COLOR,
841 [ # # ][ # # ]: 0 : bExtrusionColor ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
842 : : }
843 : : }
844 : 0 : break;
845 : : default:
846 : 0 : break;
847 : : }
848 : : }
849 [ # # ]: 0 : }
850 : : }
851 : 0 : break;
852 : : case EAS_TextPath :
853 : : {
854 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aTextPathPropSeq;
855 [ # # ][ # # ]: 0 : if ( rGeoProp.Value >>= aTextPathPropSeq )
856 : : {
857 : 0 : sal_Int32 i, nCount = aTextPathPropSeq.getLength();
858 [ # # ]: 0 : for ( i = 0; i < nCount; i++ )
859 : : {
860 [ # # ]: 0 : const beans::PropertyValue& rProp = aTextPathPropSeq[ i ];
861 [ # # ][ # # : 0 : switch( EASGet( rProp.Name ) )
# # # ]
862 : : {
863 : : case EAS_TextPath :
864 : : {
865 : 0 : sal_Bool bTextPathOn = sal_Bool();
866 [ # # ]: 0 : if ( rProp.Value >>= bTextPathOn )
867 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH,
868 [ # # ][ # # ]: 0 : bTextPathOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
869 : : }
870 : 0 : break;
871 : : case EAS_TextPathMode :
872 : : {
873 : : com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode;
874 [ # # ][ # # ]: 0 : if ( rProp.Value >>= eTextPathMode )
875 : : {
876 [ # # # # ]: 0 : switch ( eTextPathMode )
877 : : {
878 [ # # ]: 0 : case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_NORMAL: aStr = GetXMLToken( XML_NORMAL ); break;
879 [ # # ]: 0 : case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH : aStr = GetXMLToken( XML_PATH ); break;
880 [ # # ]: 0 : case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE : aStr = GetXMLToken( XML_SHAPE ); break;
881 : : default:
882 : 0 : break;
883 : : }
884 [ # # ]: 0 : if ( !aStr.isEmpty() )
885 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_MODE, aStr );
886 : : }
887 : : }
888 : 0 : break;
889 : : case EAS_ScaleX :
890 : : {
891 : 0 : sal_Bool bScaleX = sal_Bool();
892 [ # # ]: 0 : if ( rProp.Value >>= bScaleX )
893 : : {
894 [ # # ][ # # ]: 0 : aStr = bScaleX ? GetXMLToken( XML_SHAPE ) : GetXMLToken( XML_PATH );
[ # # ]
895 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_SCALE, aStr );
896 : : }
897 : : }
898 : 0 : break;
899 : : case EAS_SameLetterHeights :
900 : : {
901 : 0 : sal_Bool bSameLetterHeights = sal_Bool();
902 [ # # ]: 0 : if ( rProp.Value >>= bSameLetterHeights )
903 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_SAME_LETTER_HEIGHTS,
904 [ # # ][ # # ]: 0 : bSameLetterHeights ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
905 : : }
906 : 0 : break;
907 : : default:
908 : 0 : break;
909 : : }
910 : : }
911 [ # # ]: 0 : }
912 : : }
913 : 0 : break;
914 : : case EAS_Path :
915 : : {
916 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aPathPropSeq;
917 [ # # ][ # # ]: 0 : if ( rGeoProp.Value >>= aPathPropSeq )
918 : : {
919 : 0 : sal_Int32 i, nCount = aPathPropSeq.getLength();
920 [ # # ]: 0 : for ( i = 0; i < nCount; i++ )
921 : : {
922 [ # # ]: 0 : const beans::PropertyValue& rProp = aPathPropSeq[ i ];
923 [ # # ][ # # : 0 : switch( EASGet( rProp.Name ) )
# # # # #
# # # # ]
924 : : {
925 : : case EAS_ExtrusionAllowed :
926 : : {
927 : 0 : sal_Bool bExtrusionAllowed = sal_Bool();
928 [ # # ]: 0 : if ( rProp.Value >>= bExtrusionAllowed )
929 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ALLOWED,
930 [ # # ][ # # ]: 0 : bExtrusionAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
931 : : }
932 : 0 : break;
933 : : case EAS_ConcentricGradientFillAllowed :
934 : : {
935 : 0 : sal_Bool bConcentricGradientFillAllowed = sal_Bool();
936 [ # # ]: 0 : if ( rProp.Value >>= bConcentricGradientFillAllowed )
937 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONCENTRIC_GRADIENT_FILL_ALLOWED,
938 [ # # ][ # # ]: 0 : bConcentricGradientFillAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
939 : : }
940 : 0 : break;
941 : : case EAS_TextPathAllowed :
942 : : {
943 : 0 : sal_Bool bTextPathAllowed = sal_Bool();
944 [ # # ]: 0 : if ( rProp.Value >>= bTextPathAllowed )
945 : : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_ALLOWED,
946 [ # # ][ # # ]: 0 : bTextPathAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) );
[ # # ][ # # ]
947 : : }
948 : 0 : break;
949 : : case EAS_GluePoints :
950 : : {
951 [ # # ]: 0 : com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> aGluePoints;
952 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aGluePoints )
953 : : {
954 : 0 : sal_Int32 k, nElements = aGluePoints.getLength();
955 [ # # ]: 0 : if ( nElements )
956 : : {
957 [ # # ]: 0 : for( k = 0; k < nElements; k++ )
958 : : {
959 [ # # ][ # # ]: 0 : ExportParameter( aStrBuffer, aGluePoints[ k ].First );
960 [ # # ][ # # ]: 0 : ExportParameter( aStrBuffer, aGluePoints[ k ].Second );
961 : : }
962 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
963 : : }
964 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GLUE_POINTS, aStr );
965 [ # # ]: 0 : }
966 : : }
967 : 0 : break;
968 : : case EAS_GluePointType :
969 : : {
970 : 0 : sal_Int16 nGluePointType = sal_Int16();
971 [ # # ]: 0 : if ( rProp.Value >>= nGluePointType )
972 : : {
973 [ # # # # ]: 0 : switch ( nGluePointType )
974 : : {
975 [ # # ]: 0 : case com::sun::star::drawing::EnhancedCustomShapeGluePointType::NONE : aStr = GetXMLToken( XML_NONE ); break;
976 [ # # ]: 0 : case com::sun::star::drawing::EnhancedCustomShapeGluePointType::SEGMENTS : aStr = GetXMLToken( XML_SEGMENTS ); break;
977 [ # # ]: 0 : case com::sun::star::drawing::EnhancedCustomShapeGluePointType::RECT : aStr = GetXMLToken( XML_RECTANGLE ); break;
978 : : }
979 [ # # ]: 0 : if ( !aStr.isEmpty() )
980 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GLUE_POINT_TYPE, aStr );
981 : : }
982 : : }
983 : 0 : break;
984 : : case EAS_Coordinates :
985 : : {
986 [ # # ]: 0 : bCoordinates = ( rProp.Value >>= aCoordinates );
987 : : }
988 : 0 : break;
989 : : case EAS_Segments :
990 : : {
991 [ # # ]: 0 : rProp.Value >>= aSegments;
992 : : }
993 : 0 : break;
994 : : case EAS_StretchX :
995 : : {
996 : 0 : sal_Int32 nStretchPoint = 0;
997 [ # # ]: 0 : if ( rProp.Value >>= nStretchPoint )
998 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_X, rtl::OUString::valueOf( nStretchPoint ) );
999 : : }
1000 : 0 : break;
1001 : : case EAS_StretchY :
1002 : : {
1003 : 0 : sal_Int32 nStretchPoint = 0;
1004 [ # # ]: 0 : if ( rProp.Value >>= nStretchPoint )
1005 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_Y, rtl::OUString::valueOf( nStretchPoint ) );
1006 : : }
1007 : 0 : break;
1008 : : case EAS_TextFrames :
1009 : : {
1010 [ # # ]: 0 : com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames;
1011 [ # # ][ # # ]: 0 : if ( rProp.Value >>= aPathTextFrames )
1012 : : {
1013 [ # # ]: 0 : if ( (sal_uInt16)aPathTextFrames.getLength() )
1014 : : {
1015 : 0 : sal_uInt16 k, nElements = (sal_uInt16)aPathTextFrames.getLength();
1016 [ # # ]: 0 : for ( k = 0; k < nElements; k++ )
1017 : : {
1018 [ # # ][ # # ]: 0 : ExportParameter( aStrBuffer, aPathTextFrames[ k ].TopLeft.First );
1019 [ # # ][ # # ]: 0 : ExportParameter( aStrBuffer, aPathTextFrames[ k ].TopLeft.Second );
1020 [ # # ][ # # ]: 0 : ExportParameter( aStrBuffer, aPathTextFrames[ k ].BottomRight.First );
1021 [ # # ][ # # ]: 0 : ExportParameter( aStrBuffer, aPathTextFrames[ k ].BottomRight.Second );
1022 : : }
1023 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
1024 : : }
1025 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_AREAS, aStr );
1026 [ # # ]: 0 : }
1027 : : }
1028 : 0 : break;
1029 : : default:
1030 : 0 : break;
1031 : : }
1032 : : }
1033 [ # # ]: 0 : }
1034 : : }
1035 : 0 : break;
1036 : : case EAS_Equations :
1037 : : {
1038 [ # # ]: 0 : bEquations = ( rGeoProp.Value >>= aEquations );
1039 : : }
1040 : 0 : break;
1041 : : case EAS_Handles :
1042 : : {
1043 [ # # ]: 0 : bHandles = ( rGeoProp.Value >>= aHandles );
1044 : : }
1045 : 0 : break;
1046 : : case EAS_AdjustmentValues :
1047 : : {
1048 [ # # ]: 0 : rGeoProp.Value >>= aAdjustmentValues;
1049 : : }
1050 : 0 : break;
1051 : : default:
1052 : 0 : break;
1053 : : }
1054 : : } // for
1055 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TYPE, aCustomShapeType );
1056 : :
1057 : : // adjustments
1058 : 0 : sal_Int32 nAdjustmentValues = aAdjustmentValues.getLength();
1059 [ # # ]: 0 : if ( nAdjustmentValues )
1060 : : {
1061 : 0 : sal_Int32 i, nValue = 0;
1062 [ # # ]: 0 : for ( i = 0; i < nAdjustmentValues; i++ )
1063 : : {
1064 [ # # ]: 0 : if ( i )
1065 [ # # ]: 0 : aStrBuffer.append( (sal_Unicode)' ' );
1066 : :
1067 [ # # ]: 0 : const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue& rAdj = aAdjustmentValues[ i ];
1068 [ # # ]: 0 : if ( rAdj.State == beans::PropertyState_DIRECT_VALUE )
1069 : : {
1070 [ # # ]: 0 : if ( rAdj.Value.getValueTypeClass() == uno::TypeClass_DOUBLE )
1071 : : {
1072 : 0 : double fValue = 0.0;
1073 : 0 : rAdj.Value >>= fValue;
1074 [ # # ]: 0 : ::sax::Converter::convertDouble(aStrBuffer, fValue);
1075 : : }
1076 : : else
1077 : : {
1078 : 0 : rAdj.Value >>= nValue;
1079 [ # # ]: 0 : ::sax::Converter::convertNumber(aStrBuffer, nValue);
1080 : : }
1081 : : }
1082 : : else
1083 : : {
1084 : : // this should not be, but better than setting nothing
1085 [ # # ]: 0 : ::sax::Converter::convertNumber( aStrBuffer, 0 );
1086 : : }
1087 : : }
1088 [ # # ]: 0 : aStr = aStrBuffer.makeStringAndClear();
1089 [ # # ]: 0 : rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MODIFIERS, aStr );
1090 : : }
1091 [ # # ]: 0 : if ( bCoordinates )
1092 [ # # ]: 0 : ImpExportEnhancedPath( rExport, aCoordinates, aSegments );
1093 [ # # ]: 0 : }
1094 : : }
1095 [ # # ]: 0 : SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_ENHANCED_GEOMETRY, sal_True, sal_True );
1096 [ # # ]: 0 : if ( bEquations )
1097 [ # # ]: 0 : ImpExportEquations( rExport, aEquations );
1098 [ # # ]: 0 : if ( bHandles )
1099 [ # # ][ # # ]: 0 : ImpExportHandles( rExport, aHandles );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1100 : 0 : }
1101 : :
1102 : 0 : void XMLShapeExport::ImpExportCustomShape(
1103 : : const uno::Reference< drawing::XShape >& xShape,
1104 : : XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint )
1105 : : {
1106 [ # # ]: 0 : const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1107 [ # # ]: 0 : if ( xPropSet.is() )
1108 : : {
1109 : 0 : rtl::OUString aStr;
1110 [ # # ][ # # ]: 0 : uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1111 : :
1112 : : // Transformation
1113 [ # # ]: 0 : ImpExportNewTrans( xPropSet, nFeatures, pRefPoint );
1114 : :
1115 [ # # ]: 0 : if ( xPropSetInfo.is() )
1116 : : {
1117 [ # # ]: 0 : const rtl::OUString sCustomShapeEngine( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeEngine" ) );
1118 [ # # ][ # # ]: 0 : if ( xPropSetInfo->hasPropertyByName( sCustomShapeEngine ) )
[ # # ]
1119 : : {
1120 [ # # ][ # # ]: 0 : uno::Any aEngine( xPropSet->getPropertyValue( sCustomShapeEngine ) );
1121 [ # # ][ # # ]: 0 : if ( ( aEngine >>= aStr ) && !aStr.isEmpty() )
[ # # ]
1122 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENGINE, aStr );
1123 : : }
1124 [ # # ]: 0 : const rtl::OUString sCustomShapeData( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeData" ) );
1125 [ # # ][ # # ]: 0 : if ( xPropSetInfo->hasPropertyByName( sCustomShapeData ) )
[ # # ]
1126 : : {
1127 [ # # ][ # # ]: 0 : uno::Any aData( xPropSet->getPropertyValue( sCustomShapeData ) );
1128 [ # # ][ # # ]: 0 : if ( ( aData >>= aStr ) && !aStr.isEmpty() )
[ # # ]
1129 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DATA, aStr );
1130 : 0 : }
1131 : : }
1132 : 0 : sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1133 [ # # ]: 0 : SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, bCreateNewline, sal_True );
1134 [ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
1135 [ # # ]: 0 : ImpExportEvents( xShape );
1136 [ # # ]: 0 : ImpExportGluePoints( xShape );
1137 [ # # ]: 0 : ImpExportText( xShape );
1138 [ # # ][ # # ]: 0 : ImpExportEnhancedGeometry( mrExport, xPropSet );
1139 : 0 : }
1140 : 0 : }
1141 : :
1142 : 0 : void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint )
1143 : : {
1144 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1145 [ # # ]: 0 : uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
1146 : :
1147 : : DBG_ASSERT( xPropSet.is() && xNamed.is(), "xmloff::XMLShapeExport::ImpExportTableShape(), tabe shape is not implementing needed interfaces");
1148 [ # # ][ # # ]: 0 : if(xPropSet.is() && xNamed.is()) try
[ # # ]
1149 : : {
1150 : : // Transformation
1151 [ # # ]: 0 : ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1152 : :
1153 : 0 : sal_Bool bIsEmptyPresObj = sal_False;
1154 : :
1155 : : // presentation settings
1156 [ # # ]: 0 : if(eShapeType == XmlShapeTypePresTableShape)
1157 [ # # ][ # # ]: 0 : bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
1158 : :
1159 : 0 : const bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 );
1160 : 0 : const bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
1161 : :
1162 [ # # ]: 0 : SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW, XML_FRAME, bCreateNewline, sal_True );
1163 : :
1164 : : // do not export in ODF 1.1 or older
1165 [ # # ][ # # ]: 0 : if( mrExport.getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
1166 : : {
1167 [ # # ]: 0 : if( !bIsEmptyPresObj )
1168 : : {
1169 [ # # ][ # # ]: 0 : uno::Reference< container::XNamed > xTemplate( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ) ), uno::UNO_QUERY );
[ # # ][ # # ]
1170 [ # # ]: 0 : if( xTemplate.is() )
1171 : : {
1172 [ # # ][ # # ]: 0 : const OUString sTemplate( xTemplate->getName() );
1173 [ # # ]: 0 : if( !sTemplate.isEmpty() )
1174 : : {
1175 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sTemplate );
1176 : :
1177 [ # # ]: 0 : for( const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; pEntry->msApiName; pEntry++ )
1178 : : {
1179 : : try
1180 : : {
1181 : 0 : sal_Bool bBool = sal_False;
1182 [ # # ]: 0 : const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) );
1183 : :
1184 [ # # ][ # # ]: 0 : xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool;
1185 [ # # ]: 0 : if( bBool )
1186 [ # # ][ # # ]: 0 : mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE );
1187 : : }
1188 [ # # ]: 0 : catch( uno::Exception& )
1189 : : {
1190 : : OSL_FAIL("XMLShapeExport::ImpExportTableShape(), exception caught!");
1191 : : }
1192 : : }
1193 : 0 : }
1194 : : }
1195 : :
1196 : :
1197 [ # # ][ # # ]: 0 : uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW );
[ # # ]
1198 [ # # ][ # # ]: 0 : GetShapeTableExport()->exportTable( xRange );
1199 : : }
1200 : : }
1201 : :
1202 [ # # ]: 0 : if( !bIsEmptyPresObj )
1203 : : {
1204 [ # # ][ # # ]: 0 : uno::Reference< graphic::XGraphic > xGraphic( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReplacementGraphic" ) ) ), uno::UNO_QUERY );
[ # # ][ # # ]
1205 [ # # ]: 0 : if( xGraphic.is() ) try
1206 : : {
1207 [ # # ][ # # ]: 0 : Reference< lang::XMultiServiceFactory > xSM( GetExport().getServiceFactory(), UNO_QUERY_THROW );
1208 : :
1209 : 0 : uno::Reference< embed::XStorage > xPictureStorage;
1210 : 0 : uno::Reference< embed::XStorage > xStorage;
1211 : 0 : uno::Reference< io::XStream > xPictureStream;
1212 : :
1213 : 0 : OUString sPictureName;
1214 [ # # ]: 0 : if( bExportEmbedded )
1215 : : {
1216 [ # # ][ # # ]: 0 : xPictureStream.set( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.MemoryStream" ) ) ), UNO_QUERY_THROW );
[ # # ][ # # ]
1217 : : }
1218 : : else
1219 : : {
1220 [ # # ][ # # ]: 0 : xStorage.set( GetExport().GetTargetStorage(), UNO_QUERY_THROW );
1221 : :
1222 [ # # ][ # # ]: 0 : xPictureStorage.set( xStorage->openStorageElement( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ), ::embed::ElementModes::READWRITE ), uno::UNO_QUERY_THROW );
[ # # ][ # # ]
1223 [ # # ]: 0 : const OUString sPrefix( RTL_CONSTASCII_USTRINGPARAM("TablePreview") );
1224 [ # # ]: 0 : const OUString sSuffix( RTL_CONSTASCII_USTRINGPARAM(".svm") );
1225 : :
1226 : 0 : sal_Int32 nIndex = 0;
1227 [ # # ]: 0 : do
1228 : : {
1229 : 0 : sPictureName = sPrefix;
1230 : 0 : sPictureName += OUString::valueOf( ++nIndex );
1231 : 0 : sPictureName += sSuffix;
1232 : : }
1233 [ # # ][ # # ]: 0 : while( xPictureStorage->hasByName( sPictureName ) );
1234 : :
1235 [ # # ][ # # ]: 0 : xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), UNO_QUERY_THROW );
[ # # ]
1236 : : }
1237 : :
1238 [ # # ][ # # ]: 0 : Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(comphelper::ComponentContext(xSM).getUNOContext()) );
[ # # ][ # # ]
1239 [ # # ]: 0 : Sequence< beans::PropertyValue > aArgs( 2 );
1240 [ # # ][ # # ]: 0 : aArgs[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MimeType" ) );
1241 [ # # ][ # # ]: 0 : aArgs[ 0 ].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "image/x-vclgraphic" ) );
[ # # ]
1242 [ # # ][ # # ]: 0 : aArgs[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ) );
1243 [ # # ][ # # ]: 0 : aArgs[ 1 ].Value <<= xPictureStream->getOutputStream();
[ # # ][ # # ]
1244 [ # # ][ # # ]: 0 : xProvider->storeGraphic( xGraphic, aArgs );
1245 : :
1246 [ # # ]: 0 : if( xPictureStorage.is() )
1247 : : {
1248 [ # # ]: 0 : Reference< embed::XTransactedObject > xTrans( xPictureStorage, UNO_QUERY );
1249 [ # # ]: 0 : if( xTrans.is() )
1250 [ # # ][ # # ]: 0 : xTrans->commit();
1251 : : }
1252 : :
1253 [ # # ]: 0 : if( !bExportEmbedded )
1254 : : {
1255 [ # # ]: 0 : OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "Pictures/" ) );
1256 : 0 : sURL += sPictureName;
1257 [ # # ]: 0 : mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
1258 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1259 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1260 [ # # ]: 0 : mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1261 : : }
1262 : :
1263 [ # # ]: 0 : SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, sal_False, sal_True );
1264 : :
1265 [ # # ]: 0 : if( bExportEmbedded )
1266 : : {
1267 [ # # ]: 0 : Reference< XSeekableInputStream > xSeekable( xPictureStream, UNO_QUERY_THROW );
1268 [ # # ][ # # ]: 0 : xSeekable->seek(0);
1269 : :
1270 [ # # ]: 0 : XMLBase64Export aBase64Exp( GetExport() );
1271 [ # # ][ # # ]: 0 : aBase64Exp.exportOfficeBinaryDataElement( Reference < XInputStream >( xPictureStream, UNO_QUERY_THROW ) );
1272 [ # # ][ # # ]: 0 : }
[ # # ]
1273 : : }
1274 [ # # ]: 0 : catch( uno::Exception& )
1275 : : {
1276 : : OSL_FAIL("xmloff::XMLShapeExport::ImpExportTableShape(), exception caught!");
1277 : 0 : }
1278 : : }
1279 : :
1280 [ # # ]: 0 : ImpExportEvents( xShape );
1281 [ # # ]: 0 : ImpExportGluePoints( xShape );
1282 [ # # ][ # # ]: 0 : ImpExportDescription( xShape ); // #i68101#
[ # # ]
1283 : : }
1284 [ # # ]: 0 : catch( uno::Exception& )
1285 : : {
1286 : : OSL_FAIL( "xmloff::XMLShapeExport::ImpExportTableShape(), exception caught!" );
1287 : 0 : }
1288 : 0 : }
1289 : :
1290 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|