xref: /aoo41x/main/sw/source/core/attr/format.cxx (revision 808c4840)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 
28 #include <hintids.hxx> 			// fuer RES_..
29 #include <frame.hxx>			// fuer AttrCache
30 #include <format.hxx>
31 #include <hints.hxx>			// fuer SwFmtChg
32 #include <doc.hxx>
33 #include <paratr.hxx>			// fuer SwParaFmt - SwHyphenBug
34 #include <swcache.hxx>
35 #include <fmtcolfunc.hxx>
36 
37 TYPEINIT1( SwFmt, SwClient );	//rtti fuer SwFmt
38 
39 /*************************************************************************
40 |*    SwFmt::SwFmt
41 *************************************************************************/
42 
43 
SwFmt(SwAttrPool & rPool,const sal_Char * pFmtNm,const sal_uInt16 * pWhichRanges,SwFmt * pDrvdFrm,sal_uInt16 nFmtWhich)44 SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
45 			const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich )
46 	: SwModify( pDrvdFrm ),
47 	aSet( rPool, pWhichRanges ),
48 	nWhichId( nFmtWhich ),
49 	nFmtId( 0 ),
50 	nPoolFmtId( USHRT_MAX ),
51 	nPoolHelpId( USHRT_MAX ),
52 	nPoolHlpFileId( UCHAR_MAX )
53 {
54 	aFmtName.AssignAscii( pFmtNm );
55     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
56 	bAutoFmt = sal_True;
57 
58 	if( pDrvdFrm )
59 		aSet.SetParent( &pDrvdFrm->aSet );
60 }
61 
62 
SwFmt(SwAttrPool & rPool,const String & rFmtNm,const sal_uInt16 * pWhichRanges,SwFmt * pDrvdFrm,sal_uInt16 nFmtWhich)63 SwFmt::SwFmt( SwAttrPool& rPool, const String &rFmtNm,
64 			const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm, sal_uInt16 nFmtWhich )
65 	: SwModify( pDrvdFrm ),
66 	aFmtName( rFmtNm ),
67 	aSet( rPool, pWhichRanges ),
68 	nWhichId( nFmtWhich ),
69 	nFmtId( 0 ),
70 	nPoolFmtId( USHRT_MAX ),
71 	nPoolHelpId( USHRT_MAX ),
72 	nPoolHlpFileId( UCHAR_MAX )
73 {
74     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
75 	bAutoFmt = sal_True;
76 
77 	if( pDrvdFrm )
78 		aSet.SetParent( &pDrvdFrm->aSet );
79 }
80 
81 
SwFmt(const SwFmt & rFmt)82 SwFmt::SwFmt( const SwFmt& rFmt )
83 	: SwModify( rFmt.DerivedFrom() ),
84 	aFmtName( rFmt.aFmtName ),
85 	aSet( rFmt.aSet ),
86 	nWhichId( rFmt.nWhichId ),
87 	nFmtId( 0 ),
88 	nPoolFmtId( rFmt.GetPoolFmtId() ),
89 	nPoolHelpId( rFmt.GetPoolHelpId() ),
90 	nPoolHlpFileId( rFmt.GetPoolHlpFileId() )
91 {
92     bWritten = bFmtInDTOR = sal_False; // LAYER_IMPL
93 	bAutoFmt = rFmt.bAutoFmt;
94 	bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
95 
96 	if( rFmt.DerivedFrom() )
97 		aSet.SetParent( &rFmt.DerivedFrom()->aSet );
98 	// einige Sonderbehandlungen fuer Attribute
99 	aSet.SetModifyAtAttr( this );
100 }
101 
102 /*************************************************************************
103 |*    SwFmt &SwFmt::operator=(const SwFmt& aFmt)
104 |*
105 |*    Beschreibung		Dokument 1.14
106 |*    Ersterstellung    JP 22.11.90
107 |*    Letzte Aenderung  JP 05.08.94
108 *************************************************************************/
109 
110 
operator =(const SwFmt & rFmt)111 SwFmt &SwFmt::operator=(const SwFmt& rFmt)
112 {
113 	nWhichId = rFmt.nWhichId;
114 	nPoolFmtId = rFmt.GetPoolFmtId();
115 	nPoolHelpId = rFmt.GetPoolHelpId();
116 	nPoolHlpFileId = rFmt.GetPoolHlpFileId();
117 
118 	if ( IsInCache() )
119 	{
120 		SwFrm::GetCache().Delete( this );
121 		SetInCache( sal_False );
122 	}
123 	SetInSwFntCache( sal_False );
124 
125 	// kopiere nur das Attribut-Delta Array
126 	SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
127 				aNew( *aSet.GetPool(), aSet.GetRanges() );
128 	aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
129 	aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
130 
131 	// einige Sonderbehandlungen fuer Attribute
132 	aSet.SetModifyAtAttr( this );
133 
134 	// PoolItem-Attr erzeugen fuers Modify !!!
135 	if( aOld.Count() )
136 	{
137 		SwAttrSetChg aChgOld( aSet, aOld );
138 		SwAttrSetChg aChgNew( aSet, aNew );
139 		ModifyNotification( &aChgOld, &aChgNew );        // alle veraenderten werden verschickt
140 	}
141 
142 	if( GetRegisteredIn() != rFmt.GetRegisteredIn() )
143 	{
144 		if( GetRegisteredIn() )
145 			GetRegisteredInNonConst()->Remove(this);
146 		if(rFmt.GetRegisteredIn())
147 		{
148 			const_cast<SwFmt&>(rFmt).GetRegisteredInNonConst()->Add(this);
149 			aSet.SetParent( &rFmt.aSet );
150 		}
151 		else
152 			aSet.SetParent( 0 );
153 	}
154 	bAutoFmt = rFmt.bAutoFmt;
155 	bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
156 	return *this;
157 }
158 
SetName(const String & rNewName,sal_Bool bBroadcast)159 void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
160 {
161 	ASSERT(!IsDefault(), "SetName: Defaultformat" );
162 	if( bBroadcast )
163 	{
164 		SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
165 		SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
166 		aFmtName = rNewName;
167 		ModifyNotification( &aOld, &aNew );
168 	}
169 	else
170 	{
171 		aFmtName = rNewName;
172 	}
173 }
174 
175 /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
176  * diese Funktion wird in jedem Copy-Ctor gerufen, damit die
177  * Attribute kopiert werden. Diese koennen erst kopiert werden,
178  * wenn die abgeleitet Klasse existiert, denn beim Setzen der
179  * Attribute wird die Which()-Methode gerufen, die hier in der
180  * Basis-Klasse auf 0 defaultet ist.
181  *
182  * Zusatz: JP 8.4.1994
183  * 	Wird ueber Dokumentgrenzen kopiert, so muss das neue Dokument
184  *	mit angeben werden, in dem this steht. Z.Z. ist das fuers
185  *	DropCaps wichtig, dieses haelt Daten, die tief kopiert werden
186  *	muessen !!
187  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
188 
189 
CopyAttrs(const SwFmt & rFmt,sal_Bool bReplace)190 void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
191 {
192 	// kopiere nur das Attribut-Delta Array
193 
194 	if ( IsInCache() )
195 	{
196 		SwFrm::GetCache().Delete( this );
197 		SetInCache( sal_False );
198 	}
199 	SetInSwFntCache( sal_False );
200 
201 	// Sonderbehandlung fuer einige Attribute
202 	SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
203 
204 	if( !bReplace )		// nur die neu, die nicht gesetzt sind ??
205 	{
206 		if( pChgSet == (SwAttrSet*)&rFmt.aSet )		// Set hier kopieren
207 			pChgSet = new SwAttrSet( rFmt.aSet );
208 		pChgSet->Differentiate( aSet );
209 	}
210 
211 	// kopiere nur das Attribut-Delta Array
212 	if( pChgSet->GetPool() != aSet.GetPool() )
213 		pChgSet->CopyToModify( *this );
214 	else
215 	{
216 		SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
217 				  aNew( *aSet.GetPool(), aSet.GetRanges() );
218 
219 		if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
220 		{
221 			// einige Sonderbehandlungen fuer Attribute
222 			aSet.SetModifyAtAttr( this );
223 
224 			SwAttrSetChg aChgOld( aSet, aOld );
225 			SwAttrSetChg aChgNew( aSet, aNew );
226 			ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
227 		}
228 	}
229 
230 	if( pChgSet != (SwAttrSet*)&rFmt.aSet )		// Set hier angelegt ?
231 		delete pChgSet;
232 }
233 
234 /*************************************************************************
235 |*    SwFmt::~SwFmt()
236 |*
237 |*    Beschreibung		Dokument 1.14
238 |*    Ersterstellung    JP 22.11.90
239 |*    Letzte Aenderung  JP 14.02.91
240 *************************************************************************/
241 
242 
~SwFmt()243 SwFmt::~SwFmt()
244 {
245 	/* das passiert bei der ObjectDying Message */
246 	/* alle Abhaengigen auf DerivedFrom umhaengen */
247 	if( GetDepends() )
248 	{
249 		ASSERT(DerivedFrom(), "SwFmt::~SwFmt: Def Abhaengige!" );
250 
251 		bFmtInDTOR = sal_True;
252 
253 		SwFmt *pParentFmt = DerivedFrom();
254 		if (!pParentFmt)		// see #112405#
255 		{
256 			DBG_ERROR( "~SwFmt: parent format missing" );
257 		}
258 		else
259 		{
260 			while( GetDepends() && pParentFmt)
261 			{
262 				SwFmtChg aOldFmt(this);
263 				SwFmtChg aNewFmt(pParentFmt);
264 				SwClient * pDepend = (SwClient*)GetDepends();
265 				pParentFmt->Add(pDepend);
266 				pDepend->ModifyNotification(&aOldFmt, &aNewFmt);
267 			}
268 		}
269 	}
270 }
271 
272 
273 /*************************************************************************
274 |*    void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
275 |*
276 |*    Beschreibung		Dokument 1.14
277 |*    Ersterstellung    JP 22.11.90
278 |*    Letzte Aenderung  JP 05.08.94
279 *************************************************************************/
280 
281 
Modify(const SfxPoolItem * pOldValue,const SfxPoolItem * pNewValue)282 void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
283 {
284 	sal_Bool bWeiter = sal_True;	// sal_True = Propagierung an die Abhaengigen
285 
286 	sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
287 					pNewValue ? pNewValue->Which() : 0 ;
288 	switch( nWhich )
289 	{
290 	case 0:		break;			// Which-Id von 0 ???
291 
292 	case RES_OBJECTDYING :
293 		{
294 			// ist das sterbende Object das "Parent"-Format von diesen Format,
295 			// dann haengt sich dieses Format an den Parent vom Parent
296 			SwFmt * pFmt = (SwFmt *) ((SwPtrMsgPoolItem *)pNewValue)->pObject;
297 
298 			// nicht umhaengen wenn dieses das oberste Format ist !!
299 			if( GetRegisteredIn() && GetRegisteredIn() == pFmt )
300 			{
301 				if( pFmt->GetRegisteredIn() )
302 				{
303 					// wenn Parent, dann im neuen Parent wieder anmelden
304 					pFmt->DerivedFrom()->Add( this );
305 					aSet.SetParent( &DerivedFrom()->aSet );
306 				}
307 				else
308 				{
309 					// sonst auf jeden Fall beim sterbenden abmelden
310 					DerivedFrom()->Remove( this );
311 					aSet.SetParent( 0 );
312 				}
313 			}
314 		} // OBJECTDYING
315 		break;
316 
317 	case RES_ATTRSET_CHG:
318 		if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
319 		{
320 			//nur die weiter geben, die hier nicht gesetzt sind !!
321 			SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
322 			SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
323 
324 			aOld.GetChgSet()->Differentiate( aSet );
325 			aNew.GetChgSet()->Differentiate( aSet );
326 
327 			if( aNew.Count() )
328 				// keine mehr gesetzt, dann Ende !!
329             NotifyClients( &aOld, &aNew );
330 			bWeiter = sal_False;
331 		}
332 		break;
333 	case RES_FMT_CHG:
334 		// falls mein Format Parent umgesetzt wird, dann melde ich
335 		// meinen Attrset beim Neuen an.
336 
337 		// sein eigenes Modify ueberspringen !!
338 		if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
339 			((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
340 		{
341 			// den Set an den neuen Parent haengen
342 			aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
343 		}
344 		break;
345 
346 	case RES_RESET_FMTWRITTEN:
347 		{
348 			// IsWritten-Flag zuruecksetzen. Hint nur an abhanegige
349 			// Formate (und keine Frames) propagieren.
350             // mba: the code does the opposite from what is written in the comment!
351 			ResetWritten();
352             // mba: here we don't use the additional stuff from NotifyClients().
353             // should we?!
354             // mba: move the code that ignores this event to the clients
355             ModifyBroadcast( pOldValue, pNewValue, TYPE(SwFmt) );
356 			bWeiter = sal_False;
357 		}
358 		break;
359 
360 	default:
361 		{
362 			// Ist das Attribut in diesem Format definiert, dann auf
363 			// NICHT weiter propagieren !!
364 			if( SFX_ITEM_SET == aSet.GetItemState( nWhich, sal_False ))
365 			{
366 // wie finde ich heraus, ob nicht ich die Message versende ??
367 // aber wer ruft das hier ????
368 //ASSERT( sal_False, "Modify ohne Absender verschickt" );
369 //JP 11.06.96: DropCaps koennen hierher kommen
370 ASSERT( RES_PARATR_DROP == nWhich, "Modify ohne Absender verschickt" );
371 				bWeiter = sal_False;
372 			}
373 
374 		} // default
375 	} // switch
376 
377 	if( bWeiter )
378 	{
379 		// laufe durch alle abhaengigen Formate
380         NotifyClients( pOldValue, pNewValue );
381 	}
382 
383 }
384 
385 
SetDerivedFrom(SwFmt * pDerFrom)386 sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
387 {
388 	if ( pDerFrom )
389 	{
390 		// Zyklus?
391 		const SwFmt* pFmt = pDerFrom;
392 		while ( pFmt != 0 )
393 		{
394 			if ( pFmt == this )
395 				return sal_False;
396 
397 			pFmt=pFmt->DerivedFrom();
398 		}
399 	}
400 	else
401 	{
402 		// Nichts angegeben, Dflt-Format suchen
403 		pDerFrom = this;
404 		while ( pDerFrom->DerivedFrom() )
405 			pDerFrom = pDerFrom->DerivedFrom();
406 	}
407 	if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
408 		return sal_False;
409 
410 	ASSERT( Which()==pDerFrom->Which()
411 			|| ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
412 			|| ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
413 			|| ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
414 			"SetDerivedFrom: Aepfel von Birnen ableiten?");
415 
416 	if ( IsInCache() )
417 	{
418 		SwFrm::GetCache().Delete( this );
419 		SetInCache( sal_False );
420 	}
421 	SetInSwFntCache( sal_False );
422 
423 	pDerFrom->Add(this);
424 	aSet.SetParent( &pDerFrom->aSet );
425 
426 	SwFmtChg aOldFmt(this);
427 	SwFmtChg aNewFmt(this);
428 	ModifyNotification( &aOldFmt, &aNewFmt );
429 
430 	return sal_True;
431 }
432 
433 
SetFmtAttr(const SfxPoolItem & rAttr)434 sal_Bool SwFmt::SetFmtAttr(const SfxPoolItem& rAttr )
435 {
436 	if ( IsInCache() || IsInSwFntCache() )
437 	{
438 		const sal_uInt16 nWhich = rAttr.Which();
439 		CheckCaching( nWhich );
440 	}
441 
442 	// wenn Modify gelockt ist, werden keine Modifies verschickt;
443 	// fuer FrmFmt's immer das Modify verschicken!
444 	sal_Bool bRet = sal_False;
445     const sal_uInt16 nFmtWhich = Which();
446 	if( IsModifyLocked() || (!GetDepends() &&
447         (RES_GRFFMTCOLL == nFmtWhich  ||
448          RES_TXTFMTCOLL == nFmtWhich ) ) )
449 	{
450 		if( 0 != ( bRet = (0 != aSet.Put( rAttr ))) )
451 			aSet.SetModifyAtAttr( this );
452         if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
453         {
454             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
455         }
456 	}
457 	else
458 	{
459 		// kopiere nur das Attribut-Delta Array
460 		SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
461 					aNew( *aSet.GetPool(), aSet.GetRanges() );
462 
463 		bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
464 		if( bRet )
465 		{
466 			// einige Sonderbehandlungen fuer Attribute
467 			aSet.SetModifyAtAttr( this );
468 
469 			SwAttrSetChg aChgOld( aSet, aOld );
470 			SwAttrSetChg aChgNew( aSet, aNew );
471 			ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
472 		}
473 	}
474 	return bRet;
475 }
476 
477 
SetFmtAttr(const SfxItemSet & rSet)478 sal_Bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
479 {
480 	if( !rSet.Count() )
481 		return sal_False;
482 
483 	if ( IsInCache() )
484 	{
485 		SwFrm::GetCache().Delete( this );
486 		SetInCache( sal_False );
487 	}
488 	SetInSwFntCache( sal_False );
489 
490 	// wenn Modify gelockt ist, werden keine Modifies verschickt;
491 	// fuer FrmFmt's immer das Modify verschicken!
492 	sal_Bool bRet = sal_False;
493     const sal_uInt16 nFmtWhich = Which();
494     if ( IsModifyLocked() ||
495          ( !GetDepends() &&
496            ( RES_GRFFMTCOLL == nFmtWhich ||
497              RES_TXTFMTCOLL == nFmtWhich ) ) )
498 	{
499 		if( 0 != ( bRet = (0 != aSet.Put( rSet ))) )
500 			aSet.SetModifyAtAttr( this );
501         if ( nFmtWhich == RES_TXTFMTCOLL )
502         {
503             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
504         }
505 	}
506 	else
507 	{
508 		SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
509 					aNew( *aSet.GetPool(), aSet.GetRanges() );
510 		bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew );
511 		if( bRet )
512 		{
513 			// einige Sonderbehandlungen fuer Attribute
514 			aSet.SetModifyAtAttr( this );
515 			SwAttrSetChg aChgOld( aSet, aOld );
516 			SwAttrSetChg aChgNew( aSet, aNew );
517 			ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
518 		}
519 	}
520 	return bRet;
521 }
522 
523 // Nimmt den Hint mit nWhich aus dem Delta-Array
524 
525 
ResetFmtAttr(sal_uInt16 nWhich1,sal_uInt16 nWhich2)526 sal_Bool SwFmt::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
527 {
528 	if( !aSet.Count() )
529 		return sal_False;
530 
531 	if( !nWhich2 || nWhich2 < nWhich1 )
532 		nWhich2 = nWhich1;		// dann setze auf 1. Id, nur dieses Item
533 
534 	if ( IsInCache() || IsInSwFntCache() )
535 	{
536 		for( sal_uInt16 n = nWhich1; n < nWhich2; ++n )
537 			CheckCaching( n );
538 	}
539 
540 	// wenn Modify gelockt ist, werden keine Modifies verschickt
541 	if( IsModifyLocked() )
542 		return 0 != (( nWhich2 == nWhich1 )
543 				? aSet.ClearItem( nWhich1 )
544 				: aSet.ClearItem_BC( nWhich1, nWhich2 ));
545 
546 	SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
547 				aNew( *aSet.GetPool(), aSet.GetRanges() );
548 	sal_Bool bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
549 
550 	if( bRet )
551 	{
552 		SwAttrSetChg aChgOld( aSet, aOld );
553 		SwAttrSetChg aChgNew( aSet, aNew );
554 		ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
555 	}
556 	return bRet;
557 }
558 
559 
560 
561 // --> OD 2007-01-24 #i73790#
562 // method renamed
ResetAllFmtAttr()563 sal_uInt16 SwFmt::ResetAllFmtAttr()
564 // <--
565 {
566 	if( !aSet.Count() )
567 		return 0;
568 
569 	if ( IsInCache() )
570 	{
571 		SwFrm::GetCache().Delete( this );
572 		SetInCache( sal_False );
573 	}
574 	SetInSwFntCache( sal_False );
575 
576 	// wenn Modify gelockt ist, werden keine Modifies verschickt
577 	if( IsModifyLocked() )
578 		return aSet.ClearItem( 0 );
579 
580 	SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
581 				aNew( *aSet.GetPool(), aSet.GetRanges() );
582 	sal_Bool bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
583 
584 	if( bRet )
585 	{
586 		SwAttrSetChg aChgOld( aSet, aOld );
587 		SwAttrSetChg aChgNew( aSet, aNew );
588 		ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
589 	}
590 	return aNew.Count();
591 }
592 
593 
594 /*************************************************************************
595 |*    void SwFmt::GetInfo( const SfxPoolItem& ) const
596 |*
597 |*    Beschreibung
598 |*    Ersterstellung    JP 18.04.94
599 |*    Letzte Aenderung  JP 05.08.94
600 *************************************************************************/
601 
602 
GetInfo(SfxPoolItem & rInfo) const603 sal_Bool SwFmt::GetInfo( SfxPoolItem& rInfo ) const
604 {
605 	sal_Bool bRet = SwModify::GetInfo( rInfo );
606 	return bRet;
607 }
608 
609 
DelDiffs(const SfxItemSet & rSet)610 void SwFmt::DelDiffs( const SfxItemSet& rSet )
611 {
612 	if( !aSet.Count() )
613 		return;
614 
615 	if ( IsInCache() )
616 	{
617 		SwFrm::GetCache().Delete( this );
618 		SetInCache( sal_False );
619 	}
620 	SetInSwFntCache( sal_False );
621 
622 	// wenn Modify gelockt ist, werden keine Modifies verschickt
623 	if( IsModifyLocked() )
624 	{
625 		aSet.Intersect( rSet );
626 		return;
627 	}
628 
629 	SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
630 				aNew( *aSet.GetPool(), aSet.GetRanges() );
631 	sal_Bool bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
632 
633 	if( bRet )
634 	{
635 		SwAttrSetChg aChgOld( aSet, aOld );
636 		SwAttrSetChg aChgNew( aSet, aNew );
637 		ModifyNotification( &aChgOld, &aChgNew );		// alle veraenderten werden verschickt
638 	}
639 }
640 
641 /** SwFmt::IsBackgroundTransparent - for feature #99657#
642 
643     OD 22.08.2002
644     Virtual method to determine, if background of format is transparent.
645     Default implementation returns false. Thus, subclasses have to overload
646     method, if the specific subclass can have a transparent background.
647 
648     @author OD
649 
650     @return false, default implementation
651 */
IsBackgroundTransparent() const652 sal_Bool SwFmt::IsBackgroundTransparent() const
653 {
654     return sal_False;
655 }
656 
657 /** SwFmt::IsShadowTransparent - for feature #99657#
658 
659     OD 22.08.2002
660     Virtual method to determine, if shadow of format is transparent.
661     Default implementation returns false. Thus, subclasses have to overload
662     method, if the specific subclass can have a transparent shadow.
663 
664     @author OD
665 
666     @return false, default implementation
667 */
IsShadowTransparent() const668 sal_Bool SwFmt::IsShadowTransparent() const
669 {
670     return sal_False;
671 }
672 
673 /*
674  * Document Interface Access
675  */
getIDocumentSettingAccess() const676 const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return GetDoc(); }
getIDocumentDrawModelAccess() const677 const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
getIDocumentDrawModelAccess()678 IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
getIDocumentLayoutAccess() const679 const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
getIDocumentLayoutAccess()680 IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
getIDocumentTimerAccess()681 IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }
getIDocumentFieldsAccess()682 IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); }
getIDocumentChartDataProviderAccess()683 IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return GetDoc(); }
684 
685