LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/xmloff/source/draw - shapeexport2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 217 1073 20.2 %
Date: 2013-07-09 Functions: 11 28 39.3 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10