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>
511f882ec4SArmin Le Grand #include <basegfx/matrix/b2dhommatrixtools.hxx>
521f882ec4SArmin Le Grand #include <basegfx/point/b2dpoint.hxx>
531f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolypolygon.hxx>
541f882ec4SArmin Le Grand #include <basegfx/polygon/b2dpolypolygontools.hxx>
551f882ec4SArmin 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 
17986e1cf34SPedro Giffuni 	// decide if transformation is necessary
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 
64786e1cf34SPedro Giffuni 		// #89764# if export of position is suppressed 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 
9572f8a4d94SArmin Le Grand         // prepare name (with most used)
9582f8a4d94SArmin Le Grand         enum ::xmloff::token::XMLTokenEnum eName(XML_CIRCLE);
959cdf0e10cSrcweir 
9602f8a4d94SArmin Le Grand         if(bCircle)
9612f8a4d94SArmin Le Grand         {
9622f8a4d94SArmin Le Grand             // name already set
9632f8a4d94SArmin Le Grand         }
9642f8a4d94SArmin Le Grand         else
9652f8a4d94SArmin Le Grand         {
9662f8a4d94SArmin Le Grand             // set name
9672f8a4d94SArmin Le Grand             eName = XML_ELLIPSE;
9682f8a4d94SArmin Le Grand         }
969cdf0e10cSrcweir 
9702f8a4d94SArmin Le Grand         // write ellipse or circle
9712f8a4d94SArmin Le Grand         SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, eName, bCreateNewline, sal_True);
9722f8a4d94SArmin Le Grand 
9732f8a4d94SArmin Le Grand         ImpExportDescription( xShape ); // #i68101#
9742f8a4d94SArmin Le Grand         ImpExportEvents( xShape );
9752f8a4d94SArmin Le Grand         ImpExportGluePoints( xShape );
9762f8a4d94SArmin Le Grand         ImpExportText( xShape );
9772f8a4d94SArmin Le Grand     }
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 bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape
990cdf0e10cSrcweir 			|| eShapeType == XmlShapeTypeDrawOpenBezierShape);
991cdf0e10cSrcweir 
992cdf0e10cSrcweir 		// get matrix
993cdf0e10cSrcweir 		::basegfx::B2DHomMatrix aMatrix;
994cdf0e10cSrcweir 		ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet);
995cdf0e10cSrcweir 
996cdf0e10cSrcweir 		// decompose and correct abour pRefPoint
997cdf0e10cSrcweir 		::basegfx::B2DTuple aTRScale;
998cdf0e10cSrcweir 		double fTRShear(0.0);
999cdf0e10cSrcweir 		double fTRRotate(0.0);
1000cdf0e10cSrcweir 		::basegfx::B2DTuple aTRTranslate;
1001cdf0e10cSrcweir 		ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint);
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir 		// use features and write
1004cdf0e10cSrcweir 		ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures);
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir 		// create and export ViewBox
1007cdf0e10cSrcweir 		awt::Point aPoint(0, 0);
1008cdf0e10cSrcweir 		awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY()));
1009cdf0e10cSrcweir 		SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height);
1010cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString());
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1013cdf0e10cSrcweir 
10142f8a4d94SArmin Le Grand         // prepare name (with most used)
10152f8a4d94SArmin Le Grand         enum ::xmloff::token::XMLTokenEnum eName(XML_PATH);
10162f8a4d94SArmin Le Grand 
10171f882ec4SArmin Le Grand         if(bBezier)
10181f882ec4SArmin Le Grand         {
10191f882ec4SArmin Le Grand             // get PolygonBezier
10201f882ec4SArmin Le Grand             uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
10211f882ec4SArmin Le Grand             const basegfx::B2DPolyPolygon aPolyPolygon(
10221f882ec4SArmin Le Grand                 basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(*(drawing::PolyPolygonBezierCoords*)aAny.getValue()));
1023cdf0e10cSrcweir 
10241f882ec4SArmin Le Grand             if(aPolyPolygon.count())
10251f882ec4SArmin Le Grand             {
10261f882ec4SArmin Le Grand                 // complex polygon shape, write as svg:d
10271f882ec4SArmin Le Grand                 const ::rtl::OUString aPolygonString(
10281f882ec4SArmin Le Grand                     basegfx::tools::exportToSvgD(
10291f882ec4SArmin Le Grand                         aPolyPolygon,
10301f882ec4SArmin Le Grand                         true,       // bUseRelativeCoordinates
10311f882ec4SArmin Le Grand                         false,      // bDetectQuadraticBeziers: not used in old, but maybe activated now
10321f882ec4SArmin Le Grand                         true));     // bHandleRelativeNextPointCompatible
10331f882ec4SArmin Le Grand 
10341f882ec4SArmin Le Grand                 // write point array
10351f882ec4SArmin Le Grand                 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
10361f882ec4SArmin Le Grand             }
10371f882ec4SArmin Le Grand         }
10381f882ec4SArmin Le Grand         else
10391f882ec4SArmin Le Grand         {
10401f882ec4SArmin Le Grand             // get non-bezier polygon
10411f882ec4SArmin Le Grand             uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) );
10421f882ec4SArmin Le Grand             const basegfx::B2DPolyPolygon aPolyPolygon(
10431f882ec4SArmin Le Grand                 basegfx::tools::UnoPointSequenceSequenceToB2DPolyPolygon(*(drawing::PointSequenceSequence*)aAny.getValue()));
1044cdf0e10cSrcweir 
10451f882ec4SArmin Le Grand             if(!aPolyPolygon.areControlPointsUsed() && 1 == aPolyPolygon.count())
10461f882ec4SArmin Le Grand             {
10471f882ec4SArmin Le Grand                 // simple polygon shape, can be written as svg:points sequence
10481f882ec4SArmin Le Grand                 const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(0));
10491f882ec4SArmin Le Grand                 const ::rtl::OUString aPointString(basegfx::tools::exportToSvgPoints(aPolygon));
10501f882ec4SArmin Le Grand 
10511f882ec4SArmin Le Grand                 // write point array
10521f882ec4SArmin Le Grand                 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
10531f882ec4SArmin Le Grand 
10542f8a4d94SArmin Le Grand                 // set name
10552f8a4d94SArmin Le Grand                 eName = aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE;
10561f882ec4SArmin Le Grand             }
10571f882ec4SArmin Le Grand             else
10581f882ec4SArmin Le Grand             {
10591f882ec4SArmin Le Grand                 // complex polygon shape, write as svg:d
10601f882ec4SArmin Le Grand                 const ::rtl::OUString aPolygonString(
10611f882ec4SArmin Le Grand                     basegfx::tools::exportToSvgD(
10621f882ec4SArmin Le Grand                         aPolyPolygon,
10631f882ec4SArmin Le Grand                         true,       // bUseRelativeCoordinates
10641f882ec4SArmin Le Grand                         false,      // bDetectQuadraticBeziers: not used in old, but maybe activated now
10651f882ec4SArmin Le Grand                         true));     // bHandleRelativeNextPointCompatible
10661f882ec4SArmin Le Grand 
10671f882ec4SArmin Le Grand                 // write point array
10681f882ec4SArmin Le Grand                 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
10691f882ec4SArmin Le Grand             }
10701f882ec4SArmin Le Grand         }
1071cdf0e10cSrcweir 
10725e6b5d64SArmin Le Grand         // write object, but after attributes are added since this call will
10735e6b5d64SArmin Le Grand         // consume all of these added attributes and the destructor will close the
10745e6b5d64SArmin Le Grand         // scope. Also before text is added; this may add sub-scopes as needed
10752f8a4d94SArmin Le Grand         SvXMLElementExport aOBJ(
10762f8a4d94SArmin Le Grand             mrExport,
10772f8a4d94SArmin Le Grand             XML_NAMESPACE_DRAW,
10782f8a4d94SArmin Le Grand             eName,
10792f8a4d94SArmin Le Grand             bCreateNewline,
10802f8a4d94SArmin Le Grand             sal_True);
10812f8a4d94SArmin Le Grand 
10821f882ec4SArmin Le Grand         ImpExportDescription( xShape ); // #i68101#
10831f882ec4SArmin Le Grand         ImpExportEvents( xShape );
10841f882ec4SArmin Le Grand         ImpExportGluePoints( xShape );
10851f882ec4SArmin Le Grand         ImpExportText( xShape );
10861f882ec4SArmin Le Grand     }
1087cdf0e10cSrcweir }
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir void XMLShapeExport::ImpExportGraphicObjectShape(
1092*f636aef8SOliver-Rainer Wittmann     const uno::Reference< drawing::XShape >& xShape,
1093*f636aef8SOliver-Rainer Wittmann     XmlShapeType eShapeType,
1094*f636aef8SOliver-Rainer Wittmann     sal_Int32 nFeatures,
1095*f636aef8SOliver-Rainer Wittmann     awt::Point* pRefPoint )
1096cdf0e10cSrcweir {
1097*f636aef8SOliver-Rainer Wittmann     const uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
1098*f636aef8SOliver-Rainer Wittmann     if ( xPropSet.is() )
1099*f636aef8SOliver-Rainer Wittmann     {
1100*f636aef8SOliver-Rainer Wittmann         sal_Bool bIsEmptyPresObj = sal_False;
1101*f636aef8SOliver-Rainer Wittmann         uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1102cdf0e10cSrcweir 
1103*f636aef8SOliver-Rainer Wittmann         // Transformation
1104*f636aef8SOliver-Rainer Wittmann         ImpExportNewTrans( xPropSet, nFeatures, pRefPoint );
1105cdf0e10cSrcweir 
1106*f636aef8SOliver-Rainer Wittmann         OUString sImageURL;
1107cdf0e10cSrcweir 
1108*f636aef8SOliver-Rainer Wittmann         if ( eShapeType == XmlShapeTypePresGraphicObjectShape )
1109*f636aef8SOliver-Rainer Wittmann             bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken( XML_PRESENTATION_GRAPHIC ) );
1110cdf0e10cSrcweir 
1111*f636aef8SOliver-Rainer Wittmann         sal_Bool bCreateNewline( ( nFeatures & SEF_EXPORT_NO_WS ) == 0 ); // #86116#/#92210#
1112*f636aef8SOliver-Rainer Wittmann         SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_FRAME, bCreateNewline, sal_True );
1113cdf0e10cSrcweir 
1114*f636aef8SOliver-Rainer Wittmann         const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
1115cdf0e10cSrcweir 
1116*f636aef8SOliver-Rainer Wittmann         if ( !bIsEmptyPresObj || bSaveBackwardsCompatible )
1117*f636aef8SOliver-Rainer Wittmann         {
1118*f636aef8SOliver-Rainer Wittmann             if ( !bIsEmptyPresObj )
1119*f636aef8SOliver-Rainer Wittmann             {
1120ddde725dSArmin Le Grand                 OUString aReplacementUrl;
1121ddde725dSArmin Le Grand                 xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("ReplacementGraphicURL"))) >>= aReplacementUrl;
1122ddde725dSArmin Le Grand 
1123ddde725dSArmin Le Grand                 // If there is no url, then then graphic is empty
1124*f636aef8SOliver-Rainer Wittmann                 if ( aReplacementUrl.getLength() )
1125ddde725dSArmin Le Grand                 {
1126ddde725dSArmin Le Grand                     const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl);
1127ddde725dSArmin Le Grand 
1128ddde725dSArmin Le Grand                     if(aStr.getLength())
1129ddde725dSArmin Le Grand                     {
1130ddde725dSArmin Le Grand                         mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr);
1131ddde725dSArmin Le Grand                         mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1132ddde725dSArmin Le Grand                         mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1133ddde725dSArmin Le Grand                         mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1134ddde725dSArmin Le Grand 
1135ddde725dSArmin Le Grand                         // xlink:href for replacement, only written for Svg content
1136ddde725dSArmin Le Grand                         SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True);
1137ddde725dSArmin Le Grand 
1138ddde725dSArmin Le Grand                         // optional office:binary-data
1139ddde725dSArmin Le Grand                         mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl);
1140ddde725dSArmin Le Grand                     }
1141ddde725dSArmin Le Grand                 }
1142ddde725dSArmin Le Grand 
1143ddde725dSArmin Le Grand                 OUString aStreamURL;
1144*f636aef8SOliver-Rainer Wittmann                 xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStreamURL" ) ) ) >>= aStreamURL;
1145*f636aef8SOliver-Rainer Wittmann                 xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicURL" ) ) ) >>= sImageURL;
1146cdf0e10cSrcweir 
1147*f636aef8SOliver-Rainer Wittmann                 OUString aResolveURL( sImageURL );
1148*f636aef8SOliver-Rainer Wittmann                 const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
1149cdf0e10cSrcweir 
1150*f636aef8SOliver-Rainer Wittmann                 // sj: trying to preserve the filename
1151*f636aef8SOliver-Rainer Wittmann                 if ( aStreamURL.match( sPackageURL, 0 ) )
1152*f636aef8SOliver-Rainer Wittmann                 {
1153*f636aef8SOliver-Rainer Wittmann                     rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) );
1154*f636aef8SOliver-Rainer Wittmann                     sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1;
1155*f636aef8SOliver-Rainer Wittmann                     if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) )
1156*f636aef8SOliver-Rainer Wittmann                         sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex );
1157*f636aef8SOliver-Rainer Wittmann                     nLastIndex = sRequestedName.lastIndexOf( '.' );
1158*f636aef8SOliver-Rainer Wittmann                     if ( nLastIndex >= 0 )
1159*f636aef8SOliver-Rainer Wittmann                         sRequestedName = sRequestedName.copy( 0, nLastIndex );
1160*f636aef8SOliver-Rainer Wittmann                     if ( sRequestedName.getLength() )
1161*f636aef8SOliver-Rainer Wittmann                     {
1162*f636aef8SOliver-Rainer Wittmann                         aResolveURL = aResolveURL.concat( OUString( RTL_CONSTASCII_USTRINGPARAM( "?requestedName=" ) ) );
1163*f636aef8SOliver-Rainer Wittmann                         aResolveURL = aResolveURL.concat( sRequestedName );
1164*f636aef8SOliver-Rainer Wittmann                     }
1165*f636aef8SOliver-Rainer Wittmann                 }
1166cdf0e10cSrcweir 
1167*f636aef8SOliver-Rainer Wittmann                 const OUString aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL );
1168*f636aef8SOliver-Rainer Wittmann                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStr );
1169cdf0e10cSrcweir 
1170*f636aef8SOliver-Rainer Wittmann                 if ( !aStr.isEmpty() )
1171*f636aef8SOliver-Rainer Wittmann                 {
1172*f636aef8SOliver-Rainer Wittmann                     aStreamURL = sPackageURL;
1173*f636aef8SOliver-Rainer Wittmann                     if ( aStr[0] == '#' )
1174*f636aef8SOliver-Rainer Wittmann                     {
1175*f636aef8SOliver-Rainer Wittmann                         aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) );
1176*f636aef8SOliver-Rainer Wittmann                     }
1177*f636aef8SOliver-Rainer Wittmann                     else
1178*f636aef8SOliver-Rainer Wittmann                     {
1179*f636aef8SOliver-Rainer Wittmann                         aStreamURL = aStreamURL.concat( aStr );
1180*f636aef8SOliver-Rainer Wittmann                     }
1181cdf0e10cSrcweir 
1182*f636aef8SOliver-Rainer Wittmann                     // update stream URL for load on demand
1183*f636aef8SOliver-Rainer Wittmann                     uno::Any aAny;
1184*f636aef8SOliver-Rainer Wittmann                     aAny <<= aStreamURL;
1185*f636aef8SOliver-Rainer Wittmann                     xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "GraphicStreamURL" ) ), aAny );
1186cdf0e10cSrcweir 
1187*f636aef8SOliver-Rainer Wittmann                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1188*f636aef8SOliver-Rainer Wittmann                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1189*f636aef8SOliver-Rainer Wittmann                     mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1190*f636aef8SOliver-Rainer Wittmann                 }
1191*f636aef8SOliver-Rainer Wittmann             }
1192*f636aef8SOliver-Rainer Wittmann             else
1193*f636aef8SOliver-Rainer Wittmann             {
1194*f636aef8SOliver-Rainer Wittmann                 OUString aStr;
1195*f636aef8SOliver-Rainer Wittmann                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStr );
1196*f636aef8SOliver-Rainer Wittmann                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1197*f636aef8SOliver-Rainer Wittmann                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1198*f636aef8SOliver-Rainer Wittmann                 mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1199*f636aef8SOliver-Rainer Wittmann             }
1200cdf0e10cSrcweir 
1201*f636aef8SOliver-Rainer Wittmann             {
1202*f636aef8SOliver-Rainer Wittmann                 SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True );
1203cdf0e10cSrcweir 
1204*f636aef8SOliver-Rainer Wittmann                 if ( sImageURL.getLength() )
1205*f636aef8SOliver-Rainer Wittmann                 {
1206*f636aef8SOliver-Rainer Wittmann                     // optional office:binary-data
1207*f636aef8SOliver-Rainer Wittmann                     mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL );
1208*f636aef8SOliver-Rainer Wittmann                 }
1209*f636aef8SOliver-Rainer Wittmann                 if ( !bIsEmptyPresObj )
1210*f636aef8SOliver-Rainer Wittmann                     ImpExportText( xShape );
1211*f636aef8SOliver-Rainer Wittmann             }
1212*f636aef8SOliver-Rainer Wittmann         }
1213cdf0e10cSrcweir 
1214*f636aef8SOliver-Rainer Wittmann         ImpExportEvents( xShape );
1215*f636aef8SOliver-Rainer Wittmann         ImpExportGluePoints( xShape );
1216cdf0e10cSrcweir 
1217*f636aef8SOliver-Rainer Wittmann         // image map
1218*f636aef8SOliver-Rainer Wittmann         GetExport().GetImageMapExport().Export( xPropSet );
1219*f636aef8SOliver-Rainer Wittmann         ImpExportDescription( xShape ); // #i68101#
1220*f636aef8SOliver-Rainer Wittmann     }
1221cdf0e10cSrcweir }
1222cdf0e10cSrcweir 
1223cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir void XMLShapeExport::ImpExportChartShape(
1226cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1227cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint,
1228cdf0e10cSrcweir     SvXMLAttributeList* pAttrList )
1229cdf0e10cSrcweir {
1230cdf0e10cSrcweir 	ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList );
1231cdf0e10cSrcweir }
1232cdf0e10cSrcweir 
1233cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir void XMLShapeExport::ImpExportControlShape(
1236cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1237cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint)
1238cdf0e10cSrcweir {
1239cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1240cdf0e10cSrcweir 	if(xPropSet.is())
1241cdf0e10cSrcweir 	{
1242cdf0e10cSrcweir 		// Transformation
1243cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1244cdf0e10cSrcweir 	}
1245cdf0e10cSrcweir 
1246cdf0e10cSrcweir 	uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY );
1247cdf0e10cSrcweir 	DBG_ASSERT( xControl.is(), "Control shape is not supporting XControlShape" );
1248cdf0e10cSrcweir 	if( xControl.is() )
1249cdf0e10cSrcweir 	{
1250cdf0e10cSrcweir 		uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY );
1251cdf0e10cSrcweir 		DBG_ASSERT( xControlModel.is(), "Control shape has not XControlModel" );
1252cdf0e10cSrcweir 		if( xControlModel.is() )
1253cdf0e10cSrcweir 		{
1254cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONTROL, mrExport.GetFormExport()->getControlId( xControlModel ) );
1255cdf0e10cSrcweir 		}
1256cdf0e10cSrcweir 	}
1257cdf0e10cSrcweir 
1258cdf0e10cSrcweir 	sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1259cdf0e10cSrcweir 	SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONTROL, bCreateNewline, sal_True);
1260cdf0e10cSrcweir 
1261cdf0e10cSrcweir 	ImpExportDescription( xShape ); // #i68101#
1262cdf0e10cSrcweir }
1263cdf0e10cSrcweir 
1264cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1265cdf0e10cSrcweir 
1266cdf0e10cSrcweir void XMLShapeExport::ImpExportConnectorShape(
1267cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1268cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1269cdf0e10cSrcweir {
1270cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
1271cdf0e10cSrcweir 
1272cdf0e10cSrcweir 	OUString aStr;
1273cdf0e10cSrcweir 	OUStringBuffer sStringBuffer;
1274cdf0e10cSrcweir 
1275cdf0e10cSrcweir 	// export connection kind
1276cdf0e10cSrcweir 	drawing::ConnectorType eType = drawing::ConnectorType_STANDARD;
1277cdf0e10cSrcweir 	uno::Any aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")));
1278cdf0e10cSrcweir 	aAny >>= eType;
1279cdf0e10cSrcweir 
1280cdf0e10cSrcweir 	if( eType != drawing::ConnectorType_STANDARD )
1281cdf0e10cSrcweir 	{
1282cdf0e10cSrcweir 		SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eType, aXML_ConnectionKind_EnumMap );
1283cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1284cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TYPE, aStr);
1285cdf0e10cSrcweir 	}
1286cdf0e10cSrcweir 
1287cdf0e10cSrcweir 	// export line skew
1288cdf0e10cSrcweir 	sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0;
1289cdf0e10cSrcweir 
1290cdf0e10cSrcweir 	aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")));
1291cdf0e10cSrcweir 	aAny >>= nDelta1;
1292cdf0e10cSrcweir 	aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")));
1293cdf0e10cSrcweir 	aAny >>= nDelta2;
1294cdf0e10cSrcweir 	aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")));
1295cdf0e10cSrcweir 	aAny >>= nDelta3;
1296cdf0e10cSrcweir 
1297cdf0e10cSrcweir 	if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 )
1298cdf0e10cSrcweir 	{
1299cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta1);
1300cdf0e10cSrcweir 		if( nDelta2 != 0 || nDelta3 != 0 )
1301cdf0e10cSrcweir 		{
1302cdf0e10cSrcweir 			const char aSpace = ' ';
1303cdf0e10cSrcweir 			sStringBuffer.appendAscii( &aSpace, 1 );
1304cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta2);
1305cdf0e10cSrcweir 			if( nDelta3 != 0 )
1306cdf0e10cSrcweir 			{
1307cdf0e10cSrcweir 				sStringBuffer.appendAscii( &aSpace, 1 );
1308cdf0e10cSrcweir 				mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta3);
1309cdf0e10cSrcweir 			}
1310cdf0e10cSrcweir 		}
1311cdf0e10cSrcweir 
1312cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1313cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LINE_SKEW, aStr);
1314cdf0e10cSrcweir 	}
1315cdf0e10cSrcweir 
1316cdf0e10cSrcweir 	// export start and end point
1317cdf0e10cSrcweir 	awt::Point aStart(0,0);
1318cdf0e10cSrcweir 	awt::Point aEnd(1,1);
1319cdf0e10cSrcweir 
1320cdf0e10cSrcweir     // --> OD 2004-08-09 #i36248# - Get <StartPositionInHoriL2R> and
1321cdf0e10cSrcweir     // <EndPositionInHoriL2R>, if they exist and if the document is exported
1322cdf0e10cSrcweir     // into the OpenOffice.org file format.
1323cdf0e10cSrcweir     // These properties only exist at service com::sun::star::text::Shape - the
1324cdf0e10cSrcweir     // Writer UNO service for shapes.
1325cdf0e10cSrcweir     // This code is needed, because the positioning attributes in the
1326cdf0e10cSrcweir     // OpenOffice.org file format are given in horizontal left-to-right layout
1327cdf0e10cSrcweir     // regardless the layout direction the shape is in. In the OASIS Open Office
1328cdf0e10cSrcweir     // file format the positioning attributes are correctly given in the layout
1329cdf0e10cSrcweir     // direction the shape is in. Thus, this code provides the conversion from
1330cdf0e10cSrcweir     // the OASIS Open Office file format to the OpenOffice.org file format.
1331cdf0e10cSrcweir     if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
1332cdf0e10cSrcweir          xProps->getPropertySetInfo()->hasPropertyByName(
1333cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) &&
1334cdf0e10cSrcweir          xProps->getPropertySetInfo()->hasPropertyByName(
1335cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) )
1336cdf0e10cSrcweir     {
1337cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart;
1338cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd;
1339cdf0e10cSrcweir     }
1340cdf0e10cSrcweir     else
1341cdf0e10cSrcweir     {
1342cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart;
1343cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd;
1344cdf0e10cSrcweir     }
1345cdf0e10cSrcweir     // <--
1346cdf0e10cSrcweir 
1347cdf0e10cSrcweir 	if( pRefPoint )
1348cdf0e10cSrcweir 	{
1349cdf0e10cSrcweir 		aStart.X -= pRefPoint->X;
1350cdf0e10cSrcweir 		aStart.Y -= pRefPoint->Y;
1351cdf0e10cSrcweir 		aEnd.X -= pRefPoint->X;
1352cdf0e10cSrcweir 		aEnd.Y -= pRefPoint->Y;
1353cdf0e10cSrcweir 	}
1354cdf0e10cSrcweir 
1355cdf0e10cSrcweir 	if( nFeatures & SEF_EXPORT_X )
1356cdf0e10cSrcweir 	{
1357cdf0e10cSrcweir 		// svg: x1
1358cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
1359cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1360cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
1361cdf0e10cSrcweir 	}
1362cdf0e10cSrcweir 	else
1363cdf0e10cSrcweir 	{
1364cdf0e10cSrcweir 		aEnd.X -= aStart.X;
1365cdf0e10cSrcweir 	}
1366cdf0e10cSrcweir 
1367cdf0e10cSrcweir 	if( nFeatures & SEF_EXPORT_Y )
1368cdf0e10cSrcweir 	{
1369cdf0e10cSrcweir 		// svg: y1
1370cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
1371cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1372cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
1373cdf0e10cSrcweir 	}
1374cdf0e10cSrcweir 	else
1375cdf0e10cSrcweir 	{
1376cdf0e10cSrcweir 		aEnd.Y -= aStart.Y;
1377cdf0e10cSrcweir 	}
1378cdf0e10cSrcweir 
1379cdf0e10cSrcweir 	// svg: x2
1380cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
1381cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
1382cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
1383cdf0e10cSrcweir 
1384cdf0e10cSrcweir 	// svg: y2
1385cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
1386cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
1387cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
1388cdf0e10cSrcweir 
1389cdf0e10cSrcweir 	// #i39320#
1390cdf0e10cSrcweir 	uno::Reference< uno::XInterface > xRefS;
1391cdf0e10cSrcweir 	uno::Reference< uno::XInterface > xRefE;
1392cdf0e10cSrcweir 
1393cdf0e10cSrcweir 	// export start connection
1394cdf0e10cSrcweir 	xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartShape") ) ) >>= xRefS;
1395cdf0e10cSrcweir 	if( xRefS.is() )
1396cdf0e10cSrcweir 	{
1397cdf0e10cSrcweir 		const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefS );
1398cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_SHAPE, rShapeId);
1399cdf0e10cSrcweir 
1400cdf0e10cSrcweir 		aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")) );
1401cdf0e10cSrcweir 		sal_Int32 nGluePointId = 0;
1402cdf0e10cSrcweir 		if( aAny >>= nGluePointId )
1403cdf0e10cSrcweir 		{
1404cdf0e10cSrcweir 			if( nGluePointId != -1 )
1405cdf0e10cSrcweir 			{
1406cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_GLUE_POINT, OUString::valueOf( nGluePointId ));
1407cdf0e10cSrcweir 			}
1408cdf0e10cSrcweir 		}
1409cdf0e10cSrcweir 	}
1410cdf0e10cSrcweir 
1411cdf0e10cSrcweir 	// export end connection
1412cdf0e10cSrcweir 	xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndShape")) ) >>= xRefE;
1413cdf0e10cSrcweir 	if( xRefE.is() )
1414cdf0e10cSrcweir 	{
1415cdf0e10cSrcweir 		const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefE );
1416cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_SHAPE, rShapeId);
1417cdf0e10cSrcweir 
1418cdf0e10cSrcweir 		aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")) );
1419cdf0e10cSrcweir 		sal_Int32 nGluePointId = 0;
1420cdf0e10cSrcweir 		if( aAny >>= nGluePointId )
1421cdf0e10cSrcweir 		{
1422cdf0e10cSrcweir 			if( nGluePointId != -1 )
1423cdf0e10cSrcweir 			{
1424cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_GLUE_POINT, OUString::valueOf( nGluePointId ));
1425cdf0e10cSrcweir 			}
1426cdf0e10cSrcweir 		}
1427cdf0e10cSrcweir 	}
1428cdf0e10cSrcweir 
14291f882ec4SArmin Le Grand     if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny )
14301f882ec4SArmin Le Grand     {
14311f882ec4SArmin Le Grand         // get PolygonBezier
14321f882ec4SArmin Le Grand         drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = (drawing::PolyPolygonBezierCoords*)aAny.getValue();
1433cdf0e10cSrcweir 
14341f882ec4SArmin Le Grand         if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength())
14351f882ec4SArmin Le Grand         {
14361f882ec4SArmin Le Grand             const basegfx::B2DPolyPolygon aPolyPolygon(
14371f882ec4SArmin Le Grand                 basegfx::tools::UnoPolyPolygonBezierCoordsToB2DPolyPolygon(
14381f882ec4SArmin Le Grand                     *pSourcePolyPolygon));
14391f882ec4SArmin Le Grand             const ::rtl::OUString aPolygonString(
14401f882ec4SArmin Le Grand                 basegfx::tools::exportToSvgD(
14411f882ec4SArmin Le Grand                     aPolyPolygon,
14421f882ec4SArmin Le Grand                     true,           // bUseRelativeCoordinates
14431f882ec4SArmin Le Grand                     false,          // bDetectQuadraticBeziers: not used in old, but maybe activated now
14441f882ec4SArmin Le Grand                     true));         // bHandleRelativeNextPointCompatible
1445210145b6SArmin Le Grand 
1446210145b6SArmin Le Grand             // write point array
1447210145b6SArmin Le Grand             mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
14481f882ec4SArmin Le Grand         }
14491f882ec4SArmin Le Grand     }
1450cdf0e10cSrcweir 
1451cdf0e10cSrcweir 	// write connector shape. Add Export later.
1452cdf0e10cSrcweir 	sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1453cdf0e10cSrcweir 	SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONNECTOR, bCreateNewline, sal_True);
1454cdf0e10cSrcweir 
1455cdf0e10cSrcweir 	ImpExportDescription( xShape ); // #i68101#
1456cdf0e10cSrcweir 	ImpExportEvents( xShape );
1457cdf0e10cSrcweir 	ImpExportGluePoints( xShape );
1458cdf0e10cSrcweir 	ImpExportText( xShape );
1459cdf0e10cSrcweir }
1460cdf0e10cSrcweir 
1461cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1462cdf0e10cSrcweir 
1463cdf0e10cSrcweir void XMLShapeExport::ImpExportMeasureShape(
1464cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1465cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1466cdf0e10cSrcweir {
1467cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
1468cdf0e10cSrcweir 
1469cdf0e10cSrcweir 	OUString aStr;
1470cdf0e10cSrcweir 	OUStringBuffer sStringBuffer;
1471cdf0e10cSrcweir 
1472cdf0e10cSrcweir 	// export start and end point
1473cdf0e10cSrcweir 	awt::Point aStart(0,0);
1474cdf0e10cSrcweir 	awt::Point aEnd(1,1);
1475cdf0e10cSrcweir 
1476cdf0e10cSrcweir     // --> OD 2004-08-09 #i36248# - Get <StartPositionInHoriL2R> and
1477cdf0e10cSrcweir     // <EndPositionInHoriL2R>, if they exist and if the document is exported
1478cdf0e10cSrcweir     // into the OpenOffice.org file format.
1479cdf0e10cSrcweir     // These properties only exist at service com::sun::star::text::Shape - the
1480cdf0e10cSrcweir     // Writer UNO service for shapes.
1481cdf0e10cSrcweir     // This code is needed, because the positioning attributes in the
1482cdf0e10cSrcweir     // OpenOffice.org file format are given in horizontal left-to-right layout
1483cdf0e10cSrcweir     // regardless the layout direction the shape is in. In the OASIS Open Office
1484cdf0e10cSrcweir     // file format the positioning attributes are correctly given in the layout
1485cdf0e10cSrcweir     // direction the shape is in. Thus, this code provides the conversion from
1486cdf0e10cSrcweir     // the OASIS Open Office file format to the OpenOffice.org file format.
1487cdf0e10cSrcweir     if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 &&
1488cdf0e10cSrcweir          xProps->getPropertySetInfo()->hasPropertyByName(
1489cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) &&
1490cdf0e10cSrcweir          xProps->getPropertySetInfo()->hasPropertyByName(
1491cdf0e10cSrcweir             OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) )
1492cdf0e10cSrcweir     {
1493cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart;
1494cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd;
1495cdf0e10cSrcweir     }
1496cdf0e10cSrcweir     else
1497cdf0e10cSrcweir     {
1498cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart;
1499cdf0e10cSrcweir         xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd;
1500cdf0e10cSrcweir     }
1501cdf0e10cSrcweir     // <--
1502cdf0e10cSrcweir 
1503cdf0e10cSrcweir 	if( pRefPoint )
1504cdf0e10cSrcweir 	{
1505cdf0e10cSrcweir 		aStart.X -= pRefPoint->X;
1506cdf0e10cSrcweir 		aStart.Y -= pRefPoint->Y;
1507cdf0e10cSrcweir 		aEnd.X -= pRefPoint->X;
1508cdf0e10cSrcweir 		aEnd.Y -= pRefPoint->Y;
1509cdf0e10cSrcweir 	}
1510cdf0e10cSrcweir 
1511cdf0e10cSrcweir 	if( nFeatures & SEF_EXPORT_X )
1512cdf0e10cSrcweir 	{
1513cdf0e10cSrcweir 		// svg: x1
1514cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X);
1515cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1516cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr);
1517cdf0e10cSrcweir 	}
1518cdf0e10cSrcweir 	else
1519cdf0e10cSrcweir 	{
1520cdf0e10cSrcweir 		aEnd.X -= aStart.X;
1521cdf0e10cSrcweir 	}
1522cdf0e10cSrcweir 
1523cdf0e10cSrcweir 	if( nFeatures & SEF_EXPORT_Y )
1524cdf0e10cSrcweir 	{
1525cdf0e10cSrcweir 		// svg: y1
1526cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y);
1527cdf0e10cSrcweir 		aStr = sStringBuffer.makeStringAndClear();
1528cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr);
1529cdf0e10cSrcweir 	}
1530cdf0e10cSrcweir 	else
1531cdf0e10cSrcweir 	{
1532cdf0e10cSrcweir 		aEnd.Y -= aStart.Y;
1533cdf0e10cSrcweir 	}
1534cdf0e10cSrcweir 
1535cdf0e10cSrcweir 	// svg: x2
1536cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X);
1537cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
1538cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr);
1539cdf0e10cSrcweir 
1540cdf0e10cSrcweir 	// svg: y2
1541cdf0e10cSrcweir 	mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y);
1542cdf0e10cSrcweir 	aStr = sStringBuffer.makeStringAndClear();
1543cdf0e10cSrcweir 	mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr);
1544cdf0e10cSrcweir 
1545cdf0e10cSrcweir 	// write measure shape
1546cdf0e10cSrcweir 	sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1547cdf0e10cSrcweir 	SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_MEASURE, bCreateNewline, sal_True);
1548cdf0e10cSrcweir 
1549cdf0e10cSrcweir 	ImpExportDescription( xShape ); // #i68101#
1550cdf0e10cSrcweir 	ImpExportEvents( xShape );
1551cdf0e10cSrcweir 	ImpExportGluePoints( xShape );
1552cdf0e10cSrcweir 
1553cdf0e10cSrcweir 	uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY );
1554cdf0e10cSrcweir 	if( xText.is() )
1555cdf0e10cSrcweir 		mrExport.GetTextParagraphExport()->exportText( xText );
1556cdf0e10cSrcweir }
1557cdf0e10cSrcweir 
1558cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1559cdf0e10cSrcweir 
1560cdf0e10cSrcweir void XMLShapeExport::ImpExportOLE2Shape(
1561cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1562cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */,
1563cdf0e10cSrcweir     SvXMLAttributeList* pAttrList /* = NULL */ )
1564cdf0e10cSrcweir {
1565cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1566cdf0e10cSrcweir 	uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY);
1567cdf0e10cSrcweir 
1568cdf0e10cSrcweir 	DBG_ASSERT( xPropSet.is() && xNamed.is(), "ole shape is not implementing needed interfaces");
1569cdf0e10cSrcweir 	if(xPropSet.is() && xNamed.is())
1570cdf0e10cSrcweir 	{
1571cdf0e10cSrcweir 		// Transformation
1572cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1573cdf0e10cSrcweir 
1574cdf0e10cSrcweir 		sal_Bool bIsEmptyPresObj = sal_False;
1575cdf0e10cSrcweir 
1576cdf0e10cSrcweir 		// presentation settings
1577cdf0e10cSrcweir 		if(eShapeType == XmlShapeTypePresOLE2Shape)
1578cdf0e10cSrcweir 			bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
1579cdf0e10cSrcweir 		else if(eShapeType == XmlShapeTypePresChartShape)
1580cdf0e10cSrcweir 			bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) );
1581cdf0e10cSrcweir 		else if(eShapeType == XmlShapeTypePresSheetShape)
1582cdf0e10cSrcweir 			bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) );
1583cdf0e10cSrcweir 
1584cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1585cdf0e10cSrcweir 		sal_Bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED));
1586cdf0e10cSrcweir 		OUString sPersistName;
1587cdf0e10cSrcweir 		SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1588cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1589cdf0e10cSrcweir 
1590cdf0e10cSrcweir 		const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE );
1591cdf0e10cSrcweir 
1592cdf0e10cSrcweir 		if( !bIsEmptyPresObj || bSaveBackwardsCompatible )
1593cdf0e10cSrcweir 		{
1594cdf0e10cSrcweir             if (pAttrList)
1595cdf0e10cSrcweir             {
1596cdf0e10cSrcweir                 mrExport.AddAttributeList(pAttrList);
1597cdf0e10cSrcweir             }
1598cdf0e10cSrcweir 
1599cdf0e10cSrcweir 			OUString sClassId;
1600cdf0e10cSrcweir 			OUString sURL;
1601cdf0e10cSrcweir 			sal_Bool bInternal = false;
1602cdf0e10cSrcweir 			xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsInternal"))) >>= bInternal;
1603cdf0e10cSrcweir 
1604cdf0e10cSrcweir 			if( !bIsEmptyPresObj )
1605cdf0e10cSrcweir 			{
1606cdf0e10cSrcweir 
1607cdf0e10cSrcweir 				if ( bInternal )
1608cdf0e10cSrcweir 				{
160986e1cf34SPedro Giffuni 					// OOo internal links have no storage persistence, URL is stored in the XML file
1610cdf0e10cSrcweir 					// the result LinkURL is empty in case the object is not a link
1611cdf0e10cSrcweir 					xPropSet->getPropertyValue( OUString::createFromAscii( "LinkURL" ) ) >>= sURL;
1612cdf0e10cSrcweir 				}
1613cdf0e10cSrcweir 
1614cdf0e10cSrcweir 				xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ) ) >>= sPersistName;
1615cdf0e10cSrcweir 				if ( !sURL.getLength() )
1616cdf0e10cSrcweir 				{
1617cdf0e10cSrcweir 					if( sPersistName.getLength() )
1618cdf0e10cSrcweir 					{
1619cdf0e10cSrcweir 						sURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) );
1620cdf0e10cSrcweir 						sURL += sPersistName;
1621cdf0e10cSrcweir 					}
1622cdf0e10cSrcweir 				}
1623cdf0e10cSrcweir 
1624cdf0e10cSrcweir 				if( !bInternal )
1625cdf0e10cSrcweir 					xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sClassId;
1626cdf0e10cSrcweir 
1627cdf0e10cSrcweir 				if( sClassId.getLength() )
1628cdf0e10cSrcweir 					mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CLASS_ID, sClassId );
1629cdf0e10cSrcweir 				if(!bExportEmbedded)
1630cdf0e10cSrcweir 				{
1631cdf0e10cSrcweir 					// xlink:href
1632cdf0e10cSrcweir 					if( sURL.getLength() )
1633cdf0e10cSrcweir 					{
1634cdf0e10cSrcweir 						// #96717# in theorie, if we don't have a url we shouldn't even
1635cdf0e10cSrcweir 						// export this ole shape. But practical its to risky right now
1636cdf0e10cSrcweir 						// to change this so we better dispose this on load
1637cdf0e10cSrcweir 						sURL = mrExport.AddEmbeddedObject( sURL );
1638cdf0e10cSrcweir 
1639cdf0e10cSrcweir 						mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
1640cdf0e10cSrcweir 						mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1641cdf0e10cSrcweir 						mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1642cdf0e10cSrcweir 						mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1643cdf0e10cSrcweir 					}
1644cdf0e10cSrcweir 				}
1645cdf0e10cSrcweir 			}
1646cdf0e10cSrcweir 			else
1647cdf0e10cSrcweir 			{
1648cdf0e10cSrcweir 				// export empty href for empty placeholders to be valid odf
1649cdf0e10cSrcweir 				OUString sEmptyURL;
1650cdf0e10cSrcweir 
1651cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sEmptyURL );
1652cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1653cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1654cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1655cdf0e10cSrcweir 			}
1656cdf0e10cSrcweir 
1657cdf0e10cSrcweir 			enum XMLTokenEnum eElem = sClassId.getLength() ? XML_OBJECT_OLE : XML_OBJECT;
1658cdf0e10cSrcweir 			SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, sal_True, sal_True );
1659cdf0e10cSrcweir 
1660a5258243SPedro Giffuni             // #i118485# Add text export, the draw OLE shape allows text now
1661a5258243SPedro Giffuni             ImpExportText( xShape );
1662a5258243SPedro Giffuni 
1663cdf0e10cSrcweir 			if(bExportEmbedded && !bIsEmptyPresObj)
1664cdf0e10cSrcweir 			{
1665cdf0e10cSrcweir 				// #100592#
1666cdf0e10cSrcweir 				if(bInternal)
1667cdf0e10cSrcweir 				{
1668cdf0e10cSrcweir 					// embedded XML
1669cdf0e10cSrcweir 					uno::Reference< lang::XComponent > xComp;
1670cdf0e10cSrcweir 					xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xComp;
1671cdf0e10cSrcweir 					DBG_ASSERT( xComp.is(), "no xModel for own OLE format" );
1672cdf0e10cSrcweir 					mrExport.ExportEmbeddedOwnObject( xComp );
1673cdf0e10cSrcweir 				}
1674cdf0e10cSrcweir 				else
1675cdf0e10cSrcweir 				{
1676cdf0e10cSrcweir 					// embed as Base64
1677cdf0e10cSrcweir 					// this is an alien object ( currently MSOLE is the only supported type of such objects )
1678cdf0e10cSrcweir 					// in case it is not an OASIS format the object should be asked to store replacement image if possible
1679cdf0e10cSrcweir 
1680cdf0e10cSrcweir 					::rtl::OUString sURLRequest( sURL );
1681cdf0e10cSrcweir     				if ( ( mrExport.getExportFlags() & EXPORT_OASIS ) == 0 )
1682cdf0e10cSrcweir 						sURLRequest += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "?oasis=false" ) );
1683cdf0e10cSrcweir 					mrExport.AddEmbeddedObjectAsBase64( sURLRequest );
1684cdf0e10cSrcweir 				}
1685cdf0e10cSrcweir 			}
1686cdf0e10cSrcweir 		}
1687cdf0e10cSrcweir 		if( !bIsEmptyPresObj )
1688cdf0e10cSrcweir 		{
1689cdf0e10cSrcweir 			OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) );
1690cdf0e10cSrcweir 			sURL += sPersistName;
1691cdf0e10cSrcweir 			if( !bExportEmbedded )
1692cdf0e10cSrcweir 			{
1693cdf0e10cSrcweir 				sURL = GetExport().AddEmbeddedObject( sURL );
1694cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL );
1695cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1696cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1697cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1698cdf0e10cSrcweir 			}
1699cdf0e10cSrcweir 
1700cdf0e10cSrcweir 			SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
1701cdf0e10cSrcweir 									  XML_IMAGE, sal_False, sal_True );
1702cdf0e10cSrcweir 
1703cdf0e10cSrcweir 			if( bExportEmbedded )
1704cdf0e10cSrcweir 				GetExport().AddEmbeddedObjectAsBase64( sURL );
1705cdf0e10cSrcweir 		}
1706cdf0e10cSrcweir 
1707a5258243SPedro Giffuni         ImpExportEvents( xShape );
1708cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
1709cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
1710cdf0e10cSrcweir 	}
1711cdf0e10cSrcweir }
1712cdf0e10cSrcweir 
1713cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1714cdf0e10cSrcweir 
1715cdf0e10cSrcweir void XMLShapeExport::ImpExportPageShape(
1716cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1717cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1718cdf0e10cSrcweir {
1719cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1720cdf0e10cSrcweir 	if(xPropSet.is())
1721cdf0e10cSrcweir 	{
1722cdf0e10cSrcweir 		// #86163# Transformation
1723cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1724cdf0e10cSrcweir 
1725cdf0e10cSrcweir 		// export page number used for this page
1726cdf0e10cSrcweir 		uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
1727cdf0e10cSrcweir 		const OUString aPageNumberStr(RTL_CONSTASCII_USTRINGPARAM("PageNumber"));
1728cdf0e10cSrcweir 		if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr))
1729cdf0e10cSrcweir 		{
1730cdf0e10cSrcweir 			sal_Int32 nPageNumber = 0;
1731cdf0e10cSrcweir 			xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber;
1732cdf0e10cSrcweir 			if( nPageNumber )
1733cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_PAGE_NUMBER, OUString::valueOf(nPageNumber));
1734cdf0e10cSrcweir 		}
1735cdf0e10cSrcweir 
1736cdf0e10cSrcweir 		// a presentation page shape, normally used on notes pages only. If
1737cdf0e10cSrcweir 		// it is used not as presentation shape, it may have been created with
1738cdf0e10cSrcweir 		// copy-paste exchange between draw and impress (this IS possible...)
1739cdf0e10cSrcweir 		if(eShapeType == XmlShapeTypePresPageShape)
1740cdf0e10cSrcweir 		{
1741cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS,
1742cdf0e10cSrcweir                                  XML_PRESENTATION_PAGE);
1743cdf0e10cSrcweir 		}
1744cdf0e10cSrcweir 
1745cdf0e10cSrcweir 		// write Page shape
1746cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1747cdf0e10cSrcweir 		SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, bCreateNewline, sal_True);
1748cdf0e10cSrcweir 	}
1749cdf0e10cSrcweir }
1750cdf0e10cSrcweir 
1751cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1752cdf0e10cSrcweir 
1753cdf0e10cSrcweir void XMLShapeExport::ImpExportCaptionShape(
1754cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1755cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */)
1756cdf0e10cSrcweir {
1757cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1758cdf0e10cSrcweir 	if(xPropSet.is())
1759cdf0e10cSrcweir 	{
1760cdf0e10cSrcweir 		// Transformation
1761cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1762cdf0e10cSrcweir 
1763cdf0e10cSrcweir 		// evtl. corner radius?
1764cdf0e10cSrcweir 		sal_Int32 nCornerRadius(0L);
1765cdf0e10cSrcweir 		xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius;
1766cdf0e10cSrcweir 		if(nCornerRadius)
1767cdf0e10cSrcweir 		{
1768cdf0e10cSrcweir 			OUStringBuffer sStringBuffer;
1769cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius);
1770cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear());
1771cdf0e10cSrcweir 		}
1772cdf0e10cSrcweir 
1773cdf0e10cSrcweir 		awt::Point aCaptionPoint;
1774cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ) ) ) >>= aCaptionPoint;
1775cdf0e10cSrcweir 
1776cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.X);
1777cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() );
1778cdf0e10cSrcweir 		mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.Y);
1779cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() );
1780cdf0e10cSrcweir 
1781cdf0e10cSrcweir 		// write Caption shape. Add export later.
1782cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1783cdf0e10cSrcweir 		sal_Bool bAnnotation( (nFeatures & SEF_EXPORT_ANNOTATION) == SEF_EXPORT_ANNOTATION );
1784cdf0e10cSrcweir 
1785cdf0e10cSrcweir         SvXMLElementExport aObj( mrExport,
1786cdf0e10cSrcweir 								 (bAnnotation ? XML_NAMESPACE_OFFICE
1787cdf0e10cSrcweir 								 			  : XML_NAMESPACE_DRAW),
1788cdf0e10cSrcweir 								 (bAnnotation ?	XML_ANNOTATION : XML_CAPTION),
1789cdf0e10cSrcweir 								 bCreateNewline, sal_True );
1790cdf0e10cSrcweir 
1791cdf0e10cSrcweir 		ImpExportDescription( xShape ); // #i68101#
1792cdf0e10cSrcweir 		ImpExportEvents( xShape );
1793cdf0e10cSrcweir 		ImpExportGluePoints( xShape );
1794cdf0e10cSrcweir 		if( bAnnotation )
1795cdf0e10cSrcweir 			mrExport.exportAnnotationMeta( xShape );
1796cdf0e10cSrcweir 		ImpExportText( xShape );
1797cdf0e10cSrcweir 	}
1798cdf0e10cSrcweir }
1799cdf0e10cSrcweir 
1800cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1801cdf0e10cSrcweir 
1802cdf0e10cSrcweir void XMLShapeExport::ImpExportFrameShape(
1803cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1804cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1805cdf0e10cSrcweir {
1806cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1807cdf0e10cSrcweir 	if(xPropSet.is())
1808cdf0e10cSrcweir 	{
1809cdf0e10cSrcweir 		// Transformation
1810cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1811cdf0e10cSrcweir 
1812cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1813cdf0e10cSrcweir 		SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
1814cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1815cdf0e10cSrcweir 
1816cdf0e10cSrcweir 		// export frame url
1817cdf0e10cSrcweir 		OUString aStr;
1818cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameURL" ) ) ) >>= aStr;
1819cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1820cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1821cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1822cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1823cdf0e10cSrcweir 
1824cdf0e10cSrcweir 		// export name
1825cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameName" ) ) ) >>= aStr;
1826cdf0e10cSrcweir 		if( aStr.getLength() )
1827cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr );
1828cdf0e10cSrcweir 
1829cdf0e10cSrcweir 		// write floating frame
1830cdf0e10cSrcweir 		{
1831cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, sal_True, sal_True);
1832cdf0e10cSrcweir 		}
1833cdf0e10cSrcweir 	}
1834cdf0e10cSrcweir }
1835cdf0e10cSrcweir 
1836cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1837cdf0e10cSrcweir 
1838cdf0e10cSrcweir void XMLShapeExport::ImpExportAppletShape(
1839cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1840cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1841cdf0e10cSrcweir {
1842cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1843cdf0e10cSrcweir 	if(xPropSet.is())
1844cdf0e10cSrcweir 	{
1845cdf0e10cSrcweir 		// Transformation
1846cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1847cdf0e10cSrcweir 
1848cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1849cdf0e10cSrcweir 		SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1850cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1851cdf0e10cSrcweir 
1852cdf0e10cSrcweir 		// export frame url
1853cdf0e10cSrcweir 		OUString aStr;
1854cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCodeBase" ) ) ) >>= aStr;
1855cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1856cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1857cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1858cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1859cdf0e10cSrcweir 
1860cdf0e10cSrcweir 		// export draw:applet-name
1861cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletName" ) ) ) >>= aStr;
1862cdf0e10cSrcweir 		if( aStr.getLength() )
1863cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr );
1864cdf0e10cSrcweir 
1865cdf0e10cSrcweir 		// export draw:code
1866cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCode" ) ) ) >>= aStr;
1867cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr );
1868cdf0e10cSrcweir 
1869cdf0e10cSrcweir 		// export draw:may-script
1870cdf0e10cSrcweir 		sal_Bool bIsScript = false;
1871cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletIsScript" ) ) ) >>= bIsScript;
1872cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bIsScript ? XML_TRUE : XML_FALSE );
1873cdf0e10cSrcweir 
1874cdf0e10cSrcweir 		{
1875cdf0e10cSrcweir 			// write applet
1876cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_APPLET, sal_True, sal_True);
1877cdf0e10cSrcweir 
1878cdf0e10cSrcweir 			// export parameters
1879cdf0e10cSrcweir 			uno::Sequence< beans::PropertyValue > aCommands;
1880cdf0e10cSrcweir 			xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCommands" ) ) ) >>= aCommands;
1881cdf0e10cSrcweir 			const sal_Int32 nCount = aCommands.getLength();
1882cdf0e10cSrcweir 			for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
1883cdf0e10cSrcweir 			{
1884cdf0e10cSrcweir 				aCommands[nIndex].Value >>= aStr;
1885cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
1886cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
1887cdf0e10cSrcweir 				SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
1888cdf0e10cSrcweir 			}
1889cdf0e10cSrcweir 		}
1890cdf0e10cSrcweir 	}
1891cdf0e10cSrcweir }
1892cdf0e10cSrcweir 
1893cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1894cdf0e10cSrcweir 
1895cdf0e10cSrcweir void XMLShapeExport::ImpExportPluginShape(
1896cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1897cdf0e10cSrcweir 	XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1898cdf0e10cSrcweir {
1899cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1900cdf0e10cSrcweir 	if(xPropSet.is())
1901cdf0e10cSrcweir 	{
1902cdf0e10cSrcweir 		// Transformation
1903cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1904cdf0e10cSrcweir 
1905cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1906cdf0e10cSrcweir 		SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW,
1907cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1908cdf0e10cSrcweir 
1909cdf0e10cSrcweir 		// export plugin url
1910cdf0e10cSrcweir 		OUString aStr;
1911cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginURL" ) ) ) >>= aStr;
1912cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) );
1913cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1914cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1915cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1916cdf0e10cSrcweir 
1917cdf0e10cSrcweir 
1918cdf0e10cSrcweir 		// export mime-type
1919cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginMimeType" ) ) ) >>= aStr;
1920cdf0e10cSrcweir 		if(aStr.getLength())
1921cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr );
1922cdf0e10cSrcweir 
1923cdf0e10cSrcweir 		{
1924cdf0e10cSrcweir 			// write plugin
1925cdf0e10cSrcweir 			SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, sal_True, sal_True);
1926cdf0e10cSrcweir 
1927cdf0e10cSrcweir 			// export parameters
1928cdf0e10cSrcweir 			uno::Sequence< beans::PropertyValue > aCommands;
1929cdf0e10cSrcweir 			xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginCommands" ) ) ) >>= aCommands;
1930cdf0e10cSrcweir 			const sal_Int32 nCount = aCommands.getLength();
1931cdf0e10cSrcweir 			for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
1932cdf0e10cSrcweir 			{
1933cdf0e10cSrcweir 				aCommands[nIndex].Value >>= aStr;
1934cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name );
1935cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr );
1936cdf0e10cSrcweir 				SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True );
1937cdf0e10cSrcweir 			}
1938cdf0e10cSrcweir 		}
1939cdf0e10cSrcweir 	}
1940cdf0e10cSrcweir }
1941cdf0e10cSrcweir 
1942cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1943cdf0e10cSrcweir 
1944cdf0e10cSrcweir void XMLShapeExport::ImpExportMediaShape(
1945cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xShape,
1946cdf0e10cSrcweir 	XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint)
1947cdf0e10cSrcweir {
1948cdf0e10cSrcweir 	const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
1949cdf0e10cSrcweir 	if(xPropSet.is())
1950cdf0e10cSrcweir 	{
1951cdf0e10cSrcweir 		// Transformation
1952cdf0e10cSrcweir 		ImpExportNewTrans(xPropSet, nFeatures, pRefPoint);
1953cdf0e10cSrcweir 
1954cdf0e10cSrcweir 		if(eShapeType == XmlShapeTypePresMediaShape)
1955cdf0e10cSrcweir 			ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) );
1956cdf0e10cSrcweir 
1957cdf0e10cSrcweir 		sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
1958cdf0e10cSrcweir 		SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW,
1959cdf0e10cSrcweir 								  XML_FRAME, bCreateNewline, sal_True );
1960cdf0e10cSrcweir 
1961cdf0e10cSrcweir 		// export media url
1962cdf0e10cSrcweir 		OUString aMediaURL;
1963cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ) ) >>= aMediaURL;
1964cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( aMediaURL ) );
1965cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1966cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
1967cdf0e10cSrcweir         mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD );
1968cdf0e10cSrcweir 
1969cdf0e10cSrcweir 		// export mime-type
1970cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.media" ) ) );
1971cdf0e10cSrcweir 
1972cdf0e10cSrcweir 		// write plugin
1973cdf0e10cSrcweir 		SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & SEF_EXPORT_NO_WS ), sal_True);
1974cdf0e10cSrcweir 
1975cdf0e10cSrcweir 		// export parameters
1976cdf0e10cSrcweir 		const OUString aFalseStr( RTL_CONSTASCII_USTRINGPARAM( "false" ) ), aTrueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
1977cdf0e10cSrcweir 
1978cdf0e10cSrcweir 		sal_Bool bLoop = false;
1979cdf0e10cSrcweir 		const OUString aLoopStr( RTL_CONSTASCII_USTRINGPARAM( "Loop" ) );
1980cdf0e10cSrcweir 		xPropSet->getPropertyValue( aLoopStr ) >>= bLoop;
1981cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr );
1982cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr );
1983cdf0e10cSrcweir 		delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
1984cdf0e10cSrcweir 
1985cdf0e10cSrcweir 		sal_Bool bMute = false;
1986cdf0e10cSrcweir 		const OUString aMuteStr( RTL_CONSTASCII_USTRINGPARAM( "Mute" ) );
1987cdf0e10cSrcweir 		xPropSet->getPropertyValue( aMuteStr ) >>= bMute;
1988cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr );
1989cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr );
1990cdf0e10cSrcweir 		delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
1991cdf0e10cSrcweir 
1992cdf0e10cSrcweir 		sal_Int16 nVolumeDB = 0;
1993cdf0e10cSrcweir 		const OUString aVolumeDBStr( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) );
1994cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ) ) >>= nVolumeDB;
1995cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr );
1996cdf0e10cSrcweir 		mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::valueOf( static_cast< sal_Int32 >( nVolumeDB ) ) );
1997cdf0e10cSrcweir 		delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
1998cdf0e10cSrcweir 
1999cdf0e10cSrcweir 		media::ZoomLevel eZoom;
2000cdf0e10cSrcweir 		const OUString aZoomStr( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) );
2001cdf0e10cSrcweir 		OUString aZoomValue;
2002cdf0e10cSrcweir 		xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ) ) >>= eZoom;
2003cdf0e10cSrcweir 		switch( eZoom )
2004cdf0e10cSrcweir 		{
2005cdf0e10cSrcweir 			case( media::ZoomLevel_ZOOM_1_TO_4 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "25%" ) ); break;
2006cdf0e10cSrcweir 			case( media::ZoomLevel_ZOOM_1_TO_2 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "50%" ) ); break;
2007cdf0e10cSrcweir 			case( media::ZoomLevel_ORIGINAL ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "100%" ) ); break;
2008cdf0e10cSrcweir 			case( media::ZoomLevel_ZOOM_2_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "200%" ) ); break;
2009cdf0e10cSrcweir 			case( media::ZoomLevel_ZOOM_4_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "400%" ) ); break;
2010cdf0e10cSrcweir 		    case( media::ZoomLevel_FIT_TO_WINDOW ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fit" ) ); break;
2011cdf0e10cSrcweir 		    case( media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fixedfit" ) ); break;
2012cdf0e10cSrcweir 		    case( media::ZoomLevel_FULLSCREEN ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fullscreen" ) ); break;
2013cdf0e10cSrcweir 
2014cdf0e10cSrcweir 			default:
2015cdf0e10cSrcweir 			break;
2016cdf0e10cSrcweir 		}
2017cdf0e10cSrcweir 
2018cdf0e10cSrcweir 		if( aZoomValue.getLength() )
2019cdf0e10cSrcweir 		{
2020cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr );
2021cdf0e10cSrcweir 			mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue );
2022cdf0e10cSrcweir 			delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) );
2023cdf0e10cSrcweir 		}
2024cdf0e10cSrcweir 	}
2025cdf0e10cSrcweir }
2026