163bba73cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 363bba73cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 463bba73cSAndrew Rist * or more contributor license agreements. See the NOTICE file 563bba73cSAndrew Rist * distributed with this work for additional information 663bba73cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 763bba73cSAndrew Rist * to you under the Apache License, Version 2.0 (the 863bba73cSAndrew Rist * "License"); you may not use this file except in compliance 963bba73cSAndrew Rist * with the License. You may obtain a copy of the License at 1063bba73cSAndrew Rist * 1163bba73cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1263bba73cSAndrew Rist * 1363bba73cSAndrew Rist * Unless required by applicable law or agreed to in writing, 1463bba73cSAndrew Rist * software distributed under the License is distributed on an 1563bba73cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1663bba73cSAndrew Rist * KIND, either express or implied. See the License for the 1763bba73cSAndrew Rist * specific language governing permissions and limitations 1863bba73cSAndrew Rist * under the License. 1963bba73cSAndrew Rist * 2063bba73cSAndrew Rist *************************************************************/ 2163bba73cSAndrew Rist 2263bba73cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/debug.hxx> 28cdf0e10cSrcweir #include <xmloff/XMLShapeStyleContext.hxx> 29cdf0e10cSrcweir #include "XMLShapePropertySetContext.hxx" 30cdf0e10cSrcweir #include <xmloff/contextid.hxx> 31cdf0e10cSrcweir #include <com/sun/star/drawing/XControlShape.hpp> 32cdf0e10cSrcweir #include "com/sun/star/beans/XPropertySetInfo.hpp" 33cdf0e10cSrcweir #include <com/sun/star/lang/IllegalArgumentException.hpp> 34*b740b198SArmin Le Grand #include <com/sun/star/drawing/FillStyle.hpp> 35cdf0e10cSrcweir #include <xmloff/xmlimp.hxx> 36cdf0e10cSrcweir #include <xmloff/xmlnumi.hxx> 37cdf0e10cSrcweir #include <xmloff/xmlnmspe.hxx> 38cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 39cdf0e10cSrcweir #include "xmloff/xmlerror.hxx" 40cdf0e10cSrcweir #include <xmloff/maptype.hxx> 41cdf0e10cSrcweir 42cdf0e10cSrcweir #include "sdpropls.hxx" 43cdf0e10cSrcweir 44cdf0e10cSrcweir using ::rtl::OUString; 45cdf0e10cSrcweir using ::rtl::OUStringBuffer; 46cdf0e10cSrcweir 47cdf0e10cSrcweir using namespace ::com::sun::star; 48cdf0e10cSrcweir using namespace ::com::sun::star::uno; 49cdf0e10cSrcweir using namespace ::com::sun::star::beans; 50*b740b198SArmin Le Grand using namespace ::com::sun::star::drawing; 51cdf0e10cSrcweir using ::xmloff::token::IsXMLToken; 52cdf0e10cSrcweir using ::xmloff::token::XML_TEXT_PROPERTIES; 53cdf0e10cSrcweir using ::xmloff::token::XML_GRAPHIC_PROPERTIES; 54cdf0e10cSrcweir using ::xmloff::token::XML_PARAGRAPH_PROPERTIES; 55cdf0e10cSrcweir 56cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 57cdf0e10cSrcweir 58cdf0e10cSrcweir TYPEINIT1( XMLShapeStyleContext, XMLPropStyleContext ); 59cdf0e10cSrcweir 60cdf0e10cSrcweir XMLShapeStyleContext::XMLShapeStyleContext( 61cdf0e10cSrcweir SvXMLImport& rImport, 62cdf0e10cSrcweir sal_uInt16 nPrfx, 63cdf0e10cSrcweir const OUString& rLName, 64cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList >& xAttrList, 65cdf0e10cSrcweir SvXMLStylesContext& rStyles, 66cdf0e10cSrcweir sal_uInt16 nFamily) 67cdf0e10cSrcweir : XMLPropStyleContext(rImport, nPrfx, rLName, xAttrList, rStyles, nFamily ), 68*b740b198SArmin Le Grand m_bIsNumRuleAlreadyConverted( sal_False ), 69*b740b198SArmin Le Grand m_bIsFillStyleAlreadyConverted( sal_False ) //UUUU 70cdf0e10cSrcweir { 71cdf0e10cSrcweir } 72cdf0e10cSrcweir 73cdf0e10cSrcweir XMLShapeStyleContext::~XMLShapeStyleContext() 74cdf0e10cSrcweir { 75cdf0e10cSrcweir } 76cdf0e10cSrcweir 77cdf0e10cSrcweir void XMLShapeStyleContext::SetAttribute( sal_uInt16 nPrefixKey, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir if ((0 == m_sControlDataStyleName.getLength()) && (::xmloff::token::GetXMLToken(::xmloff::token::XML_DATA_STYLE_NAME) == rLocalName)) 80cdf0e10cSrcweir { 81cdf0e10cSrcweir m_sControlDataStyleName = rValue; 82cdf0e10cSrcweir } 83cdf0e10cSrcweir else if( (XML_NAMESPACE_STYLE == nPrefixKey) && IsXMLToken( rLocalName, ::xmloff::token::XML_LIST_STYLE_NAME ) ) 84cdf0e10cSrcweir { 85cdf0e10cSrcweir m_sListStyleName = rValue; 86cdf0e10cSrcweir } 87cdf0e10cSrcweir else 88cdf0e10cSrcweir { 89cdf0e10cSrcweir XMLPropStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue ); 90cdf0e10cSrcweir 91cdf0e10cSrcweir if( (XML_NAMESPACE_STYLE == nPrefixKey) && 92cdf0e10cSrcweir ( IsXMLToken( rLocalName, ::xmloff::token::XML_NAME ) || IsXMLToken( rLocalName, ::xmloff::token::XML_DISPLAY_NAME ) ) ) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir if( GetName().getLength() && GetDisplayName().getLength() && GetName() != GetDisplayName() ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir const_cast< SvXMLImport&>( GetImport() ). 97cdf0e10cSrcweir AddStyleDisplayName( GetFamily(), GetName(), GetDisplayName() ); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir } 100cdf0e10cSrcweir } 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir SvXMLImportContext *XMLShapeStyleContext::CreateChildContext( 104cdf0e10cSrcweir sal_uInt16 nPrefix, 105cdf0e10cSrcweir const OUString& rLocalName, 106cdf0e10cSrcweir const Reference< xml::sax::XAttributeList > & xAttrList ) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir SvXMLImportContext *pContext = 0; 109cdf0e10cSrcweir 110cdf0e10cSrcweir if( XML_NAMESPACE_STYLE == nPrefix ) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir sal_uInt32 nFamily = 0; 113cdf0e10cSrcweir if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) 114cdf0e10cSrcweir nFamily = XML_TYPE_PROP_TEXT; 115cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_PARAGRAPH_PROPERTIES ) ) 116cdf0e10cSrcweir nFamily = XML_TYPE_PROP_PARAGRAPH; 117cdf0e10cSrcweir else if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) ) 118cdf0e10cSrcweir nFamily = XML_TYPE_PROP_GRAPHIC; 119cdf0e10cSrcweir if( nFamily ) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir UniReference < SvXMLImportPropertyMapper > xImpPrMap = 122cdf0e10cSrcweir GetStyles()->GetImportPropertyMapper( GetFamily() ); 123cdf0e10cSrcweir if( xImpPrMap.is() ) 124cdf0e10cSrcweir pContext = new XMLShapePropertySetContext( GetImport(), nPrefix, 125cdf0e10cSrcweir rLocalName, xAttrList, 126cdf0e10cSrcweir nFamily, 127cdf0e10cSrcweir GetProperties(), 128cdf0e10cSrcweir xImpPrMap ); 129cdf0e10cSrcweir } 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir if( !pContext ) 133cdf0e10cSrcweir pContext = XMLPropStyleContext::CreateChildContext( nPrefix, rLocalName, 134cdf0e10cSrcweir xAttrList ); 135cdf0e10cSrcweir 136cdf0e10cSrcweir return pContext; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir void XMLShapeStyleContext::FillPropertySet( const Reference< beans::XPropertySet > & rPropSet ) 140cdf0e10cSrcweir { 141cdf0e10cSrcweir if( !m_bIsNumRuleAlreadyConverted ) 142cdf0e10cSrcweir { 143cdf0e10cSrcweir m_bIsNumRuleAlreadyConverted = sal_True; 144cdf0e10cSrcweir 145cdf0e10cSrcweir // for compatibility to beta files, search for CTF_SD_NUMBERINGRULES_NAME to 146cdf0e10cSrcweir // import numbering rules from the style:properties element 147cdf0e10cSrcweir const UniReference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper(); 148cdf0e10cSrcweir 149cdf0e10cSrcweir ::std::vector< XMLPropertyState > &rProperties = GetProperties(); 150cdf0e10cSrcweir ::std::vector< XMLPropertyState >::iterator end( rProperties.end() ); 151cdf0e10cSrcweir ::std::vector< XMLPropertyState >::iterator property; 152cdf0e10cSrcweir 153cdf0e10cSrcweir // first, look for the old format, where we had a text:list-style-name 154cdf0e10cSrcweir // attribute in the style:properties element 155cdf0e10cSrcweir for( property = rProperties.begin(); property != end; property++ ) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir // find properties with context 158cdf0e10cSrcweir if( (property->mnIndex != -1) && (rMapper->GetEntryContextId( property->mnIndex ) == CTF_SD_NUMBERINGRULES_NAME) ) 159cdf0e10cSrcweir break; 160cdf0e10cSrcweir } 161cdf0e10cSrcweir 162cdf0e10cSrcweir // if we did not find an old list-style-name in the properties, and we need one 163cdf0e10cSrcweir // because we got a style:list-style attribute in the style-style element 164cdf0e10cSrcweir // we generate one 165cdf0e10cSrcweir if( (property == end) && ( 0 != m_sListStyleName.getLength() ) ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir sal_Int32 nIndex = rMapper->FindEntryIndex( CTF_SD_NUMBERINGRULES_NAME ); 168cdf0e10cSrcweir DBG_ASSERT( -1 != nIndex, "can't find numbering rules property entry, can't set numbering rule!" ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir XMLPropertyState aNewState( nIndex ); 171cdf0e10cSrcweir rProperties.push_back( aNewState ); 172cdf0e10cSrcweir end = rProperties.end(); 173cdf0e10cSrcweir property = end - 1; 174cdf0e10cSrcweir } 175cdf0e10cSrcweir 176cdf0e10cSrcweir // so, if we have an old or a new list style name, we set its value to 177cdf0e10cSrcweir // a numbering rule 178cdf0e10cSrcweir if( property != end ) 179cdf0e10cSrcweir { 180cdf0e10cSrcweir if( 0 == m_sListStyleName.getLength() ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir property->maValue >>= m_sListStyleName; 183cdf0e10cSrcweir } 184cdf0e10cSrcweir 185cdf0e10cSrcweir const SvxXMLListStyleContext *pListStyle = GetImport().GetTextImport()->FindAutoListStyle( m_sListStyleName ); 186cdf0e10cSrcweir 187cdf0e10cSrcweir DBG_ASSERT( pListStyle, "list-style not found for shape style" ); 188cdf0e10cSrcweir if( pListStyle ) 189cdf0e10cSrcweir { 190cdf0e10cSrcweir uno::Reference< container::XIndexReplace > xNumRule( pListStyle->CreateNumRule( GetImport().GetModel() ) ); 191cdf0e10cSrcweir pListStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ ); 192cdf0e10cSrcweir property->maValue <<= xNumRule; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir else 195cdf0e10cSrcweir { 196cdf0e10cSrcweir property->mnIndex = -1; 197cdf0e10cSrcweir } 198cdf0e10cSrcweir } 199cdf0e10cSrcweir } 200cdf0e10cSrcweir 201*b740b198SArmin Le Grand if(!m_bIsFillStyleAlreadyConverted && GetProperties().size()) 202*b740b198SArmin Le Grand { 203*b740b198SArmin Le Grand const UniReference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper(GetFamily())->getPropertySetMapper(); 204*b740b198SArmin Le Grand ::std::vector< XMLPropertyState >& rProperties = GetProperties(); 205*b740b198SArmin Le Grand ::std::vector< XMLPropertyState >::iterator a; 206*b740b198SArmin Le Grand FillStyle eFS(FillStyle_NONE); 207*b740b198SArmin Le Grand static ::rtl::OUString s_FillStyle(RTL_CONSTASCII_USTRINGPARAM("FillStyle")); 208*b740b198SArmin Le Grand 209*b740b198SArmin Le Grand // try to find a FillStyle entry and a value from it 210*b740b198SArmin Le Grand for(a = rProperties.begin(); a != rProperties.end(); a++) 211*b740b198SArmin Le Grand { 212*b740b198SArmin Le Grand if(a->mnIndex != -1) 213*b740b198SArmin Le Grand { 214*b740b198SArmin Le Grand const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); 215*b740b198SArmin Le Grand 216*b740b198SArmin Le Grand if(rPropName == s_FillStyle) 217*b740b198SArmin Le Grand { 218*b740b198SArmin Le Grand if(a->maValue >>= eFS) 219*b740b198SArmin Le Grand { 220*b740b198SArmin Le Grand // okay, type was good, eFS is set 221*b740b198SArmin Le Grand } 222*b740b198SArmin Le Grand else 223*b740b198SArmin Le Grand { 224*b740b198SArmin Le Grand // also try an int (see XFillStyleItem::PutValue) 225*b740b198SArmin Le Grand sal_Int32 nFS = 0; 226*b740b198SArmin Le Grand 227*b740b198SArmin Le Grand if(a->maValue >>= nFS) 228*b740b198SArmin Le Grand { 229*b740b198SArmin Le Grand eFS = (FillStyle)nFS; 230*b740b198SArmin Le Grand } 231*b740b198SArmin Le Grand } 232*b740b198SArmin Le Grand 233*b740b198SArmin Le Grand // exit loop, we found out what we needed to know 234*b740b198SArmin Le Grand break; 235*b740b198SArmin Le Grand } 236*b740b198SArmin Le Grand } 237*b740b198SArmin Le Grand } 238*b740b198SArmin Le Grand 239*b740b198SArmin Le Grand if(FillStyle_NONE != eFS) 240*b740b198SArmin Le Grand { 241*b740b198SArmin Le Grand //UUUU a FillStyle was found, thus the new [XATTR_FILL_FIRST .. XATTR_FILL_LAST] 242*b740b198SArmin Le Grand // description for the Fill definitions is used. All formally used props based 243*b740b198SArmin Le Grand // on RES_BACKGROUND need to be deleted to get no conflicts between the two 244*b740b198SArmin Le Grand // sets of properties; old files will keep these and adapt accordingly 245*b740b198SArmin Le Grand static ::rtl::OUString s_BackColorRGB(RTL_CONSTASCII_USTRINGPARAM("BackColorRGB")); 246*b740b198SArmin Le Grand static ::rtl::OUString s_BackTransparent(RTL_CONSTASCII_USTRINGPARAM("BackTransparent")); 247*b740b198SArmin Le Grand static ::rtl::OUString s_BackColorTransparency(RTL_CONSTASCII_USTRINGPARAM("BackColorTransparency")); 248*b740b198SArmin Le Grand static ::rtl::OUString s_BackGraphicURL(RTL_CONSTASCII_USTRINGPARAM("BackGraphicURL")); 249*b740b198SArmin Le Grand static ::rtl::OUString s_BackGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("BackGraphicFilter")); 250*b740b198SArmin Le Grand static ::rtl::OUString s_BackGraphicLocation(RTL_CONSTASCII_USTRINGPARAM("BackGraphicLocation")); 251*b740b198SArmin Le Grand static ::rtl::OUString s_BackGraphicTransparency(RTL_CONSTASCII_USTRINGPARAM("BackGraphicTransparency")); 252*b740b198SArmin Le Grand 253*b740b198SArmin Le Grand for(a = rProperties.begin(); a != rProperties.end(); a++) 254*b740b198SArmin Le Grand { 255*b740b198SArmin Le Grand if(a->mnIndex != -1) 256*b740b198SArmin Le Grand { 257*b740b198SArmin Le Grand const OUString& rPropName = rMapper->GetEntryAPIName(a->mnIndex); 258*b740b198SArmin Le Grand 259*b740b198SArmin Le Grand if(s_BackColorRGB == rPropName 260*b740b198SArmin Le Grand || s_BackTransparent == rPropName 261*b740b198SArmin Le Grand || s_BackColorTransparency == rPropName 262*b740b198SArmin Le Grand || s_BackGraphicURL == rPropName 263*b740b198SArmin Le Grand || s_BackGraphicFilter == rPropName 264*b740b198SArmin Le Grand || s_BackGraphicLocation == rPropName 265*b740b198SArmin Le Grand || s_BackGraphicTransparency== rPropName) 266*b740b198SArmin Le Grand { 267*b740b198SArmin Le Grand // mark entry as inactive 268*b740b198SArmin Le Grand a->mnIndex = -1; 269*b740b198SArmin Le Grand } 270*b740b198SArmin Le Grand } 271*b740b198SArmin Le Grand } 272*b740b198SArmin Le Grand } 273*b740b198SArmin Le Grand 274*b740b198SArmin Le Grand m_bIsFillStyleAlreadyConverted = sal_True; 275*b740b198SArmin Le Grand } 276*b740b198SArmin Le Grand 277cdf0e10cSrcweir struct _ContextID_Index_Pair aContextIDs[] = 278cdf0e10cSrcweir { 279cdf0e10cSrcweir { CTF_DASHNAME , -1 }, 280cdf0e10cSrcweir { CTF_LINESTARTNAME , -1 }, 281cdf0e10cSrcweir { CTF_LINEENDNAME , -1 }, 282cdf0e10cSrcweir { CTF_FILLGRADIENTNAME, -1 }, 283cdf0e10cSrcweir { CTF_FILLTRANSNAME , -1 }, 284cdf0e10cSrcweir { CTF_FILLHATCHNAME , -1 }, 285cdf0e10cSrcweir { CTF_FILLBITMAPNAME , -1 }, 286cdf0e10cSrcweir { CTF_SD_OLE_VIS_AREA_IMPORT_LEFT, -1 }, 287cdf0e10cSrcweir { CTF_SD_OLE_VIS_AREA_IMPORT_TOP, -1 }, 288cdf0e10cSrcweir { CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH, -1 }, 289cdf0e10cSrcweir { CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT, -1 }, 290cdf0e10cSrcweir { -1, -1 } 291cdf0e10cSrcweir }; 292cdf0e10cSrcweir static sal_uInt16 aFamilies[] = 293cdf0e10cSrcweir { 294cdf0e10cSrcweir XML_STYLE_FAMILY_SD_STROKE_DASH_ID, 295cdf0e10cSrcweir XML_STYLE_FAMILY_SD_MARKER_ID, 296cdf0e10cSrcweir XML_STYLE_FAMILY_SD_MARKER_ID, 297cdf0e10cSrcweir XML_STYLE_FAMILY_SD_GRADIENT_ID, 298cdf0e10cSrcweir XML_STYLE_FAMILY_SD_GRADIENT_ID, 299cdf0e10cSrcweir XML_STYLE_FAMILY_SD_HATCH_ID, 300cdf0e10cSrcweir XML_STYLE_FAMILY_SD_FILL_IMAGE_ID 301cdf0e10cSrcweir }; 302cdf0e10cSrcweir 303cdf0e10cSrcweir UniReference < SvXMLImportPropertyMapper > xImpPrMap = 304cdf0e10cSrcweir GetStyles()->GetImportPropertyMapper( GetFamily() ); 305cdf0e10cSrcweir DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" ); 306cdf0e10cSrcweir if( xImpPrMap.is() ) 307cdf0e10cSrcweir xImpPrMap->FillPropertySet( GetProperties(), rPropSet, aContextIDs ); 308cdf0e10cSrcweir 309cdf0e10cSrcweir Reference< XPropertySetInfo > xInfo; 310cdf0e10cSrcweir // get property set mapper 311cdf0e10cSrcweir UniReference<XMLPropertySetMapper> xPropMapper( xImpPrMap->getPropertySetMapper() ); 312cdf0e10cSrcweir 313cdf0e10cSrcweir for( sal_uInt16 i=0; aContextIDs[i].nContextID != -1; i++ ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir sal_Int32 nIndex = aContextIDs[i].nIndex; 316cdf0e10cSrcweir if( nIndex != -1 ) switch( aContextIDs[i].nContextID ) 317cdf0e10cSrcweir { 318cdf0e10cSrcweir case CTF_DASHNAME: 319cdf0e10cSrcweir case CTF_LINESTARTNAME: 320cdf0e10cSrcweir case CTF_LINEENDNAME: 321cdf0e10cSrcweir case CTF_FILLGRADIENTNAME: 322cdf0e10cSrcweir case CTF_FILLTRANSNAME: 323cdf0e10cSrcweir case CTF_FILLHATCHNAME: 324cdf0e10cSrcweir case CTF_FILLBITMAPNAME: 325cdf0e10cSrcweir { 326cdf0e10cSrcweir struct XMLPropertyState& rState = GetProperties()[nIndex]; 327cdf0e10cSrcweir OUString sStyleName; 328cdf0e10cSrcweir rState.maValue >>= sStyleName; 329cdf0e10cSrcweir sStyleName = GetImport().GetStyleDisplayName( aFamilies[i], sStyleName ); 330cdf0e10cSrcweir try 331cdf0e10cSrcweir { 332cdf0e10cSrcweir 333cdf0e10cSrcweir // set property 334cdf0e10cSrcweir const OUString& rPropertyName = xPropMapper->GetEntryAPIName(rState.mnIndex); 335cdf0e10cSrcweir if( !xInfo.is() ) 336cdf0e10cSrcweir xInfo = rPropSet->getPropertySetInfo(); 337cdf0e10cSrcweir if ( xInfo->hasPropertyByName( rPropertyName ) ) 338cdf0e10cSrcweir { 339cdf0e10cSrcweir rPropSet->setPropertyValue( rPropertyName, Any( sStyleName ) ); 340cdf0e10cSrcweir } 341cdf0e10cSrcweir } 342cdf0e10cSrcweir catch ( ::com::sun::star::lang::IllegalArgumentException& e ) 343cdf0e10cSrcweir { 344cdf0e10cSrcweir Sequence<OUString> aSeq(1); 345cdf0e10cSrcweir aSeq[0] = sStyleName; 346cdf0e10cSrcweir GetImport().SetError( 347cdf0e10cSrcweir XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING, 348cdf0e10cSrcweir aSeq, e.Message, NULL ); 349cdf0e10cSrcweir } 350cdf0e10cSrcweir break; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir case CTF_SD_OLE_VIS_AREA_IMPORT_LEFT: 353cdf0e10cSrcweir case CTF_SD_OLE_VIS_AREA_IMPORT_TOP: 354cdf0e10cSrcweir case CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH: 355cdf0e10cSrcweir case CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT: 356cdf0e10cSrcweir { 357cdf0e10cSrcweir struct XMLPropertyState& rState = GetProperties()[nIndex]; 358cdf0e10cSrcweir const OUString& rPropertyName = xPropMapper->GetEntryAPIName(rState.mnIndex); 359cdf0e10cSrcweir try 360cdf0e10cSrcweir { 361cdf0e10cSrcweir if( !xInfo.is() ) 362cdf0e10cSrcweir xInfo = rPropSet->getPropertySetInfo(); 363cdf0e10cSrcweir if ( xInfo->hasPropertyByName( rPropertyName ) ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir rPropSet->setPropertyValue( rPropertyName, rState.maValue ); 366cdf0e10cSrcweir } 367cdf0e10cSrcweir } 368cdf0e10cSrcweir catch ( ::com::sun::star::lang::IllegalArgumentException& e ) 369cdf0e10cSrcweir { 370cdf0e10cSrcweir Sequence<OUString> aSeq; 371cdf0e10cSrcweir GetImport().SetError( 372cdf0e10cSrcweir XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING, 373cdf0e10cSrcweir aSeq, e.Message, NULL ); 374cdf0e10cSrcweir } 375cdf0e10cSrcweir break; 376cdf0e10cSrcweir } 377cdf0e10cSrcweir } 378cdf0e10cSrcweir } 379cdf0e10cSrcweir 380cdf0e10cSrcweir if (m_sControlDataStyleName.getLength()) 381cdf0e10cSrcweir { // we had a data-style-name attribute 382cdf0e10cSrcweir 383cdf0e10cSrcweir // set the formatting on the control model of the control shape 384cdf0e10cSrcweir uno::Reference< drawing::XControlShape > xControlShape(rPropSet, uno::UNO_QUERY); 385cdf0e10cSrcweir DBG_ASSERT(xControlShape.is(), "XMLShapeStyleContext::FillPropertySet: data style for a non-control shape!"); 386cdf0e10cSrcweir if (xControlShape.is()) 387cdf0e10cSrcweir { 388cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xControlModel(xControlShape->getControl(), uno::UNO_QUERY); 389cdf0e10cSrcweir DBG_ASSERT(xControlModel.is(), "XMLShapeStyleContext::FillPropertySet: no control model for the shape!"); 390cdf0e10cSrcweir if (xControlModel.is()) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir GetImport().GetFormImport()->applyControlNumberStyle(xControlModel, m_sControlDataStyleName); 393cdf0e10cSrcweir } 394cdf0e10cSrcweir } 395cdf0e10cSrcweir } 396cdf0e10cSrcweir } 397cdf0e10cSrcweir 398cdf0e10cSrcweir void XMLShapeStyleContext::Finish( sal_Bool /*bOverwrite*/ ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir } 401cdf0e10cSrcweir 402