1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <tools/debug.hxx> 34*cdf0e10cSrcweir #include <com/sun/star/document/XEventsSupplier.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/container/XNameReplace.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/drawing/FillStyle.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/drawing/LineStyle.hpp> 39*cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx" 40*cdf0e10cSrcweir #include <com/sun/star/drawing/XGluePointsSupplier.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/container/XIdentifierAccess.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/drawing/GluePoint2.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/drawing/Alignment.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/drawing/EscapeDirection.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/media/ZoomLevel.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp> 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 50*cdf0e10cSrcweir #include <comphelper/extract.hxx> 51*cdf0e10cSrcweir #include "ximpshap.hxx" 52*cdf0e10cSrcweir #include <xmloff/XMLBase64ImportContext.hxx> 53*cdf0e10cSrcweir #include <xmloff/XMLShapeStyleContext.hxx> 54*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx> 55*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 56*cdf0e10cSrcweir #include <com/sun/star/drawing/CircleKind.hpp> 57*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 58*cdf0e10cSrcweir #include <com/sun/star/awt/XControlModel.hpp> 59*cdf0e10cSrcweir #include <com/sun/star/drawing/XControlShape.hpp> 60*cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequenceSequence.hpp> 61*cdf0e10cSrcweir #include <com/sun/star/drawing/PointSequence.hpp> 62*cdf0e10cSrcweir #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> 63*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 64*cdf0e10cSrcweir #include <com/sun/star/util/XCloneable.hpp> 65*cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertyStates.hpp> 66*cdf0e10cSrcweir #include "xexptran.hxx" 67*cdf0e10cSrcweir #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> 68*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp> 69*cdf0e10cSrcweir #include <com/sun/star/drawing/ConnectorType.hpp> 70*cdf0e10cSrcweir #include <com/sun/star/drawing/HomogenMatrix3.hpp> 71*cdf0e10cSrcweir #include "PropertySetMerger.hxx" 72*cdf0e10cSrcweir #include <xmloff/families.hxx> 73*cdf0e10cSrcweir #include "ximpstyl.hxx" 74*cdf0e10cSrcweir #include"xmloff/xmlnmspe.hxx" 75*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 76*cdf0e10cSrcweir #include "EnhancedCustomShapeToken.hxx" 77*cdf0e10cSrcweir #include "XMLReplacementImageContext.hxx" 78*cdf0e10cSrcweir #include "XMLImageMapContext.hxx" 79*cdf0e10cSrcweir #include "sdpropls.hxx" 80*cdf0e10cSrcweir #include "eventimp.hxx" 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir #include "descriptionimp.hxx" 83*cdf0e10cSrcweir #include "ximpcustomshape.hxx" 84*cdf0e10cSrcweir #include "XMLEmbeddedObjectImportContext.hxx" 85*cdf0e10cSrcweir #include "xmloff/xmlerror.hxx" 86*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 87*cdf0e10cSrcweir #include <tools/string.hxx> 88*cdf0e10cSrcweir #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp> 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir // --> OD 2006-02-22 #b6382898# 91*cdf0e10cSrcweir #include <com/sun/star/text/XTextDocument.hpp> 92*cdf0e10cSrcweir // <-- 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir using ::rtl::OUString; 95*cdf0e10cSrcweir using ::rtl::OUStringBuffer; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir using namespace ::com::sun::star; 98*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 99*cdf0e10cSrcweir using namespace ::com::sun::star::drawing; 100*cdf0e10cSrcweir using namespace ::com::sun::star::style; 101*cdf0e10cSrcweir using namespace ::com::sun::star::container; 102*cdf0e10cSrcweir using namespace ::com::sun::star::document; 103*cdf0e10cSrcweir using namespace ::xmloff::token; 104*cdf0e10cSrcweir using namespace ::xmloff::EnhancedCustomShapeToken; 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[] = 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir { XML_TOP_LEFT, drawing::Alignment_TOP_LEFT }, 109*cdf0e10cSrcweir { XML_TOP, drawing::Alignment_TOP }, 110*cdf0e10cSrcweir { XML_TOP_RIGHT, drawing::Alignment_TOP_RIGHT }, 111*cdf0e10cSrcweir { XML_LEFT, drawing::Alignment_LEFT }, 112*cdf0e10cSrcweir { XML_CENTER, drawing::Alignment_CENTER }, 113*cdf0e10cSrcweir { XML_RIGHT, drawing::Alignment_RIGHT }, 114*cdf0e10cSrcweir { XML_BOTTOM_LEFT, drawing::Alignment_BOTTOM_LEFT }, 115*cdf0e10cSrcweir { XML_BOTTOM, drawing::Alignment_BOTTOM }, 116*cdf0e10cSrcweir { XML_BOTTOM_RIGHT, drawing::Alignment_BOTTOM_RIGHT }, 117*cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 } 118*cdf0e10cSrcweir }; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[] = 121*cdf0e10cSrcweir { 122*cdf0e10cSrcweir { XML_AUTO, drawing::EscapeDirection_SMART }, 123*cdf0e10cSrcweir { XML_LEFT, drawing::EscapeDirection_LEFT }, 124*cdf0e10cSrcweir { XML_RIGHT, drawing::EscapeDirection_RIGHT }, 125*cdf0e10cSrcweir { XML_UP, drawing::EscapeDirection_UP }, 126*cdf0e10cSrcweir { XML_DOWN, drawing::EscapeDirection_DOWN }, 127*cdf0e10cSrcweir { XML_HORIZONTAL, drawing::EscapeDirection_HORIZONTAL }, 128*cdf0e10cSrcweir { XML_VERTICAL, drawing::EscapeDirection_VERTICAL }, 129*cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 } 130*cdf0e10cSrcweir }; 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir static bool ImpIsEmptyURL( const ::rtl::OUString& rURL ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir if( rURL.getLength() == 0 ) 137*cdf0e10cSrcweir return true; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir // #i13140# Also compare against 'toplevel' URLs. which also 140*cdf0e10cSrcweir // result in empty filename strings. 141*cdf0e10cSrcweir if( 0 == rURL.compareToAscii( "#./" ) ) 142*cdf0e10cSrcweir return true; 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir return false; 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir TYPEINIT1( SvXMLShapeContext, SvXMLImportContext ); 150*cdf0e10cSrcweir TYPEINIT1( SdXMLShapeContext, SvXMLShapeContext ); 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir SdXMLShapeContext::SdXMLShapeContext( 153*cdf0e10cSrcweir SvXMLImport& rImport, 154*cdf0e10cSrcweir sal_uInt16 nPrfx, 155*cdf0e10cSrcweir const OUString& rLocalName, 156*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 157*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 158*cdf0e10cSrcweir sal_Bool bTemporaryShape) 159*cdf0e10cSrcweir : SvXMLShapeContext( rImport, nPrfx, rLocalName, bTemporaryShape ) 160*cdf0e10cSrcweir , mxShapes( rShapes ) 161*cdf0e10cSrcweir , mxAttrList(xAttrList) 162*cdf0e10cSrcweir , mbListContextPushed( false ) 163*cdf0e10cSrcweir , mnStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_ID) 164*cdf0e10cSrcweir , mbIsPlaceholder(sal_False) 165*cdf0e10cSrcweir , mbClearDefaultAttributes( true ) 166*cdf0e10cSrcweir , mbIsUserTransformed(sal_False) 167*cdf0e10cSrcweir , mnZOrder(-1) 168*cdf0e10cSrcweir , maSize(1, 1) 169*cdf0e10cSrcweir , maPosition(0, 0) 170*cdf0e10cSrcweir , mbVisible(true) 171*cdf0e10cSrcweir , mbPrintable(true) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir SdXMLShapeContext::~SdXMLShapeContext() 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir SvXMLImportContext *SdXMLShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, 184*cdf0e10cSrcweir const OUString& rLocalName, 185*cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList>& xAttrList ) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir SvXMLImportContext * pContext = NULL; 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir // #i68101# 190*cdf0e10cSrcweir if( p_nPrefix == XML_NAMESPACE_SVG && 191*cdf0e10cSrcweir (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir pContext = new SdXMLDescriptionContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape ); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir else if( p_nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir pContext = new SdXMLEventsContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape ); 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir addGluePoint( xAttrList ); 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir else if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_THUMBNAIL ) ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir // search attributes for xlink:href 206*cdf0e10cSrcweir sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 207*cdf0e10cSrcweir for(sal_Int16 i=0; i < nAttrCount; i++) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir OUString sAttrName = xAttrList->getNameByIndex( i ); 210*cdf0e10cSrcweir OUString aLocalName; 211*cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_XLINK ) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir if( IsXMLToken( aLocalName, XML_HREF ) ) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir maThumbnailURL = xAttrList->getValueByIndex( i ); 218*cdf0e10cSrcweir break; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir else 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir // create text cursor on demand 226*cdf0e10cSrcweir if( !mxCursor.is() ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY ); 229*cdf0e10cSrcweir if( xText.is() ) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir UniReference < XMLTextImportHelper > xTxtImport = 232*cdf0e10cSrcweir GetImport().GetTextImport(); 233*cdf0e10cSrcweir mxOldCursor = xTxtImport->GetCursor(); 234*cdf0e10cSrcweir mxCursor = xText->createTextCursor(); 235*cdf0e10cSrcweir if( mxCursor.is() ) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir xTxtImport->SetCursor( mxCursor ); 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir // remember old list item and block (#91964#) and reset them 241*cdf0e10cSrcweir // for the text frame 242*cdf0e10cSrcweir xTxtImport->PushListContext(); 243*cdf0e10cSrcweir mbListContextPushed = true; 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir // if we have a text cursor, lets try to import some text 248*cdf0e10cSrcweir if( mxCursor.is() ) 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir pContext = GetImport().GetTextImport()->CreateTextChildContext( 251*cdf0e10cSrcweir GetImport(), p_nPrefix, rLocalName, xAttrList ); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir // call parent for content 256*cdf0e10cSrcweir if(!pContext) 257*cdf0e10cSrcweir pContext = SvXMLImportContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList ); 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir return pContext; 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XAttributeList>& xAttrList ) 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir // get the glue points container for this shape if its not already there 265*cdf0e10cSrcweir if( !mxGluePoints.is() ) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir uno::Reference< drawing::XGluePointsSupplier > xSupplier( mxShape, uno::UNO_QUERY ); 268*cdf0e10cSrcweir if( !xSupplier.is() ) 269*cdf0e10cSrcweir return; 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir mxGluePoints = uno::Reference< container::XIdentifierContainer >::query( xSupplier->getGluePoints() ); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir if( !mxGluePoints.is() ) 274*cdf0e10cSrcweir return; 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir drawing::GluePoint2 aGluePoint; 278*cdf0e10cSrcweir aGluePoint.IsUserDefined = sal_True; 279*cdf0e10cSrcweir aGluePoint.Position.X = 0; 280*cdf0e10cSrcweir aGluePoint.Position.Y = 0; 281*cdf0e10cSrcweir aGluePoint.Escape = drawing::EscapeDirection_SMART; 282*cdf0e10cSrcweir aGluePoint.PositionAlignment = drawing::Alignment_CENTER; 283*cdf0e10cSrcweir aGluePoint.IsRelative = sal_True; 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir sal_Int32 nId = -1; 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir // read attributes for the 3DScene 288*cdf0e10cSrcweir sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 289*cdf0e10cSrcweir for(sal_Int16 i=0; i < nAttrCount; i++) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir OUString sAttrName = xAttrList->getNameByIndex( i ); 292*cdf0e10cSrcweir OUString aLocalName; 293*cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 294*cdf0e10cSrcweir const OUString sValue( xAttrList->getValueByIndex( i ) ); 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_SVG ) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir if( IsXMLToken( aLocalName, XML_X ) ) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(aGluePoint.Position.X, sValue); 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir else if( IsXMLToken( aLocalName, XML_Y ) ) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(aGluePoint.Position.Y, sValue); 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir } 307*cdf0e10cSrcweir else if( nPrefix == XML_NAMESPACE_DRAW ) 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir if( IsXMLToken( aLocalName, XML_ID ) ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir nId = sValue.toInt32(); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir else if( IsXMLToken( aLocalName, XML_ALIGN ) ) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir sal_uInt16 eKind; 316*cdf0e10cSrcweir if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueAlignment_EnumMap ) ) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir aGluePoint.PositionAlignment = (drawing::Alignment)eKind; 319*cdf0e10cSrcweir aGluePoint.IsRelative = sal_False; 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir else if( IsXMLToken( aLocalName, XML_ESCAPE_DIRECTION ) ) 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir sal_uInt16 eKind; 325*cdf0e10cSrcweir if( SvXMLUnitConverter::convertEnum( eKind, sValue, aXML_GlueEscapeDirection_EnumMap ) ) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir aGluePoint.Escape = (drawing::EscapeDirection)eKind; 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir if( nId != -1 ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir try 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir sal_Int32 nInternalId = mxGluePoints->insert( uno::makeAny( aGluePoint ) ); 338*cdf0e10cSrcweir GetImport().GetShapeImport()->addGluePointMapping( mxShape, nId, nInternalId ); 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir catch( uno::Exception& ) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir DBG_ERROR( "exception during setting of glue points!"); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 347*cdf0e10cSrcweir 348*cdf0e10cSrcweir void SdXMLShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir void SdXMLShapeContext::EndElement() 354*cdf0e10cSrcweir { 355*cdf0e10cSrcweir if(mxCursor.is()) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir // delete addition newline 358*cdf0e10cSrcweir const OUString aEmpty; 359*cdf0e10cSrcweir mxCursor->gotoEnd( sal_False ); 360*cdf0e10cSrcweir mxCursor->goLeft( 1, sal_True ); 361*cdf0e10cSrcweir mxCursor->setString( aEmpty ); 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir // reset cursor 364*cdf0e10cSrcweir GetImport().GetTextImport()->ResetCursor(); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir if(mxOldCursor.is()) 368*cdf0e10cSrcweir GetImport().GetTextImport()->SetCursor( mxOldCursor ); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir // reinstall old list item (if necessary) #91964# 371*cdf0e10cSrcweir if (mbListContextPushed) { 372*cdf0e10cSrcweir GetImport().GetTextImport()->PopListContext(); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir if( msHyperlink.getLength() != 0 ) try 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir const OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ); 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY ); 380*cdf0e10cSrcweir if( xEventsSupplier.is() ) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir const OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) ); 383*cdf0e10cSrcweir const OUString sClickAction( RTL_CONSTASCII_USTRINGPARAM( "ClickAction" ) ); 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW ); 386*cdf0e10cSrcweir 387*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aProperties( 3 ); 388*cdf0e10cSrcweir aProperties[0].Name = sEventType; 389*cdf0e10cSrcweir aProperties[0].Handle = -1; 390*cdf0e10cSrcweir aProperties[0].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM("Presentation") ); 391*cdf0e10cSrcweir aProperties[0].State = beans::PropertyState_DIRECT_VALUE; 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir aProperties[1].Name = sClickAction; 394*cdf0e10cSrcweir aProperties[1].Handle = -1; 395*cdf0e10cSrcweir aProperties[1].Value <<= ::com::sun::star::presentation::ClickAction_DOCUMENT; 396*cdf0e10cSrcweir aProperties[1].State = beans::PropertyState_DIRECT_VALUE; 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir aProperties[2].Name = sBookmark; 399*cdf0e10cSrcweir aProperties[2].Handle = -1; 400*cdf0e10cSrcweir aProperties[2].Value <<= msHyperlink; 401*cdf0e10cSrcweir aProperties[2].State = beans::PropertyState_DIRECT_VALUE; 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir const OUString sAPIEventName( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ); 404*cdf0e10cSrcweir xEvents->replaceByName( sAPIEventName, Any( aProperties ) ); 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir else 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir // in draw use the Bookmark property 409*cdf0e10cSrcweir Reference< beans::XPropertySet > xSet( mxShape, UNO_QUERY_THROW ); 410*cdf0e10cSrcweir xSet->setPropertyValue( sBookmark, Any( msHyperlink ) ); 411*cdf0e10cSrcweir xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ), Any( ::com::sun::star::presentation::ClickAction_DOCUMENT ) ); 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir catch( Exception& ) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir DBG_ERROR("xmloff::SdXMLShapeContext::EndElement(), exception caught while setting hyperlink!"); 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir if( mxLockable.is() ) 420*cdf0e10cSrcweir mxLockable->removeActionLock(); 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape) 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir if(xShape.is()) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir // set shape local 430*cdf0e10cSrcweir mxShape = xShape; 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir if(maShapeName.getLength()) 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir uno::Reference< container::XNamed > xNamed( mxShape, uno::UNO_QUERY ); 435*cdf0e10cSrcweir if( xNamed.is() ) 436*cdf0e10cSrcweir xNamed->setName( maShapeName ); 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir UniReference< XMLShapeImportHelper > xImp( GetImport().GetShapeImport() ); 440*cdf0e10cSrcweir xImp->addShape( xShape, mxAttrList, mxShapes ); 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir if( mbClearDefaultAttributes ) 443*cdf0e10cSrcweir { 444*cdf0e10cSrcweir uno::Reference<beans::XMultiPropertyStates> xMultiPropertyStates(xShape, uno::UNO_QUERY ); 445*cdf0e10cSrcweir if (xMultiPropertyStates.is()) 446*cdf0e10cSrcweir xMultiPropertyStates->setAllPropertiesToDefault(); 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir if( !mbVisible || !mbPrintable ) try 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY_THROW ); 452*cdf0e10cSrcweir if( !mbVisible ) 453*cdf0e10cSrcweir xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ), uno::Any( sal_False ) ); 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir if( !mbPrintable ) 456*cdf0e10cSrcweir xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) ), uno::Any( sal_False ) ); 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir catch( Exception& ) 459*cdf0e10cSrcweir { 460*cdf0e10cSrcweir DBG_ERROR( "SdXMLShapeContext::AddShape(), exception caught!" ); 461*cdf0e10cSrcweir } 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir // #107848# 464*cdf0e10cSrcweir if(!mbTemporaryShape && (!GetImport().HasTextImport() 465*cdf0e10cSrcweir || !GetImport().GetTextImport()->IsInsideDeleteContext())) 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir xImp->shapeWithZIndexAdded( xShape, mnZOrder ); 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir if( maShapeId.getLength() ) 471*cdf0e10cSrcweir { 472*cdf0e10cSrcweir uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY ); 473*cdf0e10cSrcweir GetImport().getInterfaceToIdentifierMapper().registerReference( maShapeId, xRef ); 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir 476*cdf0e10cSrcweir // #91065# count only if counting for shape import is enabled 477*cdf0e10cSrcweir if(GetImport().GetShapeImport()->IsHandleProgressBarEnabled()) 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir // #80365# increment progress bar at load once for each draw object 480*cdf0e10cSrcweir GetImport().GetProgressBarHelper()->Increment(); 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir } 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir mxLockable = uno::Reference< document::XActionLockable >::query( xShape ); 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir if( mxLockable.is() ) 487*cdf0e10cSrcweir mxLockable->addActionLock(); 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir void SdXMLShapeContext::AddShape(const char* pServiceName ) 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); 496*cdf0e10cSrcweir if(xServiceFact.is()) 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir try 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir // --> OD 2006-02-22 #b6382898# 501*cdf0e10cSrcweir // Since fix for issue i33294 the Writer model doesn't support 502*cdf0e10cSrcweir // com.sun.star.drawing.OLE2Shape anymore. 503*cdf0e10cSrcweir // To handle Draw OLE objects it's decided to import these 504*cdf0e10cSrcweir // objects as com.sun.star.drawing.OLE2Shape and convert these 505*cdf0e10cSrcweir // objects after the import into com.sun.star.drawing.GraphicObjectShape. 506*cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape; 507*cdf0e10cSrcweir if ( OUString::createFromAscii(pServiceName).compareToAscii( "com.sun.star.drawing.OLE2Shape" ) == 0 && 508*cdf0e10cSrcweir uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() ) 509*cdf0e10cSrcweir { 510*cdf0e10cSrcweir xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance(OUString::createFromAscii("com.sun.star.drawing.temporaryForXMLImportOLE2Shape")), uno::UNO_QUERY); 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir else 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir xShape = uno::Reference< drawing::XShape >(xServiceFact->createInstance(OUString::createFromAscii(pServiceName)), uno::UNO_QUERY); 515*cdf0e10cSrcweir } 516*cdf0e10cSrcweir // <-- 517*cdf0e10cSrcweir if( xShape.is() ) 518*cdf0e10cSrcweir AddShape( xShape ); 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir catch( const uno::Exception& e ) 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir uno::Sequence<rtl::OUString> aSeq( 1 ); 523*cdf0e10cSrcweir aSeq[0] = OUString::createFromAscii(pServiceName); 524*cdf0e10cSrcweir GetImport().SetError( XMLERROR_FLAG_ERROR | XMLERROR_API, 525*cdf0e10cSrcweir aSeq, e.Message, NULL ); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir } 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir void SdXMLShapeContext::SetTransformation() 533*cdf0e10cSrcweir { 534*cdf0e10cSrcweir if(mxShape.is()) 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 537*cdf0e10cSrcweir if(xPropSet.is()) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir ::basegfx::B2DHomMatrix aTransformation; 540*cdf0e10cSrcweir 541*cdf0e10cSrcweir if(maSize.Width != 1 || maSize.Height != 1) 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir // take care there are no zeros used by error 544*cdf0e10cSrcweir if(0 == maSize.Width) 545*cdf0e10cSrcweir maSize.Width = 1; 546*cdf0e10cSrcweir if(0 == maSize.Height) 547*cdf0e10cSrcweir maSize.Height = 1; 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir // set global size. This should always be used. 550*cdf0e10cSrcweir aTransformation.scale(maSize.Width, maSize.Height); 551*cdf0e10cSrcweir } 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir if(maPosition.X != 0 || maPosition.Y != 0) 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir // if global position is used, add it to transformation 556*cdf0e10cSrcweir aTransformation.translate(maPosition.X, maPosition.Y); 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir if(mnTransform.NeedsAction()) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir // transformation is used, apply to object. 562*cdf0e10cSrcweir // NOTICE: The transformation is applied AFTER evtl. used 563*cdf0e10cSrcweir // global positioning and scaling is used, so any shear or 564*cdf0e10cSrcweir // rotate used herein is applied around the (0,0) position 565*cdf0e10cSrcweir // of the PAGE object !!! 566*cdf0e10cSrcweir ::basegfx::B2DHomMatrix aMat; 567*cdf0e10cSrcweir mnTransform.GetFullTransform(aMat); 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir // now add to transformation 570*cdf0e10cSrcweir aTransformation *= aMat; 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir 573*cdf0e10cSrcweir // now set transformation for this object 574*cdf0e10cSrcweir uno::Any aAny; 575*cdf0e10cSrcweir drawing::HomogenMatrix3 aMatrix; 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir aMatrix.Line1.Column1 = aTransformation.get(0, 0); 578*cdf0e10cSrcweir aMatrix.Line1.Column2 = aTransformation.get(0, 1); 579*cdf0e10cSrcweir aMatrix.Line1.Column3 = aTransformation.get(0, 2); 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir aMatrix.Line2.Column1 = aTransformation.get(1, 0); 582*cdf0e10cSrcweir aMatrix.Line2.Column2 = aTransformation.get(1, 1); 583*cdf0e10cSrcweir aMatrix.Line2.Column3 = aTransformation.get(1, 2); 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir aMatrix.Line3.Column1 = aTransformation.get(2, 0); 586*cdf0e10cSrcweir aMatrix.Line3.Column2 = aTransformation.get(2, 1); 587*cdf0e10cSrcweir aMatrix.Line3.Column3 = aTransformation.get(2, 2); 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir aAny <<= aMatrix; 590*cdf0e10cSrcweir 591*cdf0e10cSrcweir xPropSet->setPropertyValue( 592*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation")), aAny); 593*cdf0e10cSrcweir } 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir } 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) 600*cdf0e10cSrcweir { 601*cdf0e10cSrcweir try 602*cdf0e10cSrcweir { 603*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 604*cdf0e10cSrcweir if( !xPropSet.is() ) 605*cdf0e10cSrcweir return; 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir do 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir XMLPropStyleContext* pDocStyle = NULL; 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir // set style on shape 612*cdf0e10cSrcweir if(maDrawStyleName.getLength() == 0) 613*cdf0e10cSrcweir break; 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir const SvXMLStyleContext* pStyle = 0L; 616*cdf0e10cSrcweir sal_Bool bAutoStyle(sal_False); 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir if(GetImport().GetShapeImport()->GetAutoStylesContext()) 619*cdf0e10cSrcweir pStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName); 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir if(pStyle) 622*cdf0e10cSrcweir bAutoStyle = sal_True; 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir if(!pStyle && GetImport().GetShapeImport()->GetStylesContext()) 625*cdf0e10cSrcweir pStyle = GetImport().GetShapeImport()->GetStylesContext()->FindStyleChildContext(mnStyleFamily, maDrawStyleName); 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir OUString aStyleName = maDrawStyleName; 628*cdf0e10cSrcweir uno::Reference< style::XStyle > xStyle; 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir if( pStyle && pStyle->ISA(XMLShapeStyleContext) ) 631*cdf0e10cSrcweir { 632*cdf0e10cSrcweir pDocStyle = PTR_CAST( XMLShapeStyleContext, pStyle ); 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir if( pDocStyle->GetStyle().is() ) 635*cdf0e10cSrcweir { 636*cdf0e10cSrcweir xStyle = pDocStyle->GetStyle(); 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir else 639*cdf0e10cSrcweir { 640*cdf0e10cSrcweir aStyleName = pDocStyle->GetParentName(); 641*cdf0e10cSrcweir } 642*cdf0e10cSrcweir } 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir if( !xStyle.is() && aStyleName.getLength() ) 645*cdf0e10cSrcweir { 646*cdf0e10cSrcweir try 647*cdf0e10cSrcweir { 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir uno::Reference< style::XStyleFamiliesSupplier > xFamiliesSupplier( GetImport().GetModel(), uno::UNO_QUERY ); 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir if( xFamiliesSupplier.is() ) 652*cdf0e10cSrcweir { 653*cdf0e10cSrcweir uno::Reference< container::XNameAccess > xFamilies( xFamiliesSupplier->getStyleFamilies() ); 654*cdf0e10cSrcweir if( xFamilies.is() ) 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir uno::Reference< container::XNameAccess > xFamily; 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir if( XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily ) 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir aStyleName = GetImport().GetStyleDisplayName( 662*cdf0e10cSrcweir XML_STYLE_FAMILY_SD_PRESENTATION_ID, 663*cdf0e10cSrcweir aStyleName ); 664*cdf0e10cSrcweir sal_Int32 nPos = aStyleName.lastIndexOf( sal_Unicode('-') ); 665*cdf0e10cSrcweir if( -1 != nPos ) 666*cdf0e10cSrcweir { 667*cdf0e10cSrcweir OUString aFamily( aStyleName.copy( 0, nPos ) ); 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir xFamilies->getByName( aFamily ) >>= xFamily; 670*cdf0e10cSrcweir aStyleName = aStyleName.copy( nPos + 1 ); 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir } 673*cdf0e10cSrcweir else 674*cdf0e10cSrcweir { 675*cdf0e10cSrcweir // get graphics familie 676*cdf0e10cSrcweir xFamilies->getByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ) ) >>= xFamily; 677*cdf0e10cSrcweir aStyleName = GetImport().GetStyleDisplayName( 678*cdf0e10cSrcweir XML_STYLE_FAMILY_SD_GRAPHICS_ID, 679*cdf0e10cSrcweir aStyleName ); 680*cdf0e10cSrcweir } 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir if( xFamily.is() ) 683*cdf0e10cSrcweir xFamily->getByName( aStyleName ) >>= xStyle; 684*cdf0e10cSrcweir } 685*cdf0e10cSrcweir } 686*cdf0e10cSrcweir } 687*cdf0e10cSrcweir catch( uno::Exception& ) 688*cdf0e10cSrcweir { 689*cdf0e10cSrcweir DBG_ERROR( "could not find style for shape!" ); 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir if( bSupportsStyle && xStyle.is() ) 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir try 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir // set style on object 698*cdf0e10cSrcweir uno::Any aAny; 699*cdf0e10cSrcweir aAny <<= xStyle; 700*cdf0e10cSrcweir xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny); 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir catch( uno::Exception& ) 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir DBG_ERROR( "could not find style for shape!" ); 705*cdf0e10cSrcweir } 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir // if this is an auto style, set its properties 709*cdf0e10cSrcweir if(bAutoStyle && pDocStyle) 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir // set PropertySet on object 712*cdf0e10cSrcweir pDocStyle->FillPropertySet(xPropSet); 713*cdf0e10cSrcweir } 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir } while(0); 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir // try to set text auto style 718*cdf0e10cSrcweir do 719*cdf0e10cSrcweir { 720*cdf0e10cSrcweir // set style on shape 721*cdf0e10cSrcweir if( 0 == maTextStyleName.getLength() ) 722*cdf0e10cSrcweir break; 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir if( NULL == GetImport().GetShapeImport()->GetAutoStylesContext()) 725*cdf0e10cSrcweir break; 726*cdf0e10cSrcweir 727*cdf0e10cSrcweir const SvXMLStyleContext* pTempStyle = GetImport().GetShapeImport()->GetAutoStylesContext()->FindStyleChildContext(XML_STYLE_FAMILY_TEXT_PARAGRAPH, maTextStyleName); 728*cdf0e10cSrcweir XMLPropStyleContext* pStyle = PTR_CAST( XMLPropStyleContext, pTempStyle ); // use temp var, PTR_CAST is a bad macro, FindStyleChildContext will be called twice 729*cdf0e10cSrcweir if( pStyle == NULL ) 730*cdf0e10cSrcweir break; 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir // set PropertySet on object 733*cdf0e10cSrcweir pStyle->FillPropertySet(xPropSet); 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir } while(0); 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir catch( uno::Exception& ) 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir } 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir void SdXMLShapeContext::SetLayer() 743*cdf0e10cSrcweir { 744*cdf0e10cSrcweir if( maLayerName.getLength() ) 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir try 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 749*cdf0e10cSrcweir if(xPropSet.is() ) 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir uno::Any aAny; 752*cdf0e10cSrcweir aAny <<= maLayerName; 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LayerName")), aAny); 755*cdf0e10cSrcweir return; 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir } 758*cdf0e10cSrcweir catch( uno::Exception e ) 759*cdf0e10cSrcweir { 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir } 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir void SdXMLShapeContext::SetThumbnail() 765*cdf0e10cSrcweir { 766*cdf0e10cSrcweir if( 0 == maThumbnailURL.getLength() ) 767*cdf0e10cSrcweir return; 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir try 770*cdf0e10cSrcweir { 771*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 772*cdf0e10cSrcweir if( !xPropSet.is() ) 773*cdf0e10cSrcweir return; 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir const OUString sProperty(RTL_CONSTASCII_USTRINGPARAM("ThumbnailGraphicURL")); 776*cdf0e10cSrcweir 777*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 778*cdf0e10cSrcweir if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sProperty ) ) 779*cdf0e10cSrcweir { 780*cdf0e10cSrcweir // load the thumbnail graphic and export it to a wmf stream so we can set 781*cdf0e10cSrcweir // it at the api 782*cdf0e10cSrcweir 783*cdf0e10cSrcweir const OUString aInternalURL( GetImport().ResolveGraphicObjectURL( maThumbnailURL, sal_False ) ); 784*cdf0e10cSrcweir xPropSet->setPropertyValue( sProperty, uno::makeAny( aInternalURL ) ); 785*cdf0e10cSrcweir } 786*cdf0e10cSrcweir } 787*cdf0e10cSrcweir catch( uno::Exception e ) 788*cdf0e10cSrcweir { 789*cdf0e10cSrcweir } 790*cdf0e10cSrcweir } 791*cdf0e10cSrcweir 792*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 793*cdf0e10cSrcweir void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir bool bHaveXmlId( false ); 796*cdf0e10cSrcweir if( (XML_NAMESPACE_DRAW == nPrefix) || (XML_NAMESPACE_DRAW_EXT == nPrefix) ) 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_ZINDEX ) ) 799*cdf0e10cSrcweir { 800*cdf0e10cSrcweir mnZOrder = rValue.toInt32(); 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_ID ) ) 803*cdf0e10cSrcweir { 804*cdf0e10cSrcweir if (!bHaveXmlId) { maShapeId = rValue; }; 805*cdf0e10cSrcweir } 806*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_NAME ) ) 807*cdf0e10cSrcweir { 808*cdf0e10cSrcweir maShapeName = rValue; 809*cdf0e10cSrcweir } 810*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) ) 811*cdf0e10cSrcweir { 812*cdf0e10cSrcweir maDrawStyleName = rValue; 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_TEXT_STYLE_NAME ) ) 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir maTextStyleName = rValue; 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_LAYER ) ) 819*cdf0e10cSrcweir { 820*cdf0e10cSrcweir maLayerName = rValue; 821*cdf0e10cSrcweir } 822*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_TRANSFORM ) ) 823*cdf0e10cSrcweir { 824*cdf0e10cSrcweir mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter()); 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_DISPLAY ) ) 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir mbVisible = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_SCREEN ); 829*cdf0e10cSrcweir mbPrintable = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_PRINTER ); 830*cdf0e10cSrcweir } 831*cdf0e10cSrcweir } 832*cdf0e10cSrcweir else if( XML_NAMESPACE_PRESENTATION == nPrefix ) 833*cdf0e10cSrcweir { 834*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_USER_TRANSFORMED ) ) 835*cdf0e10cSrcweir { 836*cdf0e10cSrcweir mbIsUserTransformed = IsXMLToken( rValue, XML_TRUE ); 837*cdf0e10cSrcweir } 838*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_PLACEHOLDER ) ) 839*cdf0e10cSrcweir { 840*cdf0e10cSrcweir mbIsPlaceholder = IsXMLToken( rValue, XML_TRUE ); 841*cdf0e10cSrcweir if( mbIsPlaceholder ) 842*cdf0e10cSrcweir mbClearDefaultAttributes = false; 843*cdf0e10cSrcweir } 844*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_CLASS ) ) 845*cdf0e10cSrcweir { 846*cdf0e10cSrcweir maPresentationClass = rValue; 847*cdf0e10cSrcweir } 848*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_STYLE_NAME ) ) 849*cdf0e10cSrcweir { 850*cdf0e10cSrcweir maDrawStyleName = rValue; 851*cdf0e10cSrcweir mnStyleFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID; 852*cdf0e10cSrcweir } 853*cdf0e10cSrcweir } 854*cdf0e10cSrcweir else if( XML_NAMESPACE_SVG == nPrefix ) 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_X ) ) 857*cdf0e10cSrcweir { 858*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maPosition.X, rValue); 859*cdf0e10cSrcweir } 860*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_Y ) ) 861*cdf0e10cSrcweir { 862*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maPosition.Y, rValue); 863*cdf0e10cSrcweir } 864*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_WIDTH ) ) 865*cdf0e10cSrcweir { 866*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maSize.Width, rValue); 867*cdf0e10cSrcweir if( maSize.Width > 0 ) 868*cdf0e10cSrcweir maSize.Width += 1; 869*cdf0e10cSrcweir else if( maSize.Width < 0 ) 870*cdf0e10cSrcweir maSize.Width -= 1; 871*cdf0e10cSrcweir } 872*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_HEIGHT ) ) 873*cdf0e10cSrcweir { 874*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maSize.Height, rValue); 875*cdf0e10cSrcweir if( maSize.Height > 0 ) 876*cdf0e10cSrcweir maSize.Height += 1; 877*cdf0e10cSrcweir else if( maSize.Height < 0 ) 878*cdf0e10cSrcweir maSize.Height -= 1; 879*cdf0e10cSrcweir } 880*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_TRANSFORM ) ) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir // because of #85127# take svg:transform into account and hanle like 883*cdf0e10cSrcweir // draw:transform for compatibility 884*cdf0e10cSrcweir mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter()); 885*cdf0e10cSrcweir } 886*cdf0e10cSrcweir 887*cdf0e10cSrcweir // #i68101# 888*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_TITLE ) ) 889*cdf0e10cSrcweir { 890*cdf0e10cSrcweir maShapeTitle = rValue; 891*cdf0e10cSrcweir } 892*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_DESC ) ) 893*cdf0e10cSrcweir { 894*cdf0e10cSrcweir maShapeDescription = rValue; 895*cdf0e10cSrcweir } 896*cdf0e10cSrcweir } 897*cdf0e10cSrcweir else if( (XML_NAMESPACE_NONE == nPrefix) || (XML_NAMESPACE_XML == nPrefix) ) 898*cdf0e10cSrcweir { 899*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_ID ) ) 900*cdf0e10cSrcweir { 901*cdf0e10cSrcweir maShapeId = rValue; 902*cdf0e10cSrcweir bHaveXmlId = true; 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir } 905*cdf0e10cSrcweir } 906*cdf0e10cSrcweir 907*cdf0e10cSrcweir sal_Bool SdXMLShapeContext::isPresentationShape() const 908*cdf0e10cSrcweir { 909*cdf0e10cSrcweir if( maPresentationClass.getLength() && (const_cast<SdXMLShapeContext*>(this))->GetImport().GetShapeImport()->IsPresentationShapesSupported() ) 910*cdf0e10cSrcweir { 911*cdf0e10cSrcweir if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == mnStyleFamily) 912*cdf0e10cSrcweir { 913*cdf0e10cSrcweir return sal_True; 914*cdf0e10cSrcweir } 915*cdf0e10cSrcweir 916*cdf0e10cSrcweir if( IsXMLToken( maPresentationClass, XML_HEADER ) || IsXMLToken( maPresentationClass, XML_FOOTER ) || 917*cdf0e10cSrcweir IsXMLToken( maPresentationClass, XML_PAGE_NUMBER ) || IsXMLToken( maPresentationClass, XML_DATE_TIME ) ) 918*cdf0e10cSrcweir { 919*cdf0e10cSrcweir return sal_True; 920*cdf0e10cSrcweir } 921*cdf0e10cSrcweir } 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir return sal_False; 924*cdf0e10cSrcweir } 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 927*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 928*cdf0e10cSrcweir 929*cdf0e10cSrcweir TYPEINIT1( SdXMLRectShapeContext, SdXMLShapeContext ); 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir SdXMLRectShapeContext::SdXMLRectShapeContext( 932*cdf0e10cSrcweir SvXMLImport& rImport, 933*cdf0e10cSrcweir sal_uInt16 nPrfx, 934*cdf0e10cSrcweir const OUString& rLocalName, 935*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 936*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 937*cdf0e10cSrcweir sal_Bool bTemporaryShape) 938*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 939*cdf0e10cSrcweir mnRadius( 0L ) 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir } 942*cdf0e10cSrcweir 943*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 944*cdf0e10cSrcweir 945*cdf0e10cSrcweir SdXMLRectShapeContext::~SdXMLRectShapeContext() 946*cdf0e10cSrcweir { 947*cdf0e10cSrcweir } 948*cdf0e10cSrcweir 949*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 950*cdf0e10cSrcweir 951*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 952*cdf0e10cSrcweir void SdXMLRectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 953*cdf0e10cSrcweir { 954*cdf0e10cSrcweir if( XML_NAMESPACE_DRAW == nPrefix ) 955*cdf0e10cSrcweir { 956*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) ) 957*cdf0e10cSrcweir { 958*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue); 959*cdf0e10cSrcweir return; 960*cdf0e10cSrcweir } 961*cdf0e10cSrcweir } 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 964*cdf0e10cSrcweir } 965*cdf0e10cSrcweir 966*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 967*cdf0e10cSrcweir 968*cdf0e10cSrcweir void SdXMLRectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 969*cdf0e10cSrcweir { 970*cdf0e10cSrcweir // create rectangle shape 971*cdf0e10cSrcweir AddShape("com.sun.star.drawing.RectangleShape"); 972*cdf0e10cSrcweir if(mxShape.is()) 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir // Add, set Style and properties from base shape 975*cdf0e10cSrcweir SetStyle(); 976*cdf0e10cSrcweir SetLayer(); 977*cdf0e10cSrcweir 978*cdf0e10cSrcweir // set pos, size, shear and rotate 979*cdf0e10cSrcweir SetTransformation(); 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir if(mnRadius) 982*cdf0e10cSrcweir { 983*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 984*cdf0e10cSrcweir if(xPropSet.is()) 985*cdf0e10cSrcweir { 986*cdf0e10cSrcweir try 987*cdf0e10cSrcweir { 988*cdf0e10cSrcweir xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) ); 989*cdf0e10cSrcweir } 990*cdf0e10cSrcweir catch( uno::Exception& ) 991*cdf0e10cSrcweir { 992*cdf0e10cSrcweir DBG_ERROR( "exception during setting of corner radius!"); 993*cdf0e10cSrcweir } 994*cdf0e10cSrcweir } 995*cdf0e10cSrcweir } 996*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 997*cdf0e10cSrcweir } 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir 1000*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1001*cdf0e10cSrcweir ////////////////////////////////////////3//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1002*cdf0e10cSrcweir 1003*cdf0e10cSrcweir TYPEINIT1( SdXMLLineShapeContext, SdXMLShapeContext ); 1004*cdf0e10cSrcweir 1005*cdf0e10cSrcweir SdXMLLineShapeContext::SdXMLLineShapeContext( 1006*cdf0e10cSrcweir SvXMLImport& rImport, 1007*cdf0e10cSrcweir sal_uInt16 nPrfx, 1008*cdf0e10cSrcweir const OUString& rLocalName, 1009*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 1010*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 1011*cdf0e10cSrcweir sal_Bool bTemporaryShape) 1012*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 1013*cdf0e10cSrcweir mnX1( 0L ), 1014*cdf0e10cSrcweir mnY1( 0L ), 1015*cdf0e10cSrcweir mnX2( 1L ), 1016*cdf0e10cSrcweir mnY2( 1L ) 1017*cdf0e10cSrcweir { 1018*cdf0e10cSrcweir } 1019*cdf0e10cSrcweir 1020*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1021*cdf0e10cSrcweir 1022*cdf0e10cSrcweir SdXMLLineShapeContext::~SdXMLLineShapeContext() 1023*cdf0e10cSrcweir { 1024*cdf0e10cSrcweir } 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 1029*cdf0e10cSrcweir void SdXMLLineShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 1030*cdf0e10cSrcweir { 1031*cdf0e10cSrcweir if( XML_NAMESPACE_SVG == nPrefix ) 1032*cdf0e10cSrcweir { 1033*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_X1 ) ) 1034*cdf0e10cSrcweir { 1035*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnX1, rValue); 1036*cdf0e10cSrcweir return; 1037*cdf0e10cSrcweir } 1038*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_Y1 ) ) 1039*cdf0e10cSrcweir { 1040*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnY1, rValue); 1041*cdf0e10cSrcweir return; 1042*cdf0e10cSrcweir } 1043*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_X2 ) ) 1044*cdf0e10cSrcweir { 1045*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnX2, rValue); 1046*cdf0e10cSrcweir return; 1047*cdf0e10cSrcweir } 1048*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_Y2 ) ) 1049*cdf0e10cSrcweir { 1050*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnY2, rValue); 1051*cdf0e10cSrcweir return; 1052*cdf0e10cSrcweir } 1053*cdf0e10cSrcweir } 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 1056*cdf0e10cSrcweir } 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1059*cdf0e10cSrcweir 1060*cdf0e10cSrcweir void SdXMLLineShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir // #85920# use SetTransformation() to handle import of simple lines. 1063*cdf0e10cSrcweir // This is necessary to kake into account all anchor positions and 1064*cdf0e10cSrcweir // other things. All shape imports use the same import schemata now. 1065*cdf0e10cSrcweir // create necessary shape (Line Shape) 1066*cdf0e10cSrcweir AddShape("com.sun.star.drawing.PolyLineShape"); 1067*cdf0e10cSrcweir 1068*cdf0e10cSrcweir if(mxShape.is()) 1069*cdf0e10cSrcweir { 1070*cdf0e10cSrcweir // Add, set Style and properties from base shape 1071*cdf0e10cSrcweir SetStyle(); 1072*cdf0e10cSrcweir SetLayer(); 1073*cdf0e10cSrcweir 1074*cdf0e10cSrcweir // get sizes and offsets 1075*cdf0e10cSrcweir awt::Point aTopLeft(mnX1, mnY1); 1076*cdf0e10cSrcweir awt::Point aBottomRight(mnX2, mnY2); 1077*cdf0e10cSrcweir 1078*cdf0e10cSrcweir if(mnX1 > mnX2) 1079*cdf0e10cSrcweir { 1080*cdf0e10cSrcweir aTopLeft.X = mnX2; 1081*cdf0e10cSrcweir aBottomRight.X = mnX1; 1082*cdf0e10cSrcweir } 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir if(mnY1 > mnY2) 1085*cdf0e10cSrcweir { 1086*cdf0e10cSrcweir aTopLeft.Y = mnY2; 1087*cdf0e10cSrcweir aBottomRight.Y = mnY1; 1088*cdf0e10cSrcweir } 1089*cdf0e10cSrcweir 1090*cdf0e10cSrcweir // set local parameters on shape 1091*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 1092*cdf0e10cSrcweir if(xPropSet.is()) 1093*cdf0e10cSrcweir { 1094*cdf0e10cSrcweir drawing::PointSequenceSequence aPolyPoly(1L); 1095*cdf0e10cSrcweir drawing::PointSequence* pOuterSequence = aPolyPoly.getArray(); 1096*cdf0e10cSrcweir pOuterSequence->realloc(2L); 1097*cdf0e10cSrcweir awt::Point* pInnerSequence = pOuterSequence->getArray(); 1098*cdf0e10cSrcweir uno::Any aAny; 1099*cdf0e10cSrcweir 1100*cdf0e10cSrcweir *pInnerSequence = awt::Point( mnX1 - aTopLeft.X, mnY1 - aTopLeft.Y); 1101*cdf0e10cSrcweir pInnerSequence++; 1102*cdf0e10cSrcweir *pInnerSequence = awt::Point( mnX2 - aTopLeft.X, mnY2 - aTopLeft.Y); 1103*cdf0e10cSrcweir 1104*cdf0e10cSrcweir aAny <<= aPolyPoly; 1105*cdf0e10cSrcweir xPropSet->setPropertyValue( 1106*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny); 1107*cdf0e10cSrcweir } 1108*cdf0e10cSrcweir 1109*cdf0e10cSrcweir // set sizes for transformation 1110*cdf0e10cSrcweir maSize.Width = aBottomRight.X - aTopLeft.X; 1111*cdf0e10cSrcweir maSize.Height = aBottomRight.Y - aTopLeft.Y; 1112*cdf0e10cSrcweir maPosition.X = aTopLeft.X; 1113*cdf0e10cSrcweir maPosition.Y = aTopLeft.Y; 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir // set pos, size, shear and rotate and get copy of matrix 1116*cdf0e10cSrcweir SetTransformation(); 1117*cdf0e10cSrcweir 1118*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 1119*cdf0e10cSrcweir } 1120*cdf0e10cSrcweir } 1121*cdf0e10cSrcweir 1122*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1123*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1124*cdf0e10cSrcweir 1125*cdf0e10cSrcweir TYPEINIT1( SdXMLEllipseShapeContext, SdXMLShapeContext ); 1126*cdf0e10cSrcweir 1127*cdf0e10cSrcweir SdXMLEllipseShapeContext::SdXMLEllipseShapeContext( 1128*cdf0e10cSrcweir SvXMLImport& rImport, 1129*cdf0e10cSrcweir sal_uInt16 nPrfx, 1130*cdf0e10cSrcweir const OUString& rLocalName, 1131*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 1132*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 1133*cdf0e10cSrcweir sal_Bool bTemporaryShape) 1134*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 1135*cdf0e10cSrcweir mnCX( 0L ), 1136*cdf0e10cSrcweir mnCY( 0L ), 1137*cdf0e10cSrcweir mnRX( 1L ), 1138*cdf0e10cSrcweir mnRY( 1L ), 1139*cdf0e10cSrcweir meKind( drawing::CircleKind_FULL ), 1140*cdf0e10cSrcweir mnStartAngle( 0 ), 1141*cdf0e10cSrcweir mnEndAngle( 0 ) 1142*cdf0e10cSrcweir { 1143*cdf0e10cSrcweir } 1144*cdf0e10cSrcweir 1145*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir SdXMLEllipseShapeContext::~SdXMLEllipseShapeContext() 1148*cdf0e10cSrcweir { 1149*cdf0e10cSrcweir } 1150*cdf0e10cSrcweir 1151*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1152*cdf0e10cSrcweir 1153*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 1154*cdf0e10cSrcweir void SdXMLEllipseShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 1155*cdf0e10cSrcweir { 1156*cdf0e10cSrcweir if( XML_NAMESPACE_SVG == nPrefix ) 1157*cdf0e10cSrcweir { 1158*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_RX ) ) 1159*cdf0e10cSrcweir { 1160*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue); 1161*cdf0e10cSrcweir return; 1162*cdf0e10cSrcweir } 1163*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_RY ) ) 1164*cdf0e10cSrcweir { 1165*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnRY, rValue); 1166*cdf0e10cSrcweir return; 1167*cdf0e10cSrcweir } 1168*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CX ) ) 1169*cdf0e10cSrcweir { 1170*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnCX, rValue); 1171*cdf0e10cSrcweir return; 1172*cdf0e10cSrcweir } 1173*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CY ) ) 1174*cdf0e10cSrcweir { 1175*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnCY, rValue); 1176*cdf0e10cSrcweir return; 1177*cdf0e10cSrcweir } 1178*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_R ) ) 1179*cdf0e10cSrcweir { 1180*cdf0e10cSrcweir // single radius, it's a circle and both radii are the same 1181*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue); 1182*cdf0e10cSrcweir mnRY = mnRX; 1183*cdf0e10cSrcweir return; 1184*cdf0e10cSrcweir } 1185*cdf0e10cSrcweir } 1186*cdf0e10cSrcweir else if( XML_NAMESPACE_DRAW == nPrefix ) 1187*cdf0e10cSrcweir { 1188*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_KIND ) ) 1189*cdf0e10cSrcweir { 1190*cdf0e10cSrcweir sal_uInt16 eKind; 1191*cdf0e10cSrcweir if( SvXMLUnitConverter::convertEnum( eKind, rValue, aXML_CircleKind_EnumMap ) ) 1192*cdf0e10cSrcweir { 1193*cdf0e10cSrcweir meKind = eKind; 1194*cdf0e10cSrcweir } 1195*cdf0e10cSrcweir return; 1196*cdf0e10cSrcweir } 1197*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_START_ANGLE ) ) 1198*cdf0e10cSrcweir { 1199*cdf0e10cSrcweir double dStartAngle; 1200*cdf0e10cSrcweir if( SvXMLUnitConverter::convertDouble( dStartAngle, rValue ) ) 1201*cdf0e10cSrcweir mnStartAngle = (sal_Int32)(dStartAngle * 100.0); 1202*cdf0e10cSrcweir return; 1203*cdf0e10cSrcweir } 1204*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_END_ANGLE ) ) 1205*cdf0e10cSrcweir { 1206*cdf0e10cSrcweir double dEndAngle; 1207*cdf0e10cSrcweir if( SvXMLUnitConverter::convertDouble( dEndAngle, rValue ) ) 1208*cdf0e10cSrcweir mnEndAngle = (sal_Int32)(dEndAngle * 100.0); 1209*cdf0e10cSrcweir return; 1210*cdf0e10cSrcweir } 1211*cdf0e10cSrcweir } 1212*cdf0e10cSrcweir 1213*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 1214*cdf0e10cSrcweir } 1215*cdf0e10cSrcweir 1216*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1217*cdf0e10cSrcweir 1218*cdf0e10cSrcweir void SdXMLEllipseShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 1219*cdf0e10cSrcweir { 1220*cdf0e10cSrcweir // create rectangle shape 1221*cdf0e10cSrcweir AddShape("com.sun.star.drawing.EllipseShape"); 1222*cdf0e10cSrcweir if(mxShape.is()) 1223*cdf0e10cSrcweir { 1224*cdf0e10cSrcweir // Add, set Style and properties from base shape 1225*cdf0e10cSrcweir SetStyle(); 1226*cdf0e10cSrcweir SetLayer(); 1227*cdf0e10cSrcweir 1228*cdf0e10cSrcweir // set pos, size, shear and rotate 1229*cdf0e10cSrcweir SetTransformation(); 1230*cdf0e10cSrcweir 1231*cdf0e10cSrcweir if( meKind != drawing::CircleKind_FULL ) 1232*cdf0e10cSrcweir { 1233*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY ); 1234*cdf0e10cSrcweir if( xPropSet.is() ) 1235*cdf0e10cSrcweir { 1236*cdf0e10cSrcweir uno::Any aAny; 1237*cdf0e10cSrcweir aAny <<= (drawing::CircleKind)meKind; 1238*cdf0e10cSrcweir xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleKind")), aAny ); 1239*cdf0e10cSrcweir 1240*cdf0e10cSrcweir aAny <<= mnStartAngle; 1241*cdf0e10cSrcweir xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleStartAngle")), aAny ); 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir aAny <<= mnEndAngle; 1244*cdf0e10cSrcweir xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleEndAngle")), aAny ); 1245*cdf0e10cSrcweir } 1246*cdf0e10cSrcweir } 1247*cdf0e10cSrcweir 1248*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 1249*cdf0e10cSrcweir } 1250*cdf0e10cSrcweir } 1251*cdf0e10cSrcweir 1252*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1253*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1254*cdf0e10cSrcweir 1255*cdf0e10cSrcweir TYPEINIT1( SdXMLPolygonShapeContext, SdXMLShapeContext ); 1256*cdf0e10cSrcweir 1257*cdf0e10cSrcweir SdXMLPolygonShapeContext::SdXMLPolygonShapeContext( 1258*cdf0e10cSrcweir SvXMLImport& rImport, 1259*cdf0e10cSrcweir sal_uInt16 nPrfx, 1260*cdf0e10cSrcweir const OUString& rLocalName, 1261*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 1262*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, sal_Bool bClosed, sal_Bool bTemporaryShape) 1263*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 1264*cdf0e10cSrcweir mbClosed( bClosed ) 1265*cdf0e10cSrcweir { 1266*cdf0e10cSrcweir } 1267*cdf0e10cSrcweir 1268*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1269*cdf0e10cSrcweir 1270*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 1271*cdf0e10cSrcweir void SdXMLPolygonShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 1272*cdf0e10cSrcweir { 1273*cdf0e10cSrcweir if( XML_NAMESPACE_SVG == nPrefix ) 1274*cdf0e10cSrcweir { 1275*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_VIEWBOX ) ) 1276*cdf0e10cSrcweir { 1277*cdf0e10cSrcweir maViewBox = rValue; 1278*cdf0e10cSrcweir return; 1279*cdf0e10cSrcweir } 1280*cdf0e10cSrcweir } 1281*cdf0e10cSrcweir else if( XML_NAMESPACE_DRAW == nPrefix ) 1282*cdf0e10cSrcweir { 1283*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_POINTS ) ) 1284*cdf0e10cSrcweir { 1285*cdf0e10cSrcweir maPoints = rValue; 1286*cdf0e10cSrcweir return; 1287*cdf0e10cSrcweir } 1288*cdf0e10cSrcweir } 1289*cdf0e10cSrcweir 1290*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 1291*cdf0e10cSrcweir } 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1294*cdf0e10cSrcweir 1295*cdf0e10cSrcweir SdXMLPolygonShapeContext::~SdXMLPolygonShapeContext() 1296*cdf0e10cSrcweir { 1297*cdf0e10cSrcweir } 1298*cdf0e10cSrcweir 1299*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1300*cdf0e10cSrcweir 1301*cdf0e10cSrcweir void SdXMLPolygonShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 1302*cdf0e10cSrcweir { 1303*cdf0e10cSrcweir // Add, set Style and properties from base shape 1304*cdf0e10cSrcweir if(mbClosed) 1305*cdf0e10cSrcweir AddShape("com.sun.star.drawing.PolyPolygonShape"); 1306*cdf0e10cSrcweir else 1307*cdf0e10cSrcweir AddShape("com.sun.star.drawing.PolyLineShape"); 1308*cdf0e10cSrcweir 1309*cdf0e10cSrcweir if( mxShape.is() ) 1310*cdf0e10cSrcweir { 1311*cdf0e10cSrcweir SetStyle(); 1312*cdf0e10cSrcweir SetLayer(); 1313*cdf0e10cSrcweir 1314*cdf0e10cSrcweir // set local parameters on shape 1315*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 1316*cdf0e10cSrcweir if(xPropSet.is()) 1317*cdf0e10cSrcweir { 1318*cdf0e10cSrcweir // set polygon 1319*cdf0e10cSrcweir if(maPoints.getLength() && maViewBox.getLength()) 1320*cdf0e10cSrcweir { 1321*cdf0e10cSrcweir SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter()); 1322*cdf0e10cSrcweir awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight()); 1323*cdf0e10cSrcweir if (maSize.Width != 0 && maSize.Height !=0) 1324*cdf0e10cSrcweir { 1325*cdf0e10cSrcweir aSize = maSize; 1326*cdf0e10cSrcweir } 1327*cdf0e10cSrcweir awt::Point aPosition(aViewBox.GetX(), aViewBox.GetY()); 1328*cdf0e10cSrcweir SdXMLImExPointsElement aPoints(maPoints, aViewBox, 1329*cdf0e10cSrcweir aPosition, aSize, GetImport().GetMM100UnitConverter()); 1330*cdf0e10cSrcweir 1331*cdf0e10cSrcweir uno::Any aAny; 1332*cdf0e10cSrcweir aAny <<= aPoints.GetPointSequenceSequence(); 1333*cdf0e10cSrcweir xPropSet->setPropertyValue( 1334*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny); 1335*cdf0e10cSrcweir } 1336*cdf0e10cSrcweir } 1337*cdf0e10cSrcweir 1338*cdf0e10cSrcweir // set pos, size, shear and rotate and get copy of matrix 1339*cdf0e10cSrcweir SetTransformation(); 1340*cdf0e10cSrcweir 1341*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 1342*cdf0e10cSrcweir } 1343*cdf0e10cSrcweir } 1344*cdf0e10cSrcweir 1345*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1346*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1347*cdf0e10cSrcweir 1348*cdf0e10cSrcweir TYPEINIT1( SdXMLPathShapeContext, SdXMLShapeContext ); 1349*cdf0e10cSrcweir 1350*cdf0e10cSrcweir SdXMLPathShapeContext::SdXMLPathShapeContext( 1351*cdf0e10cSrcweir SvXMLImport& rImport, 1352*cdf0e10cSrcweir sal_uInt16 nPrfx, 1353*cdf0e10cSrcweir const OUString& rLocalName, 1354*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 1355*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 1356*cdf0e10cSrcweir sal_Bool bTemporaryShape) 1357*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 1358*cdf0e10cSrcweir mbClosed( sal_True ) 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir } 1361*cdf0e10cSrcweir 1362*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1363*cdf0e10cSrcweir 1364*cdf0e10cSrcweir SdXMLPathShapeContext::~SdXMLPathShapeContext() 1365*cdf0e10cSrcweir { 1366*cdf0e10cSrcweir } 1367*cdf0e10cSrcweir 1368*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 1371*cdf0e10cSrcweir void SdXMLPathShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 1372*cdf0e10cSrcweir { 1373*cdf0e10cSrcweir if( XML_NAMESPACE_SVG == nPrefix ) 1374*cdf0e10cSrcweir { 1375*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_VIEWBOX ) ) 1376*cdf0e10cSrcweir { 1377*cdf0e10cSrcweir maViewBox = rValue; 1378*cdf0e10cSrcweir return; 1379*cdf0e10cSrcweir } 1380*cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_D ) ) 1381*cdf0e10cSrcweir { 1382*cdf0e10cSrcweir maD = rValue; 1383*cdf0e10cSrcweir return; 1384*cdf0e10cSrcweir } 1385*cdf0e10cSrcweir } 1386*cdf0e10cSrcweir 1387*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 1388*cdf0e10cSrcweir } 1389*cdf0e10cSrcweir 1390*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1391*cdf0e10cSrcweir 1392*cdf0e10cSrcweir void SdXMLPathShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 1393*cdf0e10cSrcweir { 1394*cdf0e10cSrcweir // create polygon shape 1395*cdf0e10cSrcweir if(maD.getLength()) 1396*cdf0e10cSrcweir { 1397*cdf0e10cSrcweir // prepare some of the parameters 1398*cdf0e10cSrcweir SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter()); 1399*cdf0e10cSrcweir awt::Size aSize(aViewBox.GetWidth(), aViewBox.GetHeight()); 1400*cdf0e10cSrcweir awt::Point aPosition(aViewBox.GetX(), aViewBox.GetY()); 1401*cdf0e10cSrcweir if (maSize.Width != 0 && maSize.Height !=0) 1402*cdf0e10cSrcweir { 1403*cdf0e10cSrcweir aSize = maSize; 1404*cdf0e10cSrcweir } 1405*cdf0e10cSrcweir SdXMLImExSvgDElement aPoints(maD, aViewBox, 1406*cdf0e10cSrcweir aPosition, aSize, GetImport().GetMM100UnitConverter()); 1407*cdf0e10cSrcweir 1408*cdf0e10cSrcweir const char* pService; 1409*cdf0e10cSrcweir // now create shape 1410*cdf0e10cSrcweir if(aPoints.IsCurve()) 1411*cdf0e10cSrcweir { 1412*cdf0e10cSrcweir if(aPoints.IsClosed()) 1413*cdf0e10cSrcweir { 1414*cdf0e10cSrcweir pService = "com.sun.star.drawing.ClosedBezierShape"; 1415*cdf0e10cSrcweir } 1416*cdf0e10cSrcweir else 1417*cdf0e10cSrcweir { 1418*cdf0e10cSrcweir pService = "com.sun.star.drawing.OpenBezierShape"; 1419*cdf0e10cSrcweir } 1420*cdf0e10cSrcweir } 1421*cdf0e10cSrcweir else 1422*cdf0e10cSrcweir { 1423*cdf0e10cSrcweir if(aPoints.IsClosed()) 1424*cdf0e10cSrcweir { 1425*cdf0e10cSrcweir pService = "com.sun.star.drawing.PolyPolygonShape"; 1426*cdf0e10cSrcweir } 1427*cdf0e10cSrcweir else 1428*cdf0e10cSrcweir { 1429*cdf0e10cSrcweir pService = "com.sun.star.drawing.PolyLineShape"; 1430*cdf0e10cSrcweir } 1431*cdf0e10cSrcweir } 1432*cdf0e10cSrcweir 1433*cdf0e10cSrcweir // Add, set Style and properties from base shape 1434*cdf0e10cSrcweir AddShape(pService); 1435*cdf0e10cSrcweir 1436*cdf0e10cSrcweir // #89344# test for mxShape.is() and not for mxShapes.is() to support 1437*cdf0e10cSrcweir // shape import helper classes WITHOUT XShapes (member mxShapes). This 1438*cdf0e10cSrcweir // is used by the writer. 1439*cdf0e10cSrcweir if( mxShape.is() ) 1440*cdf0e10cSrcweir { 1441*cdf0e10cSrcweir SetStyle(); 1442*cdf0e10cSrcweir SetLayer(); 1443*cdf0e10cSrcweir 1444*cdf0e10cSrcweir // set local parameters on shape 1445*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 1446*cdf0e10cSrcweir if(xPropSet.is()) 1447*cdf0e10cSrcweir { 1448*cdf0e10cSrcweir uno::Any aAny; 1449*cdf0e10cSrcweir 1450*cdf0e10cSrcweir // set svg:d 1451*cdf0e10cSrcweir if(maD.getLength()) 1452*cdf0e10cSrcweir { 1453*cdf0e10cSrcweir if(aPoints.IsCurve()) 1454*cdf0e10cSrcweir { 1455*cdf0e10cSrcweir drawing::PolyPolygonBezierCoords aSourcePolyPolygon( 1456*cdf0e10cSrcweir aPoints.GetPointSequenceSequence(), 1457*cdf0e10cSrcweir aPoints.GetFlagSequenceSequence()); 1458*cdf0e10cSrcweir 1459*cdf0e10cSrcweir aAny <<= aSourcePolyPolygon; 1460*cdf0e10cSrcweir xPropSet->setPropertyValue( 1461*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny); 1462*cdf0e10cSrcweir } 1463*cdf0e10cSrcweir else 1464*cdf0e10cSrcweir { 1465*cdf0e10cSrcweir aAny <<= aPoints.GetPointSequenceSequence(); 1466*cdf0e10cSrcweir xPropSet->setPropertyValue( 1467*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")), aAny); 1468*cdf0e10cSrcweir } 1469*cdf0e10cSrcweir } 1470*cdf0e10cSrcweir } 1471*cdf0e10cSrcweir 1472*cdf0e10cSrcweir // set pos, size, shear and rotate 1473*cdf0e10cSrcweir SetTransformation(); 1474*cdf0e10cSrcweir 1475*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 1476*cdf0e10cSrcweir } 1477*cdf0e10cSrcweir } 1478*cdf0e10cSrcweir } 1479*cdf0e10cSrcweir 1480*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1481*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1482*cdf0e10cSrcweir 1483*cdf0e10cSrcweir TYPEINIT1( SdXMLTextBoxShapeContext, SdXMLShapeContext ); 1484*cdf0e10cSrcweir 1485*cdf0e10cSrcweir SdXMLTextBoxShapeContext::SdXMLTextBoxShapeContext( 1486*cdf0e10cSrcweir SvXMLImport& rImport, 1487*cdf0e10cSrcweir sal_uInt16 nPrfx, 1488*cdf0e10cSrcweir const OUString& rLocalName, 1489*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 1490*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 1491*cdf0e10cSrcweir sal_Bool bTemporaryShape) 1492*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 1493*cdf0e10cSrcweir mnRadius(0) 1494*cdf0e10cSrcweir { 1495*cdf0e10cSrcweir } 1496*cdf0e10cSrcweir 1497*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1498*cdf0e10cSrcweir 1499*cdf0e10cSrcweir SdXMLTextBoxShapeContext::~SdXMLTextBoxShapeContext() 1500*cdf0e10cSrcweir { 1501*cdf0e10cSrcweir } 1502*cdf0e10cSrcweir 1503*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1504*cdf0e10cSrcweir 1505*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 1506*cdf0e10cSrcweir void SdXMLTextBoxShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 1507*cdf0e10cSrcweir { 1508*cdf0e10cSrcweir if( XML_NAMESPACE_DRAW == nPrefix ) 1509*cdf0e10cSrcweir { 1510*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) ) 1511*cdf0e10cSrcweir { 1512*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue); 1513*cdf0e10cSrcweir return; 1514*cdf0e10cSrcweir } 1515*cdf0e10cSrcweir } 1516*cdf0e10cSrcweir 1517*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 1518*cdf0e10cSrcweir } 1519*cdf0e10cSrcweir 1520*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1521*cdf0e10cSrcweir 1522*cdf0e10cSrcweir void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&) 1523*cdf0e10cSrcweir { 1524*cdf0e10cSrcweir // create textbox shape 1525*cdf0e10cSrcweir sal_Bool bIsPresShape = sal_False; 1526*cdf0e10cSrcweir bool bClearText = false; 1527*cdf0e10cSrcweir 1528*cdf0e10cSrcweir const char *pService = NULL; 1529*cdf0e10cSrcweir 1530*cdf0e10cSrcweir if( isPresentationShape() ) 1531*cdf0e10cSrcweir { 1532*cdf0e10cSrcweir // check if the current document supports presentation shapes 1533*cdf0e10cSrcweir if( GetImport().GetShapeImport()->IsPresentationShapesSupported() ) 1534*cdf0e10cSrcweir { 1535*cdf0e10cSrcweir if( IsXMLToken( maPresentationClass, XML_PRESENTATION_SUBTITLE )) 1536*cdf0e10cSrcweir { 1537*cdf0e10cSrcweir // XmlShapeTypePresSubtitleShape 1538*cdf0e10cSrcweir pService = "com.sun.star.presentation.SubtitleShape"; 1539*cdf0e10cSrcweir } 1540*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OUTLINE ) ) 1541*cdf0e10cSrcweir { 1542*cdf0e10cSrcweir // XmlShapeTypePresOutlinerShape 1543*cdf0e10cSrcweir pService = "com.sun.star.presentation.OutlinerShape"; 1544*cdf0e10cSrcweir } 1545*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_NOTES ) ) 1546*cdf0e10cSrcweir { 1547*cdf0e10cSrcweir // XmlShapeTypePresNotesShape 1548*cdf0e10cSrcweir pService = "com.sun.star.presentation.NotesShape"; 1549*cdf0e10cSrcweir } 1550*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_HEADER ) ) 1551*cdf0e10cSrcweir { 1552*cdf0e10cSrcweir // XmlShapeTypePresHeaderShape 1553*cdf0e10cSrcweir pService = "com.sun.star.presentation.HeaderShape"; 1554*cdf0e10cSrcweir bClearText = true; 1555*cdf0e10cSrcweir } 1556*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_FOOTER ) ) 1557*cdf0e10cSrcweir { 1558*cdf0e10cSrcweir // XmlShapeTypePresFooterShape 1559*cdf0e10cSrcweir pService = "com.sun.star.presentation.FooterShape"; 1560*cdf0e10cSrcweir bClearText = true; 1561*cdf0e10cSrcweir } 1562*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_PAGE_NUMBER ) ) 1563*cdf0e10cSrcweir { 1564*cdf0e10cSrcweir // XmlShapeTypePresSlideNumberShape 1565*cdf0e10cSrcweir pService = "com.sun.star.presentation.SlideNumberShape"; 1566*cdf0e10cSrcweir bClearText = true; 1567*cdf0e10cSrcweir } 1568*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_DATE_TIME ) ) 1569*cdf0e10cSrcweir { 1570*cdf0e10cSrcweir // XmlShapeTypePresDateTimeShape 1571*cdf0e10cSrcweir pService = "com.sun.star.presentation.DateTimeShape"; 1572*cdf0e10cSrcweir bClearText = true; 1573*cdf0e10cSrcweir } 1574*cdf0e10cSrcweir else // IsXMLToken( maPresentationClass, XML_PRESENTATION_TITLE ) ) 1575*cdf0e10cSrcweir { 1576*cdf0e10cSrcweir // XmlShapeTypePresTitleTextShape 1577*cdf0e10cSrcweir pService = "com.sun.star.presentation.TitleTextShape"; 1578*cdf0e10cSrcweir } 1579*cdf0e10cSrcweir bIsPresShape = sal_True; 1580*cdf0e10cSrcweir } 1581*cdf0e10cSrcweir } 1582*cdf0e10cSrcweir 1583*cdf0e10cSrcweir if( NULL == pService ) 1584*cdf0e10cSrcweir { 1585*cdf0e10cSrcweir // normal text shape 1586*cdf0e10cSrcweir pService = "com.sun.star.drawing.TextShape"; 1587*cdf0e10cSrcweir } 1588*cdf0e10cSrcweir 1589*cdf0e10cSrcweir // Add, set Style and properties from base shape 1590*cdf0e10cSrcweir AddShape(pService); 1591*cdf0e10cSrcweir 1592*cdf0e10cSrcweir if( mxShape.is() ) 1593*cdf0e10cSrcweir { 1594*cdf0e10cSrcweir SetStyle(); 1595*cdf0e10cSrcweir SetLayer(); 1596*cdf0e10cSrcweir 1597*cdf0e10cSrcweir if(bIsPresShape) 1598*cdf0e10cSrcweir { 1599*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); 1600*cdf0e10cSrcweir if(xProps.is()) 1601*cdf0e10cSrcweir { 1602*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); 1603*cdf0e10cSrcweir if( xPropsInfo.is() ) 1604*cdf0e10cSrcweir { 1605*cdf0e10cSrcweir if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) 1606*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); 1607*cdf0e10cSrcweir 1608*cdf0e10cSrcweir if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) 1609*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); 1610*cdf0e10cSrcweir } 1611*cdf0e10cSrcweir } 1612*cdf0e10cSrcweir } 1613*cdf0e10cSrcweir 1614*cdf0e10cSrcweir if( bClearText ) 1615*cdf0e10cSrcweir { 1616*cdf0e10cSrcweir uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY ); 1617*cdf0e10cSrcweir OUString aEmpty; 1618*cdf0e10cSrcweir xText->setString( aEmpty ); 1619*cdf0e10cSrcweir } 1620*cdf0e10cSrcweir 1621*cdf0e10cSrcweir // set parameters on shape 1622*cdf0e10cSrcweir //A AW->CL: Eventually You need to strip scale and translate from the transformation 1623*cdf0e10cSrcweir //A to reach the same goal again. 1624*cdf0e10cSrcweir //A if(!bIsPresShape || mbIsUserTransformed) 1625*cdf0e10cSrcweir //A { 1626*cdf0e10cSrcweir //A // set pos and size on shape, this should remove binding 1627*cdf0e10cSrcweir //A // to pres object on masterpage 1628*cdf0e10cSrcweir //A SetSizeAndPosition(); 1629*cdf0e10cSrcweir //A } 1630*cdf0e10cSrcweir 1631*cdf0e10cSrcweir // set pos, size, shear and rotate 1632*cdf0e10cSrcweir SetTransformation(); 1633*cdf0e10cSrcweir 1634*cdf0e10cSrcweir if(mnRadius) 1635*cdf0e10cSrcweir { 1636*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 1637*cdf0e10cSrcweir if(xPropSet.is()) 1638*cdf0e10cSrcweir { 1639*cdf0e10cSrcweir try 1640*cdf0e10cSrcweir { 1641*cdf0e10cSrcweir xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) ); 1642*cdf0e10cSrcweir } 1643*cdf0e10cSrcweir catch( uno::Exception& ) 1644*cdf0e10cSrcweir { 1645*cdf0e10cSrcweir DBG_ERROR( "exception during setting of corner radius!"); 1646*cdf0e10cSrcweir } 1647*cdf0e10cSrcweir } 1648*cdf0e10cSrcweir } 1649*cdf0e10cSrcweir 1650*cdf0e10cSrcweir SdXMLShapeContext::StartElement(mxAttrList); 1651*cdf0e10cSrcweir } 1652*cdf0e10cSrcweir } 1653*cdf0e10cSrcweir 1654*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1655*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1656*cdf0e10cSrcweir 1657*cdf0e10cSrcweir TYPEINIT1( SdXMLControlShapeContext, SdXMLShapeContext ); 1658*cdf0e10cSrcweir 1659*cdf0e10cSrcweir SdXMLControlShapeContext::SdXMLControlShapeContext( 1660*cdf0e10cSrcweir SvXMLImport& rImport, 1661*cdf0e10cSrcweir sal_uInt16 nPrfx, 1662*cdf0e10cSrcweir const OUString& rLocalName, 1663*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 1664*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 1665*cdf0e10cSrcweir sal_Bool bTemporaryShape) 1666*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ) 1667*cdf0e10cSrcweir { 1668*cdf0e10cSrcweir } 1669*cdf0e10cSrcweir 1670*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1671*cdf0e10cSrcweir 1672*cdf0e10cSrcweir SdXMLControlShapeContext::~SdXMLControlShapeContext() 1673*cdf0e10cSrcweir { 1674*cdf0e10cSrcweir } 1675*cdf0e10cSrcweir 1676*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1677*cdf0e10cSrcweir 1678*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 1679*cdf0e10cSrcweir void SdXMLControlShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 1680*cdf0e10cSrcweir { 1681*cdf0e10cSrcweir if( XML_NAMESPACE_DRAW == nPrefix ) 1682*cdf0e10cSrcweir { 1683*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CONTROL ) ) 1684*cdf0e10cSrcweir { 1685*cdf0e10cSrcweir maFormId = rValue; 1686*cdf0e10cSrcweir return; 1687*cdf0e10cSrcweir } 1688*cdf0e10cSrcweir } 1689*cdf0e10cSrcweir 1690*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 1691*cdf0e10cSrcweir } 1692*cdf0e10cSrcweir 1693*cdf0e10cSrcweir void SdXMLControlShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 1694*cdf0e10cSrcweir { 1695*cdf0e10cSrcweir // create Control shape 1696*cdf0e10cSrcweir // add, set style and properties from base shape 1697*cdf0e10cSrcweir AddShape("com.sun.star.drawing.ControlShape"); 1698*cdf0e10cSrcweir if( mxShape.is() ) 1699*cdf0e10cSrcweir { 1700*cdf0e10cSrcweir DBG_ASSERT( maFormId.getLength(), "draw:control without a form:id attribute!" ); 1701*cdf0e10cSrcweir if( maFormId.getLength() ) 1702*cdf0e10cSrcweir { 1703*cdf0e10cSrcweir #ifndef SVX_LIGHT 1704*cdf0e10cSrcweir if( GetImport().IsFormsSupported() ) 1705*cdf0e10cSrcweir { 1706*cdf0e10cSrcweir uno::Reference< awt::XControlModel > xControlModel( GetImport().GetFormImport()->lookupControl( maFormId ), uno::UNO_QUERY ); 1707*cdf0e10cSrcweir if( xControlModel.is() ) 1708*cdf0e10cSrcweir { 1709*cdf0e10cSrcweir uno::Reference< drawing::XControlShape > xControl( mxShape, uno::UNO_QUERY ); 1710*cdf0e10cSrcweir if( xControl.is() ) 1711*cdf0e10cSrcweir xControl->setControl( xControlModel ); 1712*cdf0e10cSrcweir 1713*cdf0e10cSrcweir } 1714*cdf0e10cSrcweir } 1715*cdf0e10cSrcweir #endif // #ifndef SVX_LIGHT 1716*cdf0e10cSrcweir } 1717*cdf0e10cSrcweir 1718*cdf0e10cSrcweir SetStyle(); 1719*cdf0e10cSrcweir SetLayer(); 1720*cdf0e10cSrcweir 1721*cdf0e10cSrcweir // set pos, size, shear and rotate 1722*cdf0e10cSrcweir SetTransformation(); 1723*cdf0e10cSrcweir 1724*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 1725*cdf0e10cSrcweir } 1726*cdf0e10cSrcweir } 1727*cdf0e10cSrcweir 1728*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1729*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1730*cdf0e10cSrcweir 1731*cdf0e10cSrcweir TYPEINIT1( SdXMLConnectorShapeContext, SdXMLShapeContext ); 1732*cdf0e10cSrcweir 1733*cdf0e10cSrcweir SdXMLConnectorShapeContext::SdXMLConnectorShapeContext( 1734*cdf0e10cSrcweir SvXMLImport& rImport, 1735*cdf0e10cSrcweir sal_uInt16 nPrfx, 1736*cdf0e10cSrcweir const OUString& rLocalName, 1737*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 1738*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 1739*cdf0e10cSrcweir sal_Bool bTemporaryShape) 1740*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 1741*cdf0e10cSrcweir maStart(0,0), 1742*cdf0e10cSrcweir maEnd(1,1), 1743*cdf0e10cSrcweir mnType( (sal_uInt16)drawing::ConnectorType_STANDARD ), 1744*cdf0e10cSrcweir mnStartGlueId(-1), 1745*cdf0e10cSrcweir mnEndGlueId(-1), 1746*cdf0e10cSrcweir mnDelta1(0), 1747*cdf0e10cSrcweir mnDelta2(0), 1748*cdf0e10cSrcweir mnDelta3(0) 1749*cdf0e10cSrcweir { 1750*cdf0e10cSrcweir } 1751*cdf0e10cSrcweir 1752*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1753*cdf0e10cSrcweir 1754*cdf0e10cSrcweir SdXMLConnectorShapeContext::~SdXMLConnectorShapeContext() 1755*cdf0e10cSrcweir { 1756*cdf0e10cSrcweir } 1757*cdf0e10cSrcweir 1758*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1759*cdf0e10cSrcweir 1760*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 1761*cdf0e10cSrcweir void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 1762*cdf0e10cSrcweir { 1763*cdf0e10cSrcweir switch( nPrefix ) 1764*cdf0e10cSrcweir { 1765*cdf0e10cSrcweir case XML_NAMESPACE_DRAW: 1766*cdf0e10cSrcweir { 1767*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_START_SHAPE ) ) 1768*cdf0e10cSrcweir { 1769*cdf0e10cSrcweir maStartShapeId = rValue; 1770*cdf0e10cSrcweir return; 1771*cdf0e10cSrcweir } 1772*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_START_GLUE_POINT ) ) 1773*cdf0e10cSrcweir { 1774*cdf0e10cSrcweir mnStartGlueId = rValue.toInt32(); 1775*cdf0e10cSrcweir return; 1776*cdf0e10cSrcweir } 1777*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_END_SHAPE ) ) 1778*cdf0e10cSrcweir { 1779*cdf0e10cSrcweir maEndShapeId = rValue; 1780*cdf0e10cSrcweir return; 1781*cdf0e10cSrcweir } 1782*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_END_GLUE_POINT ) ) 1783*cdf0e10cSrcweir { 1784*cdf0e10cSrcweir mnEndGlueId = rValue.toInt32(); 1785*cdf0e10cSrcweir return; 1786*cdf0e10cSrcweir } 1787*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_LINE_SKEW ) ) 1788*cdf0e10cSrcweir { 1789*cdf0e10cSrcweir SvXMLTokenEnumerator aTokenEnum( rValue ); 1790*cdf0e10cSrcweir OUString aToken; 1791*cdf0e10cSrcweir if( aTokenEnum.getNextToken( aToken ) ) 1792*cdf0e10cSrcweir { 1793*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnDelta1, aToken); 1794*cdf0e10cSrcweir if( aTokenEnum.getNextToken( aToken ) ) 1795*cdf0e10cSrcweir { 1796*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnDelta2, aToken); 1797*cdf0e10cSrcweir if( aTokenEnum.getNextToken( aToken ) ) 1798*cdf0e10cSrcweir { 1799*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnDelta3, aToken); 1800*cdf0e10cSrcweir } 1801*cdf0e10cSrcweir } 1802*cdf0e10cSrcweir } 1803*cdf0e10cSrcweir return; 1804*cdf0e10cSrcweir } 1805*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_TYPE ) ) 1806*cdf0e10cSrcweir { 1807*cdf0e10cSrcweir SvXMLUnitConverter::convertEnum( mnType, rValue, aXML_ConnectionKind_EnumMap ); 1808*cdf0e10cSrcweir return; 1809*cdf0e10cSrcweir } 1810*cdf0e10cSrcweir } 1811*cdf0e10cSrcweir case XML_NAMESPACE_SVG: 1812*cdf0e10cSrcweir { 1813*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_X1 ) ) 1814*cdf0e10cSrcweir { 1815*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue); 1816*cdf0e10cSrcweir return; 1817*cdf0e10cSrcweir } 1818*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_Y1 ) ) 1819*cdf0e10cSrcweir { 1820*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue); 1821*cdf0e10cSrcweir return; 1822*cdf0e10cSrcweir } 1823*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_X2 ) ) 1824*cdf0e10cSrcweir { 1825*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue); 1826*cdf0e10cSrcweir return; 1827*cdf0e10cSrcweir } 1828*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_Y2 ) ) 1829*cdf0e10cSrcweir { 1830*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue); 1831*cdf0e10cSrcweir return; 1832*cdf0e10cSrcweir } 1833*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_D ) ) 1834*cdf0e10cSrcweir { 1835*cdf0e10cSrcweir SdXMLImExViewBox aViewBox( 0, 0, 1, 1 ); 1836*cdf0e10cSrcweir awt::Point aPoint( 0, 0 ); 1837*cdf0e10cSrcweir awt::Size aSize( 1, 1 ); 1838*cdf0e10cSrcweir 1839*cdf0e10cSrcweir SdXMLImExSvgDElement aPoints( rValue, aViewBox, 1840*cdf0e10cSrcweir aPoint, aSize, GetImport().GetMM100UnitConverter() ); 1841*cdf0e10cSrcweir 1842*cdf0e10cSrcweir if ( aPoints.IsCurve() ) 1843*cdf0e10cSrcweir { 1844*cdf0e10cSrcweir drawing::PolyPolygonBezierCoords aSourcePolyPolygon( 1845*cdf0e10cSrcweir aPoints.GetPointSequenceSequence(), 1846*cdf0e10cSrcweir aPoints.GetFlagSequenceSequence()); 1847*cdf0e10cSrcweir maPath <<= aSourcePolyPolygon; 1848*cdf0e10cSrcweir } 1849*cdf0e10cSrcweir else 1850*cdf0e10cSrcweir { 1851*cdf0e10cSrcweir const drawing::PointSequenceSequence& rOuterSeq = aPoints.GetPointSequenceSequence(); 1852*cdf0e10cSrcweir drawing::FlagSequenceSequence aFlagSeqSeq( rOuterSeq.getLength() ); 1853*cdf0e10cSrcweir for ( int a = 0; a < rOuterSeq.getLength(); a++ ) 1854*cdf0e10cSrcweir aFlagSeqSeq[ a ] = drawing::FlagSequence( rOuterSeq[ a ].getLength() ); 1855*cdf0e10cSrcweir 1856*cdf0e10cSrcweir drawing::PolyPolygonBezierCoords aSourcePolyPolygon( 1857*cdf0e10cSrcweir aPoints.GetPointSequenceSequence(), 1858*cdf0e10cSrcweir aFlagSeqSeq ); 1859*cdf0e10cSrcweir maPath <<= aSourcePolyPolygon; 1860*cdf0e10cSrcweir } 1861*cdf0e10cSrcweir } 1862*cdf0e10cSrcweir } 1863*cdf0e10cSrcweir } 1864*cdf0e10cSrcweir 1865*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 1866*cdf0e10cSrcweir } 1867*cdf0e10cSrcweir 1868*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1869*cdf0e10cSrcweir 1870*cdf0e10cSrcweir void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 1871*cdf0e10cSrcweir { 1872*cdf0e10cSrcweir // #107928# 1873*cdf0e10cSrcweir // For security reasons, do not add empty connectors. There may have been an error in EA2 1874*cdf0e10cSrcweir // that created empty, far set off connectors (e.g. 63 meters below top of document). This 1875*cdf0e10cSrcweir // is not guaranteed, but it's definitely safe to not add empty connectors. 1876*cdf0e10cSrcweir sal_Bool bDoAdd(sal_True); 1877*cdf0e10cSrcweir 1878*cdf0e10cSrcweir if( 0 == maStartShapeId.getLength() 1879*cdf0e10cSrcweir && 0 == maEndShapeId.getLength() 1880*cdf0e10cSrcweir && maStart.X == maEnd.X 1881*cdf0e10cSrcweir && maStart.Y == maEnd.Y 1882*cdf0e10cSrcweir && 0 == mnDelta1 1883*cdf0e10cSrcweir && 0 == mnDelta2 1884*cdf0e10cSrcweir && 0 == mnDelta3 1885*cdf0e10cSrcweir ) 1886*cdf0e10cSrcweir { 1887*cdf0e10cSrcweir bDoAdd = sal_False; 1888*cdf0e10cSrcweir } 1889*cdf0e10cSrcweir 1890*cdf0e10cSrcweir if(bDoAdd) 1891*cdf0e10cSrcweir { 1892*cdf0e10cSrcweir // create Connector shape 1893*cdf0e10cSrcweir // add, set style and properties from base shape 1894*cdf0e10cSrcweir AddShape("com.sun.star.drawing.ConnectorShape"); 1895*cdf0e10cSrcweir if(mxShape.is()) 1896*cdf0e10cSrcweir { 1897*cdf0e10cSrcweir // add connection ids 1898*cdf0e10cSrcweir if( maStartShapeId.getLength() ) 1899*cdf0e10cSrcweir GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_True, maStartShapeId, mnStartGlueId ); 1900*cdf0e10cSrcweir if( maEndShapeId.getLength() ) 1901*cdf0e10cSrcweir GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_False, maEndShapeId, mnEndGlueId ); 1902*cdf0e10cSrcweir 1903*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 1904*cdf0e10cSrcweir if( xProps.is() ) 1905*cdf0e10cSrcweir { 1906*cdf0e10cSrcweir uno::Any aAny; 1907*cdf0e10cSrcweir aAny <<= maStart; 1908*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny); 1909*cdf0e10cSrcweir 1910*cdf0e10cSrcweir aAny <<= maEnd; 1911*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny ); 1912*cdf0e10cSrcweir 1913*cdf0e10cSrcweir aAny <<= (drawing::ConnectorType)mnType; 1914*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")), aAny ); 1915*cdf0e10cSrcweir 1916*cdf0e10cSrcweir aAny <<= mnDelta1; 1917*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")), aAny ); 1918*cdf0e10cSrcweir 1919*cdf0e10cSrcweir aAny <<= mnDelta2; 1920*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")), aAny ); 1921*cdf0e10cSrcweir 1922*cdf0e10cSrcweir aAny <<= mnDelta3; 1923*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")), aAny ); 1924*cdf0e10cSrcweir } 1925*cdf0e10cSrcweir SetStyle(); 1926*cdf0e10cSrcweir SetLayer(); 1927*cdf0e10cSrcweir 1928*cdf0e10cSrcweir if ( maPath.hasValue() ) 1929*cdf0e10cSrcweir { 1930*cdf0e10cSrcweir // --> OD #i115492# 1931*cdf0e10cSrcweir // Ignore svg:d attribute for text documents created by OpenOffice.org 1932*cdf0e10cSrcweir // versions before OOo 3.3, because these OOo versions are storing 1933*cdf0e10cSrcweir // svg:d values not using the correct unit. 1934*cdf0e10cSrcweir bool bApplySVGD( true ); 1935*cdf0e10cSrcweir if ( uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() ) 1936*cdf0e10cSrcweir { 1937*cdf0e10cSrcweir sal_Int32 nUPD( 0 ); 1938*cdf0e10cSrcweir sal_Int32 nBuild( 0 ); 1939*cdf0e10cSrcweir const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild ); 1940*cdf0e10cSrcweir if ( GetImport().IsTextDocInOOoFileFormat() || 1941*cdf0e10cSrcweir ( bBuildIdFound && 1942*cdf0e10cSrcweir ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0 1943*cdf0e10cSrcweir ( nUPD == 680 ) || // OOo 2.x 1944*cdf0e10cSrcweir ( nUPD == 300 ) || // OOo 3.0 - OOo 3.0.1 1945*cdf0e10cSrcweir ( nUPD == 310 ) || // OOo 3.1 - OOo 3.1.1 1946*cdf0e10cSrcweir ( nUPD == 320 ) ) ) ) // OOo 3.2 - OOo 3.2.1 1947*cdf0e10cSrcweir { 1948*cdf0e10cSrcweir bApplySVGD = false; 1949*cdf0e10cSrcweir } 1950*cdf0e10cSrcweir } 1951*cdf0e10cSrcweir 1952*cdf0e10cSrcweir if ( bApplySVGD ) 1953*cdf0e10cSrcweir { 1954*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ), maPath ); 1955*cdf0e10cSrcweir } 1956*cdf0e10cSrcweir // <-- 1957*cdf0e10cSrcweir } 1958*cdf0e10cSrcweir 1959*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 1960*cdf0e10cSrcweir } 1961*cdf0e10cSrcweir } 1962*cdf0e10cSrcweir } 1963*cdf0e10cSrcweir 1964*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1965*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1966*cdf0e10cSrcweir 1967*cdf0e10cSrcweir TYPEINIT1( SdXMLMeasureShapeContext, SdXMLShapeContext ); 1968*cdf0e10cSrcweir 1969*cdf0e10cSrcweir SdXMLMeasureShapeContext::SdXMLMeasureShapeContext( 1970*cdf0e10cSrcweir SvXMLImport& rImport, 1971*cdf0e10cSrcweir sal_uInt16 nPrfx, 1972*cdf0e10cSrcweir const OUString& rLocalName, 1973*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 1974*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 1975*cdf0e10cSrcweir sal_Bool bTemporaryShape) 1976*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 1977*cdf0e10cSrcweir maStart(0,0), 1978*cdf0e10cSrcweir maEnd(1,1) 1979*cdf0e10cSrcweir { 1980*cdf0e10cSrcweir } 1981*cdf0e10cSrcweir 1982*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1983*cdf0e10cSrcweir 1984*cdf0e10cSrcweir SdXMLMeasureShapeContext::~SdXMLMeasureShapeContext() 1985*cdf0e10cSrcweir { 1986*cdf0e10cSrcweir } 1987*cdf0e10cSrcweir 1988*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 1989*cdf0e10cSrcweir void SdXMLMeasureShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 1990*cdf0e10cSrcweir { 1991*cdf0e10cSrcweir switch( nPrefix ) 1992*cdf0e10cSrcweir { 1993*cdf0e10cSrcweir case XML_NAMESPACE_SVG: 1994*cdf0e10cSrcweir { 1995*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_X1 ) ) 1996*cdf0e10cSrcweir { 1997*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue); 1998*cdf0e10cSrcweir return; 1999*cdf0e10cSrcweir } 2000*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_Y1 ) ) 2001*cdf0e10cSrcweir { 2002*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue); 2003*cdf0e10cSrcweir return; 2004*cdf0e10cSrcweir } 2005*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_X2 ) ) 2006*cdf0e10cSrcweir { 2007*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue); 2008*cdf0e10cSrcweir return; 2009*cdf0e10cSrcweir } 2010*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_Y2 ) ) 2011*cdf0e10cSrcweir { 2012*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue); 2013*cdf0e10cSrcweir return; 2014*cdf0e10cSrcweir } 2015*cdf0e10cSrcweir } 2016*cdf0e10cSrcweir } 2017*cdf0e10cSrcweir 2018*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 2019*cdf0e10cSrcweir } 2020*cdf0e10cSrcweir 2021*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2022*cdf0e10cSrcweir 2023*cdf0e10cSrcweir void SdXMLMeasureShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 2024*cdf0e10cSrcweir { 2025*cdf0e10cSrcweir // create Measure shape 2026*cdf0e10cSrcweir // add, set style and properties from base shape 2027*cdf0e10cSrcweir AddShape("com.sun.star.drawing.MeasureShape"); 2028*cdf0e10cSrcweir if(mxShape.is()) 2029*cdf0e10cSrcweir { 2030*cdf0e10cSrcweir SetStyle(); 2031*cdf0e10cSrcweir SetLayer(); 2032*cdf0e10cSrcweir 2033*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 2034*cdf0e10cSrcweir if( xProps.is() ) 2035*cdf0e10cSrcweir { 2036*cdf0e10cSrcweir uno::Any aAny; 2037*cdf0e10cSrcweir aAny <<= maStart; 2038*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny); 2039*cdf0e10cSrcweir 2040*cdf0e10cSrcweir aAny <<= maEnd; 2041*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny ); 2042*cdf0e10cSrcweir } 2043*cdf0e10cSrcweir 2044*cdf0e10cSrcweir // delete pre created fields 2045*cdf0e10cSrcweir uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY ); 2046*cdf0e10cSrcweir if( xText.is() ) 2047*cdf0e10cSrcweir { 2048*cdf0e10cSrcweir const OUString aEmpty( RTL_CONSTASCII_USTRINGPARAM( " " ) ); 2049*cdf0e10cSrcweir xText->setString( aEmpty ); 2050*cdf0e10cSrcweir } 2051*cdf0e10cSrcweir 2052*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 2053*cdf0e10cSrcweir } 2054*cdf0e10cSrcweir } 2055*cdf0e10cSrcweir 2056*cdf0e10cSrcweir void SdXMLMeasureShapeContext::EndElement() 2057*cdf0e10cSrcweir { 2058*cdf0e10cSrcweir do 2059*cdf0e10cSrcweir { 2060*cdf0e10cSrcweir // delete pre created fields 2061*cdf0e10cSrcweir uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY ); 2062*cdf0e10cSrcweir if( !xText.is() ) 2063*cdf0e10cSrcweir break; 2064*cdf0e10cSrcweir 2065*cdf0e10cSrcweir uno::Reference< text::XTextCursor > xCursor( xText->createTextCursor() ); 2066*cdf0e10cSrcweir if( !xCursor.is() ) 2067*cdf0e10cSrcweir break; 2068*cdf0e10cSrcweir 2069*cdf0e10cSrcweir const OUString aEmpty; 2070*cdf0e10cSrcweir xCursor->collapseToStart(); 2071*cdf0e10cSrcweir xCursor->goRight( 1, sal_True ); 2072*cdf0e10cSrcweir xCursor->setString( aEmpty ); 2073*cdf0e10cSrcweir } 2074*cdf0e10cSrcweir while(0); 2075*cdf0e10cSrcweir 2076*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 2077*cdf0e10cSrcweir } 2078*cdf0e10cSrcweir 2079*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2080*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2081*cdf0e10cSrcweir 2082*cdf0e10cSrcweir TYPEINIT1( SdXMLPageShapeContext, SdXMLShapeContext ); 2083*cdf0e10cSrcweir 2084*cdf0e10cSrcweir SdXMLPageShapeContext::SdXMLPageShapeContext( 2085*cdf0e10cSrcweir SvXMLImport& rImport, 2086*cdf0e10cSrcweir sal_uInt16 nPrfx, 2087*cdf0e10cSrcweir const OUString& rLocalName, 2088*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 2089*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 2090*cdf0e10cSrcweir sal_Bool bTemporaryShape) 2091*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), mnPageNumber(0) 2092*cdf0e10cSrcweir { 2093*cdf0e10cSrcweir mbClearDefaultAttributes = false; 2094*cdf0e10cSrcweir } 2095*cdf0e10cSrcweir 2096*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2097*cdf0e10cSrcweir 2098*cdf0e10cSrcweir SdXMLPageShapeContext::~SdXMLPageShapeContext() 2099*cdf0e10cSrcweir { 2100*cdf0e10cSrcweir } 2101*cdf0e10cSrcweir 2102*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2103*cdf0e10cSrcweir 2104*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 2105*cdf0e10cSrcweir void SdXMLPageShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 2106*cdf0e10cSrcweir { 2107*cdf0e10cSrcweir if( XML_NAMESPACE_DRAW == nPrefix ) 2108*cdf0e10cSrcweir { 2109*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_PAGE_NUMBER ) ) 2110*cdf0e10cSrcweir { 2111*cdf0e10cSrcweir mnPageNumber = rValue.toInt32(); 2112*cdf0e10cSrcweir return; 2113*cdf0e10cSrcweir } 2114*cdf0e10cSrcweir } 2115*cdf0e10cSrcweir 2116*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 2117*cdf0e10cSrcweir } 2118*cdf0e10cSrcweir 2119*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2120*cdf0e10cSrcweir 2121*cdf0e10cSrcweir void SdXMLPageShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 2122*cdf0e10cSrcweir { 2123*cdf0e10cSrcweir // create Page shape 2124*cdf0e10cSrcweir // add, set style and properties from base shape 2125*cdf0e10cSrcweir 2126*cdf0e10cSrcweir // #86163# take into account which type of PageShape needs to 2127*cdf0e10cSrcweir // be constructed. It's an pres shape if presentation:XML_CLASS == XML_PRESENTATION_PAGE. 2128*cdf0e10cSrcweir sal_Bool bIsPresentation = maPresentationClass.getLength() && 2129*cdf0e10cSrcweir GetImport().GetShapeImport()->IsPresentationShapesSupported(); 2130*cdf0e10cSrcweir 2131*cdf0e10cSrcweir uno::Reference< lang::XServiceInfo > xInfo( mxShapes, uno::UNO_QUERY ); 2132*cdf0e10cSrcweir const sal_Bool bIsOnHandoutPage = xInfo.is() && xInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutMasterPage")) ); 2133*cdf0e10cSrcweir 2134*cdf0e10cSrcweir if( bIsOnHandoutPage ) 2135*cdf0e10cSrcweir { 2136*cdf0e10cSrcweir AddShape("com.sun.star.presentation.HandoutShape"); 2137*cdf0e10cSrcweir } 2138*cdf0e10cSrcweir else 2139*cdf0e10cSrcweir { 2140*cdf0e10cSrcweir if(bIsPresentation && !IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) ) 2141*cdf0e10cSrcweir { 2142*cdf0e10cSrcweir bIsPresentation = sal_False; 2143*cdf0e10cSrcweir } 2144*cdf0e10cSrcweir 2145*cdf0e10cSrcweir if(bIsPresentation) 2146*cdf0e10cSrcweir { 2147*cdf0e10cSrcweir AddShape("com.sun.star.presentation.PageShape"); 2148*cdf0e10cSrcweir } 2149*cdf0e10cSrcweir else 2150*cdf0e10cSrcweir { 2151*cdf0e10cSrcweir AddShape("com.sun.star.drawing.PageShape"); 2152*cdf0e10cSrcweir } 2153*cdf0e10cSrcweir } 2154*cdf0e10cSrcweir 2155*cdf0e10cSrcweir if(mxShape.is()) 2156*cdf0e10cSrcweir { 2157*cdf0e10cSrcweir SetStyle(); 2158*cdf0e10cSrcweir SetLayer(); 2159*cdf0e10cSrcweir 2160*cdf0e10cSrcweir // set pos, size, shear and rotate 2161*cdf0e10cSrcweir SetTransformation(); 2162*cdf0e10cSrcweir 2163*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 2164*cdf0e10cSrcweir if(xPropSet.is()) 2165*cdf0e10cSrcweir { 2166*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 2167*cdf0e10cSrcweir const OUString aPageNumberStr(RTL_CONSTASCII_USTRINGPARAM("PageNumber")); 2168*cdf0e10cSrcweir if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr)) 2169*cdf0e10cSrcweir xPropSet->setPropertyValue(aPageNumberStr, uno::makeAny( mnPageNumber )); 2170*cdf0e10cSrcweir } 2171*cdf0e10cSrcweir 2172*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 2173*cdf0e10cSrcweir } 2174*cdf0e10cSrcweir } 2175*cdf0e10cSrcweir 2176*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2177*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2178*cdf0e10cSrcweir 2179*cdf0e10cSrcweir TYPEINIT1( SdXMLCaptionShapeContext, SdXMLShapeContext ); 2180*cdf0e10cSrcweir 2181*cdf0e10cSrcweir SdXMLCaptionShapeContext::SdXMLCaptionShapeContext( 2182*cdf0e10cSrcweir SvXMLImport& rImport, 2183*cdf0e10cSrcweir sal_uInt16 nPrfx, 2184*cdf0e10cSrcweir const OUString& rLocalName, 2185*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 2186*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 2187*cdf0e10cSrcweir sal_Bool bTemporaryShape) 2188*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 2189*cdf0e10cSrcweir // #86616# for correct edge rounding import mnRadius needs to be initialized 2190*cdf0e10cSrcweir mnRadius( 0L ) 2191*cdf0e10cSrcweir { 2192*cdf0e10cSrcweir } 2193*cdf0e10cSrcweir 2194*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2195*cdf0e10cSrcweir 2196*cdf0e10cSrcweir SdXMLCaptionShapeContext::~SdXMLCaptionShapeContext() 2197*cdf0e10cSrcweir { 2198*cdf0e10cSrcweir } 2199*cdf0e10cSrcweir 2200*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2201*cdf0e10cSrcweir 2202*cdf0e10cSrcweir void SdXMLCaptionShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 2203*cdf0e10cSrcweir { 2204*cdf0e10cSrcweir // create Caption shape 2205*cdf0e10cSrcweir // add, set style and properties from base shape 2206*cdf0e10cSrcweir AddShape("com.sun.star.drawing.CaptionShape"); 2207*cdf0e10cSrcweir if( mxShape.is() ) 2208*cdf0e10cSrcweir { 2209*cdf0e10cSrcweir SetStyle(); 2210*cdf0e10cSrcweir SetLayer(); 2211*cdf0e10cSrcweir 2212*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 2213*cdf0e10cSrcweir 2214*cdf0e10cSrcweir // SJ: If AutoGrowWidthItem is set, SetTransformation will lead to the wrong SnapRect 2215*cdf0e10cSrcweir // because NbcAdjustTextFrameWidthAndHeight() is called (text is set later and center alignment 2216*cdf0e10cSrcweir // is the default setting, so the top left reference point that is used by the caption point is 2217*cdf0e10cSrcweir // no longer correct) There are two ways to solve this problem, temporarily disabling the 2218*cdf0e10cSrcweir // autogrowwith as we are doing here or to apply the CaptionPoint after setting text 2219*cdf0e10cSrcweir sal_Bool bIsAutoGrowWidth = sal_False; 2220*cdf0e10cSrcweir if ( xProps.is() ) 2221*cdf0e10cSrcweir { 2222*cdf0e10cSrcweir uno::Any aAny( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth") ) ) ); 2223*cdf0e10cSrcweir aAny >>= bIsAutoGrowWidth; 2224*cdf0e10cSrcweir 2225*cdf0e10cSrcweir if ( bIsAutoGrowWidth ) 2226*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth")), uno::makeAny( sal_False ) ); 2227*cdf0e10cSrcweir } 2228*cdf0e10cSrcweir 2229*cdf0e10cSrcweir // set pos, size, shear and rotate 2230*cdf0e10cSrcweir SetTransformation(); 2231*cdf0e10cSrcweir if( xProps.is() ) 2232*cdf0e10cSrcweir xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CaptionPoint")), uno::makeAny( maCaptionPoint ) ); 2233*cdf0e10cSrcweir 2234*cdf0e10cSrcweir if ( bIsAutoGrowWidth ) 2235*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth")), uno::makeAny( sal_True ) ); 2236*cdf0e10cSrcweir 2237*cdf0e10cSrcweir if(mnRadius) 2238*cdf0e10cSrcweir { 2239*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 2240*cdf0e10cSrcweir if(xPropSet.is()) 2241*cdf0e10cSrcweir { 2242*cdf0e10cSrcweir try 2243*cdf0e10cSrcweir { 2244*cdf0e10cSrcweir xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) ); 2245*cdf0e10cSrcweir } 2246*cdf0e10cSrcweir catch( uno::Exception& ) 2247*cdf0e10cSrcweir { 2248*cdf0e10cSrcweir DBG_ERROR( "exception during setting of corner radius!"); 2249*cdf0e10cSrcweir } 2250*cdf0e10cSrcweir } 2251*cdf0e10cSrcweir } 2252*cdf0e10cSrcweir 2253*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 2254*cdf0e10cSrcweir } 2255*cdf0e10cSrcweir } 2256*cdf0e10cSrcweir 2257*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 2258*cdf0e10cSrcweir void SdXMLCaptionShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 2259*cdf0e10cSrcweir { 2260*cdf0e10cSrcweir if( XML_NAMESPACE_DRAW == nPrefix ) 2261*cdf0e10cSrcweir { 2262*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CAPTION_POINT_X ) ) 2263*cdf0e10cSrcweir { 2264*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maCaptionPoint.X, rValue); 2265*cdf0e10cSrcweir return; 2266*cdf0e10cSrcweir } 2267*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CAPTION_POINT_Y ) ) 2268*cdf0e10cSrcweir { 2269*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(maCaptionPoint.Y, rValue); 2270*cdf0e10cSrcweir return; 2271*cdf0e10cSrcweir } 2272*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CORNER_RADIUS ) ) 2273*cdf0e10cSrcweir { 2274*cdf0e10cSrcweir GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue); 2275*cdf0e10cSrcweir return; 2276*cdf0e10cSrcweir } 2277*cdf0e10cSrcweir } 2278*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 2279*cdf0e10cSrcweir } 2280*cdf0e10cSrcweir 2281*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2282*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2283*cdf0e10cSrcweir 2284*cdf0e10cSrcweir TYPEINIT1( SdXMLGraphicObjectShapeContext, SdXMLShapeContext ); 2285*cdf0e10cSrcweir 2286*cdf0e10cSrcweir SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext( 2287*cdf0e10cSrcweir SvXMLImport& rImport, 2288*cdf0e10cSrcweir sal_uInt16 nPrfx, 2289*cdf0e10cSrcweir const OUString& rLocalName, 2290*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 2291*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 2292*cdf0e10cSrcweir sal_Bool bTemporaryShape) 2293*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 2294*cdf0e10cSrcweir maURL() 2295*cdf0e10cSrcweir { 2296*cdf0e10cSrcweir } 2297*cdf0e10cSrcweir 2298*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2299*cdf0e10cSrcweir 2300*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 2301*cdf0e10cSrcweir void SdXMLGraphicObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 2302*cdf0e10cSrcweir { 2303*cdf0e10cSrcweir if( XML_NAMESPACE_XLINK == nPrefix ) 2304*cdf0e10cSrcweir { 2305*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_HREF ) ) 2306*cdf0e10cSrcweir { 2307*cdf0e10cSrcweir maURL = rValue; 2308*cdf0e10cSrcweir return; 2309*cdf0e10cSrcweir } 2310*cdf0e10cSrcweir } 2311*cdf0e10cSrcweir 2312*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 2313*cdf0e10cSrcweir } 2314*cdf0e10cSrcweir 2315*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2316*cdf0e10cSrcweir 2317*cdf0e10cSrcweir void SdXMLGraphicObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& ) 2318*cdf0e10cSrcweir { 2319*cdf0e10cSrcweir // create graphic object shape 2320*cdf0e10cSrcweir const char *pService; 2321*cdf0e10cSrcweir 2322*cdf0e10cSrcweir if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) && GetImport().GetShapeImport()->IsPresentationShapesSupported() ) 2323*cdf0e10cSrcweir { 2324*cdf0e10cSrcweir pService = "com.sun.star.presentation.GraphicObjectShape"; 2325*cdf0e10cSrcweir } 2326*cdf0e10cSrcweir else 2327*cdf0e10cSrcweir { 2328*cdf0e10cSrcweir pService = "com.sun.star.drawing.GraphicObjectShape"; 2329*cdf0e10cSrcweir } 2330*cdf0e10cSrcweir 2331*cdf0e10cSrcweir AddShape( pService ); 2332*cdf0e10cSrcweir 2333*cdf0e10cSrcweir if(mxShape.is()) 2334*cdf0e10cSrcweir { 2335*cdf0e10cSrcweir SetStyle(); 2336*cdf0e10cSrcweir SetLayer(); 2337*cdf0e10cSrcweir 2338*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropset(mxShape, uno::UNO_QUERY); 2339*cdf0e10cSrcweir if(xPropset.is()) 2340*cdf0e10cSrcweir { 2341*cdf0e10cSrcweir // since OOo 1.x had no line or fill style for graphics, but may create 2342*cdf0e10cSrcweir // documents with them, we have to override them here 2343*cdf0e10cSrcweir sal_Int32 nUPD, nBuildId; 2344*cdf0e10cSrcweir if( GetImport().getBuildIds( nUPD, nBuildId ) && (nUPD == 645) ) try 2345*cdf0e10cSrcweir { 2346*cdf0e10cSrcweir xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), Any( FillStyle_NONE ) ); 2347*cdf0e10cSrcweir xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), Any( LineStyle_NONE ) ); 2348*cdf0e10cSrcweir } 2349*cdf0e10cSrcweir catch( Exception& ) 2350*cdf0e10cSrcweir { 2351*cdf0e10cSrcweir } 2352*cdf0e10cSrcweir 2353*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropsInfo( xPropset->getPropertySetInfo() ); 2354*cdf0e10cSrcweir if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) 2355*cdf0e10cSrcweir xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( mbIsPlaceholder ) ); 2356*cdf0e10cSrcweir 2357*cdf0e10cSrcweir if( !mbIsPlaceholder ) 2358*cdf0e10cSrcweir { 2359*cdf0e10cSrcweir if( maURL.getLength() ) 2360*cdf0e10cSrcweir { 2361*cdf0e10cSrcweir uno::Any aAny; 2362*cdf0e10cSrcweir aAny <<= GetImport().ResolveGraphicObjectURL( maURL, GetImport().isGraphicLoadOnDemandSupported() ); 2363*cdf0e10cSrcweir try 2364*cdf0e10cSrcweir { 2365*cdf0e10cSrcweir xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny ); 2366*cdf0e10cSrcweir xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL") ), aAny ); 2367*cdf0e10cSrcweir } 2368*cdf0e10cSrcweir catch (lang::IllegalArgumentException const &) 2369*cdf0e10cSrcweir { 2370*cdf0e10cSrcweir } 2371*cdf0e10cSrcweir } 2372*cdf0e10cSrcweir } 2373*cdf0e10cSrcweir } 2374*cdf0e10cSrcweir 2375*cdf0e10cSrcweir if(mbIsUserTransformed) 2376*cdf0e10cSrcweir { 2377*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); 2378*cdf0e10cSrcweir if(xProps.is()) 2379*cdf0e10cSrcweir { 2380*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); 2381*cdf0e10cSrcweir if( xPropsInfo.is() ) 2382*cdf0e10cSrcweir { 2383*cdf0e10cSrcweir if( xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) 2384*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); 2385*cdf0e10cSrcweir } 2386*cdf0e10cSrcweir } 2387*cdf0e10cSrcweir } 2388*cdf0e10cSrcweir 2389*cdf0e10cSrcweir // set pos, size, shear and rotate 2390*cdf0e10cSrcweir SetTransformation(); 2391*cdf0e10cSrcweir 2392*cdf0e10cSrcweir SdXMLShapeContext::StartElement(mxAttrList); 2393*cdf0e10cSrcweir } 2394*cdf0e10cSrcweir } 2395*cdf0e10cSrcweir 2396*cdf0e10cSrcweir void SdXMLGraphicObjectShapeContext::EndElement() 2397*cdf0e10cSrcweir { 2398*cdf0e10cSrcweir if( mxBase64Stream.is() ) 2399*cdf0e10cSrcweir { 2400*cdf0e10cSrcweir OUString sURL( GetImport().ResolveGraphicObjectURLFromBase64( mxBase64Stream ) ); 2401*cdf0e10cSrcweir if( sURL.getLength() ) 2402*cdf0e10cSrcweir { 2403*cdf0e10cSrcweir try 2404*cdf0e10cSrcweir { 2405*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); 2406*cdf0e10cSrcweir if(xProps.is()) 2407*cdf0e10cSrcweir { 2408*cdf0e10cSrcweir const uno::Any aAny( uno::makeAny( sURL ) ); 2409*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny ); 2410*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL") ), aAny ); 2411*cdf0e10cSrcweir } 2412*cdf0e10cSrcweir } 2413*cdf0e10cSrcweir catch (lang::IllegalArgumentException const &) 2414*cdf0e10cSrcweir { 2415*cdf0e10cSrcweir } 2416*cdf0e10cSrcweir } 2417*cdf0e10cSrcweir } 2418*cdf0e10cSrcweir 2419*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 2420*cdf0e10cSrcweir } 2421*cdf0e10cSrcweir 2422*cdf0e10cSrcweir 2423*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2424*cdf0e10cSrcweir 2425*cdf0e10cSrcweir SvXMLImportContext* SdXMLGraphicObjectShapeContext::CreateChildContext( 2426*cdf0e10cSrcweir sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 2427*cdf0e10cSrcweir const uno::Reference<xml::sax::XAttributeList>& xAttrList ) 2428*cdf0e10cSrcweir { 2429*cdf0e10cSrcweir SvXMLImportContext* pContext = NULL; 2430*cdf0e10cSrcweir 2431*cdf0e10cSrcweir if( (XML_NAMESPACE_OFFICE == nPrefix) && 2432*cdf0e10cSrcweir xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_BINARY_DATA ) ) 2433*cdf0e10cSrcweir { 2434*cdf0e10cSrcweir if( !maURL.getLength() && !mxBase64Stream.is() ) 2435*cdf0e10cSrcweir { 2436*cdf0e10cSrcweir mxBase64Stream = GetImport().GetStreamForGraphicObjectURLFromBase64(); 2437*cdf0e10cSrcweir if( mxBase64Stream.is() ) 2438*cdf0e10cSrcweir pContext = new XMLBase64ImportContext( GetImport(), nPrefix, 2439*cdf0e10cSrcweir rLocalName, xAttrList, 2440*cdf0e10cSrcweir mxBase64Stream ); 2441*cdf0e10cSrcweir } 2442*cdf0e10cSrcweir } 2443*cdf0e10cSrcweir 2444*cdf0e10cSrcweir // delegate to parent class if no context could be created 2445*cdf0e10cSrcweir if ( NULL == pContext ) 2446*cdf0e10cSrcweir pContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, 2447*cdf0e10cSrcweir xAttrList); 2448*cdf0e10cSrcweir 2449*cdf0e10cSrcweir return pContext; 2450*cdf0e10cSrcweir } 2451*cdf0e10cSrcweir 2452*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2453*cdf0e10cSrcweir 2454*cdf0e10cSrcweir SdXMLGraphicObjectShapeContext::~SdXMLGraphicObjectShapeContext() 2455*cdf0e10cSrcweir { 2456*cdf0e10cSrcweir 2457*cdf0e10cSrcweir } 2458*cdf0e10cSrcweir 2459*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2460*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2461*cdf0e10cSrcweir 2462*cdf0e10cSrcweir TYPEINIT1( SdXMLChartShapeContext, SdXMLShapeContext ); 2463*cdf0e10cSrcweir 2464*cdf0e10cSrcweir SdXMLChartShapeContext::SdXMLChartShapeContext( 2465*cdf0e10cSrcweir SvXMLImport& rImport, 2466*cdf0e10cSrcweir sal_uInt16 nPrfx, 2467*cdf0e10cSrcweir const OUString& rLocalName, 2468*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 2469*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 2470*cdf0e10cSrcweir sal_Bool bTemporaryShape) 2471*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 2472*cdf0e10cSrcweir mpChartContext( NULL ) 2473*cdf0e10cSrcweir { 2474*cdf0e10cSrcweir } 2475*cdf0e10cSrcweir 2476*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2477*cdf0e10cSrcweir 2478*cdf0e10cSrcweir SdXMLChartShapeContext::~SdXMLChartShapeContext() 2479*cdf0e10cSrcweir { 2480*cdf0e10cSrcweir if( mpChartContext ) 2481*cdf0e10cSrcweir delete mpChartContext; 2482*cdf0e10cSrcweir } 2483*cdf0e10cSrcweir 2484*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2485*cdf0e10cSrcweir 2486*cdf0e10cSrcweir void SdXMLChartShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) 2487*cdf0e10cSrcweir { 2488*cdf0e10cSrcweir const sal_Bool bIsPresentation = isPresentationShape(); 2489*cdf0e10cSrcweir 2490*cdf0e10cSrcweir AddShape( bIsPresentation ? "com.sun.star.presentation.ChartShape" : "com.sun.star.drawing.OLE2Shape" ); 2491*cdf0e10cSrcweir 2492*cdf0e10cSrcweir if(mxShape.is()) 2493*cdf0e10cSrcweir { 2494*cdf0e10cSrcweir SetStyle(); 2495*cdf0e10cSrcweir SetLayer(); 2496*cdf0e10cSrcweir 2497*cdf0e10cSrcweir if( !mbIsPlaceholder ) 2498*cdf0e10cSrcweir { 2499*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); 2500*cdf0e10cSrcweir if(xProps.is()) 2501*cdf0e10cSrcweir { 2502*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); 2503*cdf0e10cSrcweir if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) 2504*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); 2505*cdf0e10cSrcweir 2506*cdf0e10cSrcweir uno::Any aAny; 2507*cdf0e10cSrcweir 2508*cdf0e10cSrcweir const OUString aCLSID( RTL_CONSTASCII_USTRINGPARAM("12DCAE26-281F-416F-a234-c3086127382e")); 2509*cdf0e10cSrcweir 2510*cdf0e10cSrcweir aAny <<= aCLSID; 2511*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID") ), aAny ); 2512*cdf0e10cSrcweir 2513*cdf0e10cSrcweir #ifndef SVX_LIGHT 2514*cdf0e10cSrcweir aAny = xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ); 2515*cdf0e10cSrcweir uno::Reference< frame::XModel > xChartModel; 2516*cdf0e10cSrcweir if( aAny >>= xChartModel ) 2517*cdf0e10cSrcweir { 2518*cdf0e10cSrcweir mpChartContext = GetImport().GetChartImport()->CreateChartContext( GetImport(), XML_NAMESPACE_SVG, GetXMLToken(XML_CHART), xChartModel, xAttrList ); 2519*cdf0e10cSrcweir } 2520*cdf0e10cSrcweir #endif 2521*cdf0e10cSrcweir } 2522*cdf0e10cSrcweir } 2523*cdf0e10cSrcweir 2524*cdf0e10cSrcweir if(mbIsUserTransformed) 2525*cdf0e10cSrcweir { 2526*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); 2527*cdf0e10cSrcweir if(xProps.is()) 2528*cdf0e10cSrcweir { 2529*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); 2530*cdf0e10cSrcweir if( xPropsInfo.is() ) 2531*cdf0e10cSrcweir { 2532*cdf0e10cSrcweir if( xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) 2533*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); 2534*cdf0e10cSrcweir } 2535*cdf0e10cSrcweir } 2536*cdf0e10cSrcweir } 2537*cdf0e10cSrcweir 2538*cdf0e10cSrcweir 2539*cdf0e10cSrcweir // set pos, size, shear and rotate 2540*cdf0e10cSrcweir SetTransformation(); 2541*cdf0e10cSrcweir 2542*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 2543*cdf0e10cSrcweir 2544*cdf0e10cSrcweir if( mpChartContext ) 2545*cdf0e10cSrcweir mpChartContext->StartElement( xAttrList ); 2546*cdf0e10cSrcweir } 2547*cdf0e10cSrcweir } 2548*cdf0e10cSrcweir 2549*cdf0e10cSrcweir void SdXMLChartShapeContext::EndElement() 2550*cdf0e10cSrcweir { 2551*cdf0e10cSrcweir if( mpChartContext ) 2552*cdf0e10cSrcweir mpChartContext->EndElement(); 2553*cdf0e10cSrcweir 2554*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 2555*cdf0e10cSrcweir } 2556*cdf0e10cSrcweir 2557*cdf0e10cSrcweir void SdXMLChartShapeContext::Characters( const ::rtl::OUString& rChars ) 2558*cdf0e10cSrcweir { 2559*cdf0e10cSrcweir if( mpChartContext ) 2560*cdf0e10cSrcweir mpChartContext->Characters( rChars ); 2561*cdf0e10cSrcweir } 2562*cdf0e10cSrcweir 2563*cdf0e10cSrcweir SvXMLImportContext * SdXMLChartShapeContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 2564*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ) 2565*cdf0e10cSrcweir { 2566*cdf0e10cSrcweir if( mpChartContext ) 2567*cdf0e10cSrcweir return mpChartContext->CreateChildContext( nPrefix, rLocalName, xAttrList ); 2568*cdf0e10cSrcweir 2569*cdf0e10cSrcweir return NULL; 2570*cdf0e10cSrcweir } 2571*cdf0e10cSrcweir 2572*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2573*cdf0e10cSrcweir 2574*cdf0e10cSrcweir TYPEINIT1( SdXMLObjectShapeContext, SdXMLShapeContext ); 2575*cdf0e10cSrcweir 2576*cdf0e10cSrcweir SdXMLObjectShapeContext::SdXMLObjectShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 2577*cdf0e10cSrcweir const rtl::OUString& rLocalName, 2578*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 2579*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 2580*cdf0e10cSrcweir sal_Bool bTemporaryShape) 2581*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ) 2582*cdf0e10cSrcweir { 2583*cdf0e10cSrcweir } 2584*cdf0e10cSrcweir 2585*cdf0e10cSrcweir SdXMLObjectShapeContext::~SdXMLObjectShapeContext() 2586*cdf0e10cSrcweir { 2587*cdf0e10cSrcweir } 2588*cdf0e10cSrcweir 2589*cdf0e10cSrcweir void SdXMLObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& ) 2590*cdf0e10cSrcweir { 2591*cdf0e10cSrcweir // #96717# in theorie, if we don't have a url we shouldn't even 2592*cdf0e10cSrcweir // export this ole shape. But practical its to risky right now 2593*cdf0e10cSrcweir // to change this so we better dispose this on load 2594*cdf0e10cSrcweir //if( !mbIsPlaceholder && ImpIsEmptyURL(maHref) ) 2595*cdf0e10cSrcweir // return; 2596*cdf0e10cSrcweir 2597*cdf0e10cSrcweir // #100592# this BugFix prevents that a shape is created. CL 2598*cdf0e10cSrcweir // is thinking about an alternative. 2599*cdf0e10cSrcweir // #i13140# Check for more than empty string in maHref, there are 2600*cdf0e10cSrcweir // other possibilities that maHref results in empty container 2601*cdf0e10cSrcweir // storage names 2602*cdf0e10cSrcweir if( !(GetImport().getImportFlags() & IMPORT_EMBEDDED) && !mbIsPlaceholder && ImpIsEmptyURL(maHref) ) 2603*cdf0e10cSrcweir return; 2604*cdf0e10cSrcweir 2605*cdf0e10cSrcweir const char* pService = "com.sun.star.drawing.OLE2Shape"; 2606*cdf0e10cSrcweir 2607*cdf0e10cSrcweir sal_Bool bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); 2608*cdf0e10cSrcweir 2609*cdf0e10cSrcweir if( bIsPresShape ) 2610*cdf0e10cSrcweir { 2611*cdf0e10cSrcweir if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) ) 2612*cdf0e10cSrcweir { 2613*cdf0e10cSrcweir pService = "com.sun.star.presentation.ChartShape"; 2614*cdf0e10cSrcweir } 2615*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ) 2616*cdf0e10cSrcweir { 2617*cdf0e10cSrcweir pService = "com.sun.star.presentation.CalcShape"; 2618*cdf0e10cSrcweir } 2619*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) ) 2620*cdf0e10cSrcweir { 2621*cdf0e10cSrcweir pService = "com.sun.star.presentation.OLE2Shape"; 2622*cdf0e10cSrcweir } 2623*cdf0e10cSrcweir } 2624*cdf0e10cSrcweir 2625*cdf0e10cSrcweir AddShape( pService ); 2626*cdf0e10cSrcweir 2627*cdf0e10cSrcweir if( mxShape.is() ) 2628*cdf0e10cSrcweir { 2629*cdf0e10cSrcweir SetLayer(); 2630*cdf0e10cSrcweir 2631*cdf0e10cSrcweir if(bIsPresShape) 2632*cdf0e10cSrcweir { 2633*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); 2634*cdf0e10cSrcweir if(xProps.is()) 2635*cdf0e10cSrcweir { 2636*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); 2637*cdf0e10cSrcweir if( xPropsInfo.is() ) 2638*cdf0e10cSrcweir { 2639*cdf0e10cSrcweir if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) 2640*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); 2641*cdf0e10cSrcweir 2642*cdf0e10cSrcweir if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) 2643*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); 2644*cdf0e10cSrcweir } 2645*cdf0e10cSrcweir } 2646*cdf0e10cSrcweir } 2647*cdf0e10cSrcweir 2648*cdf0e10cSrcweir if( !mbIsPlaceholder && maHref.getLength() ) 2649*cdf0e10cSrcweir { 2650*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 2651*cdf0e10cSrcweir 2652*cdf0e10cSrcweir if( xProps.is() ) 2653*cdf0e10cSrcweir { 2654*cdf0e10cSrcweir OUString aPersistName = GetImport().ResolveEmbeddedObjectURL( maHref, maCLSID ); 2655*cdf0e10cSrcweir 2656*cdf0e10cSrcweir if ( GetImport().IsPackageURL( maHref ) ) 2657*cdf0e10cSrcweir { 2658*cdf0e10cSrcweir const OUString sURL(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" )); 2659*cdf0e10cSrcweir 2660*cdf0e10cSrcweir if ( aPersistName.compareTo( sURL, sURL.getLength() ) == 0 ) 2661*cdf0e10cSrcweir aPersistName = aPersistName.copy( sURL.getLength() ); 2662*cdf0e10cSrcweir 2663*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ), 2664*cdf0e10cSrcweir uno::makeAny( aPersistName ) ); 2665*cdf0e10cSrcweir } 2666*cdf0e10cSrcweir else 2667*cdf0e10cSrcweir { 2668*cdf0e10cSrcweir // this is OOo link object 2669*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LinkURL" ) ), 2670*cdf0e10cSrcweir uno::makeAny( aPersistName ) ); 2671*cdf0e10cSrcweir } 2672*cdf0e10cSrcweir } 2673*cdf0e10cSrcweir } 2674*cdf0e10cSrcweir 2675*cdf0e10cSrcweir // set pos, size, shear and rotate 2676*cdf0e10cSrcweir SetTransformation(); 2677*cdf0e10cSrcweir 2678*cdf0e10cSrcweir SetStyle(); 2679*cdf0e10cSrcweir 2680*cdf0e10cSrcweir GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); 2681*cdf0e10cSrcweir } 2682*cdf0e10cSrcweir } 2683*cdf0e10cSrcweir 2684*cdf0e10cSrcweir void SdXMLObjectShapeContext::EndElement() 2685*cdf0e10cSrcweir { 2686*cdf0e10cSrcweir // #100592# 2687*cdf0e10cSrcweir if( mxBase64Stream.is() ) 2688*cdf0e10cSrcweir { 2689*cdf0e10cSrcweir OUString aPersistName( GetImport().ResolveEmbeddedObjectURLFromBase64() ); 2690*cdf0e10cSrcweir const OUString sURL(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" )); 2691*cdf0e10cSrcweir 2692*cdf0e10cSrcweir aPersistName = aPersistName.copy( sURL.getLength() ); 2693*cdf0e10cSrcweir 2694*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); 2695*cdf0e10cSrcweir if( xProps.is() ) 2696*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ), uno::makeAny( aPersistName ) ); 2697*cdf0e10cSrcweir } 2698*cdf0e10cSrcweir 2699*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 2700*cdf0e10cSrcweir } 2701*cdf0e10cSrcweir 2702*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 2703*cdf0e10cSrcweir void SdXMLObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 2704*cdf0e10cSrcweir { 2705*cdf0e10cSrcweir switch( nPrefix ) 2706*cdf0e10cSrcweir { 2707*cdf0e10cSrcweir case XML_NAMESPACE_DRAW: 2708*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CLASS_ID ) ) 2709*cdf0e10cSrcweir { 2710*cdf0e10cSrcweir maCLSID = rValue; 2711*cdf0e10cSrcweir return; 2712*cdf0e10cSrcweir } 2713*cdf0e10cSrcweir break; 2714*cdf0e10cSrcweir case XML_NAMESPACE_XLINK: 2715*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_HREF ) ) 2716*cdf0e10cSrcweir { 2717*cdf0e10cSrcweir maHref = rValue; 2718*cdf0e10cSrcweir return; 2719*cdf0e10cSrcweir } 2720*cdf0e10cSrcweir break; 2721*cdf0e10cSrcweir } 2722*cdf0e10cSrcweir 2723*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 2724*cdf0e10cSrcweir } 2725*cdf0e10cSrcweir 2726*cdf0e10cSrcweir SvXMLImportContext* SdXMLObjectShapeContext::CreateChildContext( 2727*cdf0e10cSrcweir sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 2728*cdf0e10cSrcweir const uno::Reference<xml::sax::XAttributeList>& xAttrList ) 2729*cdf0e10cSrcweir { 2730*cdf0e10cSrcweir // #100592# 2731*cdf0e10cSrcweir SvXMLImportContext* pContext = NULL; 2732*cdf0e10cSrcweir 2733*cdf0e10cSrcweir if((XML_NAMESPACE_OFFICE == nPrefix) && IsXMLToken(rLocalName, XML_BINARY_DATA)) 2734*cdf0e10cSrcweir { 2735*cdf0e10cSrcweir mxBase64Stream = GetImport().GetStreamForEmbeddedObjectURLFromBase64(); 2736*cdf0e10cSrcweir if( mxBase64Stream.is() ) 2737*cdf0e10cSrcweir pContext = new XMLBase64ImportContext( GetImport(), nPrefix, 2738*cdf0e10cSrcweir rLocalName, xAttrList, 2739*cdf0e10cSrcweir mxBase64Stream ); 2740*cdf0e10cSrcweir } 2741*cdf0e10cSrcweir else if( ((XML_NAMESPACE_OFFICE == nPrefix) && IsXMLToken(rLocalName, XML_DOCUMENT)) || 2742*cdf0e10cSrcweir ((XML_NAMESPACE_MATH == nPrefix) && IsXMLToken(rLocalName, XML_MATH)) ) 2743*cdf0e10cSrcweir { 2744*cdf0e10cSrcweir XMLEmbeddedObjectImportContext *pEContext = 2745*cdf0e10cSrcweir new XMLEmbeddedObjectImportContext( GetImport(), nPrefix, 2746*cdf0e10cSrcweir rLocalName, xAttrList ); 2747*cdf0e10cSrcweir maCLSID = pEContext->GetFilterCLSID(); 2748*cdf0e10cSrcweir if( maCLSID.getLength() != 0 ) 2749*cdf0e10cSrcweir { 2750*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); 2751*cdf0e10cSrcweir if( xPropSet.is() ) 2752*cdf0e10cSrcweir { 2753*cdf0e10cSrcweir xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID") ), uno::makeAny( maCLSID ) ); 2754*cdf0e10cSrcweir 2755*cdf0e10cSrcweir uno::Reference< lang::XComponent > xComp; 2756*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xComp; 2757*cdf0e10cSrcweir DBG_ASSERT( xComp.is(), "no xModel for own OLE format" ); 2758*cdf0e10cSrcweir pEContext->SetComponent( xComp ); 2759*cdf0e10cSrcweir } 2760*cdf0e10cSrcweir } 2761*cdf0e10cSrcweir pContext = pEContext; 2762*cdf0e10cSrcweir } 2763*cdf0e10cSrcweir 2764*cdf0e10cSrcweir // delegate to parent class if no context could be created 2765*cdf0e10cSrcweir if(!pContext) 2766*cdf0e10cSrcweir pContext = SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList); 2767*cdf0e10cSrcweir 2768*cdf0e10cSrcweir return pContext; 2769*cdf0e10cSrcweir } 2770*cdf0e10cSrcweir 2771*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2772*cdf0e10cSrcweir 2773*cdf0e10cSrcweir TYPEINIT1( SdXMLAppletShapeContext, SdXMLShapeContext ); 2774*cdf0e10cSrcweir 2775*cdf0e10cSrcweir SdXMLAppletShapeContext::SdXMLAppletShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 2776*cdf0e10cSrcweir const rtl::OUString& rLocalName, 2777*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 2778*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 2779*cdf0e10cSrcweir sal_Bool bTemporaryShape) 2780*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 2781*cdf0e10cSrcweir mbIsScript( sal_False ) 2782*cdf0e10cSrcweir { 2783*cdf0e10cSrcweir } 2784*cdf0e10cSrcweir 2785*cdf0e10cSrcweir SdXMLAppletShapeContext::~SdXMLAppletShapeContext() 2786*cdf0e10cSrcweir { 2787*cdf0e10cSrcweir } 2788*cdf0e10cSrcweir 2789*cdf0e10cSrcweir void SdXMLAppletShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& ) 2790*cdf0e10cSrcweir { 2791*cdf0e10cSrcweir const char* pService = "com.sun.star.drawing.AppletShape"; 2792*cdf0e10cSrcweir AddShape( pService ); 2793*cdf0e10cSrcweir 2794*cdf0e10cSrcweir if( mxShape.is() ) 2795*cdf0e10cSrcweir { 2796*cdf0e10cSrcweir SetLayer(); 2797*cdf0e10cSrcweir 2798*cdf0e10cSrcweir // set pos, size, shear and rotate 2799*cdf0e10cSrcweir SetTransformation(); 2800*cdf0e10cSrcweir GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); 2801*cdf0e10cSrcweir } 2802*cdf0e10cSrcweir } 2803*cdf0e10cSrcweir 2804*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 2805*cdf0e10cSrcweir void SdXMLAppletShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 2806*cdf0e10cSrcweir { 2807*cdf0e10cSrcweir switch( nPrefix ) 2808*cdf0e10cSrcweir { 2809*cdf0e10cSrcweir case XML_NAMESPACE_DRAW: 2810*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_APPLET_NAME ) ) 2811*cdf0e10cSrcweir { 2812*cdf0e10cSrcweir maAppletName = rValue; 2813*cdf0e10cSrcweir return; 2814*cdf0e10cSrcweir } 2815*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_CODE ) ) 2816*cdf0e10cSrcweir { 2817*cdf0e10cSrcweir maAppletCode = rValue; 2818*cdf0e10cSrcweir return; 2819*cdf0e10cSrcweir } 2820*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_MAY_SCRIPT ) ) 2821*cdf0e10cSrcweir { 2822*cdf0e10cSrcweir mbIsScript = IsXMLToken( rValue, XML_TRUE ); 2823*cdf0e10cSrcweir return; 2824*cdf0e10cSrcweir } 2825*cdf0e10cSrcweir break; 2826*cdf0e10cSrcweir case XML_NAMESPACE_XLINK: 2827*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_HREF ) ) 2828*cdf0e10cSrcweir { 2829*cdf0e10cSrcweir maHref = GetImport().GetAbsoluteReference(rValue); 2830*cdf0e10cSrcweir return; 2831*cdf0e10cSrcweir } 2832*cdf0e10cSrcweir break; 2833*cdf0e10cSrcweir } 2834*cdf0e10cSrcweir 2835*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 2836*cdf0e10cSrcweir } 2837*cdf0e10cSrcweir 2838*cdf0e10cSrcweir void SdXMLAppletShapeContext::EndElement() 2839*cdf0e10cSrcweir { 2840*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 2841*cdf0e10cSrcweir if( xProps.is() ) 2842*cdf0e10cSrcweir { 2843*cdf0e10cSrcweir uno::Any aAny; 2844*cdf0e10cSrcweir 2845*cdf0e10cSrcweir if ( maSize.Width && maSize.Height ) 2846*cdf0e10cSrcweir { 2847*cdf0e10cSrcweir // the visual area for applet must be set on loading 2848*cdf0e10cSrcweir awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height ); 2849*cdf0e10cSrcweir aAny <<= aRect; 2850*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny ); 2851*cdf0e10cSrcweir } 2852*cdf0e10cSrcweir 2853*cdf0e10cSrcweir if( maParams.getLength() ) 2854*cdf0e10cSrcweir { 2855*cdf0e10cSrcweir aAny <<= maParams; 2856*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCommands" ) ), aAny ); 2857*cdf0e10cSrcweir } 2858*cdf0e10cSrcweir 2859*cdf0e10cSrcweir if( maHref.getLength() ) 2860*cdf0e10cSrcweir { 2861*cdf0e10cSrcweir aAny <<= maHref; 2862*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCodeBase" ) ), aAny ); 2863*cdf0e10cSrcweir } 2864*cdf0e10cSrcweir 2865*cdf0e10cSrcweir if( maAppletName.getLength() ) 2866*cdf0e10cSrcweir { 2867*cdf0e10cSrcweir aAny <<= maAppletName; 2868*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletName" ) ), aAny ); 2869*cdf0e10cSrcweir } 2870*cdf0e10cSrcweir 2871*cdf0e10cSrcweir if( mbIsScript ) 2872*cdf0e10cSrcweir { 2873*cdf0e10cSrcweir aAny <<= mbIsScript; 2874*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletIsScript" ) ), aAny ); 2875*cdf0e10cSrcweir 2876*cdf0e10cSrcweir } 2877*cdf0e10cSrcweir 2878*cdf0e10cSrcweir if( maAppletCode.getLength() ) 2879*cdf0e10cSrcweir { 2880*cdf0e10cSrcweir aAny <<= maAppletCode; 2881*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCode" ) ), aAny ); 2882*cdf0e10cSrcweir } 2883*cdf0e10cSrcweir 2884*cdf0e10cSrcweir aAny <<= ::rtl::OUString( GetImport().GetDocumentBase() ); 2885*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletDocBase" ) ), aAny ); 2886*cdf0e10cSrcweir 2887*cdf0e10cSrcweir SetThumbnail(); 2888*cdf0e10cSrcweir } 2889*cdf0e10cSrcweir 2890*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 2891*cdf0e10cSrcweir } 2892*cdf0e10cSrcweir 2893*cdf0e10cSrcweir SvXMLImportContext * SdXMLAppletShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ) 2894*cdf0e10cSrcweir { 2895*cdf0e10cSrcweir if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) ) 2896*cdf0e10cSrcweir { 2897*cdf0e10cSrcweir OUString aParamName, aParamValue; 2898*cdf0e10cSrcweir const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 2899*cdf0e10cSrcweir // now parse the attribute list and look for draw:name and draw:value 2900*cdf0e10cSrcweir for(sal_Int16 a(0); a < nAttrCount; a++) 2901*cdf0e10cSrcweir { 2902*cdf0e10cSrcweir const OUString& rAttrName = xAttrList->getNameByIndex(a); 2903*cdf0e10cSrcweir OUString aLocalName; 2904*cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName); 2905*cdf0e10cSrcweir const OUString aValue( xAttrList->getValueByIndex(a) ); 2906*cdf0e10cSrcweir 2907*cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_DRAW ) 2908*cdf0e10cSrcweir { 2909*cdf0e10cSrcweir if( IsXMLToken( aLocalName, XML_NAME ) ) 2910*cdf0e10cSrcweir { 2911*cdf0e10cSrcweir aParamName = aValue; 2912*cdf0e10cSrcweir } 2913*cdf0e10cSrcweir else if( IsXMLToken( aLocalName, XML_VALUE ) ) 2914*cdf0e10cSrcweir { 2915*cdf0e10cSrcweir aParamValue = aValue; 2916*cdf0e10cSrcweir } 2917*cdf0e10cSrcweir } 2918*cdf0e10cSrcweir } 2919*cdf0e10cSrcweir 2920*cdf0e10cSrcweir if( aParamName.getLength() ) 2921*cdf0e10cSrcweir { 2922*cdf0e10cSrcweir sal_Int32 nIndex = maParams.getLength(); 2923*cdf0e10cSrcweir maParams.realloc( nIndex + 1 ); 2924*cdf0e10cSrcweir maParams[nIndex].Name = aParamName; 2925*cdf0e10cSrcweir maParams[nIndex].Handle = -1; 2926*cdf0e10cSrcweir maParams[nIndex].Value <<= aParamValue; 2927*cdf0e10cSrcweir maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE; 2928*cdf0e10cSrcweir } 2929*cdf0e10cSrcweir 2930*cdf0e10cSrcweir return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName ); 2931*cdf0e10cSrcweir } 2932*cdf0e10cSrcweir 2933*cdf0e10cSrcweir return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList ); 2934*cdf0e10cSrcweir } 2935*cdf0e10cSrcweir 2936*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 2937*cdf0e10cSrcweir 2938*cdf0e10cSrcweir TYPEINIT1( SdXMLPluginShapeContext, SdXMLShapeContext ); 2939*cdf0e10cSrcweir 2940*cdf0e10cSrcweir SdXMLPluginShapeContext::SdXMLPluginShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 2941*cdf0e10cSrcweir const rtl::OUString& rLocalName, 2942*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 2943*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 2944*cdf0e10cSrcweir sal_Bool bTemporaryShape) : 2945*cdf0e10cSrcweir SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 2946*cdf0e10cSrcweir mbMedia( false ) 2947*cdf0e10cSrcweir { 2948*cdf0e10cSrcweir } 2949*cdf0e10cSrcweir 2950*cdf0e10cSrcweir SdXMLPluginShapeContext::~SdXMLPluginShapeContext() 2951*cdf0e10cSrcweir { 2952*cdf0e10cSrcweir } 2953*cdf0e10cSrcweir 2954*cdf0e10cSrcweir void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList) 2955*cdf0e10cSrcweir { 2956*cdf0e10cSrcweir // watch for MimeType attribute to see if we have a media object 2957*cdf0e10cSrcweir for( sal_Int16 n = 0, nAttrCount = ( xAttrList.is() ? xAttrList->getLength() : 0 ); n < nAttrCount; ++n ) 2958*cdf0e10cSrcweir { 2959*cdf0e10cSrcweir OUString aLocalName; 2960*cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( n ), &aLocalName ); 2961*cdf0e10cSrcweir 2962*cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( aLocalName, XML_MIME_TYPE ) ) 2963*cdf0e10cSrcweir { 2964*cdf0e10cSrcweir if( 0 == xAttrList->getValueByIndex( n ).compareToAscii( "application/vnd.sun.star.media" ) ) 2965*cdf0e10cSrcweir mbMedia = true; 2966*cdf0e10cSrcweir 2967*cdf0e10cSrcweir // leave this loop 2968*cdf0e10cSrcweir n = nAttrCount - 1; 2969*cdf0e10cSrcweir } 2970*cdf0e10cSrcweir } 2971*cdf0e10cSrcweir 2972*cdf0e10cSrcweir const char* pService; 2973*cdf0e10cSrcweir 2974*cdf0e10cSrcweir sal_Bool bIsPresShape = sal_False; 2975*cdf0e10cSrcweir 2976*cdf0e10cSrcweir if( mbMedia ) 2977*cdf0e10cSrcweir { 2978*cdf0e10cSrcweir pService = "com.sun.star.drawing.MediaShape"; 2979*cdf0e10cSrcweir 2980*cdf0e10cSrcweir bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); 2981*cdf0e10cSrcweir if( bIsPresShape ) 2982*cdf0e10cSrcweir { 2983*cdf0e10cSrcweir if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) ) 2984*cdf0e10cSrcweir { 2985*cdf0e10cSrcweir pService = "com.sun.star.presentation.MediaShape"; 2986*cdf0e10cSrcweir } 2987*cdf0e10cSrcweir } 2988*cdf0e10cSrcweir } 2989*cdf0e10cSrcweir else 2990*cdf0e10cSrcweir pService = "com.sun.star.drawing.PluginShape"; 2991*cdf0e10cSrcweir 2992*cdf0e10cSrcweir AddShape( pService ); 2993*cdf0e10cSrcweir 2994*cdf0e10cSrcweir if( mxShape.is() ) 2995*cdf0e10cSrcweir { 2996*cdf0e10cSrcweir SetLayer(); 2997*cdf0e10cSrcweir 2998*cdf0e10cSrcweir if(bIsPresShape) 2999*cdf0e10cSrcweir { 3000*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 3001*cdf0e10cSrcweir if(xProps.is()) 3002*cdf0e10cSrcweir { 3003*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); 3004*cdf0e10cSrcweir if( xPropsInfo.is() ) 3005*cdf0e10cSrcweir { 3006*cdf0e10cSrcweir if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) 3007*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); 3008*cdf0e10cSrcweir 3009*cdf0e10cSrcweir if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) 3010*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); 3011*cdf0e10cSrcweir } 3012*cdf0e10cSrcweir } 3013*cdf0e10cSrcweir } 3014*cdf0e10cSrcweir 3015*cdf0e10cSrcweir // set pos, size, shear and rotate 3016*cdf0e10cSrcweir SetTransformation(); 3017*cdf0e10cSrcweir GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); 3018*cdf0e10cSrcweir } 3019*cdf0e10cSrcweir } 3020*cdf0e10cSrcweir 3021*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 3022*cdf0e10cSrcweir void SdXMLPluginShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 3023*cdf0e10cSrcweir { 3024*cdf0e10cSrcweir switch( nPrefix ) 3025*cdf0e10cSrcweir { 3026*cdf0e10cSrcweir case XML_NAMESPACE_DRAW: 3027*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_MIME_TYPE ) ) 3028*cdf0e10cSrcweir { 3029*cdf0e10cSrcweir maMimeType = rValue; 3030*cdf0e10cSrcweir return; 3031*cdf0e10cSrcweir } 3032*cdf0e10cSrcweir break; 3033*cdf0e10cSrcweir case XML_NAMESPACE_XLINK: 3034*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_HREF ) ) 3035*cdf0e10cSrcweir { 3036*cdf0e10cSrcweir maHref = GetImport().GetAbsoluteReference(rValue); 3037*cdf0e10cSrcweir return; 3038*cdf0e10cSrcweir } 3039*cdf0e10cSrcweir break; 3040*cdf0e10cSrcweir } 3041*cdf0e10cSrcweir 3042*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 3043*cdf0e10cSrcweir } 3044*cdf0e10cSrcweir 3045*cdf0e10cSrcweir void SdXMLPluginShapeContext::EndElement() 3046*cdf0e10cSrcweir { 3047*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 3048*cdf0e10cSrcweir 3049*cdf0e10cSrcweir if( xProps.is() ) 3050*cdf0e10cSrcweir { 3051*cdf0e10cSrcweir uno::Any aAny; 3052*cdf0e10cSrcweir 3053*cdf0e10cSrcweir if ( maSize.Width && maSize.Height ) 3054*cdf0e10cSrcweir { 3055*cdf0e10cSrcweir const rtl::OUString sVisibleArea( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ); 3056*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > aXPropSetInfo( xProps->getPropertySetInfo() ); 3057*cdf0e10cSrcweir if ( !aXPropSetInfo.is() || aXPropSetInfo->hasPropertyByName( sVisibleArea ) ) 3058*cdf0e10cSrcweir { 3059*cdf0e10cSrcweir // the visual area for a plugin must be set on loading 3060*cdf0e10cSrcweir awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height ); 3061*cdf0e10cSrcweir aAny <<= aRect; 3062*cdf0e10cSrcweir xProps->setPropertyValue( sVisibleArea, aAny ); 3063*cdf0e10cSrcweir } 3064*cdf0e10cSrcweir } 3065*cdf0e10cSrcweir 3066*cdf0e10cSrcweir if( !mbMedia ) 3067*cdf0e10cSrcweir { 3068*cdf0e10cSrcweir // in case we have a plugin object 3069*cdf0e10cSrcweir if( maParams.getLength() ) 3070*cdf0e10cSrcweir { 3071*cdf0e10cSrcweir aAny <<= maParams; 3072*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginCommands" ) ), aAny ); 3073*cdf0e10cSrcweir } 3074*cdf0e10cSrcweir 3075*cdf0e10cSrcweir if( maMimeType.getLength() ) 3076*cdf0e10cSrcweir { 3077*cdf0e10cSrcweir aAny <<= maMimeType; 3078*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginMimeType" ) ), aAny ); 3079*cdf0e10cSrcweir } 3080*cdf0e10cSrcweir 3081*cdf0e10cSrcweir if( maHref.getLength() ) 3082*cdf0e10cSrcweir { 3083*cdf0e10cSrcweir aAny <<= maHref; 3084*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginURL" ) ), aAny ); 3085*cdf0e10cSrcweir } 3086*cdf0e10cSrcweir } 3087*cdf0e10cSrcweir else 3088*cdf0e10cSrcweir { 3089*cdf0e10cSrcweir // in case we have a media object 3090*cdf0e10cSrcweir 3091*cdf0e10cSrcweir OUString sTempRef; 3092*cdf0e10cSrcweir 3093*cdf0e10cSrcweir // check for package URL 3094*cdf0e10cSrcweir if( GetImport().IsPackageURL( maHref ) ) 3095*cdf0e10cSrcweir { 3096*cdf0e10cSrcweir sTempRef = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) ); 3097*cdf0e10cSrcweir } 3098*cdf0e10cSrcweir 3099*cdf0e10cSrcweir sTempRef += maHref; 3100*cdf0e10cSrcweir 3101*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ), uno::makeAny( sTempRef ) ); 3102*cdf0e10cSrcweir 3103*cdf0e10cSrcweir for( sal_Int32 nParam = 0; nParam < maParams.getLength(); ++nParam ) 3104*cdf0e10cSrcweir { 3105*cdf0e10cSrcweir const OUString& rName = maParams[ nParam ].Name; 3106*cdf0e10cSrcweir 3107*cdf0e10cSrcweir if( 0 == rName.compareToAscii( "Loop" ) ) 3108*cdf0e10cSrcweir { 3109*cdf0e10cSrcweir OUString aValueStr; 3110*cdf0e10cSrcweir maParams[ nParam ].Value >>= aValueStr; 3111*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Loop" ) ), 3112*cdf0e10cSrcweir uno::makeAny( static_cast< sal_Bool >( 0 == aValueStr.compareToAscii( "true" ) ) ) ); 3113*cdf0e10cSrcweir } 3114*cdf0e10cSrcweir else if( 0 == rName.compareToAscii( "Mute" ) ) 3115*cdf0e10cSrcweir { 3116*cdf0e10cSrcweir OUString aValueStr; 3117*cdf0e10cSrcweir maParams[ nParam ].Value >>= aValueStr; 3118*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Mute" ) ), 3119*cdf0e10cSrcweir uno::makeAny( static_cast< sal_Bool >( 0 == aValueStr.compareToAscii( "true" ) ) ) ); 3120*cdf0e10cSrcweir } 3121*cdf0e10cSrcweir else if( 0 == rName.compareToAscii( "VolumeDB" ) ) 3122*cdf0e10cSrcweir { 3123*cdf0e10cSrcweir OUString aValueStr; 3124*cdf0e10cSrcweir maParams[ nParam ].Value >>= aValueStr; 3125*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ), 3126*cdf0e10cSrcweir uno::makeAny( static_cast< sal_Int16 >( aValueStr.toInt32() ) ) ); 3127*cdf0e10cSrcweir } 3128*cdf0e10cSrcweir else if( 0 == rName.compareToAscii( "Zoom" ) ) 3129*cdf0e10cSrcweir { 3130*cdf0e10cSrcweir OUString aZoomStr; 3131*cdf0e10cSrcweir media::ZoomLevel eZoomLevel; 3132*cdf0e10cSrcweir 3133*cdf0e10cSrcweir maParams[ nParam ].Value >>= aZoomStr; 3134*cdf0e10cSrcweir 3135*cdf0e10cSrcweir if( 0 == aZoomStr.compareToAscii( "25%" ) ) 3136*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_ZOOM_1_TO_4; 3137*cdf0e10cSrcweir else if( 0 == aZoomStr.compareToAscii( "50%" ) ) 3138*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_ZOOM_1_TO_2; 3139*cdf0e10cSrcweir else if( 0 == aZoomStr.compareToAscii( "100%" ) ) 3140*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_ORIGINAL; 3141*cdf0e10cSrcweir else if( 0 == aZoomStr.compareToAscii( "200%" ) ) 3142*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_ZOOM_2_TO_1; 3143*cdf0e10cSrcweir else if( 0 == aZoomStr.compareToAscii( "400%" ) ) 3144*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_ZOOM_4_TO_1; 3145*cdf0e10cSrcweir else if( 0 == aZoomStr.compareToAscii( "fit" ) ) 3146*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW; 3147*cdf0e10cSrcweir else if( 0 == aZoomStr.compareToAscii( "fixedfit" ) ) 3148*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT; 3149*cdf0e10cSrcweir else if( 0 == aZoomStr.compareToAscii( "fullscreen" ) ) 3150*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_FULLSCREEN; 3151*cdf0e10cSrcweir else 3152*cdf0e10cSrcweir eZoomLevel = media::ZoomLevel_NOT_AVAILABLE; 3153*cdf0e10cSrcweir 3154*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ), uno::makeAny( eZoomLevel ) ); 3155*cdf0e10cSrcweir } 3156*cdf0e10cSrcweir } 3157*cdf0e10cSrcweir } 3158*cdf0e10cSrcweir 3159*cdf0e10cSrcweir SetThumbnail(); 3160*cdf0e10cSrcweir } 3161*cdf0e10cSrcweir 3162*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 3163*cdf0e10cSrcweir } 3164*cdf0e10cSrcweir 3165*cdf0e10cSrcweir SvXMLImportContext * SdXMLPluginShapeContext::CreateChildContext( sal_uInt16 p_nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ) 3166*cdf0e10cSrcweir { 3167*cdf0e10cSrcweir if( p_nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_PARAM ) ) 3168*cdf0e10cSrcweir { 3169*cdf0e10cSrcweir OUString aParamName, aParamValue; 3170*cdf0e10cSrcweir const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 3171*cdf0e10cSrcweir // now parse the attribute list and look for draw:name and draw:value 3172*cdf0e10cSrcweir for(sal_Int16 a(0); a < nAttrCount; a++) 3173*cdf0e10cSrcweir { 3174*cdf0e10cSrcweir const OUString& rAttrName = xAttrList->getNameByIndex(a); 3175*cdf0e10cSrcweir OUString aLocalName; 3176*cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName); 3177*cdf0e10cSrcweir const OUString aValue( xAttrList->getValueByIndex(a) ); 3178*cdf0e10cSrcweir 3179*cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_DRAW ) 3180*cdf0e10cSrcweir { 3181*cdf0e10cSrcweir if( IsXMLToken( aLocalName, XML_NAME ) ) 3182*cdf0e10cSrcweir { 3183*cdf0e10cSrcweir aParamName = aValue; 3184*cdf0e10cSrcweir } 3185*cdf0e10cSrcweir else if( IsXMLToken( aLocalName, XML_VALUE ) ) 3186*cdf0e10cSrcweir { 3187*cdf0e10cSrcweir aParamValue = aValue; 3188*cdf0e10cSrcweir } 3189*cdf0e10cSrcweir } 3190*cdf0e10cSrcweir 3191*cdf0e10cSrcweir if( aParamName.getLength() ) 3192*cdf0e10cSrcweir { 3193*cdf0e10cSrcweir sal_Int32 nIndex = maParams.getLength(); 3194*cdf0e10cSrcweir maParams.realloc( nIndex + 1 ); 3195*cdf0e10cSrcweir maParams[nIndex].Name = aParamName; 3196*cdf0e10cSrcweir maParams[nIndex].Handle = -1; 3197*cdf0e10cSrcweir maParams[nIndex].Value <<= aParamValue; 3198*cdf0e10cSrcweir maParams[nIndex].State = beans::PropertyState_DIRECT_VALUE; 3199*cdf0e10cSrcweir } 3200*cdf0e10cSrcweir } 3201*cdf0e10cSrcweir 3202*cdf0e10cSrcweir return new SvXMLImportContext( GetImport(), p_nPrefix, rLocalName ); 3203*cdf0e10cSrcweir } 3204*cdf0e10cSrcweir 3205*cdf0e10cSrcweir return SdXMLShapeContext::CreateChildContext( p_nPrefix, rLocalName, xAttrList ); 3206*cdf0e10cSrcweir } 3207*cdf0e10cSrcweir 3208*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 3209*cdf0e10cSrcweir 3210*cdf0e10cSrcweir TYPEINIT1( SdXMLFloatingFrameShapeContext, SdXMLShapeContext ); 3211*cdf0e10cSrcweir 3212*cdf0e10cSrcweir SdXMLFloatingFrameShapeContext::SdXMLFloatingFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 3213*cdf0e10cSrcweir const rtl::OUString& rLocalName, 3214*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 3215*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 3216*cdf0e10cSrcweir sal_Bool bTemporaryShape) 3217*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ) 3218*cdf0e10cSrcweir { 3219*cdf0e10cSrcweir } 3220*cdf0e10cSrcweir 3221*cdf0e10cSrcweir SdXMLFloatingFrameShapeContext::~SdXMLFloatingFrameShapeContext() 3222*cdf0e10cSrcweir { 3223*cdf0e10cSrcweir } 3224*cdf0e10cSrcweir 3225*cdf0e10cSrcweir void SdXMLFloatingFrameShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& ) 3226*cdf0e10cSrcweir { 3227*cdf0e10cSrcweir const char* pService = "com.sun.star.drawing.FrameShape"; 3228*cdf0e10cSrcweir AddShape( pService ); 3229*cdf0e10cSrcweir 3230*cdf0e10cSrcweir if( mxShape.is() ) 3231*cdf0e10cSrcweir { 3232*cdf0e10cSrcweir SetLayer(); 3233*cdf0e10cSrcweir 3234*cdf0e10cSrcweir // set pos, size, shear and rotate 3235*cdf0e10cSrcweir SetTransformation(); 3236*cdf0e10cSrcweir 3237*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 3238*cdf0e10cSrcweir if( xProps.is() ) 3239*cdf0e10cSrcweir { 3240*cdf0e10cSrcweir uno::Any aAny; 3241*cdf0e10cSrcweir 3242*cdf0e10cSrcweir if( maFrameName.getLength() ) 3243*cdf0e10cSrcweir { 3244*cdf0e10cSrcweir aAny <<= maFrameName; 3245*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameName" ) ), aAny ); 3246*cdf0e10cSrcweir } 3247*cdf0e10cSrcweir 3248*cdf0e10cSrcweir if( maHref.getLength() ) 3249*cdf0e10cSrcweir { 3250*cdf0e10cSrcweir aAny <<= maHref; 3251*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameURL" ) ), aAny ); 3252*cdf0e10cSrcweir } 3253*cdf0e10cSrcweir } 3254*cdf0e10cSrcweir 3255*cdf0e10cSrcweir SetStyle(); 3256*cdf0e10cSrcweir 3257*cdf0e10cSrcweir GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); 3258*cdf0e10cSrcweir } 3259*cdf0e10cSrcweir } 3260*cdf0e10cSrcweir 3261*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 3262*cdf0e10cSrcweir void SdXMLFloatingFrameShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 3263*cdf0e10cSrcweir { 3264*cdf0e10cSrcweir switch( nPrefix ) 3265*cdf0e10cSrcweir { 3266*cdf0e10cSrcweir case XML_NAMESPACE_DRAW: 3267*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_FRAME_NAME ) ) 3268*cdf0e10cSrcweir { 3269*cdf0e10cSrcweir maFrameName = rValue; 3270*cdf0e10cSrcweir return; 3271*cdf0e10cSrcweir } 3272*cdf0e10cSrcweir break; 3273*cdf0e10cSrcweir case XML_NAMESPACE_XLINK: 3274*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_HREF ) ) 3275*cdf0e10cSrcweir { 3276*cdf0e10cSrcweir maHref = GetImport().GetAbsoluteReference(rValue); 3277*cdf0e10cSrcweir return; 3278*cdf0e10cSrcweir } 3279*cdf0e10cSrcweir break; 3280*cdf0e10cSrcweir } 3281*cdf0e10cSrcweir 3282*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 3283*cdf0e10cSrcweir } 3284*cdf0e10cSrcweir 3285*cdf0e10cSrcweir void SdXMLFloatingFrameShapeContext::EndElement() 3286*cdf0e10cSrcweir { 3287*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); 3288*cdf0e10cSrcweir 3289*cdf0e10cSrcweir if( xProps.is() ) 3290*cdf0e10cSrcweir { 3291*cdf0e10cSrcweir if ( maSize.Width && maSize.Height ) 3292*cdf0e10cSrcweir { 3293*cdf0e10cSrcweir // the visual area for a floating frame must be set on loading 3294*cdf0e10cSrcweir awt::Rectangle aRect( 0, 0, maSize.Width, maSize.Height ); 3295*cdf0e10cSrcweir uno::Any aAny; 3296*cdf0e10cSrcweir aAny <<= aRect; 3297*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny ); 3298*cdf0e10cSrcweir } 3299*cdf0e10cSrcweir } 3300*cdf0e10cSrcweir 3301*cdf0e10cSrcweir SetThumbnail(); 3302*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 3303*cdf0e10cSrcweir } 3304*cdf0e10cSrcweir 3305*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 3306*cdf0e10cSrcweir 3307*cdf0e10cSrcweir TYPEINIT1( SdXMLFrameShapeContext, SdXMLShapeContext ); 3308*cdf0e10cSrcweir 3309*cdf0e10cSrcweir SdXMLFrameShapeContext::SdXMLFrameShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 3310*cdf0e10cSrcweir const rtl::OUString& rLocalName, 3311*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 3312*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, 3313*cdf0e10cSrcweir sal_Bool bTemporaryShape) 3314*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ), 3315*cdf0e10cSrcweir mbSupportsReplacement( sal_False ) 3316*cdf0e10cSrcweir { 3317*cdf0e10cSrcweir uno::Reference < util::XCloneable > xClone( xAttrList, uno::UNO_QUERY ); 3318*cdf0e10cSrcweir if( xClone.is() ) 3319*cdf0e10cSrcweir mxAttrList.set( xClone->createClone(), uno::UNO_QUERY ); 3320*cdf0e10cSrcweir else 3321*cdf0e10cSrcweir mxAttrList = new SvXMLAttributeList( xAttrList ); 3322*cdf0e10cSrcweir 3323*cdf0e10cSrcweir } 3324*cdf0e10cSrcweir 3325*cdf0e10cSrcweir SdXMLFrameShapeContext::~SdXMLFrameShapeContext() 3326*cdf0e10cSrcweir { 3327*cdf0e10cSrcweir } 3328*cdf0e10cSrcweir 3329*cdf0e10cSrcweir SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPrefix, 3330*cdf0e10cSrcweir const OUString& rLocalName, 3331*cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList>& xAttrList ) 3332*cdf0e10cSrcweir { 3333*cdf0e10cSrcweir SvXMLImportContext * pContext = 0; 3334*cdf0e10cSrcweir 3335*cdf0e10cSrcweir if( !mxImplContext.Is() ) 3336*cdf0e10cSrcweir { 3337*cdf0e10cSrcweir pContext = GetImport().GetShapeImport()->CreateFrameChildContext( 3338*cdf0e10cSrcweir GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList ); 3339*cdf0e10cSrcweir 3340*cdf0e10cSrcweir mxImplContext = pContext; 3341*cdf0e10cSrcweir mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) || 3342*cdf0e10cSrcweir IsXMLToken( rLocalName, XML_OBJECT_OLE ); 3343*cdf0e10cSrcweir } 3344*cdf0e10cSrcweir else if( mbSupportsReplacement && !mxReplImplContext && 3345*cdf0e10cSrcweir XML_NAMESPACE_DRAW == nPrefix && 3346*cdf0e10cSrcweir IsXMLToken( rLocalName, XML_IMAGE ) ) 3347*cdf0e10cSrcweir { 3348*cdf0e10cSrcweir // read replacement image 3349*cdf0e10cSrcweir SvXMLImportContext *pImplContext = &mxImplContext; 3350*cdf0e10cSrcweir SdXMLShapeContext *pSContext = 3351*cdf0e10cSrcweir PTR_CAST( SdXMLShapeContext, pImplContext ); 3352*cdf0e10cSrcweir if( pSContext ) 3353*cdf0e10cSrcweir { 3354*cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xPropSet( 3355*cdf0e10cSrcweir pSContext->getShape(), uno::UNO_QUERY ); 3356*cdf0e10cSrcweir if( xPropSet.is() ) 3357*cdf0e10cSrcweir { 3358*cdf0e10cSrcweir pContext = new XMLReplacementImageContext( GetImport(), 3359*cdf0e10cSrcweir nPrefix, rLocalName, xAttrList, xPropSet ); 3360*cdf0e10cSrcweir mxReplImplContext = pContext; 3361*cdf0e10cSrcweir } 3362*cdf0e10cSrcweir } 3363*cdf0e10cSrcweir } 3364*cdf0e10cSrcweir else if( 3365*cdf0e10cSrcweir ( nPrefix == XML_NAMESPACE_SVG && // #i68101# 3366*cdf0e10cSrcweir (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) || 3367*cdf0e10cSrcweir (nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) || 3368*cdf0e10cSrcweir (nPrefix == XML_NAMESPACE_DRAW && (IsXMLToken( rLocalName, XML_GLUE_POINT ) || 3369*cdf0e10cSrcweir IsXMLToken( rLocalName, XML_THUMBNAIL ) ) ) ) 3370*cdf0e10cSrcweir { 3371*cdf0e10cSrcweir SvXMLImportContext *pImplContext = &mxImplContext; 3372*cdf0e10cSrcweir pContext = PTR_CAST( SdXMLShapeContext, pImplContext )->CreateChildContext( nPrefix, 3373*cdf0e10cSrcweir rLocalName, xAttrList ); 3374*cdf0e10cSrcweir } 3375*cdf0e10cSrcweir else if ( (XML_NAMESPACE_DRAW == nPrefix) && IsXMLToken( rLocalName, XML_IMAGE_MAP ) ) 3376*cdf0e10cSrcweir { 3377*cdf0e10cSrcweir SdXMLShapeContext *pSContext = dynamic_cast< SdXMLShapeContext* >( &mxImplContext ); 3378*cdf0e10cSrcweir if( pSContext ) 3379*cdf0e10cSrcweir { 3380*cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xPropSet( pSContext->getShape(), uno::UNO_QUERY ); 3381*cdf0e10cSrcweir if (xPropSet.is()) 3382*cdf0e10cSrcweir { 3383*cdf0e10cSrcweir pContext = new XMLImageMapContext(GetImport(), nPrefix, rLocalName, xPropSet); 3384*cdf0e10cSrcweir } 3385*cdf0e10cSrcweir } 3386*cdf0e10cSrcweir } 3387*cdf0e10cSrcweir 3388*cdf0e10cSrcweir // call parent for content 3389*cdf0e10cSrcweir if(!pContext) 3390*cdf0e10cSrcweir pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); 3391*cdf0e10cSrcweir 3392*cdf0e10cSrcweir return pContext; 3393*cdf0e10cSrcweir } 3394*cdf0e10cSrcweir 3395*cdf0e10cSrcweir void SdXMLFrameShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&) 3396*cdf0e10cSrcweir { 3397*cdf0e10cSrcweir // ignore 3398*cdf0e10cSrcweir } 3399*cdf0e10cSrcweir 3400*cdf0e10cSrcweir void SdXMLFrameShapeContext::EndElement() 3401*cdf0e10cSrcweir { 3402*cdf0e10cSrcweir if( !mxImplContext.Is() ) 3403*cdf0e10cSrcweir { 3404*cdf0e10cSrcweir // now check if this is an empty presentation object 3405*cdf0e10cSrcweir sal_Int16 nAttrCount = mxAttrList.is() ? mxAttrList->getLength() : 0; 3406*cdf0e10cSrcweir for(sal_Int16 a(0); a < nAttrCount; a++) 3407*cdf0e10cSrcweir { 3408*cdf0e10cSrcweir OUString aLocalName; 3409*cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(mxAttrList->getNameByIndex(a), &aLocalName); 3410*cdf0e10cSrcweir 3411*cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_PRESENTATION ) 3412*cdf0e10cSrcweir { 3413*cdf0e10cSrcweir if( IsXMLToken( aLocalName, XML_PLACEHOLDER ) ) 3414*cdf0e10cSrcweir { 3415*cdf0e10cSrcweir mbIsPlaceholder = IsXMLToken( mxAttrList->getValueByIndex(a), XML_TRUE ); 3416*cdf0e10cSrcweir } 3417*cdf0e10cSrcweir else if( IsXMLToken( aLocalName, XML_CLASS ) ) 3418*cdf0e10cSrcweir { 3419*cdf0e10cSrcweir maPresentationClass = mxAttrList->getValueByIndex(a); 3420*cdf0e10cSrcweir } 3421*cdf0e10cSrcweir } 3422*cdf0e10cSrcweir } 3423*cdf0e10cSrcweir 3424*cdf0e10cSrcweir if( (maPresentationClass.getLength() != 0) && mbIsPlaceholder ) 3425*cdf0e10cSrcweir { 3426*cdf0e10cSrcweir uno::Reference< xml::sax::XAttributeList> xEmpty; 3427*cdf0e10cSrcweir 3428*cdf0e10cSrcweir enum XMLTokenEnum eToken = XML_TEXT_BOX; 3429*cdf0e10cSrcweir 3430*cdf0e10cSrcweir if( IsXMLToken( maPresentationClass, XML_GRAPHIC ) ) 3431*cdf0e10cSrcweir { 3432*cdf0e10cSrcweir eToken = XML_IMAGE; 3433*cdf0e10cSrcweir 3434*cdf0e10cSrcweir } 3435*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_PAGE ) ) 3436*cdf0e10cSrcweir { 3437*cdf0e10cSrcweir eToken = XML_PAGE_THUMBNAIL; 3438*cdf0e10cSrcweir } 3439*cdf0e10cSrcweir else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_CHART ) || 3440*cdf0e10cSrcweir IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) || 3441*cdf0e10cSrcweir IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) ) 3442*cdf0e10cSrcweir { 3443*cdf0e10cSrcweir eToken = XML_OBJECT; 3444*cdf0e10cSrcweir } 3445*cdf0e10cSrcweir 3446*cdf0e10cSrcweir mxImplContext = GetImport().GetShapeImport()->CreateFrameChildContext( 3447*cdf0e10cSrcweir GetImport(), XML_NAMESPACE_DRAW, GetXMLToken( eToken ), mxAttrList, mxShapes, xEmpty ); 3448*cdf0e10cSrcweir 3449*cdf0e10cSrcweir if( mxImplContext.Is() ) 3450*cdf0e10cSrcweir { 3451*cdf0e10cSrcweir mxImplContext->StartElement( mxAttrList ); 3452*cdf0e10cSrcweir mxImplContext->EndElement(); 3453*cdf0e10cSrcweir } 3454*cdf0e10cSrcweir } 3455*cdf0e10cSrcweir } 3456*cdf0e10cSrcweir 3457*cdf0e10cSrcweir mxImplContext = 0; 3458*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 3459*cdf0e10cSrcweir } 3460*cdf0e10cSrcweir 3461*cdf0e10cSrcweir void SdXMLFrameShapeContext::processAttribute( sal_uInt16, 3462*cdf0e10cSrcweir const ::rtl::OUString&, const ::rtl::OUString& ) 3463*cdf0e10cSrcweir { 3464*cdf0e10cSrcweir // ignore 3465*cdf0e10cSrcweir } 3466*cdf0e10cSrcweir 3467*cdf0e10cSrcweir TYPEINIT1( SdXMLCustomShapeContext, SdXMLShapeContext ); 3468*cdf0e10cSrcweir 3469*cdf0e10cSrcweir SdXMLCustomShapeContext::SdXMLCustomShapeContext( 3470*cdf0e10cSrcweir SvXMLImport& rImport, 3471*cdf0e10cSrcweir sal_uInt16 nPrfx, 3472*cdf0e10cSrcweir const OUString& rLocalName, 3473*cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 3474*cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 3475*cdf0e10cSrcweir sal_Bool bTemporaryShape) 3476*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ) 3477*cdf0e10cSrcweir { 3478*cdf0e10cSrcweir } 3479*cdf0e10cSrcweir 3480*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 3481*cdf0e10cSrcweir 3482*cdf0e10cSrcweir SdXMLCustomShapeContext::~SdXMLCustomShapeContext() 3483*cdf0e10cSrcweir { 3484*cdf0e10cSrcweir } 3485*cdf0e10cSrcweir 3486*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 3487*cdf0e10cSrcweir 3488*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 3489*cdf0e10cSrcweir void SdXMLCustomShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 3490*cdf0e10cSrcweir { 3491*cdf0e10cSrcweir if( XML_NAMESPACE_DRAW == nPrefix ) 3492*cdf0e10cSrcweir { 3493*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_ENGINE ) ) 3494*cdf0e10cSrcweir { 3495*cdf0e10cSrcweir maCustomShapeEngine = rValue; 3496*cdf0e10cSrcweir return; 3497*cdf0e10cSrcweir } 3498*cdf0e10cSrcweir if ( IsXMLToken( rLocalName, XML_DATA ) ) 3499*cdf0e10cSrcweir { 3500*cdf0e10cSrcweir maCustomShapeData = rValue; 3501*cdf0e10cSrcweir return; 3502*cdf0e10cSrcweir } 3503*cdf0e10cSrcweir } 3504*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 3505*cdf0e10cSrcweir } 3506*cdf0e10cSrcweir 3507*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 3508*cdf0e10cSrcweir 3509*cdf0e10cSrcweir void SdXMLCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) 3510*cdf0e10cSrcweir { 3511*cdf0e10cSrcweir // create rectangle shape 3512*cdf0e10cSrcweir AddShape("com.sun.star.drawing.CustomShape"); 3513*cdf0e10cSrcweir if ( mxShape.is() ) 3514*cdf0e10cSrcweir { 3515*cdf0e10cSrcweir // Add, set Style and properties from base shape 3516*cdf0e10cSrcweir SetStyle(); 3517*cdf0e10cSrcweir SetLayer(); 3518*cdf0e10cSrcweir 3519*cdf0e10cSrcweir // set pos, size, shear and rotate 3520*cdf0e10cSrcweir SetTransformation(); 3521*cdf0e10cSrcweir 3522*cdf0e10cSrcweir try 3523*cdf0e10cSrcweir { 3524*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY ); 3525*cdf0e10cSrcweir if( xPropSet.is() ) 3526*cdf0e10cSrcweir { 3527*cdf0e10cSrcweir if ( maCustomShapeEngine.getLength() ) 3528*cdf0e10cSrcweir { 3529*cdf0e10cSrcweir uno::Any aAny; 3530*cdf0e10cSrcweir aAny <<= maCustomShapeEngine; 3531*cdf0e10cSrcweir xPropSet->setPropertyValue( EASGet( EAS_CustomShapeEngine ), aAny ); 3532*cdf0e10cSrcweir } 3533*cdf0e10cSrcweir if ( maCustomShapeData.getLength() ) 3534*cdf0e10cSrcweir { 3535*cdf0e10cSrcweir uno::Any aAny; 3536*cdf0e10cSrcweir aAny <<= maCustomShapeData; 3537*cdf0e10cSrcweir xPropSet->setPropertyValue( EASGet( EAS_CustomShapeData ), aAny ); 3538*cdf0e10cSrcweir } 3539*cdf0e10cSrcweir } 3540*cdf0e10cSrcweir } 3541*cdf0e10cSrcweir catch( uno::Exception& ) 3542*cdf0e10cSrcweir { 3543*cdf0e10cSrcweir DBG_ERROR( "could not set enhanced customshape geometry" ); 3544*cdf0e10cSrcweir } 3545*cdf0e10cSrcweir SdXMLShapeContext::StartElement(xAttrList); 3546*cdf0e10cSrcweir } 3547*cdf0e10cSrcweir } 3548*cdf0e10cSrcweir 3549*cdf0e10cSrcweir void SdXMLCustomShapeContext::EndElement() 3550*cdf0e10cSrcweir { 3551*cdf0e10cSrcweir if ( !maCustomShapeGeometry.empty() ) 3552*cdf0e10cSrcweir { 3553*cdf0e10cSrcweir const rtl::OUString sCustomShapeGeometry ( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) ); 3554*cdf0e10cSrcweir 3555*cdf0e10cSrcweir // converting the vector to a sequence 3556*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aSeq( maCustomShapeGeometry.size() ); 3557*cdf0e10cSrcweir beans::PropertyValue* pValues = aSeq.getArray(); 3558*cdf0e10cSrcweir std::vector< beans::PropertyValue >::const_iterator aIter( maCustomShapeGeometry.begin() ); 3559*cdf0e10cSrcweir std::vector< beans::PropertyValue >::const_iterator aEnd( maCustomShapeGeometry.end() ); 3560*cdf0e10cSrcweir while ( aIter != aEnd ) 3561*cdf0e10cSrcweir *pValues++ = *aIter++; 3562*cdf0e10cSrcweir 3563*cdf0e10cSrcweir try 3564*cdf0e10cSrcweir { 3565*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY ); 3566*cdf0e10cSrcweir if( xPropSet.is() ) 3567*cdf0e10cSrcweir { 3568*cdf0e10cSrcweir uno::Any aAny; 3569*cdf0e10cSrcweir aAny <<= aSeq; 3570*cdf0e10cSrcweir xPropSet->setPropertyValue( sCustomShapeGeometry, aAny ); 3571*cdf0e10cSrcweir } 3572*cdf0e10cSrcweir } 3573*cdf0e10cSrcweir catch( uno::Exception& ) 3574*cdf0e10cSrcweir { 3575*cdf0e10cSrcweir DBG_ERROR( "could not set enhanced customshape geometry" ); 3576*cdf0e10cSrcweir } 3577*cdf0e10cSrcweir 3578*cdf0e10cSrcweir sal_Int32 nUPD( 0 ); 3579*cdf0e10cSrcweir sal_Int32 nBuild( 0 ); 3580*cdf0e10cSrcweir GetImport().getBuildIds( nUPD, nBuild ); 3581*cdf0e10cSrcweir if( ((nUPD >= 640 && nUPD <= 645) || (nUPD == 680)) && (nBuild <= 9221) ) 3582*cdf0e10cSrcweir { 3583*cdf0e10cSrcweir Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( mxShape, UNO_QUERY ); 3584*cdf0e10cSrcweir if( xDefaulter.is() ) 3585*cdf0e10cSrcweir { 3586*cdf0e10cSrcweir rtl::OUString aEmptyType; 3587*cdf0e10cSrcweir xDefaulter->createCustomShapeDefaults( aEmptyType ); 3588*cdf0e10cSrcweir } 3589*cdf0e10cSrcweir } 3590*cdf0e10cSrcweir } 3591*cdf0e10cSrcweir 3592*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 3593*cdf0e10cSrcweir } 3594*cdf0e10cSrcweir 3595*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 3596*cdf0e10cSrcweir 3597*cdf0e10cSrcweir SvXMLImportContext* SdXMLCustomShapeContext::CreateChildContext( 3598*cdf0e10cSrcweir sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, 3599*cdf0e10cSrcweir const uno::Reference<xml::sax::XAttributeList>& xAttrList ) 3600*cdf0e10cSrcweir { 3601*cdf0e10cSrcweir SvXMLImportContext* pContext = NULL; 3602*cdf0e10cSrcweir if ( XML_NAMESPACE_DRAW == nPrefix ) 3603*cdf0e10cSrcweir { 3604*cdf0e10cSrcweir if ( IsXMLToken( rLocalName, XML_ENHANCED_GEOMETRY ) ) 3605*cdf0e10cSrcweir { 3606*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet( mxShape,uno::UNO_QUERY ); 3607*cdf0e10cSrcweir if ( xPropSet.is() ) 3608*cdf0e10cSrcweir pContext = new XMLEnhancedCustomShapeContext( GetImport(), mxShape, nPrefix, rLocalName, maCustomShapeGeometry ); 3609*cdf0e10cSrcweir } 3610*cdf0e10cSrcweir } 3611*cdf0e10cSrcweir // delegate to parent class if no context could be created 3612*cdf0e10cSrcweir if ( NULL == pContext ) 3613*cdf0e10cSrcweir pContext = SdXMLShapeContext::CreateChildContext( nPrefix, rLocalName, 3614*cdf0e10cSrcweir xAttrList); 3615*cdf0e10cSrcweir return pContext; 3616*cdf0e10cSrcweir } 3617*cdf0e10cSrcweir 3618*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 3619*cdf0e10cSrcweir 3620*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 3621*cdf0e10cSrcweir 3622*cdf0e10cSrcweir TYPEINIT1( SdXMLTableShapeContext, SdXMLShapeContext ); 3623*cdf0e10cSrcweir 3624*cdf0e10cSrcweir SdXMLTableShapeContext::SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes ) 3625*cdf0e10cSrcweir : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, sal_False ) 3626*cdf0e10cSrcweir { 3627*cdf0e10cSrcweir memset( &maTemplateStylesUsed, 0, sizeof( maTemplateStylesUsed ) ); 3628*cdf0e10cSrcweir } 3629*cdf0e10cSrcweir 3630*cdf0e10cSrcweir SdXMLTableShapeContext::~SdXMLTableShapeContext() 3631*cdf0e10cSrcweir { 3632*cdf0e10cSrcweir } 3633*cdf0e10cSrcweir 3634*cdf0e10cSrcweir void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) 3635*cdf0e10cSrcweir { 3636*cdf0e10cSrcweir const char* pService = "com.sun.star.drawing.TableShape"; 3637*cdf0e10cSrcweir 3638*cdf0e10cSrcweir sal_Bool bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); 3639*cdf0e10cSrcweir if( bIsPresShape ) 3640*cdf0e10cSrcweir { 3641*cdf0e10cSrcweir if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ) 3642*cdf0e10cSrcweir { 3643*cdf0e10cSrcweir pService = "com.sun.star.presentation.TableShape"; 3644*cdf0e10cSrcweir } 3645*cdf0e10cSrcweir } 3646*cdf0e10cSrcweir 3647*cdf0e10cSrcweir AddShape( pService ); 3648*cdf0e10cSrcweir 3649*cdf0e10cSrcweir if( mxShape.is() ) 3650*cdf0e10cSrcweir { 3651*cdf0e10cSrcweir SetLayer(); 3652*cdf0e10cSrcweir 3653*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); 3654*cdf0e10cSrcweir 3655*cdf0e10cSrcweir if(bIsPresShape) 3656*cdf0e10cSrcweir { 3657*cdf0e10cSrcweir if(xProps.is()) 3658*cdf0e10cSrcweir { 3659*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); 3660*cdf0e10cSrcweir if( xPropsInfo.is() ) 3661*cdf0e10cSrcweir { 3662*cdf0e10cSrcweir if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) 3663*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); 3664*cdf0e10cSrcweir 3665*cdf0e10cSrcweir if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) 3666*cdf0e10cSrcweir xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); 3667*cdf0e10cSrcweir } 3668*cdf0e10cSrcweir } 3669*cdf0e10cSrcweir } 3670*cdf0e10cSrcweir 3671*cdf0e10cSrcweir SetStyle(); 3672*cdf0e10cSrcweir 3673*cdf0e10cSrcweir if( xProps.is() ) 3674*cdf0e10cSrcweir { 3675*cdf0e10cSrcweir if( msTemplateStyleName.getLength() ) try 3676*cdf0e10cSrcweir { 3677*cdf0e10cSrcweir Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetImport().GetModel(), UNO_QUERY_THROW ); 3678*cdf0e10cSrcweir Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() ); 3679*cdf0e10cSrcweir const OUString sFamilyName( RTL_CONSTASCII_USTRINGPARAM("table" ) ); 3680*cdf0e10cSrcweir Reference< XNameAccess > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW ); 3681*cdf0e10cSrcweir Reference< XStyle > xTableStyle( xTableFamily->getByName( msTemplateStyleName ), UNO_QUERY_THROW ); 3682*cdf0e10cSrcweir xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ), Any( xTableStyle ) ); 3683*cdf0e10cSrcweir } 3684*cdf0e10cSrcweir catch( Exception& ) 3685*cdf0e10cSrcweir { 3686*cdf0e10cSrcweir DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!"); 3687*cdf0e10cSrcweir } 3688*cdf0e10cSrcweir 3689*cdf0e10cSrcweir const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; 3690*cdf0e10cSrcweir for( int i = 0; pEntry->msApiName && (i < 6); i++, pEntry++ ) 3691*cdf0e10cSrcweir { 3692*cdf0e10cSrcweir try 3693*cdf0e10cSrcweir { 3694*cdf0e10cSrcweir const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) ); 3695*cdf0e10cSrcweir xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) ); 3696*cdf0e10cSrcweir } 3697*cdf0e10cSrcweir catch( Exception& ) 3698*cdf0e10cSrcweir { 3699*cdf0e10cSrcweir DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!"); 3700*cdf0e10cSrcweir } 3701*cdf0e10cSrcweir } 3702*cdf0e10cSrcweir } 3703*cdf0e10cSrcweir 3704*cdf0e10cSrcweir GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); 3705*cdf0e10cSrcweir 3706*cdf0e10cSrcweir const rtl::Reference< XMLTableImport >& xTableImport( GetImport().GetShapeImport()->GetShapeTableImport() ); 3707*cdf0e10cSrcweir if( xTableImport.is() && xProps.is() ) 3708*cdf0e10cSrcweir { 3709*cdf0e10cSrcweir uno::Reference< table::XColumnRowRange > xColumnRowRange( 3710*cdf0e10cSrcweir xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ), uno::UNO_QUERY ); 3711*cdf0e10cSrcweir 3712*cdf0e10cSrcweir if( xColumnRowRange.is() ) 3713*cdf0e10cSrcweir mxTableImportContext = xTableImport->CreateTableContext( GetPrefix(), GetLocalName(), xColumnRowRange ); 3714*cdf0e10cSrcweir 3715*cdf0e10cSrcweir if( mxTableImportContext.Is() ) 3716*cdf0e10cSrcweir mxTableImportContext->StartElement( xAttrList ); 3717*cdf0e10cSrcweir } 3718*cdf0e10cSrcweir } 3719*cdf0e10cSrcweir } 3720*cdf0e10cSrcweir 3721*cdf0e10cSrcweir void SdXMLTableShapeContext::EndElement() 3722*cdf0e10cSrcweir { 3723*cdf0e10cSrcweir if( mxTableImportContext.Is() ) 3724*cdf0e10cSrcweir mxTableImportContext->EndElement(); 3725*cdf0e10cSrcweir 3726*cdf0e10cSrcweir SdXMLShapeContext::EndElement(); 3727*cdf0e10cSrcweir 3728*cdf0e10cSrcweir if( mxShape.is() ) 3729*cdf0e10cSrcweir { 3730*cdf0e10cSrcweir // set pos, size, shear and rotate 3731*cdf0e10cSrcweir SetTransformation(); 3732*cdf0e10cSrcweir } 3733*cdf0e10cSrcweir } 3734*cdf0e10cSrcweir 3735*cdf0e10cSrcweir // this is called from the parent group for each unparsed attribute in the attribute list 3736*cdf0e10cSrcweir void SdXMLTableShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 3737*cdf0e10cSrcweir { 3738*cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_TABLE ) 3739*cdf0e10cSrcweir { 3740*cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_TEMPLATE_NAME ) ) 3741*cdf0e10cSrcweir { 3742*cdf0e10cSrcweir msTemplateStyleName = rValue; 3743*cdf0e10cSrcweir } 3744*cdf0e10cSrcweir else 3745*cdf0e10cSrcweir { 3746*cdf0e10cSrcweir int i = 0; 3747*cdf0e10cSrcweir const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; 3748*cdf0e10cSrcweir while( pEntry->msApiName && (i < 6) ) 3749*cdf0e10cSrcweir { 3750*cdf0e10cSrcweir if( IsXMLToken( rLocalName, pEntry->meXMLName ) ) 3751*cdf0e10cSrcweir { 3752*cdf0e10cSrcweir if( IsXMLToken( rValue, XML_TRUE ) ) 3753*cdf0e10cSrcweir maTemplateStylesUsed[i] = sal_True; 3754*cdf0e10cSrcweir break; 3755*cdf0e10cSrcweir } 3756*cdf0e10cSrcweir pEntry++; 3757*cdf0e10cSrcweir i++; 3758*cdf0e10cSrcweir } 3759*cdf0e10cSrcweir } 3760*cdf0e10cSrcweir } 3761*cdf0e10cSrcweir SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); 3762*cdf0e10cSrcweir } 3763*cdf0e10cSrcweir 3764*cdf0e10cSrcweir SvXMLImportContext* SdXMLTableShapeContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& xAttrList ) 3765*cdf0e10cSrcweir { 3766*cdf0e10cSrcweir if( mxTableImportContext.Is() && (nPrefix == XML_NAMESPACE_TABLE) ) 3767*cdf0e10cSrcweir return mxTableImportContext->CreateChildContext(nPrefix, rLocalName, xAttrList); 3768*cdf0e10cSrcweir else 3769*cdf0e10cSrcweir return SdXMLShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList); 3770*cdf0e10cSrcweir } 3771*cdf0e10cSrcweir 3772