xref: /trunk/main/sw/source/core/attr/format.cxx (revision 28160478)
1efeef26fSAndrew Rist /**************************************************************
2efeef26fSAndrew Rist  *
3efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5efeef26fSAndrew Rist  * distributed with this work for additional information
6efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17efeef26fSAndrew Rist  * specific language governing permissions and limitations
18efeef26fSAndrew Rist  * under the License.
19efeef26fSAndrew Rist  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sw.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <hintids.hxx> 			// fuer RES_..
26cdf0e10cSrcweir #include <frame.hxx>			// fuer AttrCache
27cdf0e10cSrcweir #include <format.hxx>
28cdf0e10cSrcweir #include <hints.hxx>			// fuer SwFmtChg
29cdf0e10cSrcweir #include <doc.hxx>
30cdf0e10cSrcweir #include <paratr.hxx>			// fuer SwParaFmt - SwHyphenBug
31cdf0e10cSrcweir #include <swcache.hxx>
32cdf0e10cSrcweir #include <fmtcolfunc.hxx>
3356b35d86SArmin Le Grand 
347624f10dSArmin Le Grand //UUUU
3556b35d86SArmin Le Grand #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
3656b35d86SArmin Le Grand #include <svx/unobrushitemhelper.hxx>
373f09c2ceSJürgen Schmidt #include <svx/xdef.hxx>
38635e52b7SArmin Le Grand #include <frmatr.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir TYPEINIT1( SwFmt, SwClient );	//rtti fuer SwFmt
41cdf0e10cSrcweir 
42cdf0e10cSrcweir /*************************************************************************
43cdf0e10cSrcweir |*    SwFmt::SwFmt
44cdf0e10cSrcweir *************************************************************************/
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
SwFmt(SwAttrPool & rPool,const sal_Char * pFmtNm,const sal_uInt16 * pWhichRanges,SwFmt * pDrvdFrm,sal_uInt16 nFmtWhich)47cdf0e10cSrcweir SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
48cdf0e10cSrcweir 			const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich )
49cdf0e10cSrcweir 	: SwModify( pDrvdFrm ),
50cdf0e10cSrcweir 	aSet( rPool, pWhichRanges ),
51cdf0e10cSrcweir 	nWhichId( nFmtWhich ),
52cdf0e10cSrcweir 	nFmtId( 0 ),
53cdf0e10cSrcweir 	nPoolFmtId( USHRT_MAX ),
54cdf0e10cSrcweir 	nPoolHelpId( USHRT_MAX ),
55cdf0e10cSrcweir 	nPoolHlpFileId( UCHAR_MAX )
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	aFmtName.AssignAscii( pFmtNm );
58cdf0e10cSrcweir     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
59cdf0e10cSrcweir 	bAutoFmt = sal_True;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	if( pDrvdFrm )
62cdf0e10cSrcweir 		aSet.SetParent( &pDrvdFrm->aSet );
63cdf0e10cSrcweir }
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
SwFmt(SwAttrPool & rPool,const String & rFmtNm,const sal_uInt16 * pWhichRanges,SwFmt * pDrvdFrm,sal_uInt16 nFmtWhich)66cdf0e10cSrcweir SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm,
67cdf0e10cSrcweir 			const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich )
68cdf0e10cSrcweir 	: SwModify( pDrvdFrm ),
69cdf0e10cSrcweir 	aFmtName( rFmtNm ),
70cdf0e10cSrcweir 	aSet( rPool, pWhichRanges ),
71cdf0e10cSrcweir 	nWhichId( nFmtWhich ),
72cdf0e10cSrcweir 	nFmtId( 0 ),
73cdf0e10cSrcweir 	nPoolFmtId( USHRT_MAX ),
74cdf0e10cSrcweir 	nPoolHelpId( USHRT_MAX ),
75cdf0e10cSrcweir 	nPoolHlpFileId( UCHAR_MAX )
76cdf0e10cSrcweir {
77cdf0e10cSrcweir     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
78cdf0e10cSrcweir 	bAutoFmt = sal_True;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	if( pDrvdFrm )
81cdf0e10cSrcweir 		aSet.SetParent( &pDrvdFrm->aSet );
82cdf0e10cSrcweir }
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 
SwFmt(const SwFmt & rFmt)85cdf0e10cSrcweir SwFmt::SwFmt( const SwFmt& rFmt )
86cdf0e10cSrcweir 	: SwModify( rFmt.DerivedFrom() ),
87cdf0e10cSrcweir 	aFmtName( rFmt.aFmtName ),
88cdf0e10cSrcweir 	aSet( rFmt.aSet ),
89cdf0e10cSrcweir 	nWhichId( rFmt.nWhichId ),
90cdf0e10cSrcweir 	nFmtId( 0 ),
91cdf0e10cSrcweir 	nPoolFmtId( rFmt.GetPoolFmtId() ),
92cdf0e10cSrcweir 	nPoolHelpId( rFmt.GetPoolHelpId() ),
93cdf0e10cSrcweir 	nPoolHlpFileId( rFmt.GetPoolHlpFileId() )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     bWritten = bFmtInDTOR = sal_False; // LAYER_IMPL
96cdf0e10cSrcweir 	bAutoFmt = rFmt.bAutoFmt;
97cdf0e10cSrcweir 	bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	if( rFmt.DerivedFrom() )
100cdf0e10cSrcweir 		aSet.SetParent( &rFmt.DerivedFrom()->aSet );
101cdf0e10cSrcweir 	// einige Sonderbehandlungen fuer Attribute
102cdf0e10cSrcweir 	aSet.SetModifyAtAttr( this );
103cdf0e10cSrcweir }
104cdf0e10cSrcweir 
105cdf0e10cSrcweir /*************************************************************************
106cdf0e10cSrcweir |*    SwFmt &SwFmt::operator=(const SwFmt& aFmt)
107cdf0e10cSrcweir |*
108cdf0e10cSrcweir |*    Beschreibung		Dokument 1.14
109cdf0e10cSrcweir |*    Ersterstellung    JP 22.11.90
110cdf0e10cSrcweir |*    Letzte Aenderung  JP 05.08.94
111cdf0e10cSrcweir *************************************************************************/
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
operator =(const SwFmt & rFmt)114cdf0e10cSrcweir SwFmt &SwFmt::operator=(const SwFmt& rFmt)
115cdf0e10cSrcweir {
116cdf0e10cSrcweir 	nWhichId = rFmt.nWhichId;
117cdf0e10cSrcweir 	nPoolFmtId = rFmt.GetPoolFmtId();
118cdf0e10cSrcweir 	nPoolHelpId = rFmt.GetPoolHelpId();
119cdf0e10cSrcweir 	nPoolHlpFileId = rFmt.GetPoolHlpFileId();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 	if ( IsInCache() )
122cdf0e10cSrcweir 	{
123cdf0e10cSrcweir 		SwFrm::GetCache().Delete( this );
124cdf0e10cSrcweir 		SetInCache( sal_False );
125cdf0e10cSrcweir 	}
126cdf0e10cSrcweir 	SetInSwFntCache( sal_False );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	// kopiere nur das Attribut-Delta Array
129cdf0e10cSrcweir 	SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
130cdf0e10cSrcweir 				aNew( *aSet.GetPool(), aSet.GetRanges() );
131cdf0e10cSrcweir 	aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
132cdf0e10cSrcweir 	aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	// einige Sonderbehandlungen fuer Attribute
135cdf0e10cSrcweir 	aSet.SetModifyAtAttr( this );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	// PoolItem-Attr erzeugen fuers Modify !!!
138cdf0e10cSrcweir 	if( aOld.Count() )
139cdf0e10cSrcweir 	{
140cdf0e10cSrcweir 		SwAttrSetChg aChgOld( aSet, aOld );
141cdf0e10cSrcweir 		SwAttrSetChg aChgNew( aSet, aNew );
142cdf0e10cSrcweir 		ModifyNotification( &aChgOld, &aChgNew );        // alle veraenderten werden verschickt
143cdf0e10cSrcweir 	}
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	if( GetRegisteredIn() != rFmt.GetRegisteredIn() )
146cdf0e10cSrcweir 	{
147cdf0e10cSrcweir 		if( GetRegisteredIn() )
148cdf0e10cSrcweir 			GetRegisteredInNonConst()->Remove(this);
149cdf0e10cSrcweir 		if(rFmt.GetRegisteredIn())
150cdf0e10cSrcweir 		{
151cdf0e10cSrcweir 			const_cast<SwFmt&>(rFmt).GetRegisteredInNonConst()->Add(this);
152cdf0e10cSrcweir 			aSet.SetParent( &rFmt.aSet );
153cdf0e10cSrcweir 		}
154cdf0e10cSrcweir 		else
155cdf0e10cSrcweir 			aSet.SetParent( 0 );
156cdf0e10cSrcweir 	}
157cdf0e10cSrcweir 	bAutoFmt = rFmt.bAutoFmt;
158cdf0e10cSrcweir 	bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
159cdf0e10cSrcweir 	return *this;
160cdf0e10cSrcweir }
161cdf0e10cSrcweir 
SetName(const String & rNewName,sal_Bool bBroadcast)162cdf0e10cSrcweir void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
163cdf0e10cSrcweir {
164cdf0e10cSrcweir 	ASSERT(!IsDefault(), "SetName: Defaultformat" );
165cdf0e10cSrcweir 	if( bBroadcast )
166cdf0e10cSrcweir 	{
167cdf0e10cSrcweir 		SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
168cdf0e10cSrcweir 		SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
169cdf0e10cSrcweir 		aFmtName = rNewName;
170cdf0e10cSrcweir 		ModifyNotification( &aOld, &aNew );
171cdf0e10cSrcweir 	}
172cdf0e10cSrcweir 	else
173cdf0e10cSrcweir 	{
174cdf0e10cSrcweir 		aFmtName = rNewName;
175cdf0e10cSrcweir 	}
176cdf0e10cSrcweir }
177cdf0e10cSrcweir 
178cdf0e10cSrcweir /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
179cdf0e10cSrcweir  * diese Funktion wird in jedem Copy-Ctor gerufen, damit die
180cdf0e10cSrcweir  * Attribute kopiert werden. Diese koennen erst kopiert werden,
181cdf0e10cSrcweir  * wenn die abgeleitet Klasse existiert, denn beim Setzen der
182cdf0e10cSrcweir  * Attribute wird die Which()-Methode gerufen, die hier in der
183cdf0e10cSrcweir  * Basis-Klasse auf 0 defaultet ist.
184cdf0e10cSrcweir  *
185cdf0e10cSrcweir  * Zusatz: JP 8.4.1994
186cdf0e10cSrcweir  * 	Wird ueber Dokumentgrenzen kopiert, so muss das neue Dokument
187cdf0e10cSrcweir  *	mit angeben werden, in dem this steht. Z.Z. ist das fuers
188cdf0e10cSrcweir  *	DropCaps wichtig, dieses haelt Daten, die tief kopiert werden
189cdf0e10cSrcweir  *	muessen !!
190cdf0e10cSrcweir  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 
CopyAttrs(const SwFmt & rFmt,sal_Bool bReplace)193cdf0e10cSrcweir void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
194cdf0e10cSrcweir {
195cdf0e10cSrcweir 	// kopiere nur das Attribut-Delta Array
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	if ( IsInCache() )
198cdf0e10cSrcweir 	{
199cdf0e10cSrcweir 		SwFrm::GetCache().Delete( this );
200cdf0e10cSrcweir 		SetInCache( sal_False );
201cdf0e10cSrcweir 	}
202cdf0e10cSrcweir 	SetInSwFntCache( sal_False );
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 	// Sonderbehandlung fuer einige Attribute
205cdf0e10cSrcweir 	SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	if( !bReplace )		// nur die neu, die nicht gesetzt sind ??
208cdf0e10cSrcweir 	{
209cdf0e10cSrcweir 		if( pChgSet == (SwAttrSet*)&rFmt.aSet )		// Set hier kopieren
210cdf0e10cSrcweir 			pChgSet = new SwAttrSet( rFmt.aSet );
211cdf0e10cSrcweir 		pChgSet->Differentiate( aSet );
212cdf0e10cSrcweir 	}
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 	// kopiere nur das Attribut-Delta Array
215cdf0e10cSrcweir 	if( pChgSet->GetPool() != aSet.GetPool() )
216cdf0e10cSrcweir 		pChgSet->CopyToModify( *this );
217cdf0e10cSrcweir 	else
218cdf0e10cSrcweir 	{
219cdf0e10cSrcweir 		SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
220cdf0e10cSrcweir 				  aNew( *aSet.GetPool(), aSet.GetRanges() );
221cdf0e10cSrcweir 
222cdf0e10cSrcweir 		if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
223cdf0e10cSrcweir 		{
224cdf0e10cSrcweir 			// einige Sonderbehandlungen fuer Attribute
225cdf0e10cSrcweir 			aSet.SetModifyAtAttr( this );
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 			SwAttrSetChg aChgOld( aSet, aOld );
228cdf0e10cSrcweir 			SwAttrSetChg aChgNew( aSet, aNew );
229cdf0e10cSrcweir 			ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
230cdf0e10cSrcweir 		}
231cdf0e10cSrcweir 	}
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	if( pChgSet != (SwAttrSet*)&rFmt.aSet )		// Set hier angelegt ?
234cdf0e10cSrcweir 		delete pChgSet;
235cdf0e10cSrcweir }
236cdf0e10cSrcweir 
237cdf0e10cSrcweir /*************************************************************************
238cdf0e10cSrcweir |*    SwFmt::~SwFmt()
239cdf0e10cSrcweir |*
240cdf0e10cSrcweir |*    Beschreibung		Dokument 1.14
241cdf0e10cSrcweir |*    Ersterstellung    JP 22.11.90
242cdf0e10cSrcweir |*    Letzte Aenderung  JP 14.02.91
243cdf0e10cSrcweir *************************************************************************/
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 
~SwFmt()246cdf0e10cSrcweir SwFmt::~SwFmt()
247cdf0e10cSrcweir {
248cdf0e10cSrcweir 	/* das passiert bei der ObjectDying Message */
249cdf0e10cSrcweir 	/* alle Abhaengigen auf DerivedFrom umhaengen */
250cdf0e10cSrcweir 	if( GetDepends() )
251cdf0e10cSrcweir 	{
252cdf0e10cSrcweir 		ASSERT(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" );
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 		bFmtInDTOR = sal_True;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 		SwFmt *pParentFmt = DerivedFrom();
257cdf0e10cSrcweir 		if (!pParentFmt)		// see #112405#
258cdf0e10cSrcweir 		{
259cdf0e10cSrcweir 			DBG_ERROR( "~SwFmt: parent format missing" );
260cdf0e10cSrcweir 		}
261cdf0e10cSrcweir 		else
262cdf0e10cSrcweir 		{
263ca62e2c2SSteve Yin 			while( GetDepends() && pParentFmt)
264cdf0e10cSrcweir 			{
265cdf0e10cSrcweir 				SwFmtChg aOldFmt(this);
266cdf0e10cSrcweir 				SwFmtChg aNewFmt(pParentFmt);
267cdf0e10cSrcweir 				SwClient * pDepend = (SwClient*)GetDepends();
268cdf0e10cSrcweir 				pParentFmt->Add(pDepend);
269cdf0e10cSrcweir 				pDepend->ModifyNotification(&aOldFmt, &aNewFmt);
270cdf0e10cSrcweir 			}
271cdf0e10cSrcweir 		}
272cdf0e10cSrcweir 	}
273cdf0e10cSrcweir }
274cdf0e10cSrcweir 
275cdf0e10cSrcweir 
276cdf0e10cSrcweir /*************************************************************************
277cdf0e10cSrcweir |*    void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
278cdf0e10cSrcweir |*
279cdf0e10cSrcweir |*    Beschreibung		Dokument 1.14
280cdf0e10cSrcweir |*    Ersterstellung    JP 22.11.90
281cdf0e10cSrcweir |*    Letzte Aenderung  JP 05.08.94
282cdf0e10cSrcweir *************************************************************************/
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 
Modify(const SfxPoolItem * pOldValue,const SfxPoolItem * pNewValue)285cdf0e10cSrcweir void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir 	sal_Bool bWeiter = sal_True;	// sal_True = Propagierung an die Abhaengigen
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 	sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
290cdf0e10cSrcweir 					pNewValue ? pNewValue->Which() : 0 ;
291cdf0e10cSrcweir 	switch( nWhich )
292cdf0e10cSrcweir 	{
293cdf0e10cSrcweir 	case 0:		break;			// Which-Id von 0 ???
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 	case RES_OBJECTDYING :
296cdf0e10cSrcweir 		{
297cdf0e10cSrcweir 			// ist das sterbende Object das "Parent"-Format von diesen Format,
298cdf0e10cSrcweir 			// dann haengt sich dieses Format an den Parent vom Parent
299cdf0e10cSrcweir 			SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject;
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 			// nicht umhaengen wenn dieses das oberste Format ist !!
302cdf0e10cSrcweir 			if( GetRegisteredIn() && GetRegisteredIn() == pFmt )
303cdf0e10cSrcweir 			{
304cdf0e10cSrcweir 				if( pFmt->GetRegisteredIn() )
305cdf0e10cSrcweir 				{
306cdf0e10cSrcweir 					// wenn Parent, dann im neuen Parent wieder anmelden
307cdf0e10cSrcweir 					pFmt->DerivedFrom()->Add( this );
308cdf0e10cSrcweir 					aSet.SetParent( &DerivedFrom()->aSet );
309cdf0e10cSrcweir 				}
310cdf0e10cSrcweir 				else
311cdf0e10cSrcweir 				{
312cdf0e10cSrcweir 					// sonst auf jeden Fall beim sterbenden abmelden
313cdf0e10cSrcweir 					DerivedFrom()->Remove( this );
314cdf0e10cSrcweir 					aSet.SetParent( 0 );
315cdf0e10cSrcweir 				}
316cdf0e10cSrcweir 			}
317cdf0e10cSrcweir 		} // OBJECTDYING
318cdf0e10cSrcweir 		break;
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	case RES_ATTRSET_CHG:
321cdf0e10cSrcweir 		if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
322cdf0e10cSrcweir 		{
323cdf0e10cSrcweir 			//nur die weiter geben, die hier nicht gesetzt sind !!
324cdf0e10cSrcweir 			SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
325cdf0e10cSrcweir 			SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 			aOld.GetChgSet()->Differentiate( aSet );
328cdf0e10cSrcweir 			aNew.GetChgSet()->Differentiate( aSet );
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 			if( aNew.Count() )
331cdf0e10cSrcweir 				// keine mehr gesetzt, dann Ende !!
332cdf0e10cSrcweir             NotifyClients( &aOld, &aNew );
333cdf0e10cSrcweir 			bWeiter = sal_False;
334cdf0e10cSrcweir 		}
335cdf0e10cSrcweir 		break;
336cdf0e10cSrcweir 	case RES_FMT_CHG:
337cdf0e10cSrcweir 		// falls mein Format Parent umgesetzt wird, dann melde ich
338cdf0e10cSrcweir 		// meinen Attrset beim Neuen an.
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 		// sein eigenes Modify ueberspringen !!
341cdf0e10cSrcweir 		if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
342cdf0e10cSrcweir 			((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
343cdf0e10cSrcweir 		{
344cdf0e10cSrcweir 			// den Set an den neuen Parent haengen
345cdf0e10cSrcweir 			aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
346cdf0e10cSrcweir 		}
347cdf0e10cSrcweir 		break;
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 	case RES_RESET_FMTWRITTEN:
350cdf0e10cSrcweir 		{
351cdf0e10cSrcweir 			// IsWritten-Flag zuruecksetzen. Hint nur an abhanegige
352cdf0e10cSrcweir 			// Formate (und keine Frames) propagieren.
353cdf0e10cSrcweir             // mba: the code does the opposite from what is written in the comment!
354cdf0e10cSrcweir 			ResetWritten();
355cdf0e10cSrcweir             // mba: here we don't use the additional stuff from NotifyClients().
356cdf0e10cSrcweir             // should we?!
357cdf0e10cSrcweir             // mba: move the code that ignores this event to the clients
358cdf0e10cSrcweir             ModifyBroadcast( pOldValue, pNewValue, TYPE(SwFmt) );
359cdf0e10cSrcweir 			bWeiter = sal_False;
360cdf0e10cSrcweir 		}
361cdf0e10cSrcweir 		break;
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 	default:
364cdf0e10cSrcweir 		{
365cdf0e10cSrcweir 			// Ist das Attribut in diesem Format definiert, dann auf
366cdf0e10cSrcweir 			// NICHT weiter propagieren !!
367cdf0e10cSrcweir 			if( SFX_ITEM_SET == aSet.GetItemState( nWhich, sal_False ))
368cdf0e10cSrcweir 			{
369cdf0e10cSrcweir // wie finde ich heraus, ob nicht ich die Message versende ??
370cdf0e10cSrcweir // aber wer ruft das hier ????
371cdf0e10cSrcweir //ASSERT( sal_False, "Modify ohne Absender verschickt" );
372cdf0e10cSrcweir //JP 11.06.96: DropCaps koennen hierher kommen
373cdf0e10cSrcweir ASSERT( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" );
374cdf0e10cSrcweir 				bWeiter = sal_False;
375cdf0e10cSrcweir 			}
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 		} // default
378cdf0e10cSrcweir 	} // switch
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 	if( bWeiter )
381cdf0e10cSrcweir 	{
382cdf0e10cSrcweir 		// laufe durch alle abhaengigen Formate
383cdf0e10cSrcweir         NotifyClients( pOldValue, pNewValue );
384cdf0e10cSrcweir 	}
385cdf0e10cSrcweir 
386cdf0e10cSrcweir }
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 
SetDerivedFrom(SwFmt * pDerFrom)389cdf0e10cSrcweir sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
390cdf0e10cSrcweir {
391cdf0e10cSrcweir 	if ( pDerFrom )
392cdf0e10cSrcweir 	{
393cdf0e10cSrcweir 		// Zyklus?
394cdf0e10cSrcweir 		const SwFmt* pFmt = pDerFrom;
395cdf0e10cSrcweir 		while ( pFmt != 0 )
396cdf0e10cSrcweir 		{
397cdf0e10cSrcweir 			if ( pFmt == this )
398cdf0e10cSrcweir 				return sal_False;
399cdf0e10cSrcweir 
400cdf0e10cSrcweir 			pFmt=pFmt->DerivedFrom();
401cdf0e10cSrcweir 		}
402cdf0e10cSrcweir 	}
403cdf0e10cSrcweir 	else
404cdf0e10cSrcweir 	{
405cdf0e10cSrcweir 		// Nichts angegeben, Dflt-Format suchen
406cdf0e10cSrcweir 		pDerFrom = this;
407cdf0e10cSrcweir 		while ( pDerFrom->DerivedFrom() )
408cdf0e10cSrcweir 			pDerFrom = pDerFrom->DerivedFrom();
409cdf0e10cSrcweir 	}
410cdf0e10cSrcweir 	if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
411cdf0e10cSrcweir 		return sal_False;
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 	ASSERT( Which()==pDerFrom->Which()
414cdf0e10cSrcweir 			|| ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
415cdf0e10cSrcweir 			|| ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
416cdf0e10cSrcweir 			|| ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
417cdf0e10cSrcweir 			"SetDerivedFrom: Aepfel von Birnen ableiten?");
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 	if ( IsInCache() )
420cdf0e10cSrcweir 	{
421cdf0e10cSrcweir 		SwFrm::GetCache().Delete( this );
422cdf0e10cSrcweir 		SetInCache( sal_False );
423cdf0e10cSrcweir 	}
424cdf0e10cSrcweir 	SetInSwFntCache( sal_False );
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 	pDerFrom->Add(this);
427cdf0e10cSrcweir 	aSet.SetParent( &pDerFrom->aSet );
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 	SwFmtChg aOldFmt(this);
430cdf0e10cSrcweir 	SwFmtChg aNewFmt(this);
431cdf0e10cSrcweir 	ModifyNotification( &aOldFmt, &aNewFmt );
432cdf0e10cSrcweir 
433cdf0e10cSrcweir 	return sal_True;
434cdf0e10cSrcweir }
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 
GetFmtAttr(sal_uInt16 nWhich,sal_Bool bInParents) const4377624f10dSArmin Le Grand const SfxPoolItem& SwFmt::GetFmtAttr( sal_uInt16 nWhich, sal_Bool bInParents ) const
4387624f10dSArmin Le Grand {
439*28160478SArmin Le Grand     if(RES_BACKGROUND == nWhich && supportsFullDrawingLayerFillAttributeSet())
4407624f10dSArmin Le Grand     {
4417624f10dSArmin Le Grand         //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
4427624f10dSArmin Le Grand         OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
4437624f10dSArmin Le Grand         static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
4447624f10dSArmin Le Grand 
4457624f10dSArmin Le Grand         // fill the local static SvxBrushItem from the current ItemSet so that
4467624f10dSArmin Le Grand         // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
4477624f10dSArmin Le Grand         // as good as possible to create a fallback representation and return that
44856b35d86SArmin Le Grand         aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInParents);
4497624f10dSArmin Le Grand 
4507624f10dSArmin Le Grand         return aSvxBrushItem;
4517624f10dSArmin Le Grand     }
4527624f10dSArmin Le Grand 
4537624f10dSArmin Le Grand     return aSet.Get( nWhich, bInParents );
4547624f10dSArmin Le Grand }
4557624f10dSArmin Le Grand 
4567624f10dSArmin Le Grand 
GetItemState(sal_uInt16 nWhich,sal_Bool bSrchInParent,const SfxPoolItem ** ppItem) const4577624f10dSArmin Le Grand SfxItemState SwFmt::GetItemState( sal_uInt16 nWhich, sal_Bool bSrchInParent, const SfxPoolItem **ppItem ) const
4587624f10dSArmin Le Grand {
459*28160478SArmin Le Grand     if(RES_BACKGROUND == nWhich && supportsFullDrawingLayerFillAttributeSet())
4607624f10dSArmin Le Grand     {
4617624f10dSArmin Le Grand         //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
4627624f10dSArmin Le Grand         OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
46356b35d86SArmin Le Grand         const drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFill = getSdrAllFillAttributesHelper();
4647624f10dSArmin Le Grand 
4657624f10dSArmin Le Grand         // check if the new fill attributes are used
4667624f10dSArmin Le Grand         if(aFill.get() && aFill->isUsed())
4677624f10dSArmin Le Grand         {
4687624f10dSArmin Le Grand             // if yes, fill the local SvxBrushItem using the new fill attributes
4697624f10dSArmin Le Grand             // as good as possible to have an instance for the pointer to point
4707624f10dSArmin Le Grand             // to and return as state that it is set
4717624f10dSArmin Le Grand             static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
4727624f10dSArmin Le Grand 
47356b35d86SArmin Le Grand             aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bSrchInParent);
474c5e17f44SHerbert Dürr             if( ppItem )
475c5e17f44SHerbert Dürr                 *ppItem = &aSvxBrushItem;
4767624f10dSArmin Le Grand 
4777624f10dSArmin Le Grand             return SFX_ITEM_SET;
4787624f10dSArmin Le Grand         }
4797624f10dSArmin Le Grand 
4807624f10dSArmin Le Grand         // if not, reset pointer and return SFX_ITEM_DEFAULT to signal that
4817624f10dSArmin Le Grand         // the item is not set
482c5e17f44SHerbert Dürr         if( ppItem )
483c5e17f44SHerbert Dürr             *ppItem = NULL;
4847624f10dSArmin Le Grand 
4857624f10dSArmin Le Grand         return SFX_ITEM_DEFAULT;
4867624f10dSArmin Le Grand     }
4877624f10dSArmin Le Grand 
4887624f10dSArmin Le Grand     return aSet.GetItemState( nWhich, bSrchInParent, ppItem );
4897624f10dSArmin Le Grand }
4907624f10dSArmin Le Grand 
4917624f10dSArmin Le Grand 
SetFmtAttr(const SfxPoolItem & rAttr)492cdf0e10cSrcweir sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
493cdf0e10cSrcweir {
494cdf0e10cSrcweir 	if ( IsInCache() || IsInSwFntCache() )
495cdf0e10cSrcweir 	{
496cdf0e10cSrcweir 		const sal_uInt16 nWhich = rAttr.Which();
497cdf0e10cSrcweir 		CheckCaching( nWhich );
498cdf0e10cSrcweir 	}
499cdf0e10cSrcweir 
5007624f10dSArmin Le Grand 	sal_Bool bRet = sal_False;
5017624f10dSArmin Le Grand 
5027624f10dSArmin Le Grand     //UUUU
503*28160478SArmin Le Grand     if(RES_BACKGROUND == rAttr.Which() && supportsFullDrawingLayerFillAttributeSet())
5047624f10dSArmin Le Grand     {
5057624f10dSArmin Le Grand         //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
5067624f10dSArmin Le Grand         OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
5077624f10dSArmin Le Grand         SfxItemSet aTempSet(*aSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0, 0);
5087624f10dSArmin Le Grand         const SvxBrushItem& rSource = static_cast< const SvxBrushItem& >(rAttr);
5097624f10dSArmin Le Grand 
5107624f10dSArmin Le Grand         // fill a local ItemSet with the attributes corresponding as good as possible
5117624f10dSArmin Le Grand         // to the new fill properties [XATTR_FILL_FIRST .. XATTR_FILL_LAST] and set these
5127624f10dSArmin Le Grand         // as ItemSet
5137624f10dSArmin Le Grand         setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
5147624f10dSArmin Le Grand 
5157624f10dSArmin Le Grand         if(IsModifyLocked())
5167624f10dSArmin Le Grand         {
5177624f10dSArmin Le Grand             if( 0 != ( bRet = (0 != aSet.Put( aTempSet ))) )
5187624f10dSArmin Le Grand             {
5197624f10dSArmin Le Grand                 aSet.SetModifyAtAttr( this );
5207624f10dSArmin Le Grand             }
5217624f10dSArmin Le Grand         }
5227624f10dSArmin Le Grand         else
5237624f10dSArmin Le Grand         {
5247624f10dSArmin Le Grand             SwAttrSet aOld(*aSet.GetPool(), aSet.GetRanges()), aNew(*aSet.GetPool(), aSet.GetRanges());
5257624f10dSArmin Le Grand 
5267624f10dSArmin Le Grand             bRet = 0 != aSet.Put_BC(aTempSet, &aOld, &aNew);
5277624f10dSArmin Le Grand 
5287624f10dSArmin Le Grand             if(bRet)
5297624f10dSArmin Le Grand             {
5307624f10dSArmin Le Grand                 aSet.SetModifyAtAttr(this);
5317624f10dSArmin Le Grand 
5327624f10dSArmin Le Grand                 SwAttrSetChg aChgOld(aSet, aOld);
5337624f10dSArmin Le Grand                 SwAttrSetChg aChgNew(aSet, aNew);
5347624f10dSArmin Le Grand 
5357624f10dSArmin Le Grand                 ModifyNotification(&aChgOld, &aChgNew);
5367624f10dSArmin Le Grand             }
5377624f10dSArmin Le Grand         }
5387624f10dSArmin Le Grand 
5397624f10dSArmin Le Grand         return bRet;
5407624f10dSArmin Le Grand     }
5417624f10dSArmin Le Grand 
542cdf0e10cSrcweir 	// wenn Modify gelockt ist, werden keine Modifies verschickt;
543cdf0e10cSrcweir 	// fuer FrmFmt's immer das Modify verschicken!
544cdf0e10cSrcweir     const sal_uInt16 nFmtWhich = Which();
545cdf0e10cSrcweir 	if( IsModifyLocked() || (!GetDepends() &&
546cdf0e10cSrcweir         (RES_GRFFMTCOLL == nFmtWhich  ||
547cdf0e10cSrcweir          RES_TXTFMTCOLL == nFmtWhich ) ) )
548cdf0e10cSrcweir 	{
549cdf0e10cSrcweir 		if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) )
550cdf0e10cSrcweir 			aSet.SetModifyAtAttr( this );
551cdf0e10cSrcweir         if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
552cdf0e10cSrcweir         {
553cdf0e10cSrcweir             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
554cdf0e10cSrcweir         }
555cdf0e10cSrcweir 	}
556cdf0e10cSrcweir 	else
557cdf0e10cSrcweir 	{
558cdf0e10cSrcweir 		// kopiere nur das Attribut-Delta Array
559cdf0e10cSrcweir 		SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
560cdf0e10cSrcweir 					aNew( *aSet.GetPool(), aSet.GetRanges() );
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 		bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
563cdf0e10cSrcweir 		if( bRet )
564cdf0e10cSrcweir 		{
565cdf0e10cSrcweir 			// einige Sonderbehandlungen fuer Attribute
566cdf0e10cSrcweir 			aSet.SetModifyAtAttr( this );
567cdf0e10cSrcweir 
568cdf0e10cSrcweir 			SwAttrSetChg aChgOld( aSet, aOld );
569cdf0e10cSrcweir 			SwAttrSetChg aChgNew( aSet, aNew );
570cdf0e10cSrcweir 			ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
571cdf0e10cSrcweir 		}
572cdf0e10cSrcweir 	}
573cdf0e10cSrcweir 	return bRet;
574cdf0e10cSrcweir }
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 
SetFmtAttr(const SfxItemSet & rSet)577cdf0e10cSrcweir sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
578cdf0e10cSrcweir {
579cdf0e10cSrcweir 	if( !rSet.Count() )
580cdf0e10cSrcweir 		return sal_False;
581cdf0e10cSrcweir 
582cdf0e10cSrcweir 	if ( IsInCache() )
583cdf0e10cSrcweir 	{
584cdf0e10cSrcweir 		SwFrm::GetCache().Delete( this );
585cdf0e10cSrcweir 		SetInCache( sal_False );
586cdf0e10cSrcweir 	}
587cdf0e10cSrcweir 	SetInSwFntCache( sal_False );
588cdf0e10cSrcweir 
589cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
5907624f10dSArmin Le Grand 
59156b35d86SArmin Le Grand     //UUUU Use local copy to be able to apply needed changes, e.g. call
592b740b198SArmin Le Grand     // CheckForUniqueItemForLineFillNameOrIndex which is needed for NameOrIndex stuff
593b740b198SArmin Le Grand     SfxItemSet aTempSet(rSet);
594b740b198SArmin Le Grand 
595b740b198SArmin Le Grand     //UUUU Need to check for unique item for DrawingLayer items of type NameOrIndex
596b740b198SArmin Le Grand     // and evtl. correct that item to ensure unique names for that type. This call may
597b740b198SArmin Le Grand     // modify/correct entries inside of the given SfxItemSet
598b740b198SArmin Le Grand     if(GetDoc())
599b740b198SArmin Le Grand     {
600b740b198SArmin Le Grand         GetDoc()->CheckForUniqueItemForLineFillNameOrIndex(aTempSet);
601b740b198SArmin Le Grand     }
602b740b198SArmin Le Grand 
60356b35d86SArmin Le Grand     //UUUU   FlyFrame              PageStyle
604*28160478SArmin Le Grand     if(supportsFullDrawingLayerFillAttributeSet())
6057624f10dSArmin Le Grand     {
6067624f10dSArmin Le Grand         const SfxPoolItem* pSource = 0;
6077624f10dSArmin Le Grand 
608b740b198SArmin Le Grand         if(SFX_ITEM_SET == aTempSet.GetItemState(RES_BACKGROUND, sal_False, &pSource))
6097624f10dSArmin Le Grand         {
6107624f10dSArmin Le Grand             //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
6117624f10dSArmin Le Grand             OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
6127624f10dSArmin Le Grand 
6137624f10dSArmin Le Grand             // copy all items to be set anyways to a local ItemSet with is also prepared for the new
6147624f10dSArmin Le Grand             // fill attribute ranges [XATTR_FILL_FIRST .. XATTR_FILL_LAST]. Add the attributes
6157624f10dSArmin Le Grand             // corresponding as good as possible to the new fill properties and set the whole ItemSet
6167624f10dSArmin Le Grand             const SvxBrushItem& rSource(static_cast< const SvxBrushItem& >(*pSource));
6177624f10dSArmin Le Grand             setSvxBrushItemAsFillAttributesToTargetSet(rSource, aTempSet);
6187624f10dSArmin Le Grand 
6197624f10dSArmin Le Grand             if(IsModifyLocked())
6207624f10dSArmin Le Grand             {
6217624f10dSArmin Le Grand                 if( 0 != ( bRet = (0 != aSet.Put( aTempSet ))) )
6227624f10dSArmin Le Grand                 {
6237624f10dSArmin Le Grand                     aSet.SetModifyAtAttr( this );
6247624f10dSArmin Le Grand                 }
6257624f10dSArmin Le Grand             }
6267624f10dSArmin Le Grand             else
6277624f10dSArmin Le Grand             {
6287624f10dSArmin Le Grand                 SwAttrSet aOld(*aSet.GetPool(), aSet.GetRanges()), aNew(*aSet.GetPool(), aSet.GetRanges());
6297624f10dSArmin Le Grand 
6307624f10dSArmin Le Grand                 bRet = 0 != aSet.Put_BC(aTempSet, &aOld, &aNew);
6317624f10dSArmin Le Grand 
6327624f10dSArmin Le Grand                 if(bRet)
6337624f10dSArmin Le Grand                 {
6347624f10dSArmin Le Grand                     aSet.SetModifyAtAttr(this);
6357624f10dSArmin Le Grand 
6367624f10dSArmin Le Grand                     SwAttrSetChg aChgOld(aSet, aOld);
6377624f10dSArmin Le Grand                     SwAttrSetChg aChgNew(aSet, aNew);
6387624f10dSArmin Le Grand 
6397624f10dSArmin Le Grand                     ModifyNotification(&aChgOld, &aChgNew);
6407624f10dSArmin Le Grand                 }
6417624f10dSArmin Le Grand             }
6427624f10dSArmin Le Grand 
64338b383a8SArmin Le Grand             return bRet;
64438b383a8SArmin Le Grand         }
6457624f10dSArmin Le Grand     }
6467624f10dSArmin Le Grand 
6477624f10dSArmin Le Grand     // wenn Modify gelockt ist, werden keine Modifies verschickt;
6487624f10dSArmin Le Grand 	// fuer FrmFmt's immer das Modify verschicken!
649cdf0e10cSrcweir     const sal_uInt16 nFmtWhich = Which();
650cdf0e10cSrcweir     if ( IsModifyLocked() ||
651cdf0e10cSrcweir          ( !GetDepends() &&
652cdf0e10cSrcweir            ( RES_GRFFMTCOLL == nFmtWhich ||
653cdf0e10cSrcweir              RES_TXTFMTCOLL == nFmtWhich ) ) )
654cdf0e10cSrcweir 	{
655b740b198SArmin Le Grand 		if( 0 != ( bRet = (0 != aSet.Put( aTempSet ))) )
656cdf0e10cSrcweir 			aSet.SetModifyAtAttr( this );
657cdf0e10cSrcweir         if ( nFmtWhich == RES_TXTFMTCOLL )
658cdf0e10cSrcweir         {
659cdf0e10cSrcweir             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
660cdf0e10cSrcweir         }
661cdf0e10cSrcweir 	}
662cdf0e10cSrcweir 	else
663cdf0e10cSrcweir 	{
664cdf0e10cSrcweir 		SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
665cdf0e10cSrcweir 					aNew( *aSet.GetPool(), aSet.GetRanges() );
666b740b198SArmin Le Grand 		bRet = 0 != aSet.Put_BC( aTempSet, &aOld, &aNew );
667cdf0e10cSrcweir 		if( bRet )
668cdf0e10cSrcweir 		{
669cdf0e10cSrcweir 			// einige Sonderbehandlungen fuer Attribute
670cdf0e10cSrcweir 			aSet.SetModifyAtAttr( this );
671cdf0e10cSrcweir 			SwAttrSetChg aChgOld( aSet, aOld );
672cdf0e10cSrcweir 			SwAttrSetChg aChgNew( aSet, aNew );
673cdf0e10cSrcweir 			ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
674cdf0e10cSrcweir 		}
675cdf0e10cSrcweir 	}
676cdf0e10cSrcweir 	return bRet;
677cdf0e10cSrcweir }
678cdf0e10cSrcweir 
679cdf0e10cSrcweir // Nimmt den Hint mit nWhich aus dem Delta-Array
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 
ResetFmtAttr(sal_uInt16 nWhich1,sal_uInt16 nWhich2)682cdf0e10cSrcweir sal_Bool SwFmt::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
683cdf0e10cSrcweir {
684cdf0e10cSrcweir 	if( !aSet.Count() )
685cdf0e10cSrcweir 		return sal_False;
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 	if( !nWhich2 || nWhich2 < nWhich1 )
688cdf0e10cSrcweir 		nWhich2 = nWhich1;		// dann setze auf 1. Id, nur dieses Item
689cdf0e10cSrcweir 
690cdf0e10cSrcweir 	if ( IsInCache() || IsInSwFntCache() )
691cdf0e10cSrcweir 	{
692cdf0e10cSrcweir 		for( sal_uInt16 n = nWhich1; n < nWhich2; ++n )
693cdf0e10cSrcweir 			CheckCaching( n );
694cdf0e10cSrcweir 	}
695cdf0e10cSrcweir 
696cdf0e10cSrcweir 	// wenn Modify gelockt ist, werden keine Modifies verschickt
697cdf0e10cSrcweir 	if( IsModifyLocked() )
698cdf0e10cSrcweir 		return 0 != (( nWhich2 == nWhich1 )
699cdf0e10cSrcweir 				? aSet.ClearItem( nWhich1 )
700cdf0e10cSrcweir 				: aSet.ClearItem_BC( nWhich1, nWhich2 ));
701cdf0e10cSrcweir 
702cdf0e10cSrcweir 	SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
703cdf0e10cSrcweir 				aNew( *aSet.GetPool(), aSet.GetRanges() );
704cdf0e10cSrcweir 	sal_Bool bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
705cdf0e10cSrcweir 
706cdf0e10cSrcweir 	if( bRet )
707cdf0e10cSrcweir 	{
708cdf0e10cSrcweir 		SwAttrSetChg aChgOld( aSet, aOld );
709cdf0e10cSrcweir 		SwAttrSetChg aChgNew( aSet, aNew );
710cdf0e10cSrcweir 		ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
711cdf0e10cSrcweir 	}
712cdf0e10cSrcweir 	return bRet;
713cdf0e10cSrcweir }
714cdf0e10cSrcweir 
715cdf0e10cSrcweir 
716cdf0e10cSrcweir 
717cdf0e10cSrcweir // --> OD 2007-01-24 #i73790#
718cdf0e10cSrcweir // method renamed
ResetAllFmtAttr()719cdf0e10cSrcweir sal_uInt16 SwFmt::ResetAllFmtAttr()
720cdf0e10cSrcweir // <--
721cdf0e10cSrcweir {
722cdf0e10cSrcweir 	if( !aSet.Count() )
723cdf0e10cSrcweir 		return 0;
724cdf0e10cSrcweir 
725cdf0e10cSrcweir 	if ( IsInCache() )
726cdf0e10cSrcweir 	{
727cdf0e10cSrcweir 		SwFrm::GetCache().Delete( this );
728cdf0e10cSrcweir 		SetInCache( sal_False );
729cdf0e10cSrcweir 	}
730cdf0e10cSrcweir 	SetInSwFntCache( sal_False );
731cdf0e10cSrcweir 
732cdf0e10cSrcweir 	// wenn Modify gelockt ist, werden keine Modifies verschickt
733cdf0e10cSrcweir 	if( IsModifyLocked() )
734cdf0e10cSrcweir 		return aSet.ClearItem( 0 );
735cdf0e10cSrcweir 
736cdf0e10cSrcweir 	SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
737cdf0e10cSrcweir 				aNew( *aSet.GetPool(), aSet.GetRanges() );
738cdf0e10cSrcweir 	sal_Bool bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
739cdf0e10cSrcweir 
740cdf0e10cSrcweir 	if( bRet )
741cdf0e10cSrcweir 	{
742cdf0e10cSrcweir 		SwAttrSetChg aChgOld( aSet, aOld );
743cdf0e10cSrcweir 		SwAttrSetChg aChgNew( aSet, aNew );
744cdf0e10cSrcweir 		ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
745cdf0e10cSrcweir 	}
746cdf0e10cSrcweir 	return aNew.Count();
747cdf0e10cSrcweir }
748cdf0e10cSrcweir 
749cdf0e10cSrcweir 
750cdf0e10cSrcweir /*************************************************************************
751cdf0e10cSrcweir |*    void SwFmt::GetInfo( const SfxPoolItem& ) const
752cdf0e10cSrcweir |*
753cdf0e10cSrcweir |*    Beschreibung
754cdf0e10cSrcweir |*    Ersterstellung    JP 18.04.94
755cdf0e10cSrcweir |*    Letzte Aenderung  JP 05.08.94
756cdf0e10cSrcweir *************************************************************************/
757cdf0e10cSrcweir 
758cdf0e10cSrcweir 
GetInfo(SfxPoolItem & rInfo) const759cdf0e10cSrcweir sal_Bool SwFmt::GetInfo( SfxPoolItem& rInfo ) const
760cdf0e10cSrcweir {
761cdf0e10cSrcweir 	sal_Bool bRet = SwModify::GetInfo( rInfo );
762cdf0e10cSrcweir 	return bRet;
763cdf0e10cSrcweir }
764cdf0e10cSrcweir 
765cdf0e10cSrcweir 
DelDiffs(const SfxItemSet & rSet)766cdf0e10cSrcweir void SwFmt::DelDiffs( const SfxItemSet& rSet )
767cdf0e10cSrcweir {
768cdf0e10cSrcweir 	if( !aSet.Count() )
769cdf0e10cSrcweir 		return;
770cdf0e10cSrcweir 
771cdf0e10cSrcweir 	if ( IsInCache() )
772cdf0e10cSrcweir 	{
773cdf0e10cSrcweir 		SwFrm::GetCache().Delete( this );
774cdf0e10cSrcweir 		SetInCache( sal_False );
775cdf0e10cSrcweir 	}
776cdf0e10cSrcweir 	SetInSwFntCache( sal_False );
777cdf0e10cSrcweir 
778cdf0e10cSrcweir 	// wenn Modify gelockt ist, werden keine Modifies verschickt
779cdf0e10cSrcweir 	if( IsModifyLocked() )
780cdf0e10cSrcweir 	{
781cdf0e10cSrcweir 		aSet.Intersect( rSet );
782cdf0e10cSrcweir 		return;
783cdf0e10cSrcweir 	}
784cdf0e10cSrcweir 
785cdf0e10cSrcweir 	SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
786cdf0e10cSrcweir 				aNew( *aSet.GetPool(), aSet.GetRanges() );
787cdf0e10cSrcweir 	sal_Bool bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
788cdf0e10cSrcweir 
789cdf0e10cSrcweir 	if( bRet )
790cdf0e10cSrcweir 	{
791cdf0e10cSrcweir 		SwAttrSetChg aChgOld( aSet, aOld );
792cdf0e10cSrcweir 		SwAttrSetChg aChgNew( aSet, aNew );
793cdf0e10cSrcweir 		ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
794cdf0e10cSrcweir 	}
795cdf0e10cSrcweir }
796cdf0e10cSrcweir 
797cdf0e10cSrcweir /** SwFmt::IsBackgroundTransparent - for feature #99657#
798cdf0e10cSrcweir 
799cdf0e10cSrcweir     OD 22.08.2002
800cdf0e10cSrcweir     Virtual method to determine, if background of format is transparent.
801cdf0e10cSrcweir     Default implementation returns false. Thus, subclasses have to overload
802cdf0e10cSrcweir     method, if the specific subclass can have a transparent background.
803cdf0e10cSrcweir 
804cdf0e10cSrcweir     @author OD
805cdf0e10cSrcweir 
806cdf0e10cSrcweir     @return false, default implementation
807cdf0e10cSrcweir */
IsBackgroundTransparent() const808cdf0e10cSrcweir sal_Bool SwFmt::IsBackgroundTransparent() const
809cdf0e10cSrcweir {
810cdf0e10cSrcweir     return sal_False;
811cdf0e10cSrcweir }
812cdf0e10cSrcweir 
813cdf0e10cSrcweir /** SwFmt::IsShadowTransparent - for feature #99657#
814cdf0e10cSrcweir 
815cdf0e10cSrcweir     OD 22.08.2002
816cdf0e10cSrcweir     Virtual method to determine, if shadow of format is transparent.
817cdf0e10cSrcweir     Default implementation returns false. Thus, subclasses have to overload
818cdf0e10cSrcweir     method, if the specific subclass can have a transparent shadow.
819cdf0e10cSrcweir 
820cdf0e10cSrcweir     @author OD
821cdf0e10cSrcweir 
822cdf0e10cSrcweir     @return false, default implementation
823cdf0e10cSrcweir */
IsShadowTransparent() const824cdf0e10cSrcweir sal_Bool SwFmt::IsShadowTransparent() const
825cdf0e10cSrcweir {
826cdf0e10cSrcweir     return sal_False;
827cdf0e10cSrcweir }
828cdf0e10cSrcweir 
829cdf0e10cSrcweir /*
830cdf0e10cSrcweir  * Document Interface Access
831cdf0e10cSrcweir  */
getIDocumentSettingAccess() const832cdf0e10cSrcweir const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return GetDoc(); }
getIDocumentDrawModelAccess() const833cdf0e10cSrcweir const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
getIDocumentDrawModelAccess()834cdf0e10cSrcweir IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
getIDocumentLayoutAccess() const835cdf0e10cSrcweir const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
getIDocumentLayoutAccess()836cdf0e10cSrcweir IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
getIDocumentTimerAccess()837cdf0e10cSrcweir IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }
getIDocumentFieldsAccess()838cdf0e10cSrcweir IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); }
getIDocumentChartDataProviderAccess()839cdf0e10cSrcweir IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return GetDoc(); }
840cdf0e10cSrcweir 
8417624f10dSArmin Le Grand //UUUU
GetBackground(sal_Bool bInP) const8427624f10dSArmin Le Grand const SvxBrushItem& SwFmt::GetBackground(sal_Bool bInP) const
8437624f10dSArmin Le Grand {
84456b35d86SArmin Le Grand     //UUUU   FlyFrame              PageStyle
845*28160478SArmin Le Grand     if(supportsFullDrawingLayerFillAttributeSet())
8467624f10dSArmin Le Grand     {
8477624f10dSArmin Le Grand         //UUUU FALLBACKBREAKHERE should not be used; instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST]
8487624f10dSArmin Le Grand         OSL_ENSURE(false, "Do no longer use SvxBrushItem, instead use [XATTR_FILL_FIRST .. XATTR_FILL_LAST] FillAttributes (simple fallback is in place and used)");
8497624f10dSArmin Le Grand         static SvxBrushItem aSvxBrushItem(RES_BACKGROUND);
8507624f10dSArmin Le Grand 
8517624f10dSArmin Le Grand         // fill the local static SvxBrushItem from the current ItemSet so that
8527624f10dSArmin Le Grand         // the fill attributes [XATTR_FILL_FIRST .. XATTR_FILL_LAST] are used
8537624f10dSArmin Le Grand         // as good as possible to create a fallback representation and return that
85456b35d86SArmin Le Grand         aSvxBrushItem = getSvxBrushItemFromSourceSet(aSet, RES_BACKGROUND, bInP);
85538b383a8SArmin Le Grand 
8567624f10dSArmin Le Grand         return aSvxBrushItem;
8577624f10dSArmin Le Grand     }
8587624f10dSArmin Le Grand 
8597624f10dSArmin Le Grand     return aSet.GetBackground(bInP);
8607624f10dSArmin Le Grand }
8617624f10dSArmin Le Grand 
862*28160478SArmin Le Grand //UUUU
supportsFullDrawingLayerFillAttributeSet() const863*28160478SArmin Le Grand bool SwFmt::supportsFullDrawingLayerFillAttributeSet() const
864*28160478SArmin Le Grand {
865*28160478SArmin Le Grand     // base definition - probably not completely correct, e.g. for Table FillStyles
866*28160478SArmin Le Grand     //UUUU  FlyFrame                    PageStyle
867*28160478SArmin Le Grand     return (RES_FLYFRMFMT == Which() || RES_FRMFMT == Which());
868*28160478SArmin Le Grand }
869*28160478SArmin Le Grand 
87056b35d86SArmin Le Grand //UUUU
getSdrAllFillAttributesHelper() const87156b35d86SArmin Le Grand drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwFmt::getSdrAllFillAttributesHelper() const
8727624f10dSArmin Le Grand {
87356b35d86SArmin Le Grand     return drawinglayer::attribute::SdrAllFillAttributesHelperPtr();
8747624f10dSArmin Le Grand }
8757624f10dSArmin Le Grand 
8767624f10dSArmin Le Grand // eof
877