xref: /aoo42x/main/sw/source/core/doc/poolfmt.cxx (revision ac591d86)
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 #include <hintids.hxx>
28 #include <i18npool/mslangid.hxx>
29 #include <unotools/localedatawrapper.hxx>
30 #include <editeng/paperinf.hxx>
31 #include <editeng/wghtitem.hxx>
32 #include <editeng/fontitem.hxx>
33 #include <editeng/fhgtitem.hxx>
34 #include <editeng/tstpitem.hxx>
35 #include <editeng/lrspitem.hxx>
36 #include <editeng/ulspitem.hxx>
37 #include <editeng/adjitem.hxx>
38 #include <editeng/postitem.hxx>
39 #include <editeng/keepitem.hxx>
40 #include <editeng/opaqitem.hxx>
41 #include <editeng/boxitem.hxx>
42 #include <editeng/cmapitem.hxx>
43 #include <editeng/udlnitem.hxx>
44 #include <editeng/colritem.hxx>
45 #include <editeng/protitem.hxx>
46 #include <editeng/escpitem.hxx>
47 #include <editeng/langitem.hxx>
48 #include <editeng/charrotateitem.hxx>
49 #include <editeng/frmdiritem.hxx>
50 #include <editeng/emphitem.hxx>
51 #include <editeng/scriptspaceitem.hxx>
52 #include <viewopt.hxx>
53 #include <doc.hxx>
54 #include <IDocumentUndoRedo.hxx>
55 #include <fmtanchr.hxx>
56 #include <fmtornt.hxx>
57 #include <fmtsrnd.hxx>
58 #include <fmtfsize.hxx>
59 #include <poolfmt.hxx>
60 #include <paratr.hxx>
61 #include <pagedesc.hxx>
62 #include <frmtool.hxx>
63 #include <charfmt.hxx>
64 #include <docary.hxx>
65 #include <fmtcol.hxx>
66 #include <ndtxt.hxx>
67 #include <fmtline.hxx>
68 #include <poolfmt.hrc>
69 #include <GetMetricVal.hxx>
70 #include <numrule.hxx>
71 
72 
73 using namespace ::com::sun::star;
74 
75 const sal_uInt16 PT_3	=  3 * 20;		//  3 pt
76 const sal_uInt16 PT_6	=  6 * 20;		//  6 pt
77 const sal_uInt16 PT_7	=  7 * 20;		//  6 pt
78 const sal_uInt16 PT_8	=  8 * 20;		//  8 pt
79 const sal_uInt16 PT_9	=  9 * 20;		//  9 pt
80 const sal_uInt16 PT_10 	= 10 * 20;		// 10 pt
81 const sal_uInt16 PT_11 	= 11 * 20;		// 11 pt
82 const sal_uInt16 PT_12 	= 12 * 20;		// 12 pt
83 const sal_uInt16 PT_14	= 14 * 20;		// 14 pt
84 const sal_uInt16 PT_16	= 16 * 20;		// 16 pt
85 const sal_uInt16 PT_18	= 18 * 20;		// 18 pt
86 const sal_uInt16 PT_22	= 22 * 20;		// 22 pt
87 const sal_uInt16 PT_24	= 24 * 20;		// 22 pt
88 
89 
90 //const sal_uInt16 HTML_PARSPACE = ((CM_05 * 7) / 10);
91 #define HTML_PARSPACE 	GetMetricVal( CM_05 )
92 
93 static const sal_Char __FAR_DATA sKomma[] = ", ";
94 
95 static const sal_uInt16 aHeadlineSizes[ 2 * MAXLEVEL ] = {
96 //	PT_16, PT_14, PT_14, PT_12, PT_12, 			// normal
97 //JP 10.12.96: jetzt soll alles prozentual sein:
98 	115, 100, 100, 85, 85,
99 	75,   75,  75, 75, 75,	// normal
100 //	PT_22, PT_16, PT_12, PT_11, PT_9			// HTML-Mode
101 	PT_24, PT_18, PT_14, PT_12, PT_10,
102 	PT_7, PT_7, PT_7, PT_7, PT_7 			// HTML-Mode
103 };
104 
105 long lcl_GetRightMargin( SwDoc& rDoc )
106 {
107 	// sorge dafuer, dass die Druckereinstellungen in die Standard-
108 	// Seitenvorlage uebernommen wurden.
109     const SwFrmFmt& rPgDscFmt =
110             const_cast<const SwDoc *>(&rDoc)->GetPageDesc( 0 ).GetMaster();
111     const SvxLRSpaceItem& rLR = rPgDscFmt.GetLRSpace();
112     const long nLeft = rLR.GetLeft();
113     const long nRight = rLR.GetRight();
114     const long nWidth = rPgDscFmt.GetFrmSize().GetWidth();
115     return nWidth - nLeft - nRight;
116 }
117 
118 void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem )
119 {
120 	rSet.Put( rItem );
121 	sal_uInt16 nWhCJK = 0, nWhCTL = 0;
122 	switch( rItem.Which() )
123 	{
124 	case RES_CHRATR_FONTSIZE:
125 		nWhCJK = RES_CHRATR_CJK_FONTSIZE, nWhCTL = RES_CHRATR_CTL_FONTSIZE;
126 		break;
127 	case RES_CHRATR_FONT:
128 		nWhCJK = RES_CHRATR_CJK_FONT, nWhCTL = RES_CHRATR_CTL_FONT;
129 		break;
130 	case RES_CHRATR_LANGUAGE:
131 		nWhCJK = RES_CHRATR_CJK_LANGUAGE, nWhCTL = RES_CHRATR_CTL_LANGUAGE;
132 		break;
133 	case RES_CHRATR_POSTURE:
134 		nWhCJK = RES_CHRATR_CJK_POSTURE, nWhCTL = RES_CHRATR_CTL_POSTURE;
135 		break;
136 	case RES_CHRATR_WEIGHT:
137 		nWhCJK = RES_CHRATR_CJK_WEIGHT, nWhCTL = RES_CHRATR_CTL_WEIGHT;
138 		break;
139 	}
140 
141 	if( nWhCJK )
142 		rSet.Put( rItem, nWhCJK );
143 	if( nWhCTL )
144 		rSet.Put( rItem, nWhCTL );
145 }
146 
147 void lcl_SetDfltFont( sal_uInt16 nFntType, SfxItemSet& rSet )
148 {
149 	static struct {
150 		sal_uInt16 nResLngId;
151 		sal_uInt16 nResFntId;
152 	} aArr[ 3 ] = {
153 		{ RES_CHRATR_LANGUAGE, RES_CHRATR_FONT },
154 		{ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT },
155 		{ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT }
156 	};
157 	for( sal_uInt16 n = 0; n < 3; ++n )
158 	{
159 		sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
160 							aArr[n].nResLngId )).GetLanguage();
161 		Font aFnt( OutputDevice::GetDefaultFont( nFntType,
162 								nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
163 
164 		rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
165 							aEmptyStr, aFnt.GetPitch(),
166 							aFnt.GetCharSet(), aArr[n].nResFntId ));
167 	}
168 }
169 
170 void lcl_SetDfltFont( sal_uInt16 nLatinFntType, sal_uInt16 nCJKFntType,
171 						sal_uInt16 nCTLFntType, SfxItemSet& rSet )
172 {
173 	static struct {
174 		sal_uInt16 nResLngId;
175 		sal_uInt16 nResFntId;
176 		sal_uInt16 nFntType;
177 	} aArr[ 3 ] = {
178 		{ RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, 0 },
179 		{ RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT, 0 },
180 		{ RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT, 0 }
181 	};
182 	aArr[0].nFntType = nLatinFntType;
183 	aArr[1].nFntType = nCJKFntType;
184 	aArr[2].nFntType = nCTLFntType;
185 
186 	for( sal_uInt16 n = 0; n < 3; ++n )
187 	{
188 		sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
189 							aArr[n].nResLngId )).GetLanguage();
190 		Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType,
191 								nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
192 
193 		rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
194 							aEmptyStr, aFnt.GetPitch(),
195 							aFnt.GetCharSet(), aArr[n].nResFntId ));
196 	}
197 }
198 
199 void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl,
200 						SfxItemSet& rSet,
201 						sal_uInt16 nOutLvlBits, sal_uInt8 nLevel, sal_Bool bItalic )
202 {
203     SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
204     SvxFontHeightItem aHItem(240, 100, RES_CHRATR_FONTSIZE);
205     const bool bHTMLMode = pDoc->get(IDocumentSettingAccess::HTML_MODE);
206     if( bHTMLMode )
207 		aHItem.SetHeight( aHeadlineSizes[ MAXLEVEL + nLevel ] );
208 	else
209 		aHItem.SetHeight( PT_14, aHeadlineSizes[ nLevel ] );
210 	SetAllScriptItem( rSet, aHItem );
211 
212     if( bItalic && !bHTMLMode )
213         SetAllScriptItem( rSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
214 
215     if( bHTMLMode )
216 	{
217 		::lcl_SetDfltFont( DEFAULTFONT_LATIN_TEXT, DEFAULTFONT_CJK_TEXT,
218 							DEFAULTFONT_CTL_TEXT, rSet );
219 	}
220 
221 	if( pColl )
222 	{
223 		if( !( nOutLvlBits & ( 1 << nLevel )) )
224 		{
225 			//pColl->SetOutlineLevel( nLevel );			 //#outline level zhaojianwei
226 			pColl->AssignToListLevelOfOutlineStyle(nLevel);//<-end,zhaojianwei
227             if( !bHTMLMode )
228 			{
229                 SwNumRule * pOutlineRule = pDoc->GetOutlineNumRule();
230 				const SwNumFmt& rNFmt = pOutlineRule->Get( nLevel );
231                 // --> OD 2008-02-01 #newlistlevelattrs#
232                 if ( rNFmt.GetPositionAndSpaceMode() ==
233                                     SvxNumberFormat::LABEL_WIDTH_AND_POSITION &&
234                      ( rNFmt.GetAbsLSpace() || rNFmt.GetFirstLineOffset() ) )
235                 // <--
236 				{
237                     SvxLRSpaceItem aLR( (SvxLRSpaceItem&)pColl->GetFmtAttr( RES_LR_SPACE ) );
238 					aLR.SetTxtFirstLineOfstValue( rNFmt.GetFirstLineOffset() );
239 					aLR.SetTxtLeft( rNFmt.GetAbsLSpace() );
240                     pColl->SetFmtAttr( aLR );
241 				}
242 
243                 // --> OD 2006-11-20 #i71764#
244                 // Check on document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE no longer needed.
245                 // All paragraph styles, which are assigned to a level of the
246                 // outline style has to have the outline style set as its list style.
247                 {
248                     SwNumRuleItem aItem(pOutlineRule->GetName());
249 
250                     pColl->SetFmtAttr(aItem);
251                 }
252                 // <--
253 			}
254 		}
255 		pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool(
256 										RES_POOLCOLL_TEXT ));
257 	}
258 }
259 
260 
261 
262 void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, sal_uInt16 nFact,
263 						sal_Bool bHeader, sal_Bool bTab )
264 {
265     SvxLRSpaceItem aLR( RES_LR_SPACE );
266 	sal_uInt16 nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0;
267 	aLR.SetTxtLeft( nLeft );
268 
269 	rSet.Put( aLR );
270 	if( bHeader )
271 	{
272         SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
273         SetAllScriptItem( rSet, SvxFontHeightItem( PT_16, 100, RES_CHRATR_FONTSIZE ) );
274 	}
275 	if( bTab )
276 	{
277 		long nRightMargin = lcl_GetRightMargin( *pDoc );
278         SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
279 		aTStops.Insert( SvxTabStop( nRightMargin - nLeft,
280 									SVX_TAB_ADJUST_RIGHT,
281 									cDfltDecimalChar, '.' ));
282 		rSet.Put( aTStops );
283 	}
284 }
285 
286 
287 
288 void lcl_SetNumBul( SwDoc* pDoc, SwTxtFmtColl* pColl,
289 						SfxItemSet& rSet,
290 						sal_uInt16 nNxt, SwTwips nEZ, SwTwips nLeft,
291 						SwTwips nUpper, SwTwips nLower )
292 {
293 
294     SvxLRSpaceItem aLR( RES_LR_SPACE ); SvxULSpaceItem aUL( RES_UL_SPACE );
295 	aLR.SetTxtFirstLineOfst( sal_uInt16(nEZ) ); aLR.SetTxtLeft( sal_uInt16(nLeft) );
296 	aUL.SetUpper( sal_uInt16(nUpper) ); aUL.SetLower( sal_uInt16(nLower) );
297 	rSet.Put( aLR );
298 	rSet.Put( aUL );
299 
300 	if( !pColl )
301 		pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool( nNxt ));
302 }
303 
304 
305 
306 // Gebe die "Auto-Collection" mit der Id zurueck. Existiert
307 // sie noch nicht, dann erzeuge sie
308 // Ist der String-Pointer definiert, dann erfrage nur die
309 // Beschreibung der Attribute, !! es legt keine Vorlage an !!
310 
311 SvxFrameDirection GetDefaultFrameDirection(sal_uLong nLanguage)
312 {
313     SvxFrameDirection eResult = (MsLangId::isRightToLeft( static_cast<LanguageType>(nLanguage)) ?
314             FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP);
315     return eResult;
316 }
317 
318 SwTxtFmtColl* SwDoc::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage )
319 {
320 	ASSERT(
321 		(RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
322 		(RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
323 		(RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
324 		(RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
325 		(RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
326 		(RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
327 			"Falsche AutoFormat-Id" );
328 
329     SwTxtFmtColl* pNewColl;
330 	sal_uInt16 nOutLvlBits = 0;
331 	for( sal_uInt16 n = 0; n < pTxtFmtCollTbl->Count(); ++n )
332 	{
333 		if( nId == ( pNewColl = (*pTxtFmtCollTbl)[ n ] )->GetPoolFmtId() )
334 		{
335             return pNewColl;
336 		}
337         //if( pNewColl->GetOutlineLevel() < MAXLEVEL )			//#outline level,zhaojianwei
338 		//nOutLvlBits |= ( 1 << pNewColl->GetOutlineLevel() );
339 		if( pNewColl->IsAssignedToListLevelOfOutlineStyle())
340 			nOutLvlBits |= ( 1 << pNewColl->GetAssignedOutlineStyleLevel() );//<-end,zhaojianwei
341 	}
342 
343 	// bis hierher nicht gefunden -> neu anlegen
344 	sal_uInt16 nResId = 0;
345 	if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
346 		nResId = RC_POOLCOLL_TEXT_BEGIN - RES_POOLCOLL_TEXT_BEGIN;
347 	else if (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END)
348 		nResId = RC_POOLCOLL_LISTS_BEGIN - RES_POOLCOLL_LISTS_BEGIN;
349 	else if (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END)
350 		nResId = RC_POOLCOLL_EXTRA_BEGIN - RES_POOLCOLL_EXTRA_BEGIN;
351 	else if (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END)
352 		nResId = RC_POOLCOLL_REGISTER_BEGIN - RES_POOLCOLL_REGISTER_BEGIN;
353 	else if (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END)
354 		nResId = RC_POOLCOLL_DOC_BEGIN - RES_POOLCOLL_DOC_BEGIN;
355 	else if (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END)
356 		nResId = RC_POOLCOLL_HTML_BEGIN - RES_POOLCOLL_HTML_BEGIN;
357 
358 	ASSERT( nResId, "Ungueltige Pool-ID" );
359 	if( !nResId )
360         return GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
361 
362 	ResId aResId( nResId + nId, *pSwResMgr );
363 	String aNm( aResId );
364 
365 	// ein Set fuer alle zusetzenden Attribute
366 	SwAttrSet aSet( GetAttrPool(), aTxtFmtCollSetRange );
367 	sal_uInt16 nParent = GetPoolParent( nId );
368 
369     {
370 
371 //FEATURE::CONDCOLL
372 		if(::IsConditionalByPoolId( nId ))
373 			pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), aNm, !nParent
374 												? pDfltTxtFmtColl
375 												: GetTxtCollFromPool( nParent ));
376 		else
377 //FEATURE::CONDCOLL
378 		pNewColl = new SwTxtFmtColl( GetAttrPool(), aNm, !nParent
379 											? pDfltTxtFmtColl
380 											: GetTxtCollFromPool( nParent ));
381 		pNewColl->SetPoolFmtId( nId );
382 		pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() );
383 	}
384 
385 	switch( nId )
386 	{
387 	// allgemeine Inhaltsformen
388 	case RES_POOLCOLL_STANDARD:
389         /* #111214# koreans do not like SvxScriptItem(sal_True) */
390         if (bRegardLanguage)
391         {
392             sal_uLong nAppLanguage = GetAppLanguage();
393             if (GetDefaultFrameDirection(nAppLanguage) ==
394                 FRMDIR_HORI_RIGHT_TOP)
395             {
396                 SvxAdjustItem aAdjust(SVX_ADJUST_RIGHT, RES_PARATR_ADJUST );
397                 aSet.Put(aAdjust);
398             }
399             if (nAppLanguage == LANGUAGE_KOREAN)
400             {
401                 SvxScriptSpaceItem aScriptSpace(sal_False, RES_PARATR_SCRIPTSPACE);
402                 aSet.Put(aScriptSpace);
403             }
404         }
405 		break;
406 
407 	case RES_POOLCOLL_TEXT:					// Textkoerper
408 		{
409             SvxULSpaceItem aUL( 0, PT_6, RES_UL_SPACE );
410 			if( get(IDocumentSettingAccess::HTML_MODE) ) aUL.SetLower( HTML_PARSPACE );
411 			aSet.Put( aUL );
412 		}
413 		break;
414 	case RES_POOLCOLL_TEXT_IDENT:			// Textkoerper Einzug
415 		{
416             SvxLRSpaceItem aLR( RES_LR_SPACE );
417 			aLR.SetTxtFirstLineOfst( GetMetricVal( CM_05 ));
418 			aSet.Put( aLR );
419 		}
420 		break;
421 	case RES_POOLCOLL_TEXT_NEGIDENT:		// Textkoerper neg. Einzug
422 		{
423             SvxLRSpaceItem aLR( RES_LR_SPACE );
424 			aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
425 			aLR.SetTxtLeft( GetMetricVal( CM_1 ));
426             SvxTabStopItem aTStops(RES_PARATR_TABSTOP);    aTStops.Insert( SvxTabStop( 0 ));
427 
428 			aSet.Put( aLR );
429 			aSet.Put( aTStops );
430 		}
431 		break;
432 	case RES_POOLCOLL_TEXT_MOVE:			// Textkoerper Einrueckung
433 		{
434             SvxLRSpaceItem aLR( RES_LR_SPACE );
435 			aLR.SetTxtLeft( GetMetricVal( CM_05 ));
436 			aSet.Put( aLR );
437 		}
438 		break;
439 
440 	case RES_POOLCOLL_CONFRONTATION: 	// Textkoerper Gegenueberstellung
441 		{
442             SvxLRSpaceItem aLR( RES_LR_SPACE );
443 			aLR.SetTxtFirstLineOfst( - short( GetMetricVal( CM_1 ) * 4 +
444 											  GetMetricVal( CM_05)) );
445 			aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 5 );
446             SvxTabStopItem aTStops( RES_PARATR_TABSTOP );    aTStops.Insert( SvxTabStop( 0 ));
447 
448 			aSet.Put( aLR );
449 			aSet.Put( aTStops );
450 		}
451 		break;
452 	case RES_POOLCOLL_MARGINAL: 		// Textkoerper maginalie
453 		{
454             SvxLRSpaceItem aLR( RES_LR_SPACE );
455 			aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 4 );
456 			aSet.Put( aLR );
457 		}
458 		break;
459 
460 	case RES_POOLCOLL_HEADLINE_BASE:			// Basis Ueberschrift
461 		{
462 			static const sal_uInt16 aFntInit[] = {
463 				DEFAULTFONT_LATIN_HEADING, 	RES_CHRATR_FONT,
464 								RES_CHRATR_LANGUAGE, LANGUAGE_ENGLISH_US,
465 				DEFAULTFONT_CJK_HEADING, 	RES_CHRATR_CJK_FONT,
466 								RES_CHRATR_CJK_LANGUAGE, LANGUAGE_ENGLISH_US,
467 				DEFAULTFONT_CTL_HEADING, 	RES_CHRATR_CTL_FONT,
468 								RES_CHRATR_CTL_LANGUAGE, LANGUAGE_ARABIC_SAUDI_ARABIA,
469 				0
470 			};
471 
472 			for( const sal_uInt16* pArr = aFntInit; *pArr; pArr += 4 )
473 			{
474 				sal_uInt16 nLng = ((SvxLanguageItem&)GetDefault( *(pArr+2) )).GetLanguage();
475 				if( LANGUAGE_DONTKNOW == nLng )
476 					nLng = *(pArr+3);
477 
478 				Font aFnt( OutputDevice::GetDefaultFont( *pArr,
479 										nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
480 
481 				aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
482 										aEmptyStr, aFnt.GetPitch(),
483                                         aFnt.GetCharSet(), *(pArr+1) ));
484 			}
485 
486             SvxFontHeightItem aFntSize( PT_14, 100, RES_CHRATR_FONTSIZE );
487             SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE );
488 			if( get(IDocumentSettingAccess::HTML_MODE) )
489 				aUL.SetLower( HTML_PARSPACE );
490             aSet.Put( SvxFmtKeepItem( sal_True, RES_KEEP ));
491 
492             pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT ));
493 
494 			aSet.Put( aUL );
495 			SetAllScriptItem( aSet, aFntSize );
496 		}
497 		break;
498 
499 	case RES_POOLCOLL_NUMBUL_BASE:			// Basis Numerierung/Aufzaehlung
500 		break;
501 
502 	case RES_POOLCOLL_GREETING:				// Grussformel
503 	case RES_POOLCOLL_REGISTER_BASE: 		// Basis Verzeichnisse
504 	case RES_POOLCOLL_SIGNATURE:			// Unterschrift
505 	case RES_POOLCOLL_TABLE:				// Tabelle-Inhalt
506 		{
507 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
508 			aSet.Put( aLN );
509 		}
510 		break;
511 
512 	case RES_POOLCOLL_HEADLINE1:		// Ueberschrift 1
513 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 0, sal_False );
514 		break;
515 	case RES_POOLCOLL_HEADLINE2:		// Ueberschrift 2
516 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 1, sal_True );
517 		break;
518 	case RES_POOLCOLL_HEADLINE3:		// Ueberschrift 3
519 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 2, sal_False );
520 		break;
521 	case RES_POOLCOLL_HEADLINE4:		// Ueberschrift 4
522 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 3, sal_True );
523 		break;
524 	case RES_POOLCOLL_HEADLINE5:		// Ueberschrift 5
525 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 4, sal_False );
526 		break;
527 	case RES_POOLCOLL_HEADLINE6:		// Ueberschrift 6
528 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 5, sal_False );
529 		break;
530 	case RES_POOLCOLL_HEADLINE7:		// Ueberschrift 7
531 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 6, sal_False );
532 		break;
533 	case RES_POOLCOLL_HEADLINE8:		// Ueberschrift 8
534 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 7, sal_False );
535 		break;
536 	case RES_POOLCOLL_HEADLINE9:		// Ueberschrift 9
537 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 8, sal_False );
538 		break;
539 	case RES_POOLCOLL_HEADLINE10:		// Ueberschrift 10
540 		lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 9, sal_False );
541 		break;
542 
543 
544 	// Sonderbereiche:
545 	// Kopfzeilen
546 	case RES_POOLCOLL_HEADER:
547 	case RES_POOLCOLL_HEADERL:
548 	case RES_POOLCOLL_HEADERR:
549 	// Fusszeilen
550 	case RES_POOLCOLL_FOOTER:
551 	case RES_POOLCOLL_FOOTERL:
552 	case RES_POOLCOLL_FOOTERR:
553 		{
554 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
555 			aSet.Put( aLN );
556 
557 			long nRightMargin = lcl_GetRightMargin( *this );
558 
559             SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
560 			aTStops.Insert( SvxTabStop( nRightMargin / 2, SVX_TAB_ADJUST_CENTER ) );
561 			aTStops.Insert( SvxTabStop( nRightMargin, SVX_TAB_ADJUST_RIGHT ) );
562 
563 			aSet.Put( aTStops );
564 		}
565 		break;
566 
567 	case RES_POOLCOLL_TABLE_HDLN:
568 		{
569             SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
570             aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
571             SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
572 			aSet.Put( aLN );
573 		}
574 		break;
575 
576 	case RES_POOLCOLL_FOOTNOTE:				// Fussnote
577 	case RES_POOLCOLL_ENDNOTE:
578 		{
579             SvxLRSpaceItem aLR( RES_LR_SPACE );
580 			aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
581 			aLR.SetTxtLeft( GetMetricVal( CM_05 ));
582             SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
583 			aSet.Put( aLR );
584 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
585 			aSet.Put( aLN );
586 		}
587 		break;
588 
589 	case RES_POOLCOLL_LABEL:				// Beschriftung-Basis
590 		{
591             SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetUpper( PT_6 ); aUL.SetLower( PT_6 );
592 			aSet.Put( aUL );
593             SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
594             SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
595 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
596 			aSet.Put( aLN );
597 		}
598 		break;
599 
600 	case RES_POOLCOLL_FRAME:				// Rahmen Inhalt
601 	case RES_POOLCOLL_LABEL_ABB:			// Beschriftung-Abbildung
602 	case RES_POOLCOLL_LABEL_TABLE:			// Beschriftung-Tabelle
603 	case RES_POOLCOLL_LABEL_FRAME:			// Beschriftung-Rahmen
604 	case RES_POOLCOLL_LABEL_DRAWING:		// Beschriftung-Zeichnung
605 		break;
606 
607 	case RES_POOLCOLL_JAKETADRESS:			// UmschlagAdresse
608 		{
609             SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
610 			aSet.Put( aUL );
611 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
612 			aSet.Put( aLN );
613 		}
614 		break;
615 
616 	case RES_POOLCOLL_SENDADRESS:			// AbsenderAdresse
617 		{
618 			if( get(IDocumentSettingAccess::HTML_MODE) )
619                 SetAllScriptItem( aSet, SvxPostureItem(ITALIC_NORMAL, RES_CHRATR_POSTURE) );
620 			else
621 			{
622                 SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
623 				aSet.Put( aUL );
624 			}
625 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
626 			aSet.Put( aLN );
627 		}
628 		break;
629 
630 	// Benutzer-Verzeichnisse:
631 	case RES_POOLCOLL_TOX_USERH:			// Header
632 		lcl_SetRegister( this, aSet, 0, sal_True, sal_False );
633 		{
634 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
635 			aSet.Put( aLN );
636 		}
637 		break;
638 	case RES_POOLCOLL_TOX_USER1:			// 1. Ebene
639 		lcl_SetRegister( this, aSet, 0, sal_False, sal_True );
640 		break;
641 	case RES_POOLCOLL_TOX_USER2:			// 2. Ebene
642 		lcl_SetRegister( this, aSet, 1, sal_False, sal_True );
643 		break;
644 	case RES_POOLCOLL_TOX_USER3:			// 3. Ebene
645 		lcl_SetRegister( this, aSet, 2, sal_False, sal_True );
646 		break;
647 	case RES_POOLCOLL_TOX_USER4:			// 4. Ebene
648 		lcl_SetRegister( this, aSet, 3, sal_False, sal_True );
649 		break;
650 	case RES_POOLCOLL_TOX_USER5:			// 5. Ebene
651 		lcl_SetRegister( this, aSet, 4, sal_False, sal_True );
652 		break;
653 	case RES_POOLCOLL_TOX_USER6:			// 6. Ebene
654 		lcl_SetRegister( this, aSet, 5, sal_False, sal_True );
655 		break;
656 	case RES_POOLCOLL_TOX_USER7:			// 7. Ebene
657 		lcl_SetRegister( this, aSet, 6, sal_False, sal_True );
658 		break;
659 	case RES_POOLCOLL_TOX_USER8:			// 8. Ebene
660 		lcl_SetRegister( this, aSet, 7, sal_False, sal_True );
661 		break;
662 	case RES_POOLCOLL_TOX_USER9:			// 9. Ebene
663 		lcl_SetRegister( this, aSet, 8, sal_False, sal_True );
664 		break;
665 	case RES_POOLCOLL_TOX_USER10:			// 10. Ebene
666 		lcl_SetRegister( this, aSet, 9, sal_False, sal_True );
667 		break;
668 
669 	// Index-Verzeichnisse
670 	case RES_POOLCOLL_TOX_IDXH:			// Header
671 		lcl_SetRegister( this, aSet, 0, sal_True, sal_False );
672 		{
673 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
674 			aSet.Put( aLN );
675 		}
676 		break;
677 	case RES_POOLCOLL_TOX_IDX1:			// 1. Ebene
678 		lcl_SetRegister( this, aSet, 0, sal_False, sal_False );
679 		break;
680 	case RES_POOLCOLL_TOX_IDX2:			// 2. Ebene
681 		lcl_SetRegister( this, aSet, 1, sal_False, sal_False );
682 		break;
683 	case RES_POOLCOLL_TOX_IDX3:			// 3. Ebene
684 		lcl_SetRegister( this, aSet, 2, sal_False, sal_False );
685 		break;
686 	case RES_POOLCOLL_TOX_IDXBREAK:		// Trenner
687 		lcl_SetRegister( this, aSet, 0, sal_False, sal_False );
688 		break;
689 
690 	// Inhalts-Verzeichnisse
691 	case RES_POOLCOLL_TOX_CNTNTH:		// Header
692 		lcl_SetRegister( this, aSet, 0, sal_True, sal_False );
693 		{
694 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
695 			aSet.Put( aLN );
696 		}
697 		break;
698 	case RES_POOLCOLL_TOX_CNTNT1:		// 1. Ebene
699 		lcl_SetRegister( this, aSet, 0, sal_False, sal_True );
700 		break;
701 	case RES_POOLCOLL_TOX_CNTNT2:		// 2. Ebene
702 		lcl_SetRegister( this, aSet, 1, sal_False, sal_True );
703 		break;
704 	case RES_POOLCOLL_TOX_CNTNT3:		// 3. Ebene
705 		lcl_SetRegister( this, aSet, 2, sal_False, sal_True );
706 		break;
707 	case RES_POOLCOLL_TOX_CNTNT4:		// 4. Ebene
708 		lcl_SetRegister( this, aSet, 3, sal_False, sal_True );
709 		break;
710 	case RES_POOLCOLL_TOX_CNTNT5:		// 5. Ebene
711 		lcl_SetRegister( this, aSet, 4, sal_False, sal_True );
712 		break;
713 	case RES_POOLCOLL_TOX_CNTNT6:		// 6. Ebene
714 		lcl_SetRegister( this, aSet, 5, sal_False, sal_True );
715 		break;
716 	case RES_POOLCOLL_TOX_CNTNT7:		// 7. Ebene
717 		lcl_SetRegister( this, aSet, 6, sal_False, sal_True );
718 		break;
719 	case RES_POOLCOLL_TOX_CNTNT8:		// 8. Ebene
720 		lcl_SetRegister( this, aSet, 7, sal_False, sal_True );
721 		break;
722 	case RES_POOLCOLL_TOX_CNTNT9:		// 9. Ebene
723 		lcl_SetRegister( this, aSet, 8, sal_False, sal_True );
724 		break;
725 	case RES_POOLCOLL_TOX_CNTNT10:		// 10. Ebene
726 		lcl_SetRegister( this, aSet, 9, sal_False, sal_True );
727 		break;
728 
729 	case RES_POOLCOLL_TOX_ILLUSH:
730 	case RES_POOLCOLL_TOX_OBJECTH:
731 	case RES_POOLCOLL_TOX_TABLESH:
732 	case RES_POOLCOLL_TOX_AUTHORITIESH:
733 		lcl_SetRegister( this, aSet, 0, sal_True, sal_False );
734 		{
735 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
736 			aSet.Put( aLN );
737 		}
738 		break;
739 	case RES_POOLCOLL_TOX_ILLUS1:
740 	case RES_POOLCOLL_TOX_OBJECT1:
741 	case RES_POOLCOLL_TOX_TABLES1:
742 	case RES_POOLCOLL_TOX_AUTHORITIES1:
743 		lcl_SetRegister( this, aSet, 0, sal_False, sal_True );
744 	break;
745 
746 
747 
748 	case RES_POOLCOLL_NUM_LEVEL1S:
749 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
750 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
751 						PT_12, PT_6 );
752 		break;
753 	case RES_POOLCOLL_NUM_LEVEL1:
754 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
755 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
756 						0, PT_6 );
757 		break;
758 	case RES_POOLCOLL_NUM_LEVEL1E:
759 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
760 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
761 						0, PT_12 );
762 		break;
763 	case RES_POOLCOLL_NUM_NONUM1:
764 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM1,
765 						0, SwNumRule::GetNumIndent( 0 ), 0, PT_6 );
766 		break;
767 	case RES_POOLCOLL_NUM_LEVEL2S:
768 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
769 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
770 						PT_12, PT_6 );
771 		break;
772 	case RES_POOLCOLL_NUM_LEVEL2:
773 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
774 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
775 						0, PT_6 );
776 		break;
777 	case RES_POOLCOLL_NUM_LEVEL2E:
778 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
779 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
780 						0, PT_12 );
781 		break;
782 	case RES_POOLCOLL_NUM_NONUM2:
783 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM2,
784 						0, SwNumRule::GetNumIndent( 1 ), 0, PT_6 );
785 		break;
786 	case RES_POOLCOLL_NUM_LEVEL3S:
787 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
788 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
789 						PT_12, PT_6 );
790 		break;
791 	case RES_POOLCOLL_NUM_LEVEL3:
792 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
793 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
794 						0, PT_6 );
795 		break;
796 	case RES_POOLCOLL_NUM_LEVEL3E:
797 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
798 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
799 						0, PT_12 );
800 		break;
801 	case RES_POOLCOLL_NUM_NONUM3:
802 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM3,
803 						0, SwNumRule::GetNumIndent( 2 ), 0, PT_6 );
804 		break;
805 	case RES_POOLCOLL_NUM_LEVEL4S:
806 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
807 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
808 						PT_12, PT_6 );
809 		break;
810 	case RES_POOLCOLL_NUM_LEVEL4:
811 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
812 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
813 						0, PT_6 );
814 		break;
815 	case RES_POOLCOLL_NUM_LEVEL4E:
816 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
817 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
818 						0, PT_12 );
819 		break;
820 	case RES_POOLCOLL_NUM_NONUM4:
821 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM4,
822 						0, SwNumRule::GetNumIndent( 3 ), 0, PT_6 );
823 		break;
824 	case RES_POOLCOLL_NUM_LEVEL5S:
825 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
826 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
827 						PT_12, PT_6 );
828 		break;
829 	case RES_POOLCOLL_NUM_LEVEL5:
830 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
831 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
832 						0, PT_6 );
833 		break;
834 	case RES_POOLCOLL_NUM_LEVEL5E:
835 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
836 						lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
837 						0, PT_12 );
838 		break;
839 	case RES_POOLCOLL_NUM_NONUM5:
840 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM5,
841 						0, SwNumRule::GetNumIndent( 4 ), 0, PT_6 );
842 		break;
843 
844 	case RES_POOLCOLL_BUL_LEVEL1S:
845 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
846 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
847 						PT_12, PT_6 );
848 		break;
849 	case RES_POOLCOLL_BUL_LEVEL1:
850 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
851 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
852 						0, PT_6 );
853 		break;
854 	case RES_POOLCOLL_BUL_LEVEL1E:
855 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
856 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
857 						0, PT_12 );
858 		break;
859 	case RES_POOLCOLL_BUL_NONUM1:
860 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM1,
861 						0, SwNumRule::GetBullIndent( 0 ), 0, PT_6 );
862 		break;
863 	case RES_POOLCOLL_BUL_LEVEL2S:
864 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
865 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
866 						PT_12, PT_6 );
867 		break;
868 	case RES_POOLCOLL_BUL_LEVEL2:
869 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
870 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
871 						0, PT_6 );
872 		break;
873 	case RES_POOLCOLL_BUL_LEVEL2E:
874 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
875 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
876 						0, PT_12 );
877 		break;
878 	case RES_POOLCOLL_BUL_NONUM2:
879 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM2,
880 						0, SwNumRule::GetBullIndent( 1 ), 0, PT_6 );
881 		break;
882 	case RES_POOLCOLL_BUL_LEVEL3S:
883 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
884 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
885 						PT_12, PT_6 );
886 		break;
887 	case RES_POOLCOLL_BUL_LEVEL3:
888 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
889 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
890 						0, PT_6 );
891 		break;
892 	case RES_POOLCOLL_BUL_LEVEL3E:
893 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
894 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
895 						0, PT_12 );
896 		break;
897 	case RES_POOLCOLL_BUL_NONUM3:
898 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM3,
899 						0, SwNumRule::GetBullIndent( 2 ), 0, PT_6 );
900 		break;
901 	case RES_POOLCOLL_BUL_LEVEL4S:
902 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
903 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
904 						PT_12, PT_6 );
905 		break;
906 	case RES_POOLCOLL_BUL_LEVEL4:
907 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
908 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
909 						0, PT_6 );
910 		break;
911 	case RES_POOLCOLL_BUL_LEVEL4E:
912 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
913 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
914 						0, PT_12 );
915 		break;
916 	case RES_POOLCOLL_BUL_NONUM4:
917 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM4,
918 						0, SwNumRule::GetBullIndent( 3 ), 0, PT_6 );
919 		break;
920 	case RES_POOLCOLL_BUL_LEVEL5S:
921 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
922 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
923 						PT_12, PT_6 );
924 		break;
925 	case RES_POOLCOLL_BUL_LEVEL5:
926 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
927 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
928 						0, PT_6 );
929 		break;
930 	case RES_POOLCOLL_BUL_LEVEL5E:
931 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
932 						lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
933 						0, PT_12 );
934 		break;
935 	case RES_POOLCOLL_BUL_NONUM5:
936 		lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM5,
937 						0, SwNumRule::GetBullIndent( 4 ), 0, PT_6 );
938 		break;
939 
940 	case RES_POOLCOLL_DOC_TITEL:	   		// Doc. Titel
941 		{
942             SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
943             SetAllScriptItem( aSet, SvxFontHeightItem( PT_18, 100, RES_CHRATR_FONTSIZE ) );
944 
945             aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
946 
947             pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
948 												RES_POOLCOLL_DOC_SUBTITEL ));
949 		}
950 		break;
951 
952 	case RES_POOLCOLL_DOC_SUBTITEL:			// Doc. UnterTitel
953 		{
954             SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ));
955             SetAllScriptItem( aSet, SvxFontHeightItem( PT_14, 100, RES_CHRATR_FONTSIZE ));
956 
957             aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ));
958 
959             pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
960 												RES_POOLCOLL_TEXT ));
961 		}
962 		break;
963 
964 	case RES_POOLCOLL_HTML_BLOCKQUOTE:
965 		{
966             SvxLRSpaceItem aLR( RES_LR_SPACE );
967 			aLR.SetLeft( GetMetricVal( CM_1 ));
968 			aLR.SetRight( GetMetricVal( CM_1 ));
969 			aSet.Put( aLR );
970 //          aSet.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, RES_PARATR_ADJUST ) );
971             SvxULSpaceItem aUL( RES_UL_SPACE );
972             aUL = pNewColl->GetULSpace();
973 			aUL.SetLower( HTML_PARSPACE );
974 			aSet.Put( aUL);
975 		}
976 		break;
977 
978 	case RES_POOLCOLL_HTML_PRE:
979 		{
980 			::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
981 
982 // WORKAROUND: PRE auf 10pt setzten
983             SetAllScriptItem( aSet, SvxFontHeightItem(PT_10, 100, RES_CHRATR_FONTSIZE) );
984 // WORKAROUND: PRE auf 10pt setzten
985 
986 			// der untere Absatz-Abstand wird explizit gesetzt (macht
987 			// die harte Attributierung einfacher)
988             SvxULSpaceItem aULSpaceItem( RES_UL_SPACE );
989             aULSpaceItem = pNewColl->GetULSpace();
990 			aULSpaceItem.SetLower( 0 );
991 			aSet.Put( aULSpaceItem );
992 		}
993 		break;
994 
995 	case RES_POOLCOLL_HTML_HR:
996 		{
997             SvxBoxItem aBox( RES_BOX );
998 			Color aColor( COL_GRAY );
999 			SvxBorderLine aNew( &aColor, DEF_DOUBLE_LINE0_OUT,
1000 										 DEF_DOUBLE_LINE0_IN,
1001 										 DEF_DOUBLE_LINE0_DIST );
1002 			aBox.SetLine( &aNew, BOX_LINE_BOTTOM );
1003 
1004 			aSet.Put( aBox );
1005             aSet.Put( SwParaConnectBorderItem( sal_False ) );
1006             SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) );
1007 
1008             SvxULSpaceItem aUL( RES_UL_SPACE );
1009             {
1010 				pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
1011 												RES_POOLCOLL_TEXT ));
1012 				aUL = pNewColl->GetULSpace();
1013 			}
1014 			aUL.SetLower( HTML_PARSPACE );
1015 			aSet.Put( aUL);
1016 			SwFmtLineNumber aLN; aLN.SetCountLines( sal_False );
1017 			aSet.Put( aLN );
1018 		}
1019 		break;
1020 
1021 	case RES_POOLCOLL_HTML_DD:
1022 		{
1023             SvxLRSpaceItem aLR( RES_LR_SPACE );
1024             aLR = pNewColl->GetLRSpace();
1025 			// es wird um 1cm eingerueckt. Die IDs liegen immer 2 auseinander!
1026 			aLR.SetLeft( GetMetricVal( CM_1 ));
1027 			aSet.Put( aLR );
1028 		}
1029 		break;
1030 	case RES_POOLCOLL_HTML_DT:
1031 		{
1032             SvxLRSpaceItem aLR( RES_LR_SPACE );
1033             {
1034 				pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
1035 													RES_POOLCOLL_HTML_DD ));
1036 				aLR = pNewColl->GetLRSpace();
1037 			}
1038 			// es wird um 0cm eingerueckt. Die IDs liegen immer 2 auseinander!
1039 			aLR.SetLeft( 0 );
1040 			aSet.Put( aLR );
1041 		}
1042 		break;
1043 	}
1044 
1045 	if( aSet.Count() )
1046 	{
1047         {
1048             pNewColl->SetFmtAttr( aSet );
1049 			// JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
1050 			//				(Bug: 18545)
1051 			// SetModified();
1052 		}
1053 	}
1054 	return pNewColl;
1055 }
1056 
1057 
1058 
1059 	// pruefe, ob diese "Auto-Collection" in Dokument schon/noch
1060 	// benutzt wird
1061 bool SwDoc::IsPoolTxtCollUsed( sal_uInt16 nId ) const
1062 {
1063 	ASSERT(
1064 		(RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
1065 		(RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
1066 		(RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
1067 		(RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
1068 		(RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
1069 		(RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
1070 			"Falsche AutoFormat-Id" );
1071 
1072 	SwTxtFmtColl* pNewColl = 0;
1073 	sal_Bool bFnd = sal_False;
1074 	for( sal_uInt16 n = 0; !bFnd && n < pTxtFmtCollTbl->Count(); ++n )
1075     {
1076         pNewColl = (*pTxtFmtCollTbl)[ n ];
1077 		if( nId == pNewColl->GetPoolFmtId() )
1078 			bFnd = sal_True;
1079     }
1080 
1081 	if( !bFnd || !pNewColl->GetDepends() )
1082 		return sal_False;
1083 
1084     SwAutoFmtGetDocNode aGetHt( &GetNodes() );
1085 	return !pNewColl->GetInfo( aGetHt );
1086 }
1087 
1088 	// Gebe das "Auto[matische]-Format" mit der Id zurueck. Existiert
1089 	// es noch nicht, dann erzeuge es
1090 
1091 SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId )
1092 {
1093     SwFmt *pNewFmt = 0;
1094     SwFmt *pDeriveFmt = 0;
1095 
1096     SvPtrarr* pArray[ 2 ];
1097 	sal_uInt16 nArrCnt = 1, nRCId = 0;
1098 	sal_uInt16* pWhichRange = 0;
1099 
1100 	switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
1101 	{
1102 	case POOLGRP_CHARFMT:
1103 		{
1104 			pArray[0] = pCharFmtTbl;
1105 			pDeriveFmt = pDfltCharFmt;
1106 
1107 			if( nId > RES_POOLCHR_NORMAL_END )
1108 				nRCId = RC_POOLCHRFMT_HTML_BEGIN - RES_POOLCHR_HTML_BEGIN;
1109 			else
1110 				nRCId = RC_POOLCHRFMT_BEGIN - RES_POOLCHR_BEGIN;
1111 			pWhichRange =  aCharFmtSetRange;
1112 
1113 			// Fehlerfall: unbekanntes Format, aber CharFormat
1114 			//			-> returne das erste
1115 			if( RES_POOLCHR_BEGIN > nId || nId >= RES_POOLCHR_END )
1116 			{
1117 				ASSERT( !this, "ungueltige Id" );
1118 				nId = RES_POOLCHR_BEGIN;
1119 			}
1120 		}
1121 		break;
1122 	case POOLGRP_FRAMEFMT:
1123 		{
1124 			pArray[0] = pFrmFmtTbl;
1125 			pArray[1] = pSpzFrmFmtTbl;
1126 			pDeriveFmt = pDfltFrmFmt;
1127 			nArrCnt = 2;
1128 			nRCId = RC_POOLFRMFMT_BEGIN - RES_POOLFRM_BEGIN;
1129 			pWhichRange = aFrmFmtSetRange;
1130 
1131 			// Fehlerfall: unbekanntes Format, aber FrameFormat
1132 			//			-> returne das erste
1133 			if( RES_POOLFRM_BEGIN > nId || nId >= RES_POOLFRM_END )
1134 			{
1135 				ASSERT( !this, "ungueltige Id" );
1136 				nId = RES_POOLFRM_BEGIN;
1137 			}
1138 		}
1139 		break;
1140 
1141 	default:
1142 		// Fehlerfall, unbekanntes Format
1143 		ASSERT( nId, "ungueltige Id" );
1144 		return 0;
1145 	}
1146 	ASSERT( nRCId, "ungueltige Id" );
1147 
1148 	while( nArrCnt-- )
1149 		for( sal_uInt16 n = 0; n < (*pArray[nArrCnt]).Count(); ++n )
1150 			if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
1151 					GetPoolFmtId() )
1152 			{
1153                 return pNewFmt;
1154 			}
1155 
1156 	ResId aResId( nRCId + nId, *pSwResMgr );
1157 	String aNm( aResId );
1158 	SwAttrSet aSet( GetAttrPool(), pWhichRange );
1159 
1160     {
1161 		sal_Bool bIsModified = IsModified();
1162 
1163         {
1164             ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1165             switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
1166             {
1167                 case POOLGRP_CHARFMT:
1168                     pNewFmt = _MakeCharFmt(aNm, pDeriveFmt, sal_False, sal_True);
1169                 break;
1170                 case POOLGRP_FRAMEFMT:
1171                     pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, sal_False, sal_True);
1172                 break;
1173                 default:
1174                 break;
1175             }
1176         }
1177 
1178 		if( !bIsModified )
1179 			ResetModified();
1180 		pNewFmt->SetPoolFmtId( nId );
1181 		pNewFmt->SetAuto( sal_False );		// kein Auto-Format
1182 	}
1183 
1184 	switch( nId )
1185 	{
1186 	case RES_POOLCHR_FOOTNOTE:				// Fussnote
1187 	case RES_POOLCHR_PAGENO:				// Seiten/Feld
1188 	case RES_POOLCHR_LABEL:					// Beschriftung
1189 	case RES_POOLCHR_DROPCAPS: 				// Initialien
1190 	case RES_POOLCHR_NUM_LEVEL:				// Aufzaehlungszeichen
1191 	case RES_POOLCHR_TOXJUMP:				// Verzeichnissprung
1192 	case RES_POOLCHR_ENDNOTE:				// Endnote
1193 	case RES_POOLCHR_LINENUM:				// Zeilennummerierung
1194 		break;
1195 
1196 	case RES_POOLCHR_ENDNOTE_ANCHOR:		// Endnotenanker
1197 	case RES_POOLCHR_FOOTNOTE_ANCHOR:		// Fussnotenanker
1198 		{
1199             aSet.Put( SvxEscapementItem( DFLT_ESC_AUTO_SUPER, 58, RES_CHRATR_ESCAPEMENT ) );
1200 		}
1201 		break;
1202 
1203 
1204 	case RES_POOLCHR_BUL_LEVEL:				// Aufzaehlungszeichen
1205 		{
1206             const Font& rBulletFont = numfunc::GetDefBulletFont();
1207             SetAllScriptItem( aSet, SvxFontItem( rBulletFont.GetFamily(),
1208                       rBulletFont.GetName(), rBulletFont.GetStyleName(),
1209                         rBulletFont.GetPitch(), rBulletFont.GetCharSet(), RES_CHRATR_FONT ));
1210             // --> OD 2008-06-02 #i63395#
1211             // no font and no font size any more
1212 //            SetAllScriptItem( aSet, SvxFontHeightItem( PT_9, 100, RES_CHRATR_FONTSIZE ));
1213             // <--
1214 		}
1215 		break;
1216 
1217 	case RES_POOLCHR_INET_NORMAL:
1218 		{
1219             Color aCol( COL_BLUE );
1220             aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1221             aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) );
1222             // i40133: patch submitted by rail: set language to 'none' to prevent spell checking:
1223             aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
1224             aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) );
1225             aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) );
1226         }
1227 		break;
1228 	case RES_POOLCHR_INET_VISIT:
1229 		{
1230             Color aCol( COL_RED );
1231             aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1232             aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) );
1233             aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
1234             aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) );
1235             aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) );
1236         }
1237 		break;
1238 	case RES_POOLCHR_JUMPEDIT:
1239 		{
1240             Color aCol( COL_CYAN );
1241             aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1242             aSet.Put( SvxUnderlineItem( UNDERLINE_DOTTED, RES_CHRATR_UNDERLINE ) );
1243             aSet.Put( SvxCaseMapItem( SVX_CASEMAP_KAPITAELCHEN, RES_CHRATR_CASEMAP ) );
1244 		}
1245 		break;
1246 
1247 	case RES_POOLCHR_RUBYTEXT:
1248 		{
1249 			long nH = ((SvxFontHeightItem*)GetDfltAttr(
1250 								RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2;
1251             SetAllScriptItem( aSet, SvxFontHeightItem( nH, 100, RES_CHRATR_FONTSIZE));
1252             aSet.Put(SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ));
1253             aSet.Put(SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK) );
1254 		}
1255 		break;
1256 
1257 	case RES_POOLCHR_HTML_EMPHASIS:
1258 	case RES_POOLCHR_HTML_CITIATION:
1259 	case RES_POOLCHR_HTML_VARIABLE:
1260 		{
1261             SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE) );
1262 		}
1263 		break;
1264 
1265 	case RES_POOLCHR_IDX_MAIN_ENTRY:
1266 	case RES_POOLCHR_HTML_STRONG:
1267 		{
1268             SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ));
1269 		}
1270 		break;
1271 
1272 	case RES_POOLCHR_HTML_CODE:
1273 	case RES_POOLCHR_HTML_SAMPLE:
1274 	case RES_POOLCHR_HTML_KEYBOARD:
1275 	case RES_POOLCHR_HTML_TELETYPE:
1276 		{
1277 			::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
1278 		}
1279 		break;
1280    case RES_POOLCHR_VERT_NUM:
1281             aSet.Put( SvxCharRotateItem( 900, sal_False, RES_CHRATR_ROTATE ) );
1282     break;
1283 //nichts besonderes
1284 //	case RES_POOLCHR_HTML_DEFINSTANCE:
1285 //			break;
1286 
1287 
1288 	case RES_POOLFRM_FRAME:
1289 		{
1290             if ( get(IDocumentSettingAccess::HTML_MODE) )
1291 			{
1292                 aSet.Put( SwFmtAnchor( FLY_AS_CHAR ));
1293                 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::LINE_CENTER, text::RelOrientation::PRINT_AREA ) );
1294 				aSet.Put( SwFmtSurround( SURROUND_NONE ) );
1295 			}
1296 			else
1297 			{
1298                 aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
1299 				aSet.Put( SwFmtSurround( SURROUND_PARALLEL ) );
1300                 aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::PRINT_AREA ) );
1301                 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::PRINT_AREA ) );
1302 				Color aCol( COL_BLACK );
1303 				SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
1304                 SvxBoxItem aBox( RES_BOX );
1305 				aBox.SetLine( &aLine, BOX_LINE_TOP );
1306 				aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
1307 				aBox.SetLine( &aLine, BOX_LINE_LEFT );
1308 				aBox.SetLine( &aLine, BOX_LINE_RIGHT );
1309 				aBox.SetDistance( 85 );
1310 				aSet.Put( aBox );
1311                 aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1312                 aSet.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE ) );
1313 			}
1314 		}
1315 		break;
1316 	case RES_POOLFRM_GRAPHIC:
1317 	case RES_POOLFRM_OLE:
1318 		{
1319             aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
1320             aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1321             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1322 			aSet.Put( SwFmtSurround( SURROUND_NONE ));
1323 		}
1324 		break;
1325 	case RES_POOLFRM_FORMEL:
1326 		{
1327             aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) );
1328             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::FRAME ) );
1329             aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1330 		}
1331 		break;
1332 	case RES_POOLFRM_MARGINAL:
1333 		{
1334             aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
1335             aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME ));
1336             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1337 			aSet.Put( SwFmtSurround( SURROUND_PARALLEL ));
1338 			// Breite 3.5 centimeter vorgegeben, als Hoehe nur den
1339 			// min. Wert benutzen
1340 			aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE,
1341 					GetMetricVal( CM_1 ) * 3 + GetMetricVal( CM_05 ),
1342 					MM50 ));
1343 		}
1344 		break;
1345 	case RES_POOLFRM_WATERSIGN:
1346 		{
1347             aSet.Put( SwFmtAnchor( FLY_AT_PAGE ));
1348             aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1349             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ));
1350 			aSet.Put( SvxOpaqueItem( sal_False ));
1351 			aSet.Put( SwFmtSurround( SURROUND_THROUGHT ));
1352 		}
1353 		break;
1354 
1355 	case RES_POOLFRM_LABEL:
1356 		{
1357             aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) );
1358             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) );
1359             aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1360 
1361             SvxProtectItem aProtect( RES_PROTECT );
1362 			aProtect.SetSizeProtect( sal_True );
1363 			aProtect.SetPosProtect( sal_True );
1364 			aSet.Put( aProtect );
1365 
1366             pNewFmt->SetAutoUpdateFmt( sal_True );
1367 		}
1368 		break;
1369 	}
1370 	if( aSet.Count() )
1371 	{
1372         {
1373             pNewFmt->SetFmtAttr( aSet );
1374 			// JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
1375 			//				(Bug: 18545)
1376 			// SetModified();
1377 		}
1378 	}
1379 	return pNewFmt;
1380 }
1381 
1382 SwFrmFmt* SwDoc::GetFrmFmtFromPool( sal_uInt16 nId )
1383 {
1384     return (SwFrmFmt*)GetFmtFromPool( nId );
1385 }
1386 
1387 SwCharFmt* SwDoc::GetCharFmtFromPool( sal_uInt16 nId )
1388 {
1389     return (SwCharFmt*)GetFmtFromPool( nId );
1390 }
1391 
1392     // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
1393 	// benutzt wird
1394 bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
1395 {
1396     SwFmt *pNewFmt = 0;
1397 	const SvPtrarr* pArray[ 2 ];
1398 	sal_uInt16 nArrCnt = 1;
1399 	sal_Bool bFnd = sal_True;
1400 
1401 	if( RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END )
1402 	{
1403 		pArray[0] = pCharFmtTbl;
1404 	}
1405 	if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
1406 	{
1407 		pArray[0] = pFrmFmtTbl;
1408 		pArray[1] = pSpzFrmFmtTbl;
1409 		nArrCnt = 2;
1410 	}
1411 	else
1412 	{
1413 		ASSERT( sal_False, "ungueltige Id" );
1414 		bFnd = sal_False;
1415 	}
1416 
1417 	if( bFnd )
1418 	{
1419 		bFnd = sal_False;
1420 		while( nArrCnt-- && !bFnd )
1421 			for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).Count(); ++n )
1422 				if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
1423 						GetPoolFmtId() )
1424 					bFnd = sal_True;
1425 	}
1426 
1427 	// nicht gefunden oder keine Abhaengigen ?
1428 	if( bFnd && pNewFmt->GetDepends() )
1429 	{
1430 		// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
1431 		// (auch indirekte fuer Format-Ableitung! )
1432         SwAutoFmtGetDocNode aGetHt( &GetNodes() );
1433 		bFnd = !pNewFmt->GetInfo( aGetHt );
1434 	}
1435 	else
1436 		bFnd = sal_False;
1437 
1438 	return bFnd;
1439 }
1440 
1441 
1442 
1443 void lcl_PutStdPageSizeIntoItemSet( SwDoc* pDoc, SfxItemSet& rSet )
1444 {
1445 	SwPageDesc* pStdPgDsc = pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1446 	SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
1447 	if( pStdPgDsc->GetLandscape() )
1448 	{
1449 		SwTwips nTmp = aFrmSz.GetHeight();
1450 		aFrmSz.SetHeight( aFrmSz.GetWidth() );
1451 		aFrmSz.SetWidth( nTmp );
1452 	}
1453 	rSet.Put( aFrmSz );
1454 }
1455 
1456 SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
1457 {
1458     ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
1459             "Falsche AutoFormat-Id" );
1460 
1461     for( sal_uInt16 n = 0; n < aPageDescs.Count(); ++n )
1462     {
1463         if ( nId == aPageDescs[ n ]->GetPoolFmtId() )
1464         {
1465             return aPageDescs[ n ];
1466         }
1467     }
1468 
1469     if( RES_POOLPAGE_BEGIN > nId ||  nId >= RES_POOLPAGE_END )
1470     {
1471         // unknown page pool ID
1472         ASSERT( !this, "<SwDoc::GetPageDescFromPool(..)> - unknown page pool ID" );
1473         nId = RES_POOLPAGE_BEGIN;
1474     }
1475 
1476     SwPageDesc* pNewPgDsc = 0;
1477     {
1478         const ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr );
1479         const String aNm( aResId );
1480         const bool bIsModified = IsModified();
1481 
1482         sal_uInt16 nPageDescIdx = 0;
1483         {
1484             ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1485             nPageDescIdx = MakePageDesc( aNm, 0, bRegardLanguage );
1486         }
1487 
1488         pNewPgDsc = aPageDescs[ nPageDescIdx ];
1489         pNewPgDsc->SetPoolFmtId( nId );
1490         if ( !bIsModified )
1491         {
1492             ResetModified();
1493         }
1494     }
1495 
1496     SvxLRSpaceItem aLR( RES_LR_SPACE );
1497     {
1498         aLR.SetLeft( GetMetricVal( CM_1 ) * 2 );
1499         aLR.SetRight( aLR.GetLeft() );
1500     }
1501     SvxULSpaceItem aUL( RES_UL_SPACE );
1502     {
1503         aUL.SetUpper( (sal_uInt16)aLR.GetLeft() );
1504         aUL.SetLower( (sal_uInt16)aLR.GetLeft() );
1505     }
1506 
1507     SwAttrSet aSet( GetAttrPool(), aPgFrmFmtSetRange );
1508     bool bSetLeft = true;
1509 
1510     switch( nId )
1511     {
1512     case RES_POOLPAGE_STANDARD:     // "Default"
1513         {
1514             aSet.Put( aLR );
1515             aSet.Put( aUL );
1516             if( pNewPgDsc )
1517                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1518         }
1519         break;
1520 
1521     case RES_POOLPAGE_FIRST:        // "First Page"
1522     case RES_POOLPAGE_REGISTER:     // "Index"
1523         {
1524             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1525             aSet.Put( aLR );
1526             aSet.Put( aUL );
1527             if( pNewPgDsc )
1528             {
1529                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1530                 if( RES_POOLPAGE_FIRST == nId )
1531                     pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD ));
1532             }
1533         }
1534         break;
1535 
1536     case RES_POOLPAGE_LEFT:         // "Left Page"
1537         {
1538             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1539             aSet.Put( aLR );
1540             aSet.Put( aUL );
1541             bSetLeft = false;
1542             if( pNewPgDsc )
1543                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT );
1544         }
1545         break;
1546     case RES_POOLPAGE_RIGHT:        // "Right Page"
1547         {
1548             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1549             aSet.Put( aLR );
1550             aSet.Put( aUL );
1551             bSetLeft = false;
1552             if( pNewPgDsc )
1553                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT );
1554         }
1555         break;
1556 
1557     case RES_POOLPAGE_JAKET:        // "Envelope"
1558         {
1559             Size aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65 ) );
1560             LandscapeSwap( aPSize );
1561             aSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aPSize.Width(), aPSize.Height() ));
1562             aLR.SetLeft( 0 ); aLR.SetRight( 0 );
1563             aUL.SetUpper( 0 ); aUL.SetLower( 0 );
1564             aSet.Put( aLR );
1565             aSet.Put( aUL );
1566 
1567             if( pNewPgDsc )
1568             {
1569                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1570                 pNewPgDsc->SetLandscape( sal_True );
1571             }
1572         }
1573         break;
1574 
1575     case RES_POOLPAGE_HTML:         // "HTML"
1576         {
1577             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1578             aLR.SetRight( GetMetricVal( CM_1 ));
1579             aUL.SetUpper( (sal_uInt16)aLR.GetRight() );
1580             aUL.SetLower( (sal_uInt16)aLR.GetRight() );
1581             aSet.Put( aLR );
1582             aSet.Put( aUL );
1583 
1584             if( pNewPgDsc )
1585                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1586         }
1587         break;
1588 
1589     case RES_POOLPAGE_FOOTNOTE:     // "Footnote"
1590     case RES_POOLPAGE_ENDNOTE:      // "Endnote"
1591         {
1592             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1593             aSet.Put( aLR );
1594             aSet.Put( aUL );
1595             if( pNewPgDsc )
1596                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1597             SwPageFtnInfo aInf( pNewPgDsc->GetFtnInfo() );
1598             aInf.SetLineWidth( 0 );
1599             aInf.SetTopDist( 0 );
1600             aInf.SetBottomDist( 0 );
1601             pNewPgDsc->SetFtnInfo( aInf );
1602         }
1603         break;
1604 
1605     case RES_POOLPAGE_LANDSCAPE:    // "Landscape"
1606         {
1607             SwPageDesc* pStdPgDsc = this->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1608             SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
1609             if ( !pStdPgDsc->GetLandscape() )
1610             {
1611                 const SwTwips nTmp = aFrmSz.GetHeight();
1612                 aFrmSz.SetHeight( aFrmSz.GetWidth() );
1613                 aFrmSz.SetWidth( nTmp );
1614             }
1615             aSet.Put( aFrmSz );
1616             aSet.Put( aLR );
1617             aSet.Put( aUL );
1618             if( pNewPgDsc )
1619             {
1620                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1621                 pNewPgDsc->SetLandscape( sal_True );
1622             }
1623         }
1624         break;
1625 
1626     }
1627 
1628     if( aSet.Count() )
1629     {
1630         if( bSetLeft )
1631             pNewPgDsc->GetLeft().SetFmtAttr( aSet );
1632         pNewPgDsc->GetMaster().SetFmtAttr( aSet );
1633     }
1634     return pNewPgDsc;
1635 }
1636 
1637 SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId )
1638 {
1639 	ASSERT( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END,
1640 			"Falsche AutoFormat-Id" );
1641 
1642     SwNumRule* pNewRule;
1643 	sal_uInt16 n;
1644 
1645 	for( n = 0; n < GetNumRuleTbl().Count(); ++n )
1646 		if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() )
1647 		{
1648             return pNewRule;
1649 		}
1650 
1651 	// Fehlerfall: unbekannte Poolvorlage
1652 	if( RES_POOLNUMRULE_BEGIN > nId ||  nId >= RES_POOLNUMRULE_END )
1653 	{
1654 		ASSERT( !this, "ungueltige Id" );
1655 		nId = RES_POOLNUMRULE_BEGIN;
1656 	}
1657 
1658 	ResId aResId( sal_uInt32(RC_POOLNUMRULE_BEGIN + nId - RES_POOLNUMRULE_BEGIN), *pSwResMgr );
1659 	String aNm( aResId );
1660 
1661 	SwCharFmt *pNumCFmt = 0, *pBullCFmt = 0;
1662 
1663     // --> OD 2008-02-11 #newlistlevelattrs#
1664     const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode
1665                                   // --> OD 2008-06-06 #i89178#
1666                                   = numfunc::GetDefaultPositionAndSpaceMode();
1667                                   // <--
1668     // <--
1669     {
1670 		sal_Bool bIsModified = IsModified();
1671         // --> OD 2008-02-11 #newlistlevelattrs#
1672         n = MakeNumRule( aNm, 0, sal_False, eNumberFormatPositionAndSpaceMode );
1673         // <--
1674 		pNewRule = GetNumRuleTbl()[ n ];
1675 		pNewRule->SetPoolFmtId( nId );
1676 		pNewRule->SetAutoRule( sal_False );
1677 
1678 		if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 )
1679 			pNumCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1680 
1681 		if( ( RES_POOLNUMRULE_BUL1 <= nId && nId <= RES_POOLNUMRULE_BUL5 ) ||
1682 			RES_POOLNUMRULE_NUM5 == nId )
1683 			pBullCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1684 
1685 		if( !bIsModified )
1686 			ResetModified();
1687 	}
1688 
1689 	switch( nId )
1690 	{
1691 	case RES_POOLNUMRULE_NUM1:
1692 		{
1693 			SwNumFmt aFmt;
1694             // --> OD 2008-02-11 #newlistlevelattrs#
1695             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1696             // <--
1697 			aFmt.SetNumberingType(SVX_NUM_ARABIC);
1698 			aFmt.SetCharFmt( pNumCFmt );
1699 			aFmt.SetStart( 1 );
1700 			aFmt.SetIncludeUpperLevels( 1 );
1701 			aFmt.SetSuffix( aDotStr );
1702 
1703 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1704 				{
1705 //				cm: 0,5  1,0  1,5  2,0   2,5   3,0   3,5   4,0   4,5   5,0
1706 					283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1707 				};
1708 #ifdef USE_MEASUREMENT
1709 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1710 				{
1711 					283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1712 				};
1713 			const sal_uInt16* pArr = MEASURE_METRIC ==
1714 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1715 									? aAbsSpace
1716 									: aAbsSpaceInch;
1717 #else
1718 			const sal_uInt16* pArr = aAbsSpace;
1719 #endif
1720 
1721             // --> OD 2008-02-11 #newlistlevelattrs#
1722             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1723             {
1724                 aFmt.SetFirstLineOffset( - (*pArr) );
1725             }
1726             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1727             {
1728                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1729                 aFmt.SetFirstLineIndent( - (*pArr) );
1730             }
1731             // <--
1732 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
1733 			{
1734                 // --> OD 2008-02-11 #newlistlevelattrs#
1735                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1736                 {
1737                     aFmt.SetAbsLSpace( *pArr );
1738                 }
1739                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1740                 {
1741                     aFmt.SetListtabPos( *pArr );
1742                     aFmt.SetIndentAt( *pArr );
1743                 }
1744                 // <--
1745 				pNewRule->Set( n, aFmt );
1746 			}
1747 		}
1748 		break;
1749 
1750 	case RES_POOLNUMRULE_NUM2:
1751 		{
1752 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1753 				{
1754 					283,  283,  567,  709,		// 0.50, 0.50, 1.00, 1.25
1755 					850, 1021, 1304, 1474,		// 1.50, 1.80, 2.30, 2.60
1756 				   1588, 1758					// 2.80, 3.10
1757 				};
1758 
1759 #ifdef USE_MEASUREMENT
1760 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1761 				{
1762 					385,  385,  770,  963,
1763 				   1155, 1386, 1771, 2002,
1764 				   2156, 2387
1765 				};
1766 
1767 			const sal_uInt16* pArr = MEASURE_METRIC ==
1768 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1769 									? aAbsSpace
1770 									: aAbsSpaceInch;
1771 #else
1772 			const sal_uInt16* pArr = aAbsSpace;
1773 #endif
1774 			SwNumFmt aFmt;
1775             // --> OD 2008-02-11 #newlistlevelattrs#
1776             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1777             // <--
1778 			aFmt.SetNumberingType(SVX_NUM_ARABIC);
1779 			aFmt.SetCharFmt( pNumCFmt );
1780 			aFmt.SetIncludeUpperLevels( 1 );
1781             // --> OD 2008-02-11 #newlistlevelattrs#
1782             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1783             {
1784                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1785             }
1786             // <--
1787 			sal_uInt16 nSpace = 0;
1788 			for( n = 0; n < MAXLEVEL; ++n )
1789 			{
1790                 // --> OD 2008-02-11 #newlistlevelattrs#
1791                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1792                 {
1793                     aFmt.SetAbsLSpace( nSpace = nSpace + pArr[ n ] );
1794                     aFmt.SetFirstLineOffset( - pArr[ n ] );
1795                 }
1796                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1797                 {
1798                     aFmt.SetListtabPos( nSpace = nSpace + pArr[ n ] );
1799                     aFmt.SetIndentAt( nSpace );
1800                     aFmt.SetFirstLineIndent( - pArr[ n ] );
1801                 }
1802                 // <--
1803 				aFmt.SetStart( n+1 );
1804 				pNewRule->Set( n, aFmt );
1805 			}
1806 		}
1807 		break;
1808 	case RES_POOLNUMRULE_NUM3:
1809 		{
1810 			SwNumFmt aFmt;
1811             // --> OD 2008-02-11 #newlistlevelattrs#
1812             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1813             // <--
1814 			aFmt.SetNumberingType(SVX_NUM_ARABIC);
1815 			aFmt.SetCharFmt( pNumCFmt );
1816 			aFmt.SetIncludeUpperLevels( 1 );
1817 
1818             sal_uInt16 nOffs = GetMetricVal( CM_1 ) * 3;
1819             // --> OD 2008-02-11 #newlistlevelattrs#
1820             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1821             {
1822                 aFmt.SetFirstLineOffset( - nOffs );
1823             }
1824             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1825             {
1826                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1827                 aFmt.SetFirstLineIndent( - nOffs );
1828             }
1829             // <--
1830 
1831 			for( n = 0; n < MAXLEVEL; ++n )
1832 			{
1833                 // --> OD 2008-02-11 #newlistlevelattrs#
1834                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1835                 {
1836                     aFmt.SetAbsLSpace( (n+1) * nOffs );
1837                 }
1838                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1839                 {
1840                     aFmt.SetListtabPos( (n+1) * nOffs );
1841                     aFmt.SetIndentAt( (n+1) * nOffs );
1842                 }
1843                 // <--
1844                 aFmt.SetStart( n+1 );
1845 				pNewRule->Set( n, aFmt );
1846 			}
1847 		}
1848 		break;
1849 	case RES_POOLNUMRULE_NUM4:
1850 		{
1851 			SwNumFmt aFmt;
1852             // --> OD 2008-02-11 #newlistlevelattrs#
1853             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1854             // <--
1855 			aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER);
1856 			aFmt.SetCharFmt( pNumCFmt );
1857 			aFmt.SetIncludeUpperLevels( 1 );
1858 			aFmt.SetSuffix( aDotStr );
1859 
1860 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1861 				{
1862 //				cm: 0,5  1,0  1,5  2,0   2,5   3,0   3,5   4,0   4,5   5,0
1863 					283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1864 				};
1865 #ifdef USE_MEASUREMENT
1866 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1867 				{
1868 					283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1869 				};
1870 			const sal_uInt16* pArr = MEASURE_METRIC ==
1871 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1872 									? aAbsSpace
1873 									: aAbsSpaceInch;
1874 #else
1875 			const sal_uInt16* pArr = aAbsSpace;
1876 #endif
1877 
1878             // --> OD 2008-02-11 #newlistlevelattrs#
1879             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1880             {
1881                 aFmt.SetFirstLineOffset( - (*pArr) );
1882             }
1883             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1884             {
1885                 aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
1886                 aFmt.SetFirstLineIndent( - (*pArr) );
1887             }
1888             // <--
1889 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
1890 			{
1891 				aFmt.SetStart( n + 1 );
1892                 // --> OD 2008-02-11 #newlistlevelattrs#
1893                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1894                 {
1895                     aFmt.SetAbsLSpace( *pArr );
1896                 }
1897                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1898                 {
1899                     aFmt.SetListtabPos( *pArr );
1900                     aFmt.SetIndentAt( *pArr );
1901                 }
1902                 // <--
1903 				pNewRule->Set( n, aFmt );
1904 			}
1905 		}
1906 		break;
1907 	case RES_POOLNUMRULE_NUM5:
1908 		{
1909 			// [ First, LSpace ]
1910 			static const sal_uInt16 aAbsSpace0to2[] =
1911 				{
1912 					227,  227,  	// 0.40, 0.40,
1913 					369,  624,		// 0.65, 1.10,
1914 					255,  879 		// 0.45, 1.55
1915 				};
1916 
1917 #ifdef USE_MEASUREMENT
1918 			static const sal_uInt16 aAbsSpaceInch0to2[] =
1919 				{
1920 					308,  308,
1921 					501,  847,
1922 					347, 1194
1923 				};
1924 			const sal_uInt16* pArr0to2 = MEASURE_METRIC ==
1925 							SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1926 								? aAbsSpace0to2
1927 								: aAbsSpaceInch0to2;
1928 #else
1929 			const sal_uInt16* pArr0to2 = aAbsSpace0to2;
1930 #endif
1931 			SwNumFmt aFmt;
1932             // --> OD 2008-02-11 #newlistlevelattrs#
1933             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1934             // <--
1935 			aFmt.SetNumberingType(SVX_NUM_ARABIC);
1936 			aFmt.SetStart( 1 );
1937 			aFmt.SetIncludeUpperLevels( 1 );
1938 			aFmt.SetSuffix( aDotStr );
1939             // --> OD 2008-02-11 #newlistlevelattrs#
1940             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1941             {
1942                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1943             }
1944             // <--
1945 
1946             // --> OD 2008-02-11 #newlistlevelattrs#
1947             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1948             {
1949                 aFmt.SetFirstLineOffset( -pArr0to2[0] );    // == 0.40 cm
1950                 aFmt.SetAbsLSpace( pArr0to2[1] );           // == 0.40 cm
1951             }
1952             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1953             {
1954                 aFmt.SetFirstLineIndent( -pArr0to2[0] );
1955                 aFmt.SetListtabPos( pArr0to2[1] );
1956                 aFmt.SetIndentAt( pArr0to2[1] );
1957             }
1958             // <--
1959 
1960 			aFmt.SetCharFmt( pNumCFmt );
1961 			pNewRule->Set( 0, aFmt );
1962 
1963 			aFmt.SetIncludeUpperLevels( 2 );
1964 			aFmt.SetStart( 2 );
1965             // --> OD 2008-02-11 #newlistlevelattrs#
1966             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1967             {
1968                 aFmt.SetFirstLineOffset( -pArr0to2[2] );    // == 0.65 cm
1969                 aFmt.SetAbsLSpace( pArr0to2[3] );           // == 1.10 cm
1970             }
1971             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1972             {
1973                 aFmt.SetFirstLineIndent( -pArr0to2[2] );
1974                 aFmt.SetListtabPos( pArr0to2[3] );
1975                 aFmt.SetIndentAt( pArr0to2[3] );
1976             }
1977             // <--
1978 			pNewRule->Set( 1, aFmt );
1979 
1980 			aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER);
1981 			aFmt.SetSuffix( ')');
1982 			aFmt.SetIncludeUpperLevels( 1 );
1983 			aFmt.SetStart( 3 );
1984             // --> OD 2008-02-11 #newlistlevelattrs#
1985             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1986             {
1987                 aFmt.SetFirstLineOffset( - pArr0to2[4] );   // == 0.45cm
1988                 aFmt.SetAbsLSpace( pArr0to2[5] );           // == 1.55 cm
1989             }
1990             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1991             {
1992                 aFmt.SetFirstLineIndent( -pArr0to2[4] );
1993                 aFmt.SetListtabPos( pArr0to2[5] );
1994                 aFmt.SetIndentAt( pArr0to2[5] );
1995             }
1996             // <--
1997 			pNewRule->Set( 2, aFmt );
1998 
1999 
2000 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2001 			aFmt.SetCharFmt( pBullCFmt );
2002             // --> OD 2006-06-29 #6440955#
2003             aFmt.SetBulletFont(  &numfunc::GetDefBulletFont() );
2004             // <--
2005 			aFmt.SetBulletChar( cBulletChar );
2006 			sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4,
2007 				   nOffs2 = GetMetricVal( CM_1 ) * 2;
2008 
2009             // --> OD 2008-02-11 #newlistlevelattrs#
2010             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2011             {
2012                 aFmt.SetFirstLineOffset( - nOffs );
2013             }
2014             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2015             {
2016                 aFmt.SetFirstLineIndent( - nOffs );
2017             }
2018             // <--
2019 			aFmt.SetSuffix( aEmptyStr );
2020 			for( n = 3; n < MAXLEVEL; ++n )
2021 			{
2022 				aFmt.SetStart( n+1 );
2023                 // --> OD 2008-02-11 #newlistlevelattrs#
2024                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2025                 {
2026                     aFmt.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) );
2027                 }
2028                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2029                 {
2030                     aFmt.SetListtabPos( nOffs2 + ((n-3) * nOffs) );
2031                     aFmt.SetIndentAt( nOffs2 + ((n-3) * nOffs) );
2032                 }
2033                 // <--
2034 				pNewRule->Set( n, aFmt );
2035 			}
2036 		}
2037 		break;
2038 
2039 	case RES_POOLNUMRULE_BUL1:
2040 		{
2041 			SwNumFmt aFmt;
2042             // --> OD 2008-02-11 #newlistlevelattrs#
2043             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2044             // <--
2045 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2046 			aFmt.SetCharFmt( pBullCFmt );
2047 			aFmt.SetStart( 1 );
2048 			aFmt.SetIncludeUpperLevels( 1 );
2049             // --> OD 2006-06-29 #6440955#
2050             aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2051             // <--
2052             aFmt.SetBulletChar( cBulletChar );
2053 
2054 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2055 				{
2056 //				cm: 0,4  0,8  1,2  1,6  2,0   2,4   2,8   3,2   3,6   4,0
2057 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2058 				};
2059 #ifdef USE_MEASUREMENT
2060 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2061 				{
2062 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2063 				};
2064 			const sal_uInt16* pArr = MEASURE_METRIC ==
2065 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2066 									? aAbsSpace
2067 									: aAbsSpaceInch;
2068 #else
2069 			const sal_uInt16* pArr = aAbsSpace;
2070 #endif
2071 
2072             // --> OD 2008-02-11 #newlistlevelattrs#
2073             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2074             {
2075                 aFmt.SetFirstLineOffset( - (*pArr) );
2076             }
2077             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2078             {
2079                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2080                 aFmt.SetFirstLineIndent( - (*pArr) );
2081             }
2082             // <--
2083 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2084 			{
2085                 // --> OD 2008-02-11 #newlistlevelattrs#
2086                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2087                 {
2088                     aFmt.SetAbsLSpace( *pArr );
2089                 }
2090                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2091                 {
2092                     aFmt.SetListtabPos( *pArr );
2093                     aFmt.SetIndentAt( *pArr );
2094                 }
2095                 // <--
2096 				pNewRule->Set( n, aFmt );
2097 			}
2098 		}
2099 		break;
2100 	case RES_POOLNUMRULE_BUL2:
2101 		{
2102 			SwNumFmt aFmt;
2103             // --> OD 2008-02-11 #newlistlevelattrs#
2104             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2105             // <--
2106 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2107 			aFmt.SetCharFmt( pBullCFmt );
2108 			aFmt.SetStart( 1 );
2109 			aFmt.SetIncludeUpperLevels( 1 );
2110             // --> OD 2006-06-29 #6440955#
2111             aFmt.SetBulletFont(  &numfunc::GetDefBulletFont() );
2112             // <--
2113             aFmt.SetBulletChar( 0x2013 );
2114 
2115 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2116 				{
2117 //				cm: 0,3  0,6  0,9  1,2  1,5  1,8   2,1   2,4   2,7   3,0
2118 					170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2119 				};
2120 #ifdef USE_MEASUREMENT
2121 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2122 				{
2123 					170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2124 				};
2125 			const sal_uInt16* pArr = MEASURE_METRIC ==
2126 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2127 									? aAbsSpace
2128 									: aAbsSpaceInch;
2129 #else
2130 			const sal_uInt16* pArr = aAbsSpace;
2131 #endif
2132 
2133             // --> OD 2008-02-11 #newlistlevelattrs#
2134             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2135             {
2136                 aFmt.SetFirstLineOffset( - (*pArr) );
2137             }
2138             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2139             {
2140                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2141                 aFmt.SetFirstLineIndent( - (*pArr) );
2142             }
2143             // <--
2144 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2145 			{
2146                 // --> OD 2008-02-11 #newlistlevelattrs#
2147                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2148                 {
2149                     aFmt.SetAbsLSpace( *pArr );
2150                 }
2151                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2152                 {
2153                     aFmt.SetListtabPos( *pArr );
2154                     aFmt.SetIndentAt( *pArr );
2155                 }
2156                 // <--
2157                 pNewRule->Set( n, aFmt );
2158 			}
2159 		}
2160 		break;
2161 	case RES_POOLNUMRULE_BUL3:
2162 		{
2163 			SwNumFmt aFmt;
2164             // --> OD 2008-02-11 #newlistlevelattrs#
2165             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2166             // <--
2167 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2168 			aFmt.SetCharFmt( pBullCFmt );
2169 			aFmt.SetStart( 1 );
2170 			aFmt.SetIncludeUpperLevels( 1 );
2171             // --> OD 2006-06-29 #6440955#
2172             aFmt.SetBulletFont(  &numfunc::GetDefBulletFont() );
2173             // <--
2174 
2175             sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4;
2176             // --> OD 2008-02-11 #newlistlevelattrs#
2177             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2178             {
2179                 aFmt.SetFirstLineOffset( - nOffs );
2180             }
2181             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2182             {
2183                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2184                 aFmt.SetFirstLineIndent( - nOffs );
2185             }
2186             // <--
2187 
2188 			for( n = 0; n < MAXLEVEL; ++n )
2189 			{
2190 				aFmt.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) );
2191                 // --> OD 2008-02-11 #newlistlevelattrs#
2192                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2193                 {
2194                     aFmt.SetAbsLSpace( ((n & 1) +1) * nOffs );
2195                 }
2196                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2197                 {
2198                     aFmt.SetListtabPos( ((n & 1) +1) * nOffs );
2199                     aFmt.SetIndentAt( ((n & 1) +1) * nOffs );
2200                 }
2201                 // <--
2202 				pNewRule->Set( n, aFmt );
2203 			}
2204 		}
2205 		break;
2206 	case RES_POOLNUMRULE_BUL4:
2207 		{
2208 			SwNumFmt aFmt;
2209             // --> OD 2008-02-11 #newlistlevelattrs#
2210             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2211             // <--
2212 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2213 			aFmt.SetCharFmt( pBullCFmt );
2214 			aFmt.SetStart( 1 );
2215 			aFmt.SetIncludeUpperLevels( 1 );
2216             // --> OD 2006-06-29 #6440955#
2217             aFmt.SetBulletFont(  &numfunc::GetDefBulletFont() );
2218             // <--
2219 
2220 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2221 				{
2222 //				cm: 0,4  0,8  1,2  1,6  2,0   2,4   2,8   3,2   3,6   4,0
2223 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2224 				};
2225 #ifdef USE_MEASUREMENT
2226 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2227 				{
2228 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2229 				};
2230 			const sal_uInt16* pArr = MEASURE_METRIC ==
2231 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2232 									? aAbsSpace
2233 									: aAbsSpaceInch;
2234 #else
2235 			const sal_uInt16* pArr = aAbsSpace;
2236 #endif
2237 
2238             // --> OD 2008-02-11 #newlistlevelattrs#
2239             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2240             {
2241                 aFmt.SetFirstLineOffset( - (*pArr) );
2242             }
2243             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2244             {
2245                 aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
2246                 aFmt.SetFirstLineIndent( - (*pArr) );
2247             }
2248             // <--
2249 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2250 			{
2251 				switch( n )
2252 				{
2253 				case 0: 	aFmt.SetBulletChar( 0x27a2 );	break;
2254 				case 1:		aFmt.SetBulletChar( 0xE006 );	break;
2255 				default:	aFmt.SetBulletChar( 0xE004 );	break;
2256 				}
2257                 // --> OD 2008-02-11 #newlistlevelattrs#
2258                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2259                 {
2260                     aFmt.SetAbsLSpace( *pArr );
2261                 }
2262                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2263                 {
2264                     aFmt.SetListtabPos( *pArr );
2265                     aFmt.SetIndentAt( *pArr );
2266                 }
2267                 // <--
2268 				pNewRule->Set( n, aFmt );
2269 			}
2270 		}
2271 		break;
2272 	case RES_POOLNUMRULE_BUL5:
2273 		{
2274 			SwNumFmt aFmt;
2275             // --> OD 2008-02-11 #newlistlevelattrs#
2276             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2277             // <--
2278 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2279 			aFmt.SetCharFmt( pBullCFmt );
2280 			aFmt.SetStart( 1 );
2281 			aFmt.SetIncludeUpperLevels( 1 );
2282 			aFmt.SetBulletChar( 0x2717 );
2283             // --> OD 2006-06-29 #6440955#
2284             aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2285             // <--
2286 
2287 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2288 				{
2289 //				cm: 0,4  0,8  1,2  1,6  2,0   2,4   2,8   3,2   3,6   4,0
2290 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2291 				};
2292 #ifdef USE_MEASUREMENT
2293 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2294 				{
2295 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2296 				};
2297 			const sal_uInt16* pArr = MEASURE_METRIC ==
2298 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2299 									? aAbsSpace
2300 									: aAbsSpaceInch;
2301 #else
2302 			const sal_uInt16* pArr = aAbsSpace;
2303 #endif
2304 
2305             // --> OD 2008-02-11 #newlistlevelattrs#
2306             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2307             {
2308                 aFmt.SetFirstLineOffset( - (*pArr) );
2309             }
2310             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2311             {
2312                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2313                 aFmt.SetFirstLineIndent( - (*pArr) );
2314             }
2315             // <--
2316 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2317 			{
2318                 // --> OD 2008-02-11 #newlistlevelattrs#
2319                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2320                 {
2321                     aFmt.SetAbsLSpace( *pArr );
2322                 }
2323                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2324                 {
2325                     aFmt.SetListtabPos( *pArr );
2326                     aFmt.SetIndentAt( *pArr );
2327                 }
2328                 // <--
2329 				pNewRule->Set( n, aFmt );
2330 			}
2331 		}
2332 		break;
2333 	}
2334 
2335     return pNewRule;
2336 }
2337 
2338 
2339 
2340 	// pruefe, ob diese "Auto-Collection" in Dokument schon/noch
2341 	// benutzt wird
2342 bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId ) const
2343 {
2344 	ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
2345 			"Falsche AutoFormat-Id" );
2346 	SwPageDesc *pNewPgDsc = 0;
2347 	sal_Bool bFnd = sal_False;
2348 	for( sal_uInt16 n = 0; !bFnd && n < aPageDescs.Count(); ++n )
2349     {
2350 		pNewPgDsc = aPageDescs[ n ];
2351 		if( nId == pNewPgDsc->GetPoolFmtId() )
2352 			bFnd = sal_True;
2353     }
2354 
2355 	// nicht gefunden oder keine Abhaengigen ?
2356 	if( !bFnd || !pNewPgDsc->GetDepends() )		// ??????
2357 		return sal_False;
2358 
2359 	// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2360 	// (auch indirekte fuer Format-Ableitung! )
2361     SwAutoFmtGetDocNode aGetHt( &GetNodes() );
2362 	return !pNewPgDsc->GetInfo( aGetHt );
2363 }
2364 
2365 // erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
2366 sal_Bool SwDoc::IsUsed( const SwModify& rModify ) const
2367 {
2368 	// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2369 	// (auch indirekte fuer Format-Ableitung! )
2370     SwAutoFmtGetDocNode aGetHt( &GetNodes() );
2371 	return !rModify.GetInfo( aGetHt );
2372 }
2373 
2374 // erfrage ob die NumRule benutzt wird
2375 sal_Bool SwDoc::IsUsed( const SwNumRule& rRule ) const
2376 {
2377     // --> OD 2008-03-04 #refactorlists#
2378 //    // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2379 //    // (auch indirekte fuer Format-Ableitung! )
2380 //    sal_Bool bUsed = sal_False;
2381 //    SwAutoFmtGetDocNode aGetHt( &aNodes );
2382 //    SwModify* pMod;
2383 //    const SfxPoolItem* pItem;
2384 //    sal_uInt16 i, nMaxItems = GetAttrPool().GetItemCount( RES_PARATR_NUMRULE);
2385 //    for( i = 0; i < nMaxItems; ++i )
2386 //    {
2387 //        if( 0 != (pItem = GetAttrPool().GetItem( RES_PARATR_NUMRULE, i ) ) &&
2388 //            0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->GetDefinedIn()) &&
2389 //            ((SwNumRuleItem*)pItem)->GetValue().Len() &&
2390 //            ((SwNumRuleItem*)pItem)->GetValue() == rRule.GetName() )
2391 //        {
2392 //            if( pMod->IsA( TYPE( SwFmt )) )
2393 //            {
2394 //                bUsed = !pMod->GetInfo( aGetHt );
2395 //                if( bUsed )
2396 //                    break;
2397 //            }
2398 //            else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
2399 //            {
2400 //                bUsed = sal_True;
2401 //                break;
2402 //            }
2403 //        }
2404 //    }
2405 
2406 //    return bUsed;
2407     sal_Bool bUsed = rRule.GetTxtNodeListSize() > 0 ||
2408                      rRule.GetParagraphStyleListSize() > 0;
2409 
2410     return bUsed;
2411     // <--
2412 }
2413 
2414 	// Suche die Position vom Vorlagen-Namen. Ist nicht vorhanden
2415 	// dann fuege neu ein
2416 sal_uInt16 SwDoc::SetDocPattern( const String& rPatternName )
2417 {
2418 	ASSERT( rPatternName.Len(), "kein Dokument-Vorlagenname" );
2419 
2420 	sal_uInt16 nNewPos = aPatternNms.Count();
2421 	for( sal_uInt16 n = 0; n < aPatternNms.Count(); ++n )
2422 		if( !aPatternNms[n] )
2423 		{
2424 			if( nNewPos == aPatternNms.Count() )
2425 				nNewPos = n;
2426 		}
2427 		else if( rPatternName == *aPatternNms[n] )
2428 			return n;
2429 
2430 	if( nNewPos < aPatternNms.Count() )
2431 		aPatternNms.Remove( nNewPos );		// Platz wieder frei machen
2432 
2433 	String* pNewNm = new String( rPatternName );
2434 	aPatternNms.Insert( pNewNm, nNewPos );
2435 	SetModified();
2436 	return nNewPos;
2437 }
2438 
2439 sal_uInt16 GetPoolParent( sal_uInt16 nId )
2440 {
2441 	sal_uInt16 nRet = USHRT_MAX;
2442 	if( POOLGRP_NOCOLLID & nId )		// 1 == Formate / 0 == Collections
2443 	{
2444 		switch( ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID ) & nId )
2445 		{
2446 		case POOLGRP_CHARFMT:
2447 		case POOLGRP_FRAMEFMT:
2448 			nRet = 0; 			// vom default abgeleitet
2449 			break;
2450 		case POOLGRP_PAGEDESC:
2451 		case POOLGRP_NUMRULE:
2452 			break;				// es gibt keine Ableitung
2453 		}
2454 	}
2455 	else
2456 	{
2457 		switch( COLL_GET_RANGE_BITS & nId )
2458 		{
2459 		case COLL_TEXT_BITS:
2460 			switch( nId )
2461 			{
2462 			case RES_POOLCOLL_STANDARD:
2463 					nRet = 0;									break;
2464 			case RES_POOLCOLL_TEXT_IDENT:
2465 			case RES_POOLCOLL_TEXT_NEGIDENT:
2466 			case RES_POOLCOLL_TEXT_MOVE:
2467 			case RES_POOLCOLL_CONFRONTATION:
2468 			case RES_POOLCOLL_MARGINAL:
2469 					nRet = RES_POOLCOLL_TEXT;					break;
2470 
2471 			case RES_POOLCOLL_TEXT:
2472 			case RES_POOLCOLL_GREETING:
2473 			case RES_POOLCOLL_SIGNATURE:
2474 			case RES_POOLCOLL_HEADLINE_BASE:
2475 					nRet = RES_POOLCOLL_STANDARD;				break;
2476 
2477 			case RES_POOLCOLL_HEADLINE1:
2478 			case RES_POOLCOLL_HEADLINE2:
2479 			case RES_POOLCOLL_HEADLINE3:
2480 			case RES_POOLCOLL_HEADLINE4:
2481 			case RES_POOLCOLL_HEADLINE5:
2482 			case RES_POOLCOLL_HEADLINE6:
2483 			case RES_POOLCOLL_HEADLINE7:
2484 			case RES_POOLCOLL_HEADLINE8:
2485 			case RES_POOLCOLL_HEADLINE9:
2486 			case RES_POOLCOLL_HEADLINE10:
2487 					nRet = RES_POOLCOLL_HEADLINE_BASE; 			break;
2488 			}
2489 			break;
2490 
2491 		case COLL_LISTS_BITS:
2492 			switch( nId )
2493 			{
2494 			case RES_POOLCOLL_NUMBUL_BASE:
2495 					nRet = RES_POOLCOLL_TEXT;					break;
2496 
2497 			default:
2498 				nRet = RES_POOLCOLL_NUMBUL_BASE;				break;
2499 			}
2500 			break;
2501 
2502 		case COLL_EXTRA_BITS:
2503 			switch( nId )
2504 			{
2505 			case RES_POOLCOLL_FRAME:
2506 					nRet = RES_POOLCOLL_TEXT;					break;
2507 
2508 			case RES_POOLCOLL_TABLE_HDLN:
2509 					nRet = RES_POOLCOLL_TABLE;					break;
2510 
2511             case RES_POOLCOLL_TABLE:
2512 			case RES_POOLCOLL_FOOTNOTE:
2513 			case RES_POOLCOLL_ENDNOTE:
2514 			case RES_POOLCOLL_JAKETADRESS:
2515 			case RES_POOLCOLL_SENDADRESS:
2516 			case RES_POOLCOLL_HEADER:
2517 			case RES_POOLCOLL_HEADERL:
2518 			case RES_POOLCOLL_HEADERR:
2519 			case RES_POOLCOLL_FOOTER:
2520 			case RES_POOLCOLL_FOOTERL:
2521 			case RES_POOLCOLL_FOOTERR:
2522 			case RES_POOLCOLL_LABEL:
2523 					nRet = RES_POOLCOLL_STANDARD;				break;
2524 
2525 			case RES_POOLCOLL_LABEL_ABB:
2526 			case RES_POOLCOLL_LABEL_TABLE:
2527 			case RES_POOLCOLL_LABEL_FRAME:
2528 			case RES_POOLCOLL_LABEL_DRAWING:
2529 					nRet = RES_POOLCOLL_LABEL;					break;
2530 			}
2531 			break;
2532 
2533 		case COLL_REGISTER_BITS:
2534 			switch( nId )
2535 			{
2536 			case RES_POOLCOLL_REGISTER_BASE:
2537 					nRet = RES_POOLCOLL_STANDARD;				break;
2538 
2539 			case RES_POOLCOLL_TOX_USERH:
2540 			case RES_POOLCOLL_TOX_CNTNTH:
2541 			case RES_POOLCOLL_TOX_IDXH:
2542 			case RES_POOLCOLL_TOX_ILLUSH:
2543 			case RES_POOLCOLL_TOX_OBJECTH:
2544 			case RES_POOLCOLL_TOX_TABLESH:
2545 			case RES_POOLCOLL_TOX_AUTHORITIESH:
2546 					nRet = RES_POOLCOLL_HEADLINE_BASE;  		break;
2547 
2548 			default:
2549 					nRet = RES_POOLCOLL_REGISTER_BASE;  		break;
2550 			}
2551 			break;
2552 
2553 		case COLL_DOC_BITS:
2554 			nRet = RES_POOLCOLL_HEADLINE_BASE;
2555 			break;
2556 
2557 		case COLL_HTML_BITS:
2558 			nRet = RES_POOLCOLL_STANDARD;
2559 			break;
2560 		}
2561 	}
2562 
2563 	return nRet;
2564 }
2565 
2566 void SwDoc::RemoveAllFmtLanguageDependencies()
2567 {
2568     /* #106748# Restore the language independ pool defaults and styles. */
2569     GetAttrPool().ResetPoolDefaultItem( RES_PARATR_ADJUST );
2570 
2571 	SwTxtFmtColl * pTxtFmtColl = GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
2572 
2573     pTxtFmtColl->ResetFmtAttr( RES_PARATR_ADJUST );
2574     /* #111214# koreans do not like SvxScriptItem(sal_True) */
2575     pTxtFmtColl->ResetFmtAttr( RES_PARATR_SCRIPTSPACE );
2576 
2577     SvxFrameDirectionItem aFrameDir( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR );
2578 
2579 	sal_uInt16 nCount = GetPageDescCnt();
2580 	for( sal_uInt16 i=0; i<nCount; ++i )
2581 	{
2582 		SwPageDesc& rDesc = _GetPageDesc( i );
2583         rDesc.GetMaster().SetFmtAttr( aFrameDir );
2584         rDesc.GetLeft().SetFmtAttr( aFrameDir );
2585 	}
2586 
2587     // OD 09.10.2003 #i18732# - restore static pool default for item
2588     // RES_FOLLOW_TEXT_FLOW.
2589     GetAttrPool().ResetPoolDefaultItem( RES_FOLLOW_TEXT_FLOW );
2590 
2591     //#i16874# AutoKerning as default for new documents
2592 	GetAttrPool().ResetPoolDefaultItem( RES_CHRATR_AUTOKERN );
2593 }
2594