LibreOffice Module sc (master)  1
docpool.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  */
19 
20 #include <sal/config.h>
21 
22 #include <utility>
23 
24 #include <scitems.hxx>
25 
26 #include <comphelper/string.hxx>
27 #include <i18nutil/unicode.hxx>
28 #include <vcl/outdev.hxx>
29 #include <vcl/svapp.hxx>
30 #include <vcl/settings.hxx>
31 #include <svl/itemiter.hxx>
32 #include <svl/stritem.hxx>
33 #include <svx/algitem.hxx>
34 #include <editeng/boxitem.hxx>
35 #include <editeng/lineitem.hxx>
36 #include <editeng/brushitem.hxx>
38 #include <editeng/contouritem.hxx>
39 #include <editeng/colritem.hxx>
42 #include <editeng/fhgtitem.hxx>
43 #include <editeng/fontitem.hxx>
45 #include <editeng/frmdiritem.hxx>
46 #include <editeng/hngpnctitem.hxx>
47 #include <editeng/itemtype.hxx>
48 #include <editeng/editrids.hrc>
49 #include <editeng/eerdll.hxx>
50 #include <editeng/langitem.hxx>
51 #include <editeng/lrspitem.hxx>
52 #include <svx/pageitem.hxx>
53 #include <editeng/pbinitem.hxx>
54 #include <editeng/postitem.hxx>
55 #include <svx/rotmodit.hxx>
57 #include <editeng/shaditem.hxx>
58 #include <editeng/shdditem.hxx>
59 #include <editeng/sizeitem.hxx>
60 #include <editeng/udlnitem.hxx>
61 #include <editeng/ulspitem.hxx>
62 #include <editeng/wghtitem.hxx>
63 #include <editeng/wrlmitem.hxx>
64 #include <editeng/xmlcnitm.hxx>
65 #include <editeng/justifyitem.hxx>
66 
67 #include <docpool.hxx>
68 #include <global.hxx>
69 #include <attrib.hxx>
70 #include <patattr.hxx>
71 #include <globstr.hrc>
72 #include <scresid.hxx>
73 #include <scmod.hxx>
74 #include <sc.hrc>
75 
76 // ATTR_FONT_TWOLINES (not used) was changed to ATTR_USERDEF (not saved in binary format) in 641c
77 
78 namespace {
79 
80 SvxFontItem* getDefaultFontItem(LanguageType eLang, DefaultFontType nFontType, sal_uInt16 nItemId)
81 {
82  vcl::Font aDefFont = OutputDevice::GetDefaultFont( nFontType, eLang, GetDefaultFontFlags::OnlyOne );
83  SvxFontItem* pNewItem = new SvxFontItem( aDefFont.GetFamilyType(), aDefFont.GetFamilyName(), aDefFont.GetStyleName(),
84  aDefFont.GetPitch(), aDefFont.GetCharSet(), nItemId );
85 
86  return pNewItem;
87 }
88 
89 }
90 
92 {
93  { SID_ATTR_CHAR_FONT, true }, // ATTR_FONT
94  { SID_ATTR_CHAR_FONTHEIGHT, true }, // ATTR_FONT_HEIGHT
95  { SID_ATTR_CHAR_WEIGHT, true }, // ATTR_FONT_WEIGHT
96  { SID_ATTR_CHAR_POSTURE, true }, // ATTR_FONT_POSTURE
97  { SID_ATTR_CHAR_UNDERLINE, true }, // ATTR_FONT_UNDERLINE
98  { SID_ATTR_CHAR_OVERLINE, true }, // ATTR_FONT_OVERLINE
99  { SID_ATTR_CHAR_STRIKEOUT, true }, // ATTR_FONT_CROSSEDOUT
100  { SID_ATTR_CHAR_CONTOUR, true }, // ATTR_FONT_CONTOUR
101  { SID_ATTR_CHAR_SHADOWED, true }, // ATTR_FONT_SHADOWED
102  { SID_ATTR_CHAR_COLOR, true }, // ATTR_FONT_COLOR
103  { SID_ATTR_CHAR_LANGUAGE, true }, // ATTR_FONT_LANGUAGE
104  { SID_ATTR_CHAR_CJK_FONT, true }, // ATTR_CJK_FONT from 614
105  { SID_ATTR_CHAR_CJK_FONTHEIGHT, true }, // ATTR_CJK_FONT_HEIGHT from 614
106  { SID_ATTR_CHAR_CJK_WEIGHT, true }, // ATTR_CJK_FONT_WEIGHT from 614
107  { SID_ATTR_CHAR_CJK_POSTURE, true }, // ATTR_CJK_FONT_POSTURE from 614
108  { SID_ATTR_CHAR_CJK_LANGUAGE, true }, // ATTR_CJK_FONT_LANGUAGE from 614
109  { SID_ATTR_CHAR_CTL_FONT, true }, // ATTR_CTL_FONT from 614
110  { SID_ATTR_CHAR_CTL_FONTHEIGHT, true }, // ATTR_CTL_FONT_HEIGHT from 614
111  { SID_ATTR_CHAR_CTL_WEIGHT, true }, // ATTR_CTL_FONT_WEIGHT from 614
112  { SID_ATTR_CHAR_CTL_POSTURE, true }, // ATTR_CTL_FONT_POSTURE from 614
113  { SID_ATTR_CHAR_CTL_LANGUAGE, true }, // ATTR_CTL_FONT_LANGUAGE from 614
114  { SID_ATTR_CHAR_EMPHASISMARK, true }, // ATTR_FONT_EMPHASISMARK from 614
115  { 0, true }, // ATTR_USERDEF from 614 / 641c
116  { SID_ATTR_CHAR_WORDLINEMODE, true }, // ATTR_FONT_WORDLINE from 632b
117  { SID_ATTR_CHAR_RELIEF, true }, // ATTR_FONT_RELIEF from 632b
118  { SID_ATTR_ALIGN_HYPHENATION, true }, // ATTR_HYPHENATE from 632b
119  { 0, true }, // ATTR_SCRIPTSPACE from 614d
120  { 0, true }, // ATTR_HANGPUNCTUATION from 614d
121  { SID_ATTR_PARA_FORBIDDEN_RULES,true }, // ATTR_FORBIDDEN_RULES from 614d
122  { SID_ATTR_ALIGN_HOR_JUSTIFY, true }, // ATTR_HOR_JUSTIFY
123  { SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD, true }, // ATTR_HOR_JUSTIFY_METHOD
124  { SID_ATTR_ALIGN_INDENT, true }, // ATTR_INDENT from 350
125  { SID_ATTR_ALIGN_VER_JUSTIFY, true }, // ATTR_VER_JUSTIFY
126  { SID_ATTR_ALIGN_VER_JUSTIFY_METHOD, true }, // ATTR_VER_JUSTIFY_METHOD
127  { SID_ATTR_ALIGN_STACKED, true }, // ATTR_STACKED from 680/dr14 (replaces ATTR_ORIENTATION)
128  { SID_ATTR_ALIGN_DEGREES, true }, // ATTR_ROTATE_VALUE from 367
129  { SID_ATTR_ALIGN_LOCKPOS, true }, // ATTR_ROTATE_MODE from 367
130  { SID_ATTR_ALIGN_ASIANVERTICAL, true }, // ATTR_VERTICAL_ASIAN from 642
131  { SID_ATTR_FRAMEDIRECTION, true }, // ATTR_WRITINGDIR from 643
132  { SID_ATTR_ALIGN_LINEBREAK, true }, // ATTR_LINEBREAK
133  { SID_ATTR_ALIGN_SHRINKTOFIT, true }, // ATTR_SHRINKTOFIT from 680/dr14
134  { SID_ATTR_BORDER_DIAG_TLBR, true }, // ATTR_BORDER_TLBR from 680/dr14
135  { SID_ATTR_BORDER_DIAG_BLTR, true }, // ATTR_BORDER_BLTR from 680/dr14
136  { SID_ATTR_ALIGN_MARGIN, true }, // ATTR_MARGIN
137  { 0, true }, // ATTR_MERGE
138  { 0, true }, // ATTR_MERGE_FLAG
139  { SID_ATTR_NUMBERFORMAT_VALUE, true }, // ATTR_VALUE_FORMAT
140  { ATTR_LANGUAGE_FORMAT, true }, // ATTR_LANGUAGE_FORMAT from 329, is combined with SID_ATTR_NUMBERFORMAT_VALUE in the dialog
141  { SID_ATTR_BRUSH, true }, // ATTR_BACKGROUND
142  { SID_SCATTR_PROTECTION, true }, // ATTR_PROTECTION
143  { SID_ATTR_BORDER_OUTER, true }, // ATTR_BORDER
144  { SID_ATTR_BORDER_INNER, true }, // ATTR_BORDER_INNER
145  { SID_ATTR_BORDER_SHADOW, true }, // ATTR_SHADOW
146  { 0, true }, // ATTR_VALIDDATA
147  { 0, true }, // ATTR_CONDITIONAL
148  { 0, true }, // ATTR_HYPERLINK
149  { 0, true }, // ATTR_PATTERN
150  { SID_ATTR_LRSPACE, true }, // ATTR_LRSPACE
151  { SID_ATTR_ULSPACE, true }, // ATTR_ULSPACE
152  { SID_ATTR_PAGE, true }, // ATTR_PAGE
153  { SID_ATTR_PAGE_PAPERBIN, true }, // ATTR_PAGE_PAPERBIN
154  { SID_ATTR_PAGE_SIZE, true }, // ATTR_PAGE_SIZE
155  { SID_ATTR_PAGE_EXT1, true }, // ATTR_PAGE_HORCENTER
156  { SID_ATTR_PAGE_EXT2, true }, // ATTR_PAGE_VERCENTER
157  { SID_ATTR_PAGE_ON, true }, // ATTR_PAGE_ON
158  { SID_ATTR_PAGE_DYNAMIC, true }, // ATTR_PAGE_DYNAMIC
159  { SID_ATTR_PAGE_SHARED, true }, // ATTR_PAGE_SHARED
160  { SID_ATTR_PAGE_SHARED_FIRST, true }, // ATTR_PAGE_SHARED_FIRST
161  { SID_SCATTR_PAGE_NOTES, true }, // ATTR_PAGE_NOTES
162  { SID_SCATTR_PAGE_GRID, true }, // ATTR_PAGE_GRID
163  { SID_SCATTR_PAGE_HEADERS, true }, // ATTR_PAGE_HEADERS
164  { SID_SCATTR_PAGE_CHARTS, true }, // ATTR_PAGE_CHARTS
165  { SID_SCATTR_PAGE_OBJECTS, true }, // ATTR_PAGE_OBJECTS
166  { SID_SCATTR_PAGE_DRAWINGS, true }, // ATTR_PAGE_DRAWINGS
167  { SID_SCATTR_PAGE_TOPDOWN, true }, // ATTR_PAGE_TOPDOWN
168  { SID_SCATTR_PAGE_SCALE, true }, // ATTR_PAGE_SCALE
169  { SID_SCATTR_PAGE_SCALETOPAGES, true }, // ATTR_PAGE_SCALETOPAGES
170  { SID_SCATTR_PAGE_FIRSTPAGENO, true }, // ATTR_PAGE_FIRSTPAGENO
171  { SID_SCATTR_PAGE_HEADERLEFT, true }, // ATTR_PAGE_HEADERLEFT
172  { SID_SCATTR_PAGE_FOOTERLEFT, true }, // ATTR_PAGE_FOOTERLEFT
173  { SID_SCATTR_PAGE_HEADERRIGHT, true }, // ATTR_PAGE_HEADERRIGHT
174  { SID_SCATTR_PAGE_FOOTERRIGHT, true }, // ATTR_PAGE_FOOTERRIGHT
175  { SID_SCATTR_PAGE_HEADERFIRST, true }, // ATTR_PAGE_HEADERFIRST
176  { SID_SCATTR_PAGE_FOOTERFIRST, true }, // ATTR_PAGE_FOOTERFIRST
177  { SID_ATTR_PAGE_HEADERSET, true }, // ATTR_PAGE_HEADERSET
178  { SID_ATTR_PAGE_FOOTERSET, true }, // ATTR_PAGE_FOOTERSET
179  { SID_SCATTR_PAGE_FORMULAS, true }, // ATTR_PAGE_FORMULAS
180  { SID_SCATTR_PAGE_NULLVALS, true }, // ATTR_PAGE_NULLVALS
181  { SID_SCATTR_PAGE_SCALETO, true }, // ATTR_PAGE_SCALETO
182  { 0, true } // ATTR_HIDDEN
183 };
184 static_assert(
185  SAL_N_ELEMENTS(aItemInfos) == ATTR_ENDINDEX - ATTR_STARTINDEX + 1, "these must match");
186 
188 
189  : SfxItemPool ( "ScDocumentPool",
191  aItemInfos, nullptr ),
192  mvPoolDefaults(ATTR_ENDINDEX-ATTR_STARTINDEX+1),
193  mnCurrentMaxKey(0)
194 {
195 
196  LanguageType nDefLang, nCjkLang, nCtlLang;
197  bool bAutoSpell;
198  ScModule::GetSpellSettings( nDefLang, nCjkLang, nCtlLang, bAutoSpell );
199 
200  // latin font from GetDefaultFonts is not used, DEFAULTFONT_LATIN_SPREADSHEET instead
201  SvxFontItem* pStdFont = getDefaultFontItem(nDefLang, DefaultFontType::LATIN_SPREADSHEET, ATTR_FONT);
202  SvxFontItem* pCjkFont = getDefaultFontItem(nCjkLang, DefaultFontType::CJK_SPREADSHEET, ATTR_CJK_FONT);
203  SvxFontItem* pCtlFont = getDefaultFontItem(nCtlLang, DefaultFontType::CTL_SPREADSHEET, ATTR_CTL_FONT);
204 
205  SvxBoxInfoItem* pGlobalBorderInnerAttr = new SvxBoxInfoItem( ATTR_BORDER_INNER );
206  SfxItemSet aSetItemItemSet( *this,
212 
213  pGlobalBorderInnerAttr->SetLine(nullptr, SvxBoxInfoItemLine::HORI);
214  pGlobalBorderInnerAttr->SetLine(nullptr, SvxBoxInfoItemLine::VERT);
215  pGlobalBorderInnerAttr->SetTable(true);
216  pGlobalBorderInnerAttr->SetDist(true);
217  pGlobalBorderInnerAttr->SetMinDist(false);
218 
219  mvPoolDefaults[ ATTR_FONT - ATTR_STARTINDEX ] = pStdFont;
248  mvPoolDefaults[ ATTR_HOR_JUSTIFY - ATTR_STARTINDEX ] = new SvxHorJustifyItem( SvxCellHorJustify::Standard, ATTR_HOR_JUSTIFY);
251  mvPoolDefaults[ ATTR_VER_JUSTIFY - ATTR_STARTINDEX ] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY);
257  // The default for the ATTR_WRITINGDIR cell attribute must by SvxFrameDirection::Environment,
258  // so that value is returned when asking for a default cell's attributes.
259  // The value from the page style is set as DefaultHorizontalTextDirection for the EditEngine.
260  mvPoolDefaults[ ATTR_WRITINGDIR - ATTR_STARTINDEX ] = new SvxFrameDirectionItem( SvxFrameDirection::Environment, ATTR_WRITINGDIR );
273  mvPoolDefaults[ ATTR_BORDER_INNER - ATTR_STARTINDEX ] = pGlobalBorderInnerAttr;
278 
279  // GetRscString only works after ScGlobal::Init (indicated by the EmptyBrushItem)
280  // TODO: Write additional method ScGlobal::IsInit() or somesuch
281  // or detect whether this is the Secondary Pool for a MessagePool
283 
285  new ScPatternAttr( SfxItemSet( *this, svl::Items<ATTR_PATTERN_START, ATTR_PATTERN_END> ),
286  ScResId(STR_STYLENAME_STANDARD) );
287  else
289  new ScPatternAttr( SfxItemSet( *this, svl::Items<ATTR_PATTERN_START, ATTR_PATTERN_END> ),
290  STRING_STANDARD ); // FIXME: without name?
291 
325 
327 }
328 
330 {
331  Delete();
332 
333  for ( sal_uInt16 i=0; i < ATTR_ENDINDEX-ATTR_STARTINDEX+1; i++ )
334  {
336  delete mvPoolDefaults[i];
337  }
338 }
339 
340 const SfxPoolItem& ScDocumentPool::PutImpl( const SfxPoolItem& rItem, sal_uInt16 nWhich, bool bPassingOwnership )
341 {
342  if ( rItem.Which() != ATTR_PATTERN ) // Only Pattern is special
343  return SfxItemPool::PutImpl( rItem, nWhich, bPassingOwnership );
344 
345  // Don't copy the default pattern of this Pool
346  if (&rItem == mvPoolDefaults[ ATTR_PATTERN - ATTR_STARTINDEX ])
347  return rItem;
348 
349  // Else Put must always happen, because it could be another Pool
350  const SfxPoolItem& rNew = SfxItemPool::PutImpl( rItem, nWhich, bPassingOwnership );
351  sal_uInt32 nRef = rNew.GetRefCount();
352  if (nRef == 1)
353  {
354  ++mnCurrentMaxKey;
355  const_cast<ScPatternAttr&>(static_cast<const ScPatternAttr&>(rNew)).SetKey(mnCurrentMaxKey);
356  }
357  return rNew;
358 }
359 
361 {
362  for (const SfxPoolItem* pItem : GetItemSurrogates( ATTR_PATTERN ))
363  {
364  ScPatternAttr* pPattern = const_cast<ScPatternAttr*>(dynamic_cast<const ScPatternAttr*>(pItem));
365  if ( pPattern && pPattern->GetStyleSheet() == pStyle )
366  pPattern->StyleToName();
367  }
368 }
369 
370 void ScDocumentPool::CellStyleCreated( std::u16string_view rName, const ScDocument& rDoc )
371 {
372  // If a style was created, don't keep any pattern with its name string in the pool,
373  // because it would compare equal to a pattern with a pointer to the new style.
374  // Calling StyleSheetChanged isn't enough because the pool may still contain items
375  // for undo or clipboard content.
376 
377  for (const SfxPoolItem* pItem : GetItemSurrogates( ATTR_PATTERN ))
378  {
379  auto pPattern = const_cast<ScPatternAttr*>(dynamic_cast<const ScPatternAttr*>(pItem));
380  if ( pPattern && pPattern->GetStyleSheet() == nullptr )
381  {
382  const OUString* pStyleName = pPattern->GetStyleName();
383  if ( pStyleName && *pStyleName == rName )
384  pPattern->UpdateStyleSheet(rDoc); // find and store style pointer
385  }
386  }
387 }
388 
390 {
391  return new SfxItemPool (*this, true);
392 }
393 
394 static bool lcl_HFPresentation
395 (
396  const SfxPoolItem& rItem,
397  MapUnit eCoreMetric,
398  MapUnit ePresentationMetric,
399  OUString& rText,
400  const IntlWrapper& rIntl
401 )
402 {
403  const SfxItemSet& rSet = static_cast<const SfxSetItem&>(rItem).GetItemSet();
404  const SfxPoolItem* pItem;
405 
406  if ( SfxItemState::SET == rSet.GetItemState(ATTR_PAGE_ON,false,&pItem) )
407  {
408  if( !static_cast<const SfxBoolItem*>(pItem)->GetValue() )
409  return false;
410  }
411 
412  SfxItemIter aIter( rSet );
413 
414  for (pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
415  {
416  sal_uInt16 nWhich = pItem->Which();
417 
418  OUString aText;
419 
420  switch( nWhich )
421  {
422  case ATTR_PAGE_ON:
423  case ATTR_PAGE_DYNAMIC:
424  case ATTR_PAGE_SHARED:
426  break;
427 
428  case ATTR_LRSPACE:
429  {
430  const SvxLRSpaceItem& rLRItem = static_cast<const SvxLRSpaceItem&>(*pItem);
431  sal_uInt16 nPropLeftMargin = rLRItem.GetPropLeft();
432  sal_uInt16 nPropRightMargin = rLRItem.GetPropRight();
433  sal_uInt16 nLeftMargin, nRightMargin;
434  tools::Long nTmp;
435  nTmp = rLRItem.GetLeft();
436  nLeftMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
437  nTmp = rLRItem.GetRight();
438  nRightMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
439 
440  aText = EditResId(RID_SVXITEMS_LRSPACE_LEFT);
441  if ( 100 != nPropLeftMargin )
442  {
443  aText += unicode::formatPercent(nPropLeftMargin,
444  Application::GetSettings().GetUILanguageTag());
445  }
446  else
447  {
448  aText += GetMetricText( static_cast<tools::Long>(nLeftMargin),
449  eCoreMetric, ePresentationMetric, &rIntl ) +
450  " " + EditResId(GetMetricId(ePresentationMetric));
451  }
452  aText += cpDelim +
453  // We don't have a nPropFirstLineOffset
454  EditResId(RID_SVXITEMS_LRSPACE_RIGHT);
455  if ( 100 != nPropRightMargin )
456  {
457  aText += unicode::formatPercent(nPropLeftMargin,
458  Application::GetSettings().GetUILanguageTag());
459  }
460  else
461  {
462  aText += GetMetricText( static_cast<tools::Long>(nRightMargin),
463  eCoreMetric, ePresentationMetric, &rIntl ) +
464  " " + EditResId(GetMetricId(ePresentationMetric));
465  }
466  }
467  break;
468 
469  default:
470  pItem->GetPresentation( SfxItemPresentation::Complete, eCoreMetric, ePresentationMetric, aText, rIntl );
471 
472  }
473 
474  if ( aText.getLength() )
475  {
476  rText += aText + " + ";
477  }
478  }
479 
480  rText = comphelper::string::stripEnd(rText, ' ');
481  rText = comphelper::string::stripEnd(rText, '+');
482  rText = comphelper::string::stripEnd(rText, ' ');
483  return true;
484 }
485 
487  const SfxPoolItem& rItem,
488  MapUnit ePresentationMetric,
489  OUString& rText,
490  const IntlWrapper& rIntl ) const
491 {
492  sal_uInt16 nW = rItem.Which();
493  OUString aStrYes ( ScResId(STR_YES) );
494  OUString aStrNo ( ScResId(STR_NO) );
495  OUString aStrSep(": ");
496 
497  bool ePresentationRet = true;
498  switch( nW )
499  {
500  case ATTR_PAGE_TOPDOWN:
501  rText = ScResId(STR_SCATTR_PAGE_PRINTDIR) + aStrSep;
502  rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ?
503  ScResId(STR_SCATTR_PAGE_TOPDOWN) :
504  ScResId(STR_SCATTR_PAGE_LEFTRIGHT) ;
505  break;
506 
507  case ATTR_PAGE_HEADERS:
508  rText = ScResId(STR_SCATTR_PAGE_HEADERS) + aStrSep;
509  rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
510  break;
511 
512  case ATTR_PAGE_NULLVALS:
513  rText = ScResId(STR_SCATTR_PAGE_NULLVALS) + aStrSep;
514  rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
515  break;
516 
517  case ATTR_PAGE_FORMULAS:
518  rText = ScResId(STR_SCATTR_PAGE_FORMULAS) + aStrSep;
519  rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
520  break;
521 
522  case ATTR_PAGE_NOTES:
523  rText = ScResId(STR_SCATTR_PAGE_NOTES) + aStrSep;
524  rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
525  break;
526 
527  case ATTR_PAGE_GRID:
528  rText = ScResId(STR_SCATTR_PAGE_GRID) + aStrSep;
529  rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
530  break;
531 
533  {
534  sal_uInt16 nPagNo = static_cast<const SfxUInt16Item&>(rItem).GetValue();
535 
536  if( nPagNo )
537  {
538  rText = ScResId( STR_SCATTR_PAGE_SCALETOPAGES ) + aStrSep;
539  OUString aPages(ScResId(STR_SCATTR_PAGE_SCALE_PAGES, nPagNo));
540  aPages = aPages.replaceFirst( "%1", OUString::number( nPagNo ) );
541  rText += aPages;
542  }
543  else
544  {
545  ePresentationRet = false;
546  }
547  }
548  break;
549 
551  {
552  sal_uInt16 nPagNo = static_cast<const SfxUInt16Item&>(rItem).GetValue();
553 
554  if( nPagNo )
555  {
556  rText = ScResId(STR_SCATTR_PAGE_FIRSTPAGENO) + aStrSep;
557  rText += OUString::number( nPagNo );
558  }
559  else
560  {
561  ePresentationRet = false;
562  }
563  }
564  break;
565 
566  case ATTR_PAGE_SCALE:
567  {
568  sal_uInt16 nPercent = static_cast<const SfxUInt16Item &>(rItem).GetValue();
569 
570  if( nPercent )
571  {
572  rText = ScResId(STR_SCATTR_PAGE_SCALE) + aStrSep;
573  rText += unicode::formatPercent(nPercent,
574  Application::GetSettings().GetUILanguageTag());
575  }
576  else
577  {
578  ePresentationRet = false;
579  }
580  }
581  break;
582 
583  case ATTR_PAGE_HEADERSET:
584  {
585  OUString aBuffer;
586 
587  if( lcl_HFPresentation( rItem, GetMetric( nW ), ePresentationMetric, aBuffer, rIntl ) )
588  {
589  rText = ScResId(STR_HEADER) + " ( " + aBuffer + " ) ";
590  }
591  }
592  break;
593 
594  case ATTR_PAGE_FOOTERSET:
595  {
596  OUString aBuffer;
597 
598  if( lcl_HFPresentation( rItem, GetMetric( nW ), ePresentationMetric, aBuffer, rIntl ) )
599  {
600  rText = ScResId(STR_FOOTER) + " ( " + aBuffer + " ) ";
601  }
602  }
603  break;
604 
605  default:
606  ePresentationRet = rItem.GetPresentation( SfxItemPresentation::Complete, GetMetric( nW ), ePresentationMetric, rText, rIntl );
607  break;
608  }
609 
610  return ePresentationRet;
611 }
612 
613 MapUnit ScDocumentPool::GetMetric( sal_uInt16 nWhich ) const
614 {
615  // Own attributes in Twips, everything else in 1/100 mm
616  if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
617  return MapUnit::MapTwip;
618  else
619  return MapUnit::Map100thMM;
620 }
621 
622 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERFIRST(183)
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
OString stripEnd(std::string_view rIn, char c)
static vcl::Font GetDefaultFont(DefaultFontType nType, LanguageType eLang, GetDefaultFontFlags nFlags, const OutputDevice *pOutDev=nullptr)
constexpr TypedWhichId< SvxEmphasisMarkItem > ATTR_FONT_EMPHASISMARK(121)
#define SID_SCATTR_PAGE_HEADERFIRST
Definition: scitems.hxx:225
virtual bool GetPresentation(const SfxPoolItem &rItem, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: docpool.cxx:486
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_DYNAMIC(165)
SfxItemPool(const SfxItemPool &rPool, bool bCloneStaticDefaults=false)
constexpr TypedWhichId< ScViewObjectModeItem > ATTR_PAGE_DRAWINGS(173)
constexpr TypedWhichId< SvxLanguageItem > ATTR_LANGUAGE_FORMAT(147)
constexpr TypedWhichId< SvxSizeItem > ATTR_PAGE_SIZE(161)
const OUString & GetFamilyName() const
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:89
void CellStyleCreated(std::u16string_view rName, const ScDocument &rDoc)
Definition: docpool.cxx:370
#define SID_SCATTR_PAGE_FIRSTPAGENO
Definition: scitems.hxx:220
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
static constexpr auto Items
constexpr TypedWhichId< SvxLanguageItem > ATTR_CJK_FONT_LANGUAGE(115)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_GRID(169)
static void GetSpellSettings(LanguageType &rDefLang, LanguageType &rCjkLang, LanguageType &rCtlLang, bool &rAutoSpell)
Definition: scmod.cxx:2175
std::string GetValue
const OUString & GetStyleName() const
void StyleDeleted(const ScStyleSheet *pStyle)
Definition: docpool.cxx:360
constexpr TypedWhichId< SfxBoolItem > ATTR_VERTICAL_ASIAN(137)
sal_uInt32 GetRefCount() const
#define SID_SCATTR_PAGE_FOOTERRIGHT
Definition: scitems.hxx:224
void SetMinDist(bool bNew)
constexpr TypedWhichId< ScViewObjectModeItem > ATTR_PAGE_CHARTS(171)
tools::Long const nLeftMargin
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERLEFT(178)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(175)
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
long Long
tools::Long GetRight() const
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr TypedWhichId< SvxLanguageItem > ATTR_FONT_LANGUAGE(110)
void SetTable(bool bNew)
static const AllSettings & GetSettings()
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr TypedWhichId< SvxRotateModeItem > ATTR_ROTATE_MODE(136)
void SetDefaults(std::vector< SfxPoolItem * > *pDefaults)
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
constexpr TypedWhichId< SvxCharReliefItem > ATTR_FONT_RELIEF(124)
#define SID_SCATTR_PAGE_HEADERRIGHT
Definition: scitems.hxx:223
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
constexpr sal_uInt16 ATTR_STARTINDEX(100)
void Delete()
virtual rtl::Reference< SfxItemPool > Clone() const override
Definition: docpool.cxx:389
constexpr TypedWhichId< ScViewObjectModeItem > ATTR_PAGE_OBJECTS(172)
#define SID_SCATTR_PAGE_SCALE
Definition: scitems.hxx:218
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
FontFamily GetFamilyType()
#define SID_SCATTR_PAGE_FOOTERLEFT
Definition: scitems.hxx:222
constexpr TypedWhichId< SvxScriptSpaceItem > ATTR_SCRIPTSPACE(126)
constexpr TypedWhichId< ScIndentItem > ATTR_INDENT(131)
#define SID_SCATTR_PAGE_TOPDOWN
Definition: scitems.hxx:217
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERRIGHT(180)
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
const SfxPoolItem * NextItem()
LINESTYLE_NONE
#define SID_SCATTR_PAGE_SCALETO
Definition: scitems.hxx:229
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_TOPDOWN(174)
TranslateId GetMetricId(MapUnit eUnit)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_VERCENTER(163)
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_HOR_JUSTIFY_METHOD(130)
constexpr TypedWhichId< ScShrinkToFitCell > ATTR_SHRINKTOFIT(140)
#define SID_SCATTR_PAGE_NULLVALS
Definition: scitems.hxx:228
void StyleToName()
Definition: patattr.cxx:1221
#define SID_SCATTR_PAGE_OBJECTS
Definition: scitems.hxx:215
sal_uInt64 mnCurrentMaxKey
Definition: docpool.hxx:32
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_SHARED_FIRST(167)
constexpr TypedWhichId< SvxPaperBinItem > ATTR_PAGE_PAPERBIN(160)
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERFIRST(182)
#define SID_SCATTR_PAGE_NOTES
Definition: scitems.hxx:211
#define SAL_N_ELEMENTS(arr)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALIDDATA(153)
sal_uInt16 GetPropRight() const
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
sal_Int32 nRef
FontPitch GetPitch()
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_HEADERSET(184)
virtual const SfxPoolItem & PutImpl(const SfxPoolItem &, sal_uInt16 nWhich=0, bool bPassingOwnership=false) override
Definition: docpool.cxx:340
virtual ~ScDocumentPool() override
Definition: docpool.cxx:329
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
#define SID_SCATTR_PAGE_HEADERS
Definition: scitems.hxx:213
sal_uInt16 GetPropLeft() const
const ScStyleSheet * GetStyleSheet() const
Definition: patattr.hxx:126
tools::Long GetLeft() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
OUString GetMetricText(tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper *pIntl)
WEIGHT_NORMAL
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_HORCENTER(162)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_FORMULAS(186)
#define LANGUAGE_DONTKNOW
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
friend friend class SfxItemSet
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
SVX_ROTATE_MODE_BOTTOM
ITALIC_NONE
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_NOTES(168)
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:548
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_FIRSTPAGENO(177)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_HEADERS(170)
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
constexpr TypedWhichId< SvxLRSpaceItem > ATTR_LRSPACE(157)
#define STRING_STANDARD
Definition: global.hxx:57
constexpr TypedWhichId< ScPageScaleToItem > ATTR_PAGE_SCALETO(188)
constexpr TypedWhichId< ScHyphenateCell > ATTR_HYPHENATE(125)
virtual MapUnit GetMetric(sal_uInt16 nWhich) const override
Definition: docpool.cxx:613
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
static SvxBrushItem * GetEmptyBrushItem()
Definition: global.hxx:594
constexpr TypedWhichId< SvxLanguageItem > ATTR_CTL_FONT_LANGUAGE(120)
constexpr TypedWhichId< SvxFrameDirectionItem > ATTR_WRITINGDIR(138)
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
#define SID_SCATTR_PAGE_HEADERLEFT
Definition: scitems.hxx:221
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERLEFT(179)
std::unique_ptr< char[]> aBuffer
constexpr sal_uInt16 ATTR_ENDINDEX(ATTR_HIDDEN)
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_VER_JUSTIFY_METHOD(133)
constexpr TypedWhichId< SvxPostureItem > ATTR_CTL_FONT_POSTURE(119)
#define SID_SCATTR_PAGE_FORMULAS
Definition: scitems.hxx:227
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:222
constexpr TypedWhichId< SvxOverlineItem > ATTR_FONT_OVERLINE(105)
std::vector< SfxPoolItem * > mvPoolDefaults
Definition: docpool.hxx:31
static void ClearRefCount(SfxPoolItem &rItem)
virtual const SfxPoolItem & PutImpl(const SfxPoolItem &, sal_uInt16 nWhich=0, bool bPassingOwnership=false)
#define SID_SCATTR_PAGE_DRAWINGS
Definition: scitems.hxx:216
void SetKey(sal_uInt64 nKey)
Definition: patattr.cxx:1357
constexpr TypedWhichId< SvXMLAttrContainerItem > ATTR_USERDEF(122)
constexpr TypedWhichId< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
SfxItemInfo const aItemInfos[]
Definition: docpool.cxx:91
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr TypedWhichId< SvxULSpaceItem > ATTR_ULSPACE(158)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
constexpr TypedWhichId< SvxPageItem > ATTR_PAGE(159)
tools::Long const nRightMargin
#define SID_SCATTR_PAGE_SCALETOPAGES
Definition: scitems.hxx:219
DefaultFontType
constexpr TypedWhichId< SfxStringItem > ATTR_HYPERLINK(155)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(176)
constexpr OUStringLiteral cpDelim
MapUnit
#define SID_SCATTR_PAGE_GRID
Definition: scitems.hxx:212
#define SID_SCATTR_PAGE_FOOTERFIRST
Definition: scitems.hxx:226
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERRIGHT(181)
constexpr TypedWhichId< SvxWordLineModeItem > ATTR_FONT_WORDLINE(123)
STRIKEOUT_NONE
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_ON(164)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_NULLVALS(187)
#define SID_SCATTR_PAGE_CHARTS
Definition: scitems.hxx:214
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_FOOTERSET(185)
constexpr TypedWhichId< SvxColorItem > ATTR_FONT_COLOR(109)
constexpr TypedWhichId< SvxWeightItem > ATTR_CJK_FONT_WEIGHT(113)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
static bool lcl_HFPresentation(const SfxPoolItem &rItem, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntl)
Definition: docpool.cxx:395
constexpr TypedWhichId< SvxHangingPunctuationItem > ATTR_HANGPUNCTUATION(127)
constexpr TypedWhichId< SfxBoolItem > ATTR_HIDDEN(189)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
const OUString * GetStyleName() const
Definition: patattr.cxx:1164
sal_uInt16 Which() const
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_SHARED(166)
rtl_TextEncoding GetCharSet() const
const SfxPoolItem * GetCurItem() const
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
void SetDist(bool bNew)
OUString EditResId(TranslateId aId)
constexpr TypedWhichId< SvxForbiddenRuleItem > ATTR_FORBIDDEN_RULES(128)