fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / core / stlsheet.cxx
blobfcb7896f7368cc697491eb5b59edcec038c6e5d5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <com/sun/star/beans/PropertyAttribute.hpp>
22 #include <com/sun/star/lang/DisposedException.hpp>
23 #include <com/sun/star/style/XStyle.hpp>
25 #include <osl/mutex.hxx>
26 #include <vcl/svapp.hxx>
27 #include <comphelper/serviceinfohelper.hxx>
28 #include <boost/bind.hpp>
30 #include <editeng/outliner.hxx>
31 #include <editeng/eeitem.hxx>
32 #include <editeng/fhgtitem.hxx>
33 #include <svx/svdoattr.hxx>
34 #include <editeng/ulspitem.hxx>
35 #include <svl/smplhint.hxx>
36 #include <svl/itemset.hxx>
38 #include <svx/sdr/properties/attributeproperties.hxx>
39 #include <svx/xflbmtit.hxx>
40 #include <svx/xflbstit.hxx>
41 #include <editeng/bulletitem.hxx>
42 #include <editeng/lrspitem.hxx>
43 #include <svx/unoshprp.hxx>
44 #include <svx/unoshape.hxx>
45 #include <svx/svdpool.hxx>
46 #include "stlsheet.hxx"
47 #include "sdresid.hxx"
48 #include "sdpage.hxx"
49 #include "drawdoc.hxx"
50 #include "stlpool.hxx"
51 #include "glob.hrc"
52 #include "app.hrc"
53 #include "glob.hxx"
54 #include "helpids.h"
55 #include "../ui/inc/DrawViewShell.hxx"
56 #include "../ui/inc/ViewShellBase.hxx"
59 using ::osl::MutexGuard;
60 using ::osl::ClearableMutexGuard;
61 using ::cppu::OInterfaceContainerHelper;
62 using namespace ::com::sun::star::uno;
63 using namespace ::com::sun::star::util;
64 using namespace ::com::sun::star::lang;
65 using namespace ::com::sun::star::style;
66 using namespace ::com::sun::star::beans;
67 using namespace ::com::sun::star::container;
68 using namespace ::com::sun::star::drawing;
70 #define WID_STYLE_HIDDEN 7997
71 #define WID_STYLE_DISPNAME 7998
72 #define WID_STYLE_FAMILY 7999
74 static SvxItemPropertySet& GetStylePropertySet()
76 static const SfxItemPropertyMapEntry aFullPropertyMap_Impl[] =
78 { RTL_CONSTASCII_STRINGPARAM("Family"), WID_STYLE_FAMILY, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
79 { RTL_CONSTASCII_STRINGPARAM("UserDefinedAttributes"), SDRATTR_XMLATTRIBUTES, &XNameContainer::static_type(), 0, 0},
80 { RTL_CONSTASCII_STRINGPARAM("DisplayName"), WID_STYLE_DISPNAME, &::getCppuType((const OUString*)0), PropertyAttribute::READONLY, 0},
81 { RTL_CONSTASCII_STRINGPARAM("Hidden"), WID_STYLE_HIDDEN, &::getCppuType((bool*)0), 0, 0},
83 SVX_UNOEDIT_NUMBERING_PROPERTIE,
84 SHADOW_PROPERTIES
85 LINE_PROPERTIES
86 LINE_PROPERTIES_START_END
87 FILL_PROPERTIES
88 EDGERADIUS_PROPERTIES
89 TEXT_PROPERTIES_DEFAULTS
90 CONNECTOR_PROPERTIES
91 SPECIAL_DIMENSIONING_PROPERTIES_DEFAULTS
92 {0,0,0,0,0,0}
95 static SvxItemPropertySet aPropSet( aFullPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
96 return aPropSet;
99 class ModifyListenerForewarder : public SfxListener
101 public:
102 ModifyListenerForewarder( SdStyleSheet* pStyleSheet );
104 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
106 private:
107 SdStyleSheet* mpStyleSheet;
110 ModifyListenerForewarder::ModifyListenerForewarder( SdStyleSheet* pStyleSheet )
111 : mpStyleSheet( pStyleSheet )
113 if( pStyleSheet )
115 SfxBroadcaster& rBC = static_cast< SfxBroadcaster& >( *pStyleSheet );
116 StartListening( rBC );
120 void ModifyListenerForewarder::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
122 if( mpStyleSheet )
123 mpStyleSheet->notifyModifyListener();
126 SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, sal_uInt16 _nMask)
127 : SdStyleSheetBase( OUString( rDisplayName ), _rPool, eFamily, _nMask)
128 , ::cppu::BaseMutex()
129 , msApiName( rDisplayName )
130 , mxPool( const_cast< SfxStyleSheetBasePool* >(&_rPool) )
131 , mrBHelper( m_aMutex )
135 SdStyleSheet::SdStyleSheet( const SdStyleSheet & r )
136 : SdStyleSheetBase( r )
137 , ::cppu::BaseMutex()
138 , msApiName( r.msApiName )
139 , mxPool( r.mxPool )
140 , mrBHelper( m_aMutex )
144 SdStyleSheet::~SdStyleSheet()
146 delete pSet;
147 pSet = NULL; // that following destructors also get a change
150 void SdStyleSheet::SetApiName( const OUString& rApiName )
152 msApiName = rApiName;
155 OUString SdStyleSheet::GetApiName() const
157 if( !msApiName.isEmpty() )
158 return msApiName;
159 else
160 return GetName();
164 void SdStyleSheet::Load (SvStream& rIn, sal_uInt16 nVersion)
166 SfxStyleSheetBase::Load(rIn, nVersion);
168 /* previously, the default mask was 0xAFFE. The needed flags were masked
169 from this mask. Now the flag SFXSTYLEBIT_READONLY was introduced and with
170 this, all style sheets are read only. Since no style sheet should be read
171 only in Draw, we reset the flag here. */
172 nMask &= ~SFXSTYLEBIT_READONLY;
176 void SdStyleSheet::Store(SvStream& rOut)
178 SfxStyleSheetBase::Store(rOut);
182 bool SdStyleSheet::SetParent(const String& rParentName)
184 bool bResult = sal_False;
186 if (SfxStyleSheet::SetParent(rParentName))
188 // PseudoStyleSheets do not have their own ItemSets
189 if (nFamily != SD_STYLE_FAMILY_PSEUDO)
191 if( rParentName.Len() )
193 SfxStyleSheetBase* pStyle = pPool->Find(rParentName, nFamily);
194 if (pStyle)
196 bResult = true;
197 SfxItemSet& rParentSet = pStyle->GetItemSet();
198 GetItemSet().SetParent(&rParentSet);
199 Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
202 else
204 bResult = true;
205 GetItemSet().SetParent(NULL);
206 Broadcast( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
209 else
211 bResult = true;
214 return bResult;
218 * create if necessary and return ItemSets
220 SfxItemSet& SdStyleSheet::GetItemSet()
222 if (nFamily == SD_STYLE_FAMILY_GRAPHICS || nFamily == SD_STYLE_FAMILY_MASTERPAGE)
224 // we create the ItemSet 'on demand' if necessary
225 if (!pSet)
227 sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST,
228 XATTR_FILL_FIRST, XATTR_FILL_LAST,
230 SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
231 SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME,
233 SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE,
235 SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST,
236 SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
238 EE_PARA_START, EE_CHAR_END,
240 SDRATTR_XMLATTRIBUTES, SDRATTR_TEXT_USEFIXEDCELLHEIGHT,
242 SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
243 0, 0 };
245 pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
248 return *pSet;
251 else if( nFamily == SD_STYLE_FAMILY_CELL )
253 if (!pSet)
255 sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST,
256 XATTR_FILL_FIRST, XATTR_FILL_LAST,
258 SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
259 SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME,
261 SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE,
263 EE_PARA_START, EE_CHAR_END,
265 SDRATTR_TABLE_FIRST, SDRATTR_TABLE_LAST,
266 SDRATTR_XMLATTRIBUTES, SDRATTR_XMLATTRIBUTES,
268 0, 0 };
270 pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
273 return *pSet;
276 // this is a dummy template for the internal template of the
277 // current presentation layout; return the ItemSet of that template
278 else
281 SdStyleSheet* pSdSheet = GetRealStyleSheet();
283 if (pSdSheet)
285 return(pSdSheet->GetItemSet());
287 else
289 if (!pSet)
291 sal_uInt16 nWhichPairTable[] = { XATTR_LINE_FIRST, XATTR_LINE_LAST,
292 XATTR_FILL_FIRST, XATTR_FILL_LAST,
294 SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST,
295 SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_CONTOURFRAME,
297 SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE,
299 SDRATTR_EDGE_FIRST, SDRATTR_EDGE_LAST,
300 SDRATTR_MEASURE_FIRST, SDRATTR_MEASURE_LAST,
302 EE_PARA_START, EE_CHAR_END,
304 SDRATTR_XMLATTRIBUTES, SDRATTR_TEXT_USEFIXEDCELLHEIGHT,
306 SDRATTR_3D_FIRST, SDRATTR_3D_LAST,
307 0, 0 };
309 pSet = new SfxItemSet(GetPool().GetPool(), nWhichPairTable);
312 return(*pSet);
318 * A template is used when it is referenced by inserted object or by a used
319 * template.
321 bool SdStyleSheet::IsUsed() const
323 bool bResult = false;
325 sal_uInt16 nListenerCount = GetListenerCount();
326 if (nListenerCount > 0)
328 for (sal_uInt16 n = 0; n < nListenerCount; n++)
330 SfxListener* pListener = GetListener(n);
331 if( pListener == this )
332 continue;
334 const svl::StyleSheetUser* const pUser(dynamic_cast<svl::StyleSheetUser*>(pListener));
335 if (pUser)
336 bResult = pUser->isUsedByModel();
337 if (bResult)
338 break;
342 if( !bResult )
344 MutexGuard aGuard( mrBHelper.rMutex );
346 OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( XModifyListener::static_type() );
347 if( pContainer )
349 Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() );
350 Reference< XInterface > *p = aModifyListeners.getArray();
351 sal_Int32 nCount = aModifyListeners.getLength();
352 while( nCount-- && !bResult )
354 Reference< XStyle > xStyle( *p++, UNO_QUERY );
355 if( xStyle.is() )
356 bResult = xStyle->isInUse();
360 return bResult;
364 * Determine the style sheet for which this dummy is for.
366 SdStyleSheet* SdStyleSheet::GetRealStyleSheet() const
368 OUString aRealStyle;
369 OUString aSep( SD_LT_SEPARATOR );
370 SdStyleSheet* pRealStyle = NULL;
371 SdDrawDocument* pDoc = ((SdStyleSheetPool*)pPool)->GetDoc();
373 ::sd::DrawViewShell* pDrawViewShell = 0;
375 ::sd::ViewShellBase* pBase = dynamic_cast< ::sd::ViewShellBase* >( SfxViewShell::Current() );
376 if( pBase )
377 pDrawViewShell = dynamic_cast< ::sd::DrawViewShell* >( pBase->GetMainViewShell().get() );
379 if (pDrawViewShell && pDrawViewShell->GetDoc() == pDoc)
381 SdPage* pPage = pDrawViewShell->getCurrentPage();
382 if( pPage )
384 aRealStyle = pPage->GetLayoutName();
385 // cut after separator string
387 if( aRealStyle.indexOf(aSep) >= 0)
389 aRealStyle = aRealStyle.copy(0,(aRealStyle.indexOf(aSep) + aSep.getLength()));
393 if (aRealStyle.isEmpty())
395 SdPage* pPage = pDoc->GetSdPage(0, PK_STANDARD);
397 if (pPage)
399 aRealStyle = pDoc->GetSdPage(0, PK_STANDARD)->GetLayoutName();
401 else
403 /* no page available yet. This can happen when actualising the
404 document templates. */
405 SfxStyleSheetIterator aIter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
406 SfxStyleSheetBase* pSheet = aIter.First();
407 if( pSheet )
408 aRealStyle = pSheet->GetName();
411 if( aRealStyle.indexOf(aSep) >= 0)
413 aRealStyle = aRealStyle.copy(0,(aRealStyle.indexOf(aSep) + aSep.getLength()));
417 /* now map from the name (specified for country language) to the internal
418 name (independent of the country language) */
419 String aInternalName;
421 if (aName == String(SdResId(STR_PSEUDOSHEET_TITLE)))
423 aInternalName = String(SdResId(STR_LAYOUT_TITLE));
425 else if (aName == String(SdResId(STR_PSEUDOSHEET_SUBTITLE)))
427 aInternalName = String(SdResId(STR_LAYOUT_SUBTITLE));
429 else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUND)))
431 aInternalName = String(SdResId(STR_LAYOUT_BACKGROUND));
433 else if (aName == String(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS)))
435 aInternalName = String(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS));
437 else if (aName == String(SdResId(STR_PSEUDOSHEET_NOTES)))
439 aInternalName = String(SdResId(STR_LAYOUT_NOTES));
441 else
443 String aOutlineStr(SdResId(STR_PSEUDOSHEET_OUTLINE));
444 sal_uInt16 nPos = aName.Search(aOutlineStr);
445 if (nPos != STRING_NOTFOUND)
447 String aNumStr(aName.Copy(aOutlineStr.Len()));
448 aInternalName = String(SdResId(STR_LAYOUT_OUTLINE));
449 aInternalName += aNumStr;
453 aRealStyle += aInternalName;
454 pRealStyle = static_cast< SdStyleSheet* >( pPool->Find(aRealStyle, SD_STYLE_FAMILY_MASTERPAGE) );
456 #ifdef DBG_UTIL
457 if( !pRealStyle )
459 SfxStyleSheetIterator aIter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
460 if( aIter.Count() > 0 )
461 // StyleSheet not found, but pool already loaded
462 DBG_ASSERT(pRealStyle, "Internal StyleSheet not found");
464 #endif
466 return pRealStyle;
470 * Determine pseudo style sheet which stands for this style sheet.
472 SdStyleSheet* SdStyleSheet::GetPseudoStyleSheet() const
474 SdStyleSheet* pPseudoStyle = NULL;
475 OUString aSep( SD_LT_SEPARATOR );
476 OUString aStyleName(aName);
477 // without layout name and separator
479 if( aStyleName.indexOf(aSep) >=0 )
481 aStyleName = aStyleName.copy (aStyleName.indexOf(aSep) + aSep.getLength());
484 if (aStyleName == OUString(SdResId(STR_LAYOUT_TITLE)))
486 aStyleName = OUString(SdResId(STR_PSEUDOSHEET_TITLE));
488 else if (aStyleName == OUString(SdResId(STR_LAYOUT_SUBTITLE)))
490 aStyleName = OUString(SdResId(STR_PSEUDOSHEET_SUBTITLE));
492 else if (aStyleName == OUString(SdResId(STR_LAYOUT_BACKGROUND)))
494 aStyleName = OUString(SdResId(STR_PSEUDOSHEET_BACKGROUND));
496 else if (aStyleName == OUString(SdResId(STR_LAYOUT_BACKGROUNDOBJECTS)))
498 aStyleName = OUString(SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS));
500 else if (aStyleName == OUString(SdResId(STR_LAYOUT_NOTES)))
502 aStyleName = OUString(SdResId(STR_PSEUDOSHEET_NOTES));
504 else
506 OUString aOutlineStr((SdResId(STR_LAYOUT_OUTLINE)));
507 sal_Int32 nPos = aStyleName.indexOf(aOutlineStr);
508 if (nPos != -1)
510 OUString aNumStr(aStyleName.copy(aOutlineStr.getLength()));
511 aStyleName = OUString(SdResId(STR_PSEUDOSHEET_OUTLINE));
512 aStyleName += aNumStr;
516 pPseudoStyle = static_cast<SdStyleSheet*>(pPool->Find(aStyleName, SD_STYLE_FAMILY_PSEUDO));
517 DBG_ASSERT(pPseudoStyle, "PseudoStyleSheet missing");
519 return pPseudoStyle;
523 void SdStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
525 // first, base class functionality
526 SfxStyleSheet::Notify(rBC, rHint);
528 /* if the dummy gets a notify about a changed attribute, he takes care that
529 the actual ment style sheet sends broadcasts. */
530 SfxSimpleHint* pSimple = PTR_CAST(SfxSimpleHint, &rHint);
531 sal_uLong nId = pSimple == NULL ? 0 : pSimple->GetId();
532 if (nId == SFX_HINT_DATACHANGED && nFamily == SD_STYLE_FAMILY_PSEUDO)
534 SdStyleSheet* pRealStyle = GetRealStyleSheet();
535 if (pRealStyle)
536 pRealStyle->Broadcast(rHint);
541 * Adjust the bullet width and the left text indent of the provided ItemSets to
542 * their font height. The new values are calculated that the ratio to the font
543 * height is as in the style sheet.
545 * @param bOnlyMissingItems If sal_True, only not set items are completed. With
546 * sal_False, are items are overwritten.
548 void SdStyleSheet::AdjustToFontHeight(SfxItemSet& rSet, sal_Bool bOnlyMissingItems)
550 /* If not explicit set, ddjust bullet width and text indent to new font
551 height. */
552 SfxStyleFamily eFamily = nFamily;
553 OUString aStyleName(aName);
554 if (eFamily == SD_STYLE_FAMILY_PSEUDO)
556 SfxStyleSheet* pRealStyle = GetRealStyleSheet();
557 eFamily = pRealStyle->GetFamily();
558 aStyleName = pRealStyle->GetName();
561 if (eFamily == SD_STYLE_FAMILY_MASTERPAGE &&
562 aStyleName.indexOf(OUString(SdResId(STR_LAYOUT_OUTLINE))) != -1 &&
563 rSet.GetItemState(EE_CHAR_FONTHEIGHT) == SFX_ITEM_SET)
565 const SfxItemSet* pCurSet = &GetItemSet();
566 sal_uInt32 nNewHeight = ((SvxFontHeightItem&)rSet.Get(EE_CHAR_FONTHEIGHT)).GetHeight();
567 sal_uInt32 nOldHeight = ((SvxFontHeightItem&)pCurSet->Get(EE_CHAR_FONTHEIGHT)).GetHeight();
569 if (rSet.GetItemState(EE_PARA_BULLET) != SFX_ITEM_SET || !bOnlyMissingItems)
571 const SvxBulletItem& rBItem = (const SvxBulletItem&)pCurSet->Get(EE_PARA_BULLET);
572 double fBulletFraction = double(rBItem.GetWidth()) / nOldHeight;
573 SvxBulletItem aNewBItem(rBItem);
574 aNewBItem.SetWidth((sal_uInt32)(fBulletFraction * nNewHeight));
575 rSet.Put(aNewBItem);
578 if (rSet.GetItemState(EE_PARA_LRSPACE) != SFX_ITEM_SET || !bOnlyMissingItems)
580 const SvxLRSpaceItem& rLRItem = (const SvxLRSpaceItem&)pCurSet->Get(EE_PARA_LRSPACE);
581 double fIndentFraction = double(rLRItem.GetTxtLeft()) / nOldHeight;
582 SvxLRSpaceItem aNewLRItem(rLRItem);
583 aNewLRItem.SetTxtLeft(fIndentFraction * nNewHeight);
584 double fFirstIndentFraction = double(rLRItem.GetTxtFirstLineOfst()) / nOldHeight;
585 aNewLRItem.SetTxtFirstLineOfst((short)(fFirstIndentFraction * nNewHeight));
586 rSet.Put(aNewLRItem);
589 if (rSet.GetItemState(EE_PARA_ULSPACE) != SFX_ITEM_SET || !bOnlyMissingItems)
591 const SvxULSpaceItem& rULItem = (const SvxULSpaceItem&)pCurSet->Get(EE_PARA_ULSPACE);
592 SvxULSpaceItem aNewULItem(rULItem);
593 double fLowerFraction = double(rULItem.GetLower()) / nOldHeight;
594 aNewULItem.SetLower((sal_uInt16)(fLowerFraction * nNewHeight));
595 double fUpperFraction = double(rULItem.GetUpper()) / nOldHeight;
596 aNewULItem.SetUpper((sal_uInt16)(fUpperFraction * nNewHeight));
597 rSet.Put(aNewULItem);
602 // --------------------------------------------------------------------
604 bool SdStyleSheet::HasFollowSupport() const
606 return false;
609 // --------------------------------------------------------------------
611 bool SdStyleSheet::HasParentSupport() const
613 return true;
616 // --------------------------------------------------------------------
618 bool SdStyleSheet::HasClearParentSupport() const
620 return true;
623 // --------------------------------------------------------------------
625 bool SdStyleSheet::SetName( const UniString& rName )
627 return SfxStyleSheet::SetName( rName );
630 // --------------------------------------------------------------------
632 void SdStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
634 SfxStyleSheet::SetHelpId( r, nId );
636 if( (nId >= HID_PSEUDOSHEET_OUTLINE1) && ( nId <= HID_PSEUDOSHEET_OUTLINE9 ) )
638 msApiName = "outline";
639 msApiName += OUString( (sal_Unicode)( '1' + (nId - HID_PSEUDOSHEET_OUTLINE1) ) );
641 else
643 static struct ApiNameMap
645 const sal_Char* mpApiName;
646 sal_uInt32 mnApiNameLength;
647 sal_uInt32 mnHelpId;
649 pApiNameMap[] =
651 { RTL_CONSTASCII_STRINGPARAM( "title" ), HID_PSEUDOSHEET_TITLE },
652 { RTL_CONSTASCII_STRINGPARAM( "subtitle" ), HID_PSEUDOSHEET_SUBTITLE },
653 { RTL_CONSTASCII_STRINGPARAM( "background" ), HID_PSEUDOSHEET_BACKGROUND },
654 { RTL_CONSTASCII_STRINGPARAM( "backgroundobjects" ),HID_PSEUDOSHEET_BACKGROUNDOBJECTS },
655 { RTL_CONSTASCII_STRINGPARAM( "notes" ), HID_PSEUDOSHEET_NOTES },
656 { RTL_CONSTASCII_STRINGPARAM( "standard" ), HID_STANDARD_STYLESHEET_NAME },
657 { RTL_CONSTASCII_STRINGPARAM( "objectwitharrow" ), HID_POOLSHEET_OBJWITHARROW },
658 { RTL_CONSTASCII_STRINGPARAM( "objectwithshadow" ), HID_POOLSHEET_OBJWITHSHADOW },
659 { RTL_CONSTASCII_STRINGPARAM( "objectwithoutfill" ),HID_POOLSHEET_OBJWITHOUTFILL },
660 { RTL_CONSTASCII_STRINGPARAM( "text" ), HID_POOLSHEET_TEXT },
661 { RTL_CONSTASCII_STRINGPARAM( "textbody" ), HID_POOLSHEET_TEXTBODY },
662 { RTL_CONSTASCII_STRINGPARAM( "textbodyjustfied" ), HID_POOLSHEET_TEXTBODY_JUSTIFY },
663 { RTL_CONSTASCII_STRINGPARAM( "textbodyindent" ), HID_POOLSHEET_TEXTBODY_INDENT },
664 { RTL_CONSTASCII_STRINGPARAM( "title" ), HID_POOLSHEET_TITLE },
665 { RTL_CONSTASCII_STRINGPARAM( "title1" ), HID_POOLSHEET_TITLE1 },
666 { RTL_CONSTASCII_STRINGPARAM( "title2" ), HID_POOLSHEET_TITLE2 },
667 { RTL_CONSTASCII_STRINGPARAM( "headline" ), HID_POOLSHEET_HEADLINE },
668 { RTL_CONSTASCII_STRINGPARAM( "headline1" ), HID_POOLSHEET_HEADLINE1 },
669 { RTL_CONSTASCII_STRINGPARAM( "headline2" ), HID_POOLSHEET_HEADLINE2 },
670 { RTL_CONSTASCII_STRINGPARAM( "measure" ), HID_POOLSHEET_MEASURE },
671 { 0, 0, 0 }
674 ApiNameMap* p = pApiNameMap;
675 while( p->mpApiName )
677 if( nId == p->mnHelpId )
679 msApiName = OUString( p->mpApiName, p->mnApiNameLength, RTL_TEXTENCODING_ASCII_US );
680 break;
682 p++;
687 // --------------------------------------------------------------------
689 OUString SdStyleSheet::GetFamilyString( SfxStyleFamily eFamily )
691 switch( eFamily )
693 case SD_STYLE_FAMILY_CELL:
694 return OUString( "cell" );
695 default:
696 OSL_FAIL( "SdStyleSheet::GetFamilyString(), illegal family!" );
697 case SD_STYLE_FAMILY_GRAPHICS:
698 return OUString( "graphics" );
702 // --------------------------------------------------------------------
704 void SdStyleSheet::throwIfDisposed() throw (RuntimeException)
706 if( !mxPool.is() )
707 throw DisposedException();
710 // --------------------------------------------------------------------
712 SdStyleSheet* SdStyleSheet::CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily )
714 OUString aPrefix( "user" );
715 OUString aName;
716 sal_Int32 nIndex = 1;
719 aName = aPrefix + OUString::valueOf( nIndex++ );
721 while( rPool.Find( aName, eFamily ) != 0 );
723 return new SdStyleSheet(aName, rPool, eFamily, SFXSTYLEBIT_USERDEF);
726 // --------------------------------------------------------------------
727 // XInterface
728 // --------------------------------------------------------------------
730 void SAL_CALL SdStyleSheet::release( ) throw ()
732 if (osl_atomic_decrement( &m_refCount ) == 0)
734 // restore reference count:
735 osl_atomic_increment( &m_refCount );
736 if (! mrBHelper.bDisposed) try
738 dispose();
740 catch (RuntimeException const& exc)
741 { // don't break throw ()
742 OSL_FAIL(
743 OUStringToOString(
744 exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
745 static_cast<void>(exc);
747 OSL_ASSERT( mrBHelper.bDisposed );
748 SdStyleSheetBase::release();
752 // --------------------------------------------------------------------
753 // XComponent
754 // --------------------------------------------------------------------
756 void SAL_CALL SdStyleSheet::dispose( ) throw (RuntimeException)
758 ClearableMutexGuard aGuard( mrBHelper.rMutex );
759 if (!mrBHelper.bDisposed && !mrBHelper.bInDispose)
761 mrBHelper.bInDispose = sal_True;
762 aGuard.clear();
765 // side effect: keeping a reference to this
766 EventObject aEvt( static_cast< OWeakObject * >( this ) );
769 mrBHelper.aLC.disposeAndClear( aEvt );
770 disposing();
772 catch (...)
774 MutexGuard aGuard2( mrBHelper.rMutex );
775 // bDisposed and bInDispose must be set in this order:
776 mrBHelper.bDisposed = sal_True;
777 mrBHelper.bInDispose = sal_False;
778 throw;
780 MutexGuard aGuard2( mrBHelper.rMutex );
781 // bDisposed and bInDispose must be set in this order:
782 mrBHelper.bDisposed = sal_True;
783 mrBHelper.bInDispose = sal_False;
785 catch (RuntimeException &)
787 throw;
789 catch (const Exception & exc)
791 throw RuntimeException( "unexpected UNO exception caught: " + exc.Message, Reference< XInterface >() );
796 // --------------------------------------------------------------------
798 void SdStyleSheet::disposing()
800 mxPool.clear();
803 // --------------------------------------------------------------------
805 void SAL_CALL SdStyleSheet::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
807 ClearableMutexGuard aGuard( mrBHelper.rMutex );
808 if (mrBHelper.bDisposed || mrBHelper.bInDispose)
810 aGuard.clear();
811 EventObject aEvt( static_cast< OWeakObject * >( this ) );
812 xListener->disposing( aEvt );
814 else
816 mrBHelper.addListener( ::getCppuType( &xListener ), xListener );
820 // --------------------------------------------------------------------
822 void SAL_CALL SdStyleSheet::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
824 mrBHelper.removeListener( ::getCppuType( &xListener ), xListener );
827 //------------------------------------------------------------------------
828 // XModifyBroadcaster
829 //------------------------------------------------------------------------
831 void SAL_CALL SdStyleSheet::addModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
833 ClearableMutexGuard aGuard( mrBHelper.rMutex );
834 if (mrBHelper.bDisposed || mrBHelper.bInDispose)
836 aGuard.clear();
837 EventObject aEvt( static_cast< OWeakObject * >( this ) );
838 xListener->disposing( aEvt );
840 else
842 if( !mpModifyListenerForewarder.get() )
843 mpModifyListenerForewarder.reset( new ModifyListenerForewarder( this ) );
844 mrBHelper.addListener( XModifyListener::static_type(), xListener );
848 //------------------------------------------------------------------------
850 void SAL_CALL SdStyleSheet::removeModifyListener( const Reference< XModifyListener >& xListener ) throw (RuntimeException)
852 mrBHelper.removeListener( XModifyListener::static_type(), xListener );
855 //------------------------------------------------------------------------
857 void SdStyleSheet::notifyModifyListener()
859 MutexGuard aGuard( mrBHelper.rMutex );
861 OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( XModifyListener::static_type() );
862 if( pContainer )
864 EventObject aEvt( static_cast< OWeakObject * >( this ) );
865 pContainer->forEach<XModifyListener>( boost::bind( &XModifyListener::modified, _1, boost::cref( aEvt ) ) );
870 // --------------------------------------------------------------------
871 // XServiceInfo
872 // --------------------------------------------------------------------
874 OUString SAL_CALL SdStyleSheet::getImplementationName() throw(RuntimeException)
876 return OUString( "SdStyleSheet" );
879 // --------------------------------------------------------------------
881 sal_Bool SAL_CALL SdStyleSheet::supportsService( const OUString& ServiceName ) throw(RuntimeException)
883 return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
886 // --------------------------------------------------------------------
888 Sequence< OUString > SAL_CALL SdStyleSheet::getSupportedServiceNames() throw(RuntimeException)
890 Sequence< OUString > aNameSequence( 10 );
891 OUString* pStrings = aNameSequence.getArray();
893 *pStrings++ = "com.sun.star.style.Style";
894 *pStrings++ = "com.sun.star.drawing.FillProperties";
895 *pStrings++ = "com.sun.star.drawing.LineProperties";
896 *pStrings++ = "com.sun.star.drawing.ShadowProperties";
897 *pStrings++ = "com.sun.star.drawing.ConnectorProperties";
898 *pStrings++ = "com.sun.star.drawing.MeasureProperties";
899 *pStrings++ = "com.sun.star.style.ParagraphProperties";
900 *pStrings++ = "com.sun.star.style.CharacterProperties";
901 *pStrings++ = "com.sun.star.drawing.TextProperties";
902 *pStrings++ = "com.sun.star.drawing.Text";
904 return aNameSequence;
907 // --------------------------------------------------------------------
908 // XNamed
909 // --------------------------------------------------------------------
911 OUString SAL_CALL SdStyleSheet::getName() throw(RuntimeException)
913 SolarMutexGuard aGuard;
914 throwIfDisposed();
915 return GetApiName();
918 // --------------------------------------------------------------------
920 void SAL_CALL SdStyleSheet::setName( const OUString& rName ) throw(RuntimeException)
922 SolarMutexGuard aGuard;
923 throwIfDisposed();
925 if( SetName( rName ) )
927 msApiName = rName;
928 Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
932 // --------------------------------------------------------------------
933 // XStyle
934 // --------------------------------------------------------------------
936 sal_Bool SAL_CALL SdStyleSheet::isUserDefined() throw(RuntimeException)
938 SolarMutexGuard aGuard;
939 throwIfDisposed();
940 return IsUserDefined() ? sal_True : sal_False;
943 // --------------------------------------------------------------------
945 sal_Bool SAL_CALL SdStyleSheet::isInUse() throw(RuntimeException)
947 SolarMutexGuard aGuard;
948 throwIfDisposed();
949 return IsUsed() ? sal_True : sal_False;
952 // --------------------------------------------------------------------
954 OUString SAL_CALL SdStyleSheet::getParentStyle() throw(RuntimeException)
956 SolarMutexGuard aGuard;
957 throwIfDisposed();
959 if( GetParent().Len() )
961 SdStyleSheet* pParentStyle = static_cast< SdStyleSheet* >( mxPool->Find( GetParent(), nFamily ) );
962 if( pParentStyle )
963 return pParentStyle->msApiName;
965 return OUString();
968 // --------------------------------------------------------------------
970 void SAL_CALL SdStyleSheet::setParentStyle( const OUString& rParentName ) throw(NoSuchElementException, RuntimeException)
972 SolarMutexGuard aGuard;
973 throwIfDisposed();
975 if( !rParentName.isEmpty() )
977 const SfxStyles& rStyles = mxPool->GetStyles();
979 /* Use reverse iterator to find the parents quicker - most probably its inserted recently.
980 * Also avoids/fixes the issue n#708518
981 * To fix it completely its probably wiser to compare this->GetName() and pStyle->GetName() or use complete names for styles (?)
983 for( SfxStyles::const_reverse_iterator iter( rStyles.rbegin() ); iter != rStyles.rend(); ++iter )
985 SdStyleSheet* pStyle = static_cast< SdStyleSheet* >( (*iter).get() );
986 if( pStyle && (pStyle->nFamily == nFamily) && (pStyle->msApiName == rParentName) )
988 if( pStyle != this )
989 SetParent( pStyle->GetName() );
990 return;
993 throw NoSuchElementException();
995 else
997 SetParent( rParentName );
1001 // --------------------------------------------------------------------
1002 // XPropertySet
1003 // --------------------------------------------------------------------
1005 Reference< XPropertySetInfo > SdStyleSheet::getPropertySetInfo() throw(RuntimeException)
1007 throwIfDisposed();
1008 static Reference< XPropertySetInfo > xInfo;
1009 if( !xInfo.is() )
1010 xInfo = GetStylePropertySet().getPropertySetInfo();
1011 return xInfo;
1014 // --------------------------------------------------------------------
1016 void SAL_CALL SdStyleSheet::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
1018 SolarMutexGuard aGuard;
1019 throwIfDisposed();
1021 const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
1022 if( pEntry == NULL )
1024 throw UnknownPropertyException();
1026 else
1028 if( pEntry->nWID == WID_STYLE_HIDDEN )
1030 sal_Bool bValue = sal_False;
1031 if ( aValue >>= bValue )
1032 SetHidden( bValue );
1033 return;
1035 if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
1036 return; // not yet implemented for styles
1038 if( pEntry->nWID == WID_STYLE_FAMILY )
1039 throw PropertyVetoException();
1041 if( (pEntry->nWID == EE_PARA_NUMBULLET) && (GetFamily() == SD_STYLE_FAMILY_MASTERPAGE) )
1043 OUString aStr;
1044 const sal_uInt32 nTempHelpId = GetHelpId( aStr );
1046 if( (nTempHelpId >= HID_PSEUDOSHEET_OUTLINE2) && (nTempHelpId <= HID_PSEUDOSHEET_OUTLINE9) )
1047 return;
1050 SfxItemSet &rStyleSet = GetItemSet();
1052 if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
1054 BitmapMode eMode;
1055 if( aValue >>= eMode )
1057 rStyleSet.Put( XFillBmpStretchItem( eMode == BitmapMode_STRETCH ) );
1058 rStyleSet.Put( XFillBmpTileItem( eMode == BitmapMode_REPEAT ) );
1059 return;
1061 throw IllegalArgumentException();
1064 SfxItemSet aSet( GetPool().GetPool(), pEntry->nWID, pEntry->nWID);
1065 aSet.Put( rStyleSet );
1067 if( !aSet.Count() )
1069 if( EE_PARA_NUMBULLET == pEntry->nWID )
1071 Font aBulletFont;
1072 SdStyleSheetPool::PutNumBulletItem( this, aBulletFont );
1073 aSet.Put( rStyleSet );
1075 else
1077 aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
1081 if( pEntry->nMemberId == MID_NAME &&
1082 ( pEntry->nWID == XATTR_FILLBITMAP || pEntry->nWID == XATTR_FILLGRADIENT ||
1083 pEntry->nWID == XATTR_FILLHATCH || pEntry->nWID == XATTR_FILLFLOATTRANSPARENCE ||
1084 pEntry->nWID == XATTR_LINESTART || pEntry->nWID == XATTR_LINEEND || pEntry->nWID == XATTR_LINEDASH) )
1086 OUString aTempName;
1087 if(!(aValue >>= aTempName ))
1088 throw IllegalArgumentException();
1090 SvxShape::SetFillAttribute( pEntry->nWID, aTempName, aSet );
1092 else if(!SvxUnoTextRangeBase::SetPropertyValueHelper( aSet, pEntry, aValue, aSet ))
1094 SvxItemPropertySet_setPropertyValue( GetStylePropertySet(), pEntry, aValue, aSet );
1097 rStyleSet.Put( aSet );
1098 Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
1102 // --------------------------------------------------------------------
1104 Any SAL_CALL SdStyleSheet::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1106 SolarMutexGuard aGuard;
1108 throwIfDisposed();
1110 const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
1111 if( pEntry == NULL )
1113 throw UnknownPropertyException();
1115 else
1117 Any aAny;
1119 if( pEntry->nWID == WID_STYLE_FAMILY )
1121 if( nFamily == SD_STYLE_FAMILY_MASTERPAGE )
1123 const OUString aLayoutName( GetName() );
1124 aAny <<= aLayoutName.copy( 0, aLayoutName.indexOf( SD_LT_SEPARATOR) );
1126 else
1128 aAny <<= GetFamilyString(nFamily);
1131 else if( pEntry->nWID == WID_STYLE_DISPNAME )
1133 aAny <<= maDisplayName;
1135 else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
1137 aAny <<= sal_False;
1139 else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
1141 SfxItemSet &rStyleSet = GetItemSet();
1143 XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)rStyleSet.GetItem(XATTR_FILLBMP_STRETCH);
1144 XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)rStyleSet.GetItem(XATTR_FILLBMP_TILE);
1146 if( pStretchItem && pTileItem )
1148 if( pTileItem->GetValue() )
1149 aAny <<= BitmapMode_REPEAT;
1150 else if( pStretchItem->GetValue() )
1151 aAny <<= BitmapMode_STRETCH;
1152 else
1153 aAny <<= BitmapMode_NO_REPEAT;
1156 else if( pEntry->nWID == WID_STYLE_HIDDEN )
1158 aAny <<= IsHidden( );
1160 else
1162 SfxItemSet aSet( GetPool().GetPool(), pEntry->nWID, pEntry->nWID);
1164 const SfxPoolItem* pItem;
1165 SfxItemSet& rStyleSet = GetItemSet();
1167 if( rStyleSet.GetItemState( pEntry->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
1168 aSet.Put( *pItem );
1170 if( !aSet.Count() )
1171 aSet.Put( GetPool().GetPool().GetDefaultItem( pEntry->nWID ) );
1173 if(SvxUnoTextRangeBase::GetPropertyValueHelper( aSet, pEntry, aAny ))
1174 return aAny;
1176 // Hole Wert aus ItemSet
1177 aAny = SvxItemPropertySet_getPropertyValue( GetStylePropertySet(),pEntry, aSet );
1180 if( *pEntry->pType != aAny.getValueType() )
1182 // since the sfx uint16 item now exports a sal_Int32, we may have to fix this here
1183 if( ( *pEntry->pType == ::getCppuType((const sal_Int16*)0)) && aAny.getValueType() == ::getCppuType((const sal_Int32*)0) )
1185 sal_Int32 nValue = 0;
1186 aAny >>= nValue;
1187 aAny <<= (sal_Int16)nValue;
1189 else
1191 OSL_FAIL("SvxShape::GetAnyForItem() Returnvalue has wrong Type!" );
1195 return aAny;
1199 // --------------------------------------------------------------------
1201 void SAL_CALL SdStyleSheet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
1202 void SAL_CALL SdStyleSheet::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
1203 void SAL_CALL SdStyleSheet::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
1204 void SAL_CALL SdStyleSheet::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) {}
1206 // --------------------------------------------------------------------
1207 // XPropertyState
1208 // --------------------------------------------------------------------
1210 PropertyState SAL_CALL SdStyleSheet::getPropertyState( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
1212 SolarMutexGuard aGuard;
1214 throwIfDisposed();
1216 const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
1218 if( pEntry == NULL )
1219 throw UnknownPropertyException();
1221 if( pEntry->nWID == WID_STYLE_FAMILY )
1223 return PropertyState_DIRECT_VALUE;
1225 else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
1227 return PropertyState_DEFAULT_VALUE;
1229 else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
1231 const SfxItemSet& rSet = GetItemSet();
1233 if( rSet.GetItemState( XATTR_FILLBMP_STRETCH, false ) == SFX_ITEM_SET ||
1234 rSet.GetItemState( XATTR_FILLBMP_TILE, false ) == SFX_ITEM_SET )
1236 return PropertyState_DIRECT_VALUE;
1238 else
1240 return PropertyState_AMBIGUOUS_VALUE;
1243 else
1245 SfxItemSet &rStyleSet = GetItemSet();
1247 PropertyState eState;
1249 switch( rStyleSet.GetItemState( pEntry->nWID, sal_False ) )
1251 case SFX_ITEM_READONLY:
1252 case SFX_ITEM_SET:
1253 eState = PropertyState_DIRECT_VALUE;
1254 break;
1255 case SFX_ITEM_DEFAULT:
1256 eState = PropertyState_DEFAULT_VALUE;
1257 break;
1258 default:
1259 eState = PropertyState_AMBIGUOUS_VALUE;
1260 break;
1263 // if a item is set, this doesn't mean we want it :)
1264 if( ( PropertyState_DIRECT_VALUE == eState ) )
1266 switch( pEntry->nWID )
1268 case XATTR_FILLBITMAP:
1269 case XATTR_FILLGRADIENT:
1270 case XATTR_FILLHATCH:
1271 case XATTR_FILLFLOATTRANSPARENCE:
1272 case XATTR_LINEEND:
1273 case XATTR_LINESTART:
1274 case XATTR_LINEDASH:
1276 NameOrIndex* pItem = (NameOrIndex*)rStyleSet.GetItem((sal_uInt16)pEntry->nWID);
1277 if( ( pItem == NULL ) || ( pItem->GetName().Len() == 0) )
1278 eState = PropertyState_DEFAULT_VALUE;
1283 return eState;
1287 // --------------------------------------------------------------------
1289 Sequence< PropertyState > SAL_CALL SdStyleSheet::getPropertyStates( const Sequence< OUString >& aPropertyName ) throw(UnknownPropertyException, RuntimeException)
1291 SolarMutexGuard aGuard;
1293 throwIfDisposed();
1295 sal_Int32 nCount = aPropertyName.getLength();
1296 const OUString* pNames = aPropertyName.getConstArray();
1298 Sequence< PropertyState > aPropertyStateSequence( nCount );
1299 PropertyState* pState = aPropertyStateSequence.getArray();
1301 while( nCount-- )
1302 *pState++ = getPropertyState( *pNames++ );
1304 return aPropertyStateSequence;
1307 // --------------------------------------------------------------------
1309 void SAL_CALL SdStyleSheet::setPropertyToDefault( const OUString& PropertyName ) throw(UnknownPropertyException, RuntimeException)
1311 SolarMutexGuard aGuard;
1313 throwIfDisposed();
1315 const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( PropertyName );
1316 if( pEntry == NULL )
1317 throw UnknownPropertyException();
1319 SfxItemSet &rStyleSet = GetItemSet();
1321 if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
1323 rStyleSet.ClearItem( XATTR_FILLBMP_STRETCH );
1324 rStyleSet.ClearItem( XATTR_FILLBMP_TILE );
1326 else
1328 rStyleSet.ClearItem( pEntry->nWID );
1330 Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
1333 // --------------------------------------------------------------------
1335 Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
1337 SolarMutexGuard aGuard;
1339 throwIfDisposed();
1341 const SfxItemPropertySimpleEntry* pEntry = getPropertyMapEntry( aPropertyName );
1342 if( pEntry == NULL )
1343 throw UnknownPropertyException();
1344 Any aRet;
1345 if( pEntry->nWID == WID_STYLE_FAMILY )
1347 aRet <<= GetFamilyString(nFamily);
1349 else if( pEntry->nWID == SDRATTR_TEXTDIRECTION )
1351 aRet <<= sal_False;
1353 else if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
1355 aRet <<= BitmapMode_REPEAT;
1357 else
1359 SfxItemPool& rMyPool = GetPool().GetPool();
1360 SfxItemSet aSet( rMyPool, pEntry->nWID, pEntry->nWID);
1361 aSet.Put( rMyPool.GetDefaultItem( pEntry->nWID ) );
1362 aRet = SvxItemPropertySet_getPropertyValue( GetStylePropertySet(), pEntry, aSet );
1364 return aRet;
1367 // --------------------------------------------------------------------
1369 /** this is used because our property map is not sorted yet */
1370 const SfxItemPropertySimpleEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName ) const throw()
1372 return GetStylePropertySet().getPropertyMapEntry(rPropertyName);
1375 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */