xref: /aoo42x/main/sw/source/core/doc/poolfmt.cxx (revision 64b14621)
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             //UUUU for styles of FlyFrames do not set the FillStyle to make it a derived attribute
1316             aSet.ClearItem(XATTR_FILLSTYLE);
1317         }
1318         break;
1319     case RES_POOLFRM_GRAPHIC:
1320 	case RES_POOLFRM_OLE:
1321 		{
1322             aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
1323             aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1324             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1325 			aSet.Put( SwFmtSurround( SURROUND_NONE ));
1326 		}
1327 		break;
1328 	case RES_POOLFRM_FORMEL:
1329 		{
1330             aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) );
1331             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::FRAME ) );
1332             aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1333 		}
1334 		break;
1335 	case RES_POOLFRM_MARGINAL:
1336 		{
1337             aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
1338             aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME ));
1339             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1340 			aSet.Put( SwFmtSurround( SURROUND_PARALLEL ));
1341 			// Breite 3.5 centimeter vorgegeben, als Hoehe nur den
1342 			// min. Wert benutzen
1343 			aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE,
1344 					GetMetricVal( CM_1 ) * 3 + GetMetricVal( CM_05 ),
1345 					MM50 ));
1346 		}
1347 		break;
1348 	case RES_POOLFRM_WATERSIGN:
1349 		{
1350             aSet.Put( SwFmtAnchor( FLY_AT_PAGE ));
1351             aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1352             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ));
1353 			aSet.Put( SvxOpaqueItem( sal_False ));
1354 			aSet.Put( SwFmtSurround( SURROUND_THROUGHT ));
1355 		}
1356 		break;
1357 
1358 	case RES_POOLFRM_LABEL:
1359 		{
1360             aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) );
1361             aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) );
1362             aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1363 
1364             SvxProtectItem aProtect( RES_PROTECT );
1365 			aProtect.SetSizeProtect( sal_True );
1366 			aProtect.SetPosProtect( sal_True );
1367 			aSet.Put( aProtect );
1368 
1369             pNewFmt->SetAutoUpdateFmt( sal_True );
1370 		}
1371 		break;
1372 	}
1373 	if( aSet.Count() )
1374 	{
1375         {
1376             pNewFmt->SetFmtAttr( aSet );
1377 			// JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
1378 			//				(Bug: 18545)
1379 			// SetModified();
1380 		}
1381 	}
1382 	return pNewFmt;
1383 }
1384 
1385 SwFrmFmt* SwDoc::GetFrmFmtFromPool( sal_uInt16 nId )
1386 {
1387     return (SwFrmFmt*)GetFmtFromPool( nId );
1388 }
1389 
1390 SwCharFmt* SwDoc::GetCharFmtFromPool( sal_uInt16 nId )
1391 {
1392     return (SwCharFmt*)GetFmtFromPool( nId );
1393 }
1394 
1395     // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
1396 	// benutzt wird
1397 bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
1398 {
1399     SwFmt *pNewFmt = 0;
1400 	const SvPtrarr* pArray[ 2 ];
1401 	sal_uInt16 nArrCnt = 1;
1402 	sal_Bool bFnd = sal_True;
1403 
1404 	if( RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END )
1405 	{
1406 		pArray[0] = pCharFmtTbl;
1407 	}
1408 	if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
1409 	{
1410 		pArray[0] = pFrmFmtTbl;
1411 		pArray[1] = pSpzFrmFmtTbl;
1412 		nArrCnt = 2;
1413 	}
1414 	else
1415 	{
1416 		ASSERT( sal_False, "ungueltige Id" );
1417 		bFnd = sal_False;
1418 	}
1419 
1420 	if( bFnd )
1421 	{
1422 		bFnd = sal_False;
1423 		while( nArrCnt-- && !bFnd )
1424 			for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).Count(); ++n )
1425 				if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
1426 						GetPoolFmtId() )
1427 					bFnd = sal_True;
1428 	}
1429 
1430 	// nicht gefunden oder keine Abhaengigen ?
1431 	if( bFnd && pNewFmt->GetDepends() )
1432 	{
1433 		// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
1434 		// (auch indirekte fuer Format-Ableitung! )
1435         SwAutoFmtGetDocNode aGetHt( &GetNodes() );
1436 		bFnd = !pNewFmt->GetInfo( aGetHt );
1437 	}
1438 	else
1439 		bFnd = sal_False;
1440 
1441 	return bFnd;
1442 }
1443 
1444 
1445 
1446 void lcl_PutStdPageSizeIntoItemSet( SwDoc* pDoc, SfxItemSet& rSet )
1447 {
1448 	SwPageDesc* pStdPgDsc = pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1449 	SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
1450 	if( pStdPgDsc->GetLandscape() )
1451 	{
1452 		SwTwips nTmp = aFrmSz.GetHeight();
1453 		aFrmSz.SetHeight( aFrmSz.GetWidth() );
1454 		aFrmSz.SetWidth( nTmp );
1455 	}
1456 	rSet.Put( aFrmSz );
1457 }
1458 
1459 SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
1460 {
1461     ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
1462             "Falsche AutoFormat-Id" );
1463 
1464     for( sal_uInt16 n = 0; n < aPageDescs.Count(); ++n )
1465     {
1466         if ( nId == aPageDescs[ n ]->GetPoolFmtId() )
1467         {
1468             return aPageDescs[ n ];
1469         }
1470     }
1471 
1472     if( RES_POOLPAGE_BEGIN > nId ||  nId >= RES_POOLPAGE_END )
1473     {
1474         // unknown page pool ID
1475         ASSERT( !this, "<SwDoc::GetPageDescFromPool(..)> - unknown page pool ID" );
1476         nId = RES_POOLPAGE_BEGIN;
1477     }
1478 
1479     SwPageDesc* pNewPgDsc = 0;
1480     {
1481         const ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr );
1482         const String aNm( aResId );
1483         const bool bIsModified = IsModified();
1484 
1485         sal_uInt16 nPageDescIdx = 0;
1486         {
1487             ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1488             nPageDescIdx = MakePageDesc( aNm, 0, bRegardLanguage );
1489         }
1490 
1491         pNewPgDsc = aPageDescs[ nPageDescIdx ];
1492         pNewPgDsc->SetPoolFmtId( nId );
1493         if ( !bIsModified )
1494         {
1495             ResetModified();
1496         }
1497     }
1498 
1499     SvxLRSpaceItem aLR( RES_LR_SPACE );
1500     {
1501         aLR.SetLeft( GetMetricVal( CM_1 ) * 2 );
1502         aLR.SetRight( aLR.GetLeft() );
1503     }
1504     SvxULSpaceItem aUL( RES_UL_SPACE );
1505     {
1506         aUL.SetUpper( (sal_uInt16)aLR.GetLeft() );
1507         aUL.SetLower( (sal_uInt16)aLR.GetLeft() );
1508     }
1509 
1510     SwAttrSet aSet( GetAttrPool(), aPgFrmFmtSetRange );
1511     bool bSetLeft = true;
1512 
1513     switch( nId )
1514     {
1515     case RES_POOLPAGE_STANDARD:     // "Default"
1516         {
1517             aSet.Put( aLR );
1518             aSet.Put( aUL );
1519             if( pNewPgDsc )
1520                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1521         }
1522         break;
1523 
1524     case RES_POOLPAGE_FIRST:        // "First Page"
1525     case RES_POOLPAGE_REGISTER:     // "Index"
1526         {
1527             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1528             aSet.Put( aLR );
1529             aSet.Put( aUL );
1530             if( pNewPgDsc )
1531             {
1532                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1533                 if( RES_POOLPAGE_FIRST == nId )
1534                     pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD ));
1535             }
1536         }
1537         break;
1538 
1539     case RES_POOLPAGE_LEFT:         // "Left Page"
1540         {
1541             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1542             aSet.Put( aLR );
1543             aSet.Put( aUL );
1544             bSetLeft = false;
1545             if( pNewPgDsc )
1546                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT );
1547         }
1548         break;
1549     case RES_POOLPAGE_RIGHT:        // "Right Page"
1550         {
1551             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1552             aSet.Put( aLR );
1553             aSet.Put( aUL );
1554             bSetLeft = false;
1555             if( pNewPgDsc )
1556                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT );
1557         }
1558         break;
1559 
1560     case RES_POOLPAGE_JAKET:        // "Envelope"
1561         {
1562             Size aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65 ) );
1563             LandscapeSwap( aPSize );
1564             aSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aPSize.Width(), aPSize.Height() ));
1565             aLR.SetLeft( 0 ); aLR.SetRight( 0 );
1566             aUL.SetUpper( 0 ); aUL.SetLower( 0 );
1567             aSet.Put( aLR );
1568             aSet.Put( aUL );
1569 
1570             if( pNewPgDsc )
1571             {
1572                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1573                 pNewPgDsc->SetLandscape( sal_True );
1574             }
1575         }
1576         break;
1577 
1578     case RES_POOLPAGE_HTML:         // "HTML"
1579         {
1580             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1581             aLR.SetRight( GetMetricVal( CM_1 ));
1582             aUL.SetUpper( (sal_uInt16)aLR.GetRight() );
1583             aUL.SetLower( (sal_uInt16)aLR.GetRight() );
1584             aSet.Put( aLR );
1585             aSet.Put( aUL );
1586 
1587             if( pNewPgDsc )
1588                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1589         }
1590         break;
1591 
1592     case RES_POOLPAGE_FOOTNOTE:     // "Footnote"
1593     case RES_POOLPAGE_ENDNOTE:      // "Endnote"
1594         {
1595             lcl_PutStdPageSizeIntoItemSet( this, aSet );
1596             aSet.Put( aLR );
1597             aSet.Put( aUL );
1598             if( pNewPgDsc )
1599                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1600             SwPageFtnInfo aInf( pNewPgDsc->GetFtnInfo() );
1601             aInf.SetLineWidth( 0 );
1602             aInf.SetTopDist( 0 );
1603             aInf.SetBottomDist( 0 );
1604             pNewPgDsc->SetFtnInfo( aInf );
1605         }
1606         break;
1607 
1608     case RES_POOLPAGE_LANDSCAPE:    // "Landscape"
1609         {
1610             SwPageDesc* pStdPgDsc = this->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1611             SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
1612             if ( !pStdPgDsc->GetLandscape() )
1613             {
1614                 const SwTwips nTmp = aFrmSz.GetHeight();
1615                 aFrmSz.SetHeight( aFrmSz.GetWidth() );
1616                 aFrmSz.SetWidth( nTmp );
1617             }
1618             aSet.Put( aFrmSz );
1619             aSet.Put( aLR );
1620             aSet.Put( aUL );
1621             if( pNewPgDsc )
1622             {
1623                 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1624                 pNewPgDsc->SetLandscape( sal_True );
1625             }
1626         }
1627         break;
1628 
1629     }
1630 
1631     if( aSet.Count() )
1632     {
1633         if( bSetLeft )
1634             pNewPgDsc->GetLeft().SetFmtAttr( aSet );
1635         pNewPgDsc->GetMaster().SetFmtAttr( aSet );
1636     }
1637     return pNewPgDsc;
1638 }
1639 
1640 SwNumRule* SwDoc::GetNumRuleFromPool( sal_uInt16 nId )
1641 {
1642 	ASSERT( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END,
1643 			"Falsche AutoFormat-Id" );
1644 
1645     SwNumRule* pNewRule;
1646 	sal_uInt16 n;
1647 
1648 	for( n = 0; n < GetNumRuleTbl().Count(); ++n )
1649 		if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() )
1650 		{
1651             return pNewRule;
1652 		}
1653 
1654 	// Fehlerfall: unbekannte Poolvorlage
1655 	if( RES_POOLNUMRULE_BEGIN > nId ||  nId >= RES_POOLNUMRULE_END )
1656 	{
1657 		ASSERT( !this, "ungueltige Id" );
1658 		nId = RES_POOLNUMRULE_BEGIN;
1659 	}
1660 
1661 	ResId aResId( sal_uInt32(RC_POOLNUMRULE_BEGIN + nId - RES_POOLNUMRULE_BEGIN), *pSwResMgr );
1662 	String aNm( aResId );
1663 
1664 	SwCharFmt *pNumCFmt = 0, *pBullCFmt = 0;
1665 
1666     // --> OD 2008-02-11 #newlistlevelattrs#
1667     const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode
1668                                   // --> OD 2008-06-06 #i89178#
1669                                   = numfunc::GetDefaultPositionAndSpaceMode();
1670                                   // <--
1671     // <--
1672     {
1673 		sal_Bool bIsModified = IsModified();
1674         // --> OD 2008-02-11 #newlistlevelattrs#
1675         n = MakeNumRule( aNm, 0, sal_False, eNumberFormatPositionAndSpaceMode );
1676         // <--
1677 		pNewRule = GetNumRuleTbl()[ n ];
1678 		pNewRule->SetPoolFmtId( nId );
1679 		pNewRule->SetAutoRule( sal_False );
1680 
1681 		if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 )
1682 			pNumCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1683 
1684 		if( ( RES_POOLNUMRULE_BUL1 <= nId && nId <= RES_POOLNUMRULE_BUL5 ) ||
1685 			RES_POOLNUMRULE_NUM5 == nId )
1686 			pBullCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1687 
1688 		if( !bIsModified )
1689 			ResetModified();
1690 	}
1691 
1692 	switch( nId )
1693 	{
1694 	case RES_POOLNUMRULE_NUM1:
1695 		{
1696 			SwNumFmt aFmt;
1697             // --> OD 2008-02-11 #newlistlevelattrs#
1698             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1699             // <--
1700 			aFmt.SetNumberingType(SVX_NUM_ARABIC);
1701 			aFmt.SetCharFmt( pNumCFmt );
1702 			aFmt.SetStart( 1 );
1703 			aFmt.SetIncludeUpperLevels( 1 );
1704 			aFmt.SetSuffix( aDotStr );
1705 
1706 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1707 				{
1708 //				cm: 0,5  1,0  1,5  2,0   2,5   3,0   3,5   4,0   4,5   5,0
1709 					283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1710 				};
1711 #ifdef USE_MEASUREMENT
1712 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1713 				{
1714 					283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1715 				};
1716 			const sal_uInt16* pArr = MEASURE_METRIC ==
1717 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1718 									? aAbsSpace
1719 									: aAbsSpaceInch;
1720 #else
1721 			const sal_uInt16* pArr = aAbsSpace;
1722 #endif
1723 
1724             // --> OD 2008-02-11 #newlistlevelattrs#
1725             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1726             {
1727                 aFmt.SetFirstLineOffset( - (*pArr) );
1728             }
1729             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1730             {
1731                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1732                 aFmt.SetFirstLineIndent( - (*pArr) );
1733             }
1734             // <--
1735 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
1736 			{
1737                 // --> OD 2008-02-11 #newlistlevelattrs#
1738                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1739                 {
1740                     aFmt.SetAbsLSpace( *pArr );
1741                 }
1742                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1743                 {
1744                     aFmt.SetListtabPos( *pArr );
1745                     aFmt.SetIndentAt( *pArr );
1746                 }
1747                 // <--
1748 				pNewRule->Set( n, aFmt );
1749 			}
1750 		}
1751 		break;
1752 
1753 	case RES_POOLNUMRULE_NUM2:
1754 		{
1755 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1756 				{
1757 					283,  283,  567,  709,		// 0.50, 0.50, 1.00, 1.25
1758 					850, 1021, 1304, 1474,		// 1.50, 1.80, 2.30, 2.60
1759 				   1588, 1758					// 2.80, 3.10
1760 				};
1761 
1762 #ifdef USE_MEASUREMENT
1763 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1764 				{
1765 					385,  385,  770,  963,
1766 				   1155, 1386, 1771, 2002,
1767 				   2156, 2387
1768 				};
1769 
1770 			const sal_uInt16* pArr = MEASURE_METRIC ==
1771 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1772 									? aAbsSpace
1773 									: aAbsSpaceInch;
1774 #else
1775 			const sal_uInt16* pArr = aAbsSpace;
1776 #endif
1777 			SwNumFmt aFmt;
1778             // --> OD 2008-02-11 #newlistlevelattrs#
1779             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1780             // <--
1781 			aFmt.SetNumberingType(SVX_NUM_ARABIC);
1782 			aFmt.SetCharFmt( pNumCFmt );
1783 			aFmt.SetIncludeUpperLevels( 1 );
1784             // --> OD 2008-02-11 #newlistlevelattrs#
1785             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1786             {
1787                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1788             }
1789             // <--
1790 			sal_uInt16 nSpace = 0;
1791 			for( n = 0; n < MAXLEVEL; ++n )
1792 			{
1793                 // --> OD 2008-02-11 #newlistlevelattrs#
1794                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1795                 {
1796                     aFmt.SetAbsLSpace( nSpace = nSpace + pArr[ n ] );
1797                     aFmt.SetFirstLineOffset( - pArr[ n ] );
1798                 }
1799                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1800                 {
1801                     aFmt.SetListtabPos( nSpace = nSpace + pArr[ n ] );
1802                     aFmt.SetIndentAt( nSpace );
1803                     aFmt.SetFirstLineIndent( - pArr[ n ] );
1804                 }
1805                 // <--
1806 				aFmt.SetStart( n+1 );
1807 				pNewRule->Set( n, aFmt );
1808 			}
1809 		}
1810 		break;
1811 	case RES_POOLNUMRULE_NUM3:
1812 		{
1813 			SwNumFmt aFmt;
1814             // --> OD 2008-02-11 #newlistlevelattrs#
1815             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1816             // <--
1817 			aFmt.SetNumberingType(SVX_NUM_ARABIC);
1818 			aFmt.SetCharFmt( pNumCFmt );
1819 			aFmt.SetIncludeUpperLevels( 1 );
1820 
1821             sal_uInt16 nOffs = GetMetricVal( CM_1 ) * 3;
1822             // --> OD 2008-02-11 #newlistlevelattrs#
1823             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1824             {
1825                 aFmt.SetFirstLineOffset( - nOffs );
1826             }
1827             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1828             {
1829                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1830                 aFmt.SetFirstLineIndent( - nOffs );
1831             }
1832             // <--
1833 
1834 			for( n = 0; n < MAXLEVEL; ++n )
1835 			{
1836                 // --> OD 2008-02-11 #newlistlevelattrs#
1837                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1838                 {
1839                     aFmt.SetAbsLSpace( (n+1) * nOffs );
1840                 }
1841                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1842                 {
1843                     aFmt.SetListtabPos( (n+1) * nOffs );
1844                     aFmt.SetIndentAt( (n+1) * nOffs );
1845                 }
1846                 // <--
1847                 aFmt.SetStart( n+1 );
1848 				pNewRule->Set( n, aFmt );
1849 			}
1850 		}
1851 		break;
1852 	case RES_POOLNUMRULE_NUM4:
1853 		{
1854 			SwNumFmt aFmt;
1855             // --> OD 2008-02-11 #newlistlevelattrs#
1856             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1857             // <--
1858 			aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER);
1859 			aFmt.SetCharFmt( pNumCFmt );
1860 			aFmt.SetIncludeUpperLevels( 1 );
1861 			aFmt.SetSuffix( aDotStr );
1862 
1863 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1864 				{
1865 //				cm: 0,5  1,0  1,5  2,0   2,5   3,0   3,5   4,0   4,5   5,0
1866 					283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1867 				};
1868 #ifdef USE_MEASUREMENT
1869 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
1870 				{
1871 					283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1872 				};
1873 			const sal_uInt16* pArr = MEASURE_METRIC ==
1874 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1875 									? aAbsSpace
1876 									: aAbsSpaceInch;
1877 #else
1878 			const sal_uInt16* pArr = aAbsSpace;
1879 #endif
1880 
1881             // --> OD 2008-02-11 #newlistlevelattrs#
1882             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1883             {
1884                 aFmt.SetFirstLineOffset( - (*pArr) );
1885             }
1886             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1887             {
1888                 aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
1889                 aFmt.SetFirstLineIndent( - (*pArr) );
1890             }
1891             // <--
1892 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
1893 			{
1894 				aFmt.SetStart( n + 1 );
1895                 // --> OD 2008-02-11 #newlistlevelattrs#
1896                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1897                 {
1898                     aFmt.SetAbsLSpace( *pArr );
1899                 }
1900                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1901                 {
1902                     aFmt.SetListtabPos( *pArr );
1903                     aFmt.SetIndentAt( *pArr );
1904                 }
1905                 // <--
1906 				pNewRule->Set( n, aFmt );
1907 			}
1908 		}
1909 		break;
1910 	case RES_POOLNUMRULE_NUM5:
1911 		{
1912 			// [ First, LSpace ]
1913 			static const sal_uInt16 aAbsSpace0to2[] =
1914 				{
1915 					227,  227,  	// 0.40, 0.40,
1916 					369,  624,		// 0.65, 1.10,
1917 					255,  879 		// 0.45, 1.55
1918 				};
1919 
1920 #ifdef USE_MEASUREMENT
1921 			static const sal_uInt16 aAbsSpaceInch0to2[] =
1922 				{
1923 					308,  308,
1924 					501,  847,
1925 					347, 1194
1926 				};
1927 			const sal_uInt16* pArr0to2 = MEASURE_METRIC ==
1928 							SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1929 								? aAbsSpace0to2
1930 								: aAbsSpaceInch0to2;
1931 #else
1932 			const sal_uInt16* pArr0to2 = aAbsSpace0to2;
1933 #endif
1934 			SwNumFmt aFmt;
1935             // --> OD 2008-02-11 #newlistlevelattrs#
1936             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1937             // <--
1938 			aFmt.SetNumberingType(SVX_NUM_ARABIC);
1939 			aFmt.SetStart( 1 );
1940 			aFmt.SetIncludeUpperLevels( 1 );
1941 			aFmt.SetSuffix( aDotStr );
1942             // --> OD 2008-02-11 #newlistlevelattrs#
1943             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1944             {
1945                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1946             }
1947             // <--
1948 
1949             // --> OD 2008-02-11 #newlistlevelattrs#
1950             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1951             {
1952                 aFmt.SetFirstLineOffset( -pArr0to2[0] );    // == 0.40 cm
1953                 aFmt.SetAbsLSpace( pArr0to2[1] );           // == 0.40 cm
1954             }
1955             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1956             {
1957                 aFmt.SetFirstLineIndent( -pArr0to2[0] );
1958                 aFmt.SetListtabPos( pArr0to2[1] );
1959                 aFmt.SetIndentAt( pArr0to2[1] );
1960             }
1961             // <--
1962 
1963 			aFmt.SetCharFmt( pNumCFmt );
1964 			pNewRule->Set( 0, aFmt );
1965 
1966 			aFmt.SetIncludeUpperLevels( 2 );
1967 			aFmt.SetStart( 2 );
1968             // --> OD 2008-02-11 #newlistlevelattrs#
1969             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1970             {
1971                 aFmt.SetFirstLineOffset( -pArr0to2[2] );    // == 0.65 cm
1972                 aFmt.SetAbsLSpace( pArr0to2[3] );           // == 1.10 cm
1973             }
1974             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1975             {
1976                 aFmt.SetFirstLineIndent( -pArr0to2[2] );
1977                 aFmt.SetListtabPos( pArr0to2[3] );
1978                 aFmt.SetIndentAt( pArr0to2[3] );
1979             }
1980             // <--
1981 			pNewRule->Set( 1, aFmt );
1982 
1983 			aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER);
1984 			aFmt.SetSuffix( ')');
1985 			aFmt.SetIncludeUpperLevels( 1 );
1986 			aFmt.SetStart( 3 );
1987             // --> OD 2008-02-11 #newlistlevelattrs#
1988             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1989             {
1990                 aFmt.SetFirstLineOffset( - pArr0to2[4] );   // == 0.45cm
1991                 aFmt.SetAbsLSpace( pArr0to2[5] );           // == 1.55 cm
1992             }
1993             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1994             {
1995                 aFmt.SetFirstLineIndent( -pArr0to2[4] );
1996                 aFmt.SetListtabPos( pArr0to2[5] );
1997                 aFmt.SetIndentAt( pArr0to2[5] );
1998             }
1999             // <--
2000 			pNewRule->Set( 2, aFmt );
2001 
2002 
2003 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2004 			aFmt.SetCharFmt( pBullCFmt );
2005             // --> OD 2006-06-29 #6440955#
2006             aFmt.SetBulletFont(  &numfunc::GetDefBulletFont() );
2007             // <--
2008 			aFmt.SetBulletChar( cBulletChar );
2009 			sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4,
2010 				   nOffs2 = GetMetricVal( CM_1 ) * 2;
2011 
2012             // --> OD 2008-02-11 #newlistlevelattrs#
2013             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2014             {
2015                 aFmt.SetFirstLineOffset( - nOffs );
2016             }
2017             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2018             {
2019                 aFmt.SetFirstLineIndent( - nOffs );
2020             }
2021             // <--
2022 			aFmt.SetSuffix( aEmptyStr );
2023 			for( n = 3; n < MAXLEVEL; ++n )
2024 			{
2025 				aFmt.SetStart( n+1 );
2026                 // --> OD 2008-02-11 #newlistlevelattrs#
2027                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2028                 {
2029                     aFmt.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) );
2030                 }
2031                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2032                 {
2033                     aFmt.SetListtabPos( nOffs2 + ((n-3) * nOffs) );
2034                     aFmt.SetIndentAt( nOffs2 + ((n-3) * nOffs) );
2035                 }
2036                 // <--
2037 				pNewRule->Set( n, aFmt );
2038 			}
2039 		}
2040 		break;
2041 
2042 	case RES_POOLNUMRULE_BUL1:
2043 		{
2044 			SwNumFmt aFmt;
2045             // --> OD 2008-02-11 #newlistlevelattrs#
2046             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2047             // <--
2048 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2049 			aFmt.SetCharFmt( pBullCFmt );
2050 			aFmt.SetStart( 1 );
2051 			aFmt.SetIncludeUpperLevels( 1 );
2052             // --> OD 2006-06-29 #6440955#
2053             aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2054             // <--
2055             aFmt.SetBulletChar( cBulletChar );
2056 
2057 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2058 				{
2059 //				cm: 0,4  0,8  1,2  1,6  2,0   2,4   2,8   3,2   3,6   4,0
2060 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2061 				};
2062 #ifdef USE_MEASUREMENT
2063 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2064 				{
2065 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2066 				};
2067 			const sal_uInt16* pArr = MEASURE_METRIC ==
2068 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2069 									? aAbsSpace
2070 									: aAbsSpaceInch;
2071 #else
2072 			const sal_uInt16* pArr = aAbsSpace;
2073 #endif
2074 
2075             // --> OD 2008-02-11 #newlistlevelattrs#
2076             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2077             {
2078                 aFmt.SetFirstLineOffset( - (*pArr) );
2079             }
2080             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2081             {
2082                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2083                 aFmt.SetFirstLineIndent( - (*pArr) );
2084             }
2085             // <--
2086 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2087 			{
2088                 // --> OD 2008-02-11 #newlistlevelattrs#
2089                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2090                 {
2091                     aFmt.SetAbsLSpace( *pArr );
2092                 }
2093                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2094                 {
2095                     aFmt.SetListtabPos( *pArr );
2096                     aFmt.SetIndentAt( *pArr );
2097                 }
2098                 // <--
2099 				pNewRule->Set( n, aFmt );
2100 			}
2101 		}
2102 		break;
2103 	case RES_POOLNUMRULE_BUL2:
2104 		{
2105 			SwNumFmt aFmt;
2106             // --> OD 2008-02-11 #newlistlevelattrs#
2107             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2108             // <--
2109 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2110 			aFmt.SetCharFmt( pBullCFmt );
2111 			aFmt.SetStart( 1 );
2112 			aFmt.SetIncludeUpperLevels( 1 );
2113             // --> OD 2006-06-29 #6440955#
2114             aFmt.SetBulletFont(  &numfunc::GetDefBulletFont() );
2115             // <--
2116             aFmt.SetBulletChar( 0x2013 );
2117 
2118 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2119 				{
2120 //				cm: 0,3  0,6  0,9  1,2  1,5  1,8   2,1   2,4   2,7   3,0
2121 					170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2122 				};
2123 #ifdef USE_MEASUREMENT
2124 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2125 				{
2126 					170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2127 				};
2128 			const sal_uInt16* pArr = MEASURE_METRIC ==
2129 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2130 									? aAbsSpace
2131 									: aAbsSpaceInch;
2132 #else
2133 			const sal_uInt16* pArr = aAbsSpace;
2134 #endif
2135 
2136             // --> OD 2008-02-11 #newlistlevelattrs#
2137             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2138             {
2139                 aFmt.SetFirstLineOffset( - (*pArr) );
2140             }
2141             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2142             {
2143                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2144                 aFmt.SetFirstLineIndent( - (*pArr) );
2145             }
2146             // <--
2147 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2148 			{
2149                 // --> OD 2008-02-11 #newlistlevelattrs#
2150                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2151                 {
2152                     aFmt.SetAbsLSpace( *pArr );
2153                 }
2154                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2155                 {
2156                     aFmt.SetListtabPos( *pArr );
2157                     aFmt.SetIndentAt( *pArr );
2158                 }
2159                 // <--
2160                 pNewRule->Set( n, aFmt );
2161 			}
2162 		}
2163 		break;
2164 	case RES_POOLNUMRULE_BUL3:
2165 		{
2166 			SwNumFmt aFmt;
2167             // --> OD 2008-02-11 #newlistlevelattrs#
2168             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2169             // <--
2170 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2171 			aFmt.SetCharFmt( pBullCFmt );
2172 			aFmt.SetStart( 1 );
2173 			aFmt.SetIncludeUpperLevels( 1 );
2174             // --> OD 2006-06-29 #6440955#
2175             aFmt.SetBulletFont(  &numfunc::GetDefBulletFont() );
2176             // <--
2177 
2178             sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4;
2179             // --> OD 2008-02-11 #newlistlevelattrs#
2180             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2181             {
2182                 aFmt.SetFirstLineOffset( - nOffs );
2183             }
2184             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2185             {
2186                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2187                 aFmt.SetFirstLineIndent( - nOffs );
2188             }
2189             // <--
2190 
2191 			for( n = 0; n < MAXLEVEL; ++n )
2192 			{
2193 				aFmt.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) );
2194                 // --> OD 2008-02-11 #newlistlevelattrs#
2195                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2196                 {
2197                     aFmt.SetAbsLSpace( ((n & 1) +1) * nOffs );
2198                 }
2199                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2200                 {
2201                     aFmt.SetListtabPos( ((n & 1) +1) * nOffs );
2202                     aFmt.SetIndentAt( ((n & 1) +1) * nOffs );
2203                 }
2204                 // <--
2205 				pNewRule->Set( n, aFmt );
2206 			}
2207 		}
2208 		break;
2209 	case RES_POOLNUMRULE_BUL4:
2210 		{
2211 			SwNumFmt aFmt;
2212             // --> OD 2008-02-11 #newlistlevelattrs#
2213             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2214             // <--
2215 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2216 			aFmt.SetCharFmt( pBullCFmt );
2217 			aFmt.SetStart( 1 );
2218 			aFmt.SetIncludeUpperLevels( 1 );
2219             // --> OD 2006-06-29 #6440955#
2220             aFmt.SetBulletFont(  &numfunc::GetDefBulletFont() );
2221             // <--
2222 
2223 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2224 				{
2225 //				cm: 0,4  0,8  1,2  1,6  2,0   2,4   2,8   3,2   3,6   4,0
2226 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2227 				};
2228 #ifdef USE_MEASUREMENT
2229 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2230 				{
2231 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2232 				};
2233 			const sal_uInt16* pArr = MEASURE_METRIC ==
2234 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2235 									? aAbsSpace
2236 									: aAbsSpaceInch;
2237 #else
2238 			const sal_uInt16* pArr = aAbsSpace;
2239 #endif
2240 
2241             // --> OD 2008-02-11 #newlistlevelattrs#
2242             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2243             {
2244                 aFmt.SetFirstLineOffset( - (*pArr) );
2245             }
2246             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2247             {
2248                 aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
2249                 aFmt.SetFirstLineIndent( - (*pArr) );
2250             }
2251             // <--
2252 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2253 			{
2254 				switch( n )
2255 				{
2256 				case 0: 	aFmt.SetBulletChar( 0x27a2 );	break;
2257 				case 1:		aFmt.SetBulletChar( 0xE006 );	break;
2258 				default:	aFmt.SetBulletChar( 0xE004 );	break;
2259 				}
2260                 // --> OD 2008-02-11 #newlistlevelattrs#
2261                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2262                 {
2263                     aFmt.SetAbsLSpace( *pArr );
2264                 }
2265                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2266                 {
2267                     aFmt.SetListtabPos( *pArr );
2268                     aFmt.SetIndentAt( *pArr );
2269                 }
2270                 // <--
2271 				pNewRule->Set( n, aFmt );
2272 			}
2273 		}
2274 		break;
2275 	case RES_POOLNUMRULE_BUL5:
2276 		{
2277 			SwNumFmt aFmt;
2278             // --> OD 2008-02-11 #newlistlevelattrs#
2279             aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2280             // <--
2281 			aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2282 			aFmt.SetCharFmt( pBullCFmt );
2283 			aFmt.SetStart( 1 );
2284 			aFmt.SetIncludeUpperLevels( 1 );
2285 			aFmt.SetBulletChar( 0x2717 );
2286             // --> OD 2006-06-29 #6440955#
2287             aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2288             // <--
2289 
2290 			static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2291 				{
2292 //				cm: 0,4  0,8  1,2  1,6  2,0   2,4   2,8   3,2   3,6   4,0
2293 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2294 				};
2295 #ifdef USE_MEASUREMENT
2296 			static const sal_uInt16 aAbsSpaceInch[ MAXLEVEL ] =
2297 				{
2298 					227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2299 				};
2300 			const sal_uInt16* pArr = MEASURE_METRIC ==
2301 								SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2302 									? aAbsSpace
2303 									: aAbsSpaceInch;
2304 #else
2305 			const sal_uInt16* pArr = aAbsSpace;
2306 #endif
2307 
2308             // --> OD 2008-02-11 #newlistlevelattrs#
2309             if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2310             {
2311                 aFmt.SetFirstLineOffset( - (*pArr) );
2312             }
2313             else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2314             {
2315                 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2316                 aFmt.SetFirstLineIndent( - (*pArr) );
2317             }
2318             // <--
2319 			for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2320 			{
2321                 // --> OD 2008-02-11 #newlistlevelattrs#
2322                 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2323                 {
2324                     aFmt.SetAbsLSpace( *pArr );
2325                 }
2326                 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2327                 {
2328                     aFmt.SetListtabPos( *pArr );
2329                     aFmt.SetIndentAt( *pArr );
2330                 }
2331                 // <--
2332 				pNewRule->Set( n, aFmt );
2333 			}
2334 		}
2335 		break;
2336 	}
2337 
2338     return pNewRule;
2339 }
2340 
2341 
2342 
2343 	// pruefe, ob diese "Auto-Collection" in Dokument schon/noch
2344 	// benutzt wird
2345 bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId ) const
2346 {
2347 	ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
2348 			"Falsche AutoFormat-Id" );
2349 	SwPageDesc *pNewPgDsc = 0;
2350 	sal_Bool bFnd = sal_False;
2351 	for( sal_uInt16 n = 0; !bFnd && n < aPageDescs.Count(); ++n )
2352     {
2353 		pNewPgDsc = aPageDescs[ n ];
2354 		if( nId == pNewPgDsc->GetPoolFmtId() )
2355 			bFnd = sal_True;
2356     }
2357 
2358 	// nicht gefunden oder keine Abhaengigen ?
2359 	if( !bFnd || !pNewPgDsc->GetDepends() )		// ??????
2360 		return sal_False;
2361 
2362 	// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2363 	// (auch indirekte fuer Format-Ableitung! )
2364     SwAutoFmtGetDocNode aGetHt( &GetNodes() );
2365 	return !pNewPgDsc->GetInfo( aGetHt );
2366 }
2367 
2368 // erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
2369 sal_Bool SwDoc::IsUsed( const SwModify& rModify ) const
2370 {
2371 	// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2372 	// (auch indirekte fuer Format-Ableitung! )
2373     SwAutoFmtGetDocNode aGetHt( &GetNodes() );
2374 	return !rModify.GetInfo( aGetHt );
2375 }
2376 
2377 // erfrage ob die NumRule benutzt wird
2378 sal_Bool SwDoc::IsUsed( const SwNumRule& rRule ) const
2379 {
2380     // --> OD 2008-03-04 #refactorlists#
2381 //    // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2382 //    // (auch indirekte fuer Format-Ableitung! )
2383 //    sal_Bool bUsed = sal_False;
2384 //    SwAutoFmtGetDocNode aGetHt( &aNodes );
2385 //    SwModify* pMod;
2386 //    const SfxPoolItem* pItem;
2387 //    sal_uInt16 i, nMaxItems = GetAttrPool().GetItemCount( RES_PARATR_NUMRULE);
2388 //    for( i = 0; i < nMaxItems; ++i )
2389 //    {
2390 //        if( 0 != (pItem = GetAttrPool().GetItem( RES_PARATR_NUMRULE, i ) ) &&
2391 //            0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->GetDefinedIn()) &&
2392 //            ((SwNumRuleItem*)pItem)->GetValue().Len() &&
2393 //            ((SwNumRuleItem*)pItem)->GetValue() == rRule.GetName() )
2394 //        {
2395 //            if( pMod->IsA( TYPE( SwFmt )) )
2396 //            {
2397 //                bUsed = !pMod->GetInfo( aGetHt );
2398 //                if( bUsed )
2399 //                    break;
2400 //            }
2401 //            else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
2402 //            {
2403 //                bUsed = sal_True;
2404 //                break;
2405 //            }
2406 //        }
2407 //    }
2408 
2409 //    return bUsed;
2410     sal_Bool bUsed = rRule.GetTxtNodeListSize() > 0 ||
2411                      rRule.GetParagraphStyleListSize() > 0;
2412 
2413     return bUsed;
2414     // <--
2415 }
2416 
2417 	// Suche die Position vom Vorlagen-Namen. Ist nicht vorhanden
2418 	// dann fuege neu ein
2419 sal_uInt16 SwDoc::SetDocPattern( const String& rPatternName )
2420 {
2421 	ASSERT( rPatternName.Len(), "kein Dokument-Vorlagenname" );
2422 
2423 	sal_uInt16 nNewPos = aPatternNms.Count();
2424 	for( sal_uInt16 n = 0; n < aPatternNms.Count(); ++n )
2425 		if( !aPatternNms[n] )
2426 		{
2427 			if( nNewPos == aPatternNms.Count() )
2428 				nNewPos = n;
2429 		}
2430 		else if( rPatternName == *aPatternNms[n] )
2431 			return n;
2432 
2433 	if( nNewPos < aPatternNms.Count() )
2434 		aPatternNms.Remove( nNewPos );		// Platz wieder frei machen
2435 
2436 	String* pNewNm = new String( rPatternName );
2437 	aPatternNms.Insert( pNewNm, nNewPos );
2438 	SetModified();
2439 	return nNewPos;
2440 }
2441 
2442 sal_uInt16 GetPoolParent( sal_uInt16 nId )
2443 {
2444 	sal_uInt16 nRet = USHRT_MAX;
2445 	if( POOLGRP_NOCOLLID & nId )		// 1 == Formate / 0 == Collections
2446 	{
2447 		switch( ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID ) & nId )
2448 		{
2449 		case POOLGRP_CHARFMT:
2450 		case POOLGRP_FRAMEFMT:
2451 			nRet = 0; 			// vom default abgeleitet
2452 			break;
2453 		case POOLGRP_PAGEDESC:
2454 		case POOLGRP_NUMRULE:
2455 			break;				// es gibt keine Ableitung
2456 		}
2457 	}
2458 	else
2459 	{
2460 		switch( COLL_GET_RANGE_BITS & nId )
2461 		{
2462 		case COLL_TEXT_BITS:
2463 			switch( nId )
2464 			{
2465 			case RES_POOLCOLL_STANDARD:
2466 					nRet = 0;									break;
2467 			case RES_POOLCOLL_TEXT_IDENT:
2468 			case RES_POOLCOLL_TEXT_NEGIDENT:
2469 			case RES_POOLCOLL_TEXT_MOVE:
2470 			case RES_POOLCOLL_CONFRONTATION:
2471 			case RES_POOLCOLL_MARGINAL:
2472 					nRet = RES_POOLCOLL_TEXT;					break;
2473 
2474 			case RES_POOLCOLL_TEXT:
2475 			case RES_POOLCOLL_GREETING:
2476 			case RES_POOLCOLL_SIGNATURE:
2477 			case RES_POOLCOLL_HEADLINE_BASE:
2478 					nRet = RES_POOLCOLL_STANDARD;				break;
2479 
2480 			case RES_POOLCOLL_HEADLINE1:
2481 			case RES_POOLCOLL_HEADLINE2:
2482 			case RES_POOLCOLL_HEADLINE3:
2483 			case RES_POOLCOLL_HEADLINE4:
2484 			case RES_POOLCOLL_HEADLINE5:
2485 			case RES_POOLCOLL_HEADLINE6:
2486 			case RES_POOLCOLL_HEADLINE7:
2487 			case RES_POOLCOLL_HEADLINE8:
2488 			case RES_POOLCOLL_HEADLINE9:
2489 			case RES_POOLCOLL_HEADLINE10:
2490 					nRet = RES_POOLCOLL_HEADLINE_BASE; 			break;
2491 			}
2492 			break;
2493 
2494 		case COLL_LISTS_BITS:
2495 			switch( nId )
2496 			{
2497 			case RES_POOLCOLL_NUMBUL_BASE:
2498 					nRet = RES_POOLCOLL_TEXT;					break;
2499 
2500 			default:
2501 				nRet = RES_POOLCOLL_NUMBUL_BASE;				break;
2502 			}
2503 			break;
2504 
2505 		case COLL_EXTRA_BITS:
2506 			switch( nId )
2507 			{
2508 			case RES_POOLCOLL_FRAME:
2509 					nRet = RES_POOLCOLL_TEXT;					break;
2510 
2511 			case RES_POOLCOLL_TABLE_HDLN:
2512 					nRet = RES_POOLCOLL_TABLE;					break;
2513 
2514             case RES_POOLCOLL_TABLE:
2515 			case RES_POOLCOLL_FOOTNOTE:
2516 			case RES_POOLCOLL_ENDNOTE:
2517 			case RES_POOLCOLL_JAKETADRESS:
2518 			case RES_POOLCOLL_SENDADRESS:
2519 			case RES_POOLCOLL_HEADER:
2520 			case RES_POOLCOLL_HEADERL:
2521 			case RES_POOLCOLL_HEADERR:
2522 			case RES_POOLCOLL_FOOTER:
2523 			case RES_POOLCOLL_FOOTERL:
2524 			case RES_POOLCOLL_FOOTERR:
2525 			case RES_POOLCOLL_LABEL:
2526 					nRet = RES_POOLCOLL_STANDARD;				break;
2527 
2528 			case RES_POOLCOLL_LABEL_ABB:
2529 			case RES_POOLCOLL_LABEL_TABLE:
2530 			case RES_POOLCOLL_LABEL_FRAME:
2531 			case RES_POOLCOLL_LABEL_DRAWING:
2532 					nRet = RES_POOLCOLL_LABEL;					break;
2533 			}
2534 			break;
2535 
2536 		case COLL_REGISTER_BITS:
2537 			switch( nId )
2538 			{
2539 			case RES_POOLCOLL_REGISTER_BASE:
2540 					nRet = RES_POOLCOLL_STANDARD;				break;
2541 
2542 			case RES_POOLCOLL_TOX_USERH:
2543 			case RES_POOLCOLL_TOX_CNTNTH:
2544 			case RES_POOLCOLL_TOX_IDXH:
2545 			case RES_POOLCOLL_TOX_ILLUSH:
2546 			case RES_POOLCOLL_TOX_OBJECTH:
2547 			case RES_POOLCOLL_TOX_TABLESH:
2548 			case RES_POOLCOLL_TOX_AUTHORITIESH:
2549 					nRet = RES_POOLCOLL_HEADLINE_BASE;  		break;
2550 
2551 			default:
2552 					nRet = RES_POOLCOLL_REGISTER_BASE;  		break;
2553 			}
2554 			break;
2555 
2556 		case COLL_DOC_BITS:
2557 			nRet = RES_POOLCOLL_HEADLINE_BASE;
2558 			break;
2559 
2560 		case COLL_HTML_BITS:
2561 			nRet = RES_POOLCOLL_STANDARD;
2562 			break;
2563 		}
2564 	}
2565 
2566 	return nRet;
2567 }
2568 
2569 void SwDoc::RemoveAllFmtLanguageDependencies()
2570 {
2571     /* #106748# Restore the language independ pool defaults and styles. */
2572     GetAttrPool().ResetPoolDefaultItem( RES_PARATR_ADJUST );
2573 
2574 	SwTxtFmtColl * pTxtFmtColl = GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
2575 
2576     pTxtFmtColl->ResetFmtAttr( RES_PARATR_ADJUST );
2577     /* #111214# koreans do not like SvxScriptItem(sal_True) */
2578     pTxtFmtColl->ResetFmtAttr( RES_PARATR_SCRIPTSPACE );
2579 
2580     SvxFrameDirectionItem aFrameDir( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR );
2581 
2582 	sal_uInt16 nCount = GetPageDescCnt();
2583 	for( sal_uInt16 i=0; i<nCount; ++i )
2584 	{
2585 		SwPageDesc& rDesc = _GetPageDesc( i );
2586         rDesc.GetMaster().SetFmtAttr( aFrameDir );
2587         rDesc.GetLeft().SetFmtAttr( aFrameDir );
2588 	}
2589 
2590     // OD 09.10.2003 #i18732# - restore static pool default for item
2591     // RES_FOLLOW_TEXT_FLOW.
2592     GetAttrPool().ResetPoolDefaultItem( RES_FOLLOW_TEXT_FLOW );
2593 
2594     //#i16874# AutoKerning as default for new documents
2595 	GetAttrPool().ResetPoolDefaultItem( RES_CHRATR_AUTOKERN );
2596 }
2597