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