xref: /AOO41X/main/sw/source/core/doc/fmtcol.cxx (revision 808c4840145b66ebc65ba9c0f5bc9b4b53af9eab)
1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
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
10cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
20efeef26fSAndrew Rist  *************************************************************/
21efeef26fSAndrew Rist 
22efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir #include <hintids.hxx>
27cdf0e10cSrcweir #include <editeng/ulspitem.hxx>
28cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
29cdf0e10cSrcweir #include <editeng/fhgtitem.hxx>
30cdf0e10cSrcweir #include <doc.hxx>			// fuer GetAttrPool
31cdf0e10cSrcweir #include <errhdl.hxx>
32cdf0e10cSrcweir #include <fmtcol.hxx>
33cdf0e10cSrcweir #include <fmtcolfunc.hxx>
34cdf0e10cSrcweir #include <hints.hxx>
35cdf0e10cSrcweir #include <calc.hxx>
36cdf0e10cSrcweir #include <node.hxx>
37cdf0e10cSrcweir #include <numrule.hxx>
38cdf0e10cSrcweir #include <paratr.hxx>
39cdf0e10cSrcweir #include <switerator.hxx>
40cdf0e10cSrcweir #include <svl/intitem.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir TYPEINIT1( SwTxtFmtColl, SwFmtColl );
43cdf0e10cSrcweir TYPEINIT1( SwGrfFmtColl, SwFmtColl );
44cdf0e10cSrcweir TYPEINIT1( SwConditionTxtFmtColl, SwTxtFmtColl );
45cdf0e10cSrcweir TYPEINIT1( SwCollCondition, SwClient );
46cdf0e10cSrcweir 
47cdf0e10cSrcweir SV_IMPL_PTRARR( SwFmtCollConditions, SwCollConditionPtr );
48cdf0e10cSrcweir 
49cdf0e10cSrcweir // --> OD 2008-03-04 #refactorlists#
50cdf0e10cSrcweir namespace TxtFmtCollFunc
51cdf0e10cSrcweir {
52cdf0e10cSrcweir 
53cdf0e10cSrcweir     // --> OD 2006-11-22 #i71574#
CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle(SwFmt * pFmt,const SwNumRuleItem * pNewNumRuleItem)54cdf0e10cSrcweir     void CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle(
55cdf0e10cSrcweir                                             SwFmt* pFmt,
56cdf0e10cSrcweir                                             const SwNumRuleItem* pNewNumRuleItem )
57cdf0e10cSrcweir     {
58cdf0e10cSrcweir         SwTxtFmtColl* pTxtFmtColl = dynamic_cast<SwTxtFmtColl*>(pFmt);
59cdf0e10cSrcweir         if ( !pTxtFmtColl )
60cdf0e10cSrcweir         {
61cdf0e10cSrcweir     #if OSL_DEBUG_LEVEL > 1
62cdf0e10cSrcweir             ASSERT( false,
63cdf0e10cSrcweir                     "<TxtFmtCollFunc::CheckTxtFmtCollFuncForDeletionOfAssignmentToOutlineStyle> - misuse of method - it's only for instances of <SwTxtFmtColl>" );
64cdf0e10cSrcweir     #endif
65cdf0e10cSrcweir             return;
66cdf0e10cSrcweir         }
67cdf0e10cSrcweir 
68*808c4840SOliver-Rainer Wittmann         if ( !pTxtFmtColl->StayAssignedToListLevelOfOutlineStyle()
69*808c4840SOliver-Rainer Wittmann              && pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() )
70cdf0e10cSrcweir         {
71*808c4840SOliver-Rainer Wittmann             if ( pNewNumRuleItem == NULL )
72cdf0e10cSrcweir             {
73cdf0e10cSrcweir                 pTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNewNumRuleItem );
74cdf0e10cSrcweir             }
75*808c4840SOliver-Rainer Wittmann             if ( pNewNumRuleItem != NULL )
76cdf0e10cSrcweir             {
77cdf0e10cSrcweir                 String sNumRuleName = pNewNumRuleItem->GetValue();
78cdf0e10cSrcweir                 if ( sNumRuleName.Len() == 0 ||
79cdf0e10cSrcweir                      sNumRuleName != pTxtFmtColl->GetDoc()->GetOutlineNumRule()->GetName() )
80cdf0e10cSrcweir                 {
81cdf0e10cSrcweir                     // delete assignment of paragraph style to list level of outline style.
82cdf0e10cSrcweir                     pTxtFmtColl->DeleteAssignmentToListLevelOfOutlineStyle();
83cdf0e10cSrcweir                 }
84cdf0e10cSrcweir             }
85cdf0e10cSrcweir         }
86cdf0e10cSrcweir     }
87*808c4840SOliver-Rainer Wittmann 
88cdf0e10cSrcweir 
GetNumRule(SwTxtFmtColl & rTxtFmtColl)89cdf0e10cSrcweir     SwNumRule* GetNumRule( SwTxtFmtColl& rTxtFmtColl )
90cdf0e10cSrcweir     {
91cdf0e10cSrcweir         SwNumRule* pNumRule( 0 );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir         const SwNumRuleItem* pNumRuleItem( 0 );
94cdf0e10cSrcweir         rTxtFmtColl.GetItemState( RES_PARATR_NUMRULE, sal_False, (const SfxPoolItem**)&pNumRuleItem );
95cdf0e10cSrcweir         if ( pNumRuleItem )
96cdf0e10cSrcweir         {
97cdf0e10cSrcweir             const String sNumRuleName = pNumRuleItem->GetValue();
98cdf0e10cSrcweir             if ( sNumRuleName.Len() > 0 )
99cdf0e10cSrcweir             {
100cdf0e10cSrcweir                 pNumRule = rTxtFmtColl.GetDoc()->FindNumRulePtr( sNumRuleName );
101cdf0e10cSrcweir             }
102cdf0e10cSrcweir         }
103cdf0e10cSrcweir 
104cdf0e10cSrcweir         return pNumRule;
105cdf0e10cSrcweir     }
106cdf0e10cSrcweir 
AddToNumRule(SwTxtFmtColl & rTxtFmtColl)107cdf0e10cSrcweir     void AddToNumRule( SwTxtFmtColl& rTxtFmtColl )
108cdf0e10cSrcweir     {
109cdf0e10cSrcweir         SwNumRule* pNumRule = GetNumRule( rTxtFmtColl );
110cdf0e10cSrcweir         if ( pNumRule )
111cdf0e10cSrcweir         {
112cdf0e10cSrcweir             pNumRule->AddParagraphStyle( rTxtFmtColl );
113cdf0e10cSrcweir         }
114cdf0e10cSrcweir     }
115cdf0e10cSrcweir 
RemoveFromNumRule(SwTxtFmtColl & rTxtFmtColl)116cdf0e10cSrcweir     void RemoveFromNumRule( SwTxtFmtColl& rTxtFmtColl )
117cdf0e10cSrcweir     {
118cdf0e10cSrcweir         SwNumRule* pNumRule = GetNumRule( rTxtFmtColl );
119cdf0e10cSrcweir         if ( pNumRule )
120cdf0e10cSrcweir         {
121cdf0e10cSrcweir             pNumRule->RemoveParagraphStyle( rTxtFmtColl );
122cdf0e10cSrcweir         }
123cdf0e10cSrcweir     }
124cdf0e10cSrcweir } // end of namespace TxtFmtCollFunc
125cdf0e10cSrcweir // <--
126cdf0e10cSrcweir 
127cdf0e10cSrcweir /*
128cdf0e10cSrcweir  * SwTxtFmtColl  TXT
129cdf0e10cSrcweir  */
130cdf0e10cSrcweir 
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)131cdf0e10cSrcweir void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir 	if( GetDoc()->IsInDtor() )
134cdf0e10cSrcweir 	{
135cdf0e10cSrcweir 		SwFmtColl::Modify( pOld, pNew );
136cdf0e10cSrcweir 		return;
137cdf0e10cSrcweir 	}
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     // --> OD 2006-06-16 #i66431# - adjust type of <bNewParent>
140cdf0e10cSrcweir     bool bNewParent( false );
141cdf0e10cSrcweir     // <--
142cdf0e10cSrcweir 	SvxULSpaceItem *pNewULSpace = 0, *pOldULSpace = 0;
143cdf0e10cSrcweir 	SvxLRSpaceItem *pNewLRSpace = 0, *pOldLRSpace = 0;
144cdf0e10cSrcweir 	SvxFontHeightItem* aFontSizeArr[3] = {0,0,0};
145cdf0e10cSrcweir     // --> OD 2006-10-17 #i70223#
146cdf0e10cSrcweir     const bool bAssignedToListLevelOfOutlineStyle(IsAssignedToListLevelOfOutlineStyle());//#outline level ,zhaojianwei
147cdf0e10cSrcweir     const SwNumRuleItem* pNewNumRuleItem( 0L );
148cdf0e10cSrcweir     // <--
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	SwAttrSetChg *pNewChgSet = 0,  *pOldChgSet = 0;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	switch( pOld ? pOld->Which() : pNew ? pNew->Which() : 0 )
153cdf0e10cSrcweir 	{
154cdf0e10cSrcweir 	case RES_ATTRSET_CHG:
155cdf0e10cSrcweir 		// nur neu berechnen, wenn nicht wir der "Versender" sind !!!
156cdf0e10cSrcweir 		pNewChgSet = (SwAttrSetChg*)pNew;
157cdf0e10cSrcweir 		pOldChgSet = (SwAttrSetChg*)pOld;
158cdf0e10cSrcweir 		pNewChgSet->GetChgSet()->GetItemState(
159cdf0e10cSrcweir 			RES_LR_SPACE, sal_False, (const SfxPoolItem**)&pNewLRSpace );
160cdf0e10cSrcweir 		pNewChgSet->GetChgSet()->GetItemState(
161cdf0e10cSrcweir 			RES_UL_SPACE, sal_False, (const SfxPoolItem**)&pNewULSpace );
162cdf0e10cSrcweir 		pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_FONTSIZE,
163cdf0e10cSrcweir 						sal_False, (const SfxPoolItem**)&(aFontSizeArr[0]) );
164cdf0e10cSrcweir 		pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CJK_FONTSIZE,
165cdf0e10cSrcweir 						sal_False, (const SfxPoolItem**)&(aFontSizeArr[1]) );
166cdf0e10cSrcweir 		pNewChgSet->GetChgSet()->GetItemState( RES_CHRATR_CTL_FONTSIZE,
167cdf0e10cSrcweir 						sal_False, (const SfxPoolItem**)&(aFontSizeArr[2]) );
168cdf0e10cSrcweir         // --> OD 2006-10-17 #i70223#
169cdf0e10cSrcweir         // --> OD 2007-12-19 #i84745#
170cdf0e10cSrcweir         // check, if attribute set is applied to this paragraph style
171cdf0e10cSrcweir         if ( bAssignedToListLevelOfOutlineStyle &&
172cdf0e10cSrcweir              pNewChgSet->GetTheChgdSet() == &GetAttrSet() )
173cdf0e10cSrcweir         {
174cdf0e10cSrcweir             pNewChgSet->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, sal_False,
175cdf0e10cSrcweir                                                    (const SfxPoolItem**)&pNewNumRuleItem );
176cdf0e10cSrcweir         }
177cdf0e10cSrcweir         // <--
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 		break;
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	case RES_FMT_CHG:
182cdf0e10cSrcweir 		if( GetAttrSet().GetParent() )
183cdf0e10cSrcweir 		{
184cdf0e10cSrcweir 			const SfxItemSet* pParent = GetAttrSet().GetParent();
185cdf0e10cSrcweir 			pNewLRSpace = (SvxLRSpaceItem*)&pParent->Get( RES_LR_SPACE );
186cdf0e10cSrcweir 			pNewULSpace = (SvxULSpaceItem*)&pParent->Get( RES_UL_SPACE );
187cdf0e10cSrcweir 			aFontSizeArr[0] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_FONTSIZE );
188cdf0e10cSrcweir 			aFontSizeArr[1] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_CJK_FONTSIZE );
189cdf0e10cSrcweir 			aFontSizeArr[2] = (SvxFontHeightItem*)&pParent->Get( RES_CHRATR_CTL_FONTSIZE );
190cdf0e10cSrcweir             // --> OD 2006-06-16 #i66431#
191cdf0e10cSrcweir             // modify has to be propagated, because of new parent format.
192cdf0e10cSrcweir             bNewParent = true;
193cdf0e10cSrcweir             // <--
194cdf0e10cSrcweir 		}
195cdf0e10cSrcweir 		break;
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	case RES_LR_SPACE:
198cdf0e10cSrcweir 		pNewLRSpace = (SvxLRSpaceItem*)pNew;
199cdf0e10cSrcweir 		break;
200cdf0e10cSrcweir 	case RES_UL_SPACE:
201cdf0e10cSrcweir 		pNewULSpace = (SvxULSpaceItem*)pNew;
202cdf0e10cSrcweir 		break;
203cdf0e10cSrcweir 	case RES_CHRATR_FONTSIZE:
204cdf0e10cSrcweir 		aFontSizeArr[0] = (SvxFontHeightItem*)pNew;
205cdf0e10cSrcweir 		break;
206cdf0e10cSrcweir 	case RES_CHRATR_CJK_FONTSIZE:
207cdf0e10cSrcweir 		aFontSizeArr[1] = (SvxFontHeightItem*)pNew;
208cdf0e10cSrcweir 		break;
209cdf0e10cSrcweir 	case RES_CHRATR_CTL_FONTSIZE:
210cdf0e10cSrcweir 		aFontSizeArr[2] = (SvxFontHeightItem*)pNew;
211cdf0e10cSrcweir 		break;
212cdf0e10cSrcweir     case RES_PARATR_NUMRULE:
213cdf0e10cSrcweir     {
214cdf0e10cSrcweir         if ( bAssignedToListLevelOfOutlineStyle )
215cdf0e10cSrcweir         {
216cdf0e10cSrcweir             pNewNumRuleItem = (SwNumRuleItem*)pNew;
217cdf0e10cSrcweir         }
218cdf0e10cSrcweir     }
219*808c4840SOliver-Rainer Wittmann     break;
220cdf0e10cSrcweir     default:
221cdf0e10cSrcweir         break;
222cdf0e10cSrcweir     }
223cdf0e10cSrcweir 
224*808c4840SOliver-Rainer Wittmann     if ( bAssignedToListLevelOfOutlineStyle
225*808c4840SOliver-Rainer Wittmann          && pNewNumRuleItem != NULL )
226cdf0e10cSrcweir     {
227*808c4840SOliver-Rainer Wittmann         TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this, pNewNumRuleItem );
228cdf0e10cSrcweir     }
229cdf0e10cSrcweir 
230cdf0e10cSrcweir     int bWeiter = sal_True;
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	// dann pruefe doch mal gegen die eigenen Attribute
233cdf0e10cSrcweir 	if( pNewLRSpace && SFX_ITEM_SET == GetItemState( RES_LR_SPACE, sal_False,
234cdf0e10cSrcweir 										(const SfxPoolItem**)&pOldLRSpace ))
235cdf0e10cSrcweir 	{
236cdf0e10cSrcweir 		int bChg = sal_False;
237cdf0e10cSrcweir 		if( pOldLRSpace != pNewLRSpace )	// verhinder Rekursion (SetAttr!!)
238cdf0e10cSrcweir 		{
239cdf0e10cSrcweir 			SvxLRSpaceItem aNew( *pOldLRSpace );
240cdf0e10cSrcweir 			// wir hatten eine relative Angabe -> neu berechnen
241cdf0e10cSrcweir 			if( 100 != aNew.GetPropLeft() )
242cdf0e10cSrcweir 			{
243cdf0e10cSrcweir 				long nTmp = aNew.GetLeft();		// alten zum Vergleichen
244cdf0e10cSrcweir 				aNew.SetLeft( pNewLRSpace->GetLeft(), aNew.GetPropLeft() );
245cdf0e10cSrcweir 				bChg |= nTmp != aNew.GetLeft();
246cdf0e10cSrcweir 			}
247cdf0e10cSrcweir 			// wir hatten eine relative Angabe -> neu berechnen
248cdf0e10cSrcweir 			if( 100 != aNew.GetPropRight() )
249cdf0e10cSrcweir 			{
250cdf0e10cSrcweir 				long nTmp = aNew.GetRight();		// alten zum Vergleichen
251cdf0e10cSrcweir 				aNew.SetRight( pNewLRSpace->GetRight(), aNew.GetPropRight() );
252cdf0e10cSrcweir 				bChg |= nTmp != aNew.GetRight();
253cdf0e10cSrcweir 			}
254cdf0e10cSrcweir 			// wir hatten eine relative Angabe -> neu berechnen
255cdf0e10cSrcweir 			if( 100 != aNew.GetPropTxtFirstLineOfst() )
256cdf0e10cSrcweir 			{
257cdf0e10cSrcweir 				short nTmp = aNew.GetTxtFirstLineOfst();		// alten zum Vergleichen
258cdf0e10cSrcweir 				aNew.SetTxtFirstLineOfst( pNewLRSpace->GetTxtFirstLineOfst(),
259cdf0e10cSrcweir 											aNew.GetPropTxtFirstLineOfst() );
260cdf0e10cSrcweir 				bChg |= nTmp != aNew.GetTxtFirstLineOfst();
261cdf0e10cSrcweir 			}
262cdf0e10cSrcweir 			if( bChg )
263cdf0e10cSrcweir 			{
264cdf0e10cSrcweir                 SetFmtAttr( aNew );
265cdf0e10cSrcweir 				bWeiter = 0 != pOldChgSet || bNewParent;
266cdf0e10cSrcweir 			}
267cdf0e10cSrcweir 			// bei uns absolut gesetzt -> nicht weiter propagieren, es sei
268cdf0e10cSrcweir 			// denn es wird bei uns gesetzt!
269cdf0e10cSrcweir 			else if( pNewChgSet )
270cdf0e10cSrcweir 				bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
271cdf0e10cSrcweir 		}
272cdf0e10cSrcweir     }
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	if( pNewULSpace && SFX_ITEM_SET == GetItemState(
275cdf0e10cSrcweir 			RES_UL_SPACE, sal_False, (const SfxPoolItem**)&pOldULSpace ) &&
276cdf0e10cSrcweir 		pOldULSpace != pNewULSpace )	// verhinder Rekursion (SetAttr!!)
277cdf0e10cSrcweir 	{
278cdf0e10cSrcweir 		SvxULSpaceItem aNew( *pOldULSpace );
279cdf0e10cSrcweir 		int bChg = sal_False;
280cdf0e10cSrcweir 		// wir hatten eine relative Angabe -> neu berechnen
281cdf0e10cSrcweir 		if( 100 != aNew.GetPropUpper() )
282cdf0e10cSrcweir 		{
283cdf0e10cSrcweir 			sal_uInt16 nTmp = aNew.GetUpper();		// alten zum Vergleichen
284cdf0e10cSrcweir 			aNew.SetUpper( pNewULSpace->GetUpper(), aNew.GetPropUpper() );
285cdf0e10cSrcweir 			bChg |= nTmp != aNew.GetUpper();
286cdf0e10cSrcweir 		}
287cdf0e10cSrcweir 		// wir hatten eine relative Angabe -> neu berechnen
288cdf0e10cSrcweir 		if( 100 != aNew.GetPropLower() )
289cdf0e10cSrcweir 		{
290cdf0e10cSrcweir 			sal_uInt16 nTmp = aNew.GetLower();		// alten zum Vergleichen
291cdf0e10cSrcweir 			aNew.SetLower( pNewULSpace->GetLower(), aNew.GetPropLower() );
292cdf0e10cSrcweir 			bChg |= nTmp != aNew.GetLower();
293cdf0e10cSrcweir 		}
294cdf0e10cSrcweir 		if( bChg )
295cdf0e10cSrcweir 		{
296cdf0e10cSrcweir             SetFmtAttr( aNew );
297cdf0e10cSrcweir 			bWeiter = 0 != pOldChgSet || bNewParent;
298cdf0e10cSrcweir 		}
299cdf0e10cSrcweir 		// bei uns absolut gesetzt -> nicht weiter propagieren, es sei
300cdf0e10cSrcweir 		// denn es wird bei uns gesetzt!
301cdf0e10cSrcweir 		else if( pNewChgSet )
302cdf0e10cSrcweir 			bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
303cdf0e10cSrcweir 	}
304cdf0e10cSrcweir 
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 	for( int nC = 0, nArrLen = sizeof(aFontSizeArr) / sizeof( aFontSizeArr[0]);
307cdf0e10cSrcweir 			nC < nArrLen; ++nC )
308cdf0e10cSrcweir 	{
309cdf0e10cSrcweir 		SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize;
310cdf0e10cSrcweir 		if( pFSize && SFX_ITEM_SET == GetItemState(
311cdf0e10cSrcweir 			pFSize->Which(), sal_False, (const SfxPoolItem**)&pOldFSize ) &&
312cdf0e10cSrcweir 			// verhinder Rekursion (SetAttr!!)
313cdf0e10cSrcweir 			pFSize != pOldFSize )
314cdf0e10cSrcweir 		{
315cdf0e10cSrcweir 			if( 100 == pOldFSize->GetProp() &&
316cdf0e10cSrcweir 				SFX_MAPUNIT_RELATIVE == pOldFSize->GetPropUnit() )
317cdf0e10cSrcweir 			{
318cdf0e10cSrcweir 				// bei uns absolut gesetzt -> nicht weiter propagieren, es sei
319cdf0e10cSrcweir 				// denn es wird bei uns gesetzt!
320cdf0e10cSrcweir 				if( pNewChgSet )
321cdf0e10cSrcweir 					bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
322cdf0e10cSrcweir 			}
323cdf0e10cSrcweir 			else
324cdf0e10cSrcweir 			{
325cdf0e10cSrcweir 				// wir hatten eine relative Angabe -> neu berechnen
326cdf0e10cSrcweir 				sal_uInt32 nTmp = pOldFSize->GetHeight();		// alten zum Vergleichen
327cdf0e10cSrcweir                 SvxFontHeightItem aNew(240 , 100, pFSize->Which());
328cdf0e10cSrcweir 				aNew.SetHeight( pFSize->GetHeight(), pOldFSize->GetProp(),
329cdf0e10cSrcweir 								pOldFSize->GetPropUnit() );
330cdf0e10cSrcweir 				if( nTmp != aNew.GetHeight() )
331cdf0e10cSrcweir 				{
332cdf0e10cSrcweir                     SetFmtAttr( aNew );
333cdf0e10cSrcweir 					bWeiter = 0 != pOldChgSet || bNewParent;
334cdf0e10cSrcweir 				}
335cdf0e10cSrcweir 				// bei uns absolut gesetzt -> nicht weiter propagieren, es sei
336cdf0e10cSrcweir 				// denn es wird bei uns gesetzt!
337cdf0e10cSrcweir 				else if( pNewChgSet )
338cdf0e10cSrcweir 					bWeiter = pNewChgSet->GetTheChgdSet() == &GetAttrSet();
339cdf0e10cSrcweir 			}
340cdf0e10cSrcweir 		}
341cdf0e10cSrcweir 	}
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 	if( bWeiter )
344cdf0e10cSrcweir 		SwFmtColl::Modify( pOld, pNew );
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
IsAtDocNodeSet() const347cdf0e10cSrcweir sal_Bool SwTxtFmtColl::IsAtDocNodeSet() const
348cdf0e10cSrcweir {
349cdf0e10cSrcweir 	SwIterator<SwCntntNode,SwFmtColl> aIter( *this );
350cdf0e10cSrcweir 	const SwNodes& rNds = GetDoc()->GetNodes();
351cdf0e10cSrcweir 	for( SwCntntNode* pNode = aIter.First(); pNode; pNode = aIter.Next() )
352cdf0e10cSrcweir 		if( &(pNode->GetNodes()) == &rNds )
353cdf0e10cSrcweir 			return sal_True;
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 	return sal_False;
356cdf0e10cSrcweir }
357cdf0e10cSrcweir 
358cdf0e10cSrcweir // --> OD 2008-03-04 #refactorlists#
SetFmtAttr(const SfxPoolItem & rAttr)359cdf0e10cSrcweir sal_Bool SwTxtFmtColl::SetFmtAttr( const SfxPoolItem& rAttr )
360cdf0e10cSrcweir {
361cdf0e10cSrcweir     const bool bIsNumRuleItem = rAttr.Which() == RES_PARATR_NUMRULE;
362cdf0e10cSrcweir     if ( bIsNumRuleItem )
363cdf0e10cSrcweir     {
364cdf0e10cSrcweir         TxtFmtCollFunc::RemoveFromNumRule( *this );
365cdf0e10cSrcweir     }
366cdf0e10cSrcweir 
367cdf0e10cSrcweir     const sal_Bool bRet = SwFmtColl::SetFmtAttr( rAttr );
368cdf0e10cSrcweir 
369cdf0e10cSrcweir     if ( bIsNumRuleItem )
370cdf0e10cSrcweir     {
371cdf0e10cSrcweir         TxtFmtCollFunc::AddToNumRule( *this );
372cdf0e10cSrcweir     }
373cdf0e10cSrcweir 
374cdf0e10cSrcweir     return bRet;
375cdf0e10cSrcweir }
376cdf0e10cSrcweir 
SetFmtAttr(const SfxItemSet & rSet)377cdf0e10cSrcweir sal_Bool SwTxtFmtColl::SetFmtAttr( const SfxItemSet& rSet )
378cdf0e10cSrcweir {
379cdf0e10cSrcweir     const bool bIsNumRuleItemAffected =
380cdf0e10cSrcweir                 rSet.GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET;
381cdf0e10cSrcweir     if ( bIsNumRuleItemAffected )
382cdf0e10cSrcweir     {
383cdf0e10cSrcweir         TxtFmtCollFunc::RemoveFromNumRule( *this );
384cdf0e10cSrcweir     }
385cdf0e10cSrcweir 
386cdf0e10cSrcweir     const sal_Bool bRet = SwFmtColl::SetFmtAttr( rSet );
387cdf0e10cSrcweir 
388cdf0e10cSrcweir     if ( bIsNumRuleItemAffected )
389cdf0e10cSrcweir     {
390cdf0e10cSrcweir         TxtFmtCollFunc::AddToNumRule( *this );
391cdf0e10cSrcweir     }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir     return bRet;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir 
ResetFmtAttr(sal_uInt16 nWhich1,sal_uInt16 nWhich2)396cdf0e10cSrcweir sal_Bool SwTxtFmtColl::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
397cdf0e10cSrcweir {
398cdf0e10cSrcweir     const bool bIsNumRuleItemAffected =
399cdf0e10cSrcweir                 ( nWhich2 != 0 && nWhich2 > nWhich1 )
400cdf0e10cSrcweir                 ? ( nWhich1 <= RES_PARATR_NUMRULE &&
401cdf0e10cSrcweir                     RES_PARATR_NUMRULE <= nWhich2 )
402cdf0e10cSrcweir                 : nWhich1 == RES_PARATR_NUMRULE;
403cdf0e10cSrcweir     if ( bIsNumRuleItemAffected )
404cdf0e10cSrcweir     {
405cdf0e10cSrcweir         TxtFmtCollFunc::RemoveFromNumRule( *this );
406cdf0e10cSrcweir     }
407cdf0e10cSrcweir 
408cdf0e10cSrcweir     const sal_Bool bRet = SwFmtColl::ResetFmtAttr( nWhich1, nWhich2 );
409cdf0e10cSrcweir 
410cdf0e10cSrcweir     return bRet;
411cdf0e10cSrcweir }
412cdf0e10cSrcweir // <--
413cdf0e10cSrcweir 
414*808c4840SOliver-Rainer Wittmann 
ResetAllFmtAttr()415cdf0e10cSrcweir sal_uInt16 SwTxtFmtColl::ResetAllFmtAttr()
416cdf0e10cSrcweir {
417cdf0e10cSrcweir     const bool bOldState( mbStayAssignedToListLevelOfOutlineStyle );
418cdf0e10cSrcweir     mbStayAssignedToListLevelOfOutlineStyle = true;
419cdf0e10cSrcweir     // Outline level is no longer a member, it is a attribute now.
420cdf0e10cSrcweir     // Thus, it needs to be restored, if the paragraph style is assigned
421cdf0e10cSrcweir     // to the outline style
422cdf0e10cSrcweir     const int nAssignedOutlineStyleLevel = IsAssignedToListLevelOfOutlineStyle()
423cdf0e10cSrcweir                                      ? GetAssignedOutlineStyleLevel()
424cdf0e10cSrcweir                                      : -1;
425cdf0e10cSrcweir 
426cdf0e10cSrcweir     sal_uInt16 nRet = SwFmtColl::ResetAllFmtAttr();
427cdf0e10cSrcweir 
428cdf0e10cSrcweir     if ( nAssignedOutlineStyleLevel != -1 )
429cdf0e10cSrcweir     {
430cdf0e10cSrcweir         AssignToListLevelOfOutlineStyle( nAssignedOutlineStyleLevel );
431cdf0e10cSrcweir     }
432cdf0e10cSrcweir 
433cdf0e10cSrcweir     mbStayAssignedToListLevelOfOutlineStyle = bOldState;
434cdf0e10cSrcweir 
435cdf0e10cSrcweir     return nRet;
436cdf0e10cSrcweir }
437cdf0e10cSrcweir // <--
438cdf0e10cSrcweir 
439cdf0e10cSrcweir // --> OD 2008-02-13 #newlistlevelattrs#
AreListLevelIndentsApplicable() const440cdf0e10cSrcweir bool SwTxtFmtColl::AreListLevelIndentsApplicable() const
441cdf0e10cSrcweir {
442cdf0e10cSrcweir     bool bAreListLevelIndentsApplicable( true );
443cdf0e10cSrcweir 
444cdf0e10cSrcweir     if ( GetItemState( RES_PARATR_NUMRULE ) != SFX_ITEM_SET )
445cdf0e10cSrcweir     {
446cdf0e10cSrcweir         // no list style applied to paragraph style
447cdf0e10cSrcweir         bAreListLevelIndentsApplicable = false;
448cdf0e10cSrcweir     }
449cdf0e10cSrcweir     else if ( GetItemState( RES_LR_SPACE, sal_False ) == SFX_ITEM_SET )
450cdf0e10cSrcweir     {
451cdf0e10cSrcweir         // paragraph style has hard-set indent attributes
452cdf0e10cSrcweir         bAreListLevelIndentsApplicable = false;
453cdf0e10cSrcweir     }
454cdf0e10cSrcweir     else if ( GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET )
455cdf0e10cSrcweir     {
456cdf0e10cSrcweir         // list style is directly applied to paragraph style and paragraph
457cdf0e10cSrcweir         // style has no hard-set indent attributes
458cdf0e10cSrcweir         bAreListLevelIndentsApplicable = true;
459cdf0e10cSrcweir     }
460cdf0e10cSrcweir     else
461cdf0e10cSrcweir     {
462cdf0e10cSrcweir         // list style is applied through one of the parent paragraph styles and
463cdf0e10cSrcweir         // paragraph style has no hard-set indent attributes
464cdf0e10cSrcweir 
465cdf0e10cSrcweir         // check parent paragraph styles
466cdf0e10cSrcweir         const SwTxtFmtColl* pColl = dynamic_cast<const SwTxtFmtColl*>(DerivedFrom());
467cdf0e10cSrcweir         while ( pColl )
468cdf0e10cSrcweir         {
469cdf0e10cSrcweir             if ( pColl->GetAttrSet().GetItemState( RES_LR_SPACE, sal_False ) == SFX_ITEM_SET )
470cdf0e10cSrcweir             {
471cdf0e10cSrcweir                 // indent attributes found in the paragraph style hierarchy.
472cdf0e10cSrcweir                 bAreListLevelIndentsApplicable = false;
473cdf0e10cSrcweir                 break;
474cdf0e10cSrcweir             }
475cdf0e10cSrcweir 
476cdf0e10cSrcweir             if ( pColl->GetAttrSet().GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_SET )
477cdf0e10cSrcweir             {
478cdf0e10cSrcweir                 // paragraph style with the list style found and until now no
479cdf0e10cSrcweir                 // indent attributes are found in the paragraph style hierarchy.
480cdf0e10cSrcweir                 bAreListLevelIndentsApplicable = true;
481cdf0e10cSrcweir                 break;
482cdf0e10cSrcweir             }
483cdf0e10cSrcweir 
484cdf0e10cSrcweir             pColl = dynamic_cast<const SwTxtFmtColl*>(pColl->DerivedFrom());
485cdf0e10cSrcweir             ASSERT( pColl,
486cdf0e10cSrcweir                     "<SwTxtFmtColl::AreListLevelIndentsApplicable()> - something wrong in paragraph style hierarchy. The applied list style is not found." );
487cdf0e10cSrcweir         }
488cdf0e10cSrcweir     }
489cdf0e10cSrcweir 
490cdf0e10cSrcweir     return bAreListLevelIndentsApplicable;
491cdf0e10cSrcweir }
492cdf0e10cSrcweir // <--
493cdf0e10cSrcweir 
494cdf0e10cSrcweir //FEATURE::CONDCOLL
495cdf0e10cSrcweir 
SwCollCondition(SwTxtFmtColl * pColl,sal_uLong nMasterCond,sal_uLong nSubCond)496cdf0e10cSrcweir SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
497cdf0e10cSrcweir 								sal_uLong nSubCond )
498cdf0e10cSrcweir 	: SwClient( pColl ), nCondition( nMasterCond )
499cdf0e10cSrcweir {
500cdf0e10cSrcweir 	aSubCondition.nSubCondition = nSubCond;
501cdf0e10cSrcweir }
502cdf0e10cSrcweir 
503cdf0e10cSrcweir 
SwCollCondition(SwTxtFmtColl * pColl,sal_uLong nMasterCond,const String & rSubExp)504cdf0e10cSrcweir SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
505cdf0e10cSrcweir 									const String& rSubExp )
506cdf0e10cSrcweir 	: SwClient( pColl ), nCondition( nMasterCond )
507cdf0e10cSrcweir {
508cdf0e10cSrcweir 	if( USRFLD_EXPRESSION & nCondition )
509cdf0e10cSrcweir 		aSubCondition.pFldExpression = new String( rSubExp );
510cdf0e10cSrcweir 	else
511cdf0e10cSrcweir 		aSubCondition.nSubCondition = 0;
512cdf0e10cSrcweir }
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 
SwCollCondition(const SwCollCondition & rCopy)515cdf0e10cSrcweir SwCollCondition::SwCollCondition( const SwCollCondition& rCopy )
516cdf0e10cSrcweir 	: SwClient( (SwModify*)rCopy.GetRegisteredIn() ), nCondition( rCopy.nCondition )
517cdf0e10cSrcweir {
518cdf0e10cSrcweir 	if( USRFLD_EXPRESSION & rCopy.nCondition )
519cdf0e10cSrcweir 		aSubCondition.pFldExpression = new String( *rCopy.GetFldExpression() );
520cdf0e10cSrcweir 	else
521cdf0e10cSrcweir 		aSubCondition.nSubCondition = rCopy.aSubCondition.nSubCondition;
522cdf0e10cSrcweir }
523cdf0e10cSrcweir 
524cdf0e10cSrcweir 
~SwCollCondition()525cdf0e10cSrcweir SwCollCondition::~SwCollCondition()
526cdf0e10cSrcweir {
527cdf0e10cSrcweir 	if( USRFLD_EXPRESSION & nCondition )
528cdf0e10cSrcweir 		delete aSubCondition.pFldExpression;
529cdf0e10cSrcweir }
530cdf0e10cSrcweir 
RegisterToFormat(SwFmt & rFmt)531cdf0e10cSrcweir void SwCollCondition::RegisterToFormat( SwFmt& rFmt )
532cdf0e10cSrcweir {
533cdf0e10cSrcweir     rFmt.Add( this );
534cdf0e10cSrcweir }
535cdf0e10cSrcweir 
536cdf0e10cSrcweir 
537cdf0e10cSrcweir 
operator ==(const SwCollCondition & rCmp) const538cdf0e10cSrcweir int SwCollCondition::operator==( const SwCollCondition& rCmp ) const
539cdf0e10cSrcweir {
540cdf0e10cSrcweir 	int nRet = 0;
541cdf0e10cSrcweir 	if( nCondition == rCmp.nCondition )
542cdf0e10cSrcweir 	{
543cdf0e10cSrcweir 		if( USRFLD_EXPRESSION & nCondition )
544cdf0e10cSrcweir 		{
545cdf0e10cSrcweir 			// in der SubCondition steht die Expression fuer das UserFeld
546cdf0e10cSrcweir 			const String* pTmp = aSubCondition.pFldExpression;
547cdf0e10cSrcweir 			if( !pTmp )
548cdf0e10cSrcweir 				pTmp = rCmp.aSubCondition.pFldExpression;
549cdf0e10cSrcweir 			if( pTmp )
550cdf0e10cSrcweir 			{
551cdf0e10cSrcweir 				SwTxtFmtColl* pColl = GetTxtFmtColl();
552cdf0e10cSrcweir 				if( !pColl )
553cdf0e10cSrcweir 					pColl = rCmp.GetTxtFmtColl();
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 				if( pColl )
556cdf0e10cSrcweir 				{
557cdf0e10cSrcweir 					SwCalc aCalc( *pColl->GetDoc() );
558cdf0e10cSrcweir 					nRet = 0 != aCalc.Calculate( *pTmp ).GetBool();
559cdf0e10cSrcweir 				}
560cdf0e10cSrcweir 			}
561cdf0e10cSrcweir 		}
562cdf0e10cSrcweir 		else if( aSubCondition.nSubCondition ==
563cdf0e10cSrcweir 					rCmp.aSubCondition.nSubCondition )
564cdf0e10cSrcweir 			nRet = 1;
565cdf0e10cSrcweir 	}
566cdf0e10cSrcweir 	return nRet;
567cdf0e10cSrcweir }
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 
SetCondition(sal_uLong nCond,sal_uLong nSubCond)570cdf0e10cSrcweir void SwCollCondition::SetCondition( sal_uLong nCond, sal_uLong nSubCond )
571cdf0e10cSrcweir {
572cdf0e10cSrcweir 	if( USRFLD_EXPRESSION & nCondition )
573cdf0e10cSrcweir 		delete aSubCondition.pFldExpression;
574cdf0e10cSrcweir 	nCondition = nCond;
575cdf0e10cSrcweir 	aSubCondition.nSubCondition = nSubCond;
576cdf0e10cSrcweir }
577cdf0e10cSrcweir 
578cdf0e10cSrcweir 
~SwConditionTxtFmtColl()579cdf0e10cSrcweir SwConditionTxtFmtColl::~SwConditionTxtFmtColl()
580cdf0e10cSrcweir {
581cdf0e10cSrcweir }
582cdf0e10cSrcweir 
HasCondition(const SwCollCondition & rCond) const583cdf0e10cSrcweir const SwCollCondition* SwConditionTxtFmtColl::HasCondition(
584cdf0e10cSrcweir 						const SwCollCondition& rCond ) const
585cdf0e10cSrcweir {
586cdf0e10cSrcweir 	const SwCollCondition* pFnd = 0;
587cdf0e10cSrcweir 	sal_uInt16 n;
588cdf0e10cSrcweir 
589cdf0e10cSrcweir 	for( n = 0; n < aCondColls.Count(); ++n )
590cdf0e10cSrcweir 		if( *( pFnd = aCondColls[ n ]) == rCond )
591cdf0e10cSrcweir 			break;
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 	return n < aCondColls.Count() ? pFnd : 0;
594cdf0e10cSrcweir }
595cdf0e10cSrcweir 
596cdf0e10cSrcweir 
InsertCondition(const SwCollCondition & rCond)597cdf0e10cSrcweir void SwConditionTxtFmtColl::InsertCondition( const SwCollCondition& rCond )
598cdf0e10cSrcweir {
599cdf0e10cSrcweir 	for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n )
600cdf0e10cSrcweir 		if( *aCondColls[ n ] == rCond )
601cdf0e10cSrcweir 		{
602cdf0e10cSrcweir 			aCondColls.DeleteAndDestroy( n );
603cdf0e10cSrcweir 			break;
604cdf0e10cSrcweir 		}
605cdf0e10cSrcweir 
606cdf0e10cSrcweir 	// nicht gefunden -> als einfuegen
607cdf0e10cSrcweir 	SwCollCondition* pNew = new SwCollCondition( rCond );
608cdf0e10cSrcweir 	aCondColls.Insert( pNew, aCondColls.Count() );
609cdf0e10cSrcweir }
610cdf0e10cSrcweir 
611cdf0e10cSrcweir 
RemoveCondition(const SwCollCondition & rCond)612cdf0e10cSrcweir sal_Bool SwConditionTxtFmtColl::RemoveCondition( const SwCollCondition& rCond )
613cdf0e10cSrcweir {
614cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
615cdf0e10cSrcweir 	for( sal_uInt16 n = 0; n < aCondColls.Count(); ++n )
616cdf0e10cSrcweir 		if( *aCondColls[ n ] == rCond )
617cdf0e10cSrcweir 		{
618cdf0e10cSrcweir 			aCondColls.DeleteAndDestroy( n );
619cdf0e10cSrcweir 			bRet = sal_True;
620cdf0e10cSrcweir 		}
621cdf0e10cSrcweir 
622cdf0e10cSrcweir 	return bRet;
623cdf0e10cSrcweir }
624cdf0e10cSrcweir 
SetConditions(const SwFmtCollConditions & rCndClls)625cdf0e10cSrcweir void SwConditionTxtFmtColl::SetConditions( const SwFmtCollConditions& rCndClls )
626cdf0e10cSrcweir {
627cdf0e10cSrcweir 	// Kopiere noch die Bedingungen
628cdf0e10cSrcweir 	// aber erst die alten loeschen!
629cdf0e10cSrcweir 	if( aCondColls.Count() )
630cdf0e10cSrcweir 		aCondColls.DeleteAndDestroy( 0, aCondColls.Count() );
631cdf0e10cSrcweir 	SwDoc& rDoc = *GetDoc();
632cdf0e10cSrcweir 	for( sal_uInt16 n = 0; n < rCndClls.Count(); ++n )
633cdf0e10cSrcweir 	{
634cdf0e10cSrcweir 		SwCollCondition* pFnd = rCndClls[ n ];
635cdf0e10cSrcweir 		SwTxtFmtColl* pTmpColl = pFnd->GetTxtFmtColl()
636cdf0e10cSrcweir 									? rDoc.CopyTxtColl( *pFnd->GetTxtFmtColl() )
637cdf0e10cSrcweir 									: 0;
638cdf0e10cSrcweir 		SwCollCondition* pNew;
639cdf0e10cSrcweir 		if( USRFLD_EXPRESSION & pFnd->GetCondition() )
640cdf0e10cSrcweir 			pNew = new SwCollCondition( pTmpColl, pFnd->GetCondition(),
641cdf0e10cSrcweir 										*pFnd->GetFldExpression() );
642cdf0e10cSrcweir 		else
643cdf0e10cSrcweir 			pNew = new SwCollCondition( pTmpColl, pFnd->GetCondition(),
644cdf0e10cSrcweir 										pFnd->GetSubCondition() );
645cdf0e10cSrcweir 		aCondColls.Insert( pNew, n );
646cdf0e10cSrcweir 	}
647cdf0e10cSrcweir }
648*808c4840SOliver-Rainer Wittmann //FEATURE::CONDCOLL
649*808c4840SOliver-Rainer Wittmann 
650*808c4840SOliver-Rainer Wittmann 
SetAttrOutlineLevel(int nLevel)651cdf0e10cSrcweir void SwTxtFmtColl::SetAttrOutlineLevel( int nLevel)
652cdf0e10cSrcweir {
653cdf0e10cSrcweir     ASSERT( 0 <= nLevel && nLevel <= MAXLEVEL ,"SwTxtFmtColl: Level Out Of Range" );
654cdf0e10cSrcweir     SetFmtAttr( SfxUInt16Item( RES_PARATR_OUTLINELEVEL,
655cdf0e10cSrcweir                             static_cast<sal_uInt16>(nLevel) ) );
656cdf0e10cSrcweir }
657cdf0e10cSrcweir 
658*808c4840SOliver-Rainer Wittmann 
GetAttrOutlineLevel() const659cdf0e10cSrcweir int SwTxtFmtColl::GetAttrOutlineLevel() const
660cdf0e10cSrcweir {
661cdf0e10cSrcweir     return ( (const SfxUInt16Item &) GetFmtAttr( RES_PARATR_OUTLINELEVEL ) ).GetValue();
662cdf0e10cSrcweir }
663cdf0e10cSrcweir 
664*808c4840SOliver-Rainer Wittmann 
GetAssignedOutlineStyleLevel() const665cdf0e10cSrcweir int SwTxtFmtColl::GetAssignedOutlineStyleLevel() const
666cdf0e10cSrcweir {
667cdf0e10cSrcweir     ASSERT( IsAssignedToListLevelOfOutlineStyle(),
668cdf0e10cSrcweir             "<SwTxtFmtColl::GetAssignedOutlineStyleLevel()> - misuse of method" );
669cdf0e10cSrcweir     return GetAttrOutlineLevel() - 1;
670cdf0e10cSrcweir }
671cdf0e10cSrcweir 
672*808c4840SOliver-Rainer Wittmann 
AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)673cdf0e10cSrcweir void SwTxtFmtColl::AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
674cdf0e10cSrcweir {
675cdf0e10cSrcweir     mbAssignedToOutlineStyle = true;
676cdf0e10cSrcweir     SetAttrOutlineLevel( nAssignedListLevel + 1 );
677cdf0e10cSrcweir 
678cdf0e10cSrcweir     SwIterator<SwTxtFmtColl,SwFmtColl> aIter( *this );
679cdf0e10cSrcweir     SwTxtFmtColl* pDerivedTxtFmtColl = aIter.First();
680cdf0e10cSrcweir     while ( pDerivedTxtFmtColl != 0 )
681cdf0e10cSrcweir     {
682cdf0e10cSrcweir         if ( !pDerivedTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() )
683cdf0e10cSrcweir         {
684cdf0e10cSrcweir             if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_NUMRULE, sal_False ) == SFX_ITEM_DEFAULT )
685cdf0e10cSrcweir             {
686cdf0e10cSrcweir                 SwNumRuleItem aItem(aEmptyStr);
687cdf0e10cSrcweir                 pDerivedTxtFmtColl->SetFmtAttr( aItem );
688cdf0e10cSrcweir             }
689cdf0e10cSrcweir             if ( pDerivedTxtFmtColl->GetItemState( RES_PARATR_OUTLINELEVEL, sal_False ) == SFX_ITEM_DEFAULT )
690cdf0e10cSrcweir             {
691cdf0e10cSrcweir                 pDerivedTxtFmtColl->SetAttrOutlineLevel( 0 );
692cdf0e10cSrcweir             }
693cdf0e10cSrcweir         }
694cdf0e10cSrcweir 
695cdf0e10cSrcweir         pDerivedTxtFmtColl = aIter.Next();
696cdf0e10cSrcweir     }
697cdf0e10cSrcweir }
698cdf0e10cSrcweir 
699*808c4840SOliver-Rainer Wittmann 
DeleteAssignmentToListLevelOfOutlineStyle(const bool bResetOutlineLevel)700*808c4840SOliver-Rainer Wittmann void SwTxtFmtColl::DeleteAssignmentToListLevelOfOutlineStyle(
701*808c4840SOliver-Rainer Wittmann     const bool bResetOutlineLevel )
702cdf0e10cSrcweir {
703cdf0e10cSrcweir     mbAssignedToOutlineStyle = false;
704*808c4840SOliver-Rainer Wittmann     if ( bResetOutlineLevel )
705*808c4840SOliver-Rainer Wittmann     {
706cdf0e10cSrcweir         ResetFmtAttr( RES_PARATR_OUTLINELEVEL );
707cdf0e10cSrcweir     }
708*808c4840SOliver-Rainer Wittmann }
709cdf0e10cSrcweir 
710