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