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 .
19 #include <DocumentStylePoolManager.hxx>
20 #include <SwStyleNameMapper.hxx>
22 #include <DocumentSettingManager.hxx>
23 #include <IDocumentState.hxx>
24 #include <IDocumentUndoRedo.hxx>
25 #include <fmtanchr.hxx>
26 #include <fmtfsize.hxx>
28 #include <poolfmt.hxx>
29 #include <fmtornt.hxx>
30 #include <charfmt.hxx>
31 #include <fmtsrnd.hxx>
33 #include <pagedesc.hxx>
35 #include <fmtline.hxx>
36 #include <numrule.hxx>
38 #include <editeng/paperinf.hxx>
39 #include <editeng/wghtitem.hxx>
40 #include <editeng/fontitem.hxx>
41 #include <editeng/fhgtitem.hxx>
42 #include <editeng/tstpitem.hxx>
43 #include <editeng/lrspitem.hxx>
44 #include <editeng/ulspitem.hxx>
45 #include <editeng/lspcitem.hxx>
46 #include <editeng/adjustitem.hxx>
47 #include <editeng/postitem.hxx>
48 #include <editeng/keepitem.hxx>
49 #include <editeng/opaqitem.hxx>
50 #include <editeng/boxitem.hxx>
51 #include <editeng/cmapitem.hxx>
52 #include <editeng/udlnitem.hxx>
53 #include <editeng/colritem.hxx>
54 #include <editeng/protitem.hxx>
55 #include <editeng/escapementitem.hxx>
56 #include <editeng/langitem.hxx>
57 #include <editeng/charrotateitem.hxx>
58 #include <editeng/emphasismarkitem.hxx>
59 #include <editeng/scriptspaceitem.hxx>
60 #include <o3tl/unit_conversion.hxx>
61 #include <svx/strings.hrc>
62 #include <svx/dialmgr.hxx>
63 #include <sal/log.hxx>
64 #include <osl/diagnose.h>
65 #include <strings.hrc>
67 #include <frameformats.hxx>
68 #include <com/sun/star/text/VertOrientation.hpp>
69 #include <com/sun/star/text/RelOrientation.hpp>
70 #include <com/sun/star/text/HoriOrientation.hpp>
71 #include <unotools/syslocale.hxx>
72 #include <i18nlangtag/languagetag.hxx>
73 #include <comphelper/lok.hxx>
75 using namespace ::editeng
;
76 using namespace ::com::sun::star
;
78 bool IsConditionalByPoolId(sal_uInt16 nId
)
80 // TODO: why is this style conditional?
81 // If it is changed to no longer be conditional, then a style "Text Body"
82 // will be imported without its conditions from ODF.
83 return RES_POOLCOLL_TEXT
== nId
;
88 const sal_uInt16 PT_3
= 3 * 20; // 3 pt
89 const sal_uInt16 PT_6
= 6 * 20; // 6 pt
90 const sal_uInt16 PT_7
= 7 * 20; // 7 pt
91 const sal_uInt16 PT_9
= 9 * 20; // 9 pt
92 const sal_uInt16 PT_10
= 10 * 20; // 10 pt
93 const sal_uInt16 PT_12
= 12 * 20; // 12 pt
94 const sal_uInt16 PT_13
= 13 * 20; // 13 pt
95 const sal_uInt16 PT_14
= 14 * 20; // 14 pt
96 const sal_uInt16 PT_16
= 16 * 20; // 16 pt
97 const sal_uInt16 PT_18
= 18 * 20; // 18 pt
98 const sal_uInt16 PT_24
= 24 * 20; // 24 pt
99 const sal_uInt16 PT_28
= 28 * 20; // 28 pt
101 const sal_uInt16 HTML_PARSPACE
= o3tl::convert(5, o3tl::Length::mm
, o3tl::Length::twip
);
103 const sal_uInt16 aHeadlineSizes
[ 2 * MAXLEVEL
] = {
104 // we do everything percentual now:
105 PT_18
, PT_16
, PT_14
, PT_13
, PT_12
,
106 PT_12
, PT_10
, PT_10
, PT_9
, PT_9
, // normal
108 PT_24
, PT_18
, PT_14
, PT_12
, PT_10
,
109 PT_7
, PT_7
, PT_7
, PT_7
, PT_7
// HTML mode
112 tools::Long
lcl_GetRightMargin( SwDoc
& rDoc
)
114 // Make sure that the printer settings are taken over to the standard
116 const SwFrameFormat
& rPgDscFormat
= rDoc
.GetPageDesc( 0 ).GetMaster();
117 const SvxLRSpaceItem
& rLR
= rPgDscFormat
.GetLRSpace();
118 const tools::Long nLeft
= rLR
.GetLeft();
119 const tools::Long nRight
= rLR
.GetRight();
120 const tools::Long nWidth
= rPgDscFormat
.GetFrameSize().GetWidth();
121 return nWidth
- nLeft
- nRight
;
124 void lcl_SetDfltFont( DefaultFontType nFntType
, SfxItemSet
& rSet
)
127 sal_uInt16 nResLngId
;
128 sal_uInt16 nResFntId
;
130 { RES_CHRATR_LANGUAGE
, RES_CHRATR_FONT
},
131 { RES_CHRATR_CJK_LANGUAGE
, RES_CHRATR_CJK_FONT
},
132 { RES_CHRATR_CTL_LANGUAGE
, RES_CHRATR_CTL_FONT
}
134 for(const auto & n
: aArr
)
136 LanguageType nLng
= static_cast<const SvxLanguageItem
&>(rSet
.GetPool()->GetDefaultItem(
137 n
.nResLngId
)).GetLanguage();
138 vcl::Font
aFnt( OutputDevice::GetDefaultFont( nFntType
,
139 nLng
, GetDefaultFontFlags::OnlyOne
) );
141 rSet
.Put( SvxFontItem( aFnt
.GetFamilyType(), aFnt
.GetFamilyName(),
142 OUString(), aFnt
.GetPitch(),
143 aFnt
.GetCharSet(), n
.nResFntId
));
147 void lcl_SetDfltFont( DefaultFontType nLatinFntType
, DefaultFontType nCJKFntType
,
148 DefaultFontType nCTLFntType
, SfxItemSet
& rSet
)
151 sal_uInt16 nResLngId
;
152 sal_uInt16 nResFntId
;
153 DefaultFontType nFntType
;
155 { RES_CHRATR_LANGUAGE
, RES_CHRATR_FONT
, static_cast<DefaultFontType
>(0) },
156 { RES_CHRATR_CJK_LANGUAGE
, RES_CHRATR_CJK_FONT
, static_cast<DefaultFontType
>(0) },
157 { RES_CHRATR_CTL_LANGUAGE
, RES_CHRATR_CTL_FONT
, static_cast<DefaultFontType
>(0) }
159 aArr
[0].nFntType
= nLatinFntType
;
160 aArr
[1].nFntType
= nCJKFntType
;
161 aArr
[2].nFntType
= nCTLFntType
;
163 for(const auto & n
: aArr
)
165 LanguageType nLng
= static_cast<const SvxLanguageItem
&>(rSet
.GetPool()->GetDefaultItem(
166 n
.nResLngId
)).GetLanguage();
167 vcl::Font
aFnt( OutputDevice::GetDefaultFont( n
.nFntType
,
168 nLng
, GetDefaultFontFlags::OnlyOne
) );
170 rSet
.Put( SvxFontItem( aFnt
.GetFamilyType(), aFnt
.GetFamilyName(),
171 OUString(), aFnt
.GetPitch(),
172 aFnt
.GetCharSet(), n
.nResFntId
));
176 void lcl_SetHeadline( SwDoc
& rDoc
, SwTextFormatColl
* pColl
,
178 sal_uInt16 nOutLvlBits
, sal_uInt8 nLevel
, bool bItalic
)
180 SetAllScriptItem( rSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
181 SvxFontHeightItem
aHItem(240, 100, RES_CHRATR_FONTSIZE
);
182 const bool bHTMLMode
= rDoc
.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE
);
184 aHItem
.SetHeight( aHeadlineSizes
[ MAXLEVEL
+ nLevel
] );
186 aHItem
.SetHeight( aHeadlineSizes
[ nLevel
] );
187 SetAllScriptItem( rSet
, aHItem
);
189 if( bItalic
&& !bHTMLMode
)
190 SetAllScriptItem( rSet
, SvxPostureItem( ITALIC_NORMAL
, RES_CHRATR_POSTURE
) );
194 lcl_SetDfltFont( DefaultFontType::LATIN_TEXT
, DefaultFontType::CJK_TEXT
,
195 DefaultFontType::CTL_TEXT
, rSet
);
201 if( !( nOutLvlBits
& ( 1 << nLevel
)) )
203 pColl
->AssignToListLevelOfOutlineStyle(nLevel
);
206 SwNumRule
* pOutlineRule
= rDoc
.GetOutlineNumRule();
207 const SwNumFormat
& rNFormat
= pOutlineRule
->Get( nLevel
);
209 if ( rNFormat
.GetPositionAndSpaceMode() ==
210 SvxNumberFormat::LABEL_WIDTH_AND_POSITION
&&
211 ( rNFormat
.GetAbsLSpace() || rNFormat
.GetFirstLineOffset() ) )
213 SvxFirstLineIndentItem
firstLine(pColl
->GetFormatAttr(RES_MARGIN_FIRSTLINE
));
214 SvxTextLeftMarginItem
leftMargin(pColl
->GetFormatAttr(RES_MARGIN_TEXTLEFT
));
215 firstLine
.SetTextFirstLineOffsetValue(rNFormat
.GetFirstLineOffset());
217 leftMargin
.SetTextLeft(rNFormat
.GetAbsLSpace());
218 pColl
->SetFormatAttr(firstLine
);
219 pColl
->SetFormatAttr(leftMargin
);
222 // All paragraph styles, which are assigned to a level of the
223 // outline style has to have the outline style set as its list style.
224 SwNumRuleItem
aItem(pOutlineRule
->GetName());
225 pColl
->SetFormatAttr(aItem
);
228 pColl
->SetNextTextFormatColl( *rDoc
.getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TEXT
));
231 void lcl_SetRegister( SwDoc
& rDoc
, SfxItemSet
& rSet
, sal_uInt16 nFact
,
232 bool bHeader
, bool bTab
)
234 sal_uInt16 nLeft
= o3tl::convert(5 * nFact
, o3tl::Length::mm
, o3tl::Length::twip
);
235 SvxFirstLineIndentItem
const firstLine(0, RES_MARGIN_FIRSTLINE
);
236 SvxTextLeftMarginItem
const leftMargin(nLeft
, RES_MARGIN_TEXTLEFT
);
238 rSet
.Put(leftMargin
);
241 SetAllScriptItem( rSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
242 SetAllScriptItem( rSet
, SvxFontHeightItem( PT_16
, 100, RES_CHRATR_FONTSIZE
) );
246 tools::Long nRightMargin
= lcl_GetRightMargin( rDoc
);
247 SvxTabStopItem
aTStops( 0, 0, SvxTabAdjust::Default
, RES_PARATR_TABSTOP
);
248 aTStops
.Insert( SvxTabStop( nRightMargin
- nLeft
,
250 cDfltDecimalChar
, '.' ));
255 void lcl_SetNumBul( SwDoc
& rDoc
, SwTextFormatColl
* pColl
,
257 sal_uInt16 nNxt
, SwTwips nEZ
, SwTwips nLeft
,
258 SwTwips nUpper
, SwTwips nLower
)
260 SvxFirstLineIndentItem
const firstLine(sal_uInt16(nEZ
), RES_MARGIN_FIRSTLINE
);
261 SvxTextLeftMarginItem
const leftMargin(sal_uInt16(nLeft
), RES_MARGIN_TEXTLEFT
);
263 rSet
.Put(leftMargin
);
264 SvxULSpaceItem
aUL( RES_UL_SPACE
);
265 aUL
.SetUpper( sal_uInt16(nUpper
) );
266 aUL
.SetLower( sal_uInt16(nLower
) );
270 pColl
->SetNextTextFormatColl( *rDoc
.getIDocumentStylePoolAccess().GetTextCollFromPool( nNxt
));
273 void lcl_PutStdPageSizeIntoItemSet( SwDoc
& rDoc
, SfxItemSet
& rSet
)
275 SwPageDesc
* pStdPgDsc
= rDoc
.getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_STANDARD
);
276 SwFormatFrameSize
aFrameSz( pStdPgDsc
->GetMaster().GetFrameSize() );
277 if( pStdPgDsc
->GetLandscape() )
279 SwTwips nTmp
= aFrameSz
.GetHeight();
280 aFrameSz
.SetHeight( aFrameSz
.GetWidth() );
281 aFrameSz
.SetWidth( nTmp
);
283 rSet
.Put( aFrameSz
);
287 const TranslateId STR_POOLCOLL_TEXT_ARY
[] =
290 STR_POOLCOLL_STANDARD
,
292 STR_POOLCOLL_TEXT_IDENT
,
293 STR_POOLCOLL_TEXT_NEGIDENT
,
294 STR_POOLCOLL_TEXT_MOVE
,
295 STR_POOLCOLL_GREETING
,
296 STR_POOLCOLL_SIGNATURE
,
297 STR_POOLCOLL_CONFRONTATION
,
298 STR_POOLCOLL_MARGINAL
,
299 // Subcategory Headlines
300 STR_POOLCOLL_HEADLINE_BASE
,
301 STR_POOLCOLL_HEADLINE1
,
302 STR_POOLCOLL_HEADLINE2
,
303 STR_POOLCOLL_HEADLINE3
,
304 STR_POOLCOLL_HEADLINE4
,
305 STR_POOLCOLL_HEADLINE5
,
306 STR_POOLCOLL_HEADLINE6
,
307 STR_POOLCOLL_HEADLINE7
,
308 STR_POOLCOLL_HEADLINE8
,
309 STR_POOLCOLL_HEADLINE9
,
310 STR_POOLCOLL_HEADLINE10
313 const TranslateId STR_POOLCOLL_LISTS_ARY
[]
316 STR_POOLCOLL_NUMBER_BULLET_BASE
,
317 // Subcategory Numbering
318 STR_POOLCOLL_NUM_LEVEL1S
,
319 STR_POOLCOLL_NUM_LEVEL1
,
320 STR_POOLCOLL_NUM_LEVEL1E
,
321 STR_POOLCOLL_NUM_NONUM1
,
322 STR_POOLCOLL_NUM_LEVEL2S
,
323 STR_POOLCOLL_NUM_LEVEL2
,
324 STR_POOLCOLL_NUM_LEVEL2E
,
325 STR_POOLCOLL_NUM_NONUM2
,
326 STR_POOLCOLL_NUM_LEVEL3S
,
327 STR_POOLCOLL_NUM_LEVEL3
,
328 STR_POOLCOLL_NUM_LEVEL3E
,
329 STR_POOLCOLL_NUM_NONUM3
,
330 STR_POOLCOLL_NUM_LEVEL4S
,
331 STR_POOLCOLL_NUM_LEVEL4
,
332 STR_POOLCOLL_NUM_LEVEL4E
,
333 STR_POOLCOLL_NUM_NONUM4
,
334 STR_POOLCOLL_NUM_LEVEL5S
,
335 STR_POOLCOLL_NUM_LEVEL5
,
336 STR_POOLCOLL_NUM_LEVEL5E
,
337 STR_POOLCOLL_NUM_NONUM5
,
339 // Subcategory Enumeration
340 STR_POOLCOLL_BULLET_LEVEL1S
,
341 STR_POOLCOLL_BULLET_LEVEL1
,
342 STR_POOLCOLL_BULLET_LEVEL1E
,
343 STR_POOLCOLL_BULLET_NONUM1
,
344 STR_POOLCOLL_BULLET_LEVEL2S
,
345 STR_POOLCOLL_BULLET_LEVEL2
,
346 STR_POOLCOLL_BULLET_LEVEL2E
,
347 STR_POOLCOLL_BULLET_NONUM2
,
348 STR_POOLCOLL_BULLET_LEVEL3S
,
349 STR_POOLCOLL_BULLET_LEVEL3
,
350 STR_POOLCOLL_BULLET_LEVEL3E
,
351 STR_POOLCOLL_BULLET_NONUM3
,
352 STR_POOLCOLL_BULLET_LEVEL4S
,
353 STR_POOLCOLL_BULLET_LEVEL4
,
354 STR_POOLCOLL_BULLET_LEVEL4E
,
355 STR_POOLCOLL_BULLET_NONUM4
,
356 STR_POOLCOLL_BULLET_LEVEL5S
,
357 STR_POOLCOLL_BULLET_LEVEL5
,
358 STR_POOLCOLL_BULLET_LEVEL5E
,
359 STR_POOLCOLL_BULLET_NONUM5
363 const TranslateId STR_POOLCOLL_EXTRA_ARY
[]
365 // Subcategory Header
366 STR_POOLCOLL_HEADERFOOTER
,
368 STR_POOLCOLL_HEADERL
,
369 STR_POOLCOLL_HEADERR
,
370 // Subcategory Footer
372 STR_POOLCOLL_FOOTERL
,
373 STR_POOLCOLL_FOOTERR
,
376 STR_POOLCOLL_TABLE_HDLN
,
377 // Subcategory Labels
379 STR_POOLCOLL_LABEL_ABB
,
380 STR_POOLCOLL_LABEL_TABLE
,
381 STR_POOLCOLL_LABEL_FRAME
,
382 STR_POOLCOLL_LABEL_FIGURE
,
385 STR_POOLCOLL_FOOTNOTE
,
386 STR_POOLCOLL_ENVELOPE_ADDRESS
,
387 STR_POOLCOLL_SEND_ADDRESS
,
388 STR_POOLCOLL_ENDNOTE
,
389 STR_POOLCOLL_LABEL_DRAWING
392 const TranslateId STR_POOLCOLL_REGISTER_ARY
[] =
394 // Category Directories
395 STR_POOLCOLL_REGISTER_BASE
,
396 // Subcategory Index-Directories
397 STR_POOLCOLL_TOX_IDXH
,
398 STR_POOLCOLL_TOX_IDX1
,
399 STR_POOLCOLL_TOX_IDX2
,
400 STR_POOLCOLL_TOX_IDX3
,
401 STR_POOLCOLL_TOX_IDXBREAK
,
402 // Subcategory Tables of Contents
403 STR_POOLCOLL_TOX_CNTNTH
,
404 STR_POOLCOLL_TOX_CNTNT1
,
405 STR_POOLCOLL_TOX_CNTNT2
,
406 STR_POOLCOLL_TOX_CNTNT3
,
407 STR_POOLCOLL_TOX_CNTNT4
,
408 STR_POOLCOLL_TOX_CNTNT5
,
409 // Subcategory User-Directories:
410 STR_POOLCOLL_TOX_USERH
,
411 STR_POOLCOLL_TOX_USER1
,
412 STR_POOLCOLL_TOX_USER2
,
413 STR_POOLCOLL_TOX_USER3
,
414 STR_POOLCOLL_TOX_USER4
,
415 STR_POOLCOLL_TOX_USER5
,
416 // Subcategory Table of Contents more Levels 5 - 10
417 STR_POOLCOLL_TOX_CNTNT6
,
418 STR_POOLCOLL_TOX_CNTNT7
,
419 STR_POOLCOLL_TOX_CNTNT8
,
420 STR_POOLCOLL_TOX_CNTNT9
,
421 STR_POOLCOLL_TOX_CNTNT10
,
422 // Illustrations Index
423 STR_POOLCOLL_TOX_ILLUSH
,
424 STR_POOLCOLL_TOX_ILLUS1
,
426 STR_POOLCOLL_TOX_OBJECTH
,
427 STR_POOLCOLL_TOX_OBJECT1
,
429 STR_POOLCOLL_TOX_TABLESH
,
430 STR_POOLCOLL_TOX_TABLES1
,
431 // Index of Authorities
432 STR_POOLCOLL_TOX_AUTHORITIESH
,
433 STR_POOLCOLL_TOX_AUTHORITIES1
,
434 // Subcategory User-Directories more Levels 5 - 10
435 STR_POOLCOLL_TOX_USER6
,
436 STR_POOLCOLL_TOX_USER7
,
437 STR_POOLCOLL_TOX_USER8
,
438 STR_POOLCOLL_TOX_USER9
,
439 STR_POOLCOLL_TOX_USER10
442 const TranslateId STR_POOLCOLL_DOC_ARY
[] =
444 // Category Chapter/Document
445 STR_POOLCOLL_DOC_TITLE
,
446 STR_POOLCOLL_DOC_SUBTITLE
,
447 STR_POOLCOLL_DOC_APPENDIX
450 const TranslateId STR_POOLCOLL_HTML_ARY
[] =
452 // Category HTML-Templates
453 STR_POOLCOLL_HTML_BLOCKQUOTE
,
454 STR_POOLCOLL_HTML_PRE
,
455 STR_POOLCOLL_HTML_HR
,
456 STR_POOLCOLL_HTML_DD
,
460 const TranslateId STR_POOLCHR_ARY
[] =
462 STR_POOLCHR_FOOTNOTE
,
465 STR_POOLCHR_DROPCAPS
,
466 STR_POOLCHR_NUM_LEVEL
,
467 STR_POOLCHR_BULLET_LEVEL
,
468 STR_POOLCHR_INET_NORMAL
,
469 STR_POOLCHR_INET_VISIT
,
470 STR_POOLCHR_JUMPEDIT
,
474 STR_POOLCHR_IDX_MAIN_ENTRY
,
475 STR_POOLCHR_FOOTNOTE_ANCHOR
,
476 STR_POOLCHR_ENDNOTE_ANCHOR
,
477 STR_POOLCHR_RUBYTEXT
,
481 const TranslateId STR_POOLCHR_HTML_ARY
[] =
483 STR_POOLCHR_HTML_EMPHASIS
,
484 STR_POOLCHR_HTML_CITATION
,
485 STR_POOLCHR_HTML_STRONG
,
486 STR_POOLCHR_HTML_CODE
,
487 STR_POOLCHR_HTML_SAMPLE
,
488 STR_POOLCHR_HTML_KEYBOARD
,
489 STR_POOLCHR_HTML_VARIABLE
,
490 STR_POOLCHR_HTML_DEFINSTANCE
,
491 STR_POOLCHR_HTML_TELETYPE
494 const TranslateId STR_POOLFRM_ARY
[] =
500 STR_POOLFRM_MARGINAL
,
501 STR_POOLFRM_WATERSIGN
,
505 const TranslateId STR_POOLPAGE_ARY
[] =
508 STR_POOLPAGE_STANDARD
,
512 STR_POOLPAGE_ENVELOPE
,
513 STR_POOLPAGE_REGISTER
,
515 STR_POOLPAGE_FOOTNOTE
,
516 STR_POOLPAGE_ENDNOTE
,
517 STR_POOLPAGE_LANDSCAPE
520 const TranslateId STR_POOLNUMRULE_NUM_ARY
[] =
523 STR_POOLNUMRULE_NOLIST
,
524 STR_POOLNUMRULE_NUM1
,
525 STR_POOLNUMRULE_NUM2
,
526 STR_POOLNUMRULE_NUM3
,
527 STR_POOLNUMRULE_NUM4
,
528 STR_POOLNUMRULE_NUM5
,
529 STR_POOLNUMRULE_BUL1
,
530 STR_POOLNUMRULE_BUL2
,
531 STR_POOLNUMRULE_BUL3
,
532 STR_POOLNUMRULE_BUL4
,
536 // XXX MUST match the entries of TableStyleProgNameTable in
537 // sw/source/core/doc/SwStyleNameMapper.cxx and MUST match the order of
538 // RES_POOL_TABLESTYLE_TYPE in sw/inc/poolfmt.hxx
539 const TranslateId STR_TABSTYLE_ARY
[] =
541 // XXX MUST be in order, Writer first, then Svx old, then Svx new
542 // 1 Writer resource string
543 STR_TABSTYLE_DEFAULT
,
544 // 16 old styles Svx resource strings
545 RID_SVXSTR_TBLAFMT_3D
,
546 RID_SVXSTR_TBLAFMT_BLACK1
,
547 RID_SVXSTR_TBLAFMT_BLACK2
,
548 RID_SVXSTR_TBLAFMT_BLUE
,
549 RID_SVXSTR_TBLAFMT_BROWN
,
550 RID_SVXSTR_TBLAFMT_CURRENCY
,
551 RID_SVXSTR_TBLAFMT_CURRENCY_3D
,
552 RID_SVXSTR_TBLAFMT_CURRENCY_GRAY
,
553 RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER
,
554 RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE
,
555 RID_SVXSTR_TBLAFMT_GRAY
,
556 RID_SVXSTR_TBLAFMT_GREEN
,
557 RID_SVXSTR_TBLAFMT_LAVENDER
,
558 RID_SVXSTR_TBLAFMT_RED
,
559 RID_SVXSTR_TBLAFMT_TURQUOISE
,
560 RID_SVXSTR_TBLAFMT_YELLOW
,
561 // 10 new styles since LibreOffice 6.0 Svx resource strings
562 RID_SVXSTR_TBLAFMT_LO6_ACADEMIC
,
563 RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_BLUE
,
564 RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_GREEN
,
565 RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_RED
,
566 RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_YELLOW
,
567 RID_SVXSTR_TBLAFMT_LO6_ELEGANT
,
568 RID_SVXSTR_TBLAFMT_LO6_FINANCIAL
,
569 RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_COLUMNS
,
570 RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_ROWS
,
571 RID_SVXSTR_TBLAFMT_LO6_SIMPLE_LIST_SHADED
577 DocumentStylePoolManager::DocumentStylePoolManager( SwDoc
& i_rSwdoc
) : m_rDoc( i_rSwdoc
)
581 SwTextFormatColl
* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId
, bool bRegardLanguage
)
584 (RES_POOLCOLL_TEXT_BEGIN
<= nId
&& nId
< RES_POOLCOLL_TEXT_END
) ||
585 (RES_POOLCOLL_LISTS_BEGIN
<= nId
&& nId
< RES_POOLCOLL_LISTS_END
) ||
586 (RES_POOLCOLL_EXTRA_BEGIN
<= nId
&& nId
< RES_POOLCOLL_EXTRA_END
) ||
587 (RES_POOLCOLL_REGISTER_BEGIN
<= nId
&& nId
< RES_POOLCOLL_REGISTER_END
) ||
588 (RES_POOLCOLL_DOC_BEGIN
<= nId
&& nId
< RES_POOLCOLL_DOC_END
) ||
589 (RES_POOLCOLL_HTML_BEGIN
<= nId
&& nId
< RES_POOLCOLL_HTML_END
),
590 "Wrong AutoFormat Id" );
592 SwTextFormatColl
* pNewColl
;
593 sal_uInt16 nOutLvlBits
= 0;
595 for (size_t n
= 0, nSize
= m_rDoc
.GetTextFormatColls()->size(); n
< nSize
; ++n
)
597 pNewColl
= (*m_rDoc
.GetTextFormatColls())[ n
];
598 if( nId
== pNewColl
->GetPoolFormatId() )
600 // in online we can have multiple languages, use translated name
601 if (comphelper::LibreOfficeKit::isActive())
604 SwStyleNameMapper::GetUIName(nId
, aName
);
605 if (!aName
.isEmpty())
606 pNewColl
->SetFormatName(aName
);
612 if( pNewColl
->IsAssignedToListLevelOfOutlineStyle())
613 nOutLvlBits
|= ( 1 << pNewColl
->GetAssignedOutlineStyleLevel() );
616 // Didn't find it until here -> create anew
618 if (RES_POOLCOLL_TEXT_BEGIN
<= nId
&& nId
< RES_POOLCOLL_TEXT_END
)
620 static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_TEXT_ARY
) == RES_POOLCOLL_TEXT_END
- RES_POOLCOLL_TEXT_BEGIN
, "### unexpected size!");
621 pResId
= STR_POOLCOLL_TEXT_ARY
[nId
- RES_POOLCOLL_TEXT_BEGIN
];
623 else if (RES_POOLCOLL_LISTS_BEGIN
<= nId
&& nId
< RES_POOLCOLL_LISTS_END
)
625 static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_LISTS_ARY
) == RES_POOLCOLL_LISTS_END
- RES_POOLCOLL_LISTS_BEGIN
, "### unexpected size!");
626 pResId
= STR_POOLCOLL_LISTS_ARY
[nId
- RES_POOLCOLL_LISTS_BEGIN
];
628 else if (RES_POOLCOLL_EXTRA_BEGIN
<= nId
&& nId
< RES_POOLCOLL_EXTRA_END
)
630 static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_EXTRA_ARY
) == RES_POOLCOLL_EXTRA_END
- RES_POOLCOLL_EXTRA_BEGIN
, "### unexpected size!");
631 pResId
= STR_POOLCOLL_EXTRA_ARY
[nId
- RES_POOLCOLL_EXTRA_BEGIN
];
633 else if (RES_POOLCOLL_REGISTER_BEGIN
<= nId
&& nId
< RES_POOLCOLL_REGISTER_END
)
635 static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_REGISTER_ARY
) == RES_POOLCOLL_REGISTER_END
- RES_POOLCOLL_REGISTER_BEGIN
, "### unexpected size!");
636 pResId
= STR_POOLCOLL_REGISTER_ARY
[nId
- RES_POOLCOLL_REGISTER_BEGIN
];
638 else if (RES_POOLCOLL_DOC_BEGIN
<= nId
&& nId
< RES_POOLCOLL_DOC_END
)
640 static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_DOC_ARY
) == RES_POOLCOLL_DOC_END
- RES_POOLCOLL_DOC_BEGIN
, "### unexpected size!");
641 pResId
= STR_POOLCOLL_DOC_ARY
[nId
- RES_POOLCOLL_DOC_BEGIN
];
643 else if (RES_POOLCOLL_HTML_BEGIN
<= nId
&& nId
< RES_POOLCOLL_HTML_END
)
645 static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_HTML_ARY
) == RES_POOLCOLL_HTML_END
- RES_POOLCOLL_HTML_BEGIN
, "### unexpected size!");
646 pResId
= STR_POOLCOLL_HTML_ARY
[nId
- RES_POOLCOLL_HTML_BEGIN
];
649 OSL_ENSURE(pResId
, "Invalid Pool ID");
651 return GetTextCollFromPool(RES_POOLCOLL_STANDARD
);
653 OUString
aNm(SwResId(pResId
));
655 // A Set for all to-be-set Attributes
656 SwAttrSet
aSet( m_rDoc
.GetAttrPool(), aTextFormatCollSetRange
);
657 sal_uInt16 nParent
= GetPoolParent( nId
);
661 if(::IsConditionalByPoolId( nId
))
662 pNewColl
= new SwConditionTextFormatColl( m_rDoc
.GetAttrPool(), aNm
, !nParent
663 ? m_rDoc
.GetDfltTextFormatColl()
664 : GetTextCollFromPool( nParent
));
666 pNewColl
= new SwTextFormatColl( m_rDoc
.GetAttrPool(), aNm
, !nParent
667 ? m_rDoc
.GetDfltTextFormatColl()
668 : GetTextCollFromPool( nParent
));
669 pNewColl
->SetPoolFormatId( nId
);
670 m_rDoc
.GetTextFormatColls()->push_back( pNewColl
);
673 bool bNoDefault
= m_rDoc
.GetDocumentSettingManager().get( DocumentSettingId::STYLES_NODEFAULT
);
678 // General content forms
679 case RES_POOLCOLL_STANDARD
:
680 /* koreans do not like SvxScriptItem(TRUE) */
683 LanguageType nAppLanguage
= GetAppLanguage();
684 if (GetDefaultFrameDirection(nAppLanguage
) ==
685 SvxFrameDirection::Horizontal_RL_TB
)
687 SvxAdjustItem
aAdjust(SvxAdjust::Right
, RES_PARATR_ADJUST
);
690 if (nAppLanguage
== LANGUAGE_KOREAN
)
692 SvxScriptSpaceItem
aScriptSpace(false, RES_PARATR_SCRIPTSPACE
);
693 aSet
.Put(aScriptSpace
);
698 case RES_POOLCOLL_TEXT
: // Text body
700 SvxLineSpacingItem
aLSpc( LINE_SPACE_DEFAULT_HEIGHT
, RES_PARATR_LINESPACING
);
701 SvxULSpaceItem
aUL( 0, PT_7
, RES_UL_SPACE
);
702 aLSpc
.SetPropLineSpace( 115 );
703 if( m_rDoc
.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE
) ) aUL
.SetLower( HTML_PARSPACE
);
708 case RES_POOLCOLL_TEXT_IDENT
: // Text body indentation
710 auto const first(o3tl::convert(5, o3tl::Length::mm
, o3tl::Length::twip
));
711 SvxFirstLineIndentItem
const firstLine(first
, RES_MARGIN_FIRSTLINE
);
712 SvxTextLeftMarginItem
const leftMargin(0, RES_MARGIN_TEXTLEFT
);
714 aSet
.Put(leftMargin
);
717 case RES_POOLCOLL_TEXT_NEGIDENT
: // Text body neg. indentation
719 auto const first(-o3tl::convert(5, o3tl::Length::mm
, o3tl::Length::twip
));
720 auto const left(o3tl::convert(1, o3tl::Length::cm
, o3tl::Length::twip
));
721 SvxFirstLineIndentItem
const firstLine(first
, RES_MARGIN_FIRSTLINE
);
722 SvxTextLeftMarginItem
const leftMargin(left
, RES_MARGIN_TEXTLEFT
);
724 aSet
.Put(leftMargin
);
726 SvxTabStopItem
aTStops(RES_PARATR_TABSTOP
);
727 aTStops
.Insert( SvxTabStop( 0 ));
731 case RES_POOLCOLL_TEXT_MOVE
: // Text body move
733 auto const left(o3tl::convert(5, o3tl::Length::mm
, o3tl::Length::twip
));
734 SvxFirstLineIndentItem
const firstLine(0, RES_MARGIN_FIRSTLINE
);
735 SvxTextLeftMarginItem
const leftMargin(left
, RES_MARGIN_TEXTLEFT
);
737 aSet
.Put(leftMargin
);
741 case RES_POOLCOLL_CONFRONTATION
: // Text body confrontation
743 auto const first(-o3tl::convert(45, o3tl::Length::mm
, o3tl::Length::twip
));
744 auto const left(o3tl::convert(5, o3tl::Length::cm
, o3tl::Length::twip
));
745 SvxFirstLineIndentItem
const firstLine(first
, RES_MARGIN_FIRSTLINE
);
746 SvxTextLeftMarginItem
const leftMargin(left
, RES_MARGIN_TEXTLEFT
);
748 aSet
.Put(leftMargin
);
750 SvxTabStopItem
aTStops( RES_PARATR_TABSTOP
);
751 aTStops
.Insert( SvxTabStop( 0 ));
755 case RES_POOLCOLL_MARGINAL
: // Text body marginal
757 auto const left(o3tl::convert(4, o3tl::Length::cm
, o3tl::Length::twip
));
758 SvxFirstLineIndentItem
const firstLine(0, RES_MARGIN_FIRSTLINE
);
759 SvxTextLeftMarginItem
const leftMargin(left
, RES_MARGIN_TEXTLEFT
);
761 aSet
.Put(leftMargin
);
765 case RES_POOLCOLL_HEADLINE_BASE
: // Base headline
767 static const sal_uInt16 aFontWhich
[] =
772 static const sal_uInt16 aLangTypes
[] =
775 RES_CHRATR_CJK_LANGUAGE
,
776 RES_CHRATR_CTL_LANGUAGE
778 static const LanguageType aLangs
[] =
782 LANGUAGE_ARABIC_SAUDI_ARABIA
784 static const DefaultFontType nFontTypes
[] =
786 DefaultFontType::LATIN_HEADING
,
787 DefaultFontType::CJK_HEADING
,
788 DefaultFontType::CTL_HEADING
791 for( int i
= 0; i
< 3; ++i
)
793 LanguageType nLng
= static_cast<const SvxLanguageItem
&>(m_rDoc
.GetDefault( aLangTypes
[i
] )).GetLanguage();
794 if( LANGUAGE_DONTKNOW
== nLng
)
797 vcl::Font
aFnt( OutputDevice::GetDefaultFont( nFontTypes
[i
],
798 nLng
, GetDefaultFontFlags::OnlyOne
) );
800 aSet
.Put( SvxFontItem( aFnt
.GetFamilyType(), aFnt
.GetFamilyName(),
801 OUString(), aFnt
.GetPitch(),
802 aFnt
.GetCharSet(), aFontWhich
[i
] ));
805 SvxFontHeightItem
aFntSize( PT_14
, 100, RES_CHRATR_FONTSIZE
);
806 SvxULSpaceItem
aUL( PT_12
, PT_6
, RES_UL_SPACE
);
807 if( m_rDoc
.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE
) )
808 aUL
.SetLower( HTML_PARSPACE
);
809 aSet
.Put( SvxFormatKeepItem( true, RES_KEEP
));
811 pNewColl
->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_TEXT
));
814 SetAllScriptItem( aSet
, aFntSize
);
818 case RES_POOLCOLL_NUMBER_BULLET_BASE
: // Base Numbering
821 case RES_POOLCOLL_GREETING
: // Greeting
822 case RES_POOLCOLL_REGISTER_BASE
: // Base indexes
823 case RES_POOLCOLL_SIGNATURE
: // Signatures
824 case RES_POOLCOLL_TABLE
: // Table content
826 SwFormatLineNumber aLN
;
827 aLN
.SetCountLines( false );
829 if (nId
== RES_POOLCOLL_TABLE
)
831 aSet
.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS
) );
832 aSet
.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS
) );
837 case RES_POOLCOLL_HEADLINE1
: // Heading 1
839 SvxULSpaceItem
aUL( PT_12
, PT_6
, RES_UL_SPACE
);
841 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 0, false );
844 case RES_POOLCOLL_HEADLINE2
: // Heading 2
846 SvxULSpaceItem
aUL( PT_10
, PT_6
, RES_UL_SPACE
);
848 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 1, false );
851 case RES_POOLCOLL_HEADLINE3
: // Heading 3
853 SvxULSpaceItem
aUL( PT_7
, PT_6
, RES_UL_SPACE
);
855 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 2, false );
858 case RES_POOLCOLL_HEADLINE4
: // Heading 4
860 SvxULSpaceItem
aUL( PT_6
, PT_6
, RES_UL_SPACE
);
862 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 3, true );
865 case RES_POOLCOLL_HEADLINE5
: // Heading 5
867 SvxULSpaceItem
aUL( PT_6
, PT_3
, RES_UL_SPACE
);
869 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 4, false );
872 case RES_POOLCOLL_HEADLINE6
: // Heading 6
874 SvxULSpaceItem
aUL( PT_3
, PT_3
, RES_UL_SPACE
);
876 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 5, true );
879 case RES_POOLCOLL_HEADLINE7
: // Heading 7
881 SvxULSpaceItem
aUL( PT_3
, PT_3
, RES_UL_SPACE
);
883 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 6, false );
886 case RES_POOLCOLL_HEADLINE8
: // Heading 8
888 SvxULSpaceItem
aUL( PT_3
, PT_3
, RES_UL_SPACE
);
890 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 7, true );
893 case RES_POOLCOLL_HEADLINE9
: // Heading 9
895 SvxULSpaceItem
aUL( PT_3
, PT_3
, RES_UL_SPACE
);
897 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 8, false );
900 case RES_POOLCOLL_HEADLINE10
: // Heading 10
902 SvxULSpaceItem
aUL( PT_3
, PT_3
, RES_UL_SPACE
);
904 lcl_SetHeadline( m_rDoc
, pNewColl
, aSet
, nOutLvlBits
, 9, false );
910 case RES_POOLCOLL_HEADERFOOTER
:
911 case RES_POOLCOLL_HEADER
:
912 case RES_POOLCOLL_HEADERL
:
913 case RES_POOLCOLL_HEADERR
:
915 case RES_POOLCOLL_FOOTER
:
916 case RES_POOLCOLL_FOOTERL
:
917 case RES_POOLCOLL_FOOTERR
:
919 SwFormatLineNumber aLN
;
920 aLN
.SetCountLines( false );
923 tools::Long nRightMargin
= lcl_GetRightMargin( m_rDoc
);
925 SvxTabStopItem
aTStops( 0, 0, SvxTabAdjust::Default
, RES_PARATR_TABSTOP
);
926 aTStops
.Insert( SvxTabStop( nRightMargin
/ 2, SvxTabAdjust::Center
) );
927 aTStops
.Insert( SvxTabStop( nRightMargin
, SvxTabAdjust::Right
) );
931 if ( (nId
==RES_POOLCOLL_HEADERR
) || (nId
==RES_POOLCOLL_FOOTERR
) ) {
932 SvxAdjustItem
aAdjust(SvxAdjust::Right
, RES_PARATR_ADJUST
);
938 case RES_POOLCOLL_TABLE_HDLN
:
940 SetAllScriptItem( aSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
941 aSet
.Put( SvxAdjustItem( SvxAdjust::Center
, RES_PARATR_ADJUST
) );
942 SwFormatLineNumber aLN
;
943 aLN
.SetCountLines( false );
948 case RES_POOLCOLL_FOOTNOTE
: // paragraph style Footnote
949 case RES_POOLCOLL_ENDNOTE
: // paragraph style Endnote
951 auto const first(-o3tl::convert(6, o3tl::Length::mm
, o3tl::Length::twip
));
952 auto const left(o3tl::convert(6, o3tl::Length::mm
, o3tl::Length::twip
));
953 SvxFirstLineIndentItem
const firstLine(first
, RES_MARGIN_FIRSTLINE
);
954 SvxTextLeftMarginItem
const leftMargin(left
, RES_MARGIN_TEXTLEFT
);
956 aSet
.Put(leftMargin
);
958 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_10
, 100, RES_CHRATR_FONTSIZE
) );
959 SwFormatLineNumber aLN
;
960 aLN
.SetCountLines( false );
965 case RES_POOLCOLL_LABEL
: // basic caption
967 SvxULSpaceItem
aUL( RES_UL_SPACE
);
968 aUL
.SetUpper( PT_6
);
969 aUL
.SetLower( PT_6
);
971 SetAllScriptItem( aSet
, SvxPostureItem( ITALIC_NORMAL
, RES_CHRATR_POSTURE
) );
972 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_10
, 100, RES_CHRATR_FONTSIZE
) );
973 SwFormatLineNumber aLN
;
974 aLN
.SetCountLines( false );
979 case RES_POOLCOLL_FRAME
: // Frame content
980 case RES_POOLCOLL_LABEL_ABB
: // caption image
981 case RES_POOLCOLL_LABEL_TABLE
: // caption table
982 case RES_POOLCOLL_LABEL_FRAME
: // caption frame
983 case RES_POOLCOLL_LABEL_DRAWING
: // caption drawing
984 case RES_POOLCOLL_LABEL_FIGURE
:
987 case RES_POOLCOLL_ENVELOPE_ADDRESS
: // envelope address
989 SvxULSpaceItem
aUL( RES_UL_SPACE
);
990 aUL
.SetLower( PT_3
);
992 SwFormatLineNumber aLN
;
993 aLN
.SetCountLines( false );
998 case RES_POOLCOLL_SEND_ADDRESS
: // Sender address
1000 if( m_rDoc
.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE
) )
1001 SetAllScriptItem( aSet
, SvxPostureItem(ITALIC_NORMAL
, RES_CHRATR_POSTURE
) );
1004 SvxULSpaceItem
aUL( RES_UL_SPACE
); aUL
.SetLower( PT_3
);
1007 SwFormatLineNumber aLN
;
1008 aLN
.SetCountLines( false );
1012 // User defined indexes:
1013 case RES_POOLCOLL_TOX_USERH
: // Header
1014 lcl_SetRegister( m_rDoc
, aSet
, 0, true, false );
1016 SwFormatLineNumber aLN
;
1017 aLN
.SetCountLines( false );
1021 case RES_POOLCOLL_TOX_USER1
: // 1st level
1022 lcl_SetRegister( m_rDoc
, aSet
, 0, false, true );
1024 case RES_POOLCOLL_TOX_USER2
: // 2nd level
1025 lcl_SetRegister( m_rDoc
, aSet
, 1, false, true );
1027 case RES_POOLCOLL_TOX_USER3
: // 3rd level
1028 lcl_SetRegister( m_rDoc
, aSet
, 2, false, true );
1030 case RES_POOLCOLL_TOX_USER4
: // 4th level
1031 lcl_SetRegister( m_rDoc
, aSet
, 3, false, true );
1033 case RES_POOLCOLL_TOX_USER5
: // 5th level
1034 lcl_SetRegister( m_rDoc
, aSet
, 4, false, true );
1036 case RES_POOLCOLL_TOX_USER6
: // 6th level
1037 lcl_SetRegister( m_rDoc
, aSet
, 5, false, true );
1039 case RES_POOLCOLL_TOX_USER7
: // 7th level
1040 lcl_SetRegister( m_rDoc
, aSet
, 6, false, true );
1042 case RES_POOLCOLL_TOX_USER8
: // 8th level
1043 lcl_SetRegister( m_rDoc
, aSet
, 7, false, true );
1045 case RES_POOLCOLL_TOX_USER9
: // 9th level
1046 lcl_SetRegister( m_rDoc
, aSet
, 8, false, true );
1048 case RES_POOLCOLL_TOX_USER10
: // 10th level
1049 lcl_SetRegister( m_rDoc
, aSet
, 9, false, true );
1053 case RES_POOLCOLL_TOX_IDXH
: // Header
1054 lcl_SetRegister( m_rDoc
, aSet
, 0, true, false );
1056 SwFormatLineNumber aLN
;
1057 aLN
.SetCountLines( false );
1061 case RES_POOLCOLL_TOX_IDX1
: // 1st level
1062 lcl_SetRegister( m_rDoc
, aSet
, 0, false, false );
1064 case RES_POOLCOLL_TOX_IDX2
: // 2nd level
1065 lcl_SetRegister( m_rDoc
, aSet
, 1, false, false );
1067 case RES_POOLCOLL_TOX_IDX3
: // 3rd level
1068 lcl_SetRegister( m_rDoc
, aSet
, 2, false, false );
1070 case RES_POOLCOLL_TOX_IDXBREAK
: // Separator
1071 lcl_SetRegister( m_rDoc
, aSet
, 0, false, false );
1075 case RES_POOLCOLL_TOX_CNTNTH
: // Header
1076 lcl_SetRegister( m_rDoc
, aSet
, 0, true, false );
1078 SwFormatLineNumber aLN
;
1079 aLN
.SetCountLines( false );
1083 case RES_POOLCOLL_TOX_CNTNT1
: // 1st level
1084 lcl_SetRegister( m_rDoc
, aSet
, 0, false, true );
1086 case RES_POOLCOLL_TOX_CNTNT2
: // 2nd level
1087 lcl_SetRegister( m_rDoc
, aSet
, 1, false, true );
1089 case RES_POOLCOLL_TOX_CNTNT3
: // 3rd level
1090 lcl_SetRegister( m_rDoc
, aSet
, 2, false, true );
1092 case RES_POOLCOLL_TOX_CNTNT4
: // 4th level
1093 lcl_SetRegister( m_rDoc
, aSet
, 3, false, true );
1095 case RES_POOLCOLL_TOX_CNTNT5
: // 5th level
1096 lcl_SetRegister( m_rDoc
, aSet
, 4, false, true );
1098 case RES_POOLCOLL_TOX_CNTNT6
: // 6th level
1099 lcl_SetRegister( m_rDoc
, aSet
, 5, false, true );
1101 case RES_POOLCOLL_TOX_CNTNT7
: // 7th level
1102 lcl_SetRegister( m_rDoc
, aSet
, 6, false, true );
1104 case RES_POOLCOLL_TOX_CNTNT8
: // 8th level
1105 lcl_SetRegister( m_rDoc
, aSet
, 7, false, true );
1107 case RES_POOLCOLL_TOX_CNTNT9
: // 9th level
1108 lcl_SetRegister( m_rDoc
, aSet
, 8, false, true );
1110 case RES_POOLCOLL_TOX_CNTNT10
: // 10th level
1111 lcl_SetRegister( m_rDoc
, aSet
, 9, false, true );
1114 case RES_POOLCOLL_TOX_ILLUSH
:
1115 case RES_POOLCOLL_TOX_OBJECTH
:
1116 case RES_POOLCOLL_TOX_TABLESH
:
1117 case RES_POOLCOLL_TOX_AUTHORITIESH
:
1118 lcl_SetRegister( m_rDoc
, aSet
, 0, true, false );
1120 SwFormatLineNumber aLN
;
1121 aLN
.SetCountLines( false );
1125 case RES_POOLCOLL_TOX_ILLUS1
:
1126 case RES_POOLCOLL_TOX_OBJECT1
:
1127 case RES_POOLCOLL_TOX_TABLES1
:
1128 case RES_POOLCOLL_TOX_AUTHORITIES1
:
1129 lcl_SetRegister( m_rDoc
, aSet
, 0, false, true );
1132 case RES_POOLCOLL_NUM_LEVEL1S
:
1133 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL1
,
1134 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 0 ),
1137 case RES_POOLCOLL_NUM_LEVEL1
:
1138 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL1
,
1139 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 0 ),
1142 case RES_POOLCOLL_NUM_LEVEL1E
:
1143 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL1
,
1144 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 0 ),
1147 case RES_POOLCOLL_NUM_NONUM1
:
1148 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM1
,
1149 0, SwNumRule::GetNumIndent( 0 ), 0, PT_6
);
1151 case RES_POOLCOLL_NUM_LEVEL2S
:
1152 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL2
,
1153 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 1 ),
1156 case RES_POOLCOLL_NUM_LEVEL2
:
1157 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL2
,
1158 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 1 ),
1161 case RES_POOLCOLL_NUM_LEVEL2E
:
1162 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL2
,
1163 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 1 ),
1166 case RES_POOLCOLL_NUM_NONUM2
:
1167 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM2
,
1168 0, SwNumRule::GetNumIndent( 1 ), 0, PT_6
);
1170 case RES_POOLCOLL_NUM_LEVEL3S
:
1171 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL3
,
1172 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 2 ),
1175 case RES_POOLCOLL_NUM_LEVEL3
:
1176 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL3
,
1177 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 2 ),
1180 case RES_POOLCOLL_NUM_LEVEL3E
:
1181 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL3
,
1182 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 2 ),
1185 case RES_POOLCOLL_NUM_NONUM3
:
1186 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM3
,
1187 0, SwNumRule::GetNumIndent( 2 ), 0, PT_6
);
1189 case RES_POOLCOLL_NUM_LEVEL4S
:
1190 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL4
,
1191 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 3 ),
1194 case RES_POOLCOLL_NUM_LEVEL4
:
1195 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL4
,
1196 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 3 ),
1199 case RES_POOLCOLL_NUM_LEVEL4E
:
1200 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL4
,
1201 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 3 ),
1204 case RES_POOLCOLL_NUM_NONUM4
:
1205 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM4
,
1206 0, SwNumRule::GetNumIndent( 3 ), 0, PT_6
);
1208 case RES_POOLCOLL_NUM_LEVEL5S
:
1209 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL5
,
1210 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 4 ),
1213 case RES_POOLCOLL_NUM_LEVEL5
:
1214 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL5
,
1215 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 4 ),
1218 case RES_POOLCOLL_NUM_LEVEL5E
:
1219 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_LEVEL5
,
1220 lNumberFirstLineOffset
, SwNumRule::GetNumIndent( 4 ),
1223 case RES_POOLCOLL_NUM_NONUM5
:
1224 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_NUM_NONUM5
,
1225 0, SwNumRule::GetNumIndent( 4 ), 0, PT_6
);
1228 case RES_POOLCOLL_BULLET_LEVEL1S
:
1229 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL1
,
1230 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 0 ),
1233 case RES_POOLCOLL_BULLET_LEVEL1
:
1234 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL1
,
1235 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 0 ),
1238 case RES_POOLCOLL_BULLET_LEVEL1E
:
1239 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL1
,
1240 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 0 ),
1243 case RES_POOLCOLL_BULLET_NONUM1
:
1244 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_NONUM1
,
1245 0, SwNumRule::GetBullIndent( 0 ), 0, PT_6
);
1247 case RES_POOLCOLL_BULLET_LEVEL2S
:
1248 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL2
,
1249 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 1 ),
1252 case RES_POOLCOLL_BULLET_LEVEL2
:
1253 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL2
,
1254 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 1 ),
1257 case RES_POOLCOLL_BULLET_LEVEL2E
:
1258 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL2
,
1259 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 1 ),
1262 case RES_POOLCOLL_BULLET_NONUM2
:
1263 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_NONUM2
,
1264 0, SwNumRule::GetBullIndent( 1 ), 0, PT_6
);
1266 case RES_POOLCOLL_BULLET_LEVEL3S
:
1267 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL3
,
1268 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 2 ),
1271 case RES_POOLCOLL_BULLET_LEVEL3
:
1272 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL3
,
1273 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 2 ),
1276 case RES_POOLCOLL_BULLET_LEVEL3E
:
1277 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL3
,
1278 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 2 ),
1281 case RES_POOLCOLL_BULLET_NONUM3
:
1282 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_NONUM3
,
1283 0, SwNumRule::GetBullIndent( 2 ), 0, PT_6
);
1285 case RES_POOLCOLL_BULLET_LEVEL4S
:
1286 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL4
,
1287 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 3 ),
1290 case RES_POOLCOLL_BULLET_LEVEL4
:
1291 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL4
,
1292 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 3 ),
1295 case RES_POOLCOLL_BULLET_LEVEL4E
:
1296 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL4
,
1297 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 3 ),
1300 case RES_POOLCOLL_BULLET_NONUM4
:
1301 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_NONUM4
,
1302 0, SwNumRule::GetBullIndent( 3 ), 0, PT_6
);
1304 case RES_POOLCOLL_BULLET_LEVEL5S
:
1305 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL5
,
1306 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 4 ),
1309 case RES_POOLCOLL_BULLET_LEVEL5
:
1310 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL5
,
1311 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 4 ),
1314 case RES_POOLCOLL_BULLET_LEVEL5E
:
1315 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_LEVEL5
,
1316 lBulletFirstLineOffset
, SwNumRule::GetBullIndent( 4 ),
1319 case RES_POOLCOLL_BULLET_NONUM5
:
1320 lcl_SetNumBul( m_rDoc
, pNewColl
, aSet
, RES_POOLCOLL_BULLET_NONUM5
,
1321 0, SwNumRule::GetBullIndent( 4 ), 0, PT_6
);
1324 case RES_POOLCOLL_DOC_TITLE
: // Document Title
1326 SetAllScriptItem( aSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
1327 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_28
, 100, RES_CHRATR_FONTSIZE
) );
1329 aSet
.Put( SvxAdjustItem( SvxAdjust::Center
, RES_PARATR_ADJUST
) );
1331 pNewColl
->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_TEXT
));
1335 case RES_POOLCOLL_DOC_SUBTITLE
: // Document subtitle
1337 SvxULSpaceItem
aUL( PT_3
, PT_6
, RES_UL_SPACE
);
1339 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_18
, 100, RES_CHRATR_FONTSIZE
));
1341 aSet
.Put( SvxAdjustItem( SvxAdjust::Center
, RES_PARATR_ADJUST
));
1343 pNewColl
->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_TEXT
));
1347 case RES_POOLCOLL_DOC_APPENDIX
: // Document Appendix tdf#114090
1349 SetAllScriptItem( aSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
) );
1350 SetAllScriptItem( aSet
, SvxFontHeightItem( PT_16
, 100, RES_CHRATR_FONTSIZE
) );
1352 aSet
.Put( SvxAdjustItem( SvxAdjust::Center
, RES_PARATR_ADJUST
) );
1354 pNewColl
->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_TEXT
));
1358 case RES_POOLCOLL_HTML_BLOCKQUOTE
:
1360 auto const left(o3tl::convert(1, o3tl::Length::cm
, o3tl::Length::twip
));
1361 auto const right(o3tl::convert(1, o3tl::Length::cm
, o3tl::Length::twip
));
1362 SvxFirstLineIndentItem
const firstLine(0, RES_MARGIN_FIRSTLINE
);
1363 SvxTextLeftMarginItem
const leftMargin(left
, RES_MARGIN_TEXTLEFT
);
1364 SvxRightMarginItem
const rightMargin(right
, RES_MARGIN_RIGHT
);
1365 aSet
.Put(firstLine
);
1366 aSet
.Put(leftMargin
);
1367 aSet
.Put(rightMargin
);
1369 std::unique_ptr
<SvxULSpaceItem
> aUL(pNewColl
->GetULSpace().Clone());
1370 aUL
->SetLower( HTML_PARSPACE
);
1371 aSet
.Put(std::move(aUL
));
1375 case RES_POOLCOLL_HTML_PRE
:
1377 ::lcl_SetDfltFont( DefaultFontType::FIXED
, aSet
);
1379 // WORKAROUND: Set PRE to 10pt
1380 SetAllScriptItem( aSet
, SvxFontHeightItem(PT_10
, 100, RES_CHRATR_FONTSIZE
) );
1382 // The lower paragraph distance is set explicitly (makes
1383 // assigning hard attributes easier)
1384 std::unique_ptr
<SvxULSpaceItem
> aULSpaceItem(pNewColl
->GetULSpace().Clone());
1385 aULSpaceItem
->SetLower( 0 );
1386 aSet
.Put(std::move(aULSpaceItem
));
1390 case RES_POOLCOLL_HTML_HR
:
1392 SvxBoxItem
aBox( RES_BOX
);
1393 Color
aColor( COL_GRAY
);
1394 SvxBorderLine
aNew(&aColor
, 3, SvxBorderLineStyle::DOUBLE
);
1395 aBox
.SetLine( &aNew
, SvxBoxItemLine::BOTTOM
);
1398 aSet
.Put( SwParaConnectBorderItem( false ) );
1399 SetAllScriptItem( aSet
, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE
) );
1401 std::unique_ptr
<SvxULSpaceItem
> aUL
;
1403 pNewColl
->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_TEXT
));
1404 aUL
.reset(pNewColl
->GetULSpace().Clone());
1406 aUL
->SetLower( HTML_PARSPACE
);
1407 aSet
.Put(std::move(aUL
));
1408 SwFormatLineNumber aLN
;
1409 aLN
.SetCountLines( false );
1414 case RES_POOLCOLL_HTML_DD
:
1416 // We indent by 1 cm. The IDs are always 2 away from each other!
1417 auto const left(o3tl::convert(1, o3tl::Length::cm
, o3tl::Length::twip
));
1418 SvxTextLeftMarginItem
const leftMargin(left
, RES_MARGIN_TEXTLEFT
);
1419 aSet
.Put(leftMargin
);
1422 case RES_POOLCOLL_HTML_DT
:
1425 pNewColl
->SetNextTextFormatColl( *GetTextCollFromPool( RES_POOLCOLL_HTML_DD
));
1427 // We indent by 0 cm. The IDs are always 2 away from each other!
1428 SvxTextLeftMarginItem
const leftMargin(0, RES_MARGIN_TEXTLEFT
);
1429 aSet
.Put(leftMargin
);
1436 pNewColl
->SetFormatAttr( aSet
);
1440 /// Return the AutomaticFormat with the supplied Id. If it doesn't
1441 /// exist, create it.
1442 SwFormat
* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId
)
1444 SwFormat
*pNewFormat
= nullptr;
1445 SwFormat
*pDeriveFormat
= nullptr;
1447 SwFormatsBase
* pArray
[ 2 ];
1448 sal_uInt16 nArrCnt
= 1;
1450 WhichRangesContainer
const* pWhichRange
;
1452 switch( nId
& (COLL_GET_RANGE_BITS
+ POOLGRP_NOCOLLID
) )
1454 case POOLGRP_CHARFMT
:
1456 pArray
[0] = m_rDoc
.GetCharFormats();
1457 pDeriveFormat
= m_rDoc
.GetDfltCharFormat();
1458 pWhichRange
= &aCharFormatSetRange
;
1460 if (nId
>= RES_POOLCHR_HTML_BEGIN
&& nId
< RES_POOLCHR_HTML_END
)
1461 pRCId
= STR_POOLCHR_HTML_ARY
[nId
- RES_POOLCHR_HTML_BEGIN
];
1462 else if (nId
>= RES_POOLCHR_NORMAL_BEGIN
&& nId
< RES_POOLCHR_NORMAL_END
)
1463 pRCId
= STR_POOLCHR_ARY
[nId
- RES_POOLCHR_BEGIN
];
1466 // Fault: unknown Format, but a CharFormat -> return the first one
1467 OSL_ENSURE( false, "invalid Id" );
1468 pRCId
= STR_POOLCHR_ARY
[0];
1472 case POOLGRP_FRAMEFMT
:
1474 pArray
[0] = m_rDoc
.GetFrameFormats();
1475 pArray
[1] = m_rDoc
.GetSpzFrameFormats();
1476 pDeriveFormat
= m_rDoc
.GetDfltFrameFormat();
1478 pWhichRange
= &aFrameFormatSetRange
;
1480 // Fault: unknown Format, but a FrameFormat
1481 // -> return the first one
1482 if( RES_POOLFRM_BEGIN
> nId
|| nId
>= RES_POOLFRM_END
)
1484 OSL_ENSURE( false, "invalid Id" );
1485 nId
= RES_POOLFRM_BEGIN
;
1488 pRCId
= STR_POOLFRM_ARY
[nId
- RES_POOLFRM_BEGIN
];
1493 // Fault, unknown Format
1494 OSL_ENSURE( nId
, "invalid Id" );
1497 OSL_ENSURE(pRCId
, "invalid Id");
1500 for( size_t n
= 0; n
< (*pArray
[nArrCnt
]).GetFormatCount(); ++n
)
1502 pNewFormat
= (*pArray
[ nArrCnt
] ).GetFormat( n
);
1503 if( nId
== pNewFormat
->GetPoolFormatId() )
1509 OUString
aNm(SwResId(pRCId
));
1510 SwAttrSet
aSet(m_rDoc
.GetAttrPool(), *pWhichRange
);
1513 bool bIsModified
= m_rDoc
.getIDocumentState().IsModified();
1516 ::sw::UndoGuard
const undoGuard(m_rDoc
.GetIDocumentUndoRedo());
1517 switch (nId
& (COLL_GET_RANGE_BITS
+ POOLGRP_NOCOLLID
) )
1519 case POOLGRP_CHARFMT
:
1520 pNewFormat
= m_rDoc
.MakeCharFormat_(aNm
, pDeriveFormat
, false, true);
1522 case POOLGRP_FRAMEFMT
:
1523 pNewFormat
= m_rDoc
.MakeFrameFormat_(aNm
, pDeriveFormat
, false, true);
1531 m_rDoc
.getIDocumentState().ResetModified();
1532 pNewFormat
->SetPoolFormatId( nId
);
1533 pNewFormat
->SetAuto(false); // no AutoFormat
1538 case RES_POOLCHR_FOOTNOTE
: // Footnote
1539 case RES_POOLCHR_PAGENO
: // Page/Field
1540 case RES_POOLCHR_LABEL
: // Label
1541 case RES_POOLCHR_DROPCAPS
: // Dropcaps
1542 case RES_POOLCHR_NUM_LEVEL
: // Numbering level
1543 case RES_POOLCHR_TOXJUMP
: // Table of contents jump
1544 case RES_POOLCHR_ENDNOTE
: // Endnote
1545 case RES_POOLCHR_LINENUM
: // Line numbering
1548 case RES_POOLCHR_ENDNOTE_ANCHOR
: // Endnote anchor
1549 case RES_POOLCHR_FOOTNOTE_ANCHOR
: // Footnote anchor
1551 aSet
.Put( SvxEscapementItem( DFLT_ESC_AUTO_SUPER
, DFLT_ESC_PROP
, RES_CHRATR_ESCAPEMENT
) );
1555 case RES_POOLCHR_BULLET_LEVEL
: // Bullet character
1557 const vcl::Font
& rBulletFont
= numfunc::GetDefBulletFont();
1558 SetAllScriptItem( aSet
, SvxFontItem( rBulletFont
.GetFamilyType(),
1559 rBulletFont
.GetFamilyName(), rBulletFont
.GetStyleName(),
1560 rBulletFont
.GetPitch(), rBulletFont
.GetCharSet(), RES_CHRATR_FONT
));
1564 case RES_POOLCHR_INET_NORMAL
:
1566 aSet
.Put( SvxColorItem( COL_BLUE
, RES_CHRATR_COLOR
) );
1567 aSet
.Put( SvxUnderlineItem( LINESTYLE_SINGLE
, RES_CHRATR_UNDERLINE
) );
1570 case RES_POOLCHR_INET_VISIT
:
1572 aSet
.Put( SvxColorItem( COL_RED
, RES_CHRATR_COLOR
) );
1573 aSet
.Put( SvxUnderlineItem( LINESTYLE_SINGLE
, RES_CHRATR_UNDERLINE
) );
1576 case RES_POOLCHR_JUMPEDIT
:
1578 aSet
.Put( SvxColorItem( COL_CYAN
, RES_CHRATR_COLOR
) );
1579 aSet
.Put( SvxUnderlineItem( LINESTYLE_DOTTED
, RES_CHRATR_UNDERLINE
) );
1580 aSet
.Put( SvxCaseMapItem( SvxCaseMap::SmallCaps
, RES_CHRATR_CASEMAP
) );
1584 case RES_POOLCHR_RUBYTEXT
:
1586 tools::Long nH
= GetDfltAttr( RES_CHRATR_CJK_FONTSIZE
)->GetHeight() / 2;
1587 SetAllScriptItem( aSet
, SvxFontHeightItem( nH
, 100, RES_CHRATR_FONTSIZE
));
1588 aSet
.Put(SvxUnderlineItem( LINESTYLE_NONE
, RES_CHRATR_UNDERLINE
));
1589 aSet
.Put(SvxEmphasisMarkItem( FontEmphasisMark::NONE
, RES_CHRATR_EMPHASIS_MARK
) );
1593 case RES_POOLCHR_HTML_EMPHASIS
:
1594 case RES_POOLCHR_HTML_CITATION
:
1595 case RES_POOLCHR_HTML_VARIABLE
:
1597 SetAllScriptItem( aSet
, SvxPostureItem( ITALIC_NORMAL
, RES_CHRATR_POSTURE
) );
1601 case RES_POOLCHR_IDX_MAIN_ENTRY
:
1602 case RES_POOLCHR_HTML_STRONG
:
1604 SetAllScriptItem( aSet
, SvxWeightItem( WEIGHT_BOLD
, RES_CHRATR_WEIGHT
));
1608 case RES_POOLCHR_HTML_CODE
:
1609 case RES_POOLCHR_HTML_SAMPLE
:
1610 case RES_POOLCHR_HTML_KEYBOARD
:
1611 case RES_POOLCHR_HTML_TELETYPE
:
1613 ::lcl_SetDfltFont( DefaultFontType::FIXED
, aSet
);
1616 case RES_POOLCHR_VERT_NUM
:
1617 aSet
.Put( SvxCharRotateItem( 900_deg10
, false, RES_CHRATR_ROTATE
) );
1620 case RES_POOLFRM_FRAME
:
1622 if ( m_rDoc
.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE
) )
1624 aSet
.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR
));
1625 aSet
.Put( SwFormatVertOrient( 0, text::VertOrientation::LINE_CENTER
, text::RelOrientation::PRINT_AREA
) );
1626 aSet
.Put( SwFormatSurround( css::text::WrapTextMode_NONE
) );
1630 aSet
.Put( SwFormatAnchor( RndStdIds::FLY_AT_PARA
));
1631 aSet
.Put( SwFormatSurround( css::text::WrapTextMode_PARALLEL
) );
1632 aSet
.Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER
, text::RelOrientation::PRINT_AREA
) );
1633 aSet
.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::PRINT_AREA
) );
1634 Color
aCol( COL_BLACK
);
1635 SvxBorderLine
aLine( &aCol
, SvxBorderLineWidth::Hairline
);
1636 SvxBoxItem
aBox( RES_BOX
);
1637 aBox
.SetLine( &aLine
, SvxBoxItemLine::TOP
);
1638 aBox
.SetLine( &aLine
, SvxBoxItemLine::BOTTOM
);
1639 aBox
.SetLine( &aLine
, SvxBoxItemLine::LEFT
);
1640 aBox
.SetLine( &aLine
, SvxBoxItemLine::RIGHT
);
1641 aBox
.SetAllDistances( 85 );
1643 aSet
.Put( SvxLRSpaceItem( 114, 114, 0, RES_LR_SPACE
) );
1644 aSet
.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE
) );
1647 // for styles of FlyFrames do not set the FillStyle to make it a derived attribute
1648 aSet
.ClearItem(XATTR_FILLSTYLE
);
1651 case RES_POOLFRM_GRAPHIC
:
1652 case RES_POOLFRM_OLE
:
1654 aSet
.Put( SwFormatAnchor( RndStdIds::FLY_AT_PARA
));
1655 aSet
.Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER
, text::RelOrientation::FRAME
));
1656 aSet
.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::FRAME
));
1657 aSet
.Put( SwFormatSurround( css::text::WrapTextMode_DYNAMIC
));
1660 case RES_POOLFRM_FORMEL
:
1662 aSet
.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR
) );
1663 aSet
.Put( SwFormatVertOrient( 0, text::VertOrientation::CHAR_CENTER
, text::RelOrientation::FRAME
) );
1664 aSet
.Put( SvxLRSpaceItem( 0, 0, 0, RES_LR_SPACE
) );
1667 case RES_POOLFRM_MARGINAL
:
1669 aSet
.Put( SwFormatAnchor( RndStdIds::FLY_AT_PARA
));
1670 aSet
.Put( SwFormatHoriOrient( 0, text::HoriOrientation::LEFT
, text::RelOrientation::FRAME
));
1671 aSet
.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::FRAME
));
1672 aSet
.Put( SwFormatSurround( css::text::WrapTextMode_PARALLEL
));
1673 // Set the default width to 3.5 cm, use the minimum value for the height
1674 aSet
.Put(SwFormatFrameSize(SwFrameSize::Minimum
,
1675 o3tl::toTwips(35, o3tl::Length::mm
),
1676 o3tl::toTwips(5, o3tl::Length::mm
)));
1679 case RES_POOLFRM_WATERSIGN
:
1681 aSet
.Put( SwFormatAnchor( RndStdIds::FLY_AT_PAGE
));
1682 aSet
.Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER
, text::RelOrientation::FRAME
));
1683 aSet
.Put( SwFormatVertOrient( 0, text::VertOrientation::CENTER
, text::RelOrientation::FRAME
));
1684 aSet
.Put( SvxOpaqueItem( RES_OPAQUE
, false ));
1685 aSet
.Put( SwFormatSurround( css::text::WrapTextMode_THROUGH
));
1688 case RES_POOLFRM_LABEL
:
1690 aSet
.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR
) );
1691 aSet
.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP
, text::RelOrientation::FRAME
) );
1692 aSet
.Put( SvxLRSpaceItem( 114, 114, 0, RES_LR_SPACE
) );
1694 SvxProtectItem
aProtect( RES_PROTECT
);
1695 aProtect
.SetSizeProtect( true );
1696 aProtect
.SetPosProtect( true );
1697 aSet
.Put( aProtect
);
1699 pNewFormat
->SetAutoUpdateOnDirectFormat();
1705 pNewFormat
->SetFormatAttr( aSet
);
1710 SwFrameFormat
* DocumentStylePoolManager::GetFrameFormatFromPool( sal_uInt16 nId
)
1712 return static_cast<SwFrameFormat
*>(GetFormatFromPool( nId
));
1715 SwCharFormat
* DocumentStylePoolManager::GetCharFormatFromPool( sal_uInt16 nId
)
1717 return static_cast<SwCharFormat
*>(GetFormatFromPool( nId
));
1720 SwPageDesc
* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId
, bool bRegardLanguage
)
1722 OSL_ENSURE( RES_POOLPAGE_BEGIN
<= nId
&& nId
< RES_POOLPAGE_END
,
1723 "Wrong AutoFormat Id" );
1725 for( size_t n
= 0; n
< m_rDoc
.GetPageDescCnt(); ++n
)
1727 if ( nId
== m_rDoc
.GetPageDesc(n
).GetPoolFormatId() )
1729 return &m_rDoc
.GetPageDesc(n
);
1733 if( RES_POOLPAGE_BEGIN
> nId
|| nId
>= RES_POOLPAGE_END
)
1735 // unknown page pool ID
1736 OSL_ENSURE( false, "<SwDoc::GetPageDescFromPool(..)> - unknown page pool ID" );
1737 nId
= RES_POOLPAGE_BEGIN
;
1740 SwPageDesc
* pNewPgDsc
= nullptr;
1742 static_assert(SAL_N_ELEMENTS(STR_POOLPAGE_ARY
) == RES_POOLPAGE_END
- RES_POOLPAGE_BEGIN
, "### unexpected size!");
1743 const OUString
aNm(SwResId(STR_POOLPAGE_ARY
[nId
- RES_POOLPAGE_BEGIN
]));
1744 const bool bIsModified
= m_rDoc
.getIDocumentState().IsModified();
1747 ::sw::UndoGuard
const undoGuard(m_rDoc
.GetIDocumentUndoRedo());
1748 pNewPgDsc
= m_rDoc
.MakePageDesc(aNm
, nullptr, bRegardLanguage
);
1751 pNewPgDsc
->SetPoolFormatId( nId
);
1754 m_rDoc
.getIDocumentState().ResetModified();
1758 SvxLRSpaceItem
aLR( RES_LR_SPACE
);
1760 aLR
.SetLeft(o3tl::convert(2, o3tl::Length::cm
, o3tl::Length::twip
));
1761 aLR
.SetRight( aLR
.GetLeft() );
1763 SvxULSpaceItem
aUL( RES_UL_SPACE
);
1765 aUL
.SetUpper( o3tl::narrowing
<sal_uInt16
>(aLR
.GetLeft()) );
1766 aUL
.SetLower( o3tl::narrowing
<sal_uInt16
>(aLR
.GetLeft()) );
1769 SwAttrSet
aSet( m_rDoc
.GetAttrPool(), aPgFrameFormatSetRange
);
1770 bool bSetLeft
= true;
1774 case RES_POOLPAGE_STANDARD
: // "Default"
1778 pNewPgDsc
->SetUseOn( UseOnPage::All
| UseOnPage::FirstShare
);
1782 case RES_POOLPAGE_FIRST
: // "First Page"
1783 case RES_POOLPAGE_REGISTER
: // "Index"
1785 lcl_PutStdPageSizeIntoItemSet( m_rDoc
, aSet
);
1788 pNewPgDsc
->SetUseOn( UseOnPage::All
);
1789 if( RES_POOLPAGE_FIRST
== nId
)
1790 pNewPgDsc
->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD
));
1794 case RES_POOLPAGE_LEFT
: // "Left Page"
1796 lcl_PutStdPageSizeIntoItemSet( m_rDoc
, aSet
);
1800 pNewPgDsc
->SetUseOn( UseOnPage::Left
);
1801 // this relies on GetPageDescFromPool() not going into infinite recursion
1802 // (by this point RES_POOLPAGE_LEFT will not reach this place again)
1803 pNewPgDsc
->SetFollow( GetPageDescFromPool( RES_POOLPAGE_RIGHT
));
1806 case RES_POOLPAGE_RIGHT
: // "Right Page"
1808 lcl_PutStdPageSizeIntoItemSet( m_rDoc
, aSet
);
1812 pNewPgDsc
->SetUseOn( UseOnPage::Right
);
1813 pNewPgDsc
->SetFollow( GetPageDescFromPool( RES_POOLPAGE_LEFT
));
1817 case RES_POOLPAGE_ENVELOPE
: // "Envelope"
1819 Size
aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65
) );
1820 LandscapeSwap( aPSize
);
1821 aSet
.Put( SwFormatFrameSize( SwFrameSize::Fixed
, aPSize
.Width(), aPSize
.Height() ));
1822 aLR
.SetLeft( 0 ); aLR
.SetRight( 0 );
1823 aUL
.SetUpper( 0 ); aUL
.SetLower( 0 );
1827 pNewPgDsc
->SetUseOn( UseOnPage::All
);
1828 pNewPgDsc
->SetLandscape( true );
1832 case RES_POOLPAGE_HTML
: // "HTML"
1834 lcl_PutStdPageSizeIntoItemSet( m_rDoc
, aSet
);
1835 aLR
.SetRight(o3tl::convert(1, o3tl::Length::cm
, o3tl::Length::twip
));
1836 aUL
.SetUpper( o3tl::narrowing
<sal_uInt16
>(aLR
.GetRight()) );
1837 aUL
.SetLower( o3tl::narrowing
<sal_uInt16
>(aLR
.GetRight()) );
1841 pNewPgDsc
->SetUseOn( UseOnPage::All
);
1845 case RES_POOLPAGE_FOOTNOTE
: // "Footnote"
1846 case RES_POOLPAGE_ENDNOTE
: // "Endnote"
1848 lcl_PutStdPageSizeIntoItemSet( m_rDoc
, aSet
);
1851 pNewPgDsc
->SetUseOn( UseOnPage::All
);
1852 SwPageFootnoteInfo
aInf( pNewPgDsc
->GetFootnoteInfo() );
1853 aInf
.SetLineWidth( 0 );
1854 aInf
.SetTopDist( 0 );
1855 aInf
.SetBottomDist( 0 );
1856 pNewPgDsc
->SetFootnoteInfo( aInf
);
1860 case RES_POOLPAGE_LANDSCAPE
: // "Landscape"
1862 SwPageDesc
* pStdPgDsc
= GetPageDescFromPool( RES_POOLPAGE_STANDARD
);
1863 SwFormatFrameSize
aFrameSz( pStdPgDsc
->GetMaster().GetFrameSize() );
1864 if ( !pStdPgDsc
->GetLandscape() )
1866 const SwTwips nTmp
= aFrameSz
.GetHeight();
1867 aFrameSz
.SetHeight( aFrameSz
.GetWidth() );
1868 aFrameSz
.SetWidth( nTmp
);
1870 aSet
.Put( aFrameSz
);
1873 pNewPgDsc
->SetUseOn( UseOnPage::All
);
1874 pNewPgDsc
->SetLandscape( true );
1884 pNewPgDsc
->GetLeft().SetFormatAttr( aSet
);
1885 pNewPgDsc
->GetFirstLeft().SetFormatAttr( aSet
);
1887 pNewPgDsc
->GetMaster().SetFormatAttr( aSet
);
1888 pNewPgDsc
->GetFirstMaster().SetFormatAttr( aSet
);
1893 SwNumRule
* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId
)
1895 OSL_ENSURE( RES_POOLNUMRULE_BEGIN
<= nId
&& nId
< RES_POOLNUMRULE_END
,
1896 "Wrong AutoFormat Id" );
1898 SwNumRule
* pNewRule
;
1900 for (size_t n
= 0; n
< m_rDoc
.GetNumRuleTable().size(); ++n
)
1902 pNewRule
= m_rDoc
.GetNumRuleTable()[ n
];
1903 if (nId
== pNewRule
->GetPoolFormatId())
1909 // error: unknown Pool style
1910 if( RES_POOLNUMRULE_BEGIN
> nId
|| nId
>= RES_POOLNUMRULE_END
)
1912 OSL_ENSURE( false, "invalid Id" );
1913 nId
= RES_POOLNUMRULE_BEGIN
;
1916 static_assert(SAL_N_ELEMENTS(STR_POOLNUMRULE_NUM_ARY
) == RES_POOLNUMRULE_END
- RES_POOLNUMRULE_BEGIN
, "### unexpected size!");
1917 OUString
aNm(SwResId(STR_POOLNUMRULE_NUM_ARY
[nId
- RES_POOLNUMRULE_BEGIN
]));
1919 SwCharFormat
*pNumCFormat
= nullptr, *pBullCFormat
= nullptr;
1921 const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode
1922 = numfunc::GetDefaultPositionAndSpaceMode(); //#i89178#
1924 bool bIsModified
= m_rDoc
.getIDocumentState().IsModified();
1926 sal_uInt16 n
= m_rDoc
.MakeNumRule( aNm
, nullptr, false, eNumberFormatPositionAndSpaceMode
);
1928 pNewRule
= m_rDoc
.GetNumRuleTable()[ n
];
1929 pNewRule
->SetPoolFormatId( nId
);
1930 pNewRule
->SetAutoRule( false );
1932 if( RES_POOLNUMRULE_NUM1
<= nId
&& nId
<= RES_POOLNUMRULE_NUM5
)
1933 pNumCFormat
= GetCharFormatFromPool( RES_POOLCHR_NUM_LEVEL
);
1935 if( ( RES_POOLNUMRULE_BUL1
<= nId
&& nId
<= RES_POOLNUMRULE_BUL5
) ||
1936 RES_POOLNUMRULE_NUM5
== nId
)
1937 pBullCFormat
= GetCharFormatFromPool( RES_POOLCHR_NUM_LEVEL
);
1940 m_rDoc
.getIDocumentState().ResetModified();
1945 case RES_POOLNUMRULE_NUM1
:
1947 SwNumFormat aFormat
;
1948 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
1949 aFormat
.SetNumberingType(SVX_NUM_ARABIC
);
1950 aFormat
.SetCharFormat( pNumCFormat
);
1951 aFormat
.SetStart( 1 );
1952 aFormat
.SetIncludeUpperLevels( 1 );
1954 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
1956 // cm: 0.7 cm intervals, with 1 cm = 567
1957 397, 794, 1191, 1588, 1985, 2381, 2778, 3175, 3572, 3969
1959 const sal_uInt16
* pArr
= aAbsSpace
;
1961 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1963 aFormat
.SetFirstLineOffset( - (*pArr
) );
1965 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1967 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
1968 aFormat
.SetFirstLineIndent( - (*pArr
) );
1971 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
1973 aFormat
.SetListFormat("", ".", n
);
1974 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
1976 aFormat
.SetAbsLSpace( *pArr
+ 357 ); // 357 is indent of 0.63 cm
1978 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
1980 aFormat
.SetListtabPos( *pArr
);
1981 aFormat
.SetIndentAt( *pArr
+ 357 );
1984 pNewRule
->Set( n
, aFormat
);
1989 case RES_POOLNUMRULE_NUM2
:
1991 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
1993 397, 397, 397, 397, // 0.70 cm intervals
1998 const sal_uInt16
* pArr
= aAbsSpace
;
1999 SwNumFormat aFormat
;
2001 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2002 aFormat
.SetNumberingType(SVX_NUM_CHARS_UPPER_LETTER
);
2003 aFormat
.SetCharFormat( pNumCFormat
);
2004 aFormat
.SetStart( 1 );
2005 aFormat
.SetIncludeUpperLevels( 1 );
2007 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2009 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2012 sal_uInt16 nSpace
= 357; // indent of 0.63 cm
2013 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
)
2015 aFormat
.SetListFormat("", ".", n
);
2016 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2018 nSpace
+= pArr
[ n
];
2019 aFormat
.SetAbsLSpace( nSpace
);
2020 aFormat
.SetFirstLineOffset( - pArr
[ n
] );
2022 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2024 nSpace
+= pArr
[ n
];
2025 aFormat
.SetListtabPos( nSpace
);
2026 aFormat
.SetIndentAt( nSpace
);
2027 aFormat
.SetFirstLineIndent( - pArr
[ n
] );
2030 pNewRule
->Set( n
, aFormat
);
2034 case RES_POOLNUMRULE_NUM3
:
2036 SwNumFormat aFormat
;
2038 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2039 aFormat
.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER
);
2040 aFormat
.SetCharFormat( pNumCFormat
);
2041 aFormat
.SetStart( 1 );
2042 aFormat
.SetIncludeUpperLevels( 1 );
2044 tools::Long
const nOffs
= 397; // 0.70 cm
2046 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2048 aFormat
.SetFirstLineOffset( - nOffs
);
2050 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2052 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2053 aFormat
.SetFirstLineIndent( - nOffs
);
2056 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
)
2058 aFormat
.SetListFormat("", ".", n
);
2059 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2061 aFormat
.SetAbsLSpace( (n
+1) * nOffs
+ 357 ); // 357 is indent of 0.63 cm
2063 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2065 tools::Long nPos
= (n
+1) * nOffs
;
2066 aFormat
.SetListtabPos(nPos
+ 357);
2067 aFormat
.SetIndentAt(nPos
+ 357);
2070 pNewRule
->Set( n
, aFormat
);
2074 case RES_POOLNUMRULE_NUM4
:
2076 SwNumFormat aFormat
;
2078 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2079 aFormat
.SetNumberingType(SVX_NUM_ROMAN_UPPER
);
2080 aFormat
.SetCharFormat( pNumCFormat
);
2081 aFormat
.SetStart( 1 );
2082 aFormat
.SetIncludeUpperLevels( 1 );
2083 aFormat
.SetNumAdjust( SvxAdjust::Right
);
2085 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
2087 // cm: 1.33 cm intervals
2088 754, 1508, 2262, 3016, 3771, 4525, 5279, 6033, 6787, 7541
2090 const sal_uInt16
* pArr
= aAbsSpace
;
2092 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2094 aFormat
.SetFirstLineOffset( 580 - (*pArr
) ); // 1 cm space
2096 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2098 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2099 aFormat
.SetFirstLineIndent( 580 - (*pArr
) );
2102 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2104 aFormat
.SetListFormat("", ".", n
);
2105 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2107 aFormat
.SetAbsLSpace( *pArr
);
2109 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2111 aFormat
.SetListtabPos( *pArr
);
2112 aFormat
.SetIndentAt( *pArr
);
2115 pNewRule
->Set( n
, aFormat
);
2119 case RES_POOLNUMRULE_NUM5
:
2121 // [ First, LSpace ]
2122 static const sal_uInt16 aAbsSpace0to2
[] =
2124 174, 754, // 0.33, 1.33cm
2125 174, 1508, // 0.33, 2.66cm
2126 397, 2262 // 0.70, 4.00cm
2129 const sal_uInt16
* pArr0to2
= aAbsSpace0to2
;
2130 SwNumFormat aFormat
;
2132 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2133 aFormat
.SetNumberingType(SVX_NUM_ROMAN_LOWER
);
2134 aFormat
.SetStart( 1 );
2135 aFormat
.SetIncludeUpperLevels( 1 );
2136 aFormat
.SetNumAdjust( SvxAdjust::Right
);
2137 aFormat
.SetListFormat("", ".", 0);
2139 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2141 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2144 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2146 aFormat
.SetFirstLineOffset(- pArr0to2
[0]); // num ends at 1.00 cm
2147 aFormat
.SetAbsLSpace(pArr0to2
[1]); // text starts at 1.33 cm
2149 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2151 aFormat
.SetFirstLineIndent( -pArr0to2
[0] );
2152 aFormat
.SetListtabPos( pArr0to2
[1] );
2153 aFormat
.SetIndentAt( pArr0to2
[1] );
2156 aFormat
.SetCharFormat( pNumCFormat
);
2157 pNewRule
->Set( 0, aFormat
);
2159 aFormat
.SetNumberingType(SVX_NUM_ROMAN_UPPER
);
2160 aFormat
.SetIncludeUpperLevels( 1 );
2161 aFormat
.SetListFormat("", ".", 1);
2163 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2165 aFormat
.SetFirstLineOffset(- pArr0to2
[2]); // num ends at 2.33 cm
2166 aFormat
.SetAbsLSpace(pArr0to2
[3]); // text starts at 2.66 cm
2168 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2170 aFormat
.SetFirstLineIndent( -pArr0to2
[2] );
2171 aFormat
.SetListtabPos( pArr0to2
[3] );
2172 aFormat
.SetIndentAt( pArr0to2
[3] );
2175 pNewRule
->Set( 1, aFormat
);
2177 aFormat
.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER
);
2178 aFormat
.SetIncludeUpperLevels( 1 );
2179 aFormat
.SetListFormat("", u
")", 2);
2180 aFormat
.SetNumAdjust( SvxAdjust::Left
);
2182 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2184 aFormat
.SetFirstLineOffset(- pArr0to2
[4]); // num starts at 3.30 cm
2185 aFormat
.SetAbsLSpace(pArr0to2
[5]); // text starts at 4.00 cm
2187 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2189 aFormat
.SetFirstLineIndent( -pArr0to2
[4] );
2190 aFormat
.SetListtabPos( pArr0to2
[5] );
2191 aFormat
.SetIndentAt( pArr0to2
[5] );
2194 pNewRule
->Set( 2, aFormat
);
2196 aFormat
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2197 aFormat
.SetCharFormat( pBullCFormat
);
2198 aFormat
.SetBulletFont( &numfunc::GetDefBulletFont() );
2199 aFormat
.SetBulletChar( cBulletChar
);
2200 sal_Int16 nOffs
= o3tl::convert(660, o3tl::Length::mm100
, o3tl::Length::twip
),
2201 nOffs2
= o3tl::convert(4000, o3tl::Length::mm100
, o3tl::Length::twip
);
2203 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2205 aFormat
.SetFirstLineOffset( - nOffs
);
2207 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2209 aFormat
.SetFirstLineIndent( - nOffs
);
2212 for (sal_uInt16 n
= 3; n
< MAXLEVEL
; ++n
)
2214 aFormat
.SetStart( n
+1 );
2215 aFormat
.SetListFormat("", "", n
);
2217 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2219 aFormat
.SetAbsLSpace(nOffs2
+ ((n
- 2) * static_cast<tools::Long
>(nOffs
)));
2221 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2223 tools::Long nPos
= nOffs2
+ ((n
- 2) * static_cast<tools::Long
>(nOffs
));
2224 aFormat
.SetListtabPos(nPos
);
2225 aFormat
.SetIndentAt(nPos
);
2228 pNewRule
->Set( n
, aFormat
);
2233 case RES_POOLNUMRULE_BUL1
:
2235 SwNumFormat aFormat
;
2237 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2238 aFormat
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2239 aFormat
.SetCharFormat( pBullCFormat
);
2240 aFormat
.SetStart( 1 );
2241 aFormat
.SetIncludeUpperLevels( 1 );
2242 aFormat
.SetBulletFont( &numfunc::GetDefBulletFont() );
2243 aFormat
.SetBulletChar( cBulletChar
);
2245 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
2247 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2248 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2250 const sal_uInt16
* pArr
= aAbsSpace
;
2252 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2254 aFormat
.SetFirstLineOffset( - (*pArr
) );
2256 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2258 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2259 aFormat
.SetFirstLineIndent( - (*pArr
) );
2262 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2264 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2266 aFormat
.SetAbsLSpace( *pArr
);
2268 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2270 aFormat
.SetListtabPos( *pArr
);
2271 aFormat
.SetIndentAt( *pArr
);
2274 pNewRule
->Set( n
, aFormat
);
2278 case RES_POOLNUMRULE_BUL2
:
2280 SwNumFormat aFormat
;
2282 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2283 aFormat
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2284 aFormat
.SetCharFormat( pBullCFormat
);
2285 aFormat
.SetStart( 1 );
2286 aFormat
.SetIncludeUpperLevels( 1 );
2287 aFormat
.SetBulletFont( &numfunc::GetDefBulletFont() );
2288 aFormat
.SetBulletChar( 0x2013 );
2290 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
2292 // cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0
2293 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2295 const sal_uInt16
* pArr
= aAbsSpace
;
2297 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2299 aFormat
.SetFirstLineOffset( - (*pArr
) );
2301 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2303 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2304 aFormat
.SetFirstLineIndent( - (*pArr
) );
2307 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2309 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2311 aFormat
.SetAbsLSpace( *pArr
);
2313 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2315 aFormat
.SetListtabPos( *pArr
);
2316 aFormat
.SetIndentAt( *pArr
);
2319 pNewRule
->Set( n
, aFormat
);
2323 case RES_POOLNUMRULE_BUL3
:
2325 SwNumFormat aFormat
;
2327 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2329 aFormat
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2330 aFormat
.SetCharFormat( pBullCFormat
);
2331 aFormat
.SetStart( 1 );
2332 aFormat
.SetIncludeUpperLevels( 1 );
2333 aFormat
.SetBulletFont( &numfunc::GetDefBulletFont() );
2335 sal_uInt16 nOffs
= o3tl::convert(4, o3tl::Length::mm
, o3tl::Length::twip
);
2337 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2339 aFormat
.SetFirstLineOffset( - nOffs
);
2341 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2343 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2344 aFormat
.SetFirstLineIndent( - nOffs
);
2347 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
)
2349 aFormat
.SetBulletChar( (n
& 1) ? 0x25a1 : 0x2611 );
2351 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2353 aFormat
.SetAbsLSpace( ((n
& 1) +1) * nOffs
);
2355 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2357 tools::Long nPos
= ((n
& 1) +1) * static_cast<tools::Long
>(nOffs
);
2358 aFormat
.SetListtabPos(nPos
);
2359 aFormat
.SetIndentAt(nPos
);
2362 pNewRule
->Set( n
, aFormat
);
2366 case RES_POOLNUMRULE_BUL4
:
2368 SwNumFormat aFormat
;
2370 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2371 aFormat
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2372 aFormat
.SetCharFormat( pBullCFormat
);
2373 aFormat
.SetStart( 1 );
2374 aFormat
.SetIncludeUpperLevels( 1 );
2375 aFormat
.SetBulletFont( &numfunc::GetDefBulletFont() );
2377 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
2379 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2380 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2383 const sal_uInt16
* pArr
= aAbsSpace
;
2385 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2387 aFormat
.SetFirstLineOffset( - (*pArr
) );
2389 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2391 aFormat
.SetLabelFollowedBy( SvxNumberFormat::SPACE
);
2392 aFormat
.SetFirstLineIndent( - (*pArr
) );
2395 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2399 case 0: aFormat
.SetBulletChar( 0x27a2 ); break;
2400 case 1: aFormat
.SetBulletChar( 0xE006 ); break;
2401 default: aFormat
.SetBulletChar( 0xE004 ); break;
2404 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2406 aFormat
.SetAbsLSpace( *pArr
);
2408 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2410 aFormat
.SetListtabPos( *pArr
);
2411 aFormat
.SetIndentAt( *pArr
);
2414 pNewRule
->Set( n
, aFormat
);
2418 case RES_POOLNUMRULE_BUL5
:
2420 SwNumFormat aFormat
;
2422 aFormat
.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode
);
2423 aFormat
.SetNumberingType(SVX_NUM_CHAR_SPECIAL
);
2424 aFormat
.SetCharFormat( pBullCFormat
);
2425 aFormat
.SetStart( 1 );
2426 aFormat
.SetIncludeUpperLevels( 1 );
2427 aFormat
.SetBulletChar( 0x2717 );
2428 aFormat
.SetBulletFont( &numfunc::GetDefBulletFont() );
2430 static const sal_uInt16 aAbsSpace
[ MAXLEVEL
] =
2432 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2433 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2435 const sal_uInt16
* pArr
= aAbsSpace
;
2437 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2439 aFormat
.SetFirstLineOffset( - (*pArr
) );
2441 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2443 aFormat
.SetLabelFollowedBy( SvxNumberFormat::LISTTAB
);
2444 aFormat
.SetFirstLineIndent( - (*pArr
) );
2447 for (sal_uInt16 n
= 0; n
< MAXLEVEL
; ++n
, ++pArr
)
2449 if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_WIDTH_AND_POSITION
)
2451 aFormat
.SetAbsLSpace( *pArr
);
2453 else if ( eNumberFormatPositionAndSpaceMode
== SvxNumberFormat::LABEL_ALIGNMENT
)
2455 aFormat
.SetListtabPos( *pArr
);
2456 aFormat
.SetIndentAt( *pArr
);
2459 pNewRule
->Set( n
, aFormat
);
2468 /// Check if this AutoCollection is already/still in use in this Document
2469 bool DocumentStylePoolManager::IsPoolTextCollUsed( sal_uInt16 nId
) const
2472 (RES_POOLCOLL_TEXT_BEGIN
<= nId
&& nId
< RES_POOLCOLL_TEXT_END
) ||
2473 (RES_POOLCOLL_LISTS_BEGIN
<= nId
&& nId
< RES_POOLCOLL_LISTS_END
) ||
2474 (RES_POOLCOLL_EXTRA_BEGIN
<= nId
&& nId
< RES_POOLCOLL_EXTRA_END
) ||
2475 (RES_POOLCOLL_REGISTER_BEGIN
<= nId
&& nId
< RES_POOLCOLL_REGISTER_END
) ||
2476 (RES_POOLCOLL_DOC_BEGIN
<= nId
&& nId
< RES_POOLCOLL_DOC_END
) ||
2477 (RES_POOLCOLL_HTML_BEGIN
<= nId
&& nId
< RES_POOLCOLL_HTML_END
),
2478 "Wrong AutoFormat Id" );
2480 SwTextFormatColl
* pNewColl
= nullptr;
2482 for( SwTextFormatColls::size_type n
= 0; !bFnd
&& n
< m_rDoc
.GetTextFormatColls()->size(); ++n
)
2484 pNewColl
= (*m_rDoc
.GetTextFormatColls())[ n
];
2485 if( nId
== pNewColl
->GetPoolFormatId() )
2489 if( !bFnd
|| !pNewColl
->HasWriterListeners() )
2492 SwAutoFormatGetDocNode
aGetHt( &m_rDoc
.GetNodes() );
2493 return !pNewColl
->GetInfo( aGetHt
);
2496 /// Check if this AutoCollection is already/still in use
2497 bool DocumentStylePoolManager::IsPoolFormatUsed( sal_uInt16 nId
) const
2499 const SwFormat
*pNewFormat
= nullptr;
2500 const SwFormatsBase
* pArray
[ 2 ];
2501 sal_uInt16 nArrCnt
= 1;
2504 if (RES_POOLCHR_BEGIN
<= nId
&& nId
< RES_POOLCHR_END
)
2506 pArray
[0] = m_rDoc
.GetCharFormats();
2508 else if (RES_POOLFRM_BEGIN
<= nId
&& nId
< RES_POOLFRM_END
)
2510 pArray
[0] = m_rDoc
.GetFrameFormats();
2511 pArray
[1] = m_rDoc
.GetSpzFrameFormats();
2516 SAL_WARN("sw.core", "Invalid Pool Id: " << nId
<< " should be within "
2517 "[" << int(RES_POOLCHR_BEGIN
) << "," << int(RES_POOLCHR_END
) << ") or "
2518 "[" << int(RES_POOLFRM_BEGIN
) << "," << int(RES_POOLFRM_END
) << ")");
2525 while( nArrCnt
-- && !bFnd
)
2526 for( size_t n
= 0; !bFnd
&& n
< (*pArray
[nArrCnt
]).GetFormatCount(); ++n
)
2528 pNewFormat
= (*pArray
[ nArrCnt
] ).GetFormat( n
);
2529 if( nId
== pNewFormat
->GetPoolFormatId() )
2534 // Not found or no dependencies?
2535 if( bFnd
&& pNewFormat
->HasWriterListeners() )
2537 // Check if we have dependent ContentNodes in the Nodes array
2538 // (also indirect ones for derived Formats)
2539 SwAutoFormatGetDocNode
aGetHt( &m_rDoc
.GetNodes() );
2540 bFnd
= !pNewFormat
->GetInfo( aGetHt
);
2548 /// Check if this AutoCollection is already/still in use in this Document
2549 bool DocumentStylePoolManager::IsPoolPageDescUsed( sal_uInt16 nId
) const
2551 OSL_ENSURE( RES_POOLPAGE_BEGIN
<= nId
&& nId
< RES_POOLPAGE_END
,
2552 "Wrong AutoFormat Id" );
2553 SwPageDesc
*pNewPgDsc
= nullptr;
2555 for( size_t n
= 0; !bFnd
&& n
< m_rDoc
.GetPageDescCnt(); ++n
)
2557 pNewPgDsc
= &m_rDoc
.GetPageDesc(n
);
2558 if( nId
== pNewPgDsc
->GetPoolFormatId() )
2562 // Not found or no dependencies?
2563 if( !bFnd
|| !pNewPgDsc
->HasWriterListeners() ) // ??????
2566 // Check if we have dependent ContentNodes in the Nodes array
2567 // (also indirect ones for derived Formats)
2568 SwAutoFormatGetDocNode
aGetHt( &m_rDoc
.GetNodes() );
2569 return !pNewPgDsc
->GetInfo( aGetHt
);
2572 DocumentStylePoolManager::~DocumentStylePoolManager()
2578 static std::vector
<OUString
>
2579 lcl_NewUINameArray(const TranslateId
* pIds
, const size_t nLen
, const size_t nSvxIds
= 0)
2581 assert(nSvxIds
<= nLen
);
2582 const size_t nWriterIds
= nLen
- nSvxIds
;
2583 std::vector
<OUString
> aNameArray
;
2584 aNameArray
.reserve(nLen
);
2585 for (size_t i
= 0; i
< nWriterIds
; ++i
)
2586 aNameArray
.push_back(SwResId(pIds
[i
]));
2587 for (size_t i
= nWriterIds
; i
< nLen
; ++i
)
2588 aNameArray
.push_back(SvxResId(pIds
[i
]));
2592 const std::vector
<OUString
>& SwStyleNameMapper::GetTextUINameArray()
2594 SvtSysLocale aSysLocale
;
2595 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2596 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aTextUINameArray
;
2598 auto it
= s_aTextUINameArray
.find(rCurrentLanguage
);
2599 if (it
== s_aTextUINameArray
.end())
2600 it
= s_aTextUINameArray
.emplace(rCurrentLanguage
,
2601 lcl_NewUINameArray(STR_POOLCOLL_TEXT_ARY
, SAL_N_ELEMENTS(STR_POOLCOLL_TEXT_ARY
))).first
;
2606 const std::vector
<OUString
>& SwStyleNameMapper::GetListsUINameArray()
2608 SvtSysLocale aSysLocale
;
2609 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2610 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aListsUINameArray
;
2612 auto it
= s_aListsUINameArray
.find(rCurrentLanguage
);
2613 if (it
== s_aListsUINameArray
.end())
2614 it
= s_aListsUINameArray
.emplace(rCurrentLanguage
,
2615 lcl_NewUINameArray(STR_POOLCOLL_LISTS_ARY
, SAL_N_ELEMENTS(STR_POOLCOLL_LISTS_ARY
))).first
;
2620 const std::vector
<OUString
>& SwStyleNameMapper::GetExtraUINameArray()
2622 SvtSysLocale aSysLocale
;
2623 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2624 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aExtraUINameArray
;
2626 auto it
= s_aExtraUINameArray
.find(rCurrentLanguage
);
2627 if (it
== s_aExtraUINameArray
.end())
2628 it
= s_aExtraUINameArray
.emplace(rCurrentLanguage
,
2629 lcl_NewUINameArray(STR_POOLCOLL_EXTRA_ARY
, SAL_N_ELEMENTS(STR_POOLCOLL_EXTRA_ARY
))).first
;
2634 const std::vector
<OUString
>& SwStyleNameMapper::GetRegisterUINameArray()
2636 SvtSysLocale aSysLocale
;
2637 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2638 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aRegisterUINameArray
;
2640 auto it
= s_aRegisterUINameArray
.find(rCurrentLanguage
);
2641 if (it
== s_aRegisterUINameArray
.end())
2642 it
= s_aRegisterUINameArray
.emplace(rCurrentLanguage
,
2643 lcl_NewUINameArray(STR_POOLCOLL_REGISTER_ARY
, SAL_N_ELEMENTS(STR_POOLCOLL_REGISTER_ARY
))).first
;
2648 const std::vector
<OUString
>& SwStyleNameMapper::GetDocUINameArray()
2650 SvtSysLocale aSysLocale
;
2651 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2652 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aDocUINameArray
;
2654 auto it
= s_aDocUINameArray
.find(rCurrentLanguage
);
2655 if (it
== s_aDocUINameArray
.end())
2656 it
= s_aDocUINameArray
.emplace(rCurrentLanguage
,
2657 lcl_NewUINameArray(STR_POOLCOLL_DOC_ARY
, SAL_N_ELEMENTS(STR_POOLCOLL_DOC_ARY
))).first
;
2662 const std::vector
<OUString
>& SwStyleNameMapper::GetHTMLUINameArray()
2664 SvtSysLocale aSysLocale
;
2665 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2666 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aHTMLUINameArray
;
2668 auto it
= s_aHTMLUINameArray
.find(rCurrentLanguage
);
2669 if (it
== s_aHTMLUINameArray
.end())
2670 it
= s_aHTMLUINameArray
.emplace(rCurrentLanguage
,
2671 lcl_NewUINameArray(STR_POOLCOLL_HTML_ARY
, SAL_N_ELEMENTS(STR_POOLCOLL_HTML_ARY
))).first
;
2676 const std::vector
<OUString
>& SwStyleNameMapper::GetFrameFormatUINameArray()
2678 SvtSysLocale aSysLocale
;
2679 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2680 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aFrameFormatUINameArray
;
2682 auto it
= s_aFrameFormatUINameArray
.find(rCurrentLanguage
);
2683 if (it
== s_aFrameFormatUINameArray
.end())
2684 it
= s_aFrameFormatUINameArray
.emplace(rCurrentLanguage
,
2685 lcl_NewUINameArray(STR_POOLFRM_ARY
, SAL_N_ELEMENTS(STR_POOLFRM_ARY
))).first
;
2690 const std::vector
<OUString
>& SwStyleNameMapper::GetChrFormatUINameArray()
2692 SvtSysLocale aSysLocale
;
2693 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2694 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aChrFormatUINameArray
;
2696 auto it
= s_aChrFormatUINameArray
.find(rCurrentLanguage
);
2697 if (it
== s_aChrFormatUINameArray
.end())
2698 it
= s_aChrFormatUINameArray
.emplace(rCurrentLanguage
,
2699 lcl_NewUINameArray(STR_POOLCHR_ARY
, SAL_N_ELEMENTS(STR_POOLCHR_ARY
))).first
;
2704 const std::vector
<OUString
>& SwStyleNameMapper::GetHTMLChrFormatUINameArray()
2706 SvtSysLocale aSysLocale
;
2707 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2708 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aHTMLChrFormatUINameArray
;
2710 auto it
= s_aHTMLChrFormatUINameArray
.find(rCurrentLanguage
);
2711 if (it
== s_aHTMLChrFormatUINameArray
.end())
2712 it
= s_aHTMLChrFormatUINameArray
.emplace(rCurrentLanguage
,
2713 lcl_NewUINameArray(STR_POOLCHR_HTML_ARY
, SAL_N_ELEMENTS(STR_POOLCHR_HTML_ARY
))).first
;
2718 const std::vector
<OUString
>& SwStyleNameMapper::GetPageDescUINameArray()
2720 SvtSysLocale aSysLocale
;
2721 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2722 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aPageDescUINameArray
;
2724 auto it
= s_aPageDescUINameArray
.find(rCurrentLanguage
);
2725 if (it
== s_aPageDescUINameArray
.end())
2726 it
= s_aPageDescUINameArray
.emplace(rCurrentLanguage
,
2727 lcl_NewUINameArray(STR_POOLPAGE_ARY
, SAL_N_ELEMENTS(STR_POOLPAGE_ARY
))).first
;
2732 const std::vector
<OUString
>& SwStyleNameMapper::GetNumRuleUINameArray()
2734 SvtSysLocale aSysLocale
;
2735 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2736 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aNumRuleUINameArray
;
2738 auto it
= s_aNumRuleUINameArray
.find(rCurrentLanguage
);
2739 if (it
== s_aNumRuleUINameArray
.end())
2740 it
= s_aNumRuleUINameArray
.emplace(rCurrentLanguage
,
2741 lcl_NewUINameArray(STR_POOLNUMRULE_NUM_ARY
, SAL_N_ELEMENTS(STR_POOLNUMRULE_NUM_ARY
))).first
;
2746 const std::vector
<OUString
>& SwStyleNameMapper::GetTableStyleUINameArray()
2748 SvtSysLocale aSysLocale
;
2749 const LanguageTag
& rCurrentLanguage
= aSysLocale
.GetUILanguageTag();
2750 static std::map
<LanguageTag
, std::vector
<OUString
>> s_aTableStyleUINameArray
;
2752 auto it
= s_aTableStyleUINameArray
.find(rCurrentLanguage
);
2753 if (it
== s_aTableStyleUINameArray
.end())
2754 it
= s_aTableStyleUINameArray
.emplace(rCurrentLanguage
,
2755 // 1 Writer resource string (XXX if this ever changes rather use offset math)
2756 lcl_NewUINameArray(STR_TABSTYLE_ARY
, SAL_N_ELEMENTS(STR_TABSTYLE_ARY
),
2757 static_cast<size_t>(SAL_N_ELEMENTS(STR_TABSTYLE_ARY
) - 1))).first
;
2762 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */