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_sd.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <osl/mutex.hxx> 36*cdf0e10cSrcweir #include <vos/mutex.hxx> 37*cdf0e10cSrcweir #include <vcl/svapp.hxx> 38*cdf0e10cSrcweir #include <comphelper/serviceinfohelper.hxx> 39*cdf0e10cSrcweir #include <boost/bind.hpp> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include "eetext.hxx" 42*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 43*cdf0e10cSrcweir #include <editeng/fhgtitem.hxx> 44*cdf0e10cSrcweir #include <svx/svdoattr.hxx> 45*cdf0e10cSrcweir #include <editeng/ulspitem.hxx> 46*cdf0e10cSrcweir #include <svl/smplhint.hxx> 47*cdf0e10cSrcweir #include <svl/itemset.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include <svx/xflbmtit.hxx> 50*cdf0e10cSrcweir #include <svx/xflbstit.hxx> 51*cdf0e10cSrcweir #include <editeng/bulitem.hxx> 52*cdf0e10cSrcweir #include <editeng/lrspitem.hxx> 53*cdf0e10cSrcweir #include <svx/unoshprp.hxx> 54*cdf0e10cSrcweir #include <svx/unoshape.hxx> 55*cdf0e10cSrcweir #include <svx/svdpool.hxx> 56*cdf0e10cSrcweir #include "stlsheet.hxx" 57*cdf0e10cSrcweir #include "sdresid.hxx" 58*cdf0e10cSrcweir #include "sdpage.hxx" 59*cdf0e10cSrcweir #include "drawdoc.hxx" 60*cdf0e10cSrcweir #include "stlpool.hxx" 61*cdf0e10cSrcweir #include "glob.hrc" 62*cdf0e10cSrcweir #include "app.hrc" 63*cdf0e10cSrcweir #include "glob.hxx" 64*cdf0e10cSrcweir #include "helpids.h" 65*cdf0e10cSrcweir #include "../ui/inc/DrawViewShell.hxx" 66*cdf0e10cSrcweir #include "../ui/inc/ViewShellBase.hxx" 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir using ::rtl::OUString; 69*cdf0e10cSrcweir using ::osl::MutexGuard; 70*cdf0e10cSrcweir using ::osl::ClearableMutexGuard; 71*cdf0e10cSrcweir using ::cppu::OInterfaceContainerHelper; 72*cdf0e10cSrcweir using namespace ::vos; 73*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 74*cdf0e10cSrcweir using namespace ::com::sun::star::util; 75*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 76*cdf0e10cSrcweir using namespace ::com::sun::star::style; 77*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 78*cdf0e10cSrcweir using namespace ::com::sun::star::container; 79*cdf0e10cSrcweir using namespace ::com::sun::star::drawing; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir #define WID_STYLE_DISPNAME 7998 82*cdf0e10cSrcweir #define WID_STYLE_FAMILY 7999 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir static SvxItemPropertySet& GetStylePropertySet() 85*cdf0e10cSrcweir { 86*cdf0e10cSrcweir static const SfxItemPropertyMapEntry aFullPropertyMap_Impl[] = 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM("Family"), WID_STYLE_FAMILY, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0}, 89*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &XNameContainer::static_type(), 0, 0}, 90*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM("DisplayName"), WID_STYLE_DISPNAME, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0}, 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir SVX_UNOEDIT_NUMBERING_PROPERTIE, 93*cdf0e10cSrcweir SHADOW_PROPERTIES 94*cdf0e10cSrcweir LINE_PROPERTIES 95*cdf0e10cSrcweir LINE_PROPERTIES_START_END 96*cdf0e10cSrcweir FILL_PROPERTIES 97*cdf0e10cSrcweir EDGERADIUS_PROPERTIES 98*cdf0e10cSrcweir TEXT_PROPERTIES_DEFAULTS 99*cdf0e10cSrcweir CONNECTOR_PROPERTIES 100*cdf0e10cSrcweir SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS 101*cdf0e10cSrcweir {0,0,0,0,0,0} 102*cdf0e10cSrcweir }; 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir static SvxItemPropertySet aPropSet( aFullPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() ); 105*cdf0e10cSrcweir return aPropSet; 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir class ModifyListenerForewarder : public SfxListener 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir public: 111*cdf0e10cSrcweir ModifyListenerForewarder( SdStyleSheet* pStyleSheet ); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir private: 116*cdf0e10cSrcweir SdStyleSheet* mpStyleSheet; 117*cdf0e10cSrcweir }; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir ModifyListenerForewarder::ModifyListenerForewarder( SdStyleSheet* pStyleSheet ) 120*cdf0e10cSrcweir : mpStyleSheet( pStyleSheet ) 121*cdf0e10cSrcweir { 122*cdf0e10cSrcweir if( pStyleSheet ) 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir SfxBroadcaster& rBC = static_cast< SfxBroadcaster& >( *pStyleSheet ); 125*cdf0e10cSrcweir StartListening( rBC ); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir void ModifyListenerForewarder::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir if( mpStyleSheet ) 132*cdf0e10cSrcweir mpStyleSheet->notifyModifyListener(); 133*cdf0e10cSrcweir } 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, sal_uInt16 _nMask) 136*cdf0e10cSrcweir : SdStyleSheetBase( UniString( rDisplayName ), _rPool, eFamily, _nMask) 137*cdf0e10cSrcweir , ::cppu::BaseMutex() 138*cdf0e10cSrcweir , msApiName( rDisplayName ) 139*cdf0e10cSrcweir , mxPool( const_cast< SfxStyleSheetBasePool* >(&_rPool) ) 140*cdf0e10cSrcweir , mrBHelper( m_aMutex ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir SdStyleSheet::SdStyleSheet( const SdStyleSheet & r ) 145*cdf0e10cSrcweir : SdStyleSheetBase( r ) 146*cdf0e10cSrcweir , ::cppu::BaseMutex() 147*cdf0e10cSrcweir , msApiName( r.msApiName ) 148*cdf0e10cSrcweir , mxPool( r.mxPool ) 149*cdf0e10cSrcweir , mrBHelper( m_aMutex ) 150*cdf0e10cSrcweir { 151*cdf0e10cSrcweir } 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir SdStyleSheet::~SdStyleSheet() 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir delete pSet; 156*cdf0e10cSrcweir pSet = NULL; // damit nachfolgende Destruktoren eine Chance haben 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir void SdStyleSheet::SetApiName( const OUString& rApiName ) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir msApiName = rApiName; 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir rtl::OUString SdStyleSheet::GetApiName() const 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir if( msApiName.getLength() ) 167*cdf0e10cSrcweir return msApiName; 168*cdf0e10cSrcweir else 169*cdf0e10cSrcweir return GetName(); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir void SdStyleSheet::Load (SvStream& rIn, sal_uInt16 nVersion) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir SfxStyleSheetBase::Load(rIn, nVersion); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir // Die Default-Maske war frueher 0xAFFE. 178*cdf0e10cSrcweir // Aus dieser Default-Maske wurden die benoetigten Flags ausmaskiert. 179*cdf0e10cSrcweir // Nun wurde das Flag SFXSTYLEBIT_READONLY eingefuehrt, was dazu 180*cdf0e10cSrcweir // das alle StyleSheets read-only waren. 181*cdf0e10cSrcweir // Da im Draw kein StyleSheet read-only sein soll, wird an dieser Stelle 182*cdf0e10cSrcweir // das Flag zurueckgesetzt. 183*cdf0e10cSrcweir nMask &= ~SFXSTYLEBIT_READONLY; 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir /************************************************************************* 187*cdf0e10cSrcweir |* 188*cdf0e10cSrcweir |* Store 189*cdf0e10cSrcweir |* 190*cdf0e10cSrcweir \************************************************************************/ 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir void SdStyleSheet::Store(SvStream& rOut) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir SfxStyleSheetBase::Store(rOut); 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir /************************************************************************* 198*cdf0e10cSrcweir |* 199*cdf0e10cSrcweir |* Parent setzen 200*cdf0e10cSrcweir |* 201*cdf0e10cSrcweir \************************************************************************/ 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir sal_Bool SdStyleSheet::SetParent(const String& rParentName) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir sal_Bool bResult = sal_False; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir if (SfxStyleSheet::SetParent(rParentName)) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir // PseudoStyleSheets haben keine eigenen ItemSets 210*cdf0e10cSrcweir if (nFamily != SD_STYLE_FAMILY_PSEUDO) 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir if( rParentName.Len() ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir SfxStyleSheetBase* pStyle = rPool.Find(rParentName, nFamily); 215*cdf0e10cSrcweir if (pStyle) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir bResult = sal_True; 218*cdf0e10cSrcweir SfxItemSet& rParentSet = pStyle->GetItemSet(); 219*cdf0e10cSrcweir GetItemSet().SetParent(&rParentSet); 220*cdf0e10cSrcweir Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir else 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir bResult = sal_True; 226*cdf0e10cSrcweir GetItemSet().SetParent(NULL); 227*cdf0e10cSrcweir Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) ); 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir } 230*cdf0e10cSrcweir else 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir bResult = sal_True; 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir return bResult; 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir /************************************************************************* 239*cdf0e10cSrcweir |* 240*cdf0e10cSrcweir |* ItemSet ggfs. erzeugen und herausreichen 241*cdf0e10cSrcweir |* 242*cdf0e10cSrcweir \************************************************************************/ 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir SfxItemSet& SdStyleSheet::GetItemSet() 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir if (nFamily == SD_STYLE_FAMILY_GRAPHICS || nFamily == SD_STYLE_FAMILY_MASTERPAGE) 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir // ggfs. das ItemSet 'on demand' anlegen 249*cdf0e10cSrcweir if (!pSet) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, 252*cdf0e10cSrcweir XATTR_FILL_FIRST, XATTR_FILL_LAST, 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, 255*cdf0e10cSrcweir SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME, 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE, 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST, 260*cdf0e10cSrcweir SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST, 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir EE_PARA_START, EE_CHAR_END, 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir SDRATTR_XMLATTRIBUTES, SDRATTR_TEXT_USEFIXEDCELLHEIGHT, 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir SDRATTR_3D_FIRST, SDRATTR_3D_LAST, 267*cdf0e10cSrcweir 0, 0 }; 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir return *pSet; 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir else if( nFamily == SD_STYLE_FAMILY_CELL ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir if (!pSet) 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, 280*cdf0e10cSrcweir XATTR_FILL_FIRST, XATTR_FILL_LAST, 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, 283*cdf0e10cSrcweir SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME, 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE, 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir EE_PARA_START, EE_CHAR_END, 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST, 290*cdf0e10cSrcweir SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES, 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir 0, 0 }; 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable); 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir return *pSet; 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir // dies ist eine Stellvertretervorlage fuer die interne Vorlage des 301*cdf0e10cSrcweir // aktuellen Praesentationslayouts: dessen ItemSet returnieren 302*cdf0e10cSrcweir else 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir // return (GetRealStyleSheet()->GetItemSet()); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir SdStyleSheet* pSdSheet = GetRealStyleSheet(); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir if (pSdSheet) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir return(pSdSheet->GetItemSet()); 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir else 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir if (!pSet) 315*cdf0e10cSrcweir { 316*cdf0e10cSrcweir sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST, 317*cdf0e10cSrcweir XATTR_FILL_FIRST, XATTR_FILL_LAST, 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, 320*cdf0e10cSrcweir SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME, 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE, 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST, 325*cdf0e10cSrcweir SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST, 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir EE_PARA_START, EE_CHAR_END, 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir SDRATTR_XMLATTRIBUTES, SDRATTR_TEXT_USEFIXEDCELLHEIGHT, 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir SDRATTR_3D_FIRST, SDRATTR_3D_LAST, 332*cdf0e10cSrcweir 0, 0 }; 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable); 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir return(*pSet); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir /************************************************************************* 343*cdf0e10cSrcweir |* 344*cdf0e10cSrcweir |* IsUsed(), eine Vorlage gilt als benutzt, wenn sie von eingefuegten Objekten 345*cdf0e10cSrcweir |* oder von benutzten Vorlagen referenziert wird 346*cdf0e10cSrcweir |* 347*cdf0e10cSrcweir \************************************************************************/ 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir sal_Bool SdStyleSheet::IsUsed() const 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir sal_Bool bResult = sal_False; 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir sal_uInt16 nListenerCount = GetListenerCount(); 354*cdf0e10cSrcweir if (nListenerCount > 0) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir for (sal_uInt16 n = 0; n < nListenerCount; n++) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir SfxListener* pListener = GetListener(n); 359*cdf0e10cSrcweir if( pListener == this ) 360*cdf0e10cSrcweir continue; 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir // NULL-Pointer ist im Listener-Array erlaubt 363*cdf0e10cSrcweir if (pListener && pListener->ISA(SdrAttrObj)) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir bResult = ((SdrAttrObj*)pListener)->IsInserted(); 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir else if (pListener && pListener->ISA(SfxStyleSheet)) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir bResult = ((SfxStyleSheet*)pListener)->IsUsed(); 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir if (bResult) 372*cdf0e10cSrcweir break; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir if( !bResult ) 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir MutexGuard aGuard( mrBHelper.rMutex ); 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( XModifyListener::static_type() ); 381*cdf0e10cSrcweir if( pContainer ) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() ); 384*cdf0e10cSrcweir Reference< XInterface > *p = aModifyListeners.getArray(); 385*cdf0e10cSrcweir sal_Int32 nCount = aModifyListeners.getLength(); 386*cdf0e10cSrcweir while( nCount-- && !bResult ) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir Reference< XStyle > xStyle( *p++, UNO_QUERY ); 389*cdf0e10cSrcweir if( xStyle.is() ) 390*cdf0e10cSrcweir bResult = xStyle->isInUse(); 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir } 394*cdf0e10cSrcweir return bResult; 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir /************************************************************************* 398*cdf0e10cSrcweir |* 399*cdf0e10cSrcweir |* das StyleSheet ermitteln, fuer das dieses StyleSheet steht 400*cdf0e10cSrcweir |* 401*cdf0e10cSrcweir \************************************************************************/ 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const 404*cdf0e10cSrcweir { 405*cdf0e10cSrcweir String aRealStyle; 406*cdf0e10cSrcweir String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )); 407*cdf0e10cSrcweir SdStyleSheet* pRealStyle = NULL; 408*cdf0e10cSrcweir SdDrawDocument* pDoc = ((SdStyleSheetPool&) rPool).GetDoc(); 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir ::sd::DrawViewShell* pDrawViewShell = 0; 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir ::sd::ViewShellBase* pBase = dynamic_cast< ::sd::ViewShellBase* >( SfxViewShell::Current() ); 413*cdf0e10cSrcweir if( pBase ) 414*cdf0e10cSrcweir pDrawViewShell = dynamic_cast< ::sd::DrawViewShell* >( pBase->GetMainViewShell().get() ); 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir if (pDrawViewShell && pDrawViewShell->GetDoc() == pDoc) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir SdPage* pPage = pDrawViewShell->getCurrentPage(); 419*cdf0e10cSrcweir if( pPage ) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir aRealStyle = pPage->GetLayoutName(); 422*cdf0e10cSrcweir // cut after seperator string 423*cdf0e10cSrcweir aRealStyle.Erase(aRealStyle.Search(aSep) + aSep.Len()); 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir if (aRealStyle.Len() == 0) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir SdPage* pPage = pDoc->GetSdPage(0, PK_STANDARD); 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir if (pPage) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir aRealStyle = pDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName(); 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir else 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir // Noch keine Seite vorhanden 438*cdf0e10cSrcweir // Dieses kann beim Aktualisieren vonDokumentvorlagen vorkommen 439*cdf0e10cSrcweir SfxStyleSheetIterator aIter(&rPool, SD_STYLE_FAMILY_MASTERPAGE); 440*cdf0e10cSrcweir SfxStyleSheetBase* pSheet = aIter.First(); 441*cdf0e10cSrcweir if( pSheet ) 442*cdf0e10cSrcweir aRealStyle = pSheet->GetName(); 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir aRealStyle.Erase(aRealStyle.Search(aSep) + aSep.Len()); 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir // jetzt vom Namen (landessprachlich angepasst) auf den internen 449*cdf0e10cSrcweir // Namen (unabhaengig von der Landessprache) mappen 450*cdf0e10cSrcweir String aInternalName; 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE))) 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir aInternalName = String(SdResId(STR_LAYOUT_TITLE)); 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE))) 457*cdf0e10cSrcweir { 458*cdf0e10cSrcweir aInternalName = String(SdResId(STR_LAYOUT_SUBTITLE)); 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUND))) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir aInternalName = String(SdResId(STR_LAYOUT_BACKGROUND)); 463*cdf0e10cSrcweir } 464*cdf0e10cSrcweir else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS))) 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir aInternalName = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS)); 467*cdf0e10cSrcweir } 468*cdf0e10cSrcweir else if (aName == String(SdResId(STR_PSEUDOSHEET_NOTES))) 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir aInternalName = String(SdResId(STR_LAYOUT_NOTES)); 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir else 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir String aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE)); 475*cdf0e10cSrcweir sal_uInt16 nPos = aName.Search(aOutlineStr); 476*cdf0e10cSrcweir if (nPos != STRING_NOTFOUND) 477*cdf0e10cSrcweir { 478*cdf0e10cSrcweir String aNumStr(aName.Copy(aOutlineStr.Len())); 479*cdf0e10cSrcweir aInternalName = String(SdResId(STR_LAYOUT_OUTLINE)); 480*cdf0e10cSrcweir aInternalName += aNumStr; 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir } 483*cdf0e10cSrcweir 484*cdf0e10cSrcweir aRealStyle += aInternalName; 485*cdf0e10cSrcweir pRealStyle = static_cast< SdStyleSheet* >( rPool.Find(aRealStyle, SD_STYLE_FAMILY_MASTERPAGE) ); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir #ifdef DBG_UTIL 488*cdf0e10cSrcweir if( !pRealStyle ) 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir SfxStyleSheetIterator aIter(&rPool, SD_STYLE_FAMILY_MASTERPAGE); 491*cdf0e10cSrcweir if( aIter.Count() > 0 ) 492*cdf0e10cSrcweir // StyleSheet not found, but pool already loaded 493*cdf0e10cSrcweir DBG_ASSERT(pRealStyle, "Internal StyleSheet not found"); 494*cdf0e10cSrcweir } 495*cdf0e10cSrcweir #endif 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir return pRealStyle; 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir /************************************************************************* 501*cdf0e10cSrcweir |* 502*cdf0e10cSrcweir |* das PseudoStyleSheet ermitteln, durch das dieses StyleSheet vertreten wird 503*cdf0e10cSrcweir |* 504*cdf0e10cSrcweir \************************************************************************/ 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir SdStyleSheet* SdStyleSheet::GetPseudoStyleSheet() const 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir SdStyleSheet* pPseudoStyle = NULL; 509*cdf0e10cSrcweir String aSep( RTL_CONSTASCII_USTRINGPARAM( SD_LT_SEPARATOR )); 510*cdf0e10cSrcweir String aStyleName(aName); 511*cdf0e10cSrcweir // ohne Layoutnamen und Separator 512*cdf0e10cSrcweir aStyleName.Erase(0, aStyleName.Search(aSep) + aSep.Len()); 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir if (aStyleName == String(SdResId(STR_LAYOUT_TITLE))) 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir aStyleName = String(SdResId(STR_PSEUDOSHEET_TITLE)); 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir else if (aStyleName == String(SdResId(STR_LAYOUT_SUBTITLE))) 519*cdf0e10cSrcweir { 520*cdf0e10cSrcweir aStyleName = String(SdResId(STR_PSEUDOSHEET_SUBTITLE)); 521*cdf0e10cSrcweir } 522*cdf0e10cSrcweir else if (aStyleName == String(SdResId(STR_LAYOUT_BACKGROUND))) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir aStyleName = String(SdResId(STR_PSEUDOSHEET_BACKGROUND)); 525*cdf0e10cSrcweir } 526*cdf0e10cSrcweir else if (aStyleName == String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS))) 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir aStyleName = String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)); 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir else if (aStyleName == String(SdResId(STR_LAYOUT_NOTES))) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir aStyleName = String(SdResId(STR_PSEUDOSHEET_NOTES)); 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir else 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir String aOutlineStr((SdResId(STR_LAYOUT_OUTLINE))); 537*cdf0e10cSrcweir sal_uInt16 nPos = aStyleName.Search(aOutlineStr); 538*cdf0e10cSrcweir if (nPos != STRING_NOTFOUND) 539*cdf0e10cSrcweir { 540*cdf0e10cSrcweir String aNumStr(aStyleName.Copy(aOutlineStr.Len())); 541*cdf0e10cSrcweir aStyleName = String(SdResId(STR_PSEUDOSHEET_OUTLINE)); 542*cdf0e10cSrcweir aStyleName += aNumStr; 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir pPseudoStyle = static_cast<SdStyleSheet*>(rPool.Find(aStyleName, SD_STYLE_FAMILY_PSEUDO)); 547*cdf0e10cSrcweir DBG_ASSERT(pPseudoStyle, "PseudoStyleSheet nicht gefunden"); 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir return pPseudoStyle; 550*cdf0e10cSrcweir } 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir 553*cdf0e10cSrcweir /************************************************************************* 554*cdf0e10cSrcweir |* 555*cdf0e10cSrcweir |* Notify 556*cdf0e10cSrcweir |* 557*cdf0e10cSrcweir \************************************************************************/ 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir void SdStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir // erstmal die Basisklassenfunktionalitaet 562*cdf0e10cSrcweir SfxStyleSheet::Notify(rBC, rHint); 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir // wenn der Stellvertreter ein Notify bezueglich geaenderter Attribute 565*cdf0e10cSrcweir // bekommt, sorgt er dafuer, dass das eigentlich gemeinte StyleSheet 566*cdf0e10cSrcweir // broadcastet 567*cdf0e10cSrcweir SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint); 568*cdf0e10cSrcweir sal_uLong nId = pSimple == NULL ? 0 : pSimple->GetId(); 569*cdf0e10cSrcweir if (nId == SFX_HINT_DATACHANGED && nFamily == SD_STYLE_FAMILY_PSEUDO) 570*cdf0e10cSrcweir { 571*cdf0e10cSrcweir SdStyleSheet* pRealStyle = GetRealStyleSheet(); 572*cdf0e10cSrcweir if (pRealStyle) 573*cdf0e10cSrcweir pRealStyle->Broadcast(rHint); 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir /************************************************************************* 578*cdf0e10cSrcweir |* AdjustToFontHeight passt die Bulletbreite und den linken Texteinzug 579*cdf0e10cSrcweir |* des uebergebenen ItemSets dessen Fonthoehe an. Die neuen Werte werden so 580*cdf0e10cSrcweir |* berechnet, dass das Verhaeltnis zur Fonthoehe so ist wie im StyleSheet. 581*cdf0e10cSrcweir |* 582*cdf0e10cSrcweir |* bOnlyMissingItems legt fest, ob lediglich nicht gesetzte Items ergaenzt 583*cdf0e10cSrcweir |* (sal_True) oder explizit gesetzte Items ueberschreiben werden sollen (sal_False) 584*cdf0e10cSrcweir |* 585*cdf0e10cSrcweir \************************************************************************/ 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir // Bulletbreite und Texteinzug an neue Fonthoehe 590*cdf0e10cSrcweir // anpassen, wenn sie nicht explizit gesetzt wurden 591*cdf0e10cSrcweir SfxStyleFamily eFamily = nFamily; 592*cdf0e10cSrcweir String aStyleName(aName); 593*cdf0e10cSrcweir if (eFamily == SD_STYLE_FAMILY_PSEUDO) 594*cdf0e10cSrcweir { 595*cdf0e10cSrcweir SfxStyleSheet* pRealStyle = GetRealStyleSheet(); 596*cdf0e10cSrcweir eFamily = pRealStyle->GetFamily(); 597*cdf0e10cSrcweir aStyleName = pRealStyle->GetName(); 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir if (eFamily == SD_STYLE_FAMILY_MASTERPAGE && 601*cdf0e10cSrcweir aStyleName.Search(String(SdResId(STR_LAYOUT_OUTLINE))) != STRING_NOTFOUND && 602*cdf0e10cSrcweir rSet.GetItemState(EE_CHAR_FONTHEIGHT) == SFX_ITEM_SET) 603*cdf0e10cSrcweir { 604*cdf0e10cSrcweir const SfxItemSet* pCurSet = &GetItemSet(); 605*cdf0e10cSrcweir sal_uInt32 nNewHeight = ((SvxFontHeightItem&)rSet.Get(EE_CHAR_FONTHEIGHT)).GetHeight(); 606*cdf0e10cSrcweir sal_uInt32 nOldHeight = ((SvxFontHeightItem&)pCurSet->Get(EE_CHAR_FONTHEIGHT)).GetHeight(); 607*cdf0e10cSrcweir 608*cdf0e10cSrcweir if (rSet.GetItemState(EE_PARA_BULLET) != SFX_ITEM_SET || !bOnlyMissingItems) 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir const SvxBulletItem& rBItem = (const SvxBulletItem&)pCurSet->Get(EE_PARA_BULLET); 611*cdf0e10cSrcweir double fBulletFraction = double(rBItem.GetWidth()) / nOldHeight; 612*cdf0e10cSrcweir SvxBulletItem aNewBItem(rBItem); 613*cdf0e10cSrcweir aNewBItem.SetWidth((sal_uInt32)(fBulletFraction * nNewHeight)); 614*cdf0e10cSrcweir rSet.Put(aNewBItem); 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir if (rSet.GetItemState(EE_PARA_LRSPACE) != SFX_ITEM_SET || !bOnlyMissingItems) 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&)pCurSet->Get(EE_PARA_LRSPACE); 620*cdf0e10cSrcweir double fIndentFraction = double(rLRItem.GetTxtLeft()) / nOldHeight; 621*cdf0e10cSrcweir SvxLRSpaceItem aNewLRItem(rLRItem); 622*cdf0e10cSrcweir aNewLRItem.SetTxtLeft((sal_uInt16)(fIndentFraction * nNewHeight)); 623*cdf0e10cSrcweir double fFirstIndentFraction = double(rLRItem.GetTxtFirstLineOfst()) / nOldHeight; 624*cdf0e10cSrcweir aNewLRItem.SetTxtFirstLineOfst((short)(fFirstIndentFraction * nNewHeight)); 625*cdf0e10cSrcweir rSet.Put(aNewLRItem); 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir if (rSet.GetItemState(EE_PARA_ULSPACE) != SFX_ITEM_SET || !bOnlyMissingItems) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pCurSet->Get(EE_PARA_ULSPACE); 631*cdf0e10cSrcweir SvxULSpaceItem aNewULItem(rULItem); 632*cdf0e10cSrcweir double fLowerFraction = double(rULItem.GetLower()) / nOldHeight; 633*cdf0e10cSrcweir aNewULItem.SetLower((sal_uInt16)(fLowerFraction * nNewHeight)); 634*cdf0e10cSrcweir double fUpperFraction = double(rULItem.GetUpper()) / nOldHeight; 635*cdf0e10cSrcweir aNewULItem.SetUpper((sal_uInt16)(fUpperFraction * nNewHeight)); 636*cdf0e10cSrcweir rSet.Put(aNewULItem); 637*cdf0e10cSrcweir } 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir // -------------------------------------------------------------------- 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir sal_Bool SdStyleSheet::HasFollowSupport() const 644*cdf0e10cSrcweir { 645*cdf0e10cSrcweir return sal_False; 646*cdf0e10cSrcweir } 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir // -------------------------------------------------------------------- 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir sal_Bool SdStyleSheet::HasParentSupport() const 651*cdf0e10cSrcweir { 652*cdf0e10cSrcweir return sal_True; 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir // -------------------------------------------------------------------- 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir sal_Bool SdStyleSheet::HasClearParentSupport() const 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir return sal_True; 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir // -------------------------------------------------------------------- 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir sal_Bool SdStyleSheet::SetName( const UniString& rName ) 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir return SfxStyleSheet::SetName( rName ); 667*cdf0e10cSrcweir } 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir // -------------------------------------------------------------------- 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir void SdStyleSheet::SetHelpId( const String& r, sal_uLong nId ) 672*cdf0e10cSrcweir { 673*cdf0e10cSrcweir SfxStyleSheet::SetHelpId( r, nId ); 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir if( (nId >= HID_PSEUDOSHEET_OUTLINE1) && ( nId <= HID_PSEUDOSHEET_OUTLINE9 ) ) 676*cdf0e10cSrcweir { 677*cdf0e10cSrcweir msApiName = OUString( RTL_CONSTASCII_USTRINGPARAM("outline") ); 678*cdf0e10cSrcweir msApiName += OUString( (sal_Unicode)( '1' + (nId - HID_PSEUDOSHEET_OUTLINE1) ) ); 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir else 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir static struct ApiNameMap 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir const sal_Char* mpApiName; 685*cdf0e10cSrcweir sal_uInt32 mnApiNameLength; 686*cdf0e10cSrcweir sal_uInt32 mnHelpId; 687*cdf0e10cSrcweir } 688*cdf0e10cSrcweir pApiNameMap[] = 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "title" ), HID_PSEUDOSHEET_TITLE }, 691*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "subtitle" ), HID_PSEUDOSHEET_SUBTITLE }, 692*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "background" ), HID_PSEUDOSHEET_BACKGROUND }, 693*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "backgroundobjects" ),HID_PSEUDOSHEET_BACKGROUNDOBJECTS }, 694*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "notes" ), HID_PSEUDOSHEET_NOTES }, 695*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "standard" ), HID_STANDARD_STYLESHEET_NAME }, 696*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "objectwitharrow" ), HID_POOLSHEET_OBJWITHARROW }, 697*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "objectwithshadow" ), HID_POOLSHEET_OBJWITHSHADOW }, 698*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "objectwithoutfill" ),HID_POOLSHEET_OBJWITHOUTFILL }, 699*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "text" ), HID_POOLSHEET_TEXT }, 700*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "textbody" ), HID_POOLSHEET_TEXTBODY }, 701*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "textbodyjustfied" ), HID_POOLSHEET_TEXTBODY_JUSTIFY }, 702*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "textbodyindent" ), HID_POOLSHEET_TEXTBODY_INDENT }, 703*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "title" ), HID_POOLSHEET_TITLE }, 704*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "title1" ), HID_POOLSHEET_TITLE1 }, 705*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "title2" ), HID_POOLSHEET_TITLE2 }, 706*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "headline" ), HID_POOLSHEET_HEADLINE }, 707*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "headline1" ), HID_POOLSHEET_HEADLINE1 }, 708*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "headline2" ), HID_POOLSHEET_HEADLINE2 }, 709*cdf0e10cSrcweir { RTL_CONSTASCII_STRINGPARAM( "measure" ), HID_POOLSHEET_MEASURE }, 710*cdf0e10cSrcweir { 0, 0, 0 } 711*cdf0e10cSrcweir }; 712*cdf0e10cSrcweir 713*cdf0e10cSrcweir ApiNameMap* p = pApiNameMap; 714*cdf0e10cSrcweir while( p->mpApiName ) 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir if( nId == p->mnHelpId ) 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir msApiName = OUString( p->mpApiName, p->mnApiNameLength, RTL_TEXTENCODING_ASCII_US ); 719*cdf0e10cSrcweir break; 720*cdf0e10cSrcweir } 721*cdf0e10cSrcweir p++; 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir } 724*cdf0e10cSrcweir } 725*cdf0e10cSrcweir 726*cdf0e10cSrcweir // -------------------------------------------------------------------- 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir OUString SdStyleSheet::GetFamilyString( SfxStyleFamily eFamily ) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir switch( eFamily ) 731*cdf0e10cSrcweir { 732*cdf0e10cSrcweir case SD_STYLE_FAMILY_CELL: 733*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "cell" ) ); 734*cdf0e10cSrcweir default: 735*cdf0e10cSrcweir DBG_ERROR( "SdStyleSheet::GetFamilyString(), illegal family!" ); 736*cdf0e10cSrcweir case SD_STYLE_FAMILY_GRAPHICS: 737*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ); 738*cdf0e10cSrcweir } 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir // -------------------------------------------------------------------- 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir void SdStyleSheet::throwIfDisposed() throw (RuntimeException) 744*cdf0e10cSrcweir { 745*cdf0e10cSrcweir if( !mxPool.is() ) 746*cdf0e10cSrcweir throw DisposedException(); 747*cdf0e10cSrcweir } 748*cdf0e10cSrcweir 749*cdf0e10cSrcweir // -------------------------------------------------------------------- 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir SdStyleSheet* SdStyleSheet::CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily ) 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir OUString aPrefix( RTL_CONSTASCII_USTRINGPARAM("user") ); 754*cdf0e10cSrcweir OUString aName; 755*cdf0e10cSrcweir sal_Int32 nIndex = 1; 756*cdf0e10cSrcweir do 757*cdf0e10cSrcweir { 758*cdf0e10cSrcweir aName = aPrefix + OUString::valueOf( nIndex++ ); 759*cdf0e10cSrcweir } 760*cdf0e10cSrcweir while( rPool.Find( aName, eFamily ) != 0 ); 761*cdf0e10cSrcweir 762*cdf0e10cSrcweir return new SdStyleSheet(aName, rPool, eFamily, SFXSTYLEBIT_USERDEF); 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir // -------------------------------------------------------------------- 766*cdf0e10cSrcweir // XInterface 767*cdf0e10cSrcweir // -------------------------------------------------------------------- 768*cdf0e10cSrcweir 769*cdf0e10cSrcweir /* 770*cdf0e10cSrcweir Any SAL_CALL SdStyleSheet::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (RuntimeException) 771*cdf0e10cSrcweir { 772*cdf0e10cSrcweir return SdStyleSheetBase::queryInterface( aType ); 773*cdf0e10cSrcweir } 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir // -------------------------------------------------------------------- 776*cdf0e10cSrcweir 777*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::acquire( ) throw () 778*cdf0e10cSrcweir { 779*cdf0e10cSrcweir SdStyleSheetBase::acquire(); 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir 782*cdf0e10cSrcweir // -------------------------------------------------------------------- 783*cdf0e10cSrcweir */ 784*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::release( ) throw () 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir if (osl_decrementInterlockedCount( &m_refCount ) == 0) 787*cdf0e10cSrcweir { 788*cdf0e10cSrcweir // restore reference count: 789*cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount ); 790*cdf0e10cSrcweir if (! mrBHelper.bDisposed) try 791*cdf0e10cSrcweir { 792*cdf0e10cSrcweir dispose(); 793*cdf0e10cSrcweir } 794*cdf0e10cSrcweir catch (RuntimeException const& exc) 795*cdf0e10cSrcweir { // don't break throw () 796*cdf0e10cSrcweir OSL_ENSURE( 797*cdf0e10cSrcweir false, OUStringToOString( 798*cdf0e10cSrcweir exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); 799*cdf0e10cSrcweir static_cast<void>(exc); 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir OSL_ASSERT( mrBHelper.bDisposed ); 802*cdf0e10cSrcweir SdStyleSheetBase::release(); 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir } 805*cdf0e10cSrcweir 806*cdf0e10cSrcweir // -------------------------------------------------------------------- 807*cdf0e10cSrcweir // XWeak 808*cdf0e10cSrcweir // -------------------------------------------------------------------- 809*cdf0e10cSrcweir /* 810*cdf0e10cSrcweir Reference< XAdapter > SAL_CALL SdStyleSheet::queryAdapter( ) throw (RuntimeException) 811*cdf0e10cSrcweir { 812*cdf0e10cSrcweir return SdStyleSheetBase::queryAdapter(); 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir // -------------------------------------------------------------------- 816*cdf0e10cSrcweir // XTypeProvider 817*cdf0e10cSrcweir // -------------------------------------------------------------------- 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir Sequence< Type > SAL_CALL SdStyleSheet::getTypes( ) throw (RuntimeException) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir return SdStyleSheetBase::getTypes(); 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir 824*cdf0e10cSrcweir // -------------------------------------------------------------------- 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir Sequence< ::sal_Int8 > SAL_CALL SdStyleSheet::getImplementationId( ) throw (RuntimeException) 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir return SdStyleSheetBase::getImplementationId(); 829*cdf0e10cSrcweir } 830*cdf0e10cSrcweir */ 831*cdf0e10cSrcweir // -------------------------------------------------------------------- 832*cdf0e10cSrcweir // XComponent 833*cdf0e10cSrcweir // -------------------------------------------------------------------- 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::dispose( ) throw (RuntimeException) 836*cdf0e10cSrcweir { 837*cdf0e10cSrcweir ClearableMutexGuard aGuard( mrBHelper.rMutex ); 838*cdf0e10cSrcweir if (!mrBHelper.bDisposed && !mrBHelper.bInDispose) 839*cdf0e10cSrcweir { 840*cdf0e10cSrcweir mrBHelper.bInDispose = sal_True; 841*cdf0e10cSrcweir aGuard.clear(); 842*cdf0e10cSrcweir try 843*cdf0e10cSrcweir { 844*cdf0e10cSrcweir // side effect: keeping a reference to this 845*cdf0e10cSrcweir EventObject aEvt( static_cast< OWeakObject * >( this ) ); 846*cdf0e10cSrcweir try 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir mrBHelper.aLC.disposeAndClear( aEvt ); 849*cdf0e10cSrcweir disposing(); 850*cdf0e10cSrcweir } 851*cdf0e10cSrcweir catch (...) 852*cdf0e10cSrcweir { 853*cdf0e10cSrcweir MutexGuard aGuard2( mrBHelper.rMutex ); 854*cdf0e10cSrcweir // bDisposed and bInDispose must be set in this order: 855*cdf0e10cSrcweir mrBHelper.bDisposed = sal_True; 856*cdf0e10cSrcweir mrBHelper.bInDispose = sal_False; 857*cdf0e10cSrcweir throw; 858*cdf0e10cSrcweir } 859*cdf0e10cSrcweir MutexGuard aGuard2( mrBHelper.rMutex ); 860*cdf0e10cSrcweir // bDisposed and bInDispose must be set in this order: 861*cdf0e10cSrcweir mrBHelper.bDisposed = sal_True; 862*cdf0e10cSrcweir mrBHelper.bInDispose = sal_False; 863*cdf0e10cSrcweir } 864*cdf0e10cSrcweir catch (RuntimeException &) 865*cdf0e10cSrcweir { 866*cdf0e10cSrcweir throw; 867*cdf0e10cSrcweir } 868*cdf0e10cSrcweir catch (Exception & exc) 869*cdf0e10cSrcweir { 870*cdf0e10cSrcweir throw RuntimeException( 871*cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 872*cdf0e10cSrcweir "unexpected UNO exception caught: ") ) + 873*cdf0e10cSrcweir exc.Message, Reference< XInterface >() ); 874*cdf0e10cSrcweir } 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir // -------------------------------------------------------------------- 879*cdf0e10cSrcweir 880*cdf0e10cSrcweir void SdStyleSheet::disposing() 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir mxPool.clear(); 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir // -------------------------------------------------------------------- 886*cdf0e10cSrcweir 887*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) 888*cdf0e10cSrcweir { 889*cdf0e10cSrcweir ClearableMutexGuard aGuard( mrBHelper.rMutex ); 890*cdf0e10cSrcweir if (mrBHelper.bDisposed || mrBHelper.bInDispose) 891*cdf0e10cSrcweir { 892*cdf0e10cSrcweir aGuard.clear(); 893*cdf0e10cSrcweir EventObject aEvt( static_cast< OWeakObject * >( this ) ); 894*cdf0e10cSrcweir xListener->disposing( aEvt ); 895*cdf0e10cSrcweir } 896*cdf0e10cSrcweir else 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir mrBHelper.addListener( ::getCppuType( &xListener ), xListener ); 899*cdf0e10cSrcweir } 900*cdf0e10cSrcweir } 901*cdf0e10cSrcweir 902*cdf0e10cSrcweir // -------------------------------------------------------------------- 903*cdf0e10cSrcweir 904*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) 905*cdf0e10cSrcweir { 906*cdf0e10cSrcweir mrBHelper.removeListener( ::getCppuType( &xListener ), xListener ); 907*cdf0e10cSrcweir } 908*cdf0e10cSrcweir 909*cdf0e10cSrcweir //------------------------------------------------------------------------ 910*cdf0e10cSrcweir // XModifyBroadcaster 911*cdf0e10cSrcweir //------------------------------------------------------------------------ 912*cdf0e10cSrcweir 913*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException) 914*cdf0e10cSrcweir { 915*cdf0e10cSrcweir ClearableMutexGuard aGuard( mrBHelper.rMutex ); 916*cdf0e10cSrcweir if (mrBHelper.bDisposed || mrBHelper.bInDispose) 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir aGuard.clear(); 919*cdf0e10cSrcweir EventObject aEvt( static_cast< OWeakObject * >( this ) ); 920*cdf0e10cSrcweir xListener->disposing( aEvt ); 921*cdf0e10cSrcweir } 922*cdf0e10cSrcweir else 923*cdf0e10cSrcweir { 924*cdf0e10cSrcweir if( !mpModifyListenerForewarder.get() ) 925*cdf0e10cSrcweir mpModifyListenerForewarder.reset( new ModifyListenerForewarder( this ) ); 926*cdf0e10cSrcweir mrBHelper.addListener( XModifyListener::static_type(), xListener ); 927*cdf0e10cSrcweir } 928*cdf0e10cSrcweir } 929*cdf0e10cSrcweir 930*cdf0e10cSrcweir //------------------------------------------------------------------------ 931*cdf0e10cSrcweir 932*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException) 933*cdf0e10cSrcweir { 934*cdf0e10cSrcweir mrBHelper.removeListener( XModifyListener::static_type(), xListener ); 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir 937*cdf0e10cSrcweir //------------------------------------------------------------------------ 938*cdf0e10cSrcweir 939*cdf0e10cSrcweir void SdStyleSheet::notifyModifyListener() 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir MutexGuard aGuard( mrBHelper.rMutex ); 942*cdf0e10cSrcweir 943*cdf0e10cSrcweir OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( XModifyListener::static_type() ); 944*cdf0e10cSrcweir if( pContainer ) 945*cdf0e10cSrcweir { 946*cdf0e10cSrcweir EventObject aEvt( static_cast< OWeakObject * >( this ) ); 947*cdf0e10cSrcweir pContainer->forEach<XModifyListener>( boost::bind( &XModifyListener::modified, _1, boost::cref( aEvt ) ) ); 948*cdf0e10cSrcweir } 949*cdf0e10cSrcweir } 950*cdf0e10cSrcweir 951*cdf0e10cSrcweir 952*cdf0e10cSrcweir // -------------------------------------------------------------------- 953*cdf0e10cSrcweir // XServiceInfo 954*cdf0e10cSrcweir // -------------------------------------------------------------------- 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir OUString SAL_CALL SdStyleSheet::getImplementationName() throw(RuntimeException) 957*cdf0e10cSrcweir { 958*cdf0e10cSrcweir return OUString::createFromAscii( "SdStyleSheet" ); 959*cdf0e10cSrcweir } 960*cdf0e10cSrcweir 961*cdf0e10cSrcweir // -------------------------------------------------------------------- 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir sal_Bool SAL_CALL SdStyleSheet::supportsService( const OUString& ServiceName ) throw(RuntimeException) 964*cdf0e10cSrcweir { 965*cdf0e10cSrcweir return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); 966*cdf0e10cSrcweir } 967*cdf0e10cSrcweir 968*cdf0e10cSrcweir // -------------------------------------------------------------------- 969*cdf0e10cSrcweir 970*cdf0e10cSrcweir Sequence< OUString > SAL_CALL SdStyleSheet::getSupportedServiceNames() throw(RuntimeException) 971*cdf0e10cSrcweir { 972*cdf0e10cSrcweir Sequence< OUString > aNameSequence( 10 ); 973*cdf0e10cSrcweir OUString* pStrings = aNameSequence.getArray(); 974*cdf0e10cSrcweir 975*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.Style" ) ); 976*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.FillProperties" ) ); 977*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.LineProperties" ) ); 978*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ShadowProperties" ) ); 979*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ConnectorProperties" ) ); 980*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.MeasureProperties" ) ); 981*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.ParagraphProperties" ) ); 982*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CharacterProperties" ) ); 983*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.TextProperties" ) ); 984*cdf0e10cSrcweir *pStrings++ = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.Text" ) ); 985*cdf0e10cSrcweir 986*cdf0e10cSrcweir return aNameSequence; 987*cdf0e10cSrcweir } 988*cdf0e10cSrcweir 989*cdf0e10cSrcweir // -------------------------------------------------------------------- 990*cdf0e10cSrcweir // XNamed 991*cdf0e10cSrcweir // -------------------------------------------------------------------- 992*cdf0e10cSrcweir 993*cdf0e10cSrcweir OUString SAL_CALL SdStyleSheet::getName() throw(RuntimeException) 994*cdf0e10cSrcweir { 995*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 996*cdf0e10cSrcweir throwIfDisposed(); 997*cdf0e10cSrcweir return GetApiName(); 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir 1000*cdf0e10cSrcweir // -------------------------------------------------------------------- 1001*cdf0e10cSrcweir 1002*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::setName( const OUString& rName ) throw(RuntimeException) 1003*cdf0e10cSrcweir { 1004*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1005*cdf0e10cSrcweir throwIfDisposed(); 1006*cdf0e10cSrcweir 1007*cdf0e10cSrcweir if( SetName( rName ) ) 1008*cdf0e10cSrcweir { 1009*cdf0e10cSrcweir msApiName = rName; 1010*cdf0e10cSrcweir Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); 1011*cdf0e10cSrcweir } 1012*cdf0e10cSrcweir } 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir // -------------------------------------------------------------------- 1015*cdf0e10cSrcweir // XStyle 1016*cdf0e10cSrcweir // -------------------------------------------------------------------- 1017*cdf0e10cSrcweir 1018*cdf0e10cSrcweir sal_Bool SAL_CALL SdStyleSheet::isUserDefined() throw(RuntimeException) 1019*cdf0e10cSrcweir { 1020*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1021*cdf0e10cSrcweir throwIfDisposed(); 1022*cdf0e10cSrcweir return IsUserDefined() ? sal_True : sal_False; 1023*cdf0e10cSrcweir } 1024*cdf0e10cSrcweir 1025*cdf0e10cSrcweir // -------------------------------------------------------------------- 1026*cdf0e10cSrcweir 1027*cdf0e10cSrcweir sal_Bool SAL_CALL SdStyleSheet::isInUse() throw(RuntimeException) 1028*cdf0e10cSrcweir { 1029*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1030*cdf0e10cSrcweir throwIfDisposed(); 1031*cdf0e10cSrcweir return IsUsed() ? sal_True : sal_False; 1032*cdf0e10cSrcweir } 1033*cdf0e10cSrcweir 1034*cdf0e10cSrcweir // -------------------------------------------------------------------- 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir OUString SAL_CALL SdStyleSheet::getParentStyle() throw(RuntimeException) 1037*cdf0e10cSrcweir { 1038*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1039*cdf0e10cSrcweir throwIfDisposed(); 1040*cdf0e10cSrcweir 1041*cdf0e10cSrcweir if( GetParent().Len() ) 1042*cdf0e10cSrcweir { 1043*cdf0e10cSrcweir SdStyleSheet* pParentStyle = static_cast< SdStyleSheet* >( mxPool->Find( GetParent(), nFamily ) ); 1044*cdf0e10cSrcweir if( pParentStyle ) 1045*cdf0e10cSrcweir return pParentStyle->msApiName; 1046*cdf0e10cSrcweir } 1047*cdf0e10cSrcweir return OUString(); 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir 1050*cdf0e10cSrcweir // -------------------------------------------------------------------- 1051*cdf0e10cSrcweir 1052*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName ) throw(NoSuchElementException, RuntimeException) 1053*cdf0e10cSrcweir { 1054*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1055*cdf0e10cSrcweir throwIfDisposed(); 1056*cdf0e10cSrcweir 1057*cdf0e10cSrcweir if( rParentName.getLength() ) 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir const SfxStyles& rStyles = mxPool->GetStyles(); 1060*cdf0e10cSrcweir 1061*cdf0e10cSrcweir for( SfxStyles::const_iterator iter( rStyles.begin() ); iter != rStyles.end(); iter++ ) 1062*cdf0e10cSrcweir { 1063*cdf0e10cSrcweir SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() ); 1064*cdf0e10cSrcweir if( pStyle && (pStyle->nFamily == nFamily) && (pStyle->msApiName == rParentName) ) 1065*cdf0e10cSrcweir { 1066*cdf0e10cSrcweir if( pStyle != this ) 1067*cdf0e10cSrcweir SetParent( pStyle->GetName() ); 1068*cdf0e10cSrcweir return; 1069*cdf0e10cSrcweir } 1070*cdf0e10cSrcweir } 1071*cdf0e10cSrcweir throw NoSuchElementException(); 1072*cdf0e10cSrcweir } 1073*cdf0e10cSrcweir else 1074*cdf0e10cSrcweir { 1075*cdf0e10cSrcweir SetParent( rParentName ); 1076*cdf0e10cSrcweir } 1077*cdf0e10cSrcweir } 1078*cdf0e10cSrcweir 1079*cdf0e10cSrcweir // -------------------------------------------------------------------- 1080*cdf0e10cSrcweir // XPropertySet 1081*cdf0e10cSrcweir // -------------------------------------------------------------------- 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir Reference< XPropertySetInfo > SdStyleSheet::getPropertySetInfo() throw(RuntimeException) 1084*cdf0e10cSrcweir { 1085*cdf0e10cSrcweir throwIfDisposed(); 1086*cdf0e10cSrcweir static Reference< XPropertySetInfo > xInfo; 1087*cdf0e10cSrcweir if( !xInfo.is() ) 1088*cdf0e10cSrcweir xInfo = GetStylePropertySet().getPropertySetInfo(); 1089*cdf0e10cSrcweir return xInfo; 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir // -------------------------------------------------------------------- 1093*cdf0e10cSrcweir 1094*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) 1095*cdf0e10cSrcweir { 1096*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1097*cdf0e10cSrcweir throwIfDisposed(); 1098*cdf0e10cSrcweir 1099*cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName ); 1100*cdf0e10cSrcweir if( pEntry == NULL ) 1101*cdf0e10cSrcweir { 1102*cdf0e10cSrcweir throw UnknownPropertyException(); 1103*cdf0e10cSrcweir } 1104*cdf0e10cSrcweir else 1105*cdf0e10cSrcweir { 1106*cdf0e10cSrcweir if( pEntry->nWID == SDRATTR_TEXTDIRECTION ) 1107*cdf0e10cSrcweir return; // not yet implemented for styles 1108*cdf0e10cSrcweir 1109*cdf0e10cSrcweir if( pEntry->nWID == WID_STYLE_FAMILY ) 1110*cdf0e10cSrcweir throw PropertyVetoException(); 1111*cdf0e10cSrcweir 1112*cdf0e10cSrcweir if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) ) 1113*cdf0e10cSrcweir { 1114*cdf0e10cSrcweir String aStr; 1115*cdf0e10cSrcweir const sal_uInt32 nTempHelpId = GetHelpId( aStr ); 1116*cdf0e10cSrcweir 1117*cdf0e10cSrcweir if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) ) 1118*cdf0e10cSrcweir return; 1119*cdf0e10cSrcweir } 1120*cdf0e10cSrcweir 1121*cdf0e10cSrcweir SfxItemSet &rStyleSet = GetItemSet(); 1122*cdf0e10cSrcweir 1123*cdf0e10cSrcweir if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) 1124*cdf0e10cSrcweir { 1125*cdf0e10cSrcweir BitmapMode eMode; 1126*cdf0e10cSrcweir if( aValue >>= eMode ) 1127*cdf0e10cSrcweir { 1128*cdf0e10cSrcweir rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) ); 1129*cdf0e10cSrcweir rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) ); 1130*cdf0e10cSrcweir return; 1131*cdf0e10cSrcweir } 1132*cdf0e10cSrcweir throw IllegalArgumentException(); 1133*cdf0e10cSrcweir } 1134*cdf0e10cSrcweir 1135*cdf0e10cSrcweir SfxItemSet aSet( GetPool().GetPool(), pEntry->nWID, pEntry->nWID); 1136*cdf0e10cSrcweir aSet.Put( rStyleSet ); 1137*cdf0e10cSrcweir 1138*cdf0e10cSrcweir if( !aSet.Count() ) 1139*cdf0e10cSrcweir { 1140*cdf0e10cSrcweir if( EE_PARA_NUMBULLET == pEntry->nWID ) 1141*cdf0e10cSrcweir { 1142*cdf0e10cSrcweir Font aBulletFont; 1143*cdf0e10cSrcweir SdStyleSheetPool::PutNumBulletItem( this, aBulletFont ); 1144*cdf0e10cSrcweir aSet.Put( rStyleSet ); 1145*cdf0e10cSrcweir } 1146*cdf0e10cSrcweir else 1147*cdf0e10cSrcweir { 1148*cdf0e10cSrcweir aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) ); 1149*cdf0e10cSrcweir } 1150*cdf0e10cSrcweir } 1151*cdf0e10cSrcweir 1152*cdf0e10cSrcweir if( pEntry->nMemberId == MID_NAME && 1153*cdf0e10cSrcweir ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT || 1154*cdf0e10cSrcweir pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE || 1155*cdf0e10cSrcweir pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) ) 1156*cdf0e10cSrcweir { 1157*cdf0e10cSrcweir OUString aTempName; 1158*cdf0e10cSrcweir if(!(aValue >>= aTempName )) 1159*cdf0e10cSrcweir throw IllegalArgumentException(); 1160*cdf0e10cSrcweir 1161*cdf0e10cSrcweir SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet ); 1162*cdf0e10cSrcweir } 1163*cdf0e10cSrcweir else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( aSet, pEntry, aValue, aSet )) 1164*cdf0e10cSrcweir { 1165*cdf0e10cSrcweir SvxItemPropertySet_setPropertyValue( GetStylePropertySet(), pEntry, aValue, aSet ); 1166*cdf0e10cSrcweir } 1167*cdf0e10cSrcweir 1168*cdf0e10cSrcweir rStyleSet.Put( aSet ); 1169*cdf0e10cSrcweir Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); 1170*cdf0e10cSrcweir } 1171*cdf0e10cSrcweir } 1172*cdf0e10cSrcweir 1173*cdf0e10cSrcweir // -------------------------------------------------------------------- 1174*cdf0e10cSrcweir 1175*cdf0e10cSrcweir Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 1176*cdf0e10cSrcweir { 1177*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1178*cdf0e10cSrcweir 1179*cdf0e10cSrcweir throwIfDisposed(); 1180*cdf0e10cSrcweir 1181*cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName ); 1182*cdf0e10cSrcweir if( pEntry == NULL ) 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir throw UnknownPropertyException(); 1185*cdf0e10cSrcweir } 1186*cdf0e10cSrcweir else 1187*cdf0e10cSrcweir { 1188*cdf0e10cSrcweir Any aAny; 1189*cdf0e10cSrcweir 1190*cdf0e10cSrcweir if( pEntry->nWID == WID_STYLE_FAMILY ) 1191*cdf0e10cSrcweir { 1192*cdf0e10cSrcweir if( nFamily == SD_STYLE_FAMILY_MASTERPAGE ) 1193*cdf0e10cSrcweir { 1194*cdf0e10cSrcweir const OUString aLayoutName( GetName() ); 1195*cdf0e10cSrcweir aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf(OUString( RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR) ) ) ); 1196*cdf0e10cSrcweir } 1197*cdf0e10cSrcweir else 1198*cdf0e10cSrcweir { 1199*cdf0e10cSrcweir aAny <<= GetFamilyString(nFamily); 1200*cdf0e10cSrcweir } 1201*cdf0e10cSrcweir } 1202*cdf0e10cSrcweir else if( pEntry->nWID == WID_STYLE_DISPNAME ) 1203*cdf0e10cSrcweir { 1204*cdf0e10cSrcweir aAny <<= maDisplayName; 1205*cdf0e10cSrcweir } 1206*cdf0e10cSrcweir else if( pEntry->nWID == SDRATTR_TEXTDIRECTION ) 1207*cdf0e10cSrcweir { 1208*cdf0e10cSrcweir aAny <<= sal_False; 1209*cdf0e10cSrcweir } 1210*cdf0e10cSrcweir else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) 1211*cdf0e10cSrcweir { 1212*cdf0e10cSrcweir SfxItemSet &rStyleSet = GetItemSet(); 1213*cdf0e10cSrcweir 1214*cdf0e10cSrcweir XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)rStyleSet.GetItem(XATTR_FILLBMP_STRETCH); 1215*cdf0e10cSrcweir XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)rStyleSet.GetItem(XATTR_FILLBMP_TILE); 1216*cdf0e10cSrcweir 1217*cdf0e10cSrcweir if( pStretchItem && pTileItem ) 1218*cdf0e10cSrcweir { 1219*cdf0e10cSrcweir if( pTileItem->GetValue() ) 1220*cdf0e10cSrcweir aAny <<= BitmapMode_REPEAT; 1221*cdf0e10cSrcweir else if( pStretchItem->GetValue() ) 1222*cdf0e10cSrcweir aAny <<= BitmapMode_STRETCH; 1223*cdf0e10cSrcweir else 1224*cdf0e10cSrcweir aAny <<= BitmapMode_NO_REPEAT; 1225*cdf0e10cSrcweir } 1226*cdf0e10cSrcweir } 1227*cdf0e10cSrcweir else 1228*cdf0e10cSrcweir { 1229*cdf0e10cSrcweir SfxItemSet aSet( GetPool().GetPool(), pEntry->nWID, pEntry->nWID); 1230*cdf0e10cSrcweir 1231*cdf0e10cSrcweir const SfxPoolItem* pItem; 1232*cdf0e10cSrcweir SfxItemSet& rStyleSet = GetItemSet(); 1233*cdf0e10cSrcweir 1234*cdf0e10cSrcweir if( rStyleSet.GetItemState( pEntry->nWID, sal_True, &pItem ) == SFX_ITEM_SET ) 1235*cdf0e10cSrcweir aSet.Put( *pItem ); 1236*cdf0e10cSrcweir 1237*cdf0e10cSrcweir if( !aSet.Count() ) 1238*cdf0e10cSrcweir aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) ); 1239*cdf0e10cSrcweir 1240*cdf0e10cSrcweir if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny )) 1241*cdf0e10cSrcweir return aAny; 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir // Hole Wert aus ItemSet 1244*cdf0e10cSrcweir aAny = SvxItemPropertySet_getPropertyValue( GetStylePropertySet(),pEntry, aSet ); 1245*cdf0e10cSrcweir } 1246*cdf0e10cSrcweir 1247*cdf0e10cSrcweir if( *pEntry->pType != aAny.getValueType() ) 1248*cdf0e10cSrcweir { 1249*cdf0e10cSrcweir // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here 1250*cdf0e10cSrcweir if( ( *pEntry->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) ) 1251*cdf0e10cSrcweir { 1252*cdf0e10cSrcweir sal_Int32 nValue = 0; 1253*cdf0e10cSrcweir aAny >>= nValue; 1254*cdf0e10cSrcweir aAny <<= (sal_Int16)nValue; 1255*cdf0e10cSrcweir } 1256*cdf0e10cSrcweir else 1257*cdf0e10cSrcweir { 1258*cdf0e10cSrcweir DBG_ERROR("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" ); 1259*cdf0e10cSrcweir } 1260*cdf0e10cSrcweir } 1261*cdf0e10cSrcweir 1262*cdf0e10cSrcweir return aAny; 1263*cdf0e10cSrcweir } 1264*cdf0e10cSrcweir } 1265*cdf0e10cSrcweir 1266*cdf0e10cSrcweir // -------------------------------------------------------------------- 1267*cdf0e10cSrcweir 1268*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {} 1269*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {} 1270*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {} 1271*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {} 1272*cdf0e10cSrcweir 1273*cdf0e10cSrcweir // -------------------------------------------------------------------- 1274*cdf0e10cSrcweir // XPropertyState 1275*cdf0e10cSrcweir // -------------------------------------------------------------------- 1276*cdf0e10cSrcweir 1277*cdf0e10cSrcweir PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException) 1278*cdf0e10cSrcweir { 1279*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1280*cdf0e10cSrcweir 1281*cdf0e10cSrcweir throwIfDisposed(); 1282*cdf0e10cSrcweir 1283*cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName ); 1284*cdf0e10cSrcweir 1285*cdf0e10cSrcweir if( pEntry == NULL ) 1286*cdf0e10cSrcweir throw UnknownPropertyException(); 1287*cdf0e10cSrcweir 1288*cdf0e10cSrcweir if( pEntry->nWID == WID_STYLE_FAMILY ) 1289*cdf0e10cSrcweir { 1290*cdf0e10cSrcweir return PropertyState_DIRECT_VALUE; 1291*cdf0e10cSrcweir } 1292*cdf0e10cSrcweir else if( pEntry->nWID == SDRATTR_TEXTDIRECTION ) 1293*cdf0e10cSrcweir { 1294*cdf0e10cSrcweir return PropertyState_DEFAULT_VALUE; 1295*cdf0e10cSrcweir } 1296*cdf0e10cSrcweir else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) 1297*cdf0e10cSrcweir { 1298*cdf0e10cSrcweir const SfxItemSet& rSet = GetItemSet(); 1299*cdf0e10cSrcweir 1300*cdf0e10cSrcweir if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET || 1301*cdf0e10cSrcweir rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET ) 1302*cdf0e10cSrcweir { 1303*cdf0e10cSrcweir return PropertyState_DIRECT_VALUE; 1304*cdf0e10cSrcweir } 1305*cdf0e10cSrcweir else 1306*cdf0e10cSrcweir { 1307*cdf0e10cSrcweir return PropertyState_AMBIGUOUS_VALUE; 1308*cdf0e10cSrcweir } 1309*cdf0e10cSrcweir } 1310*cdf0e10cSrcweir else 1311*cdf0e10cSrcweir { 1312*cdf0e10cSrcweir SfxItemSet &rStyleSet = GetItemSet(); 1313*cdf0e10cSrcweir 1314*cdf0e10cSrcweir PropertyState eState; 1315*cdf0e10cSrcweir 1316*cdf0e10cSrcweir switch( rStyleSet.GetItemState( pEntry->nWID, sal_False ) ) 1317*cdf0e10cSrcweir { 1318*cdf0e10cSrcweir case SFX_ITEM_READONLY: 1319*cdf0e10cSrcweir case SFX_ITEM_SET: 1320*cdf0e10cSrcweir eState = PropertyState_DIRECT_VALUE; 1321*cdf0e10cSrcweir break; 1322*cdf0e10cSrcweir case SFX_ITEM_DEFAULT: 1323*cdf0e10cSrcweir eState = PropertyState_DEFAULT_VALUE; 1324*cdf0e10cSrcweir break; 1325*cdf0e10cSrcweir // case SFX_ITEM_DONTCARE: 1326*cdf0e10cSrcweir // case SFX_ITEM_DISABLED: 1327*cdf0e10cSrcweir default: 1328*cdf0e10cSrcweir eState = PropertyState_AMBIGUOUS_VALUE; 1329*cdf0e10cSrcweir break; 1330*cdf0e10cSrcweir } 1331*cdf0e10cSrcweir 1332*cdf0e10cSrcweir // if a item is set, this doesn't mean we want it :) 1333*cdf0e10cSrcweir if( ( PropertyState_DIRECT_VALUE == eState ) ) 1334*cdf0e10cSrcweir { 1335*cdf0e10cSrcweir switch( pEntry->nWID ) 1336*cdf0e10cSrcweir { 1337*cdf0e10cSrcweir case XATTR_FILLBITMAP: 1338*cdf0e10cSrcweir case XATTR_FILLGRADIENT: 1339*cdf0e10cSrcweir case XATTR_FILLHATCH: 1340*cdf0e10cSrcweir case XATTR_FILLFLOATTRANSPARENCE: 1341*cdf0e10cSrcweir case XATTR_LINEEND: 1342*cdf0e10cSrcweir case XATTR_LINESTART: 1343*cdf0e10cSrcweir case XATTR_LINEDASH: 1344*cdf0e10cSrcweir { 1345*cdf0e10cSrcweir NameOrIndex* pItem = (NameOrIndex*)rStyleSet.GetItem((sal_uInt16)pEntry->nWID); 1346*cdf0e10cSrcweir if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) ) 1347*cdf0e10cSrcweir eState = PropertyState_DEFAULT_VALUE; 1348*cdf0e10cSrcweir } 1349*cdf0e10cSrcweir } 1350*cdf0e10cSrcweir } 1351*cdf0e10cSrcweir 1352*cdf0e10cSrcweir return eState; 1353*cdf0e10cSrcweir } 1354*cdf0e10cSrcweir } 1355*cdf0e10cSrcweir 1356*cdf0e10cSrcweir // -------------------------------------------------------------------- 1357*cdf0e10cSrcweir 1358*cdf0e10cSrcweir Sequence< PropertyState > SAL_CALL SdStyleSheet::getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException) 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1361*cdf0e10cSrcweir 1362*cdf0e10cSrcweir throwIfDisposed(); 1363*cdf0e10cSrcweir 1364*cdf0e10cSrcweir sal_Int32 nCount = aPropertyName.getLength(); 1365*cdf0e10cSrcweir const OUString* pNames = aPropertyName.getConstArray(); 1366*cdf0e10cSrcweir 1367*cdf0e10cSrcweir Sequence< PropertyState > aPropertyStateSequence( nCount ); 1368*cdf0e10cSrcweir PropertyState* pState = aPropertyStateSequence.getArray(); 1369*cdf0e10cSrcweir 1370*cdf0e10cSrcweir while( nCount-- ) 1371*cdf0e10cSrcweir *pState++ = getPropertyState( *pNames++ ); 1372*cdf0e10cSrcweir 1373*cdf0e10cSrcweir return aPropertyStateSequence; 1374*cdf0e10cSrcweir } 1375*cdf0e10cSrcweir 1376*cdf0e10cSrcweir // -------------------------------------------------------------------- 1377*cdf0e10cSrcweir 1378*cdf0e10cSrcweir void SAL_CALL SdStyleSheet::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException) 1379*cdf0e10cSrcweir { 1380*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1381*cdf0e10cSrcweir 1382*cdf0e10cSrcweir throwIfDisposed(); 1383*cdf0e10cSrcweir 1384*cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName ); 1385*cdf0e10cSrcweir if( pEntry == NULL ) 1386*cdf0e10cSrcweir throw UnknownPropertyException(); 1387*cdf0e10cSrcweir 1388*cdf0e10cSrcweir SfxItemSet &rStyleSet = GetItemSet(); 1389*cdf0e10cSrcweir 1390*cdf0e10cSrcweir if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) 1391*cdf0e10cSrcweir { 1392*cdf0e10cSrcweir rStyleSet.ClearItem( XATTR_FILLBMP_STRETCH ); 1393*cdf0e10cSrcweir rStyleSet.ClearItem( XATTR_FILLBMP_TILE ); 1394*cdf0e10cSrcweir } 1395*cdf0e10cSrcweir else 1396*cdf0e10cSrcweir { 1397*cdf0e10cSrcweir rStyleSet.ClearItem( pEntry->nWID ); 1398*cdf0e10cSrcweir } 1399*cdf0e10cSrcweir Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); 1400*cdf0e10cSrcweir } 1401*cdf0e10cSrcweir 1402*cdf0e10cSrcweir // -------------------------------------------------------------------- 1403*cdf0e10cSrcweir 1404*cdf0e10cSrcweir Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 1405*cdf0e10cSrcweir { 1406*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1407*cdf0e10cSrcweir 1408*cdf0e10cSrcweir throwIfDisposed(); 1409*cdf0e10cSrcweir 1410*cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName ); 1411*cdf0e10cSrcweir if( pEntry == NULL ) 1412*cdf0e10cSrcweir throw UnknownPropertyException(); 1413*cdf0e10cSrcweir Any aRet; 1414*cdf0e10cSrcweir if( pEntry->nWID == WID_STYLE_FAMILY ) 1415*cdf0e10cSrcweir { 1416*cdf0e10cSrcweir aRet <<= GetFamilyString(nFamily); 1417*cdf0e10cSrcweir } 1418*cdf0e10cSrcweir else if( pEntry->nWID == SDRATTR_TEXTDIRECTION ) 1419*cdf0e10cSrcweir { 1420*cdf0e10cSrcweir aRet <<= sal_False; 1421*cdf0e10cSrcweir } 1422*cdf0e10cSrcweir else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE ) 1423*cdf0e10cSrcweir { 1424*cdf0e10cSrcweir aRet <<= BitmapMode_REPEAT; 1425*cdf0e10cSrcweir } 1426*cdf0e10cSrcweir else 1427*cdf0e10cSrcweir { 1428*cdf0e10cSrcweir SfxItemPool& rMyPool = GetPool().GetPool(); 1429*cdf0e10cSrcweir SfxItemSet aSet( rMyPool, pEntry->nWID, pEntry->nWID); 1430*cdf0e10cSrcweir aSet.Put( rMyPool.GetDefaultItem( pEntry->nWID ) ); 1431*cdf0e10cSrcweir aRet = SvxItemPropertySet_getPropertyValue( GetStylePropertySet(), pEntry, aSet ); 1432*cdf0e10cSrcweir } 1433*cdf0e10cSrcweir return aRet; 1434*cdf0e10cSrcweir } 1435*cdf0e10cSrcweir 1436*cdf0e10cSrcweir // -------------------------------------------------------------------- 1437*cdf0e10cSrcweir 1438*cdf0e10cSrcweir /** this is used because our property map is not sorted yet */ 1439*cdf0e10cSrcweir const SfxItemPropertySimpleEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName ) const throw() 1440*cdf0e10cSrcweir { 1441*cdf0e10cSrcweir return GetStylePropertySet().getPropertyMapEntry(rPropertyName); 1442*cdf0e10cSrcweir } 1443*cdf0e10cSrcweir 1444