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