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