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 SetSecondaryPool(nullptr);
331
332 for ( sal_uInt16 i=0; i < ATTR_ENDINDEX-ATTR_STARTINDEX+1; i++ )
333 {
335 delete mvPoolDefaults[i];
336 }
337}
338
339const SfxPoolItem& ScDocumentPool::PutImpl( const SfxPoolItem& rItem, sal_uInt16 nWhich, bool bPassingOwnership )
340{
341 if ( rItem.Which() != ATTR_PATTERN ) // Only Pattern is special
342 return SfxItemPool::PutImpl( rItem, nWhich, bPassingOwnership );
343
344 // Don't copy the default pattern of this Pool
346 return rItem;
347
348 // Else Put must always happen, because it could be another Pool
349 const SfxPoolItem& rNew = SfxItemPool::PutImpl( rItem, nWhich, bPassingOwnership );
350 sal_uInt32 nRef = rNew.GetRefCount();
351 if (nRef == 1)
352 {
354 const_cast<ScPatternAttr&>(static_cast<const ScPatternAttr&>(rNew)).SetKey(mnCurrentMaxKey);
355 }
356 return rNew;
357}
358
360{
361 for (const SfxPoolItem* pItem : GetItemSurrogates( ATTR_PATTERN ))
362 {
363 ScPatternAttr* pPattern = const_cast<ScPatternAttr*>(dynamic_cast<const ScPatternAttr*>(pItem));
364 if ( pPattern && pPattern->GetStyleSheet() == pStyle )
365 pPattern->StyleToName();
366 }
367}
368
369void ScDocumentPool::CellStyleCreated( std::u16string_view rName, const ScDocument& rDoc )
370{
371 // If a style was created, don't keep any pattern with its name string in the pool,
372 // because it would compare equal to a pattern with a pointer to the new style.
373 // Calling StyleSheetChanged isn't enough because the pool may still contain items
374 // for undo or clipboard content.
375
376 for (const SfxPoolItem* pItem : GetItemSurrogates( ATTR_PATTERN ))
377 {
378 auto pPattern = const_cast<ScPatternAttr*>(dynamic_cast<const ScPatternAttr*>(pItem));
379 if ( pPattern && pPattern->GetStyleSheet() == nullptr )
380 {
381 const OUString* pStyleName = pPattern->GetStyleName();
382 if ( pStyleName && *pStyleName == rName )
383 pPattern->UpdateStyleSheet(rDoc); // find and store style pointer
384 }
385 }
386}
387
389{
390 return new SfxItemPool (*this, true);
391}
392
394(
395 const SfxPoolItem& rItem,
396 MapUnit eCoreMetric,
397 MapUnit ePresentationMetric,
398 OUString& rText,
399 const IntlWrapper& rIntl
400)
401{
402 const SfxItemSet& rSet = static_cast<const SfxSetItem&>(rItem).GetItemSet();
403
404 if ( const SfxBoolItem* pItem = rSet.GetItemIfSet(ATTR_PAGE_ON,false) )
405 {
406 if( !pItem->GetValue() )
407 return false;
408 }
409
410 SfxItemIter aIter( rSet );
411
412 for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
413 {
414 sal_uInt16 nWhich = pItem->Which();
415
416 OUString aText;
417
418 switch( nWhich )
419 {
420 case ATTR_PAGE_ON:
422 case ATTR_PAGE_SHARED:
424 break;
425
426 case ATTR_LRSPACE:
427 {
428 const SvxLRSpaceItem& rLRItem = static_cast<const SvxLRSpaceItem&>(*pItem);
429 sal_uInt16 nPropLeftMargin = rLRItem.GetPropLeft();
430 sal_uInt16 nPropRightMargin = rLRItem.GetPropRight();
431 sal_uInt16 nLeftMargin, nRightMargin;
432 tools::Long nTmp;
433 nTmp = rLRItem.GetLeft();
434 nLeftMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
435 nTmp = rLRItem.GetRight();
436 nRightMargin = nTmp < 0 ? 0 : sal_uInt16(nTmp);
437
438 aText = EditResId(RID_SVXITEMS_LRSPACE_LEFT);
439 if ( 100 != nPropLeftMargin )
440 {
441 aText += unicode::formatPercent(nPropLeftMargin,
442 Application::GetSettings().GetUILanguageTag());
443 }
444 else
445 {
446 aText += GetMetricText( static_cast<tools::Long>(nLeftMargin),
447 eCoreMetric, ePresentationMetric, &rIntl ) +
448 " " + EditResId(GetMetricId(ePresentationMetric));
449 }
450 aText += cpDelim +
451 // We don't have a nPropFirstLineOffset
452 EditResId(RID_SVXITEMS_LRSPACE_RIGHT);
453 if ( 100 != nPropRightMargin )
454 {
455 aText += unicode::formatPercent(nPropLeftMargin,
456 Application::GetSettings().GetUILanguageTag());
457 }
458 else
459 {
460 aText += GetMetricText( static_cast<tools::Long>(nRightMargin),
461 eCoreMetric, ePresentationMetric, &rIntl ) +
462 " " + EditResId(GetMetricId(ePresentationMetric));
463 }
464 }
465 break;
466
467 default:
468 pItem->GetPresentation( SfxItemPresentation::Complete, eCoreMetric, ePresentationMetric, aText, rIntl );
469
470 }
471
472 if ( aText.getLength() )
473 {
474 rText += aText + " + ";
475 }
476 }
477
478 rText = comphelper::string::stripEnd(rText, ' ');
479 rText = comphelper::string::stripEnd(rText, '+');
480 rText = comphelper::string::stripEnd(rText, ' ');
481 return true;
482}
483
485 const SfxPoolItem& rItem,
486 MapUnit ePresentationMetric,
487 OUString& rText,
488 const IntlWrapper& rIntl ) const
489{
490 sal_uInt16 nW = rItem.Which();
491 OUString aStrYes ( ScResId(STR_YES) );
492 OUString aStrNo ( ScResId(STR_NO) );
493 OUString aStrSep(": ");
494
495 bool ePresentationRet = true;
496 switch( nW )
497 {
499 rText = ScResId(STR_SCATTR_PAGE_PRINTDIR) + aStrSep;
500 rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ?
501 ScResId(STR_SCATTR_PAGE_TOPDOWN) :
502 ScResId(STR_SCATTR_PAGE_LEFTRIGHT) ;
503 break;
504
506 rText = ScResId(STR_SCATTR_PAGE_HEADERS) + aStrSep;
507 rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
508 break;
509
511 rText = ScResId(STR_SCATTR_PAGE_NULLVALS) + aStrSep;
512 rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
513 break;
514
516 rText = ScResId(STR_SCATTR_PAGE_FORMULAS) + aStrSep;
517 rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
518 break;
519
520 case ATTR_PAGE_NOTES:
521 rText = ScResId(STR_SCATTR_PAGE_NOTES) + aStrSep;
522 rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
523 break;
524
525 case ATTR_PAGE_GRID:
526 rText = ScResId(STR_SCATTR_PAGE_GRID) + aStrSep;
527 rText += static_cast<const SfxBoolItem&>(rItem).GetValue() ? aStrYes : aStrNo ;
528 break;
529
531 {
532 sal_uInt16 nPagNo = static_cast<const SfxUInt16Item&>(rItem).GetValue();
533
534 if( nPagNo )
535 {
536 rText = ScResId( STR_SCATTR_PAGE_SCALETOPAGES ) + aStrSep;
537 OUString aPages(ScResId(STR_SCATTR_PAGE_SCALE_PAGES, nPagNo));
538 aPages = aPages.replaceFirst( "%1", OUString::number( nPagNo ) );
539 rText += aPages;
540 }
541 else
542 {
543 ePresentationRet = false;
544 }
545 }
546 break;
547
549 {
550 sal_uInt16 nPagNo = static_cast<const SfxUInt16Item&>(rItem).GetValue();
551
552 if( nPagNo )
553 {
554 rText = ScResId(STR_SCATTR_PAGE_FIRSTPAGENO) + aStrSep;
555 rText += OUString::number( nPagNo );
556 }
557 else
558 {
559 ePresentationRet = false;
560 }
561 }
562 break;
563
564 case ATTR_PAGE_SCALE:
565 {
566 sal_uInt16 nPercent = static_cast<const SfxUInt16Item &>(rItem).GetValue();
567
568 if( nPercent )
569 {
570 rText = ScResId(STR_SCATTR_PAGE_SCALE) + aStrSep;
571 rText += unicode::formatPercent(nPercent,
572 Application::GetSettings().GetUILanguageTag());
573 }
574 else
575 {
576 ePresentationRet = false;
577 }
578 }
579 break;
580
582 {
583 OUString aBuffer;
584
585 if( lcl_HFPresentation( rItem, GetMetric( nW ), ePresentationMetric, aBuffer, rIntl ) )
586 {
587 rText = ScResId(STR_HEADER) + " ( " + aBuffer + " ) ";
588 }
589 }
590 break;
591
593 {
594 OUString aBuffer;
595
596 if( lcl_HFPresentation( rItem, GetMetric( nW ), ePresentationMetric, aBuffer, rIntl ) )
597 {
598 rText = ScResId(STR_FOOTER) + " ( " + aBuffer + " ) ";
599 }
600 }
601 break;
602
603 default:
604 ePresentationRet = rItem.GetPresentation( SfxItemPresentation::Complete, GetMetric( nW ), ePresentationMetric, rText, rIntl );
605 break;
606 }
607
608 return ePresentationRet;
609}
610
611MapUnit ScDocumentPool::GetMetric( sal_uInt16 nWhich ) const
612{
613 // Own attributes in Twips, everything else in 1/100 mm
614 if ( nWhich >= ATTR_STARTINDEX && nWhich <= ATTR_ENDINDEX )
615 return MapUnit::MapTwip;
616 else
617 return MapUnit::Map100thMM;
618}
619
620/* 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:611
void StyleDeleted(const ScStyleSheet *pStyle)
Definition: docpool.cxx:359
virtual bool GetPresentation(const SfxPoolItem &rItem, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: docpool.cxx:484
virtual rtl::Reference< SfxItemPool > Clone() const override
Definition: docpool.cxx:388
virtual const SfxPoolItem & PutImpl(const SfxPoolItem &, sal_uInt16 nWhich=0, bool bPassingOwnership=false) override
Definition: docpool.cxx:339
void CellStyleCreated(std::u16string_view rName, const ScDocument &rDoc)
Definition: docpool.cxx:369
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:606
static SC_DLLPUBLIC LanguageType eLnge
Definition: global.hxx:560
static void GetSpellSettings(LanguageType &rDefLang, LanguageType &rCjkLang, LanguageType &rCtlLang, bool &rAutoSpell)
Definition: scmod.cxx:2255
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:230
void StyleToName()
Definition: patattr.cxx:1362
const ScStyleSheet * GetStyleSheet() const
Definition: patattr.hxx:165
const OUString * GetStyleName() const
Definition: patattr.cxx:1301
void SetKey(sal_uInt64 nKey)
Definition: patattr.cxx:1497
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)
void SetSecondaryPool(SfxItemPool *pPool)
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:394
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