LibreOffice Module sw (master)  1
DocumentStylePoolManager.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
20 #include <SwStyleNameMapper.hxx>
21 #include <doc.hxx>
23 #include <IDocumentState.hxx>
24 #include <IDocumentUndoRedo.hxx>
25 #include <fmtanchr.hxx>
26 #include <fmtfsize.hxx>
27 #include <paratr.hxx>
28 #include <poolfmt.hxx>
29 #include <fmtornt.hxx>
30 #include <charfmt.hxx>
31 #include <fmtsrnd.hxx>
32 #include <docary.hxx>
33 #include <GetMetricVal.hxx>
34 #include <pagedesc.hxx>
35 #include <frmfmt.hxx>
36 #include <fmtline.hxx>
37 #include <numrule.hxx>
38 #include <hints.hxx>
39 #include <editeng/paperinf.hxx>
40 #include <editeng/wghtitem.hxx>
41 #include <editeng/fontitem.hxx>
42 #include <editeng/fhgtitem.hxx>
43 #include <editeng/tstpitem.hxx>
44 #include <editeng/lrspitem.hxx>
45 #include <editeng/ulspitem.hxx>
46 #include <editeng/lspcitem.hxx>
47 #include <editeng/adjustitem.hxx>
48 #include <editeng/postitem.hxx>
49 #include <editeng/keepitem.hxx>
50 #include <editeng/opaqitem.hxx>
51 #include <editeng/boxitem.hxx>
52 #include <editeng/cmapitem.hxx>
53 #include <editeng/udlnitem.hxx>
54 #include <editeng/colritem.hxx>
55 #include <editeng/protitem.hxx>
57 #include <editeng/langitem.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>
66 #include <frmatr.hxx>
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>
73 #include <comphelper/lok.hxx>
74 
75 using namespace ::editeng;
76 using namespace ::com::sun::star;
77 
78 bool IsConditionalByPoolId(sal_uInt16 nId)
79 {
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;
84 }
85 
86 namespace
87 {
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_10 = 10 * 20; // 10 pt
92  const sal_uInt16 PT_12 = 12 * 20; // 12 pt
93  const sal_uInt16 PT_14 = 14 * 20; // 14 pt
94  const sal_uInt16 PT_16 = 16 * 20; // 16 pt
95  const sal_uInt16 PT_18 = 18 * 20; // 18 pt
96  const sal_uInt16 PT_24 = 24 * 20; // 24 pt
97  const sal_uInt16 PT_28 = 28 * 20; // 28 pt
98 
99  #define HTML_PARSPACE GetMetricVal( CM_05 )
100 
101  const sal_uInt16 aHeadlineSizes[ 2 * MAXLEVEL ] = {
102  // we do everything percentual now:
103  130, 115, 101, 95, 85,
104  85, 80, 80, 75, 75, // normal
105  PT_24, PT_18, PT_14, PT_12, PT_10,
106  PT_7, PT_7, PT_7, PT_7, PT_7 // HTML mode
107  };
108 
109  tools::Long lcl_GetRightMargin( SwDoc& rDoc )
110  {
111  // Make sure that the printer settings are taken over to the standard
112  // page style
113  const SwFrameFormat& rPgDscFormat = rDoc.GetPageDesc( 0 ).GetMaster();
114  const SvxLRSpaceItem& rLR = rPgDscFormat.GetLRSpace();
115  const tools::Long nLeft = rLR.GetLeft();
116  const tools::Long nRight = rLR.GetRight();
117  const tools::Long nWidth = rPgDscFormat.GetFrameSize().GetWidth();
118  return nWidth - nLeft - nRight;
119  }
120 
121  void lcl_SetDfltFont( DefaultFontType nFntType, SfxItemSet& rSet )
122  {
123  static struct {
124  sal_uInt16 nResLngId;
125  sal_uInt16 nResFntId;
126  } aArr[ 3 ] = {
130  };
131  for(const auto & n : aArr)
132  {
133  LanguageType nLng = static_cast<const SvxLanguageItem&>(rSet.GetPool()->GetDefaultItem(
134  n.nResLngId )).GetLanguage();
135  vcl::Font aFnt( OutputDevice::GetDefaultFont( nFntType,
136  nLng, GetDefaultFontFlags::OnlyOne ) );
137 
138  rSet.Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(),
139  OUString(), aFnt.GetPitch(),
140  aFnt.GetCharSet(), n.nResFntId ));
141  }
142  }
143 
144  void lcl_SetDfltFont( DefaultFontType nLatinFntType, DefaultFontType nCJKFntType,
145  DefaultFontType nCTLFntType, SfxItemSet& rSet )
146  {
147  static struct {
148  sal_uInt16 nResLngId;
149  sal_uInt16 nResFntId;
150  DefaultFontType nFntType;
151  } aArr[ 3 ] = {
155  };
156  aArr[0].nFntType = nLatinFntType;
157  aArr[1].nFntType = nCJKFntType;
158  aArr[2].nFntType = nCTLFntType;
159 
160  for(const auto & n : aArr)
161  {
162  LanguageType nLng = static_cast<const SvxLanguageItem&>(rSet.GetPool()->GetDefaultItem(
163  n.nResLngId )).GetLanguage();
164  vcl::Font aFnt( OutputDevice::GetDefaultFont( n.nFntType,
165  nLng, GetDefaultFontFlags::OnlyOne ) );
166 
167  rSet.Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(),
168  OUString(), aFnt.GetPitch(),
169  aFnt.GetCharSet(), n.nResFntId ));
170  }
171  }
172 
173  void lcl_SetHeadline( SwDoc& rDoc, SwTextFormatColl* pColl,
174  SfxItemSet& rSet,
175  sal_uInt16 nOutLvlBits, sal_uInt8 nLevel, bool bItalic )
176  {
177  SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
178  SvxFontHeightItem aHItem(240, 100, RES_CHRATR_FONTSIZE);
179  const bool bHTMLMode = rDoc.GetDocumentSettingManager().get(DocumentSettingId::HTML_MODE);
180  if( bHTMLMode )
181  aHItem.SetHeight( aHeadlineSizes[ MAXLEVEL + nLevel ] );
182  else
183  aHItem.SetHeight( PT_14, aHeadlineSizes[ nLevel ] );
184  SetAllScriptItem( rSet, aHItem );
185 
186  if( bItalic && !bHTMLMode )
187  SetAllScriptItem( rSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) );
188 
189  if( bHTMLMode )
190  {
191  lcl_SetDfltFont( DefaultFontType::LATIN_TEXT, DefaultFontType::CJK_TEXT,
192  DefaultFontType::CTL_TEXT, rSet );
193  }
194 
195  if( !pColl )
196  return;
197 
198  if( !( nOutLvlBits & ( 1 << nLevel )) )
199  {
200  pColl->AssignToListLevelOfOutlineStyle(nLevel);
201  if( !bHTMLMode )
202  {
203  SwNumRule * pOutlineRule = rDoc.GetOutlineNumRule();
204  const SwNumFormat& rNFormat = pOutlineRule->Get( nLevel );
205 
206  if ( rNFormat.GetPositionAndSpaceMode() ==
208  ( rNFormat.GetAbsLSpace() || rNFormat.GetFirstLineOffset() ) )
209  {
210  SvxLRSpaceItem aLR( pColl->GetFormatAttr( RES_LR_SPACE ) );
212  //TODO: overflow
213  aLR.SetTextLeft( rNFormat.GetAbsLSpace() );
214  pColl->SetFormatAttr( aLR );
215  }
216 
217  // All paragraph styles, which are assigned to a level of the
218  // outline style has to have the outline style set as its list style.
219  SwNumRuleItem aItem(pOutlineRule->GetName());
220  pColl->SetFormatAttr(aItem);
221  }
222  }
224  }
225 
226  void lcl_SetRegister( SwDoc& rDoc, SfxItemSet& rSet, sal_uInt16 nFact,
227  bool bHeader, bool bTab )
228  {
230  sal_uInt16 nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0;
231  aLR.SetTextLeft( nLeft );
232 
233  rSet.Put( aLR );
234  if( bHeader )
235  {
236  SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) );
238  }
239  if( bTab )
240  {
241  tools::Long nRightMargin = lcl_GetRightMargin( rDoc );
242  SvxTabStopItem aTStops( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
243  aTStops.Insert( SvxTabStop( nRightMargin - nLeft,
244  SvxTabAdjust::Right,
245  cDfltDecimalChar, '.' ));
246  rSet.Put( aTStops );
247  }
248  }
249 
250  void lcl_SetNumBul( SwDoc& rDoc, SwTextFormatColl* pColl,
251  SfxItemSet& rSet,
252  sal_uInt16 nNxt, SwTwips nEZ, SwTwips nLeft,
253  SwTwips nUpper, SwTwips nLower )
254  {
255 
258  aLR.SetTextFirstLineOffset( sal_uInt16(nEZ) );
259  aLR.SetTextLeft( sal_uInt16(nLeft) );
260  aUL.SetUpper( sal_uInt16(nUpper) );
261  aUL.SetLower( sal_uInt16(nLower) );
262  rSet.Put( aLR );
263  rSet.Put( aUL );
264 
265  if( pColl )
267  }
268 
269  void lcl_PutStdPageSizeIntoItemSet( SwDoc& rDoc, SfxItemSet& rSet )
270  {
272  SwFormatFrameSize aFrameSz( pStdPgDsc->GetMaster().GetFrameSize() );
273  if( pStdPgDsc->GetLandscape() )
274  {
275  SwTwips nTmp = aFrameSz.GetHeight();
276  aFrameSz.SetHeight( aFrameSz.GetWidth() );
277  aFrameSz.SetWidth( nTmp );
278  }
279  rSet.Put( aFrameSz );
280  }
281 }
282 
283 static const char* STR_POOLCOLL_TEXT_ARY[] =
284 {
285  // Category Text
286  STR_POOLCOLL_STANDARD,
287  STR_POOLCOLL_TEXT,
288  STR_POOLCOLL_TEXT_IDENT,
289  STR_POOLCOLL_TEXT_NEGIDENT,
290  STR_POOLCOLL_TEXT_MOVE,
291  STR_POOLCOLL_GREETING,
292  STR_POOLCOLL_SIGNATURE,
293  STR_POOLCOLL_CONFRONTATION,
294  STR_POOLCOLL_MARGINAL,
295  // Subcategory Headlines
296  STR_POOLCOLL_HEADLINE_BASE,
297  STR_POOLCOLL_HEADLINE1,
298  STR_POOLCOLL_HEADLINE2,
299  STR_POOLCOLL_HEADLINE3,
300  STR_POOLCOLL_HEADLINE4,
301  STR_POOLCOLL_HEADLINE5,
302  STR_POOLCOLL_HEADLINE6,
303  STR_POOLCOLL_HEADLINE7,
304  STR_POOLCOLL_HEADLINE8,
305  STR_POOLCOLL_HEADLINE9,
306  STR_POOLCOLL_HEADLINE10
307 };
308 
309 static const char* STR_POOLCOLL_LISTS_ARY[]
310 {
311  // Category Lists
313  // Subcategory Numbering
334 
335  // Subcategory Enumeration
356 };
357 
358 // Special Areas
359 static const char* STR_POOLCOLL_EXTRA_ARY[]
360 {
361  // Subcategory Header
362  STR_POOLCOLL_HEADERFOOTER,
363  STR_POOLCOLL_HEADER,
364  STR_POOLCOLL_HEADERL,
365  STR_POOLCOLL_HEADERR,
366  // Subcategory Footer
367  STR_POOLCOLL_FOOTER,
368  STR_POOLCOLL_FOOTERL,
369  STR_POOLCOLL_FOOTERR,
370  // Subcategory Table
371  STR_POOLCOLL_TABLE,
372  STR_POOLCOLL_TABLE_HDLN,
373  // Subcategory Labels
374  STR_POOLCOLL_LABEL,
375  STR_POOLCOLL_LABEL_ABB,
376  STR_POOLCOLL_LABEL_TABLE,
377  STR_POOLCOLL_LABEL_FRAME,
378  STR_POOLCOLL_LABEL_FIGURE,
379  // Miscellaneous
380  STR_POOLCOLL_FRAME,
381  STR_POOLCOLL_FOOTNOTE,
382  STR_POOLCOLL_ENVELOPE_ADDRESS,
383  STR_POOLCOLL_SEND_ADDRESS,
384  STR_POOLCOLL_ENDNOTE,
385  STR_POOLCOLL_LABEL_DRAWING
386 };
387 
388 static const char* STR_POOLCOLL_REGISTER_ARY[] =
389 {
390  // Category Directories
391  STR_POOLCOLL_REGISTER_BASE,
392  // Subcategory Index-Directories
393  STR_POOLCOLL_TOX_IDXH,
394  STR_POOLCOLL_TOX_IDX1,
395  STR_POOLCOLL_TOX_IDX2,
396  STR_POOLCOLL_TOX_IDX3,
397  STR_POOLCOLL_TOX_IDXBREAK,
398  // Subcategory Tables of Contents
399  STR_POOLCOLL_TOX_CNTNTH,
400  STR_POOLCOLL_TOX_CNTNT1,
401  STR_POOLCOLL_TOX_CNTNT2,
402  STR_POOLCOLL_TOX_CNTNT3,
403  STR_POOLCOLL_TOX_CNTNT4,
404  STR_POOLCOLL_TOX_CNTNT5,
405  // Subcategory User-Directories:
406  STR_POOLCOLL_TOX_USERH,
407  STR_POOLCOLL_TOX_USER1,
408  STR_POOLCOLL_TOX_USER2,
409  STR_POOLCOLL_TOX_USER3,
410  STR_POOLCOLL_TOX_USER4,
411  STR_POOLCOLL_TOX_USER5,
412  // Subcategory Table of Contents more Levels 5 - 10
413  STR_POOLCOLL_TOX_CNTNT6,
414  STR_POOLCOLL_TOX_CNTNT7,
415  STR_POOLCOLL_TOX_CNTNT8,
416  STR_POOLCOLL_TOX_CNTNT9,
417  STR_POOLCOLL_TOX_CNTNT10,
418  // Illustrations Index
419  STR_POOLCOLL_TOX_ILLUSH,
420  STR_POOLCOLL_TOX_ILLUS1,
421  // Object Index
422  STR_POOLCOLL_TOX_OBJECTH,
423  STR_POOLCOLL_TOX_OBJECT1,
424  // Tables Index
425  STR_POOLCOLL_TOX_TABLESH,
426  STR_POOLCOLL_TOX_TABLES1,
427  // Index of Authorities
428  STR_POOLCOLL_TOX_AUTHORITIESH,
429  STR_POOLCOLL_TOX_AUTHORITIES1,
430  // Subcategory User-Directories more Levels 5 - 10
431  STR_POOLCOLL_TOX_USER6,
432  STR_POOLCOLL_TOX_USER7,
433  STR_POOLCOLL_TOX_USER8,
434  STR_POOLCOLL_TOX_USER9,
435  STR_POOLCOLL_TOX_USER10
436 };
437 
438 static const char* STR_POOLCOLL_DOC_ARY[] =
439 {
440  // Category Chapter/Document
441  STR_POOLCOLL_DOC_TITLE,
442  STR_POOLCOLL_DOC_SUBTITLE,
443  STR_POOLCOLL_DOC_APPENDIX
444 };
445 
446 static const char* STR_POOLCOLL_HTML_ARY[] =
447 {
448  // Category HTML-Templates
449  STR_POOLCOLL_HTML_BLOCKQUOTE,
450  STR_POOLCOLL_HTML_PRE,
451  STR_POOLCOLL_HTML_HR,
452  STR_POOLCOLL_HTML_DD,
453  STR_POOLCOLL_HTML_DT
454 };
455 
456 static const char* STR_POOLCHR_ARY[] =
457 {
458  STR_POOLCHR_FOOTNOTE,
459  STR_POOLCHR_PAGENO,
460  STR_POOLCHR_LABEL,
461  STR_POOLCHR_DROPCAPS,
462  STR_POOLCHR_NUM_LEVEL,
463  STR_POOLCHR_BULLET_LEVEL,
464  STR_POOLCHR_INET_NORMAL,
465  STR_POOLCHR_INET_VISIT,
466  STR_POOLCHR_JUMPEDIT,
467  STR_POOLCHR_TOXJUMP,
468  STR_POOLCHR_ENDNOTE,
469  STR_POOLCHR_LINENUM,
470  STR_POOLCHR_IDX_MAIN_ENTRY,
471  STR_POOLCHR_FOOTNOTE_ANCHOR,
472  STR_POOLCHR_ENDNOTE_ANCHOR,
473  STR_POOLCHR_RUBYTEXT,
474  STR_POOLCHR_VERT_NUM
475 };
476 
477 static const char* STR_POOLCHR_HTML_ARY[] =
478 {
479  STR_POOLCHR_HTML_EMPHASIS,
480  STR_POOLCHR_HTML_CITIATION,
481  STR_POOLCHR_HTML_STRONG,
482  STR_POOLCHR_HTML_CODE,
483  STR_POOLCHR_HTML_SAMPLE,
484  STR_POOLCHR_HTML_KEYBOARD,
485  STR_POOLCHR_HTML_VARIABLE,
486  STR_POOLCHR_HTML_DEFINSTANCE,
487  STR_POOLCHR_HTML_TELETYPE
488 };
489 
490 static const char* STR_POOLFRM_ARY[] =
491 {
492  STR_POOLFRM_FRAME,
493  STR_POOLFRM_GRAPHIC,
494  STR_POOLFRM_OLE,
495  STR_POOLFRM_FORMEL,
496  STR_POOLFRM_MARGINAL,
497  STR_POOLFRM_WATERSIGN,
498  STR_POOLFRM_LABEL
499 };
500 
501 static const char* STR_POOLPAGE_ARY[] =
502 {
503  // Page styles
504  STR_POOLPAGE_STANDARD,
505  STR_POOLPAGE_FIRST,
506  STR_POOLPAGE_LEFT,
507  STR_POOLPAGE_RIGHT,
508  STR_POOLPAGE_ENVELOPE,
509  STR_POOLPAGE_REGISTER,
510  STR_POOLPAGE_HTML,
511  STR_POOLPAGE_FOOTNOTE,
512  STR_POOLPAGE_ENDNOTE,
513  STR_POOLPAGE_LANDSCAPE
514 };
515 
516 static const char* STR_POOLNUMRULE_NUM_ARY[] =
517 {
518  // Numbering styles
519  STR_POOLNUMRULE_NUM1,
520  STR_POOLNUMRULE_NUM2,
521  STR_POOLNUMRULE_NUM3,
522  STR_POOLNUMRULE_NUM4,
523  STR_POOLNUMRULE_NUM5,
524  STR_POOLNUMRULE_BUL1,
525  STR_POOLNUMRULE_BUL2,
526  STR_POOLNUMRULE_BUL3,
527  STR_POOLNUMRULE_BUL4,
528  STR_POOLNUMRULE_BUL5
529 };
530 
531 // XXX MUST match the entries of TableStyleProgNameTable in
532 // sw/source/core/doc/SwStyleNameMapper.cxx and MUST match the order of
533 // RES_POOL_TABLESTYLE_TYPE in sw/inc/poolfmt.hxx
534 static const char* STR_TABSTYLE_ARY[] =
535 {
536  // XXX MUST be in order, Writer first, then Svx old, then Svx new
537  // 1 Writer resource string
538  STR_TABSTYLE_DEFAULT,
539  // 16 old styles Svx resource strings
540  RID_SVXSTR_TBLAFMT_3D,
541  RID_SVXSTR_TBLAFMT_BLACK1,
542  RID_SVXSTR_TBLAFMT_BLACK2,
543  RID_SVXSTR_TBLAFMT_BLUE,
544  RID_SVXSTR_TBLAFMT_BROWN,
545  RID_SVXSTR_TBLAFMT_CURRENCY,
546  RID_SVXSTR_TBLAFMT_CURRENCY_3D,
547  RID_SVXSTR_TBLAFMT_CURRENCY_GRAY,
548  RID_SVXSTR_TBLAFMT_CURRENCY_LAVENDER,
549  RID_SVXSTR_TBLAFMT_CURRENCY_TURQUOISE,
550  RID_SVXSTR_TBLAFMT_GRAY,
551  RID_SVXSTR_TBLAFMT_GREEN,
552  RID_SVXSTR_TBLAFMT_LAVENDER,
553  RID_SVXSTR_TBLAFMT_RED,
554  RID_SVXSTR_TBLAFMT_TURQUOISE,
555  RID_SVXSTR_TBLAFMT_YELLOW,
556  // 10 new styles since LibreOffice 6.0 Svx resource strings
557  RID_SVXSTR_TBLAFMT_LO6_ACADEMIC,
558  RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_BLUE,
559  RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_GREEN,
560  RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_RED,
561  RID_SVXSTR_TBLAFMT_LO6_BOX_LIST_YELLOW,
562  RID_SVXSTR_TBLAFMT_LO6_ELEGANT,
563  RID_SVXSTR_TBLAFMT_LO6_FINANCIAL,
564  RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_COLUMNS,
565  RID_SVXSTR_TBLAFMT_LO6_SIMPLE_GRID_ROWS,
566  RID_SVXSTR_TBLAFMT_LO6_SIMPLE_LIST_SHADED
567 };
568 
569 namespace sw
570 {
571 
573 {
574 }
575 
576 SwTextFormatColl* DocumentStylePoolManager::GetTextCollFromPool( sal_uInt16 nId, bool bRegardLanguage )
577 {
578  OSL_ENSURE(
583  (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
585  "Wrong AutoFormat Id" );
586 
587  SwTextFormatColl* pNewColl;
588  sal_uInt16 nOutLvlBits = 0;
589 
590  for (size_t n = 0, nSize = m_rDoc.GetTextFormatColls()->size(); n < nSize; ++n)
591  {
592  pNewColl = (*m_rDoc.GetTextFormatColls())[ n ];
593  if( nId == pNewColl->GetPoolFormatId() )
594  {
595  // in online we can have multiple languages, use translated name
597  {
598  OUString aName;
599  SwStyleNameMapper::GetUIName(nId, aName);
600  if (!aName.isEmpty())
601  pNewColl->SetName(aName);
602  }
603 
604  return pNewColl;
605  }
606 
607  if( pNewColl->IsAssignedToListLevelOfOutlineStyle())
608  nOutLvlBits |= ( 1 << pNewColl->GetAssignedOutlineStyleLevel() );
609  }
610 
611  // Didn't find it until here -> create anew
612  const char* pResId = nullptr;
614  {
615  static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_TEXT_ARY) == RES_POOLCOLL_TEXT_END - RES_POOLCOLL_TEXT_BEGIN, "### unexpected size!");
616  pResId = STR_POOLCOLL_TEXT_ARY[nId - RES_POOLCOLL_TEXT_BEGIN];
617  }
618  else if (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END)
619  {
620  static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_LISTS_ARY) == RES_POOLCOLL_LISTS_END - RES_POOLCOLL_LISTS_BEGIN, "### unexpected size!");
621  pResId = STR_POOLCOLL_LISTS_ARY[nId - RES_POOLCOLL_LISTS_BEGIN];
622  }
623  else if (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END)
624  {
625  static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_EXTRA_ARY) == RES_POOLCOLL_EXTRA_END - RES_POOLCOLL_EXTRA_BEGIN, "### unexpected size!");
627  }
629  {
630  static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_REGISTER_ARY) == RES_POOLCOLL_REGISTER_END - RES_POOLCOLL_REGISTER_BEGIN, "### unexpected size!");
631  pResId = STR_POOLCOLL_REGISTER_ARY[nId - RES_POOLCOLL_REGISTER_BEGIN];
632  }
633  else if (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END)
634  {
635  static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_DOC_ARY) == RES_POOLCOLL_DOC_END - RES_POOLCOLL_DOC_BEGIN, "### unexpected size!");
636  pResId = STR_POOLCOLL_DOC_ARY[nId - RES_POOLCOLL_DOC_BEGIN];
637  }
638  else if (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END)
639  {
640  static_assert(SAL_N_ELEMENTS(STR_POOLCOLL_HTML_ARY) == RES_POOLCOLL_HTML_END - RES_POOLCOLL_HTML_BEGIN, "### unexpected size!");
641  pResId = STR_POOLCOLL_HTML_ARY[nId - RES_POOLCOLL_HTML_BEGIN];
642  }
643 
644  OSL_ENSURE(pResId, "Invalid Pool ID");
645  if (!pResId)
647 
648  OUString aNm(SwResId(pResId));
649 
650  // A Set for all to-be-set Attributes
652  sal_uInt16 nParent = GetPoolParent( nId );
653 
654  {
655 
656 //FEATURE::CONDCOLL
657  if(::IsConditionalByPoolId( nId ))
658  pNewColl = new SwConditionTextFormatColl( m_rDoc.GetAttrPool(), aNm, !nParent
660  : GetTextCollFromPool( nParent ));
661  else
662 //FEATURE::CONDCOLL
663  pNewColl = new SwTextFormatColl( m_rDoc.GetAttrPool(), aNm, !nParent
665  : GetTextCollFromPool( nParent ));
666  pNewColl->SetPoolFormatId( nId );
667  m_rDoc.GetTextFormatColls()->push_back( pNewColl );
668  }
669 
671  if ( !bNoDefault )
672  {
673  switch( nId )
674  {
675  // General content forms
677  /* koreans do not like SvxScriptItem(TRUE) */
678  if (bRegardLanguage)
679  {
680  LanguageType nAppLanguage = GetAppLanguage();
681  if (GetDefaultFrameDirection(nAppLanguage) ==
682  SvxFrameDirection::Horizontal_RL_TB)
683  {
684  SvxAdjustItem aAdjust(SvxAdjust::Right, RES_PARATR_ADJUST );
685  aSet.Put(aAdjust);
686  }
687  if (nAppLanguage == LANGUAGE_KOREAN)
688  {
689  SvxScriptSpaceItem aScriptSpace(false, RES_PARATR_SCRIPTSPACE);
690  aSet.Put(aScriptSpace);
691  }
692  }
693  break;
694 
695  case RES_POOLCOLL_TEXT: // Text body
696  {
698  SvxULSpaceItem aUL( 0, PT_7, RES_UL_SPACE );
699  aLSpc.SetPropLineSpace( 115 );
701  aSet.Put( aUL );
702  aSet.Put( aLSpc );
703  }
704  break;
705  case RES_POOLCOLL_TEXT_IDENT: // Text body indentation
706  {
709  aSet.Put( aLR );
710  }
711  break;
712  case RES_POOLCOLL_TEXT_NEGIDENT: // Text body neg. indentation
713  {
715  aLR.SetTextFirstLineOffset( -static_cast<short>(GetMetricVal( CM_05 )));
716  aLR.SetTextLeft( GetMetricVal( CM_1 ));
718  aTStops.Insert( SvxTabStop( 0 ));
719 
720  aSet.Put( aLR );
721  aSet.Put( aTStops );
722  }
723  break;
724  case RES_POOLCOLL_TEXT_MOVE: // Text body move
725  {
727  aLR.SetTextLeft( GetMetricVal( CM_05 ));
728  aSet.Put( aLR );
729  }
730  break;
731 
732  case RES_POOLCOLL_CONFRONTATION: // Text body confrontation
733  {
735  aLR.SetTextFirstLineOffset( - short( GetMetricVal( CM_1 ) * 4 +
736  GetMetricVal( CM_05)) );
737  aLR.SetTextLeft( GetMetricVal( CM_1 ) * 5 );
739  aTStops.Insert( SvxTabStop( 0 ));
740 
741  aSet.Put( aLR );
742  aSet.Put( aTStops );
743  }
744  break;
745  case RES_POOLCOLL_MARGINAL: // Text body marginal
746  {
748  aLR.SetTextLeft( GetMetricVal( CM_1 ) * 4 );
749  aSet.Put( aLR );
750  }
751  break;
752 
753  case RES_POOLCOLL_HEADLINE_BASE: // Base headline
754  {
755  static const sal_uInt16 aFontWhich[] =
756  { RES_CHRATR_FONT,
758  RES_CHRATR_CTL_FONT
759  };
760  static const sal_uInt16 aLangTypes[] =
761  {
765  };
766  static const LanguageType aLangs[] =
767  {
771  };
772  static const DefaultFontType nFontTypes[] =
773  {
774  DefaultFontType::LATIN_HEADING,
775  DefaultFontType::CJK_HEADING,
776  DefaultFontType::CTL_HEADING
777  };
778 
779  for( int i = 0; i < 3; ++i )
780  {
781  LanguageType nLng = static_cast<const SvxLanguageItem&>(m_rDoc.GetDefault( aLangTypes[i] )).GetLanguage();
782  if( LANGUAGE_DONTKNOW == nLng )
783  nLng = aLangs[i];
784 
785  vcl::Font aFnt( OutputDevice::GetDefaultFont( nFontTypes[i],
786  nLng, GetDefaultFontFlags::OnlyOne ) );
787 
788  aSet.Put( SvxFontItem( aFnt.GetFamilyType(), aFnt.GetFamilyName(),
789  OUString(), aFnt.GetPitch(),
790  aFnt.GetCharSet(), aFontWhich[i] ));
791  }
792 
793  SvxFontHeightItem aFntSize( PT_14, 100, RES_CHRATR_FONTSIZE );
794  SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE );
796  aUL.SetLower( HTML_PARSPACE );
797  aSet.Put( SvxFormatKeepItem( true, RES_KEEP ));
798 
800 
801  aSet.Put( aUL );
802  SetAllScriptItem( aSet, aFntSize );
803  }
804  break;
805 
806  case RES_POOLCOLL_NUMBER_BULLET_BASE: // Base Numbering
807  break;
808 
809  case RES_POOLCOLL_GREETING: // Greeting
810  case RES_POOLCOLL_REGISTER_BASE: // Base indexes
811  case RES_POOLCOLL_SIGNATURE: // Signatures
812  case RES_POOLCOLL_TABLE: // Tabele content
813  {
814  SwFormatLineNumber aLN;
815  aLN.SetCountLines( false );
816  aSet.Put( aLN );
817  if (nId == RES_POOLCOLL_TABLE)
818  {
819  aSet.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
820  aSet.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
821  }
822  }
823  break;
824 
825  case RES_POOLCOLL_HEADLINE1: // Heading 1
826  {
827  SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE );
828  aSet.Put( aUL );
829  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 0, false );
830  }
831  break;
832  case RES_POOLCOLL_HEADLINE2: // Heading 2
833  {
834  SvxULSpaceItem aUL( PT_10, PT_6, RES_UL_SPACE );
835  aSet.Put( aUL );
836  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 1, false );
837  }
838  break;
839  case RES_POOLCOLL_HEADLINE3: // Heading 3
840  {
841  SvxULSpaceItem aUL( PT_7, PT_6, RES_UL_SPACE );
842  aSet.Put( aUL );
843  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 2, false );
844  }
845  break;
846  case RES_POOLCOLL_HEADLINE4: // Heading 4
847  {
848  SvxULSpaceItem aUL( PT_6, PT_6, RES_UL_SPACE );
849  aSet.Put( aUL );
850  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 3, true );
851  }
852  break;
853  case RES_POOLCOLL_HEADLINE5: // Heading 5
854  {
855  SvxULSpaceItem aUL( PT_6, PT_3, RES_UL_SPACE );
856  aSet.Put( aUL );
857  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 4, false );
858  }
859  break;
860  case RES_POOLCOLL_HEADLINE6: // Heading 6
861  {
862  SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE );
863  aSet.Put( aUL );
864  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 5, true );
865  }
866  break;
867  case RES_POOLCOLL_HEADLINE7: // Heading 7
868  {
869  SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE );
870  aSet.Put( aUL );
871  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 6, false );
872  }
873  break;
874  case RES_POOLCOLL_HEADLINE8: // Heading 8
875  {
876  SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE );
877  aSet.Put( aUL );
878  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 7, true );
879  }
880  break;
881  case RES_POOLCOLL_HEADLINE9: // Heading 9
882  {
883  SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE );
884  aSet.Put( aUL );
885  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 8, false );
886  }
887  break;
888  case RES_POOLCOLL_HEADLINE10: // Heading 10
889  {
890  SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE );
891  aSet.Put( aUL );
892  lcl_SetHeadline( m_rDoc, pNewColl, aSet, nOutLvlBits, 9, false );
893  }
894  break;
895 
896  // Special sections:
897  // Header
899  case RES_POOLCOLL_HEADER:
902  // Footer
903  case RES_POOLCOLL_FOOTER:
906  {
907  SwFormatLineNumber aLN;
908  aLN.SetCountLines( false );
909  aSet.Put( aLN );
910 
911  tools::Long nRightMargin = lcl_GetRightMargin( m_rDoc );
912 
913  SvxTabStopItem aTStops( 0, 0, SvxTabAdjust::Default, RES_PARATR_TABSTOP );
914  aTStops.Insert( SvxTabStop( nRightMargin / 2, SvxTabAdjust::Center ) );
915  aTStops.Insert( SvxTabStop( nRightMargin, SvxTabAdjust::Right ) );
916 
917  aSet.Put( aTStops );
918 
919  if ( (nId==RES_POOLCOLL_HEADERR) || (nId==RES_POOLCOLL_FOOTERR) ) {
920  SvxAdjustItem aAdjust(SvxAdjust::Right, RES_PARATR_ADJUST );
921  aSet.Put(aAdjust);
922  }
923  }
924  break;
925 
927  {
929  aSet.Put( SvxAdjustItem( SvxAdjust::Center, RES_PARATR_ADJUST ) );
930  SwFormatLineNumber aLN;
931  aLN.SetCountLines( false );
932  aSet.Put( aLN );
933  }
934  break;
935 
936  case RES_POOLCOLL_FOOTNOTE: // paragraph style Footnote
937  case RES_POOLCOLL_ENDNOTE: // paragraph style Endnote
938  {
940  aLR.SetTextFirstLineOffset( -static_cast<short>( GetMetricVal( CM_05 ) + GetMetricVal( CM_01 ) ) );
943  aSet.Put( aLR );
944  SwFormatLineNumber aLN;
945  aLN.SetCountLines( false );
946  aSet.Put( aLN );
947  }
948  break;
949 
950  case RES_POOLCOLL_LABEL: // basic caption
951  {
953  aUL.SetUpper( PT_6 );
954  aUL.SetLower( PT_6 );
955  aSet.Put( aUL );
958  SwFormatLineNumber aLN;
959  aLN.SetCountLines( false );
960  aSet.Put( aLN );
961  }
962  break;
963 
964  case RES_POOLCOLL_FRAME: // Frame content
965  case RES_POOLCOLL_LABEL_ABB: // caption image
966  case RES_POOLCOLL_LABEL_TABLE: // caption table
967  case RES_POOLCOLL_LABEL_FRAME: // caption frame
968  case RES_POOLCOLL_LABEL_DRAWING: // caption drawing
970  break;
971 
972  case RES_POOLCOLL_ENVELOPE_ADDRESS: // envelope address
973  {
975  aUL.SetLower( PT_3 );
976  aSet.Put( aUL );
977  SwFormatLineNumber aLN;
978  aLN.SetCountLines( false );
979  aSet.Put( aLN );
980  }
981  break;
982 
983  case RES_POOLCOLL_SEND_ADDRESS: // Sender address
984  {
987  else
988  {
989  SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 );
990  aSet.Put( aUL );
991  }
992  SwFormatLineNumber aLN;
993  aLN.SetCountLines( false );
994  aSet.Put( aLN );
995  }
996  break;
997 
998  // User defined indexes:
999  case RES_POOLCOLL_TOX_USERH: // Header
1000  lcl_SetRegister( m_rDoc, aSet, 0, true, false );
1001  {
1002  SwFormatLineNumber aLN;
1003  aLN.SetCountLines( false );
1004  aSet.Put( aLN );
1005  }
1006  break;
1007  case RES_POOLCOLL_TOX_USER1: // 1st level
1008  lcl_SetRegister( m_rDoc, aSet, 0, false, true );
1009  break;
1010  case RES_POOLCOLL_TOX_USER2: // 2nd level
1011  lcl_SetRegister( m_rDoc, aSet, 1, false, true );
1012  break;
1013  case RES_POOLCOLL_TOX_USER3: // 3rd level
1014  lcl_SetRegister( m_rDoc, aSet, 2, false, true );
1015  break;
1016  case RES_POOLCOLL_TOX_USER4: // 4th level
1017  lcl_SetRegister( m_rDoc, aSet, 3, false, true );
1018  break;
1019  case RES_POOLCOLL_TOX_USER5: // 5th level
1020  lcl_SetRegister( m_rDoc, aSet, 4, false, true );
1021  break;
1022  case RES_POOLCOLL_TOX_USER6: // 6th level
1023  lcl_SetRegister( m_rDoc, aSet, 5, false, true );
1024  break;
1025  case RES_POOLCOLL_TOX_USER7: // 7th level
1026  lcl_SetRegister( m_rDoc, aSet, 6, false, true );
1027  break;
1028  case RES_POOLCOLL_TOX_USER8: // 8th level
1029  lcl_SetRegister( m_rDoc, aSet, 7, false, true );
1030  break;
1031  case RES_POOLCOLL_TOX_USER9: // 9th level
1032  lcl_SetRegister( m_rDoc, aSet, 8, false, true );
1033  break;
1034  case RES_POOLCOLL_TOX_USER10: // 10th level
1035  lcl_SetRegister( m_rDoc, aSet, 9, false, true );
1036  break;
1037 
1038  // Index
1039  case RES_POOLCOLL_TOX_IDXH: // Header
1040  lcl_SetRegister( m_rDoc, aSet, 0, true, false );
1041  {
1042  SwFormatLineNumber aLN;
1043  aLN.SetCountLines( false );
1044  aSet.Put( aLN );
1045  }
1046  break;
1047  case RES_POOLCOLL_TOX_IDX1: // 1st level
1048  lcl_SetRegister( m_rDoc, aSet, 0, false, false );
1049  break;
1050  case RES_POOLCOLL_TOX_IDX2: // 2nd level
1051  lcl_SetRegister( m_rDoc, aSet, 1, false, false );
1052  break;
1053  case RES_POOLCOLL_TOX_IDX3: // 3rd level
1054  lcl_SetRegister( m_rDoc, aSet, 2, false, false );
1055  break;
1056  case RES_POOLCOLL_TOX_IDXBREAK: // Separator
1057  lcl_SetRegister( m_rDoc, aSet, 0, false, false );
1058  break;
1059 
1060  // Table of Content
1061  case RES_POOLCOLL_TOX_CNTNTH: // Header
1062  lcl_SetRegister( m_rDoc, aSet, 0, true, false );
1063  {
1064  SwFormatLineNumber aLN;
1065  aLN.SetCountLines( false );
1066  aSet.Put( aLN );
1067  }
1068  break;
1069  case RES_POOLCOLL_TOX_CNTNT1: // 1st level
1070  lcl_SetRegister( m_rDoc, aSet, 0, false, true );
1071  break;
1072  case RES_POOLCOLL_TOX_CNTNT2: // 2nd level
1073  lcl_SetRegister( m_rDoc, aSet, 1, false, true );
1074  break;
1075  case RES_POOLCOLL_TOX_CNTNT3: // 3rd level
1076  lcl_SetRegister( m_rDoc, aSet, 2, false, true );
1077  break;
1078  case RES_POOLCOLL_TOX_CNTNT4: // 4th level
1079  lcl_SetRegister( m_rDoc, aSet, 3, false, true );
1080  break;
1081  case RES_POOLCOLL_TOX_CNTNT5: // 5th level
1082  lcl_SetRegister( m_rDoc, aSet, 4, false, true );
1083  break;
1084  case RES_POOLCOLL_TOX_CNTNT6: // 6th level
1085  lcl_SetRegister( m_rDoc, aSet, 5, false, true );
1086  break;
1087  case RES_POOLCOLL_TOX_CNTNT7: // 7th level
1088  lcl_SetRegister( m_rDoc, aSet, 6, false, true );
1089  break;
1090  case RES_POOLCOLL_TOX_CNTNT8: // 8th level
1091  lcl_SetRegister( m_rDoc, aSet, 7, false, true );
1092  break;
1093  case RES_POOLCOLL_TOX_CNTNT9: // 9th level
1094  lcl_SetRegister( m_rDoc, aSet, 8, false, true );
1095  break;
1096  case RES_POOLCOLL_TOX_CNTNT10: // 10th level
1097  lcl_SetRegister( m_rDoc, aSet, 9, false, true );
1098  break;
1099 
1104  lcl_SetRegister( m_rDoc, aSet, 0, true, false );
1105  {
1106  SwFormatLineNumber aLN;
1107  aLN.SetCountLines( false );
1108  aSet.Put( aLN );
1109  }
1110  break;
1115  lcl_SetRegister( m_rDoc, aSet, 0, false, true );
1116  break;
1117 
1119  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
1121  PT_12, PT_6 );
1122  break;
1124  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
1126  0, PT_6 );
1127  break;
1129  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1,
1131  0, PT_12 );
1132  break;
1134  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM1,
1135  0, SwNumRule::GetNumIndent( 0 ), 0, PT_6 );
1136  break;
1138  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
1140  PT_12, PT_6 );
1141  break;
1143  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
1145  0, PT_6 );
1146  break;
1148  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2,
1150  0, PT_12 );
1151  break;
1153  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM2,
1154  0, SwNumRule::GetNumIndent( 1 ), 0, PT_6 );
1155  break;
1157  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
1159  PT_12, PT_6 );
1160  break;
1162  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
1164  0, PT_6 );
1165  break;
1167  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3,
1169  0, PT_12 );
1170  break;
1172  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM3,
1173  0, SwNumRule::GetNumIndent( 2 ), 0, PT_6 );
1174  break;
1176  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
1178  PT_12, PT_6 );
1179  break;
1181  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
1183  0, PT_6 );
1184  break;
1186  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4,
1188  0, PT_12 );
1189  break;
1191  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM4,
1192  0, SwNumRule::GetNumIndent( 3 ), 0, PT_6 );
1193  break;
1195  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
1197  PT_12, PT_6 );
1198  break;
1200  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
1202  0, PT_6 );
1203  break;
1205  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5,
1207  0, PT_12 );
1208  break;
1210  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM5,
1211  0, SwNumRule::GetNumIndent( 4 ), 0, PT_6 );
1212  break;
1213 
1215  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL1,
1217  PT_12, PT_6 );
1218  break;
1220  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL1,
1222  0, PT_6 );
1223  break;
1225  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL1,
1227  0, PT_12 );
1228  break;
1230  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_NONUM1,
1231  0, SwNumRule::GetBullIndent( 0 ), 0, PT_6 );
1232  break;
1234  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL2,
1236  PT_12, PT_6 );
1237  break;
1239  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL2,
1241  0, PT_6 );
1242  break;
1244  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL2,
1246  0, PT_12 );
1247  break;
1249  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_NONUM2,
1250  0, SwNumRule::GetBullIndent( 1 ), 0, PT_6 );
1251  break;
1253  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL3,
1255  PT_12, PT_6 );
1256  break;
1258  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL3,
1260  0, PT_6 );
1261  break;
1263  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL3,
1265  0, PT_12 );
1266  break;
1268  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_NONUM3,
1269  0, SwNumRule::GetBullIndent( 2 ), 0, PT_6 );
1270  break;
1272  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL4,
1274  PT_12, PT_6 );
1275  break;
1277  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL4,
1279  0, PT_6 );
1280  break;
1282  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL4,
1284  0, PT_12 );
1285  break;
1287  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_NONUM4,
1288  0, SwNumRule::GetBullIndent( 3 ), 0, PT_6 );
1289  break;
1291  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL5,
1293  PT_12, PT_6 );
1294  break;
1296  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL5,
1298  0, PT_6 );
1299  break;
1301  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_LEVEL5,
1303  0, PT_12 );
1304  break;
1306  lcl_SetNumBul( m_rDoc, pNewColl, aSet, RES_POOLCOLL_BULLET_NONUM5,
1307  0, SwNumRule::GetBullIndent( 4 ), 0, PT_6 );
1308  break;
1309 
1310  case RES_POOLCOLL_DOC_TITLE: // Document Title
1311  {
1313  SetAllScriptItem( aSet, SvxFontHeightItem( PT_28, 100, RES_CHRATR_FONTSIZE ) );
1314 
1315  aSet.Put( SvxAdjustItem( SvxAdjust::Center, RES_PARATR_ADJUST ) );
1316 
1318  }
1319  break;
1320 
1321  case RES_POOLCOLL_DOC_SUBTITLE: // Document subtitle
1322  {
1323  SvxULSpaceItem aUL( PT_3, PT_6, RES_UL_SPACE );
1324  aSet.Put( aUL );
1326 
1327  aSet.Put( SvxAdjustItem( SvxAdjust::Center, RES_PARATR_ADJUST ));
1328 
1330  }
1331  break;
1332 
1333  case RES_POOLCOLL_DOC_APPENDIX: // Document Appendix tdf#114090
1334  {
1336  SetAllScriptItem( aSet, SvxFontHeightItem( PT_16, 100, RES_CHRATR_FONTSIZE ) );
1337 
1338  aSet.Put( SvxAdjustItem( SvxAdjust::Center, RES_PARATR_ADJUST ) );
1339 
1341  }
1342  break;
1343 
1345  {
1347  aLR.SetLeft( GetMetricVal( CM_1 ));
1348  aLR.SetRight( GetMetricVal( CM_1 ));
1349  aSet.Put( aLR );
1350  std::unique_ptr<SvxULSpaceItem> aUL(pNewColl->GetULSpace().Clone());
1351  aUL->SetLower( HTML_PARSPACE );
1352  aSet.Put(std::move(aUL));
1353  }
1354  break;
1355 
1356  case RES_POOLCOLL_HTML_PRE:
1357  {
1358  ::lcl_SetDfltFont( DefaultFontType::FIXED, aSet );
1359 
1360  // WORKAROUND: Set PRE to 10pt
1362 
1363  // The lower paragraph distance is set explicitly (makes
1364  // assigning hard attributes easier)
1365  std::unique_ptr<SvxULSpaceItem> aULSpaceItem(pNewColl->GetULSpace().Clone());
1366  aULSpaceItem->SetLower( 0 );
1367  aSet.Put(std::move(aULSpaceItem));
1368  }
1369  break;
1370 
1371  case RES_POOLCOLL_HTML_HR:
1372  {
1373  SvxBoxItem aBox( RES_BOX );
1374  Color aColor( COL_GRAY );
1375  SvxBorderLine aNew(&aColor, 3, SvxBorderLineStyle::DOUBLE);
1376  aBox.SetLine( &aNew, SvxBoxItemLine::BOTTOM );
1377 
1378  aSet.Put( aBox );
1379  aSet.Put( SwParaConnectBorderItem( false ) );
1381 
1382  std::unique_ptr<SvxULSpaceItem> aUL;
1383  {
1385  aUL.reset(pNewColl->GetULSpace().Clone());
1386  }
1387  aUL->SetLower( HTML_PARSPACE );
1388  aSet.Put(std::move(aUL));
1389  SwFormatLineNumber aLN;
1390  aLN.SetCountLines( false );
1391  aSet.Put( aLN );
1392  }
1393  break;
1394 
1395  case RES_POOLCOLL_HTML_DD:
1396  {
1397  std::unique_ptr<SvxLRSpaceItem> aLR(pNewColl->GetLRSpace().Clone());
1398  // We indent by 1 cm. The IDs are always 2 away from each other!
1399  aLR->SetLeft( GetMetricVal( CM_1 ));
1400  aSet.Put(std::move(aLR));
1401  }
1402  break;
1403  case RES_POOLCOLL_HTML_DT:
1404  {
1405  std::unique_ptr<SvxLRSpaceItem> aLR;
1406  {
1408  aLR.reset(pNewColl->GetLRSpace().Clone());
1409  }
1410  // We indent by 0 cm. The IDs are always 2 away from each other!
1411  aLR->SetLeft( 0 );
1412  aSet.Put( std::move(aLR) );
1413  }
1414  break;
1415  }
1416  }
1417 
1418  if( aSet.Count() )
1419  pNewColl->SetFormatAttr( aSet );
1420  return pNewColl;
1421 }
1422 
1426 {
1427  SwFormat *pNewFormat = nullptr;
1428  SwFormat *pDeriveFormat = nullptr;
1429 
1430  SwFormatsBase* pArray[ 2 ];
1431  sal_uInt16 nArrCnt = 1;
1432  const char* pRCId = nullptr;
1433  sal_uInt16 const * pWhichRange = nullptr;
1434 
1435  switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
1436  {
1437  case POOLGRP_CHARFMT:
1438  {
1439  pArray[0] = m_rDoc.GetCharFormats();
1440  pDeriveFormat = m_rDoc.GetDfltCharFormat();
1441  pWhichRange = aCharFormatSetRange;
1442 
1443  if (nId >= RES_POOLCHR_HTML_BEGIN && nId < RES_POOLCHR_HTML_END)
1444  pRCId = STR_POOLCHR_HTML_ARY[nId - RES_POOLCHR_HTML_BEGIN];
1445  else if (nId >= RES_POOLCHR_NORMAL_BEGIN && nId < RES_POOLCHR_NORMAL_END)
1446  pRCId = STR_POOLCHR_ARY[nId - RES_POOLCHR_BEGIN];
1447  else
1448  {
1449  // Fault: unknown Format, but a CharFormat -> return the first one
1450  OSL_ENSURE( false, "invalid Id" );
1451  pRCId = STR_POOLCHR_ARY[0];
1452  }
1453  }
1454  break;
1455  case POOLGRP_FRAMEFMT:
1456  {
1457  pArray[0] = m_rDoc.GetFrameFormats();
1458  pArray[1] = m_rDoc.GetSpzFrameFormats();
1459  pDeriveFormat = m_rDoc.GetDfltFrameFormat();
1460  nArrCnt = 2;
1461  pWhichRange = aFrameFormatSetRange;
1462 
1463  // Fault: unknown Format, but a FrameFormat
1464  // -> return the first one
1465  if( RES_POOLFRM_BEGIN > nId || nId >= RES_POOLFRM_END )
1466  {
1467  OSL_ENSURE( false, "invalid Id" );
1468  nId = RES_POOLFRM_BEGIN;
1469  }
1470 
1471  pRCId = STR_POOLFRM_ARY[nId - RES_POOLFRM_BEGIN];
1472  }
1473  break;
1474 
1475  default:
1476  // Fault, unknown Format
1477  OSL_ENSURE( nId, "invalid Id" );
1478  return nullptr;
1479  }
1480  OSL_ENSURE(pRCId, "invalid Id");
1481 
1482  while( nArrCnt-- )
1483  for( size_t n = 0; n < (*pArray[nArrCnt]).GetFormatCount(); ++n )
1484  {
1485  pNewFormat = (*pArray[ nArrCnt ] ).GetFormat( n );
1486  if( nId == pNewFormat->GetPoolFormatId() )
1487  {
1488  return pNewFormat;
1489  }
1490  }
1491 
1492  OUString aNm(SwResId(pRCId));
1493  SwAttrSet aSet( m_rDoc.GetAttrPool(), pWhichRange );
1494 
1495  {
1496  bool bIsModified = m_rDoc.getIDocumentState().IsModified();
1497 
1498  {
1499  ::sw::UndoGuard const undoGuard(m_rDoc.GetIDocumentUndoRedo());
1500  switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
1501  {
1502  case POOLGRP_CHARFMT:
1503  pNewFormat = m_rDoc.MakeCharFormat_(aNm, pDeriveFormat, false, true);
1504  break;
1505  case POOLGRP_FRAMEFMT:
1506  pNewFormat = m_rDoc.MakeFrameFormat_(aNm, pDeriveFormat, false, true);
1507  break;
1508  default:
1509  break;
1510  }
1511  }
1512 
1513  if( !bIsModified )
1515  pNewFormat->SetPoolFormatId( nId );
1516  pNewFormat->SetAuto(false); // no AutoFormat
1517  }
1518 
1519  switch( nId )
1520  {
1521  case RES_POOLCHR_FOOTNOTE: // Footnote
1522  case RES_POOLCHR_PAGENO: // Page/Field
1523  case RES_POOLCHR_LABEL: // Label
1524  case RES_POOLCHR_DROPCAPS: // Dropcaps
1525  case RES_POOLCHR_NUM_LEVEL: // Numbering level
1526  case RES_POOLCHR_TOXJUMP: // Table of contents jump
1527  case RES_POOLCHR_ENDNOTE: // Endnote
1528  case RES_POOLCHR_LINENUM: // Line numbering
1529  break;
1530 
1531  case RES_POOLCHR_ENDNOTE_ANCHOR: // Endnote anchor
1532  case RES_POOLCHR_FOOTNOTE_ANCHOR: // Footnote anchor
1533  {
1535  }
1536  break;
1537 
1538  case RES_POOLCHR_BULLET_LEVEL: // Bullet character
1539  {
1540  const vcl::Font& rBulletFont = numfunc::GetDefBulletFont();
1541  SetAllScriptItem( aSet, SvxFontItem( rBulletFont.GetFamilyType(),
1542  rBulletFont.GetFamilyName(), rBulletFont.GetStyleName(),
1543  rBulletFont.GetPitch(), rBulletFont.GetCharSet(), RES_CHRATR_FONT ));
1544  }
1545  break;
1546 
1548  {
1549  aSet.Put( SvxColorItem( COL_BLUE, RES_CHRATR_COLOR ) );
1551  // i40133: patch submitted by rail: set language to 'none' to prevent spell checking:
1555  }
1556  break;
1558  {
1559  aSet.Put( SvxColorItem( COL_RED, RES_CHRATR_COLOR ) );
1564  }
1565  break;
1566  case RES_POOLCHR_JUMPEDIT:
1567  {
1568  aSet.Put( SvxColorItem( COL_CYAN, RES_CHRATR_COLOR ) );
1570  aSet.Put( SvxCaseMapItem( SvxCaseMap::SmallCaps, RES_CHRATR_CASEMAP ) );
1571  }
1572  break;
1573 
1574  case RES_POOLCHR_RUBYTEXT:
1575  {
1576  tools::Long nH = GetDfltAttr( RES_CHRATR_CJK_FONTSIZE )->GetHeight() / 2;
1579  aSet.Put(SvxEmphasisMarkItem( FontEmphasisMark::NONE, RES_CHRATR_EMPHASIS_MARK) );
1580  }
1581  break;
1582 
1586  {
1588  }
1589  break;
1590 
1593  {
1595  }
1596  break;
1597 
1598  case RES_POOLCHR_HTML_CODE:
1602  {
1603  ::lcl_SetDfltFont( DefaultFontType::FIXED, aSet );
1604  }
1605  break;
1606  case RES_POOLCHR_VERT_NUM:
1607  aSet.Put( SvxCharRotateItem( Degree10(900), false, RES_CHRATR_ROTATE ) );
1608  break;
1609 
1610  case RES_POOLFRM_FRAME:
1611  {
1613  {
1614  aSet.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR ));
1615  aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::LINE_CENTER, text::RelOrientation::PRINT_AREA ) );
1616  aSet.Put( SwFormatSurround( css::text::WrapTextMode_NONE ) );
1617  }
1618  else
1619  {
1620  aSet.Put( SwFormatAnchor( RndStdIds::FLY_AT_PARA ));
1621  aSet.Put( SwFormatSurround( css::text::WrapTextMode_PARALLEL ) );
1622  aSet.Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::PRINT_AREA ) );
1623  aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::PRINT_AREA ) );
1624  Color aCol( COL_BLACK );
1625  SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 );
1626  SvxBoxItem aBox( RES_BOX );
1627  aBox.SetLine( &aLine, SvxBoxItemLine::TOP );
1628  aBox.SetLine( &aLine, SvxBoxItemLine::BOTTOM );
1629  aBox.SetLine( &aLine, SvxBoxItemLine::LEFT );
1630  aBox.SetLine( &aLine, SvxBoxItemLine::RIGHT );
1631  aBox.SetAllDistances( 85 );
1632  aSet.Put( aBox );
1633  aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1634  aSet.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE ) );
1635  }
1636 
1637  // for styles of FlyFrames do not set the FillStyle to make it a derived attribute
1638  aSet.ClearItem(XATTR_FILLSTYLE);
1639  }
1640  break;
1641  case RES_POOLFRM_GRAPHIC:
1642  case RES_POOLFRM_OLE:
1643  {
1644  aSet.Put( SwFormatAnchor( RndStdIds::FLY_AT_PARA ));
1645  aSet.Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1646  aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1647  aSet.Put( SwFormatSurround( css::text::WrapTextMode_DYNAMIC ));
1648  }
1649  break;
1650  case RES_POOLFRM_FORMEL:
1651  {
1652  aSet.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR ) );
1653  aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::FRAME ) );
1654  aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1655  }
1656  break;
1657  case RES_POOLFRM_MARGINAL:
1658  {
1659  aSet.Put( SwFormatAnchor( RndStdIds::FLY_AT_PARA ));
1660  aSet.Put( SwFormatHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME ));
1661  aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
1662  aSet.Put( SwFormatSurround( css::text::WrapTextMode_PARALLEL ));
1663  // Set the default width to 3.5 cm, use the minimum value for the height
1665  GetMetricVal( CM_1 ) * 3 + GetMetricVal( CM_05 ),
1666  MM50 ));
1667  }
1668  break;
1669  case RES_POOLFRM_WATERSIGN:
1670  {
1671  aSet.Put( SwFormatAnchor( RndStdIds::FLY_AT_PAGE ));
1672  aSet.Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
1673  aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME ));
1674  aSet.Put( SvxOpaqueItem( RES_OPAQUE, false ));
1675  aSet.Put( SwFormatSurround( css::text::WrapTextMode_THROUGH ));
1676  }
1677  break;
1678  case RES_POOLFRM_LABEL:
1679  {
1680  aSet.Put( SwFormatAnchor( RndStdIds::FLY_AS_CHAR ) );
1681  aSet.Put( SwFormatVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) );
1682  aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) );
1683 
1684  SvxProtectItem aProtect( RES_PROTECT );
1685  aProtect.SetSizeProtect( true );
1686  aProtect.SetPosProtect( true );
1687  aSet.Put( aProtect );
1688 
1689  pNewFormat->SetAutoUpdateFormat();
1690  }
1691  break;
1692  }
1693  if( aSet.Count() )
1694  {
1695  pNewFormat->SetFormatAttr( aSet );
1696  }
1697  return pNewFormat;
1698 }
1699 
1701 {
1702  return static_cast<SwFrameFormat*>(GetFormatFromPool( nId ));
1703 }
1704 
1706 {
1707  return static_cast<SwCharFormat*>(GetFormatFromPool( nId ));
1708 }
1709 
1710 SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
1711 {
1712  OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
1713  "Wrong AutoFormat Id" );
1714 
1715  for( size_t n = 0; n < m_rDoc.GetPageDescCnt(); ++n )
1716  {
1717  if ( nId == m_rDoc.GetPageDesc(n).GetPoolFormatId() )
1718  {
1719  return &m_rDoc.GetPageDesc(n);
1720  }
1721  }
1722 
1723  if( RES_POOLPAGE_BEGIN > nId || nId >= RES_POOLPAGE_END )
1724  {
1725  // unknown page pool ID
1726  OSL_ENSURE( false, "<SwDoc::GetPageDescFromPool(..)> - unknown page pool ID" );
1727  nId = RES_POOLPAGE_BEGIN;
1728  }
1729 
1730  SwPageDesc* pNewPgDsc = nullptr;
1731  {
1732  static_assert(SAL_N_ELEMENTS(STR_POOLPAGE_ARY) == RES_POOLPAGE_END - RES_POOLPAGE_BEGIN, "### unexpected size!");
1733  const OUString aNm(SwResId(STR_POOLPAGE_ARY[nId - RES_POOLPAGE_BEGIN]));
1734  const bool bIsModified = m_rDoc.getIDocumentState().IsModified();
1735 
1736  {
1737  ::sw::UndoGuard const undoGuard(m_rDoc.GetIDocumentUndoRedo());
1738  pNewPgDsc = m_rDoc.MakePageDesc(aNm, nullptr, bRegardLanguage);
1739  }
1740 
1741  pNewPgDsc->SetPoolFormatId( nId );
1742  if ( !bIsModified )
1743  {
1745  }
1746  }
1747 
1749  {
1750  aLR.SetLeft( GetMetricVal( CM_1 ) * 2 );
1751  aLR.SetRight( aLR.GetLeft() );
1752  }
1754  {
1755  aUL.SetUpper( static_cast<sal_uInt16>(aLR.GetLeft()) );
1756  aUL.SetLower( static_cast<sal_uInt16>(aLR.GetLeft()) );
1757  }
1758 
1760  bool bSetLeft = true;
1761 
1762  switch( nId )
1763  {
1764  case RES_POOLPAGE_STANDARD: // "Default"
1765  {
1766  aSet.Put( aLR );
1767  aSet.Put( aUL );
1769  }
1770  break;
1771 
1772  case RES_POOLPAGE_FIRST: // "First Page"
1773  case RES_POOLPAGE_REGISTER: // "Index"
1774  {
1775  lcl_PutStdPageSizeIntoItemSet( m_rDoc, aSet );
1776  aSet.Put( aLR );
1777  aSet.Put( aUL );
1778  pNewPgDsc->SetUseOn( UseOnPage::All );
1779  if( RES_POOLPAGE_FIRST == nId )
1781  }
1782  break;
1783 
1784  case RES_POOLPAGE_LEFT: // "Left Page"
1785  {
1786  lcl_PutStdPageSizeIntoItemSet( m_rDoc, aSet );
1787  aSet.Put( aLR );
1788  aSet.Put( aUL );
1789  bSetLeft = false;
1790  pNewPgDsc->SetUseOn( UseOnPage::Left );
1791  // this relies on GetPageDescFromPool() not going into infinite recursion
1792  // (by this point RES_POOLPAGE_LEFT will not reach this place again)
1794  }
1795  break;
1796  case RES_POOLPAGE_RIGHT: // "Right Page"
1797  {
1798  lcl_PutStdPageSizeIntoItemSet( m_rDoc, aSet );
1799  aSet.Put( aLR );
1800  aSet.Put( aUL );
1801  bSetLeft = false;
1802  pNewPgDsc->SetUseOn( UseOnPage::Right );
1804  }
1805  break;
1806 
1807  case RES_POOLPAGE_ENVELOPE: // "Envelope"
1808  {
1810  LandscapeSwap( aPSize );
1811  aSet.Put( SwFormatFrameSize( SwFrameSize::Fixed, aPSize.Width(), aPSize.Height() ));
1812  aLR.SetLeft( 0 ); aLR.SetRight( 0 );
1813  aUL.SetUpper( 0 ); aUL.SetLower( 0 );
1814  aSet.Put( aLR );
1815  aSet.Put( aUL );
1816 
1817  pNewPgDsc->SetUseOn( UseOnPage::All );
1818  pNewPgDsc->SetLandscape( true );
1819  }
1820  break;
1821 
1822  case RES_POOLPAGE_HTML: // "HTML"
1823  {
1824  lcl_PutStdPageSizeIntoItemSet( m_rDoc, aSet );
1825  aLR.SetRight( GetMetricVal( CM_1 ));
1826  aUL.SetUpper( static_cast<sal_uInt16>(aLR.GetRight()) );
1827  aUL.SetLower( static_cast<sal_uInt16>(aLR.GetRight()) );
1828  aSet.Put( aLR );
1829  aSet.Put( aUL );
1830 
1831  pNewPgDsc->SetUseOn( UseOnPage::All );
1832  }
1833  break;
1834 
1835  case RES_POOLPAGE_FOOTNOTE: // "Footnote"
1836  case RES_POOLPAGE_ENDNOTE: // "Endnote"
1837  {
1838  lcl_PutStdPageSizeIntoItemSet( m_rDoc, aSet );
1839  aSet.Put( aLR );
1840  aSet.Put( aUL );
1841  pNewPgDsc->SetUseOn( UseOnPage::All );
1842  SwPageFootnoteInfo aInf( pNewPgDsc->GetFootnoteInfo() );
1843  aInf.SetLineWidth( 0 );
1844  aInf.SetTopDist( 0 );
1845  aInf.SetBottomDist( 0 );
1846  pNewPgDsc->SetFootnoteInfo( aInf );
1847  }
1848  break;
1849 
1850  case RES_POOLPAGE_LANDSCAPE: // "Landscape"
1851  {
1853  SwFormatFrameSize aFrameSz( pStdPgDsc->GetMaster().GetFrameSize() );
1854  if ( !pStdPgDsc->GetLandscape() )
1855  {
1856  const SwTwips nTmp = aFrameSz.GetHeight();
1857  aFrameSz.SetHeight( aFrameSz.GetWidth() );
1858  aFrameSz.SetWidth( nTmp );
1859  }
1860  aSet.Put( aFrameSz );
1861  aSet.Put( aLR );
1862  aSet.Put( aUL );
1863  pNewPgDsc->SetUseOn( UseOnPage::All );
1864  pNewPgDsc->SetLandscape( true );
1865  }
1866  break;
1867 
1868  }
1869 
1870  if( aSet.Count() )
1871  {
1872  if( bSetLeft )
1873  {
1874  pNewPgDsc->GetLeft().SetFormatAttr( aSet );
1875  pNewPgDsc->GetFirstLeft().SetFormatAttr( aSet );
1876  }
1877  pNewPgDsc->GetMaster().SetFormatAttr( aSet );
1878  pNewPgDsc->GetFirstMaster().SetFormatAttr( aSet );
1879  }
1880  return pNewPgDsc;
1881 }
1882 
1884 {
1885  OSL_ENSURE( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END,
1886  "Wrong AutoFormat Id" );
1887 
1888  SwNumRule* pNewRule;
1889 
1890  for (size_t n = 0; n < m_rDoc.GetNumRuleTable().size(); ++n )
1891  {
1892  pNewRule = m_rDoc.GetNumRuleTable()[ n ];
1893  if (nId == pNewRule->GetPoolFormatId())
1894  {
1895  return pNewRule;
1896  }
1897  }
1898 
1899  // error: unknown Pool style
1900  if( RES_POOLNUMRULE_BEGIN > nId || nId >= RES_POOLNUMRULE_END )
1901  {
1902  OSL_ENSURE( false, "invalid Id" );
1903  nId = RES_POOLNUMRULE_BEGIN;
1904  }
1905 
1906  static_assert(SAL_N_ELEMENTS(STR_POOLNUMRULE_NUM_ARY) == RES_POOLNUMRULE_END - RES_POOLNUMRULE_BEGIN, "### unexpected size!");
1907  OUString aNm(SwResId(STR_POOLNUMRULE_NUM_ARY[nId - RES_POOLNUMRULE_BEGIN]));
1908 
1909  SwCharFormat *pNumCFormat = nullptr, *pBullCFormat = nullptr;
1910 
1911  const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode
1913  {
1914  bool bIsModified = m_rDoc.getIDocumentState().IsModified();
1915 
1916  sal_uInt16 n = m_rDoc.MakeNumRule( aNm, nullptr, false, eNumberFormatPositionAndSpaceMode );
1917 
1918  pNewRule = m_rDoc.GetNumRuleTable()[ n ];
1919  pNewRule->SetPoolFormatId( nId );
1920  pNewRule->SetAutoRule( false );
1921 
1922  if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 )
1924 
1925  if( ( RES_POOLNUMRULE_BUL1 <= nId && nId <= RES_POOLNUMRULE_BUL5 ) ||
1926  RES_POOLNUMRULE_NUM5 == nId )
1927  pBullCFormat = GetCharFormatFromPool( RES_POOLCHR_NUM_LEVEL );
1928 
1929  if( !bIsModified )
1931  }
1932 
1933  switch( nId )
1934  {
1935  case RES_POOLNUMRULE_NUM1:
1936  {
1937  SwNumFormat aFormat;
1938  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1940  aFormat.SetCharFormat( pNumCFormat );
1941  aFormat.SetStart( 1 );
1942  aFormat.SetIncludeUpperLevels( 1 );
1943  aFormat.SetSuffix( "." );
1944 
1945  static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1946  {
1947 // cm: 0.7 cm intervals, with 1 cm = 567
1948  397, 794, 1191, 1588, 1985, 2381, 2778, 3175, 3572, 3969
1949  };
1950  const sal_uInt16* pArr = aAbsSpace;
1951 
1952  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1953  {
1954  aFormat.SetFirstLineOffset( - (*pArr) );
1955  }
1956  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1957  {
1959  aFormat.SetFirstLineIndent( - (*pArr) );
1960  }
1961 
1962  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr)
1963  {
1964  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1965  {
1966  aFormat.SetAbsLSpace( *pArr + 357 ); // 357 is indent of 0.63 cm
1967  }
1968  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1969  {
1970  aFormat.SetListtabPos( *pArr );
1971  aFormat.SetIndentAt( *pArr + 357 );
1972  }
1973 
1974  pNewRule->Set( n, aFormat );
1975  }
1976  }
1977  break;
1978 
1979  case RES_POOLNUMRULE_NUM2:
1980  {
1981  static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
1982  {
1983  397, 397, 397, 397, // 0.70 cm intervals
1984  397, 397, 397, 397,
1985  397, 397
1986  };
1987 
1988  const sal_uInt16* pArr = aAbsSpace;
1989  SwNumFormat aFormat;
1990 
1991  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
1993  aFormat.SetCharFormat( pNumCFormat );
1994  aFormat.SetStart( 1 );
1995  aFormat.SetIncludeUpperLevels( 1 );
1996  aFormat.SetSuffix( "." );
1997 
1998  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1999  {
2001  }
2002 
2003  sal_uInt16 nSpace = 357; // indent of 0.63 cm
2004  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n)
2005  {
2006  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2007  {
2008  nSpace += pArr[ n ];
2009  aFormat.SetAbsLSpace( nSpace );
2010  aFormat.SetFirstLineOffset( - pArr[ n ] );
2011  }
2012  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2013  {
2014  nSpace += pArr[ n ];
2015  aFormat.SetListtabPos( nSpace );
2016  aFormat.SetIndentAt( nSpace );
2017  aFormat.SetFirstLineIndent( - pArr[ n ] );
2018  }
2019 
2020  pNewRule->Set( n, aFormat );
2021  }
2022  }
2023  break;
2024  case RES_POOLNUMRULE_NUM3:
2025  {
2026  SwNumFormat aFormat;
2027 
2028  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2030  aFormat.SetCharFormat( pNumCFormat );
2031  aFormat.SetStart( 1 );
2032  aFormat.SetIncludeUpperLevels( 1 );
2033  aFormat.SetSuffix( "." );
2034 
2035  tools::Long const nOffs = 397; // 0.70 cm
2036 
2037  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2038  {
2039  aFormat.SetFirstLineOffset( - nOffs );
2040  }
2041  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2042  {
2044  aFormat.SetFirstLineIndent( - nOffs );
2045  }
2046 
2047  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n)
2048  {
2049  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2050  {
2051  aFormat.SetAbsLSpace( (n+1) * nOffs + 357 ); // 357 is indent of 0.63 cm
2052  }
2053  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2054  {
2055  tools::Long nPos = (n+1) * nOffs;
2056  aFormat.SetListtabPos(nPos + 357);
2057  aFormat.SetIndentAt(nPos + 357);
2058  }
2059 
2060  pNewRule->Set( n, aFormat );
2061  }
2062  }
2063  break;
2064  case RES_POOLNUMRULE_NUM4:
2065  {
2066  SwNumFormat aFormat;
2067 
2068  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2070  aFormat.SetCharFormat( pNumCFormat );
2071  aFormat.SetStart( 1 );
2072  aFormat.SetIncludeUpperLevels( 1 );
2073  aFormat.SetSuffix( "." );
2074  aFormat.SetNumAdjust( SvxAdjust::Right );
2075 
2076  static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2077  {
2078 // cm: 1.33 cm intervals
2079  754, 1508, 1191, 2262, 3016, 3771, 4525, 5279, 6033, 6787
2080  };
2081  const sal_uInt16* pArr = aAbsSpace;
2082 
2083  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2084  {
2085  aFormat.SetFirstLineOffset( 580 - (*pArr) ); // 1 cm space
2086  }
2087  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2088  {
2090  aFormat.SetFirstLineIndent( 580 - (*pArr) );
2091  }
2092 
2093  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr)
2094  {
2095 
2096  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2097  {
2098  aFormat.SetAbsLSpace( *pArr );
2099  }
2100  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2101  {
2102  aFormat.SetListtabPos( *pArr );
2103  aFormat.SetIndentAt( *pArr );
2104  }
2105 
2106  pNewRule->Set( n, aFormat );
2107  }
2108  }
2109  break;
2110  case RES_POOLNUMRULE_NUM5:
2111  {
2112  // [ First, LSpace ]
2113  static const sal_uInt16 aAbsSpace0to2[] =
2114  {
2115  174, 754, // 0.33, 1.33,
2116  567, 1151, // 1.03, 2.03,
2117  397, 1548 // 2.03, 2.73
2118  };
2119 
2120  const sal_uInt16* pArr0to2 = aAbsSpace0to2;
2121  SwNumFormat aFormat;
2122 
2123  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2125  aFormat.SetStart( 1 );
2126  aFormat.SetIncludeUpperLevels( 1 );
2127  aFormat.SetSuffix( "." );
2128  aFormat.SetNumAdjust( SvxAdjust::Right );
2129 
2130  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2131  {
2133  }
2134 
2135  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2136  {
2137  aFormat.SetFirstLineOffset( -pArr0to2[0] ); // == 0.33 cm
2138  aFormat.SetAbsLSpace( pArr0to2[1] ); // == 1.33 cm
2139  }
2140  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2141  {
2142  aFormat.SetFirstLineIndent( -pArr0to2[0] );
2143  aFormat.SetListtabPos( pArr0to2[1] );
2144  aFormat.SetIndentAt( pArr0to2[1] );
2145  }
2146 
2147  aFormat.SetCharFormat( pNumCFormat );
2148  pNewRule->Set( 0, aFormat );
2149 
2150  aFormat.SetIncludeUpperLevels( 1 );
2151  aFormat.SetStart( 1 );
2152 
2153  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2154  {
2155  aFormat.SetFirstLineOffset( -pArr0to2[2] ); // == 1.03 cm
2156  aFormat.SetAbsLSpace( pArr0to2[3] ); // == 2.03 cm
2157  }
2158  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2159  {
2160  aFormat.SetFirstLineIndent( -pArr0to2[2] );
2161  aFormat.SetListtabPos( pArr0to2[3] );
2162  aFormat.SetIndentAt( pArr0to2[3] );
2163  }
2164 
2165  pNewRule->Set( 1, aFormat );
2166 
2168  aFormat.SetSuffix(OUString(u')'));
2169  aFormat.SetIncludeUpperLevels( 1 );
2170  aFormat.SetStart( 3 );
2171 
2172  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2173  {
2174  aFormat.SetFirstLineOffset( - pArr0to2[4] ); // == 2.03 cm
2175  aFormat.SetAbsLSpace( pArr0to2[5] ); // == 2.73 cm
2176  }
2177  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2178  {
2179  aFormat.SetFirstLineIndent( -pArr0to2[4] );
2180  aFormat.SetListtabPos( pArr0to2[5] );
2181  aFormat.SetIndentAt( pArr0to2[5] );
2182  }
2183 
2184  pNewRule->Set( 2, aFormat );
2185 
2187  aFormat.SetCharFormat( pBullCFormat );
2189  aFormat.SetBulletChar( cBulletChar );
2190  sal_Int16 nOffs = GetMetricVal( CM_01 ) * 4,
2191  nOffs2 = GetMetricVal( CM_1 ) * 2;
2192 
2193  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2194  {
2195  aFormat.SetFirstLineOffset( - nOffs );
2196  }
2197  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2198  {
2199  aFormat.SetFirstLineIndent( - nOffs );
2200  }
2201 
2202  aFormat.SetSuffix( OUString() );
2203  for (sal_uInt16 n = 3; n < MAXLEVEL; ++n)
2204  {
2205  aFormat.SetStart( n+1 );
2206 
2207  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2208  {
2209  aFormat.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) );
2210  }
2211  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2212  {
2213  tools::Long nPos = nOffs2 + ((n-3) * static_cast<tools::Long>(nOffs));
2214  aFormat.SetListtabPos(nPos);
2215  aFormat.SetIndentAt(nPos);
2216  }
2217 
2218  pNewRule->Set( n, aFormat );
2219  }
2220  }
2221  break;
2222 
2223  case RES_POOLNUMRULE_BUL1:
2224  {
2225  SwNumFormat aFormat;
2226 
2227  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2229  aFormat.SetCharFormat( pBullCFormat );
2230  aFormat.SetStart( 1 );
2231  aFormat.SetIncludeUpperLevels( 1 );
2233  aFormat.SetBulletChar( cBulletChar );
2234 
2235  static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2236  {
2237 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2238  227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2239  };
2240  const sal_uInt16* pArr = aAbsSpace;
2241 
2242  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2243  {
2244  aFormat.SetFirstLineOffset( - (*pArr) );
2245  }
2246  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2247  {
2249  aFormat.SetFirstLineIndent( - (*pArr) );
2250  }
2251 
2252  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr)
2253  {
2254  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2255  {
2256  aFormat.SetAbsLSpace( *pArr );
2257  }
2258  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2259  {
2260  aFormat.SetListtabPos( *pArr );
2261  aFormat.SetIndentAt( *pArr );
2262  }
2263 
2264  pNewRule->Set( n, aFormat );
2265  }
2266  }
2267  break;
2268  case RES_POOLNUMRULE_BUL2:
2269  {
2270  SwNumFormat aFormat;
2271 
2272  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2274  aFormat.SetCharFormat( pBullCFormat );
2275  aFormat.SetStart( 1 );
2276  aFormat.SetIncludeUpperLevels( 1 );
2278  aFormat.SetBulletChar( 0x2013 );
2279 
2280  static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2281  {
2282 // cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0
2283  170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701
2284  };
2285  const sal_uInt16* pArr = aAbsSpace;
2286 
2287  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2288  {
2289  aFormat.SetFirstLineOffset( - (*pArr) );
2290  }
2291  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2292  {
2294  aFormat.SetFirstLineIndent( - (*pArr) );
2295  }
2296 
2297  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr)
2298  {
2299  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2300  {
2301  aFormat.SetAbsLSpace( *pArr );
2302  }
2303  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2304  {
2305  aFormat.SetListtabPos( *pArr );
2306  aFormat.SetIndentAt( *pArr );
2307  }
2308 
2309  pNewRule->Set( n, aFormat );
2310  }
2311  }
2312  break;
2313  case RES_POOLNUMRULE_BUL3:
2314  {
2315  SwNumFormat aFormat;
2316 
2317  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2318 
2320  aFormat.SetCharFormat( pBullCFormat );
2321  aFormat.SetStart( 1 );
2322  aFormat.SetIncludeUpperLevels( 1 );
2324 
2325  sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4;
2326 
2327  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2328  {
2329  aFormat.SetFirstLineOffset( - nOffs );
2330  }
2331  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2332  {
2334  aFormat.SetFirstLineIndent( - nOffs );
2335  }
2336 
2337  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n)
2338  {
2339  aFormat.SetBulletChar( (n & 1) ? 0x25a1 : 0x2611 );
2340 
2341  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2342  {
2343  aFormat.SetAbsLSpace( ((n & 1) +1) * nOffs );
2344  }
2345  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2346  {
2347  tools::Long nPos = ((n & 1) +1) * static_cast<tools::Long>(nOffs);
2348  aFormat.SetListtabPos(nPos);
2349  aFormat.SetIndentAt(nPos);
2350  }
2351 
2352  pNewRule->Set( n, aFormat );
2353  }
2354  }
2355  break;
2356  case RES_POOLNUMRULE_BUL4:
2357  {
2358  SwNumFormat aFormat;
2359 
2360  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2362  aFormat.SetCharFormat( pBullCFormat );
2363  aFormat.SetStart( 1 );
2364  aFormat.SetIncludeUpperLevels( 1 );
2366 
2367  static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2368  {
2369 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2370  227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2371  };
2372 
2373  const sal_uInt16* pArr = aAbsSpace;
2374 
2375  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2376  {
2377  aFormat.SetFirstLineOffset( - (*pArr) );
2378  }
2379  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2380  {
2382  aFormat.SetFirstLineIndent( - (*pArr) );
2383  }
2384 
2385  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr)
2386  {
2387  switch( n )
2388  {
2389  case 0: aFormat.SetBulletChar( 0x27a2 ); break;
2390  case 1: aFormat.SetBulletChar( 0xE006 ); break;
2391  default: aFormat.SetBulletChar( 0xE004 ); break;
2392  }
2393 
2394  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2395  {
2396  aFormat.SetAbsLSpace( *pArr );
2397  }
2398  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2399  {
2400  aFormat.SetListtabPos( *pArr );
2401  aFormat.SetIndentAt( *pArr );
2402  }
2403 
2404  pNewRule->Set( n, aFormat );
2405  }
2406  }
2407  break;
2408  case RES_POOLNUMRULE_BUL5:
2409  {
2410  SwNumFormat aFormat;
2411 
2412  aFormat.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode );
2414  aFormat.SetCharFormat( pBullCFormat );
2415  aFormat.SetStart( 1 );
2416  aFormat.SetIncludeUpperLevels( 1 );
2417  aFormat.SetBulletChar( 0x2717 );
2419 
2420  static const sal_uInt16 aAbsSpace[ MAXLEVEL ] =
2421  {
2422 // cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0
2423  227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268
2424  };
2425  const sal_uInt16* pArr = aAbsSpace;
2426 
2427  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2428  {
2429  aFormat.SetFirstLineOffset( - (*pArr) );
2430  }
2431  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2432  {
2434  aFormat.SetFirstLineIndent( - (*pArr) );
2435  }
2436 
2437  for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr)
2438  {
2439  if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
2440  {
2441  aFormat.SetAbsLSpace( *pArr );
2442  }
2443  else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
2444  {
2445  aFormat.SetListtabPos( *pArr );
2446  aFormat.SetIndentAt( *pArr );
2447  }
2448 
2449  pNewRule->Set( n, aFormat );
2450  }
2451  }
2452  break;
2453  }
2454 
2455  return pNewRule;
2456 }
2457 
2460 {
2461  OSL_ENSURE(
2462  (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) ||
2466  (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) ||
2468  "Wrong AutoFormat Id" );
2469 
2470  SwTextFormatColl* pNewColl = nullptr;
2471  bool bFnd = false;
2472  for( SwTextFormatColls::size_type n = 0; !bFnd && n < m_rDoc.GetTextFormatColls()->size(); ++n )
2473  {
2474  pNewColl = (*m_rDoc.GetTextFormatColls())[ n ];
2475  if( nId == pNewColl->GetPoolFormatId() )
2476  bFnd = true;
2477  }
2478 
2479  if( !bFnd || !pNewColl->HasWriterListeners() )
2480  return false;
2481 
2482  SwAutoFormatGetDocNode aGetHt( &m_rDoc.GetNodes() );
2483  return !pNewColl->GetInfo( aGetHt );
2484 }
2485 
2488 {
2489  const SwFormat *pNewFormat = nullptr;
2490  const SwFormatsBase* pArray[ 2 ];
2491  sal_uInt16 nArrCnt = 1;
2492  bool bFnd = true;
2493 
2494  if (RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END)
2495  {
2496  pArray[0] = m_rDoc.GetCharFormats();
2497  }
2498  else if (RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END)
2499  {
2500  pArray[0] = m_rDoc.GetFrameFormats();
2501  pArray[1] = m_rDoc.GetSpzFrameFormats();
2502  nArrCnt = 2;
2503  }
2504  else
2505  {
2506  SAL_WARN("sw.core", "Invalid Pool Id: " << nId << " should be within "
2507  "[" << int(RES_POOLCHR_BEGIN) << "," << int(RES_POOLCHR_END) << ") or "
2508  "[" << int(RES_POOLFRM_BEGIN) << "," << int(RES_POOLFRM_END) << ")");
2509  bFnd = false;
2510  }
2511 
2512  if( bFnd )
2513  {
2514  bFnd = false;
2515  while( nArrCnt-- && !bFnd )
2516  for( size_t n = 0; !bFnd && n < (*pArray[nArrCnt]).GetFormatCount(); ++n )
2517  {
2518  pNewFormat = (*pArray[ nArrCnt ] ).GetFormat( n );
2519  if( nId == pNewFormat->GetPoolFormatId() )
2520  bFnd = true;
2521  }
2522  }
2523 
2524  // Not found or no dependencies?
2525  if( bFnd && pNewFormat->HasWriterListeners() )
2526  {
2527  // Check if we have dependent ContentNodes in the Nodes array
2528  // (also indirect ones for derived Formats)
2529  SwAutoFormatGetDocNode aGetHt( &m_rDoc.GetNodes() );
2530  bFnd = !pNewFormat->GetInfo( aGetHt );
2531  }
2532  else
2533  bFnd = false;
2534 
2535  return bFnd;
2536 }
2537 
2540 {
2541  OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END,
2542  "Wrong AutoFormat Id" );
2543  SwPageDesc *pNewPgDsc = nullptr;
2544  bool bFnd = false;
2545  for( size_t n = 0; !bFnd && n < m_rDoc.GetPageDescCnt(); ++n )
2546  {
2547  pNewPgDsc = &m_rDoc.GetPageDesc(n);
2548  if( nId == pNewPgDsc->GetPoolFormatId() )
2549  bFnd = true;
2550  }
2551 
2552  // Not found or no dependencies?
2553  if( !bFnd || !pNewPgDsc->HasWriterListeners() ) // ??????
2554  return false;
2555 
2556  // Check if we have dependent ContentNodes in the Nodes array
2557  // (also indirect ones for derived Formats)
2558  SwAutoFormatGetDocNode aGetHt( &m_rDoc.GetNodes() );
2559  return !pNewPgDsc->GetInfo( aGetHt );
2560 }
2561 
2563 {
2564 }
2565 
2566 }
2567 
2568 static std::vector<OUString>
2569 lcl_NewUINameArray(const char** pIds, const size_t nLen, const size_t nSvxIds = 0)
2570 {
2571  assert(nSvxIds <= nLen);
2572  const size_t nWriterIds = nLen - nSvxIds;
2573  std::vector<OUString> aNameArray;
2574  aNameArray.reserve(nLen);
2575  for (size_t i = 0; i < nWriterIds; ++i)
2576  aNameArray.push_back(SwResId(pIds[i]));
2577  for (size_t i = nWriterIds; i < nLen; ++i)
2578  aNameArray.push_back(SvxResId(pIds[i]));
2579  return aNameArray;
2580 }
2581 
2582 const std::vector<OUString>& SwStyleNameMapper::GetTextUINameArray()
2583 {
2584  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2585  static std::map<LanguageTag, std::vector<OUString>> s_aTextUINameArray;
2586 
2587  auto aFound = s_aTextUINameArray.find(aCurrentLanguage);
2588  if (aFound == s_aTextUINameArray.end()) {
2589  s_aTextUINameArray[aCurrentLanguage] =
2590  lcl_NewUINameArray(STR_POOLCOLL_TEXT_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_TEXT_ARY));
2591  }
2592 
2593  return s_aTextUINameArray[aCurrentLanguage];
2594 }
2595 
2596 const std::vector<OUString>& SwStyleNameMapper::GetListsUINameArray()
2597 {
2598  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2599  static std::map<LanguageTag, std::vector<OUString>> s_aListsUINameArray;
2600 
2601  auto aFound = s_aListsUINameArray.find(aCurrentLanguage);
2602  if (aFound == s_aListsUINameArray.end()) {
2603  s_aListsUINameArray[aCurrentLanguage] =
2604  lcl_NewUINameArray(STR_POOLCOLL_LISTS_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_LISTS_ARY));
2605  }
2606 
2607  return s_aListsUINameArray[aCurrentLanguage];
2608 }
2609 
2610 const std::vector<OUString>& SwStyleNameMapper::GetExtraUINameArray()
2611 {
2612  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2613  static std::map<LanguageTag, std::vector<OUString>> s_aExtraUINameArray;
2614 
2615  auto aFound = s_aExtraUINameArray.find(aCurrentLanguage);
2616  if (aFound == s_aExtraUINameArray.end()) {
2617  s_aExtraUINameArray[aCurrentLanguage] =
2619  }
2620 
2621  return s_aExtraUINameArray[aCurrentLanguage];
2622 }
2623 
2624 const std::vector<OUString>& SwStyleNameMapper::GetRegisterUINameArray()
2625 {
2626  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2627  static std::map<LanguageTag, std::vector<OUString>> s_aRegisterUINameArray;
2628 
2629  auto aFound = s_aRegisterUINameArray.find(aCurrentLanguage);
2630  if (aFound == s_aRegisterUINameArray.end()) {
2631  s_aRegisterUINameArray[aCurrentLanguage] =
2632  lcl_NewUINameArray(STR_POOLCOLL_REGISTER_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_REGISTER_ARY));
2633  }
2634 
2635  return s_aRegisterUINameArray[aCurrentLanguage];
2636 }
2637 
2638 const std::vector<OUString>& SwStyleNameMapper::GetDocUINameArray()
2639 {
2640  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2641  static std::map<LanguageTag, std::vector<OUString>> s_aDocUINameArray;
2642 
2643  auto aFound = s_aDocUINameArray.find(aCurrentLanguage);
2644  if (aFound == s_aDocUINameArray.end())
2645  s_aDocUINameArray[aCurrentLanguage] =
2646  lcl_NewUINameArray(STR_POOLCOLL_DOC_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_DOC_ARY));
2647 
2648  return s_aDocUINameArray[aCurrentLanguage];
2649 }
2650 
2651 const std::vector<OUString>& SwStyleNameMapper::GetHTMLUINameArray()
2652 {
2653  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2654  static std::map<LanguageTag, std::vector<OUString>> s_aHTMLUINameArray;
2655 
2656  auto aFound = s_aHTMLUINameArray.find(aCurrentLanguage);
2657  if (aFound == s_aHTMLUINameArray.end()) {
2658  s_aHTMLUINameArray[aCurrentLanguage] =
2659  lcl_NewUINameArray(STR_POOLCOLL_HTML_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_HTML_ARY));
2660  }
2661 
2662  return s_aHTMLUINameArray[aCurrentLanguage];
2663 }
2664 
2665 const std::vector<OUString>& SwStyleNameMapper::GetFrameFormatUINameArray()
2666 {
2667  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2668  static std::map<LanguageTag, std::vector<OUString>> s_aFrameFormatUINameArray;
2669 
2670  auto aFound = s_aFrameFormatUINameArray.find(aCurrentLanguage);
2671  if (aFound == s_aFrameFormatUINameArray.end()) {
2672  s_aFrameFormatUINameArray[aCurrentLanguage] =
2673  lcl_NewUINameArray(STR_POOLFRM_ARY, SAL_N_ELEMENTS(STR_POOLFRM_ARY));
2674  }
2675 
2676  return s_aFrameFormatUINameArray[aCurrentLanguage];
2677 }
2678 
2679 const std::vector<OUString>& SwStyleNameMapper::GetChrFormatUINameArray()
2680 {
2681  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2682  static std::map<LanguageTag, std::vector<OUString>> s_aChrFormatUINameArray;
2683 
2684  auto aFound = s_aChrFormatUINameArray.find(aCurrentLanguage);
2685  if (aFound == s_aChrFormatUINameArray.end()) {
2686  s_aChrFormatUINameArray[aCurrentLanguage] =
2687  lcl_NewUINameArray(STR_POOLCHR_ARY, SAL_N_ELEMENTS(STR_POOLCHR_ARY));
2688  }
2689 
2690  return s_aChrFormatUINameArray[aCurrentLanguage];
2691 }
2692 
2694 {
2695  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2696  static std::map<LanguageTag, std::vector<OUString>> s_aHTMLChrFormatUINameArray;
2697 
2698  auto aFound = s_aHTMLChrFormatUINameArray.find(aCurrentLanguage);
2699  if (aFound == s_aHTMLChrFormatUINameArray.end()) {
2700  s_aHTMLChrFormatUINameArray[aCurrentLanguage] =
2701  lcl_NewUINameArray(STR_POOLCHR_HTML_ARY, SAL_N_ELEMENTS(STR_POOLCHR_HTML_ARY));
2702  }
2703 
2704  return s_aHTMLChrFormatUINameArray[aCurrentLanguage];
2705 }
2706 
2707 const std::vector<OUString>& SwStyleNameMapper::GetPageDescUINameArray()
2708 {
2709  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2710  static std::map<LanguageTag, std::vector<OUString>> s_aPageDescUINameArray;
2711 
2712  auto aFound = s_aPageDescUINameArray.find(aCurrentLanguage);
2713  if (aFound == s_aPageDescUINameArray.end()) {
2714  s_aPageDescUINameArray[aCurrentLanguage] =
2715  lcl_NewUINameArray(STR_POOLPAGE_ARY, SAL_N_ELEMENTS(STR_POOLPAGE_ARY));
2716  }
2717 
2718  return s_aPageDescUINameArray[aCurrentLanguage];
2719 }
2720 
2721 const std::vector<OUString>& SwStyleNameMapper::GetNumRuleUINameArray()
2722 {
2723  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2724  static std::map<LanguageTag, std::vector<OUString>> s_aNumRuleUINameArray;
2725 
2726  auto aFound = s_aNumRuleUINameArray.find(aCurrentLanguage);
2727  if (aFound == s_aNumRuleUINameArray.end()) {
2728  s_aNumRuleUINameArray[aCurrentLanguage] =
2729  lcl_NewUINameArray(STR_POOLNUMRULE_NUM_ARY, SAL_N_ELEMENTS(STR_POOLNUMRULE_NUM_ARY));
2730  }
2731 
2732  return s_aNumRuleUINameArray[aCurrentLanguage];
2733 }
2734 
2735 const std::vector<OUString>& SwStyleNameMapper::GetTableStyleUINameArray()
2736 {
2737  LanguageTag aCurrentLanguage = SvtSysLocale().GetUILanguageTag();
2738  static std::map<LanguageTag, std::vector<OUString>> s_aTableStyleUINameArray;
2739 
2740  auto aFound = s_aTableStyleUINameArray.find(aCurrentLanguage);
2741  if (aFound == s_aTableStyleUINameArray.end()) {
2742  s_aTableStyleUINameArray[aCurrentLanguage] =
2743  // 1 Writer resource string (XXX if this ever changes rather use offset math)
2744  lcl_NewUINameArray(STR_TABSTYLE_ARY, SAL_N_ELEMENTS(STR_TABSTYLE_ARY),
2745  static_cast<size_t>(SAL_N_ELEMENTS(STR_TABSTYLE_ARY) - 1));
2746  }
2747 
2748  return s_aTableStyleUINameArray[aCurrentLanguage];
2749 }
2750 
2751 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
End 1st level.
Definition: poolfmt.hxx:282
NumRule Numbering abc.
Definition: poolfmt.hxx:190
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
static const char * STR_POOLCOLL_HTML_ARY[]
virtual bool IsPoolPageDescUsed(sal_uInt16 nId) const override
Check if this AutoCollection is already/still in use in this Document.
Subgroup labels.
Definition: poolfmt.hxx:344
#define LANGUAGE_NONE
tools::Long GetWidth() const
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
bool Insert(const SvxTabStop &rTab)
void SetLabelFollowedBy(const LabelFollowedBy eLabelFollowedBy)
void SetUseOn(UseOnPage eNew)
Same as WriteUseOn(), but the >= HeaderShare part of the bitfield is not modified.
Definition: pagedesc.hxx:319
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:590
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL5S
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL3S
Group HTML-styles.
Definition: poolfmt.hxx:429
static sal_uInt16 GetBullIndent(sal_uInt8 nLvl)
Definition: number.cxx:167
Subgroup numberings.
Definition: poolfmt.hxx:280
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
static const std::vector< OUString > & GetListsUINameArray()
static const char * STR_POOLCOLL_EXTRA_ARY[]
Footnote at end of document.
Definition: poolfmt.hxx:177
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CTL_FONT(27)
const OUString & GetFamilyName() const
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL1S
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:217
#define LANGUAGE_ARABIC_SAUDI_ARABIA
#define LINE_SPACE_DEFAULT_HEIGHT
static const std::vector< OUString > & GetTableStyleUINameArray()
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL1S
Group chapter / document.
Definition: poolfmt.hxx:420
#define LANGUAGE_ENGLISH_US
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL3E
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL3
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL3E
void SetAutoRule(bool bFlag)
Definition: numrule.hxx:229
static const char * STR_POOLPAGE_ARY[]
const OUString & GetStyleName() const
Start 3rd level.
Definition: poolfmt.hxx:288
static const std::vector< OUString > & GetFrameFormatUINameArray()
#define CM_01
const LanguageTag & GetUILanguageTag() const
static const char * STR_POOLCHR_HTML_ARY[]
const sal_uInt16 COLL_GET_RANGE_BITS
Definition: poolfmt.hxx:71
virtual SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId) override
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL4E
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_NONUM5
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(110)
void SetPositionAndSpaceMode(SvxNumPositionAndSpaceMode ePositionAndSpaceMode)
constexpr::Color COL_RED(0x80, 0x00, 0x00)
static const std::vector< OUString > & GetHTMLUINameArray()
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL5S
Header Left.
Definition: poolfmt.hxx:331
Pages/field.
Definition: poolfmt.hxx:114
NumRule Bullets 1.
Definition: poolfmt.hxx:193
End of text styles collection.
Definition: poolfmt.hxx:437
Main entry in indices.
Definition: poolfmt.hxx:126
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_LANGUAGE(10)
long Long
tools::Long GetRight() const
const short lNumberFirstLineOffset
Definition: swtypes.hxx:106
NumRule Bullets 3.
Definition: poolfmt.hxx:195
Subgroup user indices.
Definition: poolfmt.hxx:381
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL4S
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
Definition: langhelper.cxx:398
SVX_NUM_CHARS_UPPER_LETTER
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat IDs.
Definition: numrule.hxx:249
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:218
#define LANGUAGE_KOREAN
Doc. subtitle.
Definition: poolfmt.hxx:423
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true) override
Return "Auto-Collection with ID.
Special ranges.
Definition: poolfmt.hxx:326
sal_Int64 n
Objects all levels.
Definition: poolfmt.hxx:400
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL5E
Start 2nd level.
Definition: poolfmt.hxx:306
Definition: doc.hxx:186
Vertical numbering symbols.
Definition: poolfmt.hxx:130
const sal_Unicode cBulletChar
Character for lists.
Definition: numrule.hxx:48
Content 1st level.
Definition: poolfmt.hxx:374
sal_uInt16 GetPoolParent(sal_uInt16 nId)
Query defined parent of a POOL-ID Returns 0 if standard USHRT_MAX if no parent the parent in all othe...
Definition: poolfmt.cxx:143
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
const OUString & GetName() const
Definition: numrule.hxx:223
constexpr TypedWhichId< SvxOpaqueItem > RES_OPAQUE(99)
Dialog to specify the properties of date form field.
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
void SetIncludeUpperLevels(sal_uInt8 nSet)
SwFormat * MakeFrameFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:836
virtual bool SetFormatAttr(const SfxPoolItem &rAttr) override
Override to recognize changes on the and register/unregister the paragragh style at t...
Definition: fmtcol.cxx:332
Tables all levels.
Definition: poolfmt.hxx:404
bool HasWriterListeners() const
Definition: calbck.hxx:209
static const char * STR_POOLCOLL_REGISTER_ARY[]
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:188
static const char * STR_POOLCOLL_TEXT_ARY[]
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:741
static const std::vector< OUString > & GetPageDescUINameArray()
sal_uInt16 const aTextFormatCollSetRange[]
Definition: init.cxx:149
Value in Var-direction gives minimum (can be exceeded but not be less).
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:292
FontFamily GetFamilyType()
void SetIndentAt(const tools::Long nIndentAt)
Landscape page style.
Definition: poolfmt.hxx:179
Content 5th level.
Definition: poolfmt.hxx:378
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_NONUM4
static const char * STR_POOLCHR_ARY[]
WEIGHT_BOLD
static const std::vector< OUString > & GetDocUINameArray()
constexpr TypedWhichId< SvxCaseMapItem > RES_CHRATR_CASEMAP(RES_CHRATR_BEGIN)
SwDoc & m_rDoc
Definition: docbm.cxx:1205
const SwPageFootnoteInfo & GetFootnoteInfo() const
Definition: pagedesc.hxx:195
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:750
void SetPropLineSpace(const sal_uInt16 nProp)
provides some methods for generic operations on lists that contain SwFormat* subclasses.
Definition: docary.hxx:43
void SetFootnoteInfo(const SwPageFootnoteInfo &rNew)
Definition: pagedesc.hxx:197
LINESTYLE_NONE
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL5E
OUString SvxResId(const char *pId)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUMBER_BULLET_BASE
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:144
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:253
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CTL_LANGUAGE(29)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
const SwTextFormatColl * GetDfltTextFormatColl() const
Definition: doc.hxx:775
Subgroup header.
Definition: poolfmt.hxx:329
void SetLandscape(bool bNew)
Definition: pagedesc.hxx:190
constexpr::Color COL_CYAN(0x00, 0x80, 0x80)
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:233
SwFormat * MakeCharFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:869
void SetAllScriptItem(SfxItemSet &rSet, const SfxPoolItem &rItem)
Definition: poolfmt.cxx:39
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:655
SVX_NUM_ARABIC
No numbering.
Definition: poolfmt.hxx:291
Content 6th level.
Definition: poolfmt.hxx:388
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL1E
SVX_NUM_ROMAN_UPPER
#define DFLT_ESC_AUTO_SUPER
NumRule Numbering ivx.
Definition: poolfmt.hxx:192
Numbering symbols.
Definition: poolfmt.hxx:117
SVX_NUM_ROMAN_LOWER
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:153
virtual SwNumRule * GetNumRuleFromPool(sal_uInt16 nId) override
void SetAllDistances(sal_uInt16 nNew)
Content 2nd level.
Definition: poolfmt.hxx:375
Text body indent.
Definition: poolfmt.hxx:253
#define DFLT_ESC_PROP
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_NONUM1
Authorities all levels.
Definition: poolfmt.hxx:408
const sal_uInt16 POOLGRP_NOCOLLID
POOLCOLL-IDs: +-—+—+—+—+—+—+—+—+—+—+—+—+—+—+—+—+ !User! Range ! 0 ! Offset ! +-—+—+...
Definition: poolfmt.hxx:59
Other stuff.
Definition: poolfmt.hxx:351
void SetPoolFormatId(sal_uInt16 nId)
Definition: numrule.hxx:250
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
constexpr TypedWhichId< SvxWeightItem > RES_CHRATR_WEIGHT(15)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_NONUM2
Base class for various Writer styles.
Definition: format.hxx:43
#define SAL_N_ELEMENTS(arr)
Content 3rd level.
Definition: poolfmt.hxx:376
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL2
void SetNumAdjust(SvxAdjust eSet)
SVX_NUM_CHAR_SPECIAL
object index.
Definition: poolfmt.hxx:399
Table of Contents - heading.
Definition: poolfmt.hxx:341
NumRule Bullets 2.
Definition: poolfmt.hxx:194
virtual SvxULSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
Start 3rd level.
Definition: poolfmt.hxx:310
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL2S
Style of a layout element.
Definition: frmfmt.hxx:58
SVX_NUM_CHARS_LOWER_LETTER
Footnote anchor.
Definition: poolfmt.hxx:127
FontPitch GetPitch()
HTML-styles.
Definition: poolfmt.hxx:134
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL4
Complimentary close.
Definition: poolfmt.hxx:254
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true) override
Return required automatic page style.
void SetTextFirstLineOffsetValue(const short nValue)
Internet visited.
Definition: poolfmt.hxx:121
int i
void SetBulletFont(const vcl::Font *pFont)
sal_Int32 GetAbsLSpace() const
No numbering.
Definition: poolfmt.hxx:287
End 5th level.
Definition: poolfmt.hxx:298
No numbering.
Definition: poolfmt.hxx:295
Marginalia.
Definition: poolfmt.hxx:158
First page.
Definition: poolfmt.hxx:171
std::vector< SwTextFormatColl * >::size_type size_type
Definition: docary.hxx:63
Subgroup headings.
Definition: poolfmt.hxx:260
Subgroup footer.
Definition: poolfmt.hxx:335
NumRule Numbering IVX.
Definition: poolfmt.hxx:191
virtual bool IsModified() const =0
Changes of document?
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1322
End 2nd level.
Definition: poolfmt.hxx:286
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL1
void SetAuto(bool bNew)
Definition: format.hxx:159
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL1
bool GetLandscape() const
Definition: pagedesc.hxx:189
Text body.
Definition: poolfmt.hxx:250
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:641
NumRule Numbering ABC.
Definition: poolfmt.hxx:189
FlyAnchors.
Definition: fmtanchr.hxx:34
Jump from index.
Definition: poolfmt.hxx:123
End 4th level.
Definition: poolfmt.hxx:294
bool IsConditionalByPoolId(sal_uInt16 nId)
const SvxPageUsage aArr[]
const short lBulletFirstLineOffset
Definition: swtypes.hxx:104
tools::Long GetLeft() const
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
tools::Long Width() const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_GRAY
virtual void SetName(const OUString &rNewName, bool bBroadcast=false)
Definition: format.cxx:150
size_t GetPageDescCnt() const
Definition: doc.hxx:879
Internet normal.
Definition: poolfmt.hxx:120
LINESTYLE_SINGLE
float u
size_t size() const
Definition: docary.hxx:84
Header Left&Right.
Definition: poolfmt.hxx:330
Header Right.
Definition: poolfmt.hxx:332
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
#define LANGUAGE_DONTKNOW
Endnote anchor.
Definition: poolfmt.hxx:128
Label drawing objects.
Definition: poolfmt.hxx:357
Subgroup bullets.
Definition: poolfmt.hxx:302
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
static sal_uInt16 GetNumIndent(sal_uInt8 nLvl)
Definition: number.cxx:161
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:254
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL2
constexpr TypedWhichId< SvxEmphasisMarkItem > RES_CHRATR_EMPHASIS_MARK(33)
tools::Long GetHeight() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL2E
SfxItemPool * GetPool() const
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL1E
Left page.
Definition: poolfmt.hxx:172
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL2E
#define CM_1
Start 4th level.
Definition: poolfmt.hxx:292
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_NONUM3
Illustrations all levels.
Definition: poolfmt.hxx:396
Frame cannot be moved in Var-direction.
tools::Long SwTwips
Definition: swtypes.hxx:49
void SetCountLines(bool b)
Definition: fmtline.hxx:61
Text body first line indent.
Definition: poolfmt.hxx:251
const sal_uInt16 POOLGRP_FRAMEFMT
Definition: poolfmt.hxx:76
void push_back(Value const &rVal)
Definition: docary.hxx:98
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_NONUM2
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:744
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
Definition: fmtcol.cxx:597
void SetBulletChar(sal_UCS4 cSet)
user index 6..10.
Definition: poolfmt.hxx:411
Endnote page.
Definition: poolfmt.hxx:178
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL2S
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL4E
Size & LandscapeSwap(Size &rSize)
sal_uInt16 const aFrameFormatSetRange[]
Definition: init.cxx:233
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:462
static const std::vector< OUString > & GetNumRuleUINameArray()
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
illustrations index.
Definition: poolfmt.hxx:395
constexpr TypedWhichId< SvxScriptSpaceItem > RES_PARATR_SCRIPTSPACE(73)
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:79
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL3
virtual SwFrameFormat * GetFrameFormatFromPool(sal_uInt16 nId) override
Return required automatic format.
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:216
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
static const std::vector< OUString > & GetHTMLChrFormatUINameArray()
Content 9th level.
Definition: poolfmt.hxx:391
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
void SetSizeProtect(bool bNew)
Footnote information.
Definition: pagedesc.hxx:48
static const std::vector< OUString > & GetChrFormatUINameArray()
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:591
Doc. appendix.
Definition: poolfmt.hxx:424
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:273
Start 5th level.
Definition: poolfmt.hxx:318
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL5
static const std::vector< OUString > & GetExtraUINameArray()
constexpr TypedWhichId< SvxOrphansItem > RES_PARATR_ORPHANS(66)
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:737
void SetPosProtect(bool bNew)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL4
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1488
#define MM50
Definition: swtypes.hxx:59
#define CM_05
static const char * STR_POOLNUMRULE_NUM_ARY[]
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
NumRule Numbering 123.
Definition: poolfmt.hxx:188
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:777
ITALIC_NORMAL
unsigned char sal_uInt8
virtual bool GetInfo(SfxPoolItem &) const override
Query information from Client.
Definition: pagedesc.cxx:179
LINESTYLE_DOTTED
void SetFirstLineOffset(sal_Int32 nSet)
Right page.
Definition: poolfmt.hxx:173
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:219
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1065
Marginalia.
Definition: poolfmt.hxx:257
static std::vector< OUString > lcl_NewUINameArray(const char **pIds, const size_t nLen, const size_t nSvxIds=0)
OUString aName
Content 4th level.
Definition: poolfmt.hxx:377
static const char * STR_POOLCOLL_DOC_ARY[]
LanguageType GetAppLanguage()
Definition: init.cxx:728
SwNodes & GetNodes()
Definition: doc.hxx:405
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_CJK_FONT(22)
Start 2nd level.
Definition: poolfmt.hxx:284
virtual SvxLRSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
static const std::vector< OUString > & GetRegisterUINameArray()
sal_uInt16 const aCharFormatSetRange[]
Definition: init.cxx:244
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_NONUM5
Content 10th level.
Definition: poolfmt.hxx:392
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:186
Content 8th level.
Definition: poolfmt.hxx:390
NumRule Bullets 4.
Definition: poolfmt.hxx:196
tools::Long Height() const
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
Start 5th level.
Definition: poolfmt.hxx:296
sal_uInt16 MakeNumRule(const OUString &rName, const SwNumRule *pCpy=nullptr, bool bBroadcast=false, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode=SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
Definition: docnum.cxx:2449
Label illustration.
Definition: poolfmt.hxx:345
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:381
tools::Long const nRightMargin
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_LEVEL4S
tables index.
Definition: poolfmt.hxx:403
void SetSuffix(const OUString &rSet)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_NONUM4
sal_Int32 GetFirstLineOffset() const
Start 4th level.
Definition: poolfmt.hxx:314
virtual bool IsPoolTextCollUsed(sal_uInt16 nId) const override
Check if this AutoCollection is already/still in use in this Document.
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
DefaultFontType
void SetStart(sal_uInt16 nSet)
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
Definition: poolfmt.cxx:77
static const char * STR_POOLFRM_ARY[]
void SetLineWidth(sal_uLong const nSet)
Definition: pagedesc.hxx:71
No numbering.
Definition: poolfmt.hxx:299
Footer Left.
Definition: poolfmt.hxx:336
virtual SwFormat * GetFormatFromPool(sal_uInt16 nId) override
Return the AutomaticFormat with the supplied Id.
Line numbering.
Definition: poolfmt.hxx:125
PAPER_ENV_C65
#define SAL_WARN(area, stream)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_NONUM1
Content 7th level.
Definition: poolfmt.hxx:389
void SetAbsLSpace(sal_Int32 nSet)
constexpr::Color COL_BLUE(0x00, 0x00, 0x80)
No numbering.
Definition: poolfmt.hxx:283
Subgroup index tables.
Definition: poolfmt.hxx:366
Text body hanging indent.
Definition: poolfmt.hxx:252
constexpr TypedWhichId< SvxCharRotateItem > RES_CHRATR_ROTATE(32)
Subgroup table of contents.
Definition: poolfmt.hxx:373
#define DEF_LINE_WIDTH_0
sal_uInt16 const aPgFrameFormatSetRange[]
Definition: init.cxx:259
End 3rd level.
Definition: poolfmt.hxx:290
void SetNumberingType(SvxNumType nSet)
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:735
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_BULLET_NONUM3
Subgroup table.
Definition: poolfmt.hxx:340
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL3S
void SetFirstLineIndent(const tools::Long nFirstLineIndent)
sal_uInt16 GetMetricVal(int n)
index of authorities.
Definition: poolfmt.hxx:407
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
Standard page.
Definition: poolfmt.hxx:170
const sal_uInt16 POOLGRP_CHARFMT
Other groups:
Definition: poolfmt.hxx:75
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_CJK_FONTSIZE(23)
static const char *STR_POOLCOLL_LISTS_ARY[] STR_POOLCOLL_NUM_LEVEL5
static const std::vector< OUString > & GetTextUINameArray()
NumRule Bullets 5.
Definition: poolfmt.hxx:197
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SvxPostureItem > RES_CHRATR_POSTURE(11)
Footer Right.
Definition: poolfmt.hxx:337
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
constexpr TypedWhichId< SvxLanguageItem > RES_CHRATR_CJK_LANGUAGE(24)
#define HTML_PARSPACE
static const char * STR_TABSTYLE_ARY[]
constexpr TypedWhichId< SvxWidowsItem > RES_PARATR_WIDOWS(67)
rtl_TextEncoding GetCharSet() const
sal_uInt16 nPos
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1317
void SetListtabPos(const tools::Long nListtabPos)
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1023
virtual bool IsPoolFormatUsed(sal_uInt16 nId) const override
Check if this AutoCollection is already/still in use.
virtual void ResetModified()=0
Placeholder.
Definition: poolfmt.hxx:122
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
void SetAutoUpdateFormat(bool bNew=true)
Definition: format.hxx:169