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 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
24cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx"
25cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp>
26cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp>
27cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
28cdf0e10cSrcweir #include <com/sun/star/drawing/CircleKind.hpp>
29cdf0e10cSrcweir #include <com/sun/star/drawing/ConnectorType.hpp>
30cdf0e10cSrcweir #include <com/sun/star/drawing/XControlShape.hpp>
31cdf0e10cSrcweir #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
32cdf0e10cSrcweir #include <com/sun/star/document/XEventsSupplier.hpp>
33cdf0e10cSrcweir #include <com/sun/star/drawing/HomogenMatrix3.hpp>
34cdf0e10cSrcweir #include <com/sun/star/media/ZoomLevel.hpp>
35cdf0e10cSrcweir #include "anim.hxx"
36cdf0e10cSrcweir #include <xmloff/shapeexport.hxx>
37cdf0e10cSrcweir #include "sdpropls.hxx"
38cdf0e10cSrcweir #include <tools/debug.hxx>
39cdf0e10cSrcweir #include <tools/urlobj.hxx>
40cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
41cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
42cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
43cdf0e10cSrcweir #include "XMLImageMapExport.hxx"
44cdf0e10cSrcweir #include "xexptran.hxx"
45cdf0e10cSrcweir #include <tools/gen.hxx>		// FRound
46cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
47cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
48cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
49cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
50cdf0e10cSrcweir #include <basegfx/tuple/b2dtuple.hxx>
51*1f882ec4SArmin Le Grand #include <basegfx/matrix/b2dhommatrixtools.hxx>
52*1f882ec4SArmin Le Grand #include <basegfx/point/b2dpoint.hxx>
53*1f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolypolygon.hxx>
54*1f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolypolygontools.hxx>
55*1f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolygontools.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir using ::rtl::OUString;
58cdf0e10cSrcweir using ::rtl::OUStringBuffer;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir using namespace ::com::sun::star;
61cdf0e10cSrcweir using namespace ::xmloff::token;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
65cdf0e10cSrcweir 
66cdf0e10cSrcweir void XMLShapeExport::ImpExportNewTrans(const uno::Reference< beans::XPropertySet >& xPropSet,
67cdf0e10cSrcweir 	sal_Int32 nFeatures, awt::Point* pRefPoint)
68cdf0e10cSrcweir {
69cdf0e10cSrcweir 	// get matrix
70cdf0e10cSrcweir 	::basegfx::B2DHomMatrix aMatrix;
71cdf0e10cSrcweir 	ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	// decompose and correct abour pRefPoint
74cdf0e10cSrcweir 	::basegfx::B2DTuple aTRScale;
75cdf0e10cSrcweir 	double fTRShear(0.0);
76cdf0e10cSrcweir 	double fTRRotate(0.0);
77cdf0e10cSrcweir 	::basegfx::B2DTuple aTRTranslate;
78cdf0e10cSrcweir 	ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	// use features and write
81cdf0e10cSrcweir 	ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir void XMLShapeExport::ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix,
85cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet >& xPropSet)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     // --> OD 2004-08-09 #i28749# - Get <TransformationInHoriL2R>, if it exist
88cdf0e10cSrcweir     // and if the document is exported into the OpenOffice.org file format.
89cdf0e10cSrcweir     // This property only exists at service com::sun::star::text::Shape - the
90cdf0e10cSrcweir     // Writer UNO service for shapes.
91cdf0e10cSrcweir     // This code is needed, because the positioning attributes in the
92cdf0e10cSrcweir     // OpenOffice.org file format are given in horizontal left-to-right layout
93cdf0e10cSrcweir     // regardless the layout direction the shape is in. In the OASIS Open Office
94cdf0e10cSrcweir     // file format the positioning attributes are correctly given in the layout
95cdf0e10cSrcweir     // direction the shape is in. Thus, this code provides the conversion from
96cdf0e10cSrcweir     // the OASIS Open Office file format to the OpenOffice.org file format.
97cdf0e10cSrcweir     uno::Any aAny;
98cdf0e10cSrcweir     if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
99cdf0e10cSrcweir          xPropSet->getPropertySetInfo()->hasPropertyByName(
100cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("TransformationInHoriL2R"))) )
101cdf0e10cSrcweir     {
102cdf0e10cSrcweir         aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("TransformationInHoriL2R")));
103cdf0e10cSrcweir     }
104cdf0e10cSrcweir     else
105cdf0e10cSrcweir     {
106cdf0e10cSrcweir         aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")));
107cdf0e10cSrcweir     }
108cdf0e10cSrcweir     // <--
109cdf0e10cSrcweir 	drawing::HomogenMatrix3 aMatrix;
110cdf0e10cSrcweir 	aAny >>= aMatrix;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	rMatrix.set(0, 0, aMatrix.Line1.Column1);
113cdf0e10cSrcweir 	rMatrix.set(0, 1, aMatrix.Line1.Column2);
114cdf0e10cSrcweir 	rMatrix.set(0, 2, aMatrix.Line1.Column3);
115cdf0e10cSrcweir 	rMatrix.set(1, 0, aMatrix.Line2.Column1);
116cdf0e10cSrcweir 	rMatrix.set(1, 1, aMatrix.Line2.Column2);
117cdf0e10cSrcweir 	rMatrix.set(1, 2, aMatrix.Line2.Column3);
118cdf0e10cSrcweir 	rMatrix.set(2, 0, aMatrix.Line3.Column1);
119cdf0e10cSrcweir 	rMatrix.set(2, 1, aMatrix.Line3.Column2);
120cdf0e10cSrcweir 	rMatrix.set(2, 2, aMatrix.Line3.Column3);
121cdf0e10cSrcweir }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir void XMLShapeExport::ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMatrix, ::basegfx::B2DTuple& rTRScale,
124cdf0e10cSrcweir 	double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint)
125cdf0e10cSrcweir {
126cdf0e10cSrcweir 	// decompose matrix
127cdf0e10cSrcweir 	rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	// correct translation about pRefPoint
130cdf0e10cSrcweir 	if(pRefPoint)
131cdf0e10cSrcweir 	{
132cdf0e10cSrcweir 		rTRTranslate -= ::basegfx::B2DTuple(pRefPoint->X, pRefPoint->Y);
133cdf0e10cSrcweir 	}
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear,
137cdf0e10cSrcweir 	double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const sal_Int32 nFeatures)
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	// allways write Size (rTRScale) since this statement carries the union
140cdf0e10cSrcweir 	// of the object
141cdf0e10cSrcweir 	OUString aStr;
142cdf0e10cSrcweir 	OUStringBuffer sStringBuffer;
143cdf0e10cSrcweir 	::basegfx::B2DTuple aTRScale(rTRScale);
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	// svg: width
146cdf0e10cSrcweir 	if(!(nFeatures & SEF_EXPORT_WIDTH))
147cdf0e10cSrcweir 	{
148cdf0e10cSrcweir 		aTRScale.setX(1.0);
149cdf0e10cSrcweir 	}
150cdf0e10cSrcweir 	else
151cdf0e10cSrcweir 	{
152cdf0e10cSrcweir 		if( aTRScale.getX() > 0.0 )
153cdf0e10cSrcweir 			aTRScale.setX(aTRScale.getX() - 1.0);
154cdf0e10cSrcweir 		else if( aTRScale.getX() < 0.0 )
155cdf0e10cSrcweir 			aTRScale.setX(aTRScale.getX() + 1.0);
156cdf0e10cSrcweir 	}
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getX()));
159cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
160cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	// svg: height
163cdf0e10cSrcweir 	if(!(nFeatures & SEF_EXPORT_HEIGHT))
164cdf0e10cSrcweir 	{
165cdf0e10cSrcweir 		aTRScale.setY(1.0);
166cdf0e10cSrcweir 	}
167cdf0e10cSrcweir 	else
168cdf0e10cSrcweir 	{
169cdf0e10cSrcweir 		if( aTRScale.getY() > 0.0 )
170cdf0e10cSrcweir 			aTRScale.setY(aTRScale.getY() - 1.0);
171cdf0e10cSrcweir 		else if( aTRScale.getY() < 0.0 )
172cdf0e10cSrcweir 			aTRScale.setY(aTRScale.getY() + 1.0);
173cdf0e10cSrcweir 	}
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getY()));
176cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
177cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	// decide if transformation is neccessary
180cdf0e10cSrcweir 	sal_Bool bTransformationIsNeccessary(fTRShear != 0.0 || fTRRotate != 0.0);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	if(bTransformationIsNeccessary)
183cdf0e10cSrcweir 	{
184cdf0e10cSrcweir 		// write transformation, but WITHOUT scale which is exported as size above
185cdf0e10cSrcweir 		SdXMLImExTransform2D aTransform;
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 		aTransform.AddSkewX(atan(fTRShear));
188cdf0e10cSrcweir 
189cdf0e10cSrcweir         // #i78696#
190cdf0e10cSrcweir         // fTRRotate is mathematically correct, but due to the error
191cdf0e10cSrcweir         // we export/import it mirrored. Since the API implementation is fixed and
192cdf0e10cSrcweir         // uses the correctly oriented angle, it is necessary for compatibility to
193cdf0e10cSrcweir         // mirror the angle here to stay at the old behaviour. There is a follow-up
194cdf0e10cSrcweir         // task (#i78698#) to fix this in the next ODF FileFormat version
195cdf0e10cSrcweir 		aTransform.AddRotate(-fTRRotate);
196cdf0e10cSrcweir 
197cdf0e10cSrcweir         aTransform.AddTranslate(rTRTranslate);
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 		// does transformation need to be exported?
200cdf0e10cSrcweir 		if(aTransform.NeedsAction())
201cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter()));
202cdf0e10cSrcweir 	}
203cdf0e10cSrcweir 	else
204cdf0e10cSrcweir 	{
205cdf0e10cSrcweir 		// no shear, no rotate; just add object position to export and we are done
206cdf0e10cSrcweir 		if(nFeatures & SEF_EXPORT_X)
207cdf0e10cSrcweir 		{
208cdf0e10cSrcweir 			// svg: x
209cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getX()));
210cdf0e10cSrcweir 			aStr = sStringBuffer.makeStringAndClear();
211cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
212cdf0e10cSrcweir 		}
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 		if(nFeatures & SEF_EXPORT_Y)
215cdf0e10cSrcweir 		{
216cdf0e10cSrcweir 			// svg: y
217cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getY()));
218cdf0e10cSrcweir 			aStr = sStringBuffer.makeStringAndClear();
219cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
220cdf0e10cSrcweir 		}
221cdf0e10cSrcweir 	}
222cdf0e10cSrcweir }
223cdf0e10cSrcweir 
224cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
225cdf0e10cSrcweir 
226cdf0e10cSrcweir sal_Bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< beans::XPropertySet >& xPropSet, const rtl::OUString& rClass )
227cdf0e10cSrcweir {
228cdf0e10cSrcweir 	sal_Bool bIsEmpty = sal_False;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 	OUStringBuffer sStringBuffer;
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	// write presentation class entry
233cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS, rClass);
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	if( xPropSet.is() )
236cdf0e10cSrcweir 	{
237cdf0e10cSrcweir 		uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 		sal_Bool bTemp = false;
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 		// is empty pes shape?
242cdf0e10cSrcweir 		if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject"))))
243cdf0e10cSrcweir 		{
244cdf0e10cSrcweir 			xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject"))) >>= bIsEmpty;
245cdf0e10cSrcweir 			if( bIsEmpty )
246cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, XML_TRUE);
247cdf0e10cSrcweir 		}
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 		// is user-transformed?
250cdf0e10cSrcweir 		if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent"))))
251cdf0e10cSrcweir 		{
252cdf0e10cSrcweir 			xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent"))) >>= bTemp;
253cdf0e10cSrcweir 			if(!bTemp)
254cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_USER_TRANSFORMED, XML_TRUE);
255cdf0e10cSrcweir 		}
256cdf0e10cSrcweir 	}
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 	return bIsEmpty;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
262cdf0e10cSrcweir 
263cdf0e10cSrcweir void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xShape )
264cdf0e10cSrcweir {
265cdf0e10cSrcweir 	uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
266cdf0e10cSrcweir 	if( xText.is() )
267cdf0e10cSrcweir 	{
268cdf0e10cSrcweir 		uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY );
269cdf0e10cSrcweir 		if( xEnumAccess.is() && xEnumAccess->hasElements() )
270cdf0e10cSrcweir 			mrExport.GetTextParagraphExport()->exportText( xText );
271cdf0e10cSrcweir 	}
272cdf0e10cSrcweir }
273cdf0e10cSrcweir 
274cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
275cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp>
276cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationSpeed.hpp>
277cdf0e10cSrcweir 
278cdf0e10cSrcweir namespace {
279cdf0e10cSrcweir 
280cdf0e10cSrcweir const sal_Int32 FOUND_CLICKACTION       = 0x00000001;
281cdf0e10cSrcweir const sal_Int32 FOUND_BOOKMARK          = 0x00000002;
282cdf0e10cSrcweir const sal_Int32 FOUND_EFFECT            = 0x00000004;
283cdf0e10cSrcweir const sal_Int32 FOUND_PLAYFULL          = 0x00000008;
284cdf0e10cSrcweir const sal_Int32 FOUND_VERB              = 0x00000010;
285cdf0e10cSrcweir const sal_Int32 FOUND_SOUNDURL          = 0x00000020;
286cdf0e10cSrcweir const sal_Int32 FOUND_SPEED             = 0x00000040;
287cdf0e10cSrcweir const sal_Int32 FOUND_CLICKEVENTTYPE    = 0x00000080;
288cdf0e10cSrcweir const sal_Int32 FOUND_MACRO             = 0x00000100;
289cdf0e10cSrcweir const sal_Int32 FOUND_LIBRARY           = 0x00000200;
290cdf0e10cSrcweir const sal_Int32 FOUND_ACTIONEVENTTYPE   = 0x00000400;
291cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
292cdf0e10cSrcweir const sal_Int32 FOUND_URL               = 0x00000800;
293cdf0e10cSrcweir #endif
294cdf0e10cSrcweir 
295cdf0e10cSrcweir } // namespace
296cdf0e10cSrcweir 
297cdf0e10cSrcweir void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape )
298cdf0e10cSrcweir {
299cdf0e10cSrcweir     uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY );
300cdf0e10cSrcweir     if( !xEventsSupplier.is() )
301cdf0e10cSrcweir         return;
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     uno::Reference< container::XNameAccess > xEvents( xEventsSupplier->getEvents(), uno::UNO_QUERY );
304cdf0e10cSrcweir     DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" );
305cdf0e10cSrcweir     if( !xEvents.is() )
306cdf0e10cSrcweir         return;
307cdf0e10cSrcweir 
308cdf0e10cSrcweir     sal_Int32 nFound = 0;
309cdf0e10cSrcweir 
310cdf0e10cSrcweir     // extract properties from "OnClick" event --------------------------------
311cdf0e10cSrcweir 
312cdf0e10cSrcweir     OUString aClickEventType;
313cdf0e10cSrcweir     presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
314cdf0e10cSrcweir     presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
315cdf0e10cSrcweir     presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW;
316cdf0e10cSrcweir     OUString aStrSoundURL;
317cdf0e10cSrcweir     sal_Bool bPlayFull = false;
318cdf0e10cSrcweir     sal_Int32 nVerb = 0;
319cdf0e10cSrcweir     OUString aStrMacro;
320cdf0e10cSrcweir     OUString aStrLibrary;
321cdf0e10cSrcweir     OUString aStrBookmark;
322cdf0e10cSrcweir 
323cdf0e10cSrcweir     uno::Sequence< beans::PropertyValue > aClickProperties;
324cdf0e10cSrcweir     if( xEvents->hasByName( msOnClick ) && (xEvents->getByName( msOnClick ) >>= aClickProperties) )
325cdf0e10cSrcweir     {
326cdf0e10cSrcweir         const beans::PropertyValue* pProperty = aClickProperties.getConstArray();
327cdf0e10cSrcweir         const beans::PropertyValue* pPropertyEnd = pProperty + aClickProperties.getLength();
328cdf0e10cSrcweir         for( ; pProperty != pPropertyEnd; ++pProperty )
329cdf0e10cSrcweir         {
330cdf0e10cSrcweir             if( ( ( nFound & FOUND_CLICKEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
331cdf0e10cSrcweir             {
332cdf0e10cSrcweir                 if( pProperty->Value >>= aClickEventType )
333cdf0e10cSrcweir                     nFound |= FOUND_CLICKEVENTTYPE;
334cdf0e10cSrcweir             }
335cdf0e10cSrcweir             else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperty->Name == msClickAction )
336cdf0e10cSrcweir             {
337cdf0e10cSrcweir                 if( pProperty->Value >>= eClickAction )
338cdf0e10cSrcweir                     nFound |= FOUND_CLICKACTION;
339cdf0e10cSrcweir             }
340cdf0e10cSrcweir             else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperty->Name == msMacroName || pProperty->Name == msScript ) )
341cdf0e10cSrcweir             {
342cdf0e10cSrcweir                 if( pProperty->Value >>= aStrMacro )
343cdf0e10cSrcweir                     nFound |= FOUND_MACRO;
344cdf0e10cSrcweir             }
345cdf0e10cSrcweir             else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperty->Name == msLibrary )
346cdf0e10cSrcweir             {
347cdf0e10cSrcweir                 if( pProperty->Value >>= aStrLibrary )
348cdf0e10cSrcweir                     nFound |= FOUND_LIBRARY;
349cdf0e10cSrcweir             }
350cdf0e10cSrcweir             else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperty->Name == msEffect )
351cdf0e10cSrcweir             {
352cdf0e10cSrcweir                 if( pProperty->Value >>= eEffect )
353cdf0e10cSrcweir                     nFound |= FOUND_EFFECT;
354cdf0e10cSrcweir             }
355cdf0e10cSrcweir             else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperty->Name == msBookmark )
356cdf0e10cSrcweir             {
357cdf0e10cSrcweir                 if( pProperty->Value >>= aStrBookmark )
358cdf0e10cSrcweir                     nFound |= FOUND_BOOKMARK;
359cdf0e10cSrcweir             }
360cdf0e10cSrcweir             else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperty->Name == msSpeed )
361cdf0e10cSrcweir             {
362cdf0e10cSrcweir                 if( pProperty->Value >>= eSpeed )
363cdf0e10cSrcweir                     nFound |= FOUND_SPEED;
364cdf0e10cSrcweir             }
365cdf0e10cSrcweir             else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperty->Name == msSoundURL )
366cdf0e10cSrcweir             {
367cdf0e10cSrcweir                 if( pProperty->Value >>= aStrSoundURL )
368cdf0e10cSrcweir                     nFound |= FOUND_SOUNDURL;
369cdf0e10cSrcweir             }
370cdf0e10cSrcweir             else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperty->Name == msPlayFull )
371cdf0e10cSrcweir             {
372cdf0e10cSrcweir                 if( pProperty->Value >>= bPlayFull )
373cdf0e10cSrcweir                     nFound |= FOUND_PLAYFULL;
374cdf0e10cSrcweir             }
375cdf0e10cSrcweir             else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperty->Name == msVerb )
376cdf0e10cSrcweir             {
377cdf0e10cSrcweir                 if( pProperty->Value >>= nVerb )
378cdf0e10cSrcweir                     nFound |= FOUND_VERB;
379cdf0e10cSrcweir             }
380cdf0e10cSrcweir         }
381cdf0e10cSrcweir     }
382cdf0e10cSrcweir 
383cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
384cdf0e10cSrcweir     // extract properties from "OnAction" event -------------------------------
385cdf0e10cSrcweir 
386cdf0e10cSrcweir     OUString aActionEventType;
387cdf0e10cSrcweir     OUString aHyperURL;
388cdf0e10cSrcweir 
389cdf0e10cSrcweir     uno::Sequence< beans::PropertyValue > aActionProperties;
390cdf0e10cSrcweir     if( xEvents->hasByName( msOnAction ) && (xEvents->getByName( msOnAction ) >>= aActionProperties) )
391cdf0e10cSrcweir     {
392cdf0e10cSrcweir         const beans::PropertyValue* pProperty = aActionProperties.getConstArray();
393cdf0e10cSrcweir         const beans::PropertyValue* pPropertyEnd = pProperty + aActionProperties.getLength();
394cdf0e10cSrcweir         for( ; pProperty != pPropertyEnd; ++pProperty )
395cdf0e10cSrcweir         {
396cdf0e10cSrcweir             if( ( ( nFound & FOUND_ACTIONEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
397cdf0e10cSrcweir             {
398cdf0e10cSrcweir                 if( pProperty->Value >>= aActionEventType )
399cdf0e10cSrcweir                     nFound |= FOUND_ACTIONEVENTTYPE;
400cdf0e10cSrcweir             }
401cdf0e10cSrcweir             else if( ( ( nFound & FOUND_URL ) == 0 ) && ( pProperty->Name == msURL  ) )
402cdf0e10cSrcweir             {
403cdf0e10cSrcweir                 if( pProperty->Value >>= aHyperURL )
404cdf0e10cSrcweir                     nFound |= FOUND_URL;
405cdf0e10cSrcweir             }
406cdf0e10cSrcweir         }
407cdf0e10cSrcweir     }
408cdf0e10cSrcweir #endif
409cdf0e10cSrcweir 
410cdf0e10cSrcweir     // create the XML elements
411cdf0e10cSrcweir 
412cdf0e10cSrcweir     if( aClickEventType == msPresentation )
413cdf0e10cSrcweir     {
414cdf0e10cSrcweir         if( ((nFound & FOUND_CLICKACTION) == 0) || (eClickAction == presentation::ClickAction_NONE) )
415cdf0e10cSrcweir             return;
416cdf0e10cSrcweir 
417cdf0e10cSrcweir         SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
418cdf0e10cSrcweir 
419cdf0e10cSrcweir         enum XMLTokenEnum eStrAction;
420cdf0e10cSrcweir 
421cdf0e10cSrcweir         switch( eClickAction )
422cdf0e10cSrcweir         {
423cdf0e10cSrcweir             case presentation::ClickAction_PREVPAGE:        eStrAction = XML_PREVIOUS_PAGE; break;
424cdf0e10cSrcweir             case presentation::ClickAction_NEXTPAGE:        eStrAction = XML_NEXT_PAGE; break;
425cdf0e10cSrcweir             case presentation::ClickAction_FIRSTPAGE:       eStrAction = XML_FIRST_PAGE; break;
426cdf0e10cSrcweir             case presentation::ClickAction_LASTPAGE:        eStrAction = XML_LAST_PAGE; break;
427cdf0e10cSrcweir             case presentation::ClickAction_INVISIBLE:       eStrAction = XML_HIDE; break;
428cdf0e10cSrcweir             case presentation::ClickAction_STOPPRESENTATION:eStrAction = XML_STOP; break;
429cdf0e10cSrcweir             case presentation::ClickAction_PROGRAM:         eStrAction = XML_EXECUTE; break;
430cdf0e10cSrcweir             case presentation::ClickAction_BOOKMARK:        eStrAction = XML_SHOW; break;
431cdf0e10cSrcweir             case presentation::ClickAction_DOCUMENT:        eStrAction = XML_SHOW; break;
432cdf0e10cSrcweir             case presentation::ClickAction_MACRO:           eStrAction = XML_EXECUTE_MACRO; break;
433cdf0e10cSrcweir             case presentation::ClickAction_VERB:            eStrAction = XML_VERB; break;
434cdf0e10cSrcweir             case presentation::ClickAction_VANISH:          eStrAction = XML_FADE_OUT; break;
435cdf0e10cSrcweir             case presentation::ClickAction_SOUND:           eStrAction = XML_SOUND; break;
436cdf0e10cSrcweir             default:
437cdf0e10cSrcweir                 DBG_ERROR( "unknown presentation::ClickAction found!" );
438cdf0e10cSrcweir                 eStrAction = XML_UNKNOWN;
439cdf0e10cSrcweir         }
440cdf0e10cSrcweir 
441cdf0e10cSrcweir         OUString aEventQName(
442cdf0e10cSrcweir             mrExport.GetNamespaceMap().GetQNameByKey(
443cdf0e10cSrcweir                     XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
444cdf0e10cSrcweir         mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
445cdf0e10cSrcweir         mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_ACTION, eStrAction );
446cdf0e10cSrcweir 
447cdf0e10cSrcweir         if( eClickAction == presentation::ClickAction_VANISH )
448cdf0e10cSrcweir         {
449cdf0e10cSrcweir             if( nFound & FOUND_EFFECT )
450cdf0e10cSrcweir             {
451cdf0e10cSrcweir                 XMLEffect eKind;
452cdf0e10cSrcweir                 XMLEffectDirection eDirection;
453cdf0e10cSrcweir                 sal_Int16 nStartScale;
454cdf0e10cSrcweir                 sal_Bool bIn;
455cdf0e10cSrcweir 
456cdf0e10cSrcweir                 SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn );
457cdf0e10cSrcweir 
458cdf0e10cSrcweir                 if( eKind != EK_none )
459cdf0e10cSrcweir                 {
460cdf0e10cSrcweir                     SvXMLUnitConverter::convertEnum( msBuffer, eKind, aXML_AnimationEffect_EnumMap );
461cdf0e10cSrcweir                     mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, msBuffer.makeStringAndClear() );
462cdf0e10cSrcweir                 }
463cdf0e10cSrcweir 
464cdf0e10cSrcweir                 if( eDirection != ED_none )
465cdf0e10cSrcweir                 {
466cdf0e10cSrcweir                     SvXMLUnitConverter::convertEnum( msBuffer, eDirection, aXML_AnimationDirection_EnumMap );
467cdf0e10cSrcweir                     mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, msBuffer.makeStringAndClear() );
468cdf0e10cSrcweir                 }
469cdf0e10cSrcweir 
470cdf0e10cSrcweir                 if( nStartScale != -1 )
471cdf0e10cSrcweir                 {
472cdf0e10cSrcweir                     SvXMLUnitConverter::convertPercent( msBuffer, nStartScale );
473cdf0e10cSrcweir                     mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, msBuffer.makeStringAndClear() );
474cdf0e10cSrcweir                 }
475cdf0e10cSrcweir             }
476cdf0e10cSrcweir 
477cdf0e10cSrcweir             if( nFound & FOUND_SPEED && eEffect != presentation::AnimationEffect_NONE )
478cdf0e10cSrcweir             {
479cdf0e10cSrcweir                  if( eSpeed != presentation::AnimationSpeed_MEDIUM )
480cdf0e10cSrcweir                     {
481cdf0e10cSrcweir                     SvXMLUnitConverter::convertEnum( msBuffer, eSpeed, aXML_AnimationSpeed_EnumMap );
482cdf0e10cSrcweir                     mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, msBuffer.makeStringAndClear() );
483cdf0e10cSrcweir                 }
484cdf0e10cSrcweir             }
485cdf0e10cSrcweir         }
486cdf0e10cSrcweir 
487cdf0e10cSrcweir         if( eClickAction == presentation::ClickAction_PROGRAM ||
488cdf0e10cSrcweir             eClickAction == presentation::ClickAction_BOOKMARK ||
489cdf0e10cSrcweir             eClickAction == presentation::ClickAction_DOCUMENT )
490cdf0e10cSrcweir         {
491cdf0e10cSrcweir             if( eClickAction == presentation::ClickAction_BOOKMARK )
492cdf0e10cSrcweir                 msBuffer.append( sal_Unicode('#') );
493cdf0e10cSrcweir 
494cdf0e10cSrcweir             msBuffer.append( aStrBookmark );
495cdf0e10cSrcweir             mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(msBuffer.makeStringAndClear()) );
496cdf0e10cSrcweir             mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
497cdf0e10cSrcweir             mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
498cdf0e10cSrcweir             mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
499cdf0e10cSrcweir         }
500cdf0e10cSrcweir 
501cdf0e10cSrcweir         if( ( nFound & FOUND_VERB ) && eClickAction == presentation::ClickAction_VERB )
502cdf0e10cSrcweir         {
503cdf0e10cSrcweir             msBuffer.append( nVerb );
504cdf0e10cSrcweir             mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_VERB, msBuffer.makeStringAndClear());
505cdf0e10cSrcweir         }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir         SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
508cdf0e10cSrcweir 
509cdf0e10cSrcweir         if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND )
510cdf0e10cSrcweir         {
511cdf0e10cSrcweir             if( ( nFound & FOUND_SOUNDURL ) && aStrSoundURL.getLength() != 0 )
512cdf0e10cSrcweir             {
513cdf0e10cSrcweir                 mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStrSoundURL) );
514cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
515cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW );
516cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
517cdf0e10cSrcweir                 if( nFound & FOUND_PLAYFULL && bPlayFull )
518cdf0e10cSrcweir                     mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE );
519cdf0e10cSrcweir 
520cdf0e10cSrcweir                 SvXMLElementExport aElem( mrExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True );
521cdf0e10cSrcweir             }
522cdf0e10cSrcweir        }
523cdf0e10cSrcweir     }
524cdf0e10cSrcweir     else if( aClickEventType == msStarBasic )
525cdf0e10cSrcweir     {
526cdf0e10cSrcweir         if( nFound & FOUND_MACRO )
527cdf0e10cSrcweir         {
528cdf0e10cSrcweir             SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
529cdf0e10cSrcweir 
530cdf0e10cSrcweir             mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE,
531cdf0e10cSrcweir                         mrExport.GetNamespaceMap().GetQNameByKey(
532cdf0e10cSrcweir                             XML_NAMESPACE_OOO,
533cdf0e10cSrcweir                             OUString( RTL_CONSTASCII_USTRINGPARAM(
534cdf0e10cSrcweir                                             "starbasic" ) ) ) );
535cdf0e10cSrcweir             OUString aEventQName(
536cdf0e10cSrcweir                 mrExport.GetNamespaceMap().GetQNameByKey(
537cdf0e10cSrcweir                         XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
538cdf0e10cSrcweir             mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
539cdf0e10cSrcweir 
540cdf0e10cSrcweir             if( nFound & FOUND_LIBRARY )
541cdf0e10cSrcweir             {
542cdf0e10cSrcweir                 OUString sLocation( GetXMLToken(
543cdf0e10cSrcweir                     (aStrLibrary.equalsIgnoreAsciiCaseAscii("StarOffice") ||
544cdf0e10cSrcweir                      aStrLibrary.equalsIgnoreAsciiCaseAscii("application") ) ? XML_APPLICATION
545cdf0e10cSrcweir                                                                        : XML_DOCUMENT ) );
546cdf0e10cSrcweir                 OUStringBuffer sTmp( sLocation.getLength() + aStrMacro.getLength() + 1 );
547cdf0e10cSrcweir                 sTmp = sLocation;
548cdf0e10cSrcweir                 sTmp.append( sal_Unicode( ':' ) );
549cdf0e10cSrcweir                 sTmp.append( aStrMacro );
550cdf0e10cSrcweir                 mrExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME,
551cdf0e10cSrcweir                                      sTmp.makeStringAndClear());
552cdf0e10cSrcweir             }
553cdf0e10cSrcweir             else
554cdf0e10cSrcweir             {
555cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, aStrMacro );
556cdf0e10cSrcweir             }
557cdf0e10cSrcweir 
558cdf0e10cSrcweir             SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
559cdf0e10cSrcweir         }
560cdf0e10cSrcweir     }
561cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
562cdf0e10cSrcweir     else if( aClickEventType == msScript || aActionEventType == msAction )
563cdf0e10cSrcweir     {
564cdf0e10cSrcweir         if( nFound & ( FOUND_MACRO | FOUND_URL ) )
565cdf0e10cSrcweir #else
566cdf0e10cSrcweir     else if( aClickEventType == msScript )
567cdf0e10cSrcweir     {
568cdf0e10cSrcweir         if( nFound & FOUND_MACRO )
569cdf0e10cSrcweir #endif
570cdf0e10cSrcweir         {
571cdf0e10cSrcweir             SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
572cdf0e10cSrcweir             if ( nFound & FOUND_MACRO )
573cdf0e10cSrcweir             {
574cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, mrExport.GetNamespaceMap().GetQNameByKey(
575cdf0e10cSrcweir                          XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) );
576cdf0e10cSrcweir                 OUString aEventQName(
577cdf0e10cSrcweir                     mrExport.GetNamespaceMap().GetQNameByKey(
578cdf0e10cSrcweir                             XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) );
579cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
580cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro );
581cdf0e10cSrcweir 
582cdf0e10cSrcweir                 SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
583cdf0e10cSrcweir             }
584cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
585cdf0e10cSrcweir             if ( nFound & FOUND_URL )
586cdf0e10cSrcweir             {
587cdf0e10cSrcweir                 OUString aEventQName(
588cdf0e10cSrcweir                     mrExport.GetNamespaceMap().GetQNameByKey(
589cdf0e10cSrcweir                             XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "action" ) ) ) );
590cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
591cdf0e10cSrcweir                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aHyperURL );
592cdf0e10cSrcweir 
593cdf0e10cSrcweir                 SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
594cdf0e10cSrcweir             }
595cdf0e10cSrcweir #endif
596cdf0e10cSrcweir         }
597cdf0e10cSrcweir     }
598cdf0e10cSrcweir }
599cdf0e10cSrcweir 
600cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
601cdf0e10cSrcweir 
602cdf0e10cSrcweir /** #i68101# export shape Title and Description */
603cdf0e10cSrcweir void XMLShapeExport::ImpExportDescription( const uno::Reference< drawing::XShape >& xShape )
604cdf0e10cSrcweir {
605cdf0e10cSrcweir 	try
606cdf0e10cSrcweir 	{
607cdf0e10cSrcweir 		OUString aTitle;
608cdf0e10cSrcweir 		OUString aDescription;
609cdf0e10cSrcweir 
610cdf0e10cSrcweir 		uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
611cdf0e10cSrcweir 		xProps->getPropertyValue( OUString::createFromAscii( "Title" ) ) >>= aTitle;
612cdf0e10cSrcweir 		xProps->getPropertyValue( OUString::createFromAscii( "Description" ) ) >>= aDescription;
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 		if(aTitle.getLength())
615cdf0e10cSrcweir 		{
616cdf0e10cSrcweir 			SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False);
617cdf0e10cSrcweir 			mrExport.Characters( aTitle );
618cdf0e10cSrcweir 		}
619cdf0e10cSrcweir 
620cdf0e10cSrcweir 		if(aDescription.getLength())
621cdf0e10cSrcweir 		{
622cdf0e10cSrcweir 			SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_DESC, sal_True, sal_False );
623cdf0e10cSrcweir 			mrExport.Characters( aDescription );
624cdf0e10cSrcweir 		}
625cdf0e10cSrcweir 	}
626cdf0e10cSrcweir 	catch( uno::Exception& )
627cdf0e10cSrcweir 	{
628cdf0e10cSrcweir 		DBG_ERROR( "could not export Title and/or Description for shape!" );
629cdf0e10cSrcweir 	}
630cdf0e10cSrcweir }
631cdf0e10cSrcweir 
632cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
633cdf0e10cSrcweir 
634cdf0e10cSrcweir void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
635cdf0e10cSrcweir {
636cdf0e10cSrcweir 	uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY);
637cdf0e10cSrcweir 	if(xShapes.is() && xShapes->getCount())
638cdf0e10cSrcweir 	{
639cdf0e10cSrcweir 		// write group shape
640cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
641cdf0e10cSrcweir 		SvXMLElementExport aPGR(mrExport, XML_NAMESPACE_DRAW, XML_G, bCreateNewline, sal_True);
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
644cdf0e10cSrcweir 		ImpExportEvents( xShape );
645cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
646cdf0e10cSrcweir 
647cdf0e10cSrcweir 		// #89764# if export of position is supressed for group shape,
648cdf0e10cSrcweir 		// positions of contained objects should be written relative to
649cdf0e10cSrcweir 		// the upper left edge of the group.
650cdf0e10cSrcweir 		awt::Point aUpperLeft;
651cdf0e10cSrcweir 
652cdf0e10cSrcweir 		if(!(nFeatures & SEF_EXPORT_POSITION))
653cdf0e10cSrcweir 		{
654cdf0e10cSrcweir 			nFeatures |= SEF_EXPORT_POSITION;
655cdf0e10cSrcweir 			aUpperLeft = xShape->getPosition();
656cdf0e10cSrcweir 			pRefPoint = &aUpperLeft;
657cdf0e10cSrcweir 		}
658cdf0e10cSrcweir 
659cdf0e10cSrcweir 		// write members
660cdf0e10cSrcweir 		exportShapes( xShapes, nFeatures, pRefPoint );
661cdf0e10cSrcweir 	}
662cdf0e10cSrcweir }
663cdf0e10cSrcweir 
664cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
665cdf0e10cSrcweir 
666cdf0e10cSrcweir void XMLShapeExport::ImpExportTextBoxShape(
667cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
668cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
669cdf0e10cSrcweir {
670cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
671cdf0e10cSrcweir 	if(xPropSet.is())
672cdf0e10cSrcweir 	{
673cdf0e10cSrcweir 		uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 		// presentation attribute (if presentation)
676cdf0e10cSrcweir 		sal_Bool bIsPresShape(sal_False);
677cdf0e10cSrcweir 		sal_Bool bIsEmptyPresObj(sal_False);
678cdf0e10cSrcweir 		OUString aStr;
679cdf0e10cSrcweir 
680cdf0e10cSrcweir 		switch(eShapeType)
681cdf0e10cSrcweir 		{
682cdf0e10cSrcweir 			case XmlShapeTypePresSubtitleShape:
683cdf0e10cSrcweir 			{
684cdf0e10cSrcweir 				aStr = GetXMLToken(XML_PRESENTATION_SUBTITLE);
685cdf0e10cSrcweir 				bIsPresShape = sal_True;
686cdf0e10cSrcweir 				break;
687cdf0e10cSrcweir 			}
688cdf0e10cSrcweir 			case XmlShapeTypePresTitleTextShape:
689cdf0e10cSrcweir 			{
690cdf0e10cSrcweir 				aStr = GetXMLToken(XML_PRESENTATION_TITLE);
691cdf0e10cSrcweir 				bIsPresShape = sal_True;
692cdf0e10cSrcweir 				break;
693cdf0e10cSrcweir 			}
694cdf0e10cSrcweir 			case XmlShapeTypePresOutlinerShape:
695cdf0e10cSrcweir 			{
696cdf0e10cSrcweir 				aStr = GetXMLToken(XML_PRESENTATION_OUTLINE);
697cdf0e10cSrcweir 				bIsPresShape = sal_True;
698cdf0e10cSrcweir 				break;
699cdf0e10cSrcweir 			}
700cdf0e10cSrcweir 			case XmlShapeTypePresNotesShape:
701cdf0e10cSrcweir 			{
702cdf0e10cSrcweir 				aStr = GetXMLToken(XML_PRESENTATION_NOTES);
703cdf0e10cSrcweir 				bIsPresShape = sal_True;
704cdf0e10cSrcweir 				break;
705cdf0e10cSrcweir 			}
706cdf0e10cSrcweir 			case XmlShapeTypePresHeaderShape:
707cdf0e10cSrcweir 			{
708cdf0e10cSrcweir 				aStr = GetXMLToken(XML_HEADER);
709cdf0e10cSrcweir 				bIsPresShape = sal_True;
710cdf0e10cSrcweir 				break;
711cdf0e10cSrcweir 			}
712cdf0e10cSrcweir 			case XmlShapeTypePresFooterShape:
713cdf0e10cSrcweir 			{
714cdf0e10cSrcweir 				aStr = GetXMLToken(XML_FOOTER);
715cdf0e10cSrcweir 				bIsPresShape = sal_True;
716cdf0e10cSrcweir 				break;
717cdf0e10cSrcweir 			}
718cdf0e10cSrcweir 			case XmlShapeTypePresSlideNumberShape:
719cdf0e10cSrcweir 			{
720cdf0e10cSrcweir 				aStr = GetXMLToken(XML_PAGE_NUMBER);
721cdf0e10cSrcweir 				bIsPresShape = sal_True;
722cdf0e10cSrcweir 				break;
723cdf0e10cSrcweir 			}
724cdf0e10cSrcweir 			case XmlShapeTypePresDateTimeShape:
725cdf0e10cSrcweir 			{
726cdf0e10cSrcweir 				aStr = GetXMLToken(XML_DATE_TIME);
727cdf0e10cSrcweir 				bIsPresShape = sal_True;
728cdf0e10cSrcweir 				break;
729cdf0e10cSrcweir 			}
730cdf0e10cSrcweir 			default:
731cdf0e10cSrcweir 				break;
732cdf0e10cSrcweir 		}
733cdf0e10cSrcweir 
734cdf0e10cSrcweir 		// Transformation
735cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
736cdf0e10cSrcweir 
737cdf0e10cSrcweir 		if(bIsPresShape)
738cdf0e10cSrcweir 			bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, aStr );
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 
741cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
742cdf0e10cSrcweir 		SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
743cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
744cdf0e10cSrcweir 
745cdf0e10cSrcweir 		// evtl. corner radius?
746cdf0e10cSrcweir 		sal_Int32 nCornerRadius(0L);
747cdf0e10cSrcweir 		xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
748cdf0e10cSrcweir 		if(nCornerRadius)
749cdf0e10cSrcweir 		{
750cdf0e10cSrcweir 			OUStringBuffer sStringBuffer;
751cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
752cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
753cdf0e10cSrcweir 		}
754cdf0e10cSrcweir 
755cdf0e10cSrcweir 		{
756cdf0e10cSrcweir 			// write text-box
757cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_TEXT_BOX, sal_True, sal_True);
758cdf0e10cSrcweir 			if(!bIsEmptyPresObj)
759cdf0e10cSrcweir 				ImpExportText( xShape );
760cdf0e10cSrcweir 		}
761cdf0e10cSrcweir 
762cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
763cdf0e10cSrcweir 		ImpExportEvents( xShape );
764cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
765cdf0e10cSrcweir 	}
766cdf0e10cSrcweir }
767cdf0e10cSrcweir 
768cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
769cdf0e10cSrcweir 
770cdf0e10cSrcweir void XMLShapeExport::ImpExportRectangleShape(
771cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
772cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
773cdf0e10cSrcweir {
774cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
775cdf0e10cSrcweir 	if(xPropSet.is())
776cdf0e10cSrcweir 	{
777cdf0e10cSrcweir 		// Transformation
778cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
779cdf0e10cSrcweir 
780cdf0e10cSrcweir 		// evtl. corner radius?
781cdf0e10cSrcweir 		sal_Int32 nCornerRadius(0L);
782cdf0e10cSrcweir 		xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
783cdf0e10cSrcweir 		if(nCornerRadius)
784cdf0e10cSrcweir 		{
785cdf0e10cSrcweir 			OUStringBuffer sStringBuffer;
786cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
787cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
788cdf0e10cSrcweir 		}
789cdf0e10cSrcweir 
790cdf0e10cSrcweir 		// write rectangle
791cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
792cdf0e10cSrcweir 		SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_RECT, bCreateNewline, sal_True);
793cdf0e10cSrcweir 
794cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
795cdf0e10cSrcweir 		ImpExportEvents( xShape );
796cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
797cdf0e10cSrcweir 		ImpExportText( xShape );
798cdf0e10cSrcweir 	}
799cdf0e10cSrcweir }
800cdf0e10cSrcweir 
801cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
802cdf0e10cSrcweir 
803cdf0e10cSrcweir void XMLShapeExport::ImpExportLineShape(
804cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
805cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
806cdf0e10cSrcweir {
807cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
808cdf0e10cSrcweir 	if(xPropSet.is())
809cdf0e10cSrcweir 	{
810cdf0e10cSrcweir 		OUString aStr;
811cdf0e10cSrcweir 		OUStringBuffer sStringBuffer;
812cdf0e10cSrcweir 		awt::Point aStart(0,0);
813cdf0e10cSrcweir 		awt::Point aEnd(1,1);
814cdf0e10cSrcweir 
815cdf0e10cSrcweir 		// #85920# use 'Geometry' to get the points of the line
816cdf0e10cSrcweir 		// since this slot take anchor pos into account.
817cdf0e10cSrcweir 
818cdf0e10cSrcweir 		// get matrix
819cdf0e10cSrcweir 		::basegfx::B2DHomMatrix aMatrix;
820cdf0e10cSrcweir 		ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
821cdf0e10cSrcweir 
822cdf0e10cSrcweir 		// decompose and correct about pRefPoint
823cdf0e10cSrcweir 		::basegfx::B2DTuple aTRScale;
824cdf0e10cSrcweir 		double fTRShear(0.0);
825cdf0e10cSrcweir 		double fTRRotate(0.0);
826cdf0e10cSrcweir 		::basegfx::B2DTuple aTRTranslate;
827cdf0e10cSrcweir 		ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
828cdf0e10cSrcweir 
829cdf0e10cSrcweir 		// create base position
830cdf0e10cSrcweir 		awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY()));
831cdf0e10cSrcweir 
832cdf0e10cSrcweir 		// get the two points
833cdf0e10cSrcweir 		uno::Any aAny(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))));
834cdf0e10cSrcweir 		drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue();
835cdf0e10cSrcweir 
836cdf0e10cSrcweir 		if(pSourcePolyPolygon)
837cdf0e10cSrcweir 		{
838cdf0e10cSrcweir 		    drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray();
839cdf0e10cSrcweir 			if(pOuterSequence)
840cdf0e10cSrcweir 			{
841cdf0e10cSrcweir 		        drawing::PointSequence* pInnerSequence = pOuterSequence++;
842cdf0e10cSrcweir 				if(pInnerSequence)
843cdf0e10cSrcweir 				{
844cdf0e10cSrcweir 				    awt::Point* pArray = pInnerSequence->getArray();
845cdf0e10cSrcweir 					if(pArray)
846cdf0e10cSrcweir 					{
847cdf0e10cSrcweir 						if(pInnerSequence->getLength() > 0)
848cdf0e10cSrcweir 						{
849cdf0e10cSrcweir 							aStart = awt::Point(
850cdf0e10cSrcweir 								pArray->X + aBasePosition.X,
851cdf0e10cSrcweir 								pArray->Y + aBasePosition.Y);
852cdf0e10cSrcweir 							pArray++;
853cdf0e10cSrcweir 						}
854cdf0e10cSrcweir 
855cdf0e10cSrcweir 						if(pInnerSequence->getLength() > 1)
856cdf0e10cSrcweir 						{
857cdf0e10cSrcweir 							aEnd = awt::Point(
858cdf0e10cSrcweir 								pArray->X + aBasePosition.X,
859cdf0e10cSrcweir 								pArray->Y + aBasePosition.Y);
860cdf0e10cSrcweir 						}
861cdf0e10cSrcweir 					}
862cdf0e10cSrcweir 				}
863cdf0e10cSrcweir 			}
864cdf0e10cSrcweir 		}
865cdf0e10cSrcweir 
866cdf0e10cSrcweir 		if( nFeatures & SEF_EXPORT_X )
867cdf0e10cSrcweir 		{
868cdf0e10cSrcweir 			// svg: x1
869cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
870cdf0e10cSrcweir 			aStr = sStringBuffer.makeStringAndClear();
871cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
872cdf0e10cSrcweir 		}
873cdf0e10cSrcweir 		else
874cdf0e10cSrcweir 		{
875cdf0e10cSrcweir 			aEnd.X -= aStart.X;
876cdf0e10cSrcweir 		}
877cdf0e10cSrcweir 
878cdf0e10cSrcweir 		if( nFeatures & SEF_EXPORT_Y )
879cdf0e10cSrcweir 		{
880cdf0e10cSrcweir 			// svg: y1
881cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
882cdf0e10cSrcweir 			aStr = sStringBuffer.makeStringAndClear();
883cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
884cdf0e10cSrcweir 		}
885cdf0e10cSrcweir 		else
886cdf0e10cSrcweir 		{
887cdf0e10cSrcweir 			aEnd.Y -= aStart.Y;
888cdf0e10cSrcweir 		}
889cdf0e10cSrcweir 
890cdf0e10cSrcweir 		// svg: x2
891cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
892cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
893cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
894cdf0e10cSrcweir 
895cdf0e10cSrcweir 		// svg: y2
896cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
897cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
898cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
899cdf0e10cSrcweir 
900cdf0e10cSrcweir 		// write line
901cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
902cdf0e10cSrcweir 		SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_LINE, bCreateNewline, sal_True);
903cdf0e10cSrcweir 
904cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
905cdf0e10cSrcweir 		ImpExportEvents( xShape );
906cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
907cdf0e10cSrcweir 		ImpExportText( xShape );
908cdf0e10cSrcweir 	}
909cdf0e10cSrcweir }
910cdf0e10cSrcweir 
911cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
912cdf0e10cSrcweir 
913cdf0e10cSrcweir void XMLShapeExport::ImpExportEllipseShape(
914cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
915cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
916cdf0e10cSrcweir {
917cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
918cdf0e10cSrcweir 	if(xPropSet.is())
919cdf0e10cSrcweir 	{
920cdf0e10cSrcweir 		// get size to decide between Circle and Ellipse
921cdf0e10cSrcweir 		awt::Size aSize = xShape->getSize();
922cdf0e10cSrcweir 		sal_Int32 nRx((aSize.Width + 1) / 2);
923cdf0e10cSrcweir 		sal_Int32 nRy((aSize.Height + 1) / 2);
924cdf0e10cSrcweir 		sal_Bool bCircle(nRx == nRy);
925cdf0e10cSrcweir 
926cdf0e10cSrcweir 		// Transformation
927cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
928cdf0e10cSrcweir 
929cdf0e10cSrcweir 		drawing::CircleKind eKind = drawing::CircleKind_FULL;
930cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleKind")) ) >>= eKind;
931cdf0e10cSrcweir 		if( eKind != drawing::CircleKind_FULL )
932cdf0e10cSrcweir 		{
933cdf0e10cSrcweir 			OUStringBuffer sStringBuffer;
934cdf0e10cSrcweir 			sal_Int32 nStartAngle = 0;
935cdf0e10cSrcweir 			sal_Int32 nEndAngle = 0;
936cdf0e10cSrcweir 			xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleStartAngle")) ) >>= nStartAngle;
937cdf0e10cSrcweir 			xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleEndAngle")) ) >>= nEndAngle;
938cdf0e10cSrcweir 
939cdf0e10cSrcweir 			const double dStartAngle = nStartAngle / 100.0;
940cdf0e10cSrcweir 			const double dEndAngle = nEndAngle / 100.0;
941cdf0e10cSrcweir 
942cdf0e10cSrcweir 			// export circle kind
943cdf0e10cSrcweir 			SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eKind, aXML_CircleKind_EnumMap );
944cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() );
945cdf0e10cSrcweir 
946cdf0e10cSrcweir 			// export start angle
947cdf0e10cSrcweir 			SvXMLUnitConverter::convertDouble( sStringBuffer, dStartAngle );
948cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() );
949cdf0e10cSrcweir 
950cdf0e10cSrcweir 			// export end angle
951cdf0e10cSrcweir 			SvXMLUnitConverter::convertDouble( sStringBuffer, dEndAngle );
952cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() );
953cdf0e10cSrcweir 		}
954cdf0e10cSrcweir 
955cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
956cdf0e10cSrcweir 
957cdf0e10cSrcweir 		if(bCircle)
958cdf0e10cSrcweir 		{
959cdf0e10cSrcweir 			// write circle
960cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True);
961cdf0e10cSrcweir 
962cdf0e10cSrcweir 			ImpExportDescription( xShape ); // #i68101#
963cdf0e10cSrcweir 			ImpExportEvents( xShape );
964cdf0e10cSrcweir 			ImpExportGluePoints( xShape );
965cdf0e10cSrcweir 			ImpExportText( xShape );
966cdf0e10cSrcweir 		}
967cdf0e10cSrcweir 		else
968cdf0e10cSrcweir 		{
969cdf0e10cSrcweir 			// write ellipse
970cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True);
971cdf0e10cSrcweir 
972cdf0e10cSrcweir 			ImpExportDescription( xShape ); // #i68101#
973cdf0e10cSrcweir 			ImpExportEvents( xShape );
974cdf0e10cSrcweir 			ImpExportGluePoints( xShape );
975cdf0e10cSrcweir 			ImpExportText( xShape );
976cdf0e10cSrcweir 		}
977cdf0e10cSrcweir 	}
978cdf0e10cSrcweir }
979cdf0e10cSrcweir 
980cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
981cdf0e10cSrcweir 
982cdf0e10cSrcweir void XMLShapeExport::ImpExportPolygonShape(
983cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
984cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
985cdf0e10cSrcweir {
986cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
987cdf0e10cSrcweir 	if(xPropSet.is())
988cdf0e10cSrcweir 	{
989cdf0e10cSrcweir 		sal_Bool bClosed(eShapeType == XmlShapeTypeDrawPolyPolygonShape
990cdf0e10cSrcweir 			|| eShapeType == XmlShapeTypeDrawClosedBezierShape);
991cdf0e10cSrcweir 		sal_Bool bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
992cdf0e10cSrcweir 			|| eShapeType == XmlShapeTypeDrawOpenBezierShape);
993cdf0e10cSrcweir 
994cdf0e10cSrcweir 		// get matrix
995cdf0e10cSrcweir 		::basegfx::B2DHomMatrix aMatrix;
996cdf0e10cSrcweir 		ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
997cdf0e10cSrcweir 
998cdf0e10cSrcweir 		// decompose and correct abour pRefPoint
999cdf0e10cSrcweir 		::basegfx::B2DTuple aTRScale;
1000cdf0e10cSrcweir 		double fTRShear(0.0);
1001cdf0e10cSrcweir 		double fTRRotate(0.0);
1002cdf0e10cSrcweir 		::basegfx::B2DTuple aTRTranslate;
1003cdf0e10cSrcweir 		ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir 		// use features and write
1006cdf0e10cSrcweir 		ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
1007cdf0e10cSrcweir 
1008cdf0e10cSrcweir 		// create and export ViewBox
1009cdf0e10cSrcweir 		awt::Point aPoint(0, 0);
1010cdf0e10cSrcweir 		awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
1011cdf0e10cSrcweir 		SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
1012cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
1013cdf0e10cSrcweir 
1014cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1015cdf0e10cSrcweir 
1016*1f882ec4SArmin Le Grand         if(bBezier)
1017*1f882ec4SArmin Le Grand         {
1018*1f882ec4SArmin Le Grand             // get PolygonBezier
1019*1f882ec4SArmin Le Grand             uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
1020*1f882ec4SArmin Le Grand             const basegfx::B2DPolyPolygon aPolyPolygon(
1021*1f882ec4SArmin Le Grand                 basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*(drawing::PolyPolygonBezierCoords*)aAny.getValue()));
1022cdf0e10cSrcweir 
1023*1f882ec4SArmin Le Grand             if(aPolyPolygon.count())
1024*1f882ec4SArmin Le Grand             {
1025*1f882ec4SArmin Le Grand                 // complex polygon shape, write as svg:d
1026*1f882ec4SArmin Le Grand                 const ::rtl::OUString aPolygonString(
1027*1f882ec4SArmin Le Grand                     basegfx::tools::exportToSvgD(
1028*1f882ec4SArmin Le Grand                         aPolyPolygon,
1029*1f882ec4SArmin Le Grand                         true,       // bUseRelativeCoordinates
1030*1f882ec4SArmin Le Grand                         false,      // bDetectQuadraticBeziers: not used in old, but maybe activated now
1031*1f882ec4SArmin Le Grand                         true));     // bHandleRelativeNextPointCompatible
1032*1f882ec4SArmin Le Grand 
1033*1f882ec4SArmin Le Grand                 // write point array
1034*1f882ec4SArmin Le Grand                 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
1035*1f882ec4SArmin Le Grand 
1036*1f882ec4SArmin Le Grand                 // write object now
1037*1f882ec4SArmin Le Grand                 SvXMLElementExport aOBJ(
1038*1f882ec4SArmin Le Grand                     mrExport,
1039*1f882ec4SArmin Le Grand                     XML_NAMESPACE_DRAW,
1040*1f882ec4SArmin Le Grand                     XML_PATH,
1041*1f882ec4SArmin Le Grand                     bCreateNewline,
1042*1f882ec4SArmin Le Grand                     sal_True);
1043*1f882ec4SArmin Le Grand             }
1044*1f882ec4SArmin Le Grand         }
1045*1f882ec4SArmin Le Grand         else
1046*1f882ec4SArmin Le Grand         {
1047*1f882ec4SArmin Le Grand             // get non-bezier polygon
1048*1f882ec4SArmin Le Grand             uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
1049*1f882ec4SArmin Le Grand             const basegfx::B2DPolyPolygon aPolyPolygon(
1050*1f882ec4SArmin Le Grand                 basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*(drawing::PointSequenceSequence*)aAny.getValue()));
1051cdf0e10cSrcweir 
1052*1f882ec4SArmin Le Grand             if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
1053*1f882ec4SArmin Le Grand             {
1054*1f882ec4SArmin Le Grand                 // simple polygon shape, can be written as svg:points sequence
1055*1f882ec4SArmin Le Grand                 const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
1056*1f882ec4SArmin Le Grand                 const ::rtl::OUString aPointString(basegfx::tools::exportToSvgPoints(aPolygon));
1057*1f882ec4SArmin Le Grand 
1058*1f882ec4SArmin Le Grand                 // write point array
1059*1f882ec4SArmin Le Grand                 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
1060*1f882ec4SArmin Le Grand 
1061*1f882ec4SArmin Le Grand                 // write object now
1062*1f882ec4SArmin Le Grand                 SvXMLElementExport aOBJ(
1063*1f882ec4SArmin Le Grand                     mrExport,
1064*1f882ec4SArmin Le Grand                     XML_NAMESPACE_DRAW,
1065*1f882ec4SArmin Le Grand                     aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE,
1066*1f882ec4SArmin Le Grand                     bCreateNewline,
1067*1f882ec4SArmin Le Grand                     sal_True);
1068*1f882ec4SArmin Le Grand             }
1069*1f882ec4SArmin Le Grand             else
1070*1f882ec4SArmin Le Grand             {
1071*1f882ec4SArmin Le Grand                 // complex polygon shape, write as svg:d
1072*1f882ec4SArmin Le Grand                 const ::rtl::OUString aPolygonString(
1073*1f882ec4SArmin Le Grand                     basegfx::tools::exportToSvgD(
1074*1f882ec4SArmin Le Grand                         aPolyPolygon,
1075*1f882ec4SArmin Le Grand                         true,       // bUseRelativeCoordinates
1076*1f882ec4SArmin Le Grand                         false,      // bDetectQuadraticBeziers: not used in old, but maybe activated now
1077*1f882ec4SArmin Le Grand                         true));     // bHandleRelativeNextPointCompatible
1078*1f882ec4SArmin Le Grand 
1079*1f882ec4SArmin Le Grand                 // write point array
1080*1f882ec4SArmin Le Grand                 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
1081*1f882ec4SArmin Le Grand 
1082*1f882ec4SArmin Le Grand                 // write object now
1083*1f882ec4SArmin Le Grand                 SvXMLElementExport aOBJ(
1084*1f882ec4SArmin Le Grand                     mrExport,
1085*1f882ec4SArmin Le Grand                     XML_NAMESPACE_DRAW,
1086*1f882ec4SArmin Le Grand                     XML_PATH,
1087*1f882ec4SArmin Le Grand                     bCreateNewline,
1088*1f882ec4SArmin Le Grand                     sal_True);
1089*1f882ec4SArmin Le Grand             }
1090*1f882ec4SArmin Le Grand         }
1091cdf0e10cSrcweir 
1092*1f882ec4SArmin Le Grand         ImpExportDescription( xShape ); // #i68101#
1093*1f882ec4SArmin Le Grand         ImpExportEvents( xShape );
1094*1f882ec4SArmin Le Grand         ImpExportGluePoints( xShape );
1095*1f882ec4SArmin Le Grand         ImpExportText( xShape );
1096*1f882ec4SArmin Le Grand     }
1097cdf0e10cSrcweir }
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1100cdf0e10cSrcweir 
1101cdf0e10cSrcweir void XMLShapeExport::ImpExportGraphicObjectShape(
1102cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1103cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
1104cdf0e10cSrcweir {
1105cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1106cdf0e10cSrcweir 	if(xPropSet.is())
1107cdf0e10cSrcweir 	{
1108cdf0e10cSrcweir 		sal_Bool bIsEmptyPresObj = sal_False;
1109cdf0e10cSrcweir 		uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir 		// Transformation
1112cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1113cdf0e10cSrcweir 
1114cdf0e10cSrcweir 		OUString sImageURL;
1115cdf0e10cSrcweir 
1116cdf0e10cSrcweir 		if(eShapeType == XmlShapeTypePresGraphicObjectShape)
1117cdf0e10cSrcweir 			bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) );
1118cdf0e10cSrcweir 
1119cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1120cdf0e10cSrcweir 		SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
1121cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1122cdf0e10cSrcweir 
1123cdf0e10cSrcweir 		const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
1124cdf0e10cSrcweir 
1125cdf0e10cSrcweir 		if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
1126cdf0e10cSrcweir 		{
1127cdf0e10cSrcweir 			if( !bIsEmptyPresObj )
1128cdf0e10cSrcweir 			{
1129ddde725dSArmin Le Grand                 OUString aReplacementUrl;
1130ddde725dSArmin Le Grand                 xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("ReplacementGraphicURL"))) >>= aReplacementUrl;
1131ddde725dSArmin Le Grand 
1132ddde725dSArmin Le Grand                 // If there is no url, then then graphic is empty
1133ddde725dSArmin Le Grand                 if(aReplacementUrl.getLength())
1134ddde725dSArmin Le Grand                 {
1135ddde725dSArmin Le Grand                     const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl);
1136ddde725dSArmin Le Grand 
1137ddde725dSArmin Le Grand                     if(aStr.getLength())
1138ddde725dSArmin Le Grand                     {
1139ddde725dSArmin Le Grand                         mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr);
1140ddde725dSArmin Le Grand                         mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1141ddde725dSArmin Le Grand                         mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1142ddde725dSArmin Le Grand                         mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1143ddde725dSArmin Le Grand 
1144ddde725dSArmin Le Grand                         // xlink:href for replacement, only written for Svg content
1145ddde725dSArmin Le Grand                         SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True);
1146ddde725dSArmin Le Grand 
1147ddde725dSArmin Le Grand                         // optional office:binary-data
1148ddde725dSArmin Le Grand                         mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl);
1149ddde725dSArmin Le Grand                     }
1150ddde725dSArmin Le Grand                 }
1151ddde725dSArmin Le Grand 
1152ddde725dSArmin Le Grand                 OUString aStreamURL;
1153cdf0e10cSrcweir 				OUString aStr;
1154cdf0e10cSrcweir 
1155cdf0e10cSrcweir 				xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL"))) >>= aStreamURL;
1156cdf0e10cSrcweir 				xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))) >>= sImageURL;
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir 				OUString aResolveURL( sImageURL );
1159cdf0e10cSrcweir 				const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") );
1160cdf0e10cSrcweir 
1161cdf0e10cSrcweir 					// sj: trying to preserve the filename
1162cdf0e10cSrcweir 				if ( aStreamURL.match( sPackageURL, 0 ) )
1163cdf0e10cSrcweir 				{
1164cdf0e10cSrcweir 					rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
1165cdf0e10cSrcweir 					sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
1166cdf0e10cSrcweir 					if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
1167cdf0e10cSrcweir 						sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex );
1168cdf0e10cSrcweir 					nLastIndex = sRequestedName.lastIndexOf( '.' );
1169cdf0e10cSrcweir 					if ( nLastIndex >= 0 )
1170cdf0e10cSrcweir 						sRequestedName = sRequestedName.copy( 0, nLastIndex );
1171cdf0e10cSrcweir 					if ( sRequestedName.getLength() )
1172cdf0e10cSrcweir 					{
1173cdf0e10cSrcweir 						aResolveURL = aResolveURL.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("?requestedName=")));
1174cdf0e10cSrcweir 						aResolveURL = aResolveURL.concat( sRequestedName );
1175cdf0e10cSrcweir 					}
1176cdf0e10cSrcweir 				}
1177cdf0e10cSrcweir 
1178cdf0e10cSrcweir 				aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
1179cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
1180cdf0e10cSrcweir 
1181cdf0e10cSrcweir 				if( aStr.getLength() )
1182cdf0e10cSrcweir 				{
1183cdf0e10cSrcweir 					if( aStr[ 0 ] == '#' )
1184cdf0e10cSrcweir 					{
1185ddde725dSArmin Le Grand 						aStreamURL = sPackageURL;
1186cdf0e10cSrcweir 						aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) );
1187cdf0e10cSrcweir 					}
1188cdf0e10cSrcweir 
1189cdf0e10cSrcweir 					// update stream URL for load on demand
1190cdf0e10cSrcweir 					uno::Any aAny;
1191cdf0e10cSrcweir 					aAny <<= aStreamURL;
1192cdf0e10cSrcweir 					xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL")), aAny );
1193cdf0e10cSrcweir 
1194cdf0e10cSrcweir 					mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1195cdf0e10cSrcweir 					mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1196cdf0e10cSrcweir 					mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1197cdf0e10cSrcweir 				}
1198cdf0e10cSrcweir 			}
1199cdf0e10cSrcweir 			else
1200cdf0e10cSrcweir 			{
1201cdf0e10cSrcweir 				OUString aStr;
1202cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr );
1203cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1204cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1205cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1206cdf0e10cSrcweir 			}
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir 			{
1209cdf0e10cSrcweir 				SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True);
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir 				if( sImageURL.getLength() )
1212cdf0e10cSrcweir 				{
1213cdf0e10cSrcweir 					// optional office:binary-data
1214cdf0e10cSrcweir 					mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL );
1215cdf0e10cSrcweir 				}
1216cdf0e10cSrcweir 				if( !bIsEmptyPresObj )
1217cdf0e10cSrcweir 					ImpExportText( xShape );
1218cdf0e10cSrcweir 			}
1219cdf0e10cSrcweir 		}
1220cdf0e10cSrcweir 
1221cdf0e10cSrcweir 		ImpExportEvents( xShape );
1222cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
1223cdf0e10cSrcweir 
1224cdf0e10cSrcweir 		// image map
1225cdf0e10cSrcweir 		GetExport().GetImageMapExport().Export( xPropSet );
1226cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
1227cdf0e10cSrcweir 	}
1228cdf0e10cSrcweir }
1229cdf0e10cSrcweir 
1230cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir void XMLShapeExport::ImpExportChartShape(
1233cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1234cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint,
1235cdf0e10cSrcweir     SvXMLAttributeList* pAttrList )
1236cdf0e10cSrcweir {
1237cdf0e10cSrcweir 	ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList );
1238cdf0e10cSrcweir }
1239cdf0e10cSrcweir 
1240cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1241cdf0e10cSrcweir 
1242cdf0e10cSrcweir void XMLShapeExport::ImpExportControlShape(
1243cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1244cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
1245cdf0e10cSrcweir {
1246cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1247cdf0e10cSrcweir 	if(xPropSet.is())
1248cdf0e10cSrcweir 	{
1249cdf0e10cSrcweir 		// Transformation
1250cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1251cdf0e10cSrcweir 	}
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir 	uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY );
1254cdf0e10cSrcweir 	DBG_ASSERT( xControl.is(), "Control shape is not supporting XControlShape" );
1255cdf0e10cSrcweir 	if( xControl.is() )
1256cdf0e10cSrcweir 	{
1257cdf0e10cSrcweir 		uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
1258cdf0e10cSrcweir 		DBG_ASSERT( xControlModel.is(), "Control shape has not XControlModel" );
1259cdf0e10cSrcweir 		if( xControlModel.is() )
1260cdf0e10cSrcweir 		{
1261cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONTROL, mrExport.GetFormExport()->getControlId( xControlModel ) );
1262cdf0e10cSrcweir 		}
1263cdf0e10cSrcweir 	}
1264cdf0e10cSrcweir 
1265cdf0e10cSrcweir 	sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1266cdf0e10cSrcweir 	SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONTROL, bCreateNewline, sal_True);
1267cdf0e10cSrcweir 
1268cdf0e10cSrcweir 	ImpExportDescription( xShape ); // #i68101#
1269cdf0e10cSrcweir }
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1272cdf0e10cSrcweir 
1273cdf0e10cSrcweir void XMLShapeExport::ImpExportConnectorShape(
1274cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1275cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
1278cdf0e10cSrcweir 
1279cdf0e10cSrcweir 	OUString aStr;
1280cdf0e10cSrcweir 	OUStringBuffer sStringBuffer;
1281cdf0e10cSrcweir 
1282cdf0e10cSrcweir 	// export connection kind
1283cdf0e10cSrcweir 	drawing::ConnectorType eType = drawing::ConnectorType_STANDARD;
1284cdf0e10cSrcweir 	uno::Any aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")));
1285cdf0e10cSrcweir 	aAny >>= eType;
1286cdf0e10cSrcweir 
1287cdf0e10cSrcweir 	if( eType != drawing::ConnectorType_STANDARD )
1288cdf0e10cSrcweir 	{
1289cdf0e10cSrcweir 		SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eType, aXML_ConnectionKind_EnumMap );
1290cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1291cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TYPE, aStr);
1292cdf0e10cSrcweir 	}
1293cdf0e10cSrcweir 
1294cdf0e10cSrcweir 	// export line skew
1295cdf0e10cSrcweir 	sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0;
1296cdf0e10cSrcweir 
1297cdf0e10cSrcweir 	aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")));
1298cdf0e10cSrcweir 	aAny >>= nDelta1;
1299cdf0e10cSrcweir 	aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")));
1300cdf0e10cSrcweir 	aAny >>= nDelta2;
1301cdf0e10cSrcweir 	aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")));
1302cdf0e10cSrcweir 	aAny >>= nDelta3;
1303cdf0e10cSrcweir 
1304cdf0e10cSrcweir 	if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 )
1305cdf0e10cSrcweir 	{
1306cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta1);
1307cdf0e10cSrcweir 		if( nDelta2 != 0 || nDelta3 != 0 )
1308cdf0e10cSrcweir 		{
1309cdf0e10cSrcweir 			const char aSpace = ' ';
1310cdf0e10cSrcweir 			sStringBuffer.appendAscii( &aSpace, 1 );
1311cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta2);
1312cdf0e10cSrcweir 			if( nDelta3 != 0 )
1313cdf0e10cSrcweir 			{
1314cdf0e10cSrcweir 				sStringBuffer.appendAscii( &aSpace, 1 );
1315cdf0e10cSrcweir 				mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta3);
1316cdf0e10cSrcweir 			}
1317cdf0e10cSrcweir 		}
1318cdf0e10cSrcweir 
1319cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1320cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LINE_SKEW, aStr);
1321cdf0e10cSrcweir 	}
1322cdf0e10cSrcweir 
1323cdf0e10cSrcweir 	// export start and end point
1324cdf0e10cSrcweir 	awt::Point aStart(0,0);
1325cdf0e10cSrcweir 	awt::Point aEnd(1,1);
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir     // --> OD 2004-08-09 #i36248# - Get <StartPositionInHoriL2R> and
1328cdf0e10cSrcweir     // <EndPositionInHoriL2R>, if they exist and if the document is exported
1329cdf0e10cSrcweir     // into the OpenOffice.org file format.
1330cdf0e10cSrcweir     // These properties only exist at service com::sun::star::text::Shape - the
1331cdf0e10cSrcweir     // Writer UNO service for shapes.
1332cdf0e10cSrcweir     // This code is needed, because the positioning attributes in the
1333cdf0e10cSrcweir     // OpenOffice.org file format are given in horizontal left-to-right layout
1334cdf0e10cSrcweir     // regardless the layout direction the shape is in. In the OASIS Open Office
1335cdf0e10cSrcweir     // file format the positioning attributes are correctly given in the layout
1336cdf0e10cSrcweir     // direction the shape is in. Thus, this code provides the conversion from
1337cdf0e10cSrcweir     // the OASIS Open Office file format to the OpenOffice.org file format.
1338cdf0e10cSrcweir     if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
1339cdf0e10cSrcweir          xProps->getPropertySetInfo()->hasPropertyByName(
1340cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) &&
1341cdf0e10cSrcweir          xProps->getPropertySetInfo()->hasPropertyByName(
1342cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) )
1343cdf0e10cSrcweir     {
1344cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart;
1345cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd;
1346cdf0e10cSrcweir     }
1347cdf0e10cSrcweir     else
1348cdf0e10cSrcweir     {
1349cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart;
1350cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd;
1351cdf0e10cSrcweir     }
1352cdf0e10cSrcweir     // <--
1353cdf0e10cSrcweir 
1354cdf0e10cSrcweir 	if( pRefPoint )
1355cdf0e10cSrcweir 	{
1356cdf0e10cSrcweir 		aStart.X -= pRefPoint->X;
1357cdf0e10cSrcweir 		aStart.Y -= pRefPoint->Y;
1358cdf0e10cSrcweir 		aEnd.X -= pRefPoint->X;
1359cdf0e10cSrcweir 		aEnd.Y -= pRefPoint->Y;
1360cdf0e10cSrcweir 	}
1361cdf0e10cSrcweir 
1362cdf0e10cSrcweir 	if( nFeatures & SEF_EXPORT_X )
1363cdf0e10cSrcweir 	{
1364cdf0e10cSrcweir 		// svg: x1
1365cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
1366cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1367cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
1368cdf0e10cSrcweir 	}
1369cdf0e10cSrcweir 	else
1370cdf0e10cSrcweir 	{
1371cdf0e10cSrcweir 		aEnd.X -= aStart.X;
1372cdf0e10cSrcweir 	}
1373cdf0e10cSrcweir 
1374cdf0e10cSrcweir 	if( nFeatures & SEF_EXPORT_Y )
1375cdf0e10cSrcweir 	{
1376cdf0e10cSrcweir 		// svg: y1
1377cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
1378cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1379cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
1380cdf0e10cSrcweir 	}
1381cdf0e10cSrcweir 	else
1382cdf0e10cSrcweir 	{
1383cdf0e10cSrcweir 		aEnd.Y -= aStart.Y;
1384cdf0e10cSrcweir 	}
1385cdf0e10cSrcweir 
1386cdf0e10cSrcweir 	// svg: x2
1387cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
1388cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
1389cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
1390cdf0e10cSrcweir 
1391cdf0e10cSrcweir 	// svg: y2
1392cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
1393cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
1394cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
1395cdf0e10cSrcweir 
1396cdf0e10cSrcweir 	// #i39320#
1397cdf0e10cSrcweir 	uno::Reference< uno::XInterface > xRefS;
1398cdf0e10cSrcweir 	uno::Reference< uno::XInterface > xRefE;
1399cdf0e10cSrcweir 
1400cdf0e10cSrcweir 	// export start connection
1401cdf0e10cSrcweir 	xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartShape") ) ) >>= xRefS;
1402cdf0e10cSrcweir 	if( xRefS.is() )
1403cdf0e10cSrcweir 	{
1404cdf0e10cSrcweir 		const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefS );
1405cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_SHAPE, rShapeId);
1406cdf0e10cSrcweir 
1407cdf0e10cSrcweir 		aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")) );
1408cdf0e10cSrcweir 		sal_Int32 nGluePointId = 0;
1409cdf0e10cSrcweir 		if( aAny >>= nGluePointId )
1410cdf0e10cSrcweir 		{
1411cdf0e10cSrcweir 			if( nGluePointId != -1 )
1412cdf0e10cSrcweir 			{
1413cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_GLUE_POINT, OUString::valueOf( nGluePointId ));
1414cdf0e10cSrcweir 			}
1415cdf0e10cSrcweir 		}
1416cdf0e10cSrcweir 	}
1417cdf0e10cSrcweir 
1418cdf0e10cSrcweir 	// export end connection
1419cdf0e10cSrcweir 	xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndShape")) ) >>= xRefE;
1420cdf0e10cSrcweir 	if( xRefE.is() )
1421cdf0e10cSrcweir 	{
1422cdf0e10cSrcweir 		const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefE );
1423cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_SHAPE, rShapeId);
1424cdf0e10cSrcweir 
1425cdf0e10cSrcweir 		aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")) );
1426cdf0e10cSrcweir 		sal_Int32 nGluePointId = 0;
1427cdf0e10cSrcweir 		if( aAny >>= nGluePointId )
1428cdf0e10cSrcweir 		{
1429cdf0e10cSrcweir 			if( nGluePointId != -1 )
1430cdf0e10cSrcweir 			{
1431cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_GLUE_POINT, OUString::valueOf( nGluePointId ));
1432cdf0e10cSrcweir 			}
1433cdf0e10cSrcweir 		}
1434cdf0e10cSrcweir 	}
1435cdf0e10cSrcweir 
1436*1f882ec4SArmin Le Grand     if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny )
1437*1f882ec4SArmin Le Grand     {
1438*1f882ec4SArmin Le Grand         // get PolygonBezier
1439*1f882ec4SArmin Le Grand         drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = (drawing::PolyPolygonBezierCoords*)aAny.getValue();
1440cdf0e10cSrcweir 
1441*1f882ec4SArmin Le Grand         if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
1442*1f882ec4SArmin Le Grand         {
1443*1f882ec4SArmin Le Grand             const basegfx::B2DPolyPolygon aPolyPolygon(
1444*1f882ec4SArmin Le Grand                 basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
1445*1f882ec4SArmin Le Grand                     *pSourcePolyPolygon));
1446*1f882ec4SArmin Le Grand             const ::rtl::OUString aPolygonString(
1447*1f882ec4SArmin Le Grand                 basegfx::tools::exportToSvgD(
1448*1f882ec4SArmin Le Grand                     aPolyPolygon,
1449*1f882ec4SArmin Le Grand                     true,           // bUseRelativeCoordinates
1450*1f882ec4SArmin Le Grand                     false,          // bDetectQuadraticBeziers: not used in old, but maybe activated now
1451*1f882ec4SArmin Le Grand                     true));         // bHandleRelativeNextPointCompatible
1452*1f882ec4SArmin Le Grand         }
1453*1f882ec4SArmin Le Grand     }
1454cdf0e10cSrcweir 
1455cdf0e10cSrcweir 	// write connector shape. Add Export later.
1456cdf0e10cSrcweir 	sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1457cdf0e10cSrcweir 	SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONNECTOR, bCreateNewline, sal_True);
1458cdf0e10cSrcweir 
1459cdf0e10cSrcweir 	ImpExportDescription( xShape ); // #i68101#
1460cdf0e10cSrcweir 	ImpExportEvents( xShape );
1461cdf0e10cSrcweir 	ImpExportGluePoints( xShape );
1462cdf0e10cSrcweir 	ImpExportText( xShape );
1463cdf0e10cSrcweir }
1464cdf0e10cSrcweir 
1465cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1466cdf0e10cSrcweir 
1467cdf0e10cSrcweir void XMLShapeExport::ImpExportMeasureShape(
1468cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1469cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1470cdf0e10cSrcweir {
1471cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
1472cdf0e10cSrcweir 
1473cdf0e10cSrcweir 	OUString aStr;
1474cdf0e10cSrcweir 	OUStringBuffer sStringBuffer;
1475cdf0e10cSrcweir 
1476cdf0e10cSrcweir 	// export start and end point
1477cdf0e10cSrcweir 	awt::Point aStart(0,0);
1478cdf0e10cSrcweir 	awt::Point aEnd(1,1);
1479cdf0e10cSrcweir 
1480cdf0e10cSrcweir     // --> OD 2004-08-09 #i36248# - Get <StartPositionInHoriL2R> and
1481cdf0e10cSrcweir     // <EndPositionInHoriL2R>, if they exist and if the document is exported
1482cdf0e10cSrcweir     // into the OpenOffice.org file format.
1483cdf0e10cSrcweir     // These properties only exist at service com::sun::star::text::Shape - the
1484cdf0e10cSrcweir     // Writer UNO service for shapes.
1485cdf0e10cSrcweir     // This code is needed, because the positioning attributes in the
1486cdf0e10cSrcweir     // OpenOffice.org file format are given in horizontal left-to-right layout
1487cdf0e10cSrcweir     // regardless the layout direction the shape is in. In the OASIS Open Office
1488cdf0e10cSrcweir     // file format the positioning attributes are correctly given in the layout
1489cdf0e10cSrcweir     // direction the shape is in. Thus, this code provides the conversion from
1490cdf0e10cSrcweir     // the OASIS Open Office file format to the OpenOffice.org file format.
1491cdf0e10cSrcweir     if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
1492cdf0e10cSrcweir          xProps->getPropertySetInfo()->hasPropertyByName(
1493cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) &&
1494cdf0e10cSrcweir          xProps->getPropertySetInfo()->hasPropertyByName(
1495cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) )
1496cdf0e10cSrcweir     {
1497cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart;
1498cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd;
1499cdf0e10cSrcweir     }
1500cdf0e10cSrcweir     else
1501cdf0e10cSrcweir     {
1502cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart;
1503cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd;
1504cdf0e10cSrcweir     }
1505cdf0e10cSrcweir     // <--
1506cdf0e10cSrcweir 
1507cdf0e10cSrcweir 	if( pRefPoint )
1508cdf0e10cSrcweir 	{
1509cdf0e10cSrcweir 		aStart.X -= pRefPoint->X;
1510cdf0e10cSrcweir 		aStart.Y -= pRefPoint->Y;
1511cdf0e10cSrcweir 		aEnd.X -= pRefPoint->X;
1512cdf0e10cSrcweir 		aEnd.Y -= pRefPoint->Y;
1513cdf0e10cSrcweir 	}
1514cdf0e10cSrcweir 
1515cdf0e10cSrcweir 	if( nFeatures & SEF_EXPORT_X )
1516cdf0e10cSrcweir 	{
1517cdf0e10cSrcweir 		// svg: x1
1518cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
1519cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1520cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
1521cdf0e10cSrcweir 	}
1522cdf0e10cSrcweir 	else
1523cdf0e10cSrcweir 	{
1524cdf0e10cSrcweir 		aEnd.X -= aStart.X;
1525cdf0e10cSrcweir 	}
1526cdf0e10cSrcweir 
1527cdf0e10cSrcweir 	if( nFeatures & SEF_EXPORT_Y )
1528cdf0e10cSrcweir 	{
1529cdf0e10cSrcweir 		// svg: y1
1530cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
1531cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1532cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
1533cdf0e10cSrcweir 	}
1534cdf0e10cSrcweir 	else
1535cdf0e10cSrcweir 	{
1536cdf0e10cSrcweir 		aEnd.Y -= aStart.Y;
1537cdf0e10cSrcweir 	}
1538cdf0e10cSrcweir 
1539cdf0e10cSrcweir 	// svg: x2
1540cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
1541cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
1542cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
1543cdf0e10cSrcweir 
1544cdf0e10cSrcweir 	// svg: y2
1545cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
1546cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
1547cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
1548cdf0e10cSrcweir 
1549cdf0e10cSrcweir 	// write measure shape
1550cdf0e10cSrcweir 	sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1551cdf0e10cSrcweir 	SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_MEASURE, bCreateNewline, sal_True);
1552cdf0e10cSrcweir 
1553cdf0e10cSrcweir 	ImpExportDescription( xShape ); // #i68101#
1554cdf0e10cSrcweir 	ImpExportEvents( xShape );
1555cdf0e10cSrcweir 	ImpExportGluePoints( xShape );
1556cdf0e10cSrcweir 
1557cdf0e10cSrcweir 	uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
1558cdf0e10cSrcweir 	if( xText.is() )
1559cdf0e10cSrcweir 		mrExport.GetTextParagraphExport()->exportText( xText );
1560cdf0e10cSrcweir }
1561cdf0e10cSrcweir 
1562cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1563cdf0e10cSrcweir 
1564cdf0e10cSrcweir void XMLShapeExport::ImpExportOLE2Shape(
1565cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1566cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */,
1567cdf0e10cSrcweir     SvXMLAttributeList* pAttrList /* = NULL */ )
1568cdf0e10cSrcweir {
1569cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1570cdf0e10cSrcweir 	uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
1571cdf0e10cSrcweir 
1572cdf0e10cSrcweir 	DBG_ASSERT( xPropSet.is() && xNamed.is(), "ole shape is not implementing needed interfaces");
1573cdf0e10cSrcweir 	if(xPropSet.is() && xNamed.is())
1574cdf0e10cSrcweir 	{
1575cdf0e10cSrcweir 		// Transformation
1576cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1577cdf0e10cSrcweir 
1578cdf0e10cSrcweir 		sal_Bool bIsEmptyPresObj = sal_False;
1579cdf0e10cSrcweir 
1580cdf0e10cSrcweir 		// presentation settings
1581cdf0e10cSrcweir 		if(eShapeType == XmlShapeTypePresOLE2Shape)
1582cdf0e10cSrcweir 			bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
1583cdf0e10cSrcweir 		else if(eShapeType == XmlShapeTypePresChartShape)
1584cdf0e10cSrcweir 			bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) );
1585cdf0e10cSrcweir 		else if(eShapeType == XmlShapeTypePresSheetShape)
1586cdf0e10cSrcweir 			bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
1587cdf0e10cSrcweir 
1588cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1589cdf0e10cSrcweir 		sal_Bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
1590cdf0e10cSrcweir 		OUString sPersistName;
1591cdf0e10cSrcweir 		SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1592cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1593cdf0e10cSrcweir 
1594cdf0e10cSrcweir 		const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
1595cdf0e10cSrcweir 
1596cdf0e10cSrcweir 		if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
1597cdf0e10cSrcweir 		{
1598cdf0e10cSrcweir             if (pAttrList)
1599cdf0e10cSrcweir             {
1600cdf0e10cSrcweir                 mrExport.AddAttributeList(pAttrList);
1601cdf0e10cSrcweir             }
1602cdf0e10cSrcweir 
1603cdf0e10cSrcweir 			OUString sClassId;
1604cdf0e10cSrcweir 			OUString sURL;
1605cdf0e10cSrcweir 			sal_Bool bInternal = false;
1606cdf0e10cSrcweir 			xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsInternal"))) >>= bInternal;
1607cdf0e10cSrcweir 
1608cdf0e10cSrcweir 			if( !bIsEmptyPresObj )
1609cdf0e10cSrcweir 			{
1610cdf0e10cSrcweir 
1611cdf0e10cSrcweir 				if ( bInternal )
1612cdf0e10cSrcweir 				{
1613cdf0e10cSrcweir 					// OOo internal links have no storage persistance, URL is stored in the XML file
1614cdf0e10cSrcweir 					// the result LinkURL is empty in case the object is not a link
1615cdf0e10cSrcweir 					xPropSet->getPropertyValue( OUString::createFromAscii( "LinkURL" ) ) >>= sURL;
1616cdf0e10cSrcweir 				}
1617cdf0e10cSrcweir 
1618cdf0e10cSrcweir 				xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ) ) >>= sPersistName;
1619cdf0e10cSrcweir 				if ( !sURL.getLength() )
1620cdf0e10cSrcweir 				{
1621cdf0e10cSrcweir 					if( sPersistName.getLength() )
1622cdf0e10cSrcweir 					{
1623cdf0e10cSrcweir 						sURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) );
1624cdf0e10cSrcweir 						sURL += sPersistName;
1625cdf0e10cSrcweir 					}
1626cdf0e10cSrcweir 				}
1627cdf0e10cSrcweir 
1628cdf0e10cSrcweir 				if( !bInternal )
1629cdf0e10cSrcweir 					xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sClassId;
1630cdf0e10cSrcweir 
1631cdf0e10cSrcweir 				if( sClassId.getLength() )
1632cdf0e10cSrcweir 					mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CLASS_ID, sClassId );
1633cdf0e10cSrcweir 				if(!bExportEmbedded)
1634cdf0e10cSrcweir 				{
1635cdf0e10cSrcweir 					// xlink:href
1636cdf0e10cSrcweir 					if( sURL.getLength() )
1637cdf0e10cSrcweir 					{
1638cdf0e10cSrcweir 						// #96717# in theorie, if we don't have a url we shouldn't even
1639cdf0e10cSrcweir 						// export this ole shape. But practical its to risky right now
1640cdf0e10cSrcweir 						// to change this so we better dispose this on load
1641cdf0e10cSrcweir 						sURL = mrExport.AddEmbeddedObject( sURL );
1642cdf0e10cSrcweir 
1643cdf0e10cSrcweir 						mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
1644cdf0e10cSrcweir 						mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1645cdf0e10cSrcweir 						mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1646cdf0e10cSrcweir 						mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1647cdf0e10cSrcweir 					}
1648cdf0e10cSrcweir 				}
1649cdf0e10cSrcweir 			}
1650cdf0e10cSrcweir 			else
1651cdf0e10cSrcweir 			{
1652cdf0e10cSrcweir 				// export empty href for empty placeholders to be valid odf
1653cdf0e10cSrcweir 				OUString sEmptyURL;
1654cdf0e10cSrcweir 
1655cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sEmptyURL );
1656cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1657cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1658cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1659cdf0e10cSrcweir 			}
1660cdf0e10cSrcweir 
1661cdf0e10cSrcweir 			enum XMLTokenEnum eElem = sClassId.getLength() ? XML_OBJECT_OLE : XML_OBJECT;
1662cdf0e10cSrcweir 			SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, sal_True, sal_True );
1663cdf0e10cSrcweir 
1664a5258243SPedro Giffuni             // #i118485# Add text export, the draw OLE shape allows text now
1665a5258243SPedro Giffuni             ImpExportText( xShape );
1666a5258243SPedro Giffuni 
1667cdf0e10cSrcweir 			if(bExportEmbedded && !bIsEmptyPresObj)
1668cdf0e10cSrcweir 			{
1669cdf0e10cSrcweir 				// #100592#
1670cdf0e10cSrcweir 				if(bInternal)
1671cdf0e10cSrcweir 				{
1672cdf0e10cSrcweir 					// embedded XML
1673cdf0e10cSrcweir 					uno::Reference< lang::XComponent > xComp;
1674cdf0e10cSrcweir 					xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xComp;
1675cdf0e10cSrcweir 					DBG_ASSERT( xComp.is(), "no xModel for own OLE format" );
1676cdf0e10cSrcweir 					mrExport.ExportEmbeddedOwnObject( xComp );
1677cdf0e10cSrcweir 				}
1678cdf0e10cSrcweir 				else
1679cdf0e10cSrcweir 				{
1680cdf0e10cSrcweir 					// embed as Base64
1681cdf0e10cSrcweir 					// this is an alien object ( currently MSOLE is the only supported type of such objects )
1682cdf0e10cSrcweir 					// in case it is not an OASIS format the object should be asked to store replacement image if possible
1683cdf0e10cSrcweir 
1684cdf0e10cSrcweir 					::rtl::OUString sURLRequest( sURL );
1685cdf0e10cSrcweir     				if ( ( mrExport.getExportFlags() & EXPORT_OASIS ) == 0 )
1686cdf0e10cSrcweir 						sURLRequest += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "?oasis=false" ) );
1687cdf0e10cSrcweir 					mrExport.AddEmbeddedObjectAsBase64( sURLRequest );
1688cdf0e10cSrcweir 				}
1689cdf0e10cSrcweir 			}
1690cdf0e10cSrcweir 		}
1691cdf0e10cSrcweir 		if( !bIsEmptyPresObj )
1692cdf0e10cSrcweir 		{
1693cdf0e10cSrcweir 			OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
1694cdf0e10cSrcweir 			sURL += sPersistName;
1695cdf0e10cSrcweir 			if( !bExportEmbedded )
1696cdf0e10cSrcweir 			{
1697cdf0e10cSrcweir 				sURL = GetExport().AddEmbeddedObject( sURL );
1698cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
1699cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1700cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1701cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1702cdf0e10cSrcweir 			}
1703cdf0e10cSrcweir 
1704cdf0e10cSrcweir 			SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
1705cdf0e10cSrcweir 									  XML_IMAGE, sal_False, sal_True );
1706cdf0e10cSrcweir 
1707cdf0e10cSrcweir 			if( bExportEmbedded )
1708cdf0e10cSrcweir 				GetExport().AddEmbeddedObjectAsBase64( sURL );
1709cdf0e10cSrcweir 		}
1710cdf0e10cSrcweir 
1711a5258243SPedro Giffuni         ImpExportEvents( xShape );
1712cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
1713cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
1714cdf0e10cSrcweir 	}
1715cdf0e10cSrcweir }
1716cdf0e10cSrcweir 
1717cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1718cdf0e10cSrcweir 
1719cdf0e10cSrcweir void XMLShapeExport::ImpExportPageShape(
1720cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1721cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1722cdf0e10cSrcweir {
1723cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1724cdf0e10cSrcweir 	if(xPropSet.is())
1725cdf0e10cSrcweir 	{
1726cdf0e10cSrcweir 		// #86163# Transformation
1727cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1728cdf0e10cSrcweir 
1729cdf0e10cSrcweir 		// export page number used for this page
1730cdf0e10cSrcweir 		uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1731cdf0e10cSrcweir 		const OUString aPageNumberStr(RTL_CONSTASCII_USTRINGPARAM("PageNumber"));
1732cdf0e10cSrcweir 		if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
1733cdf0e10cSrcweir 		{
1734cdf0e10cSrcweir 			sal_Int32 nPageNumber = 0;
1735cdf0e10cSrcweir 			xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber;
1736cdf0e10cSrcweir 			if( nPageNumber )
1737cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_PAGE_NUMBER, OUString::valueOf(nPageNumber));
1738cdf0e10cSrcweir 		}
1739cdf0e10cSrcweir 
1740cdf0e10cSrcweir 		// a presentation page shape, normally used on notes pages only. If
1741cdf0e10cSrcweir 		// it is used not as presentation shape, it may have been created with
1742cdf0e10cSrcweir 		// copy-paste exchange between draw and impress (this IS possible...)
1743cdf0e10cSrcweir 		if(eShapeType == XmlShapeTypePresPageShape)
1744cdf0e10cSrcweir 		{
1745cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS,
1746cdf0e10cSrcweir                                  XML_PRESENTATION_PAGE);
1747cdf0e10cSrcweir 		}
1748cdf0e10cSrcweir 
1749cdf0e10cSrcweir 		// write Page shape
1750cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1751cdf0e10cSrcweir 		SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, bCreateNewline, sal_True);
1752cdf0e10cSrcweir 	}
1753cdf0e10cSrcweir }
1754cdf0e10cSrcweir 
1755cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1756cdf0e10cSrcweir 
1757cdf0e10cSrcweir void XMLShapeExport::ImpExportCaptionShape(
1758cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1759cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1760cdf0e10cSrcweir {
1761cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1762cdf0e10cSrcweir 	if(xPropSet.is())
1763cdf0e10cSrcweir 	{
1764cdf0e10cSrcweir 		// Transformation
1765cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1766cdf0e10cSrcweir 
1767cdf0e10cSrcweir 		// evtl. corner radius?
1768cdf0e10cSrcweir 		sal_Int32 nCornerRadius(0L);
1769cdf0e10cSrcweir 		xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
1770cdf0e10cSrcweir 		if(nCornerRadius)
1771cdf0e10cSrcweir 		{
1772cdf0e10cSrcweir 			OUStringBuffer sStringBuffer;
1773cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
1774cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
1775cdf0e10cSrcweir 		}
1776cdf0e10cSrcweir 
1777cdf0e10cSrcweir 		awt::Point aCaptionPoint;
1778cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ) ) ) >>= aCaptionPoint;
1779cdf0e10cSrcweir 
1780cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.X);
1781cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() );
1782cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.Y);
1783cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() );
1784cdf0e10cSrcweir 
1785cdf0e10cSrcweir 		// write Caption shape. Add export later.
1786cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1787cdf0e10cSrcweir 		sal_Bool bAnnotation( (nFeatures & SEF_EXPORT_ANNOTATION) == SEF_EXPORT_ANNOTATION );
1788cdf0e10cSrcweir 
1789cdf0e10cSrcweir         SvXMLElementExport aObj( mrExport,
1790cdf0e10cSrcweir 								 (bAnnotation ? XML_NAMESPACE_OFFICE
1791cdf0e10cSrcweir 								 			  : XML_NAMESPACE_DRAW),
1792cdf0e10cSrcweir 								 (bAnnotation ?	XML_ANNOTATION : XML_CAPTION),
1793cdf0e10cSrcweir 								 bCreateNewline, sal_True );
1794cdf0e10cSrcweir 
1795cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
1796cdf0e10cSrcweir 		ImpExportEvents( xShape );
1797cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
1798cdf0e10cSrcweir 		if( bAnnotation )
1799cdf0e10cSrcweir 			mrExport.exportAnnotationMeta( xShape );
1800cdf0e10cSrcweir 		ImpExportText( xShape );
1801cdf0e10cSrcweir 	}
1802cdf0e10cSrcweir }
1803cdf0e10cSrcweir 
1804cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1805cdf0e10cSrcweir 
1806cdf0e10cSrcweir void XMLShapeExport::ImpExportFrameShape(
1807cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1808cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1809cdf0e10cSrcweir {
1810cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1811cdf0e10cSrcweir 	if(xPropSet.is())
1812cdf0e10cSrcweir 	{
1813cdf0e10cSrcweir 		// Transformation
1814cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1815cdf0e10cSrcweir 
1816cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1817cdf0e10cSrcweir 		SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
1818cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1819cdf0e10cSrcweir 
1820cdf0e10cSrcweir 		// export frame url
1821cdf0e10cSrcweir 		OUString aStr;
1822cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameURL" ) ) ) >>= aStr;
1823cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1824cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1825cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1826cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1827cdf0e10cSrcweir 
1828cdf0e10cSrcweir 		// export name
1829cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameName" ) ) ) >>= aStr;
1830cdf0e10cSrcweir 		if( aStr.getLength() )
1831cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr );
1832cdf0e10cSrcweir 
1833cdf0e10cSrcweir 		// write floating frame
1834cdf0e10cSrcweir 		{
1835cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, sal_True, sal_True);
1836cdf0e10cSrcweir 		}
1837cdf0e10cSrcweir 	}
1838cdf0e10cSrcweir }
1839cdf0e10cSrcweir 
1840cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1841cdf0e10cSrcweir 
1842cdf0e10cSrcweir void XMLShapeExport::ImpExportAppletShape(
1843cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1844cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1845cdf0e10cSrcweir {
1846cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1847cdf0e10cSrcweir 	if(xPropSet.is())
1848cdf0e10cSrcweir 	{
1849cdf0e10cSrcweir 		// Transformation
1850cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1851cdf0e10cSrcweir 
1852cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1853cdf0e10cSrcweir 		SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1854cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1855cdf0e10cSrcweir 
1856cdf0e10cSrcweir 		// export frame url
1857cdf0e10cSrcweir 		OUString aStr;
1858cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCodeBase" ) ) ) >>= aStr;
1859cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1860cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1861cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1862cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1863cdf0e10cSrcweir 
1864cdf0e10cSrcweir 		// export draw:applet-name
1865cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletName" ) ) ) >>= aStr;
1866cdf0e10cSrcweir 		if( aStr.getLength() )
1867cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr );
1868cdf0e10cSrcweir 
1869cdf0e10cSrcweir 		// export draw:code
1870cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCode" ) ) ) >>= aStr;
1871cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr );
1872cdf0e10cSrcweir 
1873cdf0e10cSrcweir 		// export draw:may-script
1874cdf0e10cSrcweir 		sal_Bool bIsScript = false;
1875cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletIsScript" ) ) ) >>= bIsScript;
1876cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bIsScript ? XML_TRUE : XML_FALSE );
1877cdf0e10cSrcweir 
1878cdf0e10cSrcweir 		{
1879cdf0e10cSrcweir 			// write applet
1880cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_APPLET, sal_True, sal_True);
1881cdf0e10cSrcweir 
1882cdf0e10cSrcweir 			// export parameters
1883cdf0e10cSrcweir 			uno::Sequence< beans::PropertyValue > aCommands;
1884cdf0e10cSrcweir 			xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCommands" ) ) ) >>= aCommands;
1885cdf0e10cSrcweir 			const sal_Int32 nCount = aCommands.getLength();
1886cdf0e10cSrcweir 			for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
1887cdf0e10cSrcweir 			{
1888cdf0e10cSrcweir 				aCommands[nIndex].Value >>= aStr;
1889cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
1890cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
1891cdf0e10cSrcweir 				SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
1892cdf0e10cSrcweir 			}
1893cdf0e10cSrcweir 		}
1894cdf0e10cSrcweir 	}
1895cdf0e10cSrcweir }
1896cdf0e10cSrcweir 
1897cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1898cdf0e10cSrcweir 
1899cdf0e10cSrcweir void XMLShapeExport::ImpExportPluginShape(
1900cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1901cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1902cdf0e10cSrcweir {
1903cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1904cdf0e10cSrcweir 	if(xPropSet.is())
1905cdf0e10cSrcweir 	{
1906cdf0e10cSrcweir 		// Transformation
1907cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1908cdf0e10cSrcweir 
1909cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1910cdf0e10cSrcweir 		SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1911cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1912cdf0e10cSrcweir 
1913cdf0e10cSrcweir 		// export plugin url
1914cdf0e10cSrcweir 		OUString aStr;
1915cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginURL" ) ) ) >>= aStr;
1916cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1917cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1918cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1919cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1920cdf0e10cSrcweir 
1921cdf0e10cSrcweir 
1922cdf0e10cSrcweir 		// export mime-type
1923cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginMimeType" ) ) ) >>= aStr;
1924cdf0e10cSrcweir 		if(aStr.getLength())
1925cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
1926cdf0e10cSrcweir 
1927cdf0e10cSrcweir 		{
1928cdf0e10cSrcweir 			// write plugin
1929cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, sal_True, sal_True);
1930cdf0e10cSrcweir 
1931cdf0e10cSrcweir 			// export parameters
1932cdf0e10cSrcweir 			uno::Sequence< beans::PropertyValue > aCommands;
1933cdf0e10cSrcweir 			xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginCommands" ) ) ) >>= aCommands;
1934cdf0e10cSrcweir 			const sal_Int32 nCount = aCommands.getLength();
1935cdf0e10cSrcweir 			for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
1936cdf0e10cSrcweir 			{
1937cdf0e10cSrcweir 				aCommands[nIndex].Value >>= aStr;
1938cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
1939cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
1940cdf0e10cSrcweir 				SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
1941cdf0e10cSrcweir 			}
1942cdf0e10cSrcweir 		}
1943cdf0e10cSrcweir 	}
1944cdf0e10cSrcweir }
1945cdf0e10cSrcweir 
1946cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1947cdf0e10cSrcweir 
1948cdf0e10cSrcweir void XMLShapeExport::ImpExportMediaShape(
1949cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1950cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1951cdf0e10cSrcweir {
1952cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1953cdf0e10cSrcweir 	if(xPropSet.is())
1954cdf0e10cSrcweir 	{
1955cdf0e10cSrcweir 		// Transformation
1956cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1957cdf0e10cSrcweir 
1958cdf0e10cSrcweir 		if(eShapeType == XmlShapeTypePresMediaShape)
1959cdf0e10cSrcweir 			ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
1960cdf0e10cSrcweir 
1961cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1962cdf0e10cSrcweir 		SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
1963cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1964cdf0e10cSrcweir 
1965cdf0e10cSrcweir 		// export media url
1966cdf0e10cSrcweir 		OUString aMediaURL;
1967cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ) ) >>= aMediaURL;
1968cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( aMediaURL ) );
1969cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1970cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1971cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1972cdf0e10cSrcweir 
1973cdf0e10cSrcweir 		// export mime-type
1974cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.media" ) ) );
1975cdf0e10cSrcweir 
1976cdf0e10cSrcweir 		// write plugin
1977cdf0e10cSrcweir 		SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & SEF_EXPORT_NO_WS ), sal_True);
1978cdf0e10cSrcweir 
1979cdf0e10cSrcweir 		// export parameters
1980cdf0e10cSrcweir 		const OUString aFalseStr( RTL_CONSTASCII_USTRINGPARAM( "false" ) ), aTrueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
1981cdf0e10cSrcweir 
1982cdf0e10cSrcweir 		sal_Bool bLoop = false;
1983cdf0e10cSrcweir 		const OUString aLoopStr( RTL_CONSTASCII_USTRINGPARAM( "Loop" ) );
1984cdf0e10cSrcweir 		xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
1985cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
1986cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr );
1987cdf0e10cSrcweir 		delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
1988cdf0e10cSrcweir 
1989cdf0e10cSrcweir 		sal_Bool bMute = false;
1990cdf0e10cSrcweir 		const OUString aMuteStr( RTL_CONSTASCII_USTRINGPARAM( "Mute" ) );
1991cdf0e10cSrcweir 		xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
1992cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
1993cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr );
1994cdf0e10cSrcweir 		delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
1995cdf0e10cSrcweir 
1996cdf0e10cSrcweir 		sal_Int16 nVolumeDB = 0;
1997cdf0e10cSrcweir 		const OUString aVolumeDBStr( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) );
1998cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ) ) >>= nVolumeDB;
1999cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr );
2000cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::valueOf( static_cast< sal_Int32 >( nVolumeDB ) ) );
2001cdf0e10cSrcweir 		delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
2002cdf0e10cSrcweir 
2003cdf0e10cSrcweir 		media::ZoomLevel eZoom;
2004cdf0e10cSrcweir 		const OUString aZoomStr( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) );
2005cdf0e10cSrcweir 		OUString aZoomValue;
2006cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ) ) >>= eZoom;
2007cdf0e10cSrcweir 		switch( eZoom )
2008cdf0e10cSrcweir 		{
2009cdf0e10cSrcweir 			case( media::ZoomLevel_ZOOM_1_TO_4 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "25%" ) ); break;
2010cdf0e10cSrcweir 			case( media::ZoomLevel_ZOOM_1_TO_2 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "50%" ) ); break;
2011cdf0e10cSrcweir 			case( media::ZoomLevel_ORIGINAL ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "100%" ) ); break;
2012cdf0e10cSrcweir 			case( media::ZoomLevel_ZOOM_2_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "200%" ) ); break;
2013cdf0e10cSrcweir 			case( media::ZoomLevel_ZOOM_4_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "400%" ) ); break;
2014cdf0e10cSrcweir 		    case( media::ZoomLevel_FIT_TO_WINDOW ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fit" ) ); break;
2015cdf0e10cSrcweir 		    case( media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fixedfit" ) ); break;
2016cdf0e10cSrcweir 		    case( media::ZoomLevel_FULLSCREEN ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fullscreen" ) ); break;
2017cdf0e10cSrcweir 
2018cdf0e10cSrcweir 			default:
2019cdf0e10cSrcweir 			break;
2020cdf0e10cSrcweir 		}
2021cdf0e10cSrcweir 
2022cdf0e10cSrcweir 		if( aZoomValue.getLength() )
2023cdf0e10cSrcweir 		{
2024cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr );
2025cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue );
2026cdf0e10cSrcweir 			delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
2027cdf0e10cSrcweir 		}
2028cdf0e10cSrcweir 	}
2029cdf0e10cSrcweir }
2030