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