xref: /aoo41x/main/sw/source/core/attr/swatrset.cxx (revision efeef26f)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*efeef26fSAndrew Rist  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19*efeef26fSAndrew Rist  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <hintids.hxx>
29cdf0e10cSrcweir #include <svl/whiter.hxx>
30cdf0e10cSrcweir #include <editeng/colritem.hxx>
31cdf0e10cSrcweir #include <editeng/brshitem.hxx>
32cdf0e10cSrcweir #include <editeng/bolnitem.hxx>
33cdf0e10cSrcweir #include <editeng/boxitem.hxx>
34cdf0e10cSrcweir #include <svx/xtable.hxx>
35cdf0e10cSrcweir #include <fmtpdsc.hxx>
36cdf0e10cSrcweir #include <pagedesc.hxx>
37cdf0e10cSrcweir #include <charfmt.hxx>
38cdf0e10cSrcweir #include <doc.hxx>
39cdf0e10cSrcweir #include <node.hxx>
40cdf0e10cSrcweir #include <paratr.hxx>		// fuer SetModifyAtAttr
41cdf0e10cSrcweir #include <cellatr.hxx>		// fuer SetModifyAtAttr
42cdf0e10cSrcweir #ifndef _CMDID_H
43cdf0e10cSrcweir #include <cmdid.h>
44cdf0e10cSrcweir #endif
45cdf0e10cSrcweir #include <istyleaccess.hxx>
46cdf0e10cSrcweir #include <numrule.hxx>
47cdf0e10cSrcweir // --> OD 2008-03-19 #refactorlists#
48cdf0e10cSrcweir #include <list.hxx>
49cdf0e10cSrcweir // <--
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
SwAttrPool(SwDoc * pD)52cdf0e10cSrcweir SwAttrPool::SwAttrPool( SwDoc* pD )
53cdf0e10cSrcweir 	: SfxItemPool( String::CreateFromAscii(
54cdf0e10cSrcweir 								RTL_CONSTASCII_STRINGPARAM( "SWG" )),
55cdf0e10cSrcweir 					POOLATTR_BEGIN, POOLATTR_END-1,
56cdf0e10cSrcweir 					aSlotTab, aAttrTab ),
57cdf0e10cSrcweir 	pDoc( pD )
58cdf0e10cSrcweir {
59cdf0e10cSrcweir 	SetVersionMap( 1, 1, 60, pVersionMap1 );
60cdf0e10cSrcweir 	SetVersionMap( 2, 1, 75, pVersionMap2 );
61cdf0e10cSrcweir 	SetVersionMap( 3, 1, 86, pVersionMap3 );
62cdf0e10cSrcweir 	SetVersionMap( 4, 1,121, pVersionMap4 );
63cdf0e10cSrcweir     // OD 2004-01-21 #i18732# - apply new version map
64cdf0e10cSrcweir     SetVersionMap( 5, 1,130, pVersionMap5 );
65cdf0e10cSrcweir     SetVersionMap( 6, 1,136, pVersionMap6 );
66cdf0e10cSrcweir }
67cdf0e10cSrcweir 
~SwAttrPool()68cdf0e10cSrcweir SwAttrPool::~SwAttrPool()
69cdf0e10cSrcweir {
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
SwAttrSet(SwAttrPool & rPool,sal_uInt16 nWh1,sal_uInt16 nWh2)72cdf0e10cSrcweir SwAttrSet::SwAttrSet( SwAttrPool& rPool, sal_uInt16 nWh1, sal_uInt16 nWh2 )
73cdf0e10cSrcweir 	: SfxItemSet( rPool, nWh1, nWh2 ), pOldSet( 0 ), pNewSet( 0 )
74cdf0e10cSrcweir {
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 
SwAttrSet(SwAttrPool & rPool,const sal_uInt16 * nWhichPairTable)78cdf0e10cSrcweir SwAttrSet::SwAttrSet( SwAttrPool& rPool, const sal_uInt16* nWhichPairTable )
79cdf0e10cSrcweir 	: SfxItemSet( rPool, nWhichPairTable ), pOldSet( 0 ), pNewSet( 0 )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir }
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
SwAttrSet(const SwAttrSet & rSet)84cdf0e10cSrcweir SwAttrSet::SwAttrSet( const SwAttrSet& rSet )
85cdf0e10cSrcweir 	: SfxItemSet( rSet ), pOldSet( 0 ), pNewSet( 0 )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir }
88cdf0e10cSrcweir 
Clone(sal_Bool bItems,SfxItemPool * pToPool) const89cdf0e10cSrcweir SfxItemSet* SwAttrSet::Clone( sal_Bool bItems, SfxItemPool *pToPool ) const
90cdf0e10cSrcweir {
91cdf0e10cSrcweir     if ( pToPool && pToPool != GetPool() )
92cdf0e10cSrcweir     {
93cdf0e10cSrcweir         SwAttrPool* pAttrPool = dynamic_cast< SwAttrPool* >(pToPool);
94cdf0e10cSrcweir         SfxItemSet* pTmpSet = 0;
95cdf0e10cSrcweir         if ( !pAttrPool )
96cdf0e10cSrcweir             pTmpSet = SfxItemSet::Clone( bItems, pToPool );
97cdf0e10cSrcweir         else
98cdf0e10cSrcweir         {
99cdf0e10cSrcweir             pTmpSet = new SwAttrSet( *pAttrPool, GetRanges() );
100cdf0e10cSrcweir             if ( bItems )
101cdf0e10cSrcweir             {
102cdf0e10cSrcweir                 SfxWhichIter aIter(*pTmpSet);
103cdf0e10cSrcweir                 sal_uInt16 nWhich = aIter.FirstWhich();
104cdf0e10cSrcweir                 while ( nWhich )
105cdf0e10cSrcweir                 {
106cdf0e10cSrcweir                     const SfxPoolItem* pItem;
107cdf0e10cSrcweir                     if ( SFX_ITEM_SET == GetItemState( nWhich, sal_False, &pItem ) )
108cdf0e10cSrcweir                         pTmpSet->Put( *pItem, pItem->Which() );
109cdf0e10cSrcweir                     nWhich = aIter.NextWhich();
110cdf0e10cSrcweir                 }
111cdf0e10cSrcweir             }
112cdf0e10cSrcweir         }
113cdf0e10cSrcweir         return pTmpSet;
114cdf0e10cSrcweir     }
115cdf0e10cSrcweir     else
116cdf0e10cSrcweir         return bItems
117cdf0e10cSrcweir                 ? new SwAttrSet( *this )
118cdf0e10cSrcweir                 : new SwAttrSet( *GetPool(), GetRanges() );
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
Put_BC(const SfxPoolItem & rAttr,SwAttrSet * pOld,SwAttrSet * pNew)121cdf0e10cSrcweir int SwAttrSet::Put_BC( const SfxPoolItem& rAttr,
122cdf0e10cSrcweir 					SwAttrSet* pOld, SwAttrSet* pNew )
123cdf0e10cSrcweir {
124cdf0e10cSrcweir 	pNewSet = pNew;
125cdf0e10cSrcweir 	pOldSet = pOld;
126cdf0e10cSrcweir 	int nRet = 0 != SfxItemSet::Put( rAttr );
127cdf0e10cSrcweir 	pOldSet = pNewSet = 0;
128cdf0e10cSrcweir 	return nRet;
129cdf0e10cSrcweir }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 
Put_BC(const SfxItemSet & rSet,SwAttrSet * pOld,SwAttrSet * pNew)132cdf0e10cSrcweir int SwAttrSet::Put_BC( const SfxItemSet& rSet,
133cdf0e10cSrcweir 					SwAttrSet* pOld, SwAttrSet* pNew )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir 	pNewSet = pNew;
136cdf0e10cSrcweir 	pOldSet = pOld;
137cdf0e10cSrcweir 	int nRet = 0 != SfxItemSet::Put( rSet );
138cdf0e10cSrcweir 	pOldSet = pNewSet = 0;
139cdf0e10cSrcweir 	return nRet;
140cdf0e10cSrcweir }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 
ClearItem_BC(sal_uInt16 nWhich,SwAttrSet * pOld,SwAttrSet * pNew)144cdf0e10cSrcweir sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich,
145cdf0e10cSrcweir 						SwAttrSet* pOld, SwAttrSet* pNew )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir 	pNewSet = pNew;
148cdf0e10cSrcweir 	pOldSet = pOld;
149cdf0e10cSrcweir 	sal_uInt16 nRet = SfxItemSet::ClearItem( nWhich );
150cdf0e10cSrcweir 	pOldSet = pNewSet = 0;
151cdf0e10cSrcweir 	return nRet;
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 
ClearItem_BC(sal_uInt16 nWhich1,sal_uInt16 nWhich2,SwAttrSet * pOld,SwAttrSet * pNew)155cdf0e10cSrcweir sal_uInt16 SwAttrSet::ClearItem_BC( sal_uInt16 nWhich1, sal_uInt16 nWhich2,
156cdf0e10cSrcweir 						SwAttrSet* pOld, SwAttrSet* pNew )
157cdf0e10cSrcweir {
158cdf0e10cSrcweir 	ASSERT( nWhich1 <= nWhich2, "kein gueltiger Bereich" );
159cdf0e10cSrcweir 	pNewSet = pNew;
160cdf0e10cSrcweir 	pOldSet = pOld;
161cdf0e10cSrcweir 	sal_uInt16 nRet = 0;
162cdf0e10cSrcweir 	for( ; nWhich1 <= nWhich2; ++nWhich1 )
163cdf0e10cSrcweir 		nRet = nRet + SfxItemSet::ClearItem( nWhich1 );
164cdf0e10cSrcweir 	pOldSet = pNewSet = 0;
165cdf0e10cSrcweir 	return nRet;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 
Intersect_BC(const SfxItemSet & rSet,SwAttrSet * pOld,SwAttrSet * pNew)170cdf0e10cSrcweir int SwAttrSet::Intersect_BC( const SfxItemSet& rSet,
171cdf0e10cSrcweir 							SwAttrSet* pOld, SwAttrSet* pNew )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir 	pNewSet = pNew;
174cdf0e10cSrcweir 	pOldSet = pOld;
175cdf0e10cSrcweir 	SfxItemSet::Intersect( rSet );
176cdf0e10cSrcweir 	pOldSet = pNewSet = 0;
177cdf0e10cSrcweir 	return pNew ? pNew->Count() : ( pOld ? pOld->Count() : 0 );
178cdf0e10cSrcweir }
179cdf0e10cSrcweir 
180cdf0e10cSrcweir // Notification-Callback
Changed(const SfxPoolItem & rOld,const SfxPoolItem & rNew)181cdf0e10cSrcweir void  SwAttrSet::Changed( const SfxPoolItem& rOld,
182cdf0e10cSrcweir 								const SfxPoolItem& rNew )
183cdf0e10cSrcweir {
184cdf0e10cSrcweir 	if( pOldSet )
185cdf0e10cSrcweir 		pOldSet->PutChgd( rOld );
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 	if( pNewSet )
188cdf0e10cSrcweir 		pNewSet->PutChgd( rNew );
189cdf0e10cSrcweir }
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 
192cdf0e10cSrcweir // ----------------------------------------------------------------
193cdf0e10cSrcweir // Sonderbehandlung fuer einige Attribute
194cdf0e10cSrcweir // Setze den Modify-Pointer (alten pDefinedIn) bei folgenden Attributen:
195cdf0e10cSrcweir //	- SwFmtDropCaps
196cdf0e10cSrcweir //	- SwFmtPageDesc
197cdf0e10cSrcweir // (Wird beim Einfuegen in Formate/Nodes gerufen)
198cdf0e10cSrcweir // ----------------------------------------------------------------
199cdf0e10cSrcweir 
SetModifyAtAttr(const SwModify * pModify)200cdf0e10cSrcweir bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir     bool bSet = false;
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 	const SfxPoolItem* pItem;
205cdf0e10cSrcweir 	if( SFX_ITEM_SET == GetItemState( RES_PAGEDESC, sal_False, &pItem ) &&
206cdf0e10cSrcweir 		((SwFmtPageDesc*)pItem)->GetDefinedIn() != pModify  )
207cdf0e10cSrcweir 	{
208cdf0e10cSrcweir 		((SwFmtPageDesc*)pItem)->ChgDefinedIn( pModify );
209cdf0e10cSrcweir         bSet = true;
210cdf0e10cSrcweir 	}
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 	if( SFX_ITEM_SET == GetItemState( RES_PARATR_DROP, sal_False, &pItem ) &&
213cdf0e10cSrcweir 		((SwFmtDrop*)pItem)->GetDefinedIn() != pModify )
214cdf0e10cSrcweir 	{
215cdf0e10cSrcweir 		// CharFormat gesetzt und dann noch in unterschiedlichen
216cdf0e10cSrcweir 		// Attribut Pools, dann muss das CharFormat kopiert werden!
217cdf0e10cSrcweir 		SwCharFmt* pCharFmt;
218cdf0e10cSrcweir 		if( 0 != ( pCharFmt = ((SwFmtDrop*)pItem)->GetCharFmt() )
219cdf0e10cSrcweir 			&& GetPool() != pCharFmt->GetAttrSet().GetPool() )
220cdf0e10cSrcweir 		{
221cdf0e10cSrcweir            pCharFmt = GetDoc()->CopyCharFmt( *pCharFmt );
222cdf0e10cSrcweir            ((SwFmtDrop*)pItem)->SetCharFmt( pCharFmt );
223cdf0e10cSrcweir 		}
224cdf0e10cSrcweir 		((SwFmtDrop*)pItem)->ChgDefinedIn( pModify );
225cdf0e10cSrcweir         bSet = true;
226cdf0e10cSrcweir     }
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	if( SFX_ITEM_SET == GetItemState( RES_BOXATR_FORMULA, sal_False, &pItem ) &&
229cdf0e10cSrcweir 		((SwTblBoxFormula*)pItem)->GetDefinedIn() != pModify )
230cdf0e10cSrcweir 	{
231cdf0e10cSrcweir 		((SwTblBoxFormula*)pItem)->ChgDefinedIn( pModify );
232cdf0e10cSrcweir         bSet = true;
233cdf0e10cSrcweir     }
234cdf0e10cSrcweir 
235cdf0e10cSrcweir     return bSet;
236cdf0e10cSrcweir }
237cdf0e10cSrcweir 
CopyToModify(SwModify & rMod) const238cdf0e10cSrcweir void SwAttrSet::CopyToModify( SwModify& rMod ) const
239cdf0e10cSrcweir {
240cdf0e10cSrcweir 	// kopiere die Attribute ggfs. ueber Dokumentgrenzen
241cdf0e10cSrcweir 	SwCntntNode* pCNd = PTR_CAST( SwCntntNode, &rMod );
242cdf0e10cSrcweir 	SwFmt* pFmt = PTR_CAST( SwFmt, &rMod );
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	if( pCNd || pFmt )
245cdf0e10cSrcweir 	{
246cdf0e10cSrcweir 		if( Count() )
247cdf0e10cSrcweir 		{
248cdf0e10cSrcweir             // --> OD 2008-08-15 #i92811#
249cdf0e10cSrcweir             SfxStringItem* pNewListIdItem( 0 );
250cdf0e10cSrcweir             // <--
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 			const SfxPoolItem* pItem;
253cdf0e10cSrcweir 			const SwDoc *pSrcDoc = GetDoc();
254cdf0e10cSrcweir 			SwDoc *pDstDoc = pCNd ? pCNd->GetDoc() : pFmt->GetDoc();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 			// muss die NumRule kopiert werden?
257cdf0e10cSrcweir 			if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
258cdf0e10cSrcweir 									RES_PARATR_NUMRULE, sal_False, &pItem ) )
259cdf0e10cSrcweir 			{
260cdf0e10cSrcweir 				const String& rNm = ((SwNumRuleItem*)pItem)->GetValue();
261cdf0e10cSrcweir 				if( rNm.Len() )
262cdf0e10cSrcweir 				{
263cdf0e10cSrcweir 					SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( rNm );
264cdf0e10cSrcweir 					if( pDestRule )
265cdf0e10cSrcweir 						pDestRule->SetInvalidRule( sal_True );
266cdf0e10cSrcweir 					else
267cdf0e10cSrcweir 						pDstDoc->MakeNumRule( rNm,
268cdf0e10cSrcweir 											pSrcDoc->FindNumRulePtr( rNm ) );
269cdf0e10cSrcweir 				}
270cdf0e10cSrcweir 			}
271cdf0e10cSrcweir 
272cdf0e10cSrcweir             // --> OD 2008-03-19 #refactorlists#
273cdf0e10cSrcweir             // copy list and if needed also the corresponding list style
274cdf0e10cSrcweir             // for text nodes
275cdf0e10cSrcweir             if ( pSrcDoc != pDstDoc &&
276cdf0e10cSrcweir                  pCNd && pCNd->IsTxtNode() &&
277cdf0e10cSrcweir                  GetItemState( RES_PARATR_LIST_ID, sal_False, &pItem ) == SFX_ITEM_SET )
278cdf0e10cSrcweir             {
279cdf0e10cSrcweir                 const String& sListId =
280cdf0e10cSrcweir                         dynamic_cast<const SfxStringItem*>(pItem)->GetValue();
281cdf0e10cSrcweir                 if ( sListId.Len() > 0 &&
282cdf0e10cSrcweir                      !pDstDoc->getListByName( sListId ) )
283cdf0e10cSrcweir                 {
284cdf0e10cSrcweir                     const SwList* pList = pSrcDoc->getListByName( sListId );
285cdf0e10cSrcweir                     // copy list style, if needed
286cdf0e10cSrcweir                     const String sDefaultListStyleName =
287cdf0e10cSrcweir                                             pList->GetDefaultListStyleName();
288cdf0e10cSrcweir                     // --> OD 2008-08-15 #i92811#
289cdf0e10cSrcweir                     const SwNumRule* pDstDocNumRule =
290cdf0e10cSrcweir                                 pDstDoc->FindNumRulePtr( sDefaultListStyleName );
291cdf0e10cSrcweir                     if ( !pDstDocNumRule )
292cdf0e10cSrcweir                     {
293cdf0e10cSrcweir                         pDstDoc->MakeNumRule( sDefaultListStyleName,
294cdf0e10cSrcweir                                               pSrcDoc->FindNumRulePtr( sDefaultListStyleName ) );
295cdf0e10cSrcweir                     }
296cdf0e10cSrcweir                     else
297cdf0e10cSrcweir                     {
298cdf0e10cSrcweir                         const SwNumRule* pSrcDocNumRule =
299cdf0e10cSrcweir                                 pSrcDoc->FindNumRulePtr( sDefaultListStyleName );
300cdf0e10cSrcweir                         // If list id of text node equals the list style's
301cdf0e10cSrcweir                         // default list id in the source document, the same
302cdf0e10cSrcweir                         // should be hold in the destination document.
303cdf0e10cSrcweir                         // Thus, create new list id item.
304cdf0e10cSrcweir                         if ( sListId == pSrcDocNumRule->GetDefaultListId() )
305cdf0e10cSrcweir                         {
306cdf0e10cSrcweir                             pNewListIdItem = new SfxStringItem (
307cdf0e10cSrcweir                                             RES_PARATR_LIST_ID,
308cdf0e10cSrcweir                                             pDstDocNumRule->GetDefaultListId() );
309cdf0e10cSrcweir                         }
310cdf0e10cSrcweir                     }
311cdf0e10cSrcweir                     // check again, if list exist, because <SwDoc::MakeNumRule(..)>
312cdf0e10cSrcweir                     // could have also created it.
313cdf0e10cSrcweir                     if ( pNewListIdItem == 0 &&
314cdf0e10cSrcweir                          !pDstDoc->getListByName( sListId ) )
315cdf0e10cSrcweir                     {
316cdf0e10cSrcweir                         // copy list
317cdf0e10cSrcweir                         pDstDoc->createList( sListId, sDefaultListStyleName );
318cdf0e10cSrcweir                     }
319cdf0e10cSrcweir                     // <--
320cdf0e10cSrcweir                 }
321cdf0e10cSrcweir             }
322cdf0e10cSrcweir             // <--
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 			// JP 04.02.99: Task #61467# Seitenvorlagenwechsel mit kopieren
325cdf0e10cSrcweir 			//				Gegenueber dem alten Verhalten, sie zu entfernen
326cdf0e10cSrcweir 			const SwPageDesc* pPgDesc;
327cdf0e10cSrcweir 			if( pSrcDoc != pDstDoc && SFX_ITEM_SET == GetItemState(
328cdf0e10cSrcweir 											RES_PAGEDESC, sal_False, &pItem ) &&
329cdf0e10cSrcweir 				0 != ( pPgDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc()) )
330cdf0e10cSrcweir 			{
331cdf0e10cSrcweir 				SfxItemSet aTmpSet( *this );
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 				SwPageDesc* pDstPgDesc = pDstDoc->FindPageDescByName(
334cdf0e10cSrcweir 													pPgDesc->GetName() );
335cdf0e10cSrcweir 				if( !pDstPgDesc )
336cdf0e10cSrcweir 				{
337cdf0e10cSrcweir 					// dann kopieren, ansonsten den benutzen
338cdf0e10cSrcweir 					pDstPgDesc = &pDstDoc->_GetPageDesc( pDstDoc->MakePageDesc(
339cdf0e10cSrcweir 													pPgDesc->GetName() ));
340cdf0e10cSrcweir 					pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc );
341cdf0e10cSrcweir 				}
342cdf0e10cSrcweir 				SwFmtPageDesc aDesc( pDstPgDesc );
343cdf0e10cSrcweir 				aDesc.SetNumOffset( ((SwFmtPageDesc*)pItem)->GetNumOffset() );
344cdf0e10cSrcweir 				aTmpSet.Put( aDesc );
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 				if( pCNd )
347cdf0e10cSrcweir                 {
348cdf0e10cSrcweir                     // --> OD 2008-08-15 #i92811#
349cdf0e10cSrcweir                     if ( pNewListIdItem != 0 )
350cdf0e10cSrcweir                     {
351cdf0e10cSrcweir                         aTmpSet.Put( *pNewListIdItem );
352cdf0e10cSrcweir                     }
353cdf0e10cSrcweir                     // <--
354cdf0e10cSrcweir 					pCNd->SetAttr( aTmpSet );
355cdf0e10cSrcweir                 }
356cdf0e10cSrcweir 				else
357cdf0e10cSrcweir                     pFmt->SetFmtAttr( aTmpSet );
358cdf0e10cSrcweir 			}
359cdf0e10cSrcweir 			else if( pCNd )
360cdf0e10cSrcweir             {
361cdf0e10cSrcweir                 // --> OD 2008-08-15 #i92811#
362cdf0e10cSrcweir                 if ( pNewListIdItem != 0 )
363cdf0e10cSrcweir                 {
364cdf0e10cSrcweir                     SfxItemSet aTmpSet( *this );
365cdf0e10cSrcweir                     aTmpSet.Put( *pNewListIdItem );
366cdf0e10cSrcweir                     pCNd->SetAttr( aTmpSet );
367cdf0e10cSrcweir                 }
368cdf0e10cSrcweir                 else
369cdf0e10cSrcweir                 {
370cdf0e10cSrcweir                     pCNd->SetAttr( *this );
371cdf0e10cSrcweir                 }
372cdf0e10cSrcweir                 // <--
373cdf0e10cSrcweir             }
374cdf0e10cSrcweir 			else
375cdf0e10cSrcweir                 pFmt->SetFmtAttr( *this );
376cdf0e10cSrcweir 
377cdf0e10cSrcweir             // --> OD 2008-08-15 #i92811#
378cdf0e10cSrcweir             delete pNewListIdItem;
379cdf0e10cSrcweir             pNewListIdItem = 0;
380cdf0e10cSrcweir             // <--
381cdf0e10cSrcweir 		}
382cdf0e10cSrcweir 	}
383cdf0e10cSrcweir #ifdef DBG_UTIL
384cdf0e10cSrcweir 	else
385cdf0e10cSrcweir 		ASSERT( !this, "weder Format noch ContentNode - keine Attribute kopiert");
386cdf0e10cSrcweir #endif
387cdf0e10cSrcweir }
388cdf0e10cSrcweir 
389cdf0e10cSrcweir // check if ID is InRange of AttrSet-Ids
IsInRange(const sal_uInt16 * pRange,const sal_uInt16 nId)390cdf0e10cSrcweir sal_Bool IsInRange( const sal_uInt16* pRange, const sal_uInt16 nId )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir 	while( *pRange )
393cdf0e10cSrcweir 	{
394cdf0e10cSrcweir 		if( *pRange <= nId && nId <= *(pRange+1) )
395cdf0e10cSrcweir 			return sal_True;
396cdf0e10cSrcweir 		pRange += 2;
397cdf0e10cSrcweir 	}
398cdf0e10cSrcweir 	return sal_False;
399cdf0e10cSrcweir }
400cdf0e10cSrcweir 
401