update dev300-m58
[ooovba.git] / sw / source / core / doc / poolfmt.cxx
blobb679c549b978bcc8dfc9535ee4768cd4981fe44c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: poolfmt.cxx,v $
10 * $Revision: 1.54.108.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #include <hintids.hxx>
34 #include <i18npool/mslangid.hxx>
35 #include <unotools/localedatawrapper.hxx>
36 #include <svx/paperinf.hxx>
37 #include <svx/wghtitem.hxx>
38 #include <svx/fontitem.hxx>
39 #include <svx/fhgtitem.hxx>
40 #ifndef _SVX_TSTPITEM_HXX //autogen
41 #include <svx/tstpitem.hxx>
42 #endif
43 #include <svx/lrspitem.hxx>
44 #include <svx/ulspitem.hxx>
45 #include <svx/adjitem.hxx>
46 #include <svx/postitem.hxx>
47 #include <svx/keepitem.hxx>
48 #include <svx/opaqitem.hxx>
49 #include <svx/boxitem.hxx>
50 #include <svx/cmapitem.hxx>
51 #include <svx/udlnitem.hxx>
52 #include <svx/colritem.hxx>
53 #include <svx/protitem.hxx>
54 #include <svx/escpitem.hxx>
55 #include <svx/langitem.hxx>
56 #include <svx/charrotateitem.hxx>
57 #include <svx/frmdiritem.hxx>
58 #ifndef _SVX_EMPHITEM_HXX
59 #include <svx/emphitem.hxx>
60 #endif
61 #include <svx/scriptspaceitem.hxx>
62 #include <viewopt.hxx>
63 #include <doc.hxx>
64 #include <fmtanchr.hxx>
65 #include <fmtornt.hxx>
66 #include <fmtsrnd.hxx>
67 #include <fmtfsize.hxx>
68 #include <poolfmt.hxx>
69 #include <paratr.hxx>
70 #include <pagedesc.hxx>
71 #include <frmtool.hxx>
72 #include <charfmt.hxx>
73 #include <docary.hxx>
74 #include <fmtcol.hxx>
75 #include <ndtxt.hxx>
76 #include <fmtline.hxx>
77 #ifndef _POOLFMT_HRC
78 #include <poolfmt.hrc>
79 #endif
80 #include <GetMetricVal.hxx>
81 #include <numrule.hxx>
84 using namespace ::com::sun::star;
86 const USHORT PT_3 = 3 * 20; // 3 pt
87 const USHORT PT_6 = 6 * 20; // 6 pt
88 const USHORT PT_7 = 7 * 20; // 6 pt
89 const USHORT PT_8 = 8 * 20; // 8 pt
90 const USHORT PT_9 = 9 * 20; // 9 pt
91 const USHORT PT_10 = 10 * 20; // 10 pt
92 const USHORT PT_11 = 11 * 20; // 11 pt
93 const USHORT PT_12 = 12 * 20; // 12 pt
94 const USHORT PT_14 = 14 * 20; // 14 pt
95 const USHORT PT_16 = 16 * 20; // 16 pt
96 const USHORT PT_18 = 18 * 20; // 18 pt
97 const USHORT PT_22 = 22 * 20; // 22 pt
98 const USHORT PT_24 = 24 * 20; // 22 pt
101 //const USHORT HTML_PARSPACE = ((CM_05 * 7) / 10);
102 #define HTML_PARSPACE GetMetricVal( CM_05 )
104 static const sal_Char __FAR_DATA sKomma[] = ", ";
106 static const USHORT aHeadlineSizes[ 2 * MAXLEVEL ] = {
107 // PT_16, PT_14, PT_14, PT_12, PT_12, // normal
108 //JP 10.12.96: jetzt soll alles prozentual sein:
109 115, 100, 100, 85, 85,
110 75, 75, 75, 75, 75, // normal
111 // PT_22, PT_16, PT_12, PT_11, PT_9 // HTML-Mode
112 PT_24, PT_18, PT_14, PT_12, PT_10,
113 PT_7, PT_7, PT_7, PT_7, PT_7 // HTML-Mode
116 long lcl_GetRightMargin( SwDoc& rDoc )
118 // sorge dafuer, dass die Druckereinstellungen in die Standard-
119 // Seitenvorlage uebernommen wurden.
120 const SwFrmFmt& rPgDscFmt =
121 const_cast<const SwDoc *>(&rDoc)->GetPageDesc( 0 ).GetMaster();
122 const SvxLRSpaceItem& rLR = rPgDscFmt.GetLRSpace();
123 const long nLeft = rLR.GetLeft();
124 const long nRight = rLR.GetRight();
125 const long nWidth = rPgDscFmt.GetFrmSize().GetWidth();
126 return nWidth - nLeft - nRight;
129 void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem )
131 rSet.Put( rItem );
132 USHORT nWhCJK = 0, nWhCTL = 0;
133 switch( rItem.Which() )
135 case RES_CHRATR_FONTSIZE:
136 nWhCJK = RES_CHRATR_CJK_FONTSIZE, nWhCTL = RES_CHRATR_CTL_FONTSIZE;
137 break;
138 case RES_CHRATR_FONT:
139 nWhCJK = RES_CHRATR_CJK_FONT, nWhCTL = RES_CHRATR_CTL_FONT;
140 break;
141 case RES_CHRATR_LANGUAGE:
142 nWhCJK = RES_CHRATR_CJK_LANGUAGE, nWhCTL = RES_CHRATR_CTL_LANGUAGE;
143 break;
144 case RES_CHRATR_POSTURE:
145 nWhCJK = RES_CHRATR_CJK_POSTURE, nWhCTL = RES_CHRATR_CTL_POSTURE;
146 break;
147 case RES_CHRATR_WEIGHT:
148 nWhCJK = RES_CHRATR_CJK_WEIGHT, nWhCTL = RES_CHRATR_CTL_WEIGHT;
149 break;
152 if( nWhCJK )
153 rSet.Put( rItem, nWhCJK );
154 if( nWhCTL )
155 rSet.Put( rItem, nWhCTL );
158 void lcl_SetDfltFont( USHORT nFntType, SfxItemSet& rSet )
160 static struct {
161 USHORT nResLngId;
162 USHORT nResFntId;
163 } aArr[ 3 ] = {
164 { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT },
165 { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT },
166 { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT }
168 for( USHORT n = 0; n < 3; ++n )
170 USHORT nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
171 aArr[n].nResLngId )).GetLanguage();
172 Font aFnt( OutputDevice::GetDefaultFont( nFntType,
173 nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
175 rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
176 aEmptyStr, aFnt.GetPitch(),
177 aFnt.GetCharSet(), aArr[n].nResFntId ));
181 void lcl_SetDfltFont( USHORT nLatinFntType, USHORT nCJKFntType,
182 USHORT nCTLFntType, SfxItemSet& rSet )
184 static struct {
185 USHORT nResLngId;
186 USHORT nResFntId;
187 USHORT nFntType;
188 } aArr[ 3 ] = {
189 { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, 0 },
190 { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT, 0 },
191 { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT, 0 }
193 aArr[0].nFntType = nLatinFntType;
194 aArr[1].nFntType = nCJKFntType;
195 aArr[2].nFntType = nCTLFntType;
197 for( USHORT n = 0; n < 3; ++n )
199 USHORT nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem(
200 aArr[n].nResLngId )).GetLanguage();
201 Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType,
202 nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
204 rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
205 aEmptyStr, aFnt.GetPitch(),
206 aFnt.GetCharSet(), aArr[n].nResFntId ));
210 void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl,
211 SfxItemSet& rSet,
212 USHORT nOutLvlBits, BYTE nLevel, BOOL bItalic )
214 SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
215 SvxFontHeightItem aHItem(240, 100, RES_CHRATR_FONTSIZE);
216 const bool bHTMLMode = pDoc->get(IDocumentSettingAccess::HTML_MODE);
217 if( bHTMLMode )
218 aHItem.SetHeight( aHeadlineSizes[ MAXLEVEL + nLevel ] );
219 else
220 aHItem.SetHeight( PT_14, aHeadlineSizes[ nLevel ] );
221 SetAllScriptItem( rSet, aHItem );
223 if( bItalic && !bHTMLMode )
224 SetAllScriptItem( rSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
226 if( bHTMLMode )
228 ::lcl_SetDfltFont( DEFAULTFONT_LATIN_TEXT, DEFAULTFONT_CJK_TEXT,
229 DEFAULTFONT_CTL_TEXT, rSet );
232 if( pColl )
234 if( !( nOutLvlBits & ( 1 << nLevel )) )
236 //pColl->SetOutlineLevel( nLevel ); //#outline level zhaojianwei
237 pColl->AssignToListLevelOfOutlineStyle(nLevel);//<-end,zhaojianwei
238 if( !bHTMLMode )
240 SwNumRule * pOutlineRule = pDoc->GetOutlineNumRule();
241 const SwNumFmt& rNFmt = pOutlineRule->Get( nLevel );
242 // --> OD 2008-02-01 #newlistlevelattrs#
243 if ( rNFmt.GetPositionAndSpaceMode() ==
244 SvxNumberFormat::LABEL_WIDTH_AND_POSITION &&
245 ( rNFmt.GetAbsLSpace() || rNFmt.GetFirstLineOffset() ) )
246 // <--
248 SvxLRSpaceItem aLR( (SvxLRSpaceItem&)pColl->GetFmtAttr( RES_LR_SPACE ) );
249 aLR.SetTxtFirstLineOfstValue( rNFmt.GetFirstLineOffset() );
250 aLR.SetTxtLeft( rNFmt.GetAbsLSpace() );
251 pColl->SetFmtAttr( aLR );
254 // --> OD 2006-11-20 #i71764#
255 // Check on document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE no longer needed.
256 // All paragraph styles, which are assigned to a level of the
257 // outline style has to have the outline style set as its list style.
259 SwNumRuleItem aItem(pOutlineRule->GetName());
261 pColl->SetFmtAttr(aItem);
263 // <--
266 pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool(
267 RES_POOLCOLL_TEXT ));
273 void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, USHORT nFact,
274 BOOL bHeader, BOOL bTab )
276 SvxLRSpaceItem aLR( RES_LR_SPACE );
277 USHORT nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0;
278 aLR.SetTxtLeft( nLeft );
280 rSet.Put( aLR );
281 if( bHeader )
283 SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
284 SetAllScriptItem( rSet, SvxFontHeightItem( PT_16, 100, RES_CHRATR_FONTSIZE ) );
286 if( bTab )
288 long nRightMargin = lcl_GetRightMargin( *pDoc );
289 SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
290 aTStops.Insert( SvxTabStop( nRightMargin - nLeft,
291 SVX_TAB_ADJUST_RIGHT,
292 cDfltDecimalChar, '.' ));
293 rSet.Put( aTStops );
299 void lcl_SetNumBul( SwDoc* pDoc, SwTxtFmtColl* pColl,
300 SfxItemSet& rSet,
301 USHORT nNxt, SwTwips nEZ, SwTwips nLeft,
302 SwTwips nUpper, SwTwips nLower )
305 SvxLRSpaceItem aLR( RES_LR_SPACE ); SvxULSpaceItem aUL( RES_UL_SPACE );
306 aLR.SetTxtFirstLineOfst( USHORT(nEZ) ); aLR.SetTxtLeft( USHORT(nLeft) );
307 aUL.SetUpper( USHORT(nUpper) ); aUL.SetLower( USHORT(nLower) );
308 rSet.Put( aLR );
309 rSet.Put( aUL );
311 if( !pColl )
312 pColl->SetNextTxtFmtColl( *pDoc->GetTxtCollFromPool( nNxt ));
317 // Gebe die "Auto-Collection" mit der Id zurueck. Existiert
318 // sie noch nicht, dann erzeuge sie
319 // Ist der String-Pointer definiert, dann erfrage nur die
320 // Beschreibung der Attribute, !! es legt keine Vorlage an !!
322 SvxFrameDirection GetDefaultFrameDirection(ULONG nLanguage)
324 SvxFrameDirection eResult = (MsLangId::isRightToLeft( static_cast<LanguageType>(nLanguage)) ?
325 FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP);
326 return eResult;
329 SwTxtFmtColl* SwDoc::GetTxtCollFromPool( USHORT nId, bool bRegardLanguage )
331 ASSERT(
332 (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
333 (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
334 (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
335 (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
336 (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
337 (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
338 "Falsche AutoFormat-Id" );
340 SwTxtFmtColl* pNewColl;
341 USHORT nOutLvlBits = 0;
342 for( USHORT n = 0; n < pTxtFmtCollTbl->Count(); ++n )
344 if( nId == ( pNewColl = (*pTxtFmtCollTbl)[ n ] )->GetPoolFmtId() )
346 return pNewColl;
348 //if( pNewColl->GetOutlineLevel() < MAXLEVEL ) //#outline level,zhaojianwei
349 //nOutLvlBits |= ( 1 << pNewColl->GetOutlineLevel() );
350 if( pNewColl->IsAssignedToListLevelOfOutlineStyle())
351 nOutLvlBits |= ( 1 << pNewColl->GetAssignedOutlineStyleLevel() );//<-end,zhaojianwei
354 // bis hierher nicht gefunden -> neu anlegen
355 USHORT nResId = 0;
356 if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END )
357 nResId = RC_POOLCOLL_TEXT_BEGIN - RES_POOLCOLL_TEXT_BEGIN;
358 else if (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END)
359 nResId = RC_POOLCOLL_LISTS_BEGIN - RES_POOLCOLL_LISTS_BEGIN;
360 else if (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END)
361 nResId = RC_POOLCOLL_EXTRA_BEGIN - RES_POOLCOLL_EXTRA_BEGIN;
362 else if (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END)
363 nResId = RC_POOLCOLL_REGISTER_BEGIN - RES_POOLCOLL_REGISTER_BEGIN;
364 else if (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END)
365 nResId = RC_POOLCOLL_DOC_BEGIN - RES_POOLCOLL_DOC_BEGIN;
366 else if (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END)
367 nResId = RC_POOLCOLL_HTML_BEGIN - RES_POOLCOLL_HTML_BEGIN;
369 ASSERT( nResId, "Ungueltige Pool-ID" );
370 if( !nResId )
371 return GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
373 ResId aResId( nResId + nId, *pSwResMgr );
374 String aNm( aResId );
376 // ein Set fuer alle zusetzenden Attribute
377 SwAttrSet aSet( GetAttrPool(), aTxtFmtCollSetRange );
378 USHORT nParent = GetPoolParent( nId );
382 //FEATURE::CONDCOLL
383 if(::IsConditionalByPoolId( nId ))
384 pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), aNm, !nParent
385 ? pDfltTxtFmtColl
386 : GetTxtCollFromPool( nParent ));
387 else
388 //FEATURE::CONDCOLL
389 pNewColl = new SwTxtFmtColl( GetAttrPool(), aNm, !nParent
390 ? pDfltTxtFmtColl
391 : GetTxtCollFromPool( nParent ));
392 pNewColl->SetPoolFmtId( nId );
393 pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() );
396 switch( nId )
398 // allgemeine Inhaltsformen
399 case RES_POOLCOLL_STANDARD:
400 /* #111214# koreans do not like SvxScriptItem(TRUE) */
401 if (bRegardLanguage)
403 ULONG nAppLanguage = GetAppLanguage();
404 if (GetDefaultFrameDirection(nAppLanguage) ==
405 FRMDIR_HORI_RIGHT_TOP)
407 SvxAdjustItem aAdjust(SVX_ADJUST_RIGHT, RES_PARATR_ADJUST );
408 aSet.Put(aAdjust);
410 if (nAppLanguage == LANGUAGE_KOREAN)
412 SvxScriptSpaceItem aScriptSpace(FALSE, RES_PARATR_SCRIPTSPACE);
413 aSet.Put(aScriptSpace);
416 break;
418 case RES_POOLCOLL_TEXT: // Textkoerper
420 SvxULSpaceItem aUL( 0, PT_6, RES_UL_SPACE );
421 if( get(IDocumentSettingAccess::HTML_MODE) ) aUL.SetLower( HTML_PARSPACE );
422 aSet.Put( aUL );
424 break;
425 case RES_POOLCOLL_TEXT_IDENT: // Textkoerper Einzug
427 SvxLRSpaceItem aLR( RES_LR_SPACE );
428 aLR.SetTxtFirstLineOfst( GetMetricVal( CM_05 ));
429 aSet.Put( aLR );
431 break;
432 case RES_POOLCOLL_TEXT_NEGIDENT: // Textkoerper neg. Einzug
434 SvxLRSpaceItem aLR( RES_LR_SPACE );
435 aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
436 aLR.SetTxtLeft( GetMetricVal( CM_1 ));
437 SvxTabStopItem aTStops(RES_PARATR_TABSTOP); aTStops.Insert( SvxTabStop( 0 ));
439 aSet.Put( aLR );
440 aSet.Put( aTStops );
442 break;
443 case RES_POOLCOLL_TEXT_MOVE: // Textkoerper Einrueckung
445 SvxLRSpaceItem aLR( RES_LR_SPACE );
446 aLR.SetTxtLeft( GetMetricVal( CM_05 ));
447 aSet.Put( aLR );
449 break;
451 case RES_POOLCOLL_CONFRONTATION: // Textkoerper Gegenueberstellung
453 SvxLRSpaceItem aLR( RES_LR_SPACE );
454 aLR.SetTxtFirstLineOfst( - short( GetMetricVal( CM_1 ) * 4 +
455 GetMetricVal( CM_05)) );
456 aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 5 );
457 SvxTabStopItem aTStops( RES_PARATR_TABSTOP ); aTStops.Insert( SvxTabStop( 0 ));
459 aSet.Put( aLR );
460 aSet.Put( aTStops );
462 break;
463 case RES_POOLCOLL_MARGINAL: // Textkoerper maginalie
465 SvxLRSpaceItem aLR( RES_LR_SPACE );
466 aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 4 );
467 aSet.Put( aLR );
469 break;
471 case RES_POOLCOLL_HEADLINE_BASE: // Basis Ueberschrift
473 static const USHORT aFntInit[] = {
474 DEFAULTFONT_LATIN_HEADING, RES_CHRATR_FONT,
475 RES_CHRATR_LANGUAGE, LANGUAGE_ENGLISH_US,
476 DEFAULTFONT_CJK_HEADING, RES_CHRATR_CJK_FONT,
477 RES_CHRATR_CJK_LANGUAGE, LANGUAGE_ENGLISH_US,
478 DEFAULTFONT_CTL_HEADING, RES_CHRATR_CTL_FONT,
479 RES_CHRATR_CTL_LANGUAGE, LANGUAGE_ARABIC_SAUDI_ARABIA,
483 for( const USHORT* pArr = aFntInit; *pArr; pArr += 4 )
485 USHORT nLng = ((SvxLanguageItem&)GetDefault( *(pArr+2) )).GetLanguage();
486 if( LANGUAGE_DONTKNOW == nLng )
487 nLng = *(pArr+3);
489 Font aFnt( OutputDevice::GetDefaultFont( *pArr,
490 nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
492 aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
493 aEmptyStr, aFnt.GetPitch(),
494 aFnt.GetCharSet(), *(pArr+1) ));
497 SvxFontHeightItem aFntSize( PT_14, 100, RES_CHRATR_FONTSIZE );
498 SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE );
499 if( get(IDocumentSettingAccess::HTML_MODE) )
500 aUL.SetLower( HTML_PARSPACE );
501 aSet.Put( SvxFmtKeepItem( TRUE, RES_KEEP ));
503 pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT ));
505 aSet.Put( aUL );
506 SetAllScriptItem( aSet, aFntSize );
508 break;
510 case RES_POOLCOLL_NUMBUL_BASE: // Basis Numerierung/Aufzaehlung
511 break;
513 case RES_POOLCOLL_GREETING: // Grussformel
514 case RES_POOLCOLL_REGISTER_BASE: // Basis Verzeichnisse
515 case RES_POOLCOLL_SIGNATURE: // Unterschrift
516 case RES_POOLCOLL_TABLE: // Tabelle-Inhalt
518 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
519 aSet.Put( aLN );
521 break;
523 case RES_POOLCOLL_HEADLINE1: // Ueberschrift 1
524 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 0, FALSE );
525 break;
526 case RES_POOLCOLL_HEADLINE2: // Ueberschrift 2
527 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 1, TRUE );
528 break;
529 case RES_POOLCOLL_HEADLINE3: // Ueberschrift 3
530 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 2, FALSE );
531 break;
532 case RES_POOLCOLL_HEADLINE4: // Ueberschrift 4
533 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 3, TRUE );
534 break;
535 case RES_POOLCOLL_HEADLINE5: // Ueberschrift 5
536 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 4, FALSE );
537 break;
538 case RES_POOLCOLL_HEADLINE6: // Ueberschrift 6
539 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 5, FALSE );
540 break;
541 case RES_POOLCOLL_HEADLINE7: // Ueberschrift 7
542 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 6, FALSE );
543 break;
544 case RES_POOLCOLL_HEADLINE8: // Ueberschrift 8
545 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 7, FALSE );
546 break;
547 case RES_POOLCOLL_HEADLINE9: // Ueberschrift 9
548 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 8, FALSE );
549 break;
550 case RES_POOLCOLL_HEADLINE10: // Ueberschrift 10
551 lcl_SetHeadline( this, pNewColl, aSet, nOutLvlBits, 9, FALSE );
552 break;
555 // Sonderbereiche:
556 // Kopfzeilen
557 case RES_POOLCOLL_HEADER:
558 case RES_POOLCOLL_HEADERL:
559 case RES_POOLCOLL_HEADERR:
560 // Fusszeilen
561 case RES_POOLCOLL_FOOTER:
562 case RES_POOLCOLL_FOOTERL:
563 case RES_POOLCOLL_FOOTERR:
565 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
566 aSet.Put( aLN );
568 long nRightMargin = lcl_GetRightMargin( *this );
570 SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
571 aTStops.Insert( SvxTabStop( nRightMargin / 2, SVX_TAB_ADJUST_CENTER ) );
572 aTStops.Insert( SvxTabStop( nRightMargin, SVX_TAB_ADJUST_RIGHT ) );
574 aSet.Put( aTStops );
576 break;
578 case RES_POOLCOLL_TABLE_HDLN:
580 SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
581 aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
582 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
583 aSet.Put( aLN );
585 break;
587 case RES_POOLCOLL_FOOTNOTE: // Fussnote
588 case RES_POOLCOLL_ENDNOTE:
590 SvxLRSpaceItem aLR( RES_LR_SPACE );
591 aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 ));
592 aLR.SetTxtLeft( GetMetricVal( CM_05 ));
593 SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
594 aSet.Put( aLR );
595 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
596 aSet.Put( aLN );
598 break;
600 case RES_POOLCOLL_LABEL: // Beschriftung-Basis
602 SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetUpper( PT_6 ); aUL.SetLower( PT_6 );
603 aSet.Put( aUL );
604 SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
605 SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) );
606 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
607 aSet.Put( aLN );
609 break;
611 case RES_POOLCOLL_FRAME: // Rahmen Inhalt
612 case RES_POOLCOLL_LABEL_ABB: // Beschriftung-Abbildung
613 case RES_POOLCOLL_LABEL_TABLE: // Beschriftung-Tabelle
614 case RES_POOLCOLL_LABEL_FRAME: // Beschriftung-Rahmen
615 case RES_POOLCOLL_LABEL_DRAWING: // Beschriftung-Zeichnung
616 break;
618 case RES_POOLCOLL_JAKETADRESS: // UmschlagAdresse
620 SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
621 aSet.Put( aUL );
622 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
623 aSet.Put( aLN );
625 break;
627 case RES_POOLCOLL_SENDADRESS: // AbsenderAdresse
629 if( get(IDocumentSettingAccess::HTML_MODE) )
630 SetAllScriptItem( aSet, SvxPostureItem(ITALIC_NORMAL, RES_CHRATR_POSTURE) );
631 else
633 SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
634 aSet.Put( aUL );
636 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
637 aSet.Put( aLN );
639 break;
641 // Benutzer-Verzeichnisse:
642 case RES_POOLCOLL_TOX_USERH: // Header
643 lcl_SetRegister( this, aSet, 0, TRUE, FALSE );
645 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
646 aSet.Put( aLN );
648 break;
649 case RES_POOLCOLL_TOX_USER1: // 1. Ebene
650 lcl_SetRegister( this, aSet, 0, FALSE, TRUE );
651 break;
652 case RES_POOLCOLL_TOX_USER2: // 2. Ebene
653 lcl_SetRegister( this, aSet, 1, FALSE, TRUE );
654 break;
655 case RES_POOLCOLL_TOX_USER3: // 3. Ebene
656 lcl_SetRegister( this, aSet, 2, FALSE, TRUE );
657 break;
658 case RES_POOLCOLL_TOX_USER4: // 4. Ebene
659 lcl_SetRegister( this, aSet, 3, FALSE, TRUE );
660 break;
661 case RES_POOLCOLL_TOX_USER5: // 5. Ebene
662 lcl_SetRegister( this, aSet, 4, FALSE, TRUE );
663 break;
664 case RES_POOLCOLL_TOX_USER6: // 6. Ebene
665 lcl_SetRegister( this, aSet, 5, FALSE, TRUE );
666 break;
667 case RES_POOLCOLL_TOX_USER7: // 7. Ebene
668 lcl_SetRegister( this, aSet, 6, FALSE, TRUE );
669 break;
670 case RES_POOLCOLL_TOX_USER8: // 8. Ebene
671 lcl_SetRegister( this, aSet, 7, FALSE, TRUE );
672 break;
673 case RES_POOLCOLL_TOX_USER9: // 9. Ebene
674 lcl_SetRegister( this, aSet, 8, FALSE, TRUE );
675 break;
676 case RES_POOLCOLL_TOX_USER10: // 10. Ebene
677 lcl_SetRegister( this, aSet, 9, FALSE, TRUE );
678 break;
680 // Index-Verzeichnisse
681 case RES_POOLCOLL_TOX_IDXH: // Header
682 lcl_SetRegister( this, aSet, 0, TRUE, FALSE );
684 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
685 aSet.Put( aLN );
687 break;
688 case RES_POOLCOLL_TOX_IDX1: // 1. Ebene
689 lcl_SetRegister( this, aSet, 0, FALSE, FALSE );
690 break;
691 case RES_POOLCOLL_TOX_IDX2: // 2. Ebene
692 lcl_SetRegister( this, aSet, 1, FALSE, FALSE );
693 break;
694 case RES_POOLCOLL_TOX_IDX3: // 3. Ebene
695 lcl_SetRegister( this, aSet, 2, FALSE, FALSE );
696 break;
697 case RES_POOLCOLL_TOX_IDXBREAK: // Trenner
698 lcl_SetRegister( this, aSet, 0, FALSE, FALSE );
699 break;
701 // Inhalts-Verzeichnisse
702 case RES_POOLCOLL_TOX_CNTNTH: // Header
703 lcl_SetRegister( this, aSet, 0, TRUE, FALSE );
705 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
706 aSet.Put( aLN );
708 break;
709 case RES_POOLCOLL_TOX_CNTNT1: // 1. Ebene
710 lcl_SetRegister( this, aSet, 0, FALSE, TRUE );
711 break;
712 case RES_POOLCOLL_TOX_CNTNT2: // 2. Ebene
713 lcl_SetRegister( this, aSet, 1, FALSE, TRUE );
714 break;
715 case RES_POOLCOLL_TOX_CNTNT3: // 3. Ebene
716 lcl_SetRegister( this, aSet, 2, FALSE, TRUE );
717 break;
718 case RES_POOLCOLL_TOX_CNTNT4: // 4. Ebene
719 lcl_SetRegister( this, aSet, 3, FALSE, TRUE );
720 break;
721 case RES_POOLCOLL_TOX_CNTNT5: // 5. Ebene
722 lcl_SetRegister( this, aSet, 4, FALSE, TRUE );
723 break;
724 case RES_POOLCOLL_TOX_CNTNT6: // 6. Ebene
725 lcl_SetRegister( this, aSet, 5, FALSE, TRUE );
726 break;
727 case RES_POOLCOLL_TOX_CNTNT7: // 7. Ebene
728 lcl_SetRegister( this, aSet, 6, FALSE, TRUE );
729 break;
730 case RES_POOLCOLL_TOX_CNTNT8: // 8. Ebene
731 lcl_SetRegister( this, aSet, 7, FALSE, TRUE );
732 break;
733 case RES_POOLCOLL_TOX_CNTNT9: // 9. Ebene
734 lcl_SetRegister( this, aSet, 8, FALSE, TRUE );
735 break;
736 case RES_POOLCOLL_TOX_CNTNT10: // 10. Ebene
737 lcl_SetRegister( this, aSet, 9, FALSE, TRUE );
738 break;
740 case RES_POOLCOLL_TOX_ILLUSH:
741 case RES_POOLCOLL_TOX_OBJECTH:
742 case RES_POOLCOLL_TOX_TABLESH:
743 case RES_POOLCOLL_TOX_AUTHORITIESH:
744 lcl_SetRegister( this, aSet, 0, TRUE, FALSE );
746 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
747 aSet.Put( aLN );
749 break;
750 case RES_POOLCOLL_TOX_ILLUS1:
751 case RES_POOLCOLL_TOX_OBJECT1:
752 case RES_POOLCOLL_TOX_TABLES1:
753 case RES_POOLCOLL_TOX_AUTHORITIES1:
754 lcl_SetRegister( this, aSet, 0, FALSE, TRUE );
755 break;
759 case RES_POOLCOLL_NUM_LEVEL1S:
760 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
761 lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
762 PT_12, PT_6 );
763 break;
764 case RES_POOLCOLL_NUM_LEVEL1:
765 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
766 lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
767 0, PT_6 );
768 break;
769 case RES_POOLCOLL_NUM_LEVEL1E:
770 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
771 lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ),
772 0, PT_12 );
773 break;
774 case RES_POOLCOLL_NUM_NONUM1:
775 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM1,
776 0, SwNumRule::GetNumIndent( 0 ), 0, PT_6 );
777 break;
778 case RES_POOLCOLL_NUM_LEVEL2S:
779 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
780 lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
781 PT_12, PT_6 );
782 break;
783 case RES_POOLCOLL_NUM_LEVEL2:
784 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
785 lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
786 0, PT_6 );
787 break;
788 case RES_POOLCOLL_NUM_LEVEL2E:
789 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
790 lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ),
791 0, PT_12 );
792 break;
793 case RES_POOLCOLL_NUM_NONUM2:
794 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM2,
795 0, SwNumRule::GetNumIndent( 1 ), 0, PT_6 );
796 break;
797 case RES_POOLCOLL_NUM_LEVEL3S:
798 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
799 lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
800 PT_12, PT_6 );
801 break;
802 case RES_POOLCOLL_NUM_LEVEL3:
803 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
804 lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
805 0, PT_6 );
806 break;
807 case RES_POOLCOLL_NUM_LEVEL3E:
808 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
809 lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ),
810 0, PT_12 );
811 break;
812 case RES_POOLCOLL_NUM_NONUM3:
813 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM3,
814 0, SwNumRule::GetNumIndent( 2 ), 0, PT_6 );
815 break;
816 case RES_POOLCOLL_NUM_LEVEL4S:
817 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
818 lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
819 PT_12, PT_6 );
820 break;
821 case RES_POOLCOLL_NUM_LEVEL4:
822 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
823 lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
824 0, PT_6 );
825 break;
826 case RES_POOLCOLL_NUM_LEVEL4E:
827 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
828 lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ),
829 0, PT_12 );
830 break;
831 case RES_POOLCOLL_NUM_NONUM4:
832 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM4,
833 0, SwNumRule::GetNumIndent( 3 ), 0, PT_6 );
834 break;
835 case RES_POOLCOLL_NUM_LEVEL5S:
836 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
837 lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
838 PT_12, PT_6 );
839 break;
840 case RES_POOLCOLL_NUM_LEVEL5:
841 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
842 lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
843 0, PT_6 );
844 break;
845 case RES_POOLCOLL_NUM_LEVEL5E:
846 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
847 lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ),
848 0, PT_12 );
849 break;
850 case RES_POOLCOLL_NUM_NONUM5:
851 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM5,
852 0, SwNumRule::GetNumIndent( 4 ), 0, PT_6 );
853 break;
855 case RES_POOLCOLL_BUL_LEVEL1S:
856 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
857 lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
858 PT_12, PT_6 );
859 break;
860 case RES_POOLCOLL_BUL_LEVEL1:
861 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
862 lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
863 0, PT_6 );
864 break;
865 case RES_POOLCOLL_BUL_LEVEL1E:
866 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1,
867 lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ),
868 0, PT_12 );
869 break;
870 case RES_POOLCOLL_BUL_NONUM1:
871 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM1,
872 0, SwNumRule::GetBullIndent( 0 ), 0, PT_6 );
873 break;
874 case RES_POOLCOLL_BUL_LEVEL2S:
875 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
876 lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
877 PT_12, PT_6 );
878 break;
879 case RES_POOLCOLL_BUL_LEVEL2:
880 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
881 lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
882 0, PT_6 );
883 break;
884 case RES_POOLCOLL_BUL_LEVEL2E:
885 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2,
886 lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ),
887 0, PT_12 );
888 break;
889 case RES_POOLCOLL_BUL_NONUM2:
890 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM2,
891 0, SwNumRule::GetBullIndent( 1 ), 0, PT_6 );
892 break;
893 case RES_POOLCOLL_BUL_LEVEL3S:
894 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
895 lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
896 PT_12, PT_6 );
897 break;
898 case RES_POOLCOLL_BUL_LEVEL3:
899 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
900 lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
901 0, PT_6 );
902 break;
903 case RES_POOLCOLL_BUL_LEVEL3E:
904 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3,
905 lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ),
906 0, PT_12 );
907 break;
908 case RES_POOLCOLL_BUL_NONUM3:
909 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM3,
910 0, SwNumRule::GetBullIndent( 2 ), 0, PT_6 );
911 break;
912 case RES_POOLCOLL_BUL_LEVEL4S:
913 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
914 lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
915 PT_12, PT_6 );
916 break;
917 case RES_POOLCOLL_BUL_LEVEL4:
918 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
919 lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
920 0, PT_6 );
921 break;
922 case RES_POOLCOLL_BUL_LEVEL4E:
923 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4,
924 lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ),
925 0, PT_12 );
926 break;
927 case RES_POOLCOLL_BUL_NONUM4:
928 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM4,
929 0, SwNumRule::GetBullIndent( 3 ), 0, PT_6 );
930 break;
931 case RES_POOLCOLL_BUL_LEVEL5S:
932 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
933 lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
934 PT_12, PT_6 );
935 break;
936 case RES_POOLCOLL_BUL_LEVEL5:
937 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
938 lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
939 0, PT_6 );
940 break;
941 case RES_POOLCOLL_BUL_LEVEL5E:
942 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5,
943 lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ),
944 0, PT_12 );
945 break;
946 case RES_POOLCOLL_BUL_NONUM5:
947 lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM5,
948 0, SwNumRule::GetBullIndent( 4 ), 0, PT_6 );
949 break;
951 case RES_POOLCOLL_DOC_TITEL: // Doc. Titel
953 SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
954 SetAllScriptItem( aSet, SvxFontHeightItem( PT_18, 100, RES_CHRATR_FONTSIZE ) );
956 aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) );
958 pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
959 RES_POOLCOLL_DOC_SUBTITEL ));
961 break;
963 case RES_POOLCOLL_DOC_SUBTITEL: // Doc. UnterTitel
965 SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ));
966 SetAllScriptItem( aSet, SvxFontHeightItem( PT_14, 100, RES_CHRATR_FONTSIZE ));
968 aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ));
970 pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
971 RES_POOLCOLL_TEXT ));
973 break;
975 case RES_POOLCOLL_HTML_BLOCKQUOTE:
977 SvxLRSpaceItem aLR( RES_LR_SPACE );
978 aLR.SetLeft( GetMetricVal( CM_1 ));
979 aLR.SetRight( GetMetricVal( CM_1 ));
980 aSet.Put( aLR );
981 // aSet.Put( SvxAdjustItem( SVX_ADJUST_BLOCK, RES_PARATR_ADJUST ) );
982 SvxULSpaceItem aUL( RES_UL_SPACE );
983 aUL = pNewColl->GetULSpace();
984 aUL.SetLower( HTML_PARSPACE );
985 aSet.Put( aUL);
987 break;
989 case RES_POOLCOLL_HTML_PRE:
991 ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
993 // WORKAROUND: PRE auf 10pt setzten
994 SetAllScriptItem( aSet, SvxFontHeightItem(PT_10, 100, RES_CHRATR_FONTSIZE) );
995 // WORKAROUND: PRE auf 10pt setzten
997 // der untere Absatz-Abstand wird explizit gesetzt (macht
998 // die harte Attributierung einfacher)
999 SvxULSpaceItem aULSpaceItem( RES_UL_SPACE );
1000 aULSpaceItem = pNewColl->GetULSpace();
1001 aULSpaceItem.SetLower( 0 );
1002 aSet.Put( aULSpaceItem );
1004 break;
1006 case RES_POOLCOLL_HTML_HR:
1008 SvxBoxItem aBox( RES_BOX );
1009 Color aColor( COL_GRAY );
1010 SvxBorderLine aNew( &aColor, DEF_DOUBLE_LINE0_OUT,
1011 DEF_DOUBLE_LINE0_IN,
1012 DEF_DOUBLE_LINE0_DIST );
1013 aBox.SetLine( &aNew, BOX_LINE_BOTTOM );
1015 aSet.Put( aBox );
1016 aSet.Put( SwParaConnectBorderItem( FALSE ) );
1017 SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) );
1019 SvxULSpaceItem aUL( RES_UL_SPACE );
1021 pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
1022 RES_POOLCOLL_TEXT ));
1023 aUL = pNewColl->GetULSpace();
1025 aUL.SetLower( HTML_PARSPACE );
1026 aSet.Put( aUL);
1027 SwFmtLineNumber aLN; aLN.SetCountLines( FALSE );
1028 aSet.Put( aLN );
1030 break;
1032 case RES_POOLCOLL_HTML_DD:
1034 SvxLRSpaceItem aLR( RES_LR_SPACE );
1035 aLR = pNewColl->GetLRSpace();
1036 // es wird um 1cm eingerueckt. Die IDs liegen immer 2 auseinander!
1037 aLR.SetLeft( GetMetricVal( CM_1 ));
1038 aSet.Put( aLR );
1040 break;
1041 case RES_POOLCOLL_HTML_DT:
1043 SvxLRSpaceItem aLR( RES_LR_SPACE );
1045 pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool(
1046 RES_POOLCOLL_HTML_DD ));
1047 aLR = pNewColl->GetLRSpace();
1049 // es wird um 0cm eingerueckt. Die IDs liegen immer 2 auseinander!
1050 aLR.SetLeft( 0 );
1051 aSet.Put( aLR );
1053 break;
1056 if( aSet.Count() )
1059 pNewColl->SetFmtAttr( aSet );
1060 // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
1061 // (Bug: 18545)
1062 // SetModified();
1065 return pNewColl;
1070 // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
1071 // benutzt wird
1072 bool SwDoc::IsPoolTxtCollUsed( USHORT nId ) const
1074 ASSERT(
1075 (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
1076 (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) ||
1077 (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) ||
1078 (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) ||
1079 (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
1080 (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END),
1081 "Falsche AutoFormat-Id" );
1083 SwTxtFmtColl* pNewColl = 0;
1084 BOOL bFnd = FALSE;
1085 for( USHORT n = 0; !bFnd && n < pTxtFmtCollTbl->Count(); ++n )
1087 pNewColl = (*pTxtFmtCollTbl)[ n ];
1088 if( nId == pNewColl->GetPoolFmtId() )
1089 bFnd = TRUE;
1092 if( !bFnd || !pNewColl->GetDepends() )
1093 return FALSE;
1095 SwAutoFmtGetDocNode aGetHt( &aNodes );
1096 return !pNewColl->GetInfo( aGetHt );
1099 // Gebe das "Auto[matische]-Format" mit der Id zurueck. Existiert
1100 // es noch nicht, dann erzeuge es
1102 SwFmt* SwDoc::GetFmtFromPool( USHORT nId )
1104 SwFmt *pNewFmt = 0;
1105 SwFmt *pDeriveFmt = 0;
1107 SvPtrarr* pArray[ 2 ];
1108 USHORT nArrCnt = 1, nRCId = 0;
1109 USHORT* pWhichRange = 0;
1111 switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
1113 case POOLGRP_CHARFMT:
1115 pArray[0] = pCharFmtTbl;
1116 pDeriveFmt = pDfltCharFmt;
1118 if( nId > RES_POOLCHR_NORMAL_END )
1119 nRCId = RC_POOLCHRFMT_HTML_BEGIN - RES_POOLCHR_HTML_BEGIN;
1120 else
1121 nRCId = RC_POOLCHRFMT_BEGIN - RES_POOLCHR_BEGIN;
1122 pWhichRange = aCharFmtSetRange;
1124 // Fehlerfall: unbekanntes Format, aber CharFormat
1125 // -> returne das erste
1126 if( RES_POOLCHR_BEGIN > nId || nId >= RES_POOLCHR_END )
1128 ASSERT( !this, "ungueltige Id" );
1129 nId = RES_POOLCHR_BEGIN;
1132 break;
1133 case POOLGRP_FRAMEFMT:
1135 pArray[0] = pFrmFmtTbl;
1136 pArray[1] = pSpzFrmFmtTbl;
1137 pDeriveFmt = pDfltFrmFmt;
1138 nArrCnt = 2;
1139 nRCId = RC_POOLFRMFMT_BEGIN - RES_POOLFRM_BEGIN;
1140 pWhichRange = aFrmFmtSetRange;
1142 // Fehlerfall: unbekanntes Format, aber FrameFormat
1143 // -> returne das erste
1144 if( RES_POOLFRM_BEGIN > nId || nId >= RES_POOLFRM_END )
1146 ASSERT( !this, "ungueltige Id" );
1147 nId = RES_POOLFRM_BEGIN;
1150 break;
1152 default:
1153 // Fehlerfall, unbekanntes Format
1154 ASSERT( nId, "ungueltige Id" );
1155 return 0;
1157 ASSERT( nRCId, "ungueltige Id" );
1159 while( nArrCnt-- )
1160 for( USHORT n = 0; n < (*pArray[nArrCnt]).Count(); ++n )
1161 if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
1162 GetPoolFmtId() )
1164 return pNewFmt;
1167 ResId aResId( nRCId + nId, *pSwResMgr );
1168 String aNm( aResId );
1169 SwAttrSet aSet( GetAttrPool(), pWhichRange );
1172 BOOL bIsModified = IsModified();
1174 BOOL bDoesUndo = DoesUndo();
1175 DoUndo(FALSE);
1176 switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
1178 case POOLGRP_CHARFMT:
1179 pNewFmt = _MakeCharFmt( aNm, pDeriveFmt, FALSE, TRUE );
1181 break;
1182 case POOLGRP_FRAMEFMT:
1183 pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, FALSE, TRUE );
1185 break;
1186 default:
1187 break;
1190 DoUndo(bDoesUndo);
1192 if( !bIsModified )
1193 ResetModified();
1194 pNewFmt->SetPoolFmtId( nId );
1195 pNewFmt->SetAuto( FALSE ); // kein Auto-Format
1198 switch( nId )
1200 case RES_POOLCHR_FOOTNOTE: // Fussnote
1201 case RES_POOLCHR_PAGENO: // Seiten/Feld
1202 case RES_POOLCHR_LABEL: // Beschriftung
1203 case RES_POOLCHR_DROPCAPS: // Initialien
1204 case RES_POOLCHR_NUM_LEVEL: // Aufzaehlungszeichen
1205 case RES_POOLCHR_TOXJUMP: // Verzeichnissprung
1206 case RES_POOLCHR_ENDNOTE: // Endnote
1207 case RES_POOLCHR_LINENUM: // Zeilennummerierung
1208 break;
1210 case RES_POOLCHR_ENDNOTE_ANCHOR: // Endnotenanker
1211 case RES_POOLCHR_FOOTNOTE_ANCHOR: // Fussnotenanker
1213 aSet.Put( SvxEscapementItem( DFLT_ESC_AUTO_SUPER, 58, RES_CHRATR_ESCAPEMENT ) );
1215 break;
1218 case RES_POOLCHR_BUL_LEVEL: // Aufzaehlungszeichen
1220 const Font& rBulletFont = numfunc::GetDefBulletFont();
1221 SetAllScriptItem( aSet, SvxFontItem( rBulletFont.GetFamily(),
1222 rBulletFont.GetName(), rBulletFont.GetStyleName(),
1223 rBulletFont.GetPitch(), rBulletFont.GetCharSet(), RES_CHRATR_FONT ));
1224 // --> OD 2008-06-02 #i63395#
1225 // no font and no font size any more
1226 // SetAllScriptItem( aSet, SvxFontHeightItem( PT_9, 100, RES_CHRATR_FONTSIZE ));
1227 // <--
1229 break;
1231 case RES_POOLCHR_INET_NORMAL:
1233 Color aCol( COL_BLUE );
1234 aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1235 aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) );
1236 // i40133: patch submitted by rail: set language to 'none' to prevent spell checking:
1237 aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
1238 aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) );
1239 aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) );
1241 break;
1242 case RES_POOLCHR_INET_VISIT:
1244 Color aCol( COL_RED );
1245 aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1246 aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) );
1247 aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) );
1248 aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) );
1249 aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) );
1251 break;
1252 case RES_POOLCHR_JUMPEDIT:
1254 Color aCol( COL_CYAN );
1255 aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) );
1256 aSet.Put( SvxUnderlineItem( UNDERLINE_DOTTED, RES_CHRATR_UNDERLINE ) );
1257 aSet.Put( SvxCaseMapItem( SVX_CASEMAP_KAPITAELCHEN, RES_CHRATR_CASEMAP ) );
1259 break;
1261 case RES_POOLCHR_RUBYTEXT:
1263 long nH = ((SvxFontHeightItem*)GetDfltAttr(
1264 RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2;
1265 SetAllScriptItem( aSet, SvxFontHeightItem( nH, 100, RES_CHRATR_FONTSIZE));
1266 aSet.Put(SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ));
1267 aSet.Put(SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK) );
1269 break;
1271 case RES_POOLCHR_HTML_EMPHASIS:
1272 case RES_POOLCHR_HTML_CITIATION:
1273 case RES_POOLCHR_HTML_VARIABLE:
1275 SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE) );
1277 break;
1279 case RES_POOLCHR_IDX_MAIN_ENTRY:
1280 case RES_POOLCHR_HTML_STRONG:
1282 SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ));
1284 break;
1286 case RES_POOLCHR_HTML_CODE:
1287 case RES_POOLCHR_HTML_SAMPLE:
1288 case RES_POOLCHR_HTML_KEYBOARD:
1289 case RES_POOLCHR_HTML_TELETYPE:
1291 ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
1293 break;
1294 case RES_POOLCHR_VERT_NUM:
1295 aSet.Put( SvxCharRotateItem( 900, sal_False, RES_CHRATR_ROTATE ) );
1296 break;
1297 //nichts besonderes
1298 // case RES_POOLCHR_HTML_DEFINSTANCE:
1299 // break;
1302 case RES_POOLFRM_FRAME:
1304 if ( get(IDocumentSettingAccess::BROWSE_MODE) )
1306 aSet.Put( SwFmtAnchor( FLY_IN_CNTNT ));
1307 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::LINE_CENTER, text::RelOrientation::PRINT_AREA ) );
1308 aSet.Put( SwFmtSurround( SURROUND_NONE ) );
1310 else
1312 aSet.Put( SwFmtAnchor( FLY_AT_CNTNT ));
1313 aSet.Put( SwFmtSurround( SURROUND_PARALLEL ) );
1314 aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::PRINT_AREA ) );
1315 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::PRINT_AREA ) );
1316 Color aCol( COL_BLACK );
1317 SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
1318 SvxBoxItem aBox( RES_BOX );
1319 aBox.SetLine( &aLine, BOX_LINE_TOP );
1320 aBox.SetLine( &aLine, BOX_LINE_BOTTOM );
1321 aBox.SetLine( &aLine, BOX_LINE_LEFT );
1322 aBox.SetLine( &aLine, BOX_LINE_RIGHT );
1323 aBox.SetDistance( 85 );
1324 aSet.Put( aBox );
1325 aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1326 aSet.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE ) );
1329 break;
1330 case RES_POOLFRM_GRAPHIC:
1331 case RES_POOLFRM_OLE:
1333 aSet.Put( SwFmtAnchor( FLY_AT_CNTNT ));
1334 aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1335 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1336 aSet.Put( SwFmtSurround( SURROUND_IDEAL ));
1338 break;
1339 case RES_POOLFRM_FORMEL:
1341 aSet.Put( SwFmtAnchor( FLY_IN_CNTNT ) );
1342 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::FRAME ) );
1343 aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1345 break;
1346 case RES_POOLFRM_MARGINAL:
1348 aSet.Put( SwFmtAnchor( FLY_AT_CNTNT ));
1349 aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME ));
1350 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1351 aSet.Put( SwFmtSurround( SURROUND_PARALLEL ));
1352 // Breite 3.5 centimeter vorgegeben, als Hoehe nur den
1353 // min. Wert benutzen
1354 aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE,
1355 GetMetricVal( CM_1 ) * 3 + GetMetricVal( CM_05 ),
1356 MM50 ));
1358 break;
1359 case RES_POOLFRM_WATERSIGN:
1361 aSet.Put( SwFmtAnchor( FLY_PAGE ));
1362 aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1363 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ));
1364 aSet.Put( SvxOpaqueItem( FALSE ));
1365 aSet.Put( SwFmtSurround( SURROUND_THROUGHT ));
1367 break;
1369 case RES_POOLFRM_LABEL:
1371 aSet.Put( SwFmtAnchor( FLY_IN_CNTNT ) );
1372 aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) );
1373 aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1375 SvxProtectItem aProtect( RES_PROTECT );
1376 aProtect.SetSizeProtect( TRUE );
1377 aProtect.SetPosProtect( TRUE );
1378 aSet.Put( aProtect );
1380 pNewFmt->SetAutoUpdateFmt( TRUE );
1382 break;
1384 if( aSet.Count() )
1387 pNewFmt->SetFmtAttr( aSet );
1388 // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
1389 // (Bug: 18545)
1390 // SetModified();
1393 return pNewFmt;
1396 SwFrmFmt* SwDoc::GetFrmFmtFromPool( sal_uInt16 nId )
1398 return (SwFrmFmt*)GetFmtFromPool( nId );
1401 SwCharFmt* SwDoc::GetCharFmtFromPool( sal_uInt16 nId )
1403 return (SwCharFmt*)GetFmtFromPool( nId );
1406 // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
1407 // benutzt wird
1408 bool SwDoc::IsPoolFmtUsed( USHORT nId ) const
1410 SwFmt *pNewFmt = 0;
1411 const SvPtrarr* pArray[ 2 ];
1412 USHORT nArrCnt = 1;
1413 BOOL bFnd = TRUE;
1415 if( RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END )
1417 pArray[0] = pCharFmtTbl;
1419 if( RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END )
1421 pArray[0] = pFrmFmtTbl;
1422 pArray[1] = pSpzFrmFmtTbl;
1423 nArrCnt = 2;
1425 else
1427 ASSERT( FALSE, "ungueltige Id" );
1428 bFnd = FALSE;
1431 if( bFnd )
1433 bFnd = FALSE;
1434 while( nArrCnt-- && !bFnd )
1435 for( USHORT n = 0; !bFnd && n < (*pArray[nArrCnt]).Count(); ++n )
1436 if( nId == ( pNewFmt = (SwFmt*)(*pArray[ nArrCnt ] )[ n ] )->
1437 GetPoolFmtId() )
1438 bFnd = TRUE;
1441 // nicht gefunden oder keine Abhaengigen ?
1442 if( bFnd && pNewFmt->GetDepends() )
1444 // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
1445 // (auch indirekte fuer Format-Ableitung! )
1446 SwAutoFmtGetDocNode aGetHt( &aNodes );
1447 bFnd = !pNewFmt->GetInfo( aGetHt );
1449 else
1450 bFnd = FALSE;
1452 return bFnd;
1457 void lcl_GetStdPgSize( SwDoc* pDoc, SfxItemSet& rSet )
1459 SwPageDesc* pStdPgDsc = pDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1460 SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
1461 if( pStdPgDsc->GetLandscape() )
1463 SwTwips nTmp = aFrmSz.GetHeight();
1464 aFrmSz.SetHeight( aFrmSz.GetWidth() );
1465 aFrmSz.SetWidth( nTmp );
1467 rSet.Put( aFrmSz );
1470 SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
1472 ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
1473 "Falsche AutoFormat-Id" );
1475 SwPageDesc *pNewPgDsc;
1476 USHORT n;
1478 for( n = 0; n < aPageDescs.Count(); ++n )
1479 if( nId == ( pNewPgDsc = aPageDescs[ n ] )->GetPoolFmtId() )
1481 return pNewPgDsc;
1484 // Fehlerfall: unbekannte Poolvorlage
1485 if( RES_POOLPAGE_BEGIN > nId || nId >= RES_POOLPAGE_END )
1487 ASSERT( !this, "ungueltige Id" );
1488 nId = RES_POOLPAGE_BEGIN;
1491 ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr );
1492 String aNm( aResId );
1494 BOOL bIsModified = IsModified();
1496 BOOL bDoesUndo = DoesUndo();
1497 DoUndo(FALSE);
1498 n = MakePageDesc( aNm, 0, bRegardLanguage );
1499 DoUndo(bDoesUndo);
1501 pNewPgDsc = aPageDescs[ n ];
1502 pNewPgDsc->SetPoolFmtId( nId );
1503 if( !bIsModified )
1504 ResetModified();
1508 SvxLRSpaceItem aLR( RES_LR_SPACE );
1509 aLR.SetLeft( GetMetricVal( CM_1 ) * 2 );
1510 aLR.SetRight( aLR.GetLeft() );
1511 SvxULSpaceItem aUL( RES_UL_SPACE );
1512 aUL.SetUpper( (USHORT)aLR.GetLeft() );
1513 aUL.SetLower( (USHORT)aLR.GetLeft() );
1515 SwAttrSet aSet( GetAttrPool(), aPgFrmFmtSetRange );
1516 BOOL bSetLeft = TRUE;
1518 switch( nId )
1520 case RES_POOLPAGE_STANDARD: // Standard-Seite
1522 aSet.Put( aLR );
1523 aSet.Put( aUL );
1524 if( pNewPgDsc )
1525 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1527 break;
1529 case RES_POOLPAGE_FIRST: // Erste Seite
1530 case RES_POOLPAGE_REGISTER: // Verzeichnis
1532 lcl_GetStdPgSize( this, aSet );
1533 aSet.Put( aLR );
1534 aSet.Put( aUL );
1535 if( pNewPgDsc )
1537 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1538 if( RES_POOLPAGE_FIRST == nId )
1539 pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD ));
1542 break;
1544 case RES_POOLPAGE_LEFT: // Linke Seite
1546 lcl_GetStdPgSize( this, aSet );
1547 aSet.Put( aLR );
1548 aSet.Put( aUL );
1549 bSetLeft = FALSE;
1550 if( pNewPgDsc )
1551 pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT );
1553 break;
1554 case RES_POOLPAGE_RIGHT: // Rechte Seite
1556 lcl_GetStdPgSize( this, aSet );
1557 aSet.Put( aLR );
1558 aSet.Put( aUL );
1559 bSetLeft = FALSE;
1560 if( pNewPgDsc )
1561 pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT );
1563 break;
1565 case RES_POOLPAGE_JAKET: // Umschlag
1567 aLR.SetLeft( 0 ); aLR.SetRight( 0 );
1568 aUL.SetUpper( 0 ); aUL.SetLower( 0 );
1569 Size aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65 ) );
1570 LandscapeSwap( aPSize );
1571 aSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aPSize.Width(), aPSize.Height() ));
1572 aSet.Put( aLR );
1573 aSet.Put( aUL );
1575 if( pNewPgDsc )
1577 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1578 pNewPgDsc->SetLandscape( TRUE );
1581 break;
1583 case RES_POOLPAGE_HTML: // HTML
1585 lcl_GetStdPgSize( this, aSet );
1586 aLR.SetRight( GetMetricVal( CM_1 ));
1587 aUL.SetUpper( (USHORT)aLR.GetRight() );
1588 aUL.SetLower( (USHORT)aLR.GetRight() );
1589 aSet.Put( aLR );
1590 aSet.Put( aUL );
1592 if( pNewPgDsc )
1593 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1595 break;
1596 case RES_POOLPAGE_FOOTNOTE:
1597 case RES_POOLPAGE_ENDNOTE:
1599 lcl_GetStdPgSize( this, aSet );
1600 aSet.Put( aLR );
1601 aSet.Put( aUL );
1602 if( pNewPgDsc )
1603 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1604 SwPageFtnInfo aInf( pNewPgDsc->GetFtnInfo() );
1605 aInf.SetLineWidth( 0 );
1606 aInf.SetTopDist( 0 );
1607 aInf.SetBottomDist( 0 );
1608 pNewPgDsc->SetFtnInfo( aInf );
1610 break;
1611 case RES_POOLPAGE_LANDSCAPE:
1613 SwPageDesc* pStdPgDsc = this->GetPageDescFromPool( RES_POOLPAGE_STANDARD );
1614 SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() );
1615 SwTwips nTmp = aFrmSz.GetHeight();
1616 aFrmSz.SetHeight( aFrmSz.GetWidth() );
1617 aFrmSz.SetWidth( nTmp );
1618 aSet.Put( aFrmSz );
1619 aSet.Put( aLR );
1620 aSet.Put( aUL );
1621 if( pNewPgDsc )
1623 pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL );
1624 pNewPgDsc->SetLandscape( TRUE );
1627 break;
1631 if( aSet.Count() )
1634 if( bSetLeft )
1635 pNewPgDsc->GetLeft().SetFmtAttr( aSet );
1636 pNewPgDsc->GetMaster().SetFmtAttr( aSet );
1637 // JP 31.08.95: erzeugen einer PoolVorlage ist keine Modifikation
1638 // (Bug: 18545)
1639 // SetModified();
1642 return pNewPgDsc;
1645 SwNumRule* SwDoc::GetNumRuleFromPool( USHORT nId )
1647 ASSERT( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END,
1648 "Falsche AutoFormat-Id" );
1650 SwNumRule* pNewRule;
1651 USHORT n;
1653 for( n = 0; n < GetNumRuleTbl().Count(); ++n )
1654 if( nId == ( pNewRule = GetNumRuleTbl()[ n ] )->GetPoolFmtId() )
1656 return pNewRule;
1659 // Fehlerfall: unbekannte Poolvorlage
1660 if( RES_POOLNUMRULE_BEGIN > nId || nId >= RES_POOLNUMRULE_END )
1662 ASSERT( !this, "ungueltige Id" );
1663 nId = RES_POOLNUMRULE_BEGIN;
1666 ResId aResId( sal_uInt32(RC_POOLNUMRULE_BEGIN + nId - RES_POOLNUMRULE_BEGIN), *pSwResMgr );
1667 String aNm( aResId );
1669 SwCharFmt *pNumCFmt = 0, *pBullCFmt = 0;
1671 // --> OD 2008-02-11 #newlistlevelattrs#
1672 const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode
1673 // --> OD 2008-06-06 #i89178#
1674 = numfunc::GetDefaultPositionAndSpaceMode();
1675 // <--
1676 // <--
1678 BOOL bIsModified = IsModified();
1679 // --> OD 2008-02-11 #newlistlevelattrs#
1680 n = MakeNumRule( aNm, 0, FALSE, eNumberFormatPositionAndSpaceMode );
1681 // <--
1682 pNewRule = GetNumRuleTbl()[ n ];
1683 pNewRule->SetPoolFmtId( nId );
1684 pNewRule->SetAutoRule( FALSE );
1686 if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 )
1687 pNumCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1689 if( ( RES_POOLNUMRULE_BUL1 <= nId && nId <= RES_POOLNUMRULE_BUL5 ) ||
1690 RES_POOLNUMRULE_NUM5 == nId )
1691 pBullCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL );
1693 if( !bIsModified )
1694 ResetModified();
1697 switch( nId )
1699 case RES_POOLNUMRULE_NUM1:
1701 SwNumFmt aFmt;
1702 // --> OD 2008-02-11 #newlistlevelattrs#
1703 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1704 // <--
1705 aFmt.SetNumberingType(SVX_NUM_ARABIC);
1706 aFmt.SetCharFmt( pNumCFmt );
1707 aFmt.SetStart( 1 );
1708 aFmt.SetIncludeUpperLevels( 1 );
1709 aFmt.SetSuffix( aDotStr );
1711 static const USHORT aAbsSpace[ MAXLEVEL ] =
1713 // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
1714 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1716 #ifdef USE_MEASUREMENT
1717 static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
1719 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1721 const USHORT* pArr = MEASURE_METRIC ==
1722 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1723 ? aAbsSpace
1724 : aAbsSpaceInch;
1725 #else
1726 const USHORT* pArr = aAbsSpace;
1727 #endif
1729 // --> OD 2008-02-11 #newlistlevelattrs#
1730 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1732 aFmt.SetFirstLineOffset( - (*pArr) );
1734 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1736 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1737 aFmt.SetFirstLineIndent( - (*pArr) );
1739 // <--
1740 for( n = 0; n < MAXLEVEL; ++n, ++pArr )
1742 // --> OD 2008-02-11 #newlistlevelattrs#
1743 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1745 aFmt.SetAbsLSpace( *pArr );
1747 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1749 aFmt.SetListtabPos( *pArr );
1750 aFmt.SetIndentAt( *pArr );
1752 // <--
1753 pNewRule->Set( n, aFmt );
1756 break;
1758 case RES_POOLNUMRULE_NUM2:
1760 static const USHORT aAbsSpace[ MAXLEVEL ] =
1762 283, 283, 567, 709, // 0.50, 0.50, 1.00, 1.25
1763 850, 1021, 1304, 1474, // 1.50, 1.80, 2.30, 2.60
1764 1588, 1758 // 2.80, 3.10
1767 #ifdef USE_MEASUREMENT
1768 static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
1770 385, 385, 770, 963,
1771 1155, 1386, 1771, 2002,
1772 2156, 2387
1775 const USHORT* pArr = MEASURE_METRIC ==
1776 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1777 ? aAbsSpace
1778 : aAbsSpaceInch;
1779 #else
1780 const USHORT* pArr = aAbsSpace;
1781 #endif
1782 SwNumFmt aFmt;
1783 // --> OD 2008-02-11 #newlistlevelattrs#
1784 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1785 // <--
1786 aFmt.SetNumberingType(SVX_NUM_ARABIC);
1787 aFmt.SetCharFmt( pNumCFmt );
1788 aFmt.SetIncludeUpperLevels( 1 );
1789 // --> OD 2008-02-11 #newlistlevelattrs#
1790 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1792 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1794 // <--
1795 USHORT nSpace = 0;
1796 for( n = 0; n < MAXLEVEL; ++n )
1798 // --> OD 2008-02-11 #newlistlevelattrs#
1799 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1801 aFmt.SetAbsLSpace( nSpace = nSpace + pArr[ n ] );
1802 aFmt.SetFirstLineOffset( - pArr[ n ] );
1804 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1806 aFmt.SetListtabPos( nSpace = nSpace + pArr[ n ] );
1807 aFmt.SetIndentAt( nSpace );
1808 aFmt.SetFirstLineIndent( - pArr[ n ] );
1810 // <--
1811 aFmt.SetStart( n+1 );
1812 pNewRule->Set( n, aFmt );
1815 break;
1816 case RES_POOLNUMRULE_NUM3:
1818 SwNumFmt aFmt;
1819 // --> OD 2008-02-11 #newlistlevelattrs#
1820 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1821 // <--
1822 aFmt.SetNumberingType(SVX_NUM_ARABIC);
1823 aFmt.SetCharFmt( pNumCFmt );
1824 aFmt.SetIncludeUpperLevels( 1 );
1826 USHORT nOffs = GetMetricVal( CM_1 ) * 3;
1827 // --> OD 2008-02-11 #newlistlevelattrs#
1828 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1830 aFmt.SetFirstLineOffset( - nOffs );
1832 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1834 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1835 aFmt.SetFirstLineIndent( - nOffs );
1837 // <--
1839 for( n = 0; n < MAXLEVEL; ++n )
1841 // --> OD 2008-02-11 #newlistlevelattrs#
1842 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1844 aFmt.SetAbsLSpace( (n+1) * nOffs );
1846 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1848 aFmt.SetListtabPos( (n+1) * nOffs );
1849 aFmt.SetIndentAt( (n+1) * nOffs );
1851 // <--
1852 aFmt.SetStart( n+1 );
1853 pNewRule->Set( n, aFmt );
1856 break;
1857 case RES_POOLNUMRULE_NUM4:
1859 SwNumFmt aFmt;
1860 // --> OD 2008-02-11 #newlistlevelattrs#
1861 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1862 // <--
1863 aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER);
1864 aFmt.SetCharFmt( pNumCFmt );
1865 aFmt.SetIncludeUpperLevels( 1 );
1866 aFmt.SetSuffix( aDotStr );
1868 static const USHORT aAbsSpace[ MAXLEVEL ] =
1870 // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
1871 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1873 #ifdef USE_MEASUREMENT
1874 static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
1876 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1878 const USHORT* pArr = MEASURE_METRIC ==
1879 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1880 ? aAbsSpace
1881 : aAbsSpaceInch;
1882 #else
1883 const USHORT* pArr = aAbsSpace;
1884 #endif
1886 // --> OD 2008-02-11 #newlistlevelattrs#
1887 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1889 aFmt.SetFirstLineOffset( - (*pArr) );
1891 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1893 aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
1894 aFmt.SetFirstLineIndent( - (*pArr) );
1896 // <--
1897 for( n = 0; n < MAXLEVEL; ++n, ++pArr )
1899 aFmt.SetStart( n + 1 );
1900 // --> OD 2008-02-11 #newlistlevelattrs#
1901 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1903 aFmt.SetAbsLSpace( *pArr );
1905 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1907 aFmt.SetListtabPos( *pArr );
1908 aFmt.SetIndentAt( *pArr );
1910 // <--
1911 pNewRule->Set( n, aFmt );
1914 break;
1915 case RES_POOLNUMRULE_NUM5:
1917 // [ First, LSpace ]
1918 static const USHORT aAbsSpace0to2[] =
1920 227, 227, // 0.40, 0.40,
1921 369, 624, // 0.65, 1.10,
1922 255, 879 // 0.45, 1.55
1925 #ifdef USE_MEASUREMENT
1926 static const USHORT aAbsSpaceInch0to2[] =
1928 308, 308,
1929 501, 847,
1930 347, 1194
1932 const USHORT* pArr0to2 = MEASURE_METRIC ==
1933 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1934 ? aAbsSpace0to2
1935 : aAbsSpaceInch0to2;
1936 #else
1937 const USHORT* pArr0to2 = aAbsSpace0to2;
1938 #endif
1939 SwNumFmt aFmt;
1940 // --> OD 2008-02-11 #newlistlevelattrs#
1941 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1942 // <--
1943 aFmt.SetNumberingType(SVX_NUM_ARABIC);
1944 aFmt.SetStart( 1 );
1945 aFmt.SetIncludeUpperLevels( 1 );
1946 aFmt.SetSuffix( aDotStr );
1947 // --> OD 2008-02-11 #newlistlevelattrs#
1948 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1950 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
1952 // <--
1954 // --> OD 2008-02-11 #newlistlevelattrs#
1955 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1957 aFmt.SetFirstLineOffset( -pArr0to2[0] ); // == 0.40 cm
1958 aFmt.SetAbsLSpace( pArr0to2[1] ); // == 0.40 cm
1960 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1962 aFmt.SetFirstLineIndent( -pArr0to2[0] );
1963 aFmt.SetListtabPos( pArr0to2[1] );
1964 aFmt.SetIndentAt( pArr0to2[1] );
1966 // <--
1968 aFmt.SetCharFmt( pNumCFmt );
1969 pNewRule->Set( 0, aFmt );
1971 aFmt.SetIncludeUpperLevels( 2 );
1972 aFmt.SetStart( 2 );
1973 // --> OD 2008-02-11 #newlistlevelattrs#
1974 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1976 aFmt.SetFirstLineOffset( -pArr0to2[2] ); // == 0.65 cm
1977 aFmt.SetAbsLSpace( pArr0to2[3] ); // == 1.10 cm
1979 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1981 aFmt.SetFirstLineIndent( -pArr0to2[2] );
1982 aFmt.SetListtabPos( pArr0to2[3] );
1983 aFmt.SetIndentAt( pArr0to2[3] );
1985 // <--
1986 pNewRule->Set( 1, aFmt );
1988 aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER);
1989 aFmt.SetSuffix( ')');
1990 aFmt.SetIncludeUpperLevels( 1 );
1991 aFmt.SetStart( 3 );
1992 // --> OD 2008-02-11 #newlistlevelattrs#
1993 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1995 aFmt.SetFirstLineOffset( - pArr0to2[4] ); // == 0.45cm
1996 aFmt.SetAbsLSpace( pArr0to2[5] ); // == 1.55 cm
1998 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2000 aFmt.SetFirstLineIndent( -pArr0to2[4] );
2001 aFmt.SetListtabPos( pArr0to2[5] );
2002 aFmt.SetIndentAt( pArr0to2[5] );
2004 // <--
2005 pNewRule->Set( 2, aFmt );
2008 aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2009 aFmt.SetCharFmt( pBullCFmt );
2010 // --> OD 2006-06-29 #6440955#
2011 aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2012 // <--
2013 aFmt.SetBulletChar( cBulletChar );
2014 USHORT nOffs = GetMetricVal( CM_01 ) * 4,
2015 nOffs2 = GetMetricVal( CM_1 ) * 2;
2017 // --> OD 2008-02-11 #newlistlevelattrs#
2018 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2020 aFmt.SetFirstLineOffset( - nOffs );
2022 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2024 aFmt.SetFirstLineIndent( - nOffs );
2026 // <--
2027 aFmt.SetSuffix( aEmptyStr );
2028 for( n = 3; n < MAXLEVEL; ++n )
2030 aFmt.SetStart( n+1 );
2031 // --> OD 2008-02-11 #newlistlevelattrs#
2032 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2034 aFmt.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) );
2036 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2038 aFmt.SetListtabPos( nOffs2 + ((n-3) * nOffs) );
2039 aFmt.SetIndentAt( nOffs2 + ((n-3) * nOffs) );
2041 // <--
2042 pNewRule->Set( n, aFmt );
2045 break;
2047 case RES_POOLNUMRULE_BUL1:
2049 SwNumFmt aFmt;
2050 // --> OD 2008-02-11 #newlistlevelattrs#
2051 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2052 // <--
2053 aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2054 aFmt.SetCharFmt( pBullCFmt );
2055 aFmt.SetStart( 1 );
2056 aFmt.SetIncludeUpperLevels( 1 );
2057 // --> OD 2006-06-29 #6440955#
2058 aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2059 // <--
2060 aFmt.SetBulletChar( cBulletChar );
2062 static const USHORT aAbsSpace[ MAXLEVEL ] =
2064 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2065 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2067 #ifdef USE_MEASUREMENT
2068 static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
2070 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2072 const USHORT* pArr = MEASURE_METRIC ==
2073 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2074 ? aAbsSpace
2075 : aAbsSpaceInch;
2076 #else
2077 const USHORT* pArr = aAbsSpace;
2078 #endif
2080 // --> OD 2008-02-11 #newlistlevelattrs#
2081 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2083 aFmt.SetFirstLineOffset( - (*pArr) );
2085 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2087 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2088 aFmt.SetFirstLineIndent( - (*pArr) );
2090 // <--
2091 for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2093 // --> OD 2008-02-11 #newlistlevelattrs#
2094 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2096 aFmt.SetAbsLSpace( *pArr );
2098 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2100 aFmt.SetListtabPos( *pArr );
2101 aFmt.SetIndentAt( *pArr );
2103 // <--
2104 pNewRule->Set( n, aFmt );
2107 break;
2108 case RES_POOLNUMRULE_BUL2:
2110 SwNumFmt aFmt;
2111 // --> OD 2008-02-11 #newlistlevelattrs#
2112 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2113 // <--
2114 aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2115 aFmt.SetCharFmt( pBullCFmt );
2116 aFmt.SetStart( 1 );
2117 aFmt.SetIncludeUpperLevels( 1 );
2118 // --> OD 2006-06-29 #6440955#
2119 aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2120 // <--
2121 aFmt.SetBulletChar( 0x2013 );
2123 static const USHORT aAbsSpace[ MAXLEVEL ] =
2125 // cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0
2126 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2128 #ifdef USE_MEASUREMENT
2129 static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
2131 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2133 const USHORT* pArr = MEASURE_METRIC ==
2134 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2135 ? aAbsSpace
2136 : aAbsSpaceInch;
2137 #else
2138 const USHORT* pArr = aAbsSpace;
2139 #endif
2141 // --> OD 2008-02-11 #newlistlevelattrs#
2142 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2144 aFmt.SetFirstLineOffset( - (*pArr) );
2146 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2148 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2149 aFmt.SetFirstLineIndent( - (*pArr) );
2151 // <--
2152 for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2154 // --> OD 2008-02-11 #newlistlevelattrs#
2155 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2157 aFmt.SetAbsLSpace( *pArr );
2159 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2161 aFmt.SetListtabPos( *pArr );
2162 aFmt.SetIndentAt( *pArr );
2164 // <--
2165 pNewRule->Set( n, aFmt );
2168 break;
2169 case RES_POOLNUMRULE_BUL3:
2171 SwNumFmt aFmt;
2172 // --> OD 2008-02-11 #newlistlevelattrs#
2173 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2174 // <--
2175 aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2176 aFmt.SetCharFmt( pBullCFmt );
2177 aFmt.SetStart( 1 );
2178 aFmt.SetIncludeUpperLevels( 1 );
2179 // --> OD 2006-06-29 #6440955#
2180 aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2181 // <--
2183 USHORT nOffs = GetMetricVal( CM_01 ) * 4;
2184 // --> OD 2008-02-11 #newlistlevelattrs#
2185 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2187 aFmt.SetFirstLineOffset( - nOffs );
2189 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2191 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2192 aFmt.SetFirstLineIndent( - nOffs );
2194 // <--
2196 for( n = 0; n < MAXLEVEL; ++n )
2198 aFmt.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) );
2199 // --> OD 2008-02-11 #newlistlevelattrs#
2200 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2202 aFmt.SetAbsLSpace( ((n & 1) +1) * nOffs );
2204 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2206 aFmt.SetListtabPos( ((n & 1) +1) * nOffs );
2207 aFmt.SetIndentAt( ((n & 1) +1) * nOffs );
2209 // <--
2210 pNewRule->Set( n, aFmt );
2213 break;
2214 case RES_POOLNUMRULE_BUL4:
2216 SwNumFmt aFmt;
2217 // --> OD 2008-02-11 #newlistlevelattrs#
2218 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2219 // <--
2220 aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2221 aFmt.SetCharFmt( pBullCFmt );
2222 aFmt.SetStart( 1 );
2223 aFmt.SetIncludeUpperLevels( 1 );
2224 // --> OD 2006-06-29 #6440955#
2225 aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2226 // <--
2228 static const USHORT aAbsSpace[ MAXLEVEL ] =
2230 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2231 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2233 #ifdef USE_MEASUREMENT
2234 static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
2236 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2238 const USHORT* pArr = MEASURE_METRIC ==
2239 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2240 ? aAbsSpace
2241 : aAbsSpaceInch;
2242 #else
2243 const USHORT* pArr = aAbsSpace;
2244 #endif
2246 // --> OD 2008-02-11 #newlistlevelattrs#
2247 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2249 aFmt.SetFirstLineOffset( - (*pArr) );
2251 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2253 aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE );
2254 aFmt.SetFirstLineIndent( - (*pArr) );
2256 // <--
2257 for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2259 switch( n )
2261 case 0: aFmt.SetBulletChar( 0x27a2 ); break;
2262 case 1: aFmt.SetBulletChar( 0xE006 ); break;
2263 default: aFmt.SetBulletChar( 0xE004 ); break;
2265 // --> OD 2008-02-11 #newlistlevelattrs#
2266 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2268 aFmt.SetAbsLSpace( *pArr );
2270 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2272 aFmt.SetListtabPos( *pArr );
2273 aFmt.SetIndentAt( *pArr );
2275 // <--
2276 pNewRule->Set( n, aFmt );
2279 break;
2280 case RES_POOLNUMRULE_BUL5:
2282 SwNumFmt aFmt;
2283 // --> OD 2008-02-11 #newlistlevelattrs#
2284 aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2285 // <--
2286 aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
2287 aFmt.SetCharFmt( pBullCFmt );
2288 aFmt.SetStart( 1 );
2289 aFmt.SetIncludeUpperLevels( 1 );
2290 aFmt.SetBulletChar( 0x2717 );
2291 // --> OD 2006-06-29 #6440955#
2292 aFmt.SetBulletFont( &numfunc::GetDefBulletFont() );
2293 // <--
2295 static const USHORT aAbsSpace[ MAXLEVEL ] =
2297 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2298 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2300 #ifdef USE_MEASUREMENT
2301 static const USHORT aAbsSpaceInch[ MAXLEVEL ] =
2303 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2305 const USHORT* pArr = MEASURE_METRIC ==
2306 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2307 ? aAbsSpace
2308 : aAbsSpaceInch;
2309 #else
2310 const USHORT* pArr = aAbsSpace;
2311 #endif
2313 // --> OD 2008-02-11 #newlistlevelattrs#
2314 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2316 aFmt.SetFirstLineOffset( - (*pArr) );
2318 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2320 aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
2321 aFmt.SetFirstLineIndent( - (*pArr) );
2323 // <--
2324 for( n = 0; n < MAXLEVEL; ++n, ++pArr )
2326 // --> OD 2008-02-11 #newlistlevelattrs#
2327 if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2329 aFmt.SetAbsLSpace( *pArr );
2331 else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2333 aFmt.SetListtabPos( *pArr );
2334 aFmt.SetIndentAt( *pArr );
2336 // <--
2337 pNewRule->Set( n, aFmt );
2340 break;
2343 return pNewRule;
2348 // pruefe, ob diese "Auto-Collection" in Dokument schon/noch
2349 // benutzt wird
2350 bool SwDoc::IsPoolPageDescUsed( USHORT nId ) const
2352 ASSERT( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
2353 "Falsche AutoFormat-Id" );
2354 SwPageDesc *pNewPgDsc = 0;
2355 BOOL bFnd = FALSE;
2356 for( USHORT n = 0; !bFnd && n < aPageDescs.Count(); ++n )
2358 pNewPgDsc = aPageDescs[ n ];
2359 if( nId == pNewPgDsc->GetPoolFmtId() )
2360 bFnd = TRUE;
2363 // nicht gefunden oder keine Abhaengigen ?
2364 if( !bFnd || !pNewPgDsc->GetDepends() ) // ??????
2365 return FALSE;
2367 // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2368 // (auch indirekte fuer Format-Ableitung! )
2369 SwAutoFmtGetDocNode aGetHt( &aNodes );
2370 return !pNewPgDsc->GetInfo( aGetHt );
2373 // erfrage ob die Absatz-/Zeichen-/Rahmen-/Seiten - Vorlage benutzt wird
2374 sal_Bool SwDoc::IsUsed( const SwModify& rModify ) const
2376 // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2377 // (auch indirekte fuer Format-Ableitung! )
2378 SwAutoFmtGetDocNode aGetHt( &aNodes );
2379 return !rModify.GetInfo( aGetHt );
2382 // erfrage ob die NumRule benutzt wird
2383 sal_Bool SwDoc::IsUsed( const SwNumRule& rRule ) const
2385 // --> OD 2008-03-04 #refactorlists#
2386 // // dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
2387 // // (auch indirekte fuer Format-Ableitung! )
2388 // sal_Bool bUsed = FALSE;
2389 // SwAutoFmtGetDocNode aGetHt( &aNodes );
2390 // SwModify* pMod;
2391 // const SfxPoolItem* pItem;
2392 // USHORT i, nMaxItems = GetAttrPool().GetItemCount( RES_PARATR_NUMRULE);
2393 // for( i = 0; i < nMaxItems; ++i )
2394 // {
2395 // if( 0 != (pItem = GetAttrPool().GetItem( RES_PARATR_NUMRULE, i ) ) &&
2396 // 0 != ( pMod = (SwModify*)((SwNumRuleItem*)pItem)->GetDefinedIn()) &&
2397 // ((SwNumRuleItem*)pItem)->GetValue().Len() &&
2398 // ((SwNumRuleItem*)pItem)->GetValue() == rRule.GetName() )
2399 // {
2400 // if( pMod->IsA( TYPE( SwFmt )) )
2401 // {
2402 // bUsed = !pMod->GetInfo( aGetHt );
2403 // if( bUsed )
2404 // break;
2405 // }
2406 // else if( ((SwTxtNode*)pMod)->GetNodes().IsDocNodes() )
2407 // {
2408 // bUsed = TRUE;
2409 // break;
2410 // }
2411 // }
2412 // }
2414 // return bUsed;
2415 sal_Bool bUsed = rRule.GetTxtNodeListSize() > 0 ||
2416 rRule.GetParagraphStyleListSize() > 0;
2418 return bUsed;
2419 // <--
2422 // Suche die Position vom Vorlagen-Namen. Ist nicht vorhanden
2423 // dann fuege neu ein
2424 USHORT SwDoc::SetDocPattern( const String& rPatternName )
2426 ASSERT( rPatternName.Len(), "kein Dokument-Vorlagenname" );
2428 USHORT nNewPos = aPatternNms.Count();
2429 for( USHORT n = 0; n < aPatternNms.Count(); ++n )
2430 if( !aPatternNms[n] )
2432 if( nNewPos == aPatternNms.Count() )
2433 nNewPos = n;
2435 else if( rPatternName == *aPatternNms[n] )
2436 return n;
2438 if( nNewPos < aPatternNms.Count() )
2439 aPatternNms.Remove( nNewPos ); // Platz wieder frei machen
2441 String* pNewNm = new String( rPatternName );
2442 aPatternNms.Insert( pNewNm, nNewPos );
2443 SetModified();
2444 return nNewPos;
2447 USHORT GetPoolParent( USHORT nId )
2449 USHORT nRet = USHRT_MAX;
2450 if( POOLGRP_NOCOLLID & nId ) // 1 == Formate / 0 == Collections
2452 switch( ( COLL_GET_RANGE_BITS | POOLGRP_NOCOLLID ) & nId )
2454 case POOLGRP_CHARFMT:
2455 case POOLGRP_FRAMEFMT:
2456 nRet = 0; // vom default abgeleitet
2457 break;
2458 case POOLGRP_PAGEDESC:
2459 case POOLGRP_NUMRULE:
2460 break; // es gibt keine Ableitung
2463 else
2465 switch( COLL_GET_RANGE_BITS & nId )
2467 case COLL_TEXT_BITS:
2468 switch( nId )
2470 case RES_POOLCOLL_STANDARD:
2471 nRet = 0; break;
2472 case RES_POOLCOLL_TEXT_IDENT:
2473 case RES_POOLCOLL_TEXT_NEGIDENT:
2474 case RES_POOLCOLL_TEXT_MOVE:
2475 case RES_POOLCOLL_CONFRONTATION:
2476 case RES_POOLCOLL_MARGINAL:
2477 nRet = RES_POOLCOLL_TEXT; break;
2479 case RES_POOLCOLL_TEXT:
2480 case RES_POOLCOLL_GREETING:
2481 case RES_POOLCOLL_SIGNATURE:
2482 case RES_POOLCOLL_HEADLINE_BASE:
2483 nRet = RES_POOLCOLL_STANDARD; break;
2485 case RES_POOLCOLL_HEADLINE1:
2486 case RES_POOLCOLL_HEADLINE2:
2487 case RES_POOLCOLL_HEADLINE3:
2488 case RES_POOLCOLL_HEADLINE4:
2489 case RES_POOLCOLL_HEADLINE5:
2490 case RES_POOLCOLL_HEADLINE6:
2491 case RES_POOLCOLL_HEADLINE7:
2492 case RES_POOLCOLL_HEADLINE8:
2493 case RES_POOLCOLL_HEADLINE9:
2494 case RES_POOLCOLL_HEADLINE10:
2495 nRet = RES_POOLCOLL_HEADLINE_BASE; break;
2497 break;
2499 case COLL_LISTS_BITS:
2500 switch( nId )
2502 case RES_POOLCOLL_NUMBUL_BASE:
2503 nRet = RES_POOLCOLL_TEXT; break;
2505 default:
2506 nRet = RES_POOLCOLL_NUMBUL_BASE; break;
2508 break;
2510 case COLL_EXTRA_BITS:
2511 switch( nId )
2513 case RES_POOLCOLL_FRAME:
2514 nRet = RES_POOLCOLL_TEXT; break;
2516 case RES_POOLCOLL_TABLE_HDLN:
2517 nRet = RES_POOLCOLL_TABLE; break;
2519 case RES_POOLCOLL_TABLE:
2520 case RES_POOLCOLL_FOOTNOTE:
2521 case RES_POOLCOLL_ENDNOTE:
2522 case RES_POOLCOLL_JAKETADRESS:
2523 case RES_POOLCOLL_SENDADRESS:
2524 case RES_POOLCOLL_HEADER:
2525 case RES_POOLCOLL_HEADERL:
2526 case RES_POOLCOLL_HEADERR:
2527 case RES_POOLCOLL_FOOTER:
2528 case RES_POOLCOLL_FOOTERL:
2529 case RES_POOLCOLL_FOOTERR:
2530 case RES_POOLCOLL_LABEL:
2531 nRet = RES_POOLCOLL_STANDARD; break;
2533 case RES_POOLCOLL_LABEL_ABB:
2534 case RES_POOLCOLL_LABEL_TABLE:
2535 case RES_POOLCOLL_LABEL_FRAME:
2536 case RES_POOLCOLL_LABEL_DRAWING:
2537 nRet = RES_POOLCOLL_LABEL; break;
2539 break;
2541 case COLL_REGISTER_BITS:
2542 switch( nId )
2544 case RES_POOLCOLL_REGISTER_BASE:
2545 nRet = RES_POOLCOLL_STANDARD; break;
2547 case RES_POOLCOLL_TOX_USERH:
2548 case RES_POOLCOLL_TOX_CNTNTH:
2549 case RES_POOLCOLL_TOX_IDXH:
2550 case RES_POOLCOLL_TOX_ILLUSH:
2551 case RES_POOLCOLL_TOX_OBJECTH:
2552 case RES_POOLCOLL_TOX_TABLESH:
2553 case RES_POOLCOLL_TOX_AUTHORITIESH:
2554 nRet = RES_POOLCOLL_HEADLINE_BASE; break;
2556 default:
2557 nRet = RES_POOLCOLL_REGISTER_BASE; break;
2559 break;
2561 case COLL_DOC_BITS:
2562 nRet = RES_POOLCOLL_HEADLINE_BASE;
2563 break;
2565 case COLL_HTML_BITS:
2566 nRet = RES_POOLCOLL_STANDARD;
2567 break;
2571 return nRet;
2574 void SwDoc::RemoveAllFmtLanguageDependencies()
2576 /* #106748# Restore the language independ pool defaults and styles. */
2577 GetAttrPool().ResetPoolDefaultItem( RES_PARATR_ADJUST );
2579 SwTxtFmtColl * pTxtFmtColl = GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
2581 pTxtFmtColl->ResetFmtAttr( RES_PARATR_ADJUST );
2582 /* #111214# koreans do not like SvxScriptItem(TRUE) */
2583 pTxtFmtColl->ResetFmtAttr( RES_PARATR_SCRIPTSPACE );
2585 SvxFrameDirectionItem aFrameDir( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR );
2587 sal_uInt16 nCount = GetPageDescCnt();
2588 for( sal_uInt16 i=0; i<nCount; ++i )
2590 SwPageDesc& rDesc = _GetPageDesc( i );
2591 rDesc.GetMaster().SetFmtAttr( aFrameDir );
2592 rDesc.GetLeft().SetFmtAttr( aFrameDir );
2595 // OD 09.10.2003 #i18732# - restore static pool default for item
2596 // RES_FOLLOW_TEXT_FLOW.
2597 GetAttrPool().ResetPoolDefaultItem( RES_FOLLOW_TEXT_FLOW );
2599 //#i16874# AutoKerning as default for new documents
2600 GetAttrPool().ResetPoolDefaultItem( RES_CHRATR_AUTOKERN );