1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <hintids.hxx>
22 #include <i18nlangtag/mslangid.hxx>
23 #include <unotools/localedatawrapper.hxx>
24 #include <editeng/paperinf.hxx>
25 #include <editeng/wghtitem.hxx>
26 #include <editeng/fontitem.hxx>
27 #include <editeng/fhgtitem.hxx>
28 #include <editeng/tstpitem.hxx>
29 #include <editeng/lrspitem.hxx>
30 #include <editeng/ulspitem.hxx>
31 #include <editeng/adjustitem.hxx>
32 #include <editeng/postitem.hxx>
33 #include <editeng/keepitem.hxx>
34 #include <editeng/opaqitem.hxx>
35 #include <editeng/boxitem.hxx>
36 #include <editeng/cmapitem.hxx>
37 #include <editeng/udlnitem.hxx>
38 #include <editeng/colritem.hxx>
39 #include <editeng/protitem.hxx>
40 #include <editeng/escapementitem.hxx>
41 #include <editeng/langitem.hxx>
42 #include <editeng/charrotateitem.hxx>
43 #include <editeng/frmdiritem.hxx>
44 #include <editeng/emphasismarkitem.hxx>
45 #include <editeng/scriptspaceitem.hxx>
46 #include <viewopt.hxx>
48 #include <IDocumentUndoRedo.hxx>
49 #include <fmtanchr.hxx>
50 #include <fmtornt.hxx>
51 #include <fmtsrnd.hxx>
52 #include <fmtfsize.hxx>
53 #include <poolfmt.hxx>
55 #include <pagedesc.hxx>
56 #include <frmtool.hxx>
57 #include <charfmt.hxx>
61 #include <fmtline.hxx>
62 #include <poolfmt.hrc>
63 #include <GetMetricVal.hxx>
64 #include <numrule.hxx>
67 using namespace ::editeng
;
68 using namespace ::com::sun::star
;
70 const sal_uInt16 PT_3
= 3 * 20; // 3 pt
71 const sal_uInt16 PT_6
= 6 * 20; // 6 pt
72 const sal_uInt16 PT_7
= 7 * 20; // 6 pt
73 const sal_uInt16 PT_8
= 8 * 20; // 8 pt
74 const sal_uInt16 PT_9
= 9 * 20; // 9 pt
75 const sal_uInt16 PT_10
= 10 * 20; // 10 pt
76 const sal_uInt16 PT_11
= 11 * 20; // 11 pt
77 const sal_uInt16 PT_12
= 12 * 20; // 12 pt
78 const sal_uInt16 PT_14
= 14 * 20; // 14 pt
79 const sal_uInt16 PT_16
= 16 * 20; // 16 pt
80 const sal_uInt16 PT_18
= 18 * 20; // 18 pt
81 const sal_uInt16 PT_22
= 22 * 20; // 22 pt
82 const sal_uInt16 PT_24
= 24 * 20; // 22 pt
85 #define HTML_PARSPACE GetMetricVal( CM_05 )
87 static const sal_uInt16 aHeadlineSizes
[ 2 * MAXLEVEL
] = {
88 // PT_16, PT_14, PT_14, PT_12, PT_12, // normal
89 // we do everything procentual now:
90 115, 100, 100, 85, 85,
91 75, 75, 75, 75, 75, // normal
92 // PT_22, PT_16, PT_12, PT_11, PT_9 // HTML mode
93 PT_24
, PT_18
, PT_14
, PT_12
, PT_10
,
94 PT_7
, PT_7
, PT_7
, PT_7
, PT_7
// HTML mode
97 static long lcl_GetRightMargin( SwDoc
& rDoc
)
99 // Make sure that the printer settings are taken over to the standard
101 const SwFrmFmt
& rPgDscFmt
= rDoc
.GetPageDesc( 0 ).GetMaster();
102 const SvxLRSpaceItem
& rLR
= rPgDscFmt
.GetLRSpace();
103 const long nLeft
= rLR
.GetLeft();
104 const long nRight
= rLR
.GetRight();
105 const long nWidth
= rPgDscFmt
.GetFrmSize().GetWidth();
106 return nWidth
- nLeft
- nRight
;
109 void SetAllScriptItem( SfxItemSet
& rSet
, const SfxPoolItem
& rItem
)
112 sal_uInt16 nWhCJK
= 0, nWhCTL
= 0;
113 switch( rItem
.Which() )
115 case RES_CHRATR_FONTSIZE
:
116 nWhCJK
= RES_CHRATR_CJK_FONTSIZE
, nWhCTL
= RES_CHRATR_CTL_FONTSIZE
;
118 case RES_CHRATR_FONT
:
119 nWhCJK
= RES_CHRATR_CJK_FONT
, nWhCTL
= RES_CHRATR_CTL_FONT
;
121 case RES_CHRATR_LANGUAGE
:
122 nWhCJK
= RES_CHRATR_CJK_LANGUAGE
, nWhCTL
= RES_CHRATR_CTL_LANGUAGE
;
124 case RES_CHRATR_POSTURE
:
125 nWhCJK
= RES_CHRATR_CJK_POSTURE
, nWhCTL
= RES_CHRATR_CTL_POSTURE
;
127 case RES_CHRATR_WEIGHT
:
128 nWhCJK
= RES_CHRATR_CJK_WEIGHT
, nWhCTL
= RES_CHRATR_CTL_WEIGHT
;
133 rSet
.Put( rItem
, nWhCJK
);
135 rSet
.Put( rItem
, nWhCTL
);
138 static void lcl_SetDfltFont( sal_uInt16 nFntType
, SfxItemSet
& rSet
)
141 sal_uInt16 nResLngId
;
142 sal_uInt16 nResFntId
;
144 { RES_CHRATR_LANGUAGE
, RES_CHRATR_FONT
},
145 { RES_CHRATR_CJK_LANGUAGE
, RES_CHRATR_CJK_FONT
},
146 { RES_CHRATR_CTL_LANGUAGE
, RES_CHRATR_CTL_FONT
}
148 for( sal_uInt16 n
= 0; n
< 3; ++n
)
150 sal_uInt16 nLng
= ((SvxLanguageItem
&)rSet
.GetPool()->GetDefaultItem(
151 aArr
[n
].nResLngId
)).GetLanguage();
152 Font
aFnt( OutputDevice::GetDefaultFont( nFntType
,
153 nLng
, DEFAULTFONT_FLAGS_ONLYONE
) );
155 rSet
.Put( SvxFontItem( aFnt
.GetFamily(), aFnt
.GetName(),
156 aEmptyStr
, aFnt
.GetPitch(),
157 aFnt
.GetCharSet(), aArr
[n
].nResFntId
));
161 static void lcl_SetDfltFont( sal_uInt16 nLatinFntType
, sal_uInt16 nCJKFntType
,
162 sal_uInt16 nCTLFntType
, SfxItemSet
& rSet
)
165 sal_uInt16 nResLngId
;
166 sal_uInt16 nResFntId
;
169 { RES_CHRATR_LANGUAGE
, RES_CHRATR_FONT
, 0 },
170 { RES_CHRATR_CJK_LANGUAGE
, RES_CHRATR_CJK_FONT
, 0 },
171 { RES_CHRATR_CTL_LANGUAGE
, RES_CHRATR_CTL_FONT
, 0 }
173 aArr
[0].nFntType
= nLatinFntType
;
174 aArr
[1].nFntType
= nCJKFntType
;
175 aArr
[2].nFntType
= nCTLFntType
;
177 for( sal_uInt16 n
= 0; n
< 3; ++n
)
179 sal_uInt16 nLng
= ((SvxLanguageItem
&)rSet
.GetPool()->GetDefaultItem(
180 aArr
[n
].nResLngId
)).GetLanguage();
181 Font
aFnt( OutputDevice::GetDefaultFont( aArr
[n
].nFntType
,
182 nLng
, DEFAULTFONT_FLAGS_ONLYONE
) );
184 rSet
.Put( SvxFontItem( aFnt
.GetFamily(), aFnt
.GetName(),
185 aEmptyStr
, aFnt
.GetPitch(),
186 aFnt
.GetCharSet(), aArr
[n
].nResFntId
));
190 static void lcl_SetHeadline( SwDoc
* pDoc
, SwTxtFmtColl
* pColl
,
192 sal_uInt16 nOutLvlBits
, sal_uInt8 nLevel
, bool bItalic
)
194 SetAllScriptItem( rSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
195 SvxFontHeightItem
aHItem(240, 100, RES_CHRATR_FONTSIZE
);
196 const bool bHTMLMode
= pDoc
->get(IDocumentSettingAccess::HTML_MODE
);
198 aHItem
.SetHeight( aHeadlineSizes
[ MAXLEVEL
+ nLevel
] );
200 aHItem
.SetHeight( PT_14
, aHeadlineSizes
[ nLevel
] );
201 SetAllScriptItem( rSet
, aHItem
);
203 if( bItalic
&& !bHTMLMode
)
204 SetAllScriptItem( rSet
, SvxPostureItem( ITALIC_NORMAL
, RES_CHRATR_POSTURE
) );
208 ::lcl_SetDfltFont( DEFAULTFONT_LATIN_TEXT
, DEFAULTFONT_CJK_TEXT
,
209 DEFAULTFONT_CTL_TEXT
, rSet
);
214 if( !( nOutLvlBits
& ( 1 << nLevel
)) )
216 pColl
->AssignToListLevelOfOutlineStyle(nLevel
);//<-end,zhaojianwei
219 SwNumRule
* pOutlineRule
= pDoc
->GetOutlineNumRule();
220 const SwNumFmt
& rNFmt
= pOutlineRule
->Get( nLevel
);
222 if ( rNFmt
.GetPositionAndSpaceMode() ==
223 SvxNumberFormat::LABEL_WIDTH_AND_POSITION
&&
224 ( rNFmt
.GetAbsLSpace() || rNFmt
.GetFirstLineOffset() ) )
226 SvxLRSpaceItem
aLR( (SvxLRSpaceItem
&)pColl
->GetFmtAttr( RES_LR_SPACE
) );
227 aLR
.SetTxtFirstLineOfstValue( rNFmt
.GetFirstLineOffset() );
228 aLR
.SetTxtLeft( rNFmt
.GetAbsLSpace() );
229 pColl
->SetFmtAttr( aLR
);
233 // Check on document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE no longer needed.
234 // All paragraph styles, which are assigned to a level of the
235 // outline style has to have the outline style set as its list style.
237 SwNumRuleItem
aItem(pOutlineRule
->GetName());
239 pColl
->SetFmtAttr(aItem
);
243 pColl
->SetNextTxtFmtColl( *pDoc
->GetTxtCollFromPool(
244 RES_POOLCOLL_TEXT
));
250 static void lcl_SetRegister( SwDoc
* pDoc
, SfxItemSet
& rSet
, sal_uInt16 nFact
,
251 bool bHeader
, bool bTab
)
253 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
254 sal_uInt16 nLeft
= nFact
? GetMetricVal( CM_05
) * nFact
: 0;
255 aLR
.SetTxtLeft( nLeft
);
260 SetAllScriptItem( rSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
261 SetAllScriptItem( rSet
, SvxFontHeightItem( PT_16
, 100, RES_CHRATR_FONTSIZE
) );
265 long nRightMargin
= lcl_GetRightMargin( *pDoc
);
266 SvxTabStopItem
aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT
, RES_PARATR_TABSTOP
);
267 aTStops
.Insert( SvxTabStop( nRightMargin
- nLeft
,
268 SVX_TAB_ADJUST_RIGHT
,
269 cDfltDecimalChar
, '.' ));
276 static void lcl_SetNumBul( SwDoc
* pDoc
, SwTxtFmtColl
* pColl
,
278 sal_uInt16 nNxt
, SwTwips nEZ
, SwTwips nLeft
,
279 SwTwips nUpper
, SwTwips nLower
)
282 SvxLRSpaceItem
aLR( RES_LR_SPACE
); SvxULSpaceItem
aUL( RES_UL_SPACE
);
283 aLR
.SetTxtFirstLineOfst( sal_uInt16(nEZ
) ); aLR
.SetTxtLeft( sal_uInt16(nLeft
) );
284 aUL
.SetUpper( sal_uInt16(nUpper
) ); aUL
.SetLower( sal_uInt16(nLower
) );
289 pColl
->SetNextTxtFmtColl( *pDoc
->GetTxtCollFromPool( nNxt
));
292 /// Return the AutoCollection by it's Id. If it doesn't
293 /// exist yet, create it.
294 /// If the String pointer is defined, then only query for
295 /// the Attribute descriptions. It doesn't create a style!
296 SvxFrameDirection
GetDefaultFrameDirection(sal_uLong nLanguage
)
298 SvxFrameDirection eResult
= (MsLangId::isRightToLeft( static_cast<LanguageType
>(nLanguage
)) ?
299 FRMDIR_HORI_RIGHT_TOP
: FRMDIR_HORI_LEFT_TOP
);
303 SwTxtFmtColl
* SwDoc::GetTxtCollFromPool( sal_uInt16 nId
, bool bRegardLanguage
)
306 (RES_POOLCOLL_TEXT_BEGIN
<= nId
&& nId
< RES_POOLCOLL_TEXT_END
) ||
307 (RES_POOLCOLL_LISTS_BEGIN
<= nId
&& nId
< RES_POOLCOLL_LISTS_END
) ||
308 (RES_POOLCOLL_EXTRA_BEGIN
<= nId
&& nId
< RES_POOLCOLL_EXTRA_END
) ||
309 (RES_POOLCOLL_REGISTER_BEGIN
<= nId
&& nId
< RES_POOLCOLL_REGISTER_END
) ||
310 (RES_POOLCOLL_DOC_BEGIN
<= nId
&& nId
< RES_POOLCOLL_DOC_END
) ||
311 (RES_POOLCOLL_HTML_BEGIN
<= nId
&& nId
< RES_POOLCOLL_HTML_END
),
312 "Wrong AutoFormat Id" );
314 SwTxtFmtColl
* pNewColl
;
315 sal_uInt16 nOutLvlBits
= 0;
316 for( sal_uInt16 n
= 0; n
< mpTxtFmtCollTbl
->size(); ++n
)
318 if( nId
== ( pNewColl
= (*mpTxtFmtCollTbl
)[ n
] )->GetPoolFmtId() )
323 if( pNewColl
->IsAssignedToListLevelOfOutlineStyle())
324 nOutLvlBits
|= ( 1 << pNewColl
->GetAssignedOutlineStyleLevel() );//<-end,zhaojianwei
327 // Didn't find it until here -> create anew
328 sal_uInt16 nResId
= 0;
329 if( RES_POOLCOLL_TEXT_BEGIN
<= nId
&& nId
< RES_POOLCOLL_TEXT_END
)
330 nResId
= RC_POOLCOLL_TEXT_BEGIN
- RES_POOLCOLL_TEXT_BEGIN
;
331 else if (RES_POOLCOLL_LISTS_BEGIN
<= nId
&& nId
< RES_POOLCOLL_LISTS_END
)
332 nResId
= RC_POOLCOLL_LISTS_BEGIN
- RES_POOLCOLL_LISTS_BEGIN
;
333 else if (RES_POOLCOLL_EXTRA_BEGIN
<= nId
&& nId
< RES_POOLCOLL_EXTRA_END
)
334 nResId
= RC_POOLCOLL_EXTRA_BEGIN
- RES_POOLCOLL_EXTRA_BEGIN
;
335 else if (RES_POOLCOLL_REGISTER_BEGIN
<= nId
&& nId
< RES_POOLCOLL_REGISTER_END
)
336 nResId
= RC_POOLCOLL_REGISTER_BEGIN
- RES_POOLCOLL_REGISTER_BEGIN
;
337 else if (RES_POOLCOLL_DOC_BEGIN
<= nId
&& nId
< RES_POOLCOLL_DOC_END
)
338 nResId
= RC_POOLCOLL_DOC_BEGIN
- RES_POOLCOLL_DOC_BEGIN
;
339 else if (RES_POOLCOLL_HTML_BEGIN
<= nId
&& nId
< RES_POOLCOLL_HTML_END
)
340 nResId
= RC_POOLCOLL_HTML_BEGIN
- RES_POOLCOLL_HTML_BEGIN
;
342 OSL_ENSURE( nResId
, "Invalid Pool ID" );
344 return GetTxtCollFromPool( RES_POOLCOLL_STANDARD
);
346 ResId
aResId( nResId
+ nId
, *pSwResMgr
);
347 String
aNm( aResId
);
349 // A Set for all to-be-set Attributes
350 SwAttrSet
aSet( GetAttrPool(), aTxtFmtCollSetRange
);
351 sal_uInt16 nParent
= GetPoolParent( nId
);
356 if(::IsConditionalByPoolId( nId
))
357 pNewColl
= new SwConditionTxtFmtColl( GetAttrPool(), aNm
, !nParent
359 : GetTxtCollFromPool( nParent
));
362 pNewColl
= new SwTxtFmtColl( GetAttrPool(), aNm
, !nParent
364 : GetTxtCollFromPool( nParent
));
365 pNewColl
->SetPoolFmtId( nId
);
366 mpTxtFmtCollTbl
->push_back( pNewColl
);
369 bool bNoDefault
= get( IDocumentSettingAccess::STYLES_NODEFAULT
);
374 // General content forms
375 case RES_POOLCOLL_STANDARD
:
376 /* koreans do not like SvxScriptItem(TRUE) */
379 sal_uLong nAppLanguage
= GetAppLanguage();
380 if (GetDefaultFrameDirection(nAppLanguage
) ==
381 FRMDIR_HORI_RIGHT_TOP
)
383 SvxAdjustItem
aAdjust(SVX_ADJUST_RIGHT
, RES_PARATR_ADJUST
);
386 if (nAppLanguage
== LANGUAGE_KOREAN
)
388 SvxScriptSpaceItem
aScriptSpace(sal_False
, RES_PARATR_SCRIPTSPACE
);
389 aSet
.Put(aScriptSpace
);
394 case RES_POOLCOLL_TEXT
: // Text body
396 SvxULSpaceItem
aUL( 0, PT_6
, RES_UL_SPACE
);
397 if( get(IDocumentSettingAccess::HTML_MODE
) ) aUL
.SetLower( HTML_PARSPACE
);
401 case RES_POOLCOLL_TEXT_IDENT
: // Text body indentation
403 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
404 aLR
.SetTxtFirstLineOfst( GetMetricVal( CM_05
));
408 case RES_POOLCOLL_TEXT_NEGIDENT
: // Text body neg. indentation
410 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
411 aLR
.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05
));
412 aLR
.SetTxtLeft( GetMetricVal( CM_1
));
413 SvxTabStopItem
aTStops(RES_PARATR_TABSTOP
); aTStops
.Insert( SvxTabStop( 0 ));
419 case RES_POOLCOLL_TEXT_MOVE
: // Text body move
421 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
422 aLR
.SetTxtLeft( GetMetricVal( CM_05
));
427 case RES_POOLCOLL_CONFRONTATION
: // Text body confrontation
429 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
430 aLR
.SetTxtFirstLineOfst( - short( GetMetricVal( CM_1
) * 4 +
431 GetMetricVal( CM_05
)) );
432 aLR
.SetTxtLeft( GetMetricVal( CM_1
) * 5 );
433 SvxTabStopItem
aTStops( RES_PARATR_TABSTOP
); aTStops
.Insert( SvxTabStop( 0 ));
439 case RES_POOLCOLL_MARGINAL
: // Text body marginal
441 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
442 aLR
.SetTxtLeft( GetMetricVal( CM_1
) * 4 );
447 case RES_POOLCOLL_HEADLINE_BASE
: // Base headline
449 static const sal_uInt16 aFntInit
[] = {
450 DEFAULTFONT_LATIN_HEADING
, RES_CHRATR_FONT
,
451 RES_CHRATR_LANGUAGE
, LANGUAGE_ENGLISH_US
,
452 DEFAULTFONT_CJK_HEADING
, RES_CHRATR_CJK_FONT
,
453 RES_CHRATR_CJK_LANGUAGE
, LANGUAGE_ENGLISH_US
,
454 DEFAULTFONT_CTL_HEADING
, RES_CHRATR_CTL_FONT
,
455 RES_CHRATR_CTL_LANGUAGE
, LANGUAGE_ARABIC_SAUDI_ARABIA
,
459 for( const sal_uInt16
* pArr
= aFntInit
; *pArr
; pArr
+= 4 )
461 sal_uInt16 nLng
= ((SvxLanguageItem
&)GetDefault( *(pArr
+2) )).GetLanguage();
462 if( LANGUAGE_DONTKNOW
== nLng
)
465 Font
aFnt( OutputDevice::GetDefaultFont( *pArr
,
466 nLng
, DEFAULTFONT_FLAGS_ONLYONE
) );
468 aSet
.Put( SvxFontItem( aFnt
.GetFamily(), aFnt
.GetName(),
469 aEmptyStr
, aFnt
.GetPitch(),
470 aFnt
.GetCharSet(), *(pArr
+1) ));
473 SvxFontHeightItem
aFntSize( PT_14
, 100, RES_CHRATR_FONTSIZE
);
474 SvxULSpaceItem
aUL( PT_12
, PT_6
, RES_UL_SPACE
);
475 if( get(IDocumentSettingAccess::HTML_MODE
) )
476 aUL
.SetLower( HTML_PARSPACE
);
477 aSet
.Put( SvxFmtKeepItem( sal_True
, RES_KEEP
));
479 pNewColl
->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT
));
482 SetAllScriptItem( aSet
, aFntSize
);
486 case RES_POOLCOLL_NUMBUL_BASE
: // Base Numbering
489 case RES_POOLCOLL_GREETING
: // Greeting
490 case RES_POOLCOLL_REGISTER_BASE
: // Base indexes
491 case RES_POOLCOLL_SIGNATURE
: // Signatures
492 case RES_POOLCOLL_TABLE
: // Tabele content
494 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
499 case RES_POOLCOLL_HEADLINE1
: // Headinline 1
500 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 0, false );
502 case RES_POOLCOLL_HEADLINE2
: // Headinline 2
503 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 1, true );
505 case RES_POOLCOLL_HEADLINE3
: // Headinline 3
506 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 2, false );
508 case RES_POOLCOLL_HEADLINE4
: // Headinline 4
509 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 3, true );
511 case RES_POOLCOLL_HEADLINE5
: // Headinline 5
512 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 4, false );
514 case RES_POOLCOLL_HEADLINE6
: // Headinline 6
515 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 5, false );
517 case RES_POOLCOLL_HEADLINE7
: // Headinline 7
518 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 6, false );
520 case RES_POOLCOLL_HEADLINE8
: // Headinline 8
521 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 7, false );
523 case RES_POOLCOLL_HEADLINE9
: // Headinline 9
524 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 8, false );
526 case RES_POOLCOLL_HEADLINE10
: // Headinline 10
527 lcl_SetHeadline( this, pNewColl
, aSet
, nOutLvlBits
, 9, false );
533 case RES_POOLCOLL_HEADER
:
534 case RES_POOLCOLL_HEADERL
:
535 case RES_POOLCOLL_HEADERR
:
537 case RES_POOLCOLL_FOOTER
:
538 case RES_POOLCOLL_FOOTERL
:
539 case RES_POOLCOLL_FOOTERR
:
541 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
544 long nRightMargin
= lcl_GetRightMargin( *this );
546 SvxTabStopItem
aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT
, RES_PARATR_TABSTOP
);
547 aTStops
.Insert( SvxTabStop( nRightMargin
/ 2, SVX_TAB_ADJUST_CENTER
) );
548 aTStops
.Insert( SvxTabStop( nRightMargin
, SVX_TAB_ADJUST_RIGHT
) );
554 case RES_POOLCOLL_TABLE_HDLN
:
556 SetAllScriptItem( aSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
557 aSet
.Put( SvxAdjustItem( SVX_ADJUST_CENTER
, RES_PARATR_ADJUST
) );
558 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
563 case RES_POOLCOLL_FOOTNOTE
: // paragraph style Footnote
564 case RES_POOLCOLL_ENDNOTE
: // paragraph style Endnote
566 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
567 aLR
.SetTxtFirstLineOfst( -(short)( GetMetricVal( CM_05
) + GetMetricVal( CM_01
) ) );
568 aLR
.SetTxtLeft( GetMetricVal( CM_05
) + GetMetricVal( CM_01
) );
569 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_10
, 100, RES_CHRATR_FONTSIZE
) );
571 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
576 case RES_POOLCOLL_LABEL
: // basic caption
578 SvxULSpaceItem
aUL( RES_UL_SPACE
); aUL
.SetUpper( PT_6
); aUL
.SetLower( PT_6
);
580 SetAllScriptItem( aSet
, SvxPostureItem( ITALIC_NORMAL
, RES_CHRATR_POSTURE
) );
581 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_10
, 100, RES_CHRATR_FONTSIZE
) );
582 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
587 case RES_POOLCOLL_FRAME
: // Frame content
588 case RES_POOLCOLL_LABEL_ABB
: // caption image
589 case RES_POOLCOLL_LABEL_TABLE
: // caption table
590 case RES_POOLCOLL_LABEL_FRAME
: // caption frame
591 case RES_POOLCOLL_LABEL_DRAWING
: // caption drawing
594 case RES_POOLCOLL_JAKETADRESS
: // envelope address
596 SvxULSpaceItem
aUL( RES_UL_SPACE
); aUL
.SetLower( PT_3
);
598 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
603 case RES_POOLCOLL_SENDADRESS
: // Sender address
605 if( get(IDocumentSettingAccess::HTML_MODE
) )
606 SetAllScriptItem( aSet
, SvxPostureItem(ITALIC_NORMAL
, RES_CHRATR_POSTURE
) );
609 SvxULSpaceItem
aUL( RES_UL_SPACE
); aUL
.SetLower( PT_3
);
612 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
617 // User defined indexes:
618 case RES_POOLCOLL_TOX_USERH
: // Header
619 lcl_SetRegister( this, aSet
, 0, true, false );
621 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
625 case RES_POOLCOLL_TOX_USER1
: // 1. Level
626 lcl_SetRegister( this, aSet
, 0, false, true );
628 case RES_POOLCOLL_TOX_USER2
: // 2. Level
629 lcl_SetRegister( this, aSet
, 1, false, true );
631 case RES_POOLCOLL_TOX_USER3
: // 3. Level
632 lcl_SetRegister( this, aSet
, 2, false, true );
634 case RES_POOLCOLL_TOX_USER4
: // 4. Level
635 lcl_SetRegister( this, aSet
, 3, false, true );
637 case RES_POOLCOLL_TOX_USER5
: // 5. Level
638 lcl_SetRegister( this, aSet
, 4, false, true );
640 case RES_POOLCOLL_TOX_USER6
: // 6. Level
641 lcl_SetRegister( this, aSet
, 5, false, true );
643 case RES_POOLCOLL_TOX_USER7
: // 7. Level
644 lcl_SetRegister( this, aSet
, 6, false, true );
646 case RES_POOLCOLL_TOX_USER8
: // 8. Level
647 lcl_SetRegister( this, aSet
, 7, false, true );
649 case RES_POOLCOLL_TOX_USER9
: // 9. Level
650 lcl_SetRegister( this, aSet
, 8, false, true );
652 case RES_POOLCOLL_TOX_USER10
: // 10. Level
653 lcl_SetRegister( this, aSet
, 9, false, true );
657 case RES_POOLCOLL_TOX_IDXH
: // Header
658 lcl_SetRegister( this, aSet
, 0, true, false );
660 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
664 case RES_POOLCOLL_TOX_IDX1
: // 1. Level
665 lcl_SetRegister( this, aSet
, 0, false, false );
667 case RES_POOLCOLL_TOX_IDX2
: // 2. Level
668 lcl_SetRegister( this, aSet
, 1, false, false );
670 case RES_POOLCOLL_TOX_IDX3
: // 3. Level
671 lcl_SetRegister( this, aSet
, 2, false, false );
673 case RES_POOLCOLL_TOX_IDXBREAK
: // Trenner
674 lcl_SetRegister( this, aSet
, 0, false, false );
678 case RES_POOLCOLL_TOX_CNTNTH
: // Header
679 lcl_SetRegister( this, aSet
, 0, true, false );
681 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
685 case RES_POOLCOLL_TOX_CNTNT1
: // 1. Level
686 lcl_SetRegister( this, aSet
, 0, false, true );
688 case RES_POOLCOLL_TOX_CNTNT2
: // 2. Level
689 lcl_SetRegister( this, aSet
, 1, false, true );
691 case RES_POOLCOLL_TOX_CNTNT3
: // 3. Level
692 lcl_SetRegister( this, aSet
, 2, false, true );
694 case RES_POOLCOLL_TOX_CNTNT4
: // 4. Level
695 lcl_SetRegister( this, aSet
, 3, false, true );
697 case RES_POOLCOLL_TOX_CNTNT5
: // 5. Level
698 lcl_SetRegister( this, aSet
, 4, false, true );
700 case RES_POOLCOLL_TOX_CNTNT6
: // 6. Level
701 lcl_SetRegister( this, aSet
, 5, false, true );
703 case RES_POOLCOLL_TOX_CNTNT7
: // 7. Level
704 lcl_SetRegister( this, aSet
, 6, false, true );
706 case RES_POOLCOLL_TOX_CNTNT8
: // 8. Level
707 lcl_SetRegister( this, aSet
, 7, false, true );
709 case RES_POOLCOLL_TOX_CNTNT9
: // 9. Level
710 lcl_SetRegister( this, aSet
, 8, false, true );
712 case RES_POOLCOLL_TOX_CNTNT10
: // 10. Level
713 lcl_SetRegister( this, aSet
, 9, false, true );
716 case RES_POOLCOLL_TOX_ILLUSH
:
717 case RES_POOLCOLL_TOX_OBJECTH
:
718 case RES_POOLCOLL_TOX_TABLESH
:
719 case RES_POOLCOLL_TOX_AUTHORITIESH
:
720 lcl_SetRegister( this, aSet
, 0, true, false );
722 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
726 case RES_POOLCOLL_TOX_ILLUS1
:
727 case RES_POOLCOLL_TOX_OBJECT1
:
728 case RES_POOLCOLL_TOX_TABLES1
:
729 case RES_POOLCOLL_TOX_AUTHORITIES1
:
730 lcl_SetRegister( this, aSet
, 0, false, true );
735 case RES_POOLCOLL_NUM_LEVEL1S
:
736 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL1
,
737 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 0 ),
740 case RES_POOLCOLL_NUM_LEVEL1
:
741 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL1
,
742 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 0 ),
745 case RES_POOLCOLL_NUM_LEVEL1E
:
746 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL1
,
747 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 0 ),
750 case RES_POOLCOLL_NUM_NONUM1
:
751 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM1
,
752 0, SwNumRule::GetNumIndent( 0 ), 0, PT_6
);
754 case RES_POOLCOLL_NUM_LEVEL2S
:
755 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL2
,
756 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 1 ),
759 case RES_POOLCOLL_NUM_LEVEL2
:
760 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL2
,
761 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 1 ),
764 case RES_POOLCOLL_NUM_LEVEL2E
:
765 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL2
,
766 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 1 ),
769 case RES_POOLCOLL_NUM_NONUM2
:
770 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM2
,
771 0, SwNumRule::GetNumIndent( 1 ), 0, PT_6
);
773 case RES_POOLCOLL_NUM_LEVEL3S
:
774 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL3
,
775 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 2 ),
778 case RES_POOLCOLL_NUM_LEVEL3
:
779 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL3
,
780 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 2 ),
783 case RES_POOLCOLL_NUM_LEVEL3E
:
784 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL3
,
785 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 2 ),
788 case RES_POOLCOLL_NUM_NONUM3
:
789 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM3
,
790 0, SwNumRule::GetNumIndent( 2 ), 0, PT_6
);
792 case RES_POOLCOLL_NUM_LEVEL4S
:
793 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL4
,
794 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 3 ),
797 case RES_POOLCOLL_NUM_LEVEL4
:
798 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL4
,
799 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 3 ),
802 case RES_POOLCOLL_NUM_LEVEL4E
:
803 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL4
,
804 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 3 ),
807 case RES_POOLCOLL_NUM_NONUM4
:
808 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM4
,
809 0, SwNumRule::GetNumIndent( 3 ), 0, PT_6
);
811 case RES_POOLCOLL_NUM_LEVEL5S
:
812 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL5
,
813 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 4 ),
816 case RES_POOLCOLL_NUM_LEVEL5
:
817 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL5
,
818 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 4 ),
821 case RES_POOLCOLL_NUM_LEVEL5E
:
822 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL5
,
823 lNumFirstLineOffset
, SwNumRule::GetNumIndent( 4 ),
826 case RES_POOLCOLL_NUM_NONUM5
:
827 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM5
,
828 0, SwNumRule::GetNumIndent( 4 ), 0, PT_6
);
831 case RES_POOLCOLL_BUL_LEVEL1S
:
832 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL1
,
833 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 0 ),
836 case RES_POOLCOLL_BUL_LEVEL1
:
837 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL1
,
838 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 0 ),
841 case RES_POOLCOLL_BUL_LEVEL1E
:
842 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL1
,
843 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 0 ),
846 case RES_POOLCOLL_BUL_NONUM1
:
847 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_NONUM1
,
848 0, SwNumRule::GetBullIndent( 0 ), 0, PT_6
);
850 case RES_POOLCOLL_BUL_LEVEL2S
:
851 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL2
,
852 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 1 ),
855 case RES_POOLCOLL_BUL_LEVEL2
:
856 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL2
,
857 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 1 ),
860 case RES_POOLCOLL_BUL_LEVEL2E
:
861 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL2
,
862 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 1 ),
865 case RES_POOLCOLL_BUL_NONUM2
:
866 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_NONUM2
,
867 0, SwNumRule::GetBullIndent( 1 ), 0, PT_6
);
869 case RES_POOLCOLL_BUL_LEVEL3S
:
870 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL3
,
871 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 2 ),
874 case RES_POOLCOLL_BUL_LEVEL3
:
875 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL3
,
876 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 2 ),
879 case RES_POOLCOLL_BUL_LEVEL3E
:
880 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL3
,
881 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 2 ),
884 case RES_POOLCOLL_BUL_NONUM3
:
885 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_NONUM3
,
886 0, SwNumRule::GetBullIndent( 2 ), 0, PT_6
);
888 case RES_POOLCOLL_BUL_LEVEL4S
:
889 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL4
,
890 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 3 ),
893 case RES_POOLCOLL_BUL_LEVEL4
:
894 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL4
,
895 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 3 ),
898 case RES_POOLCOLL_BUL_LEVEL4E
:
899 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL4
,
900 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 3 ),
903 case RES_POOLCOLL_BUL_NONUM4
:
904 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_NONUM4
,
905 0, SwNumRule::GetBullIndent( 3 ), 0, PT_6
);
907 case RES_POOLCOLL_BUL_LEVEL5S
:
908 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL5
,
909 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 4 ),
912 case RES_POOLCOLL_BUL_LEVEL5
:
913 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL5
,
914 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 4 ),
917 case RES_POOLCOLL_BUL_LEVEL5E
:
918 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_LEVEL5
,
919 lBullFirstLineOffset
, SwNumRule::GetBullIndent( 4 ),
922 case RES_POOLCOLL_BUL_NONUM5
:
923 lcl_SetNumBul( this, pNewColl
, aSet
, RES_POOLCOLL_BUL_NONUM5
,
924 0, SwNumRule::GetBullIndent( 4 ), 0, PT_6
);
927 case RES_POOLCOLL_DOC_TITEL
: // Document Title
929 SetAllScriptItem( aSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
930 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_18
, 100, RES_CHRATR_FONTSIZE
) );
932 aSet
.Put( SvxAdjustItem( SVX_ADJUST_CENTER
, RES_PARATR_ADJUST
) );
934 pNewColl
->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT
));
938 case RES_POOLCOLL_DOC_SUBTITEL
: // Document subtitle
940 SetAllScriptItem( aSet
, SvxPostureItem( ITALIC_NORMAL
, RES_CHRATR_POSTURE
));
941 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_14
, 100, RES_CHRATR_FONTSIZE
));
943 aSet
.Put( SvxAdjustItem( SVX_ADJUST_CENTER
, RES_PARATR_ADJUST
));
945 pNewColl
->SetNextTxtFmtColl( *GetTxtCollFromPool(
946 RES_POOLCOLL_TEXT
));
950 case RES_POOLCOLL_HTML_BLOCKQUOTE
:
952 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
953 aLR
.SetLeft( GetMetricVal( CM_1
));
954 aLR
.SetRight( GetMetricVal( CM_1
));
956 SvxULSpaceItem
aUL( RES_UL_SPACE
);
957 aUL
= pNewColl
->GetULSpace();
958 aUL
.SetLower( HTML_PARSPACE
);
963 case RES_POOLCOLL_HTML_PRE
:
965 ::lcl_SetDfltFont( DEFAULTFONT_FIXED
, aSet
);
967 // WORKAROUND: Set PRE to 10pt
968 SetAllScriptItem( aSet
, SvxFontHeightItem(PT_10
, 100, RES_CHRATR_FONTSIZE
) );
970 // The lower paragraph distance is set explicitly (makes
971 // assigning hard attributes easier)
972 SvxULSpaceItem
aULSpaceItem( RES_UL_SPACE
);
973 aULSpaceItem
= pNewColl
->GetULSpace();
974 aULSpaceItem
.SetLower( 0 );
975 aSet
.Put( aULSpaceItem
);
979 case RES_POOLCOLL_HTML_HR
:
981 SvxBoxItem
aBox( RES_BOX
);
982 Color
aColor( COL_GRAY
);
983 SvxBorderLine
aNew(&aColor
, 1, table::BorderLineStyle::DOUBLE
);
984 aBox
.SetLine( &aNew
, BOX_LINE_BOTTOM
);
987 aSet
.Put( SwParaConnectBorderItem( sal_False
) );
988 SetAllScriptItem( aSet
, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE
) );
990 SvxULSpaceItem
aUL( RES_UL_SPACE
);
992 pNewColl
->SetNextTxtFmtColl( *GetTxtCollFromPool(
993 RES_POOLCOLL_TEXT
));
994 aUL
= pNewColl
->GetULSpace();
996 aUL
.SetLower( HTML_PARSPACE
);
998 SwFmtLineNumber aLN
; aLN
.SetCountLines( sal_False
);
1003 case RES_POOLCOLL_HTML_DD
:
1005 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
1006 aLR
= pNewColl
->GetLRSpace();
1007 // We indent by 1 cm. The IDs are always 2 away from each other!
1008 aLR
.SetLeft( GetMetricVal( CM_1
));
1012 case RES_POOLCOLL_HTML_DT
:
1014 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
1016 pNewColl
->SetNextTxtFmtColl( *GetTxtCollFromPool(
1017 RES_POOLCOLL_HTML_DD
));
1018 aLR
= pNewColl
->GetLRSpace();
1020 // We indent by 0 cm. The IDs are always 2 away from each other!
1031 pNewColl
->SetFmtAttr( aSet
);
1037 /// Check if this AutoCollection is already/still in use in this Document
1038 bool SwDoc::IsPoolTxtCollUsed( sal_uInt16 nId
) const
1041 (RES_POOLCOLL_TEXT_BEGIN
<= nId
&& nId
< RES_POOLCOLL_TEXT_END
) ||
1042 (RES_POOLCOLL_LISTS_BEGIN
<= nId
&& nId
< RES_POOLCOLL_LISTS_END
) ||
1043 (RES_POOLCOLL_EXTRA_BEGIN
<= nId
&& nId
< RES_POOLCOLL_EXTRA_END
) ||
1044 (RES_POOLCOLL_REGISTER_BEGIN
<= nId
&& nId
< RES_POOLCOLL_REGISTER_END
) ||
1045 (RES_POOLCOLL_DOC_BEGIN
<= nId
&& nId
< RES_POOLCOLL_DOC_END
) ||
1046 (RES_POOLCOLL_HTML_BEGIN
<= nId
&& nId
< RES_POOLCOLL_HTML_END
),
1047 "Wrong AutoFormat Id" );
1049 SwTxtFmtColl
* pNewColl
= 0;
1051 for( sal_uInt16 n
= 0; !bFnd
&& n
< mpTxtFmtCollTbl
->size(); ++n
)
1053 pNewColl
= (*mpTxtFmtCollTbl
)[ n
];
1054 if( nId
== pNewColl
->GetPoolFmtId() )
1058 if( !bFnd
|| !pNewColl
->GetDepends() )
1061 SwAutoFmtGetDocNode
aGetHt( &GetNodes() );
1062 return !pNewColl
->GetInfo( aGetHt
);
1065 /// Return the AutomaticFormat with the supplied Id. If it doesn't
1066 /// exist, create it.
1067 SwFmt
* SwDoc::GetFmtFromPool( sal_uInt16 nId
)
1070 SwFmt
*pDeriveFmt
= 0;
1072 SwFmtsBase
* pArray
[ 2 ];
1073 sal_uInt16 nArrCnt
= 1, nRCId
= 0;
1074 sal_uInt16
* pWhichRange
= 0;
1076 switch( nId
& (COLL_GET_RANGE_BITS
+ POOLGRP_NOCOLLID
) )
1078 case POOLGRP_CHARFMT
:
1080 pArray
[0] = mpCharFmtTbl
;
1081 pDeriveFmt
= mpDfltCharFmt
;
1083 if( nId
> RES_POOLCHR_NORMAL_END
)
1084 nRCId
= RC_POOLCHRFMT_HTML_BEGIN
- RES_POOLCHR_HTML_BEGIN
;
1086 nRCId
= RC_POOLCHRFMT_BEGIN
- RES_POOLCHR_BEGIN
;
1087 pWhichRange
= aCharFmtSetRange
;
1089 // Fault: unknown Format, but a CharFormat
1090 // -> return the first one
1091 if( RES_POOLCHR_BEGIN
> nId
|| nId
>= RES_POOLCHR_END
)
1093 OSL_ENSURE( !this, "invalid Id" );
1094 nId
= RES_POOLCHR_BEGIN
;
1098 case POOLGRP_FRAMEFMT
:
1100 pArray
[0] = mpFrmFmtTbl
;
1101 pArray
[1] = mpSpzFrmFmtTbl
;
1102 pDeriveFmt
= mpDfltFrmFmt
;
1104 nRCId
= RC_POOLFRMFMT_BEGIN
- RES_POOLFRM_BEGIN
;
1105 pWhichRange
= aFrmFmtSetRange
;
1107 // Fault: unknown Format, but a FrameFormat
1108 // -> return the first one
1109 if( RES_POOLFRM_BEGIN
> nId
|| nId
>= RES_POOLFRM_END
)
1111 OSL_ENSURE( !this, "invalid Id" );
1112 nId
= RES_POOLFRM_BEGIN
;
1118 // Fault, unknown Format
1119 OSL_ENSURE( nId
, "invalid Id" );
1122 OSL_ENSURE( nRCId
, "invalid Id" );
1125 for( sal_uInt16 n
= 0; n
< (*pArray
[nArrCnt
]).GetFmtCount(); ++n
)
1126 if( nId
== ( pNewFmt
= (*pArray
[ nArrCnt
] ).GetFmt( n
) )->
1132 ResId
aResId( nRCId
+ nId
, *pSwResMgr
);
1133 String
aNm( aResId
);
1134 SwAttrSet
aSet( GetAttrPool(), pWhichRange
);
1137 bool bIsModified
= IsModified();
1140 ::sw::UndoGuard
const undoGuard(GetIDocumentUndoRedo());
1141 switch (nId
& (COLL_GET_RANGE_BITS
+ POOLGRP_NOCOLLID
) )
1143 case POOLGRP_CHARFMT
:
1144 pNewFmt
= _MakeCharFmt(aNm
, pDeriveFmt
, false, true);
1146 case POOLGRP_FRAMEFMT
:
1147 pNewFmt
= _MakeFrmFmt(aNm
, pDeriveFmt
, false, true);
1156 pNewFmt
->SetPoolFmtId( nId
);
1157 pNewFmt
->SetAuto( false ); // no AutoFormat
1162 case RES_POOLCHR_FOOTNOTE
: // Footnote
1163 case RES_POOLCHR_PAGENO
: // Page/Field
1164 case RES_POOLCHR_LABEL
: // Label
1165 case RES_POOLCHR_DROPCAPS
: // Dropcaps
1166 case RES_POOLCHR_NUM_LEVEL
: // Numbering level
1167 case RES_POOLCHR_TOXJUMP
: // Table of contents jump
1168 case RES_POOLCHR_ENDNOTE
: // Endnote
1169 case RES_POOLCHR_LINENUM
: // Line numbering
1172 case RES_POOLCHR_ENDNOTE_ANCHOR
: // Endnote anchor
1173 case RES_POOLCHR_FOOTNOTE_ANCHOR
: // Footnote anchor
1175 aSet
.Put( SvxEscapementItem( DFLT_ESC_AUTO_SUPER
, 58, RES_CHRATR_ESCAPEMENT
) );
1180 case RES_POOLCHR_BUL_LEVEL
: // Bullet character
1182 const Font
& rBulletFont
= numfunc::GetDefBulletFont();
1183 SetAllScriptItem( aSet
, SvxFontItem( rBulletFont
.GetFamily(),
1184 rBulletFont
.GetName(), rBulletFont
.GetStyleName(),
1185 rBulletFont
.GetPitch(), rBulletFont
.GetCharSet(), RES_CHRATR_FONT
));
1189 case RES_POOLCHR_INET_NORMAL
:
1191 Color
aCol( COL_BLUE
);
1192 aSet
.Put( SvxColorItem( aCol
, RES_CHRATR_COLOR
) );
1193 aSet
.Put( SvxUnderlineItem( UNDERLINE_SINGLE
, RES_CHRATR_UNDERLINE
) );
1194 // i40133: patch submitted by rail: set language to 'none' to prevent spell checking:
1195 aSet
.Put( SvxLanguageItem( LANGUAGE_NONE
, RES_CHRATR_LANGUAGE
) );
1196 aSet
.Put( SvxLanguageItem( LANGUAGE_NONE
, RES_CHRATR_CJK_LANGUAGE
) );
1197 aSet
.Put( SvxLanguageItem( LANGUAGE_NONE
, RES_CHRATR_CTL_LANGUAGE
) );
1200 case RES_POOLCHR_INET_VISIT
:
1202 Color
aCol( COL_RED
);
1203 aSet
.Put( SvxColorItem( aCol
, RES_CHRATR_COLOR
) );
1204 aSet
.Put( SvxUnderlineItem( UNDERLINE_SINGLE
, RES_CHRATR_UNDERLINE
) );
1205 aSet
.Put( SvxLanguageItem( LANGUAGE_NONE
, RES_CHRATR_LANGUAGE
) );
1206 aSet
.Put( SvxLanguageItem( LANGUAGE_NONE
, RES_CHRATR_CJK_LANGUAGE
) );
1207 aSet
.Put( SvxLanguageItem( LANGUAGE_NONE
, RES_CHRATR_CTL_LANGUAGE
) );
1210 case RES_POOLCHR_JUMPEDIT
:
1212 Color
aCol( COL_CYAN
);
1213 aSet
.Put( SvxColorItem( aCol
, RES_CHRATR_COLOR
) );
1214 aSet
.Put( SvxUnderlineItem( UNDERLINE_DOTTED
, RES_CHRATR_UNDERLINE
) );
1215 aSet
.Put( SvxCaseMapItem( SVX_CASEMAP_KAPITAELCHEN
, RES_CHRATR_CASEMAP
) );
1219 case RES_POOLCHR_RUBYTEXT
:
1221 long nH
= ((SvxFontHeightItem
*)GetDfltAttr(
1222 RES_CHRATR_CJK_FONTSIZE
))->GetHeight() / 2;
1223 SetAllScriptItem( aSet
, SvxFontHeightItem( nH
, 100, RES_CHRATR_FONTSIZE
));
1224 aSet
.Put(SvxUnderlineItem( UNDERLINE_NONE
, RES_CHRATR_UNDERLINE
));
1225 aSet
.Put(SvxEmphasisMarkItem( EMPHASISMARK_NONE
, RES_CHRATR_EMPHASIS_MARK
) );
1229 case RES_POOLCHR_HTML_EMPHASIS
:
1230 case RES_POOLCHR_HTML_CITIATION
:
1231 case RES_POOLCHR_HTML_VARIABLE
:
1233 SetAllScriptItem( aSet
, SvxPostureItem( ITALIC_NORMAL
, RES_CHRATR_POSTURE
) );
1237 case RES_POOLCHR_IDX_MAIN_ENTRY
:
1238 case RES_POOLCHR_HTML_STRONG
:
1240 SetAllScriptItem( aSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
));
1244 case RES_POOLCHR_HTML_CODE
:
1245 case RES_POOLCHR_HTML_SAMPLE
:
1246 case RES_POOLCHR_HTML_KEYBOARD
:
1247 case RES_POOLCHR_HTML_TELETYPE
:
1249 ::lcl_SetDfltFont( DEFAULTFONT_FIXED
, aSet
);
1252 case RES_POOLCHR_VERT_NUM
:
1253 aSet
.Put( SvxCharRotateItem( 900, sal_False
, RES_CHRATR_ROTATE
) );
1256 case RES_POOLFRM_FRAME
:
1258 if ( get(IDocumentSettingAccess::HTML_MODE
) )
1260 aSet
.Put( SwFmtAnchor( FLY_AS_CHAR
));
1261 aSet
.Put( SwFmtVertOrient( 0, text::VertOrientation::LINE_CENTER
, text::RelOrientation::PRINT_AREA
) );
1262 aSet
.Put( SwFmtSurround( SURROUND_NONE
) );
1266 aSet
.Put( SwFmtAnchor( FLY_AT_PARA
));
1267 aSet
.Put( SwFmtSurround( SURROUND_PARALLEL
) );
1268 aSet
.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER
, text::RelOrientation::PRINT_AREA
) );
1269 aSet
.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::PRINT_AREA
) );
1270 Color
aCol( COL_BLACK
);
1271 SvxBorderLine
aLine( &aCol
, DEF_LINE_WIDTH_0
);
1272 SvxBoxItem
aBox( RES_BOX
);
1273 aBox
.SetLine( &aLine
, BOX_LINE_TOP
);
1274 aBox
.SetLine( &aLine
, BOX_LINE_BOTTOM
);
1275 aBox
.SetLine( &aLine
, BOX_LINE_LEFT
);
1276 aBox
.SetLine( &aLine
, BOX_LINE_RIGHT
);
1277 aBox
.SetDistance( 85 );
1279 aSet
.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE
) );
1280 aSet
.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE
) );
1284 case RES_POOLFRM_GRAPHIC
:
1285 case RES_POOLFRM_OLE
:
1287 aSet
.Put( SwFmtAnchor( FLY_AT_PARA
));
1288 aSet
.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER
, text::RelOrientation::FRAME
));
1289 aSet
.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::FRAME
));
1290 aSet
.Put( SwFmtSurround( SURROUND_IDEAL
));
1293 case RES_POOLFRM_FORMEL
:
1295 aSet
.Put( SwFmtAnchor( FLY_AS_CHAR
) );
1296 aSet
.Put( SwFmtVertOrient( 0, text::VertOrientation::CHAR_CENTER
, text::RelOrientation::FRAME
) );
1297 aSet
.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE
) );
1300 case RES_POOLFRM_MARGINAL
:
1302 aSet
.Put( SwFmtAnchor( FLY_AT_PARA
));
1303 aSet
.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT
, text::RelOrientation::FRAME
));
1304 aSet
.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::FRAME
));
1305 aSet
.Put( SwFmtSurround( SURROUND_PARALLEL
));
1306 // Set the default width to 3.5 cm, use the minimum value for the height
1307 aSet
.Put( SwFmtFrmSize( ATT_MIN_SIZE
,
1308 GetMetricVal( CM_1
) * 3 + GetMetricVal( CM_05
),
1312 case RES_POOLFRM_WATERSIGN
:
1314 aSet
.Put( SwFmtAnchor( FLY_AT_PAGE
));
1315 aSet
.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER
, text::RelOrientation::FRAME
));
1316 aSet
.Put( SwFmtVertOrient( 0, text::VertOrientation::CENTER
, text::RelOrientation::FRAME
));
1317 aSet
.Put( SvxOpaqueItem( sal_False
));
1318 aSet
.Put( SwFmtSurround( SURROUND_THROUGHT
));
1322 case RES_POOLFRM_LABEL
:
1324 aSet
.Put( SwFmtAnchor( FLY_AS_CHAR
) );
1325 aSet
.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::FRAME
) );
1326 aSet
.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE
) );
1328 SvxProtectItem
aProtect( RES_PROTECT
);
1329 aProtect
.SetSizeProtect( sal_True
);
1330 aProtect
.SetPosProtect( sal_True
);
1331 aSet
.Put( aProtect
);
1333 pNewFmt
->SetAutoUpdateFmt( sal_True
);
1340 pNewFmt
->SetFmtAttr( aSet
);
1346 SwFrmFmt
* SwDoc::GetFrmFmtFromPool( sal_uInt16 nId
)
1348 return (SwFrmFmt
*)GetFmtFromPool( nId
);
1351 SwCharFmt
* SwDoc::GetCharFmtFromPool( sal_uInt16 nId
)
1353 return (SwCharFmt
*)GetFmtFromPool( nId
);
1356 /// Check if this AutoCollection is already/still in use
1357 bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId
) const
1360 const SwFmtsBase
* pArray
[ 2 ];
1361 sal_uInt16 nArrCnt
= 1;
1364 if (RES_POOLCHR_BEGIN
<= nId
&& nId
< RES_POOLCHR_END
)
1366 pArray
[0] = mpCharFmtTbl
;
1368 else if (RES_POOLFRM_BEGIN
<= nId
&& nId
< RES_POOLFRM_END
)
1370 pArray
[0] = mpFrmFmtTbl
;
1371 pArray
[1] = mpSpzFrmFmtTbl
;
1376 SAL_WARN("sw.core", "Invalid Pool Id: " << nId
<< " should be within " <<
1377 "[" << int(RES_POOLCHR_BEGIN
) << "," << int(RES_POOLCHR_END
) << ") or " <<
1378 "[" << int(RES_POOLFRM_BEGIN
) << "," << int(RES_POOLFRM_END
) << ")");
1385 while( nArrCnt
-- && !bFnd
)
1386 for( sal_uInt16 n
= 0; !bFnd
&& n
< (*pArray
[nArrCnt
]).GetFmtCount(); ++n
)
1387 if( nId
== ( pNewFmt
= (*pArray
[ nArrCnt
] ).GetFmt( n
) )->
1392 // Not found or no dependecies?
1393 if( bFnd
&& pNewFmt
->GetDepends() )
1395 // Check if we have dependent ContentNodes in the Nodes array
1396 // (also indirect ones for derived Formats)
1397 SwAutoFmtGetDocNode
aGetHt( &GetNodes() );
1398 bFnd
= !pNewFmt
->GetInfo( aGetHt
);
1408 static void lcl_GetStdPgSize( SwDoc
* pDoc
, SfxItemSet
& rSet
)
1410 SwPageDesc
* pStdPgDsc
= pDoc
->GetPageDescFromPool( RES_POOLPAGE_STANDARD
);
1411 SwFmtFrmSize
aFrmSz( pStdPgDsc
->GetMaster().GetFrmSize() );
1412 if( pStdPgDsc
->GetLandscape() )
1414 SwTwips nTmp
= aFrmSz
.GetHeight();
1415 aFrmSz
.SetHeight( aFrmSz
.GetWidth() );
1416 aFrmSz
.SetWidth( nTmp
);
1421 SwPageDesc
* SwDoc::GetPageDescFromPool( sal_uInt16 nId
, bool bRegardLanguage
)
1423 OSL_ENSURE( RES_POOLPAGE_BEGIN
<= nId
&& nId
< RES_POOLPAGE_END
,
1424 "Wrong AutoFormat Id" );
1426 SwPageDesc
*pNewPgDsc
;
1429 for( n
= 0; n
< maPageDescs
.size(); ++n
)
1430 if( nId
== ( pNewPgDsc
= maPageDescs
[ n
] )->GetPoolFmtId() )
1435 // error: unknown Pool style
1436 if( RES_POOLPAGE_BEGIN
> nId
|| nId
>= RES_POOLPAGE_END
)
1438 OSL_ENSURE( !this, "invalid Id" );
1439 nId
= RES_POOLPAGE_BEGIN
;
1442 ResId
aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN
+ nId
- RES_POOLPAGE_BEGIN
), *pSwResMgr
);
1443 String
aNm( aResId
);
1445 bool bIsModified
= IsModified();
1448 ::sw::UndoGuard
const undoGuard(GetIDocumentUndoRedo());
1449 n
= MakePageDesc( aNm
, 0, bRegardLanguage
);
1452 pNewPgDsc
= maPageDescs
[ n
];
1453 pNewPgDsc
->SetPoolFmtId( nId
);
1459 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
1460 aLR
.SetLeft( GetMetricVal( CM_1
) * 2 );
1461 aLR
.SetRight( aLR
.GetLeft() );
1462 SvxULSpaceItem
aUL( RES_UL_SPACE
);
1463 aUL
.SetUpper( (sal_uInt16
)aLR
.GetLeft() );
1464 aUL
.SetLower( (sal_uInt16
)aLR
.GetLeft() );
1466 SwAttrSet
aSet( GetAttrPool(), aPgFrmFmtSetRange
);
1467 bool bSetLeft
= true;
1471 case RES_POOLPAGE_STANDARD
: // Standard page
1476 pNewPgDsc
->SetUseOn( nsUseOnPage::PD_ALL
| nsUseOnPage::PD_FIRSTSHARE
);
1480 case RES_POOLPAGE_FIRST
: // First page
1481 case RES_POOLPAGE_REGISTER
: // ToX
1483 lcl_GetStdPgSize( this, aSet
);
1488 pNewPgDsc
->SetUseOn( nsUseOnPage::PD_ALL
);
1489 if( RES_POOLPAGE_FIRST
== nId
)
1490 pNewPgDsc
->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD
));
1495 case RES_POOLPAGE_LEFT
: // Left page
1497 lcl_GetStdPgSize( this, aSet
);
1503 pNewPgDsc
->SetUseOn( nsUseOnPage::PD_LEFT
);
1504 // this relies on GetPageDescFromPool() not going into infinite recursion
1505 // (by this point RES_POOLPAGE_LEFT will not reach this place again)
1506 pNewPgDsc
->SetFollow( GetPageDescFromPool( RES_POOLPAGE_RIGHT
));
1510 case RES_POOLPAGE_RIGHT
: // Right page
1512 lcl_GetStdPgSize( this, aSet
);
1518 pNewPgDsc
->SetUseOn( nsUseOnPage::PD_RIGHT
);
1519 pNewPgDsc
->SetFollow( GetPageDescFromPool( RES_POOLPAGE_LEFT
));
1524 case RES_POOLPAGE_JAKET
: // envelope
1526 aLR
.SetLeft( 0 ); aLR
.SetRight( 0 );
1527 aUL
.SetUpper( 0 ); aUL
.SetLower( 0 );
1528 Size
aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65
) );
1529 LandscapeSwap( aPSize
);
1530 aSet
.Put( SwFmtFrmSize( ATT_FIX_SIZE
, aPSize
.Width(), aPSize
.Height() ));
1536 pNewPgDsc
->SetUseOn( nsUseOnPage::PD_ALL
);
1537 pNewPgDsc
->SetLandscape( sal_True
);
1542 case RES_POOLPAGE_HTML
: // HTML
1544 lcl_GetStdPgSize( this, aSet
);
1545 aLR
.SetRight( GetMetricVal( CM_1
));
1546 aUL
.SetUpper( (sal_uInt16
)aLR
.GetRight() );
1547 aUL
.SetLower( (sal_uInt16
)aLR
.GetRight() );
1552 pNewPgDsc
->SetUseOn( nsUseOnPage::PD_ALL
);
1555 case RES_POOLPAGE_FOOTNOTE
:
1556 case RES_POOLPAGE_ENDNOTE
:
1558 lcl_GetStdPgSize( this, aSet
);
1562 pNewPgDsc
->SetUseOn( nsUseOnPage::PD_ALL
);
1563 SwPageFtnInfo
aInf( pNewPgDsc
->GetFtnInfo() );
1564 aInf
.SetLineWidth( 0 );
1565 aInf
.SetTopDist( 0 );
1566 aInf
.SetBottomDist( 0 );
1567 pNewPgDsc
->SetFtnInfo( aInf
);
1570 case RES_POOLPAGE_LANDSCAPE
:
1572 SwPageDesc
* pStdPgDsc
= this->GetPageDescFromPool( RES_POOLPAGE_STANDARD
);
1573 SwFmtFrmSize
aFrmSz( pStdPgDsc
->GetMaster().GetFrmSize() );
1574 SwTwips nTmp
= aFrmSz
.GetHeight();
1575 aFrmSz
.SetHeight( aFrmSz
.GetWidth() );
1576 aFrmSz
.SetWidth( nTmp
);
1582 pNewPgDsc
->SetUseOn( nsUseOnPage::PD_ALL
);
1583 pNewPgDsc
->SetLandscape( sal_True
);
1595 pNewPgDsc
->GetLeft().SetFmtAttr( aSet
);
1596 pNewPgDsc
->GetFirstLeft().SetFmtAttr( aSet
);
1598 pNewPgDsc
->GetMaster().SetFmtAttr( aSet
);
1599 pNewPgDsc
->GetFirstMaster().SetFmtAttr( aSet
);
1605 SwNumRule
* SwDoc::GetNumRuleFromPool( sal_uInt16 nId
)
1607 OSL_ENSURE( RES_POOLNUMRULE_BEGIN
<= nId
&& nId
< RES_POOLNUMRULE_END
,
1608 "Wrong AutoFormat Id" );
1610 SwNumRule
* pNewRule
;
1613 for( n
= 0; n
< GetNumRuleTbl().size(); ++n
)
1614 if( nId
== ( pNewRule
= GetNumRuleTbl()[ n
] )->GetPoolFmtId() )
1619 // error: unknown Pool style
1620 if( RES_POOLNUMRULE_BEGIN
> nId
|| nId
>= RES_POOLNUMRULE_END
)
1622 OSL_ENSURE( !this, "invalid Id" );
1623 nId
= RES_POOLNUMRULE_BEGIN
;
1626 ResId
aResId( sal_uInt32(RC_POOLNUMRULE_BEGIN
+ nId
- RES_POOLNUMRULE_BEGIN
), *pSwResMgr
);
1627 String
aNm( aResId
);
1629 SwCharFmt
*pNumCFmt
= 0, *pBullCFmt
= 0;
1631 const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode
1632 = numfunc::GetDefaultPositionAndSpaceMode(); //#i89178#
1634 bool bIsModified
= IsModified();
1636 n
= MakeNumRule( aNm
, 0, false, eNumberFormatPositionAndSpaceMode
);
1638 pNewRule
= GetNumRuleTbl()[ n
];
1639 pNewRule
->SetPoolFmtId( nId
);
1640 pNewRule
->SetAutoRule( sal_False
);
1642 if( RES_POOLNUMRULE_NUM1
<= nId
&& nId
<= RES_POOLNUMRULE_NUM5
)
1643 pNumCFmt
= GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL
);
1645 if( ( RES_POOLNUMRULE_BUL1
<= nId
&& nId
<= RES_POOLNUMRULE_BUL5
) ||
1646 RES_POOLNUMRULE_NUM5
== nId
)
1647 pBullCFmt
= GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL
);
1655 case RES_POOLNUMRULE_NUM1
:
1658 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
1659 aFmt
.SetNumberingType(SVX_NUM_ARABIC
);
1660 aFmt
.SetCharFmt( pNumCFmt
);
1662 aFmt
.SetIncludeUpperLevels( 1 );
1663 aFmt
.SetSuffix( aDotStr
);
1665 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
1667 // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
1668 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1670 #ifdef USE_MEASUREMENT
1671 static const sal_uInt16 aAbsSpaceInch
[ MAXLEVEL
] =
1673 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1675 const sal_uInt16
* pArr
= MEASURE_METRIC
==
1676 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1680 const sal_uInt16
* pArr
= aAbsSpace
;
1683 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1685 aFmt
.SetFirstLineOffset( - (*pArr
) );
1687 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1689 aFmt
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
1690 aFmt
.SetFirstLineIndent( - (*pArr
) );
1693 for( n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
1695 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1697 aFmt
.SetAbsLSpace( *pArr
);
1699 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1701 aFmt
.SetListtabPos( *pArr
);
1702 aFmt
.SetIndentAt( *pArr
);
1705 pNewRule
->Set( n
, aFmt
);
1710 case RES_POOLNUMRULE_NUM2
:
1712 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
1714 283, 283, 567, 709, // 0.50, 0.50, 1.00, 1.25
1715 850, 1021, 1304, 1474, // 1.50, 1.80, 2.30, 2.60
1716 1588, 1758 // 2.80, 3.10
1719 #ifdef USE_MEASUREMENT
1720 static const sal_uInt16 aAbsSpaceInch
[ MAXLEVEL
] =
1723 1155, 1386, 1771, 2002,
1727 const sal_uInt16
* pArr
= MEASURE_METRIC
==
1728 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1732 const sal_uInt16
* pArr
= aAbsSpace
;
1736 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
1737 aFmt
.SetNumberingType(SVX_NUM_ARABIC
);
1738 aFmt
.SetCharFmt( pNumCFmt
);
1739 aFmt
.SetIncludeUpperLevels( 1 );
1741 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1743 aFmt
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
1746 sal_uInt16 nSpace
= 0;
1747 for( n
= 0; n
< MAXLEVEL
; ++n
)
1749 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1751 aFmt
.SetAbsLSpace( nSpace
= nSpace
+ pArr
[ n
] );
1752 aFmt
.SetFirstLineOffset( - pArr
[ n
] );
1754 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1756 aFmt
.SetListtabPos( nSpace
= nSpace
+ pArr
[ n
] );
1757 aFmt
.SetIndentAt( nSpace
);
1758 aFmt
.SetFirstLineIndent( - pArr
[ n
] );
1761 aFmt
.SetStart( n
+1 );
1762 pNewRule
->Set( n
, aFmt
);
1766 case RES_POOLNUMRULE_NUM3
:
1770 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
1771 aFmt
.SetNumberingType(SVX_NUM_ARABIC
);
1772 aFmt
.SetCharFmt( pNumCFmt
);
1773 aFmt
.SetIncludeUpperLevels( 1 );
1775 sal_uInt16 nOffs
= GetMetricVal( CM_1
) * 3;
1777 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1779 aFmt
.SetFirstLineOffset( - nOffs
);
1781 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1783 aFmt
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
1784 aFmt
.SetFirstLineIndent( - nOffs
);
1787 for( n
= 0; n
< MAXLEVEL
; ++n
)
1789 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1791 aFmt
.SetAbsLSpace( (n
+1) * nOffs
);
1793 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1795 aFmt
.SetListtabPos( (n
+1) * nOffs
);
1796 aFmt
.SetIndentAt( (n
+1) * nOffs
);
1799 aFmt
.SetStart( n
+1 );
1800 pNewRule
->Set( n
, aFmt
);
1804 case RES_POOLNUMRULE_NUM4
:
1808 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
1809 aFmt
.SetNumberingType(SVX_NUM_ROMAN_UPPER
);
1810 aFmt
.SetCharFmt( pNumCFmt
);
1811 aFmt
.SetIncludeUpperLevels( 1 );
1812 aFmt
.SetSuffix( aDotStr
);
1814 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
1816 // cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
1817 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1819 #ifdef USE_MEASUREMENT
1820 static const sal_uInt16 aAbsSpaceInch
[ MAXLEVEL
] =
1822 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835
1824 const sal_uInt16
* pArr
= MEASURE_METRIC
==
1825 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1829 const sal_uInt16
* pArr
= aAbsSpace
;
1832 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1834 aFmt
.SetFirstLineOffset( - (*pArr
) );
1836 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1838 aFmt
.SetLabelFollowedBy( SvxNumberFormat::SPACE
);
1839 aFmt
.SetFirstLineIndent( - (*pArr
) );
1842 for( n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
1844 aFmt
.SetStart( n
+ 1 );
1846 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1848 aFmt
.SetAbsLSpace( *pArr
);
1850 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1852 aFmt
.SetListtabPos( *pArr
);
1853 aFmt
.SetIndentAt( *pArr
);
1856 pNewRule
->Set( n
, aFmt
);
1860 case RES_POOLNUMRULE_NUM5
:
1862 // [ First, LSpace ]
1863 static const sal_uInt16 aAbsSpace0to2
[] =
1865 227, 227, // 0.40, 0.40,
1866 369, 624, // 0.65, 1.10,
1867 255, 879 // 0.45, 1.55
1870 #ifdef USE_MEASUREMENT
1871 static const sal_uInt16 aAbsSpaceInch0to2
[] =
1877 const sal_uInt16
* pArr0to2
= MEASURE_METRIC
==
1878 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
1880 : aAbsSpaceInch0to2
;
1882 const sal_uInt16
* pArr0to2
= aAbsSpace0to2
;
1886 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
1887 aFmt
.SetNumberingType(SVX_NUM_ARABIC
);
1889 aFmt
.SetIncludeUpperLevels( 1 );
1890 aFmt
.SetSuffix( aDotStr
);
1892 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1894 aFmt
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
1897 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1899 aFmt
.SetFirstLineOffset( -pArr0to2
[0] ); // == 0.40 cm
1900 aFmt
.SetAbsLSpace( pArr0to2
[1] ); // == 0.40 cm
1902 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1904 aFmt
.SetFirstLineIndent( -pArr0to2
[0] );
1905 aFmt
.SetListtabPos( pArr0to2
[1] );
1906 aFmt
.SetIndentAt( pArr0to2
[1] );
1909 aFmt
.SetCharFmt( pNumCFmt
);
1910 pNewRule
->Set( 0, aFmt
);
1912 aFmt
.SetIncludeUpperLevels( 2 );
1915 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1917 aFmt
.SetFirstLineOffset( -pArr0to2
[2] ); // == 0.65 cm
1918 aFmt
.SetAbsLSpace( pArr0to2
[3] ); // == 1.10 cm
1920 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1922 aFmt
.SetFirstLineIndent( -pArr0to2
[2] );
1923 aFmt
.SetListtabPos( pArr0to2
[3] );
1924 aFmt
.SetIndentAt( pArr0to2
[3] );
1927 pNewRule
->Set( 1, aFmt
);
1929 aFmt
.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER
);
1930 aFmt
.SetSuffix(OUString(static_cast<sal_Unicode
>(')')));
1931 aFmt
.SetIncludeUpperLevels( 1 );
1934 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1936 aFmt
.SetFirstLineOffset( - pArr0to2
[4] ); // == 0.45cm
1937 aFmt
.SetAbsLSpace( pArr0to2
[5] ); // == 1.55 cm
1939 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1941 aFmt
.SetFirstLineIndent( -pArr0to2
[4] );
1942 aFmt
.SetListtabPos( pArr0to2
[5] );
1943 aFmt
.SetIndentAt( pArr0to2
[5] );
1946 pNewRule
->Set( 2, aFmt
);
1949 aFmt
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
1950 aFmt
.SetCharFmt( pBullCFmt
);
1951 aFmt
.SetBulletFont( &numfunc::GetDefBulletFont() );
1952 aFmt
.SetBulletChar( cBulletChar
);
1953 sal_uInt16 nOffs
= GetMetricVal( CM_01
) * 4,
1954 nOffs2
= GetMetricVal( CM_1
) * 2;
1956 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1958 aFmt
.SetFirstLineOffset( - nOffs
);
1960 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1962 aFmt
.SetFirstLineIndent( - nOffs
);
1965 aFmt
.SetSuffix( aEmptyStr
);
1966 for( n
= 3; n
< MAXLEVEL
; ++n
)
1968 aFmt
.SetStart( n
+1 );
1970 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1972 aFmt
.SetAbsLSpace( nOffs2
+ ((n
-3) * nOffs
) );
1974 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1976 aFmt
.SetListtabPos( nOffs2
+ ((n
-3) * nOffs
) );
1977 aFmt
.SetIndentAt( nOffs2
+ ((n
-3) * nOffs
) );
1980 pNewRule
->Set( n
, aFmt
);
1985 case RES_POOLNUMRULE_BUL1
:
1989 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
1990 aFmt
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
1991 aFmt
.SetCharFmt( pBullCFmt
);
1993 aFmt
.SetIncludeUpperLevels( 1 );
1994 aFmt
.SetBulletFont( &numfunc::GetDefBulletFont() );
1995 aFmt
.SetBulletChar( cBulletChar
);
1997 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
1999 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2000 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2002 #ifdef USE_MEASUREMENT
2003 static const sal_uInt16 aAbsSpaceInch
[ MAXLEVEL
] =
2005 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2007 const sal_uInt16
* pArr
= MEASURE_METRIC
==
2008 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2012 const sal_uInt16
* pArr
= aAbsSpace
;
2015 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2017 aFmt
.SetFirstLineOffset( - (*pArr
) );
2019 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2021 aFmt
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2022 aFmt
.SetFirstLineIndent( - (*pArr
) );
2025 for( n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2027 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2029 aFmt
.SetAbsLSpace( *pArr
);
2031 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2033 aFmt
.SetListtabPos( *pArr
);
2034 aFmt
.SetIndentAt( *pArr
);
2037 pNewRule
->Set( n
, aFmt
);
2041 case RES_POOLNUMRULE_BUL2
:
2045 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2046 aFmt
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2047 aFmt
.SetCharFmt( pBullCFmt
);
2049 aFmt
.SetIncludeUpperLevels( 1 );
2050 aFmt
.SetBulletFont( &numfunc::GetDefBulletFont() );
2051 aFmt
.SetBulletChar( 0x2013 );
2053 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
2055 // cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0
2056 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2058 #ifdef USE_MEASUREMENT
2059 static const sal_uInt16 aAbsSpaceInch
[ MAXLEVEL
] =
2061 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2063 const sal_uInt16
* pArr
= MEASURE_METRIC
==
2064 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2068 const sal_uInt16
* pArr
= aAbsSpace
;
2071 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2073 aFmt
.SetFirstLineOffset( - (*pArr
) );
2075 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2077 aFmt
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2078 aFmt
.SetFirstLineIndent( - (*pArr
) );
2081 for( n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2083 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2085 aFmt
.SetAbsLSpace( *pArr
);
2087 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2089 aFmt
.SetListtabPos( *pArr
);
2090 aFmt
.SetIndentAt( *pArr
);
2093 pNewRule
->Set( n
, aFmt
);
2097 case RES_POOLNUMRULE_BUL3
:
2101 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2103 aFmt
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2104 aFmt
.SetCharFmt( pBullCFmt
);
2106 aFmt
.SetIncludeUpperLevels( 1 );
2107 aFmt
.SetBulletFont( &numfunc::GetDefBulletFont() );
2109 sal_uInt16 nOffs
= GetMetricVal( CM_01
) * 4;
2111 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2113 aFmt
.SetFirstLineOffset( - nOffs
);
2115 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2117 aFmt
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2118 aFmt
.SetFirstLineIndent( - nOffs
);
2121 for( n
= 0; n
< MAXLEVEL
; ++n
)
2123 aFmt
.SetBulletChar( ( n
& 1 ? 0x25a1 : 0x2611 ) );
2125 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2127 aFmt
.SetAbsLSpace( ((n
& 1) +1) * nOffs
);
2129 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2131 aFmt
.SetListtabPos( ((n
& 1) +1) * nOffs
);
2132 aFmt
.SetIndentAt( ((n
& 1) +1) * nOffs
);
2135 pNewRule
->Set( n
, aFmt
);
2139 case RES_POOLNUMRULE_BUL4
:
2143 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2144 aFmt
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2145 aFmt
.SetCharFmt( pBullCFmt
);
2147 aFmt
.SetIncludeUpperLevels( 1 );
2148 aFmt
.SetBulletFont( &numfunc::GetDefBulletFont() );
2150 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
2152 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2153 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2155 #ifdef USE_MEASUREMENT
2156 static const sal_uInt16 aAbsSpaceInch
[ MAXLEVEL
] =
2158 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2160 const sal_uInt16
* pArr
= MEASURE_METRIC
==
2161 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2165 const sal_uInt16
* pArr
= aAbsSpace
;
2168 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2170 aFmt
.SetFirstLineOffset( - (*pArr
) );
2172 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2174 aFmt
.SetLabelFollowedBy( SvxNumberFormat::SPACE
);
2175 aFmt
.SetFirstLineIndent( - (*pArr
) );
2178 for( n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2182 case 0: aFmt
.SetBulletChar( 0x27a2 ); break;
2183 case 1: aFmt
.SetBulletChar( 0xE006 ); break;
2184 default: aFmt
.SetBulletChar( 0xE004 ); break;
2187 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2189 aFmt
.SetAbsLSpace( *pArr
);
2191 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2193 aFmt
.SetListtabPos( *pArr
);
2194 aFmt
.SetIndentAt( *pArr
);
2197 pNewRule
->Set( n
, aFmt
);
2201 case RES_POOLNUMRULE_BUL5
:
2205 aFmt
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2206 aFmt
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2207 aFmt
.SetCharFmt( pBullCFmt
);
2209 aFmt
.SetIncludeUpperLevels( 1 );
2210 aFmt
.SetBulletChar( 0x2717 );
2211 aFmt
.SetBulletFont( &numfunc::GetDefBulletFont() );
2213 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
2215 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2216 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2218 #ifdef USE_MEASUREMENT
2219 static const sal_uInt16 aAbsSpaceInch
[ MAXLEVEL
] =
2221 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2223 const sal_uInt16
* pArr
= MEASURE_METRIC
==
2224 SvtSysLocale().GetLocaleData().getMeasurementSystemEnum()
2228 const sal_uInt16
* pArr
= aAbsSpace
;
2231 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2233 aFmt
.SetFirstLineOffset( - (*pArr
) );
2235 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2237 aFmt
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2238 aFmt
.SetFirstLineIndent( - (*pArr
) );
2241 for( n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2243 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2245 aFmt
.SetAbsLSpace( *pArr
);
2247 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2249 aFmt
.SetListtabPos( *pArr
);
2250 aFmt
.SetIndentAt( *pArr
);
2253 pNewRule
->Set( n
, aFmt
);
2262 /// Check if this AutoCollection is already/still in use in this Document
2263 bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId
) const
2265 OSL_ENSURE( RES_POOLPAGE_BEGIN
<= nId
&& nId
< RES_POOLPAGE_END
,
2266 "Wrong AutoFormat Id" );
2267 SwPageDesc
*pNewPgDsc
= 0;
2269 for( sal_uInt16 n
= 0; !bFnd
&& n
< maPageDescs
.size(); ++n
)
2271 pNewPgDsc
= maPageDescs
[ n
];
2272 if( nId
== pNewPgDsc
->GetPoolFmtId() )
2276 // Not found or no dependencies?
2277 if( !bFnd
|| !pNewPgDsc
->GetDepends() ) // ??????
2280 // Check if we have dependent ContentNodes in the Nodes array
2281 // (also indirect ones for derived Formats)
2282 SwAutoFmtGetDocNode
aGetHt( &GetNodes() );
2283 return !pNewPgDsc
->GetInfo( aGetHt
);
2286 // See if the Paragraph/Character/Frame/Page style is in use
2287 bool SwDoc::IsUsed( const SwModify
& rModify
) const
2289 // Check if we have dependent ContentNodes in the Nodes array
2290 // (also indirect ones for derived Formats)
2291 SwAutoFmtGetDocNode
aGetHt( &GetNodes() );
2292 return !rModify
.GetInfo( aGetHt
);
2295 // See if the NumRule is used
2296 bool SwDoc::IsUsed( const SwNumRule
& rRule
) const
2298 bool bUsed
= rRule
.GetTxtNodeListSize() > 0 ||
2299 rRule
.GetParagraphStyleListSize() > 0;
2304 // Look for the style name's position. If it doesn't exist,
2306 sal_uInt16
SwDoc::SetDocPattern( const String
& rPatternName
)
2308 OSL_ENSURE( rPatternName
.Len(), "no Document style name" );
2310 size_t nNewPos
= maPatternNms
.size();
2311 for(size_t n
= 0; n
< maPatternNms
.size(); ++n
)
2312 if( boost::is_null(maPatternNms
.begin() + n
) )
2314 if( nNewPos
== maPatternNms
.size() )
2317 else if( rPatternName
== maPatternNms
[n
] )
2320 if( nNewPos
< maPatternNms
.size() )
2321 maPatternNms
.erase(maPatternNms
.begin() + nNewPos
); // Free space again
2323 maPatternNms
.insert(maPatternNms
.begin() + nNewPos
, new String(rPatternName
));
2328 sal_uInt16
GetPoolParent( sal_uInt16 nId
)
2330 sal_uInt16 nRet
= USHRT_MAX
;
2331 if( POOLGRP_NOCOLLID
& nId
) // 1 == Formats / 0 == Collections
2333 switch( ( COLL_GET_RANGE_BITS
| POOLGRP_NOCOLLID
) & nId
)
2335 case POOLGRP_CHARFMT
:
2336 case POOLGRP_FRAMEFMT
:
2337 nRet
= 0; // derived from the default
2339 case POOLGRP_PAGEDESC
:
2340 case POOLGRP_NUMRULE
:
2341 break; // there are no derivations
2346 switch( COLL_GET_RANGE_BITS
& nId
)
2348 case COLL_TEXT_BITS
:
2351 case RES_POOLCOLL_STANDARD
:
2353 case RES_POOLCOLL_TEXT_IDENT
:
2354 case RES_POOLCOLL_TEXT_NEGIDENT
:
2355 case RES_POOLCOLL_TEXT_MOVE
:
2356 case RES_POOLCOLL_CONFRONTATION
:
2357 case RES_POOLCOLL_MARGINAL
:
2358 nRet
= RES_POOLCOLL_TEXT
; break;
2360 case RES_POOLCOLL_TEXT
:
2361 case RES_POOLCOLL_GREETING
:
2362 case RES_POOLCOLL_SIGNATURE
:
2363 case RES_POOLCOLL_HEADLINE_BASE
:
2364 nRet
= RES_POOLCOLL_STANDARD
; break;
2366 case RES_POOLCOLL_HEADLINE1
:
2367 case RES_POOLCOLL_HEADLINE2
:
2368 case RES_POOLCOLL_HEADLINE3
:
2369 case RES_POOLCOLL_HEADLINE4
:
2370 case RES_POOLCOLL_HEADLINE5
:
2371 case RES_POOLCOLL_HEADLINE6
:
2372 case RES_POOLCOLL_HEADLINE7
:
2373 case RES_POOLCOLL_HEADLINE8
:
2374 case RES_POOLCOLL_HEADLINE9
:
2375 case RES_POOLCOLL_HEADLINE10
:
2376 nRet
= RES_POOLCOLL_HEADLINE_BASE
; break;
2380 case COLL_LISTS_BITS
:
2383 case RES_POOLCOLL_NUMBUL_BASE
:
2384 nRet
= RES_POOLCOLL_TEXT
; break;
2387 nRet
= RES_POOLCOLL_NUMBUL_BASE
; break;
2391 case COLL_EXTRA_BITS
:
2394 case RES_POOLCOLL_TABLE_HDLN
:
2395 nRet
= RES_POOLCOLL_TABLE
; break;
2397 case RES_POOLCOLL_FRAME
:
2398 case RES_POOLCOLL_TABLE
:
2399 case RES_POOLCOLL_FOOTNOTE
:
2400 case RES_POOLCOLL_ENDNOTE
:
2401 case RES_POOLCOLL_JAKETADRESS
:
2402 case RES_POOLCOLL_SENDADRESS
:
2403 case RES_POOLCOLL_HEADER
:
2404 case RES_POOLCOLL_HEADERL
:
2405 case RES_POOLCOLL_HEADERR
:
2406 case RES_POOLCOLL_FOOTER
:
2407 case RES_POOLCOLL_FOOTERL
:
2408 case RES_POOLCOLL_FOOTERR
:
2409 case RES_POOLCOLL_LABEL
:
2410 nRet
= RES_POOLCOLL_STANDARD
; break;
2412 case RES_POOLCOLL_LABEL_ABB
:
2413 case RES_POOLCOLL_LABEL_TABLE
:
2414 case RES_POOLCOLL_LABEL_FRAME
:
2415 case RES_POOLCOLL_LABEL_DRAWING
:
2416 nRet
= RES_POOLCOLL_LABEL
; break;
2420 case COLL_REGISTER_BITS
:
2423 case RES_POOLCOLL_REGISTER_BASE
:
2424 nRet
= RES_POOLCOLL_STANDARD
; break;
2426 case RES_POOLCOLL_TOX_USERH
:
2427 case RES_POOLCOLL_TOX_CNTNTH
:
2428 case RES_POOLCOLL_TOX_IDXH
:
2429 case RES_POOLCOLL_TOX_ILLUSH
:
2430 case RES_POOLCOLL_TOX_OBJECTH
:
2431 case RES_POOLCOLL_TOX_TABLESH
:
2432 case RES_POOLCOLL_TOX_AUTHORITIESH
:
2433 nRet
= RES_POOLCOLL_HEADLINE_BASE
; break;
2436 nRet
= RES_POOLCOLL_REGISTER_BASE
; break;
2441 nRet
= RES_POOLCOLL_HEADLINE_BASE
;
2444 case COLL_HTML_BITS
:
2445 nRet
= RES_POOLCOLL_STANDARD
;
2453 void SwDoc::RemoveAllFmtLanguageDependencies()
2455 /* Restore the language independ pool defaults and styles. */
2456 GetAttrPool().ResetPoolDefaultItem( RES_PARATR_ADJUST
);
2458 SwTxtFmtColl
* pTxtFmtColl
= GetTxtCollFromPool( RES_POOLCOLL_STANDARD
);
2460 pTxtFmtColl
->ResetFmtAttr( RES_PARATR_ADJUST
);
2461 /* koreans do not like SvxScriptItem(TRUE) */
2462 pTxtFmtColl
->ResetFmtAttr( RES_PARATR_SCRIPTSPACE
);
2464 SvxFrameDirectionItem
aFrameDir( FRMDIR_HORI_LEFT_TOP
, RES_FRAMEDIR
);
2466 sal_uInt16 nCount
= GetPageDescCnt();
2467 for( sal_uInt16 i
=0; i
<nCount
; ++i
)
2469 SwPageDesc
& rDesc
= GetPageDesc( i
);
2470 rDesc
.GetMaster().SetFmtAttr( aFrameDir
);
2471 rDesc
.GetLeft().SetFmtAttr( aFrameDir
);
2474 //#i16874# AutoKerning as default for new documents
2475 GetAttrPool().ResetPoolDefaultItem( RES_CHRATR_AUTOKERN
);
2478 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */