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