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