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