LibreOffice Module sc (master) 1
patattr.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 <memory>
21#include <utility>
22#include <scitems.hxx>
24#include <editeng/boxitem.hxx>
25#include <editeng/lineitem.hxx>
26#include <editeng/brushitem.hxx>
29#include <svtools/colorcfg.hxx>
30#include <editeng/colritem.hxx>
32#include <editeng/eeitem.hxx>
34#include <editeng/fhgtitem.hxx>
35#include <editeng/fontitem.hxx>
38#include <editeng/langitem.hxx>
39#include <editeng/postitem.hxx>
40#include <svx/rotmodit.hxx>
42#include <editeng/shaditem.hxx>
43#include <editeng/shdditem.hxx>
44#include <editeng/udlnitem.hxx>
45#include <editeng/wghtitem.hxx>
46#include <editeng/wrlmitem.hxx>
48#include <svl/intitem.hxx>
49#include <svl/numformat.hxx>
50#include <svl/zforlist.hxx>
51#include <vcl/outdev.hxx>
52#include <tools/fract.hxx>
54#include <osl/diagnose.h>
55
56#include <attrib.hxx>
57#include <patattr.hxx>
58#include <docpool.hxx>
59#include <stlsheet.hxx>
60#include <stlpool.hxx>
61#include <document.hxx>
62#include <globstr.hrc>
63#include <scresid.hxx>
64#include <validat.hxx>
65#include <scmod.hxx>
66#include <fillinfo.hxx>
67#include <boost/functional/hash.hpp>
68
69ScPatternAttr::ScPatternAttr( SfxItemSet&& pItemSet, const OUString& rStyleName )
70 : SfxSetItem ( ATTR_PATTERN, std::move(pItemSet) ),
71 pName ( rStyleName ),
72 pStyle ( nullptr ),
73 mnKey(0)
74{
75}
76
78 : SfxSetItem ( ATTR_PATTERN, std::move(pItemSet) ),
79 pStyle ( nullptr ),
80 mnKey(0)
81{
82}
83
86 pStyle ( nullptr ),
87 mnKey(0)
88{
89}
90
92 : SfxSetItem ( rPatternAttr ),
93 pName ( rPatternAttr.pName ),
94 pStyle ( rPatternAttr.pStyle ),
95 mnKey(rPatternAttr.mnKey)
96{
97}
98
100{
101 ScPatternAttr* pPattern = new ScPatternAttr( GetItemSet().CloneAsValue(true, pPool) );
102
103 pPattern->pStyle = pStyle;
104 pPattern->pName = pName;
105
106 return pPattern;
107}
108
109static bool StrCmp( const OUString* pStr1, const OUString* pStr2 )
110{
111 if (pStr1 == pStr2)
112 return true;
113 if (pStr1 && !pStr2)
114 return false;
115 if (!pStr1 && pStr2)
116 return false;
117 return *pStr1 == *pStr2;
118}
119
121
122std::optional<bool> ScPatternAttr::FastEqualPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )
123{
124 // #i62090# The SfxItemSet in the SfxSetItem base class always has the same ranges
125 // (single range from ATTR_PATTERN_START to ATTR_PATTERN_END), and the items are pooled,
126 // so it's enough to compare just the pointers (Count just because it's even faster).
127
128 if ( rSet1.Count() != rSet2.Count() )
129 return { false };
130
131 // Actually test_tdf133629 from UITest_calc_tests9 somehow manages to have
132 // a different range (and I don't understand enough why), so better be safe and compare fully.
133 if( rSet1.TotalCount() != compareSize || rSet2.TotalCount() != compareSize )
134 return std::nullopt;
135
136 SfxPoolItem const ** pItems1 = rSet1.GetItems_Impl(); // inline method of SfxItemSet
137 SfxPoolItem const ** pItems2 = rSet2.GetItems_Impl();
138
139 return { memcmp( pItems1, pItems2, compareSize * sizeof(pItems1[0]) ) == 0 };
140}
141
142static bool EqualPatternSets( const SfxItemSet& rSet1, const SfxItemSet& rSet2 )
143{
144 std::optional<bool> equal = ScPatternAttr::FastEqualPatternSets( rSet1, rSet2 );
145 if(equal.has_value())
146 return *equal;
147 return rSet1 == rSet2;
148}
149
150bool ScPatternAttr::operator==( const SfxPoolItem& rCmp ) const
151{
152 // #i62090# Use quick comparison between ScPatternAttr's ItemSets
153
154 if (!SfxPoolItem::operator==(rCmp) )
155 return false;
156 if (!mxHashCode)
157 CalcHashCode();
158 auto const & rOther = static_cast<const ScPatternAttr&>(rCmp);
159 if (!rOther.mxHashCode)
160 rOther.CalcHashCode();
161 if (*mxHashCode != *rOther.mxHashCode)
162 return false;
163 return EqualPatternSets( GetItemSet(), rOther.GetItemSet() ) &&
164 StrCmp( GetStyleName(), rOther.GetStyleName() );
165}
166
168{
169 if( !mxHashCode )
170 CalcHashCode();
171 if( *mxHashCode != 0 )
172 {
173 for( auto it = begin; it != end; ++it)
174 {
175 const ScPatternAttr* other = static_cast<const ScPatternAttr*>(*it);
176 if( !other->mxHashCode )
177 other->CalcHashCode();
178 if (*mxHashCode == *other->mxHashCode
179 && EqualPatternSets( GetItemSet(), other->GetItemSet())
180 && StrCmp( GetStyleName(), other->GetStyleName()))
181 {
182 return it;
183 }
184 }
185 }
186 return end;
187}
188
190{
191 SvxCellOrientation eOrient = SvxCellOrientation::Standard;
192
193 if( GetItem( ATTR_STACKED, rItemSet, pCondSet ).GetValue() )
194 {
195 eOrient = SvxCellOrientation::Stacked;
196 }
197 else
198 {
199 Degree100 nAngle = GetItem( ATTR_ROTATE_VALUE, rItemSet, pCondSet ).GetValue();
200 if( nAngle == 9000_deg100 )
201 eOrient = SvxCellOrientation::BottomUp;
202 else if( nAngle == 27000_deg100 )
203 eOrient = SvxCellOrientation::TopBottom;
204 }
205
206 return eOrient;
207}
208
210{
211 return GetCellOrientation( GetItemSet(), pCondSet );
212}
213
214namespace {
215
216void getFontIDsByScriptType(SvtScriptType nScript,
222{
223 if ( nScript == SvtScriptType::ASIAN )
224 {
225 nFontId = ATTR_CJK_FONT;
226 nHeightId = ATTR_CJK_FONT_HEIGHT;
227 nWeightId = ATTR_CJK_FONT_WEIGHT;
228 nPostureId = ATTR_CJK_FONT_POSTURE;
229 nLangId = ATTR_CJK_FONT_LANGUAGE;
230 }
231 else if ( nScript == SvtScriptType::COMPLEX )
232 {
233 nFontId = ATTR_CTL_FONT;
234 nHeightId = ATTR_CTL_FONT_HEIGHT;
235 nWeightId = ATTR_CTL_FONT_WEIGHT;
236 nPostureId = ATTR_CTL_FONT_POSTURE;
237 nLangId = ATTR_CTL_FONT_LANGUAGE;
238 }
239 else
240 {
241 nFontId = ATTR_FONT;
242 nHeightId = ATTR_FONT_HEIGHT;
243 nWeightId = ATTR_FONT_WEIGHT;
244 nPostureId = ATTR_FONT_POSTURE;
245 nLangId = ATTR_FONT_LANGUAGE;
246 }
247}
248
249}
250
252 vcl::Font& rFont, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode,
253 const OutputDevice* pOutDev, const Fraction* pScale,
254 const SfxItemSet* pCondSet, SvtScriptType nScript,
255 const Color* pBackConfigColor, const Color* pTextConfigColor )
256{
257 // Read items
258
259 const SvxFontItem* pFontAttr;
260 sal_uInt32 nFontHeight;
261 FontWeight eWeight;
262 FontItalic eItalic;
263 FontLineStyle eUnder;
264 FontLineStyle eOver;
265 bool bWordLine;
266 FontStrikeout eStrike;
267 bool bOutline;
268 bool bShadow;
269 FontEmphasisMark eEmphasis;
270 FontRelief eRelief;
271 Color aColor;
272 LanguageType eLang;
273
274 TypedWhichId<SvxFontItem> nFontId(0);
276 TypedWhichId<SvxWeightItem> nWeightId(0);
277 TypedWhichId<SvxPostureItem> nPostureId(0);
279 getFontIDsByScriptType(nScript, nFontId, nHeightId, nWeightId, nPostureId, nLangId);
280
281 if ( pCondSet )
282 {
283 pFontAttr = pCondSet->GetItemIfSet( nFontId );
284 if ( !pFontAttr )
285 pFontAttr = &rItemSet.Get( nFontId );
286
287 const SvxFontHeightItem* pFontHeightItem = pCondSet->GetItemIfSet( nHeightId );
288 if ( !pFontHeightItem )
289 pFontHeightItem = &rItemSet.Get( nHeightId );
290 nFontHeight = pFontHeightItem->GetHeight();
291
292 const SvxWeightItem* pFontHWeightItem = pCondSet->GetItemIfSet( nWeightId );
293 if ( !pFontHWeightItem )
294 pFontHWeightItem = &rItemSet.Get( nWeightId );
295 eWeight = pFontHWeightItem->GetValue();
296
297 const SvxPostureItem* pPostureItem = pCondSet->GetItemIfSet( nPostureId );
298 if ( !pPostureItem )
299 pPostureItem = &rItemSet.Get( nPostureId );
300 eItalic = pPostureItem->GetValue();
301
302 const SvxUnderlineItem* pUnderlineItem = pCondSet->GetItemIfSet( ATTR_FONT_UNDERLINE );
303 if ( !pUnderlineItem )
304 pUnderlineItem = &rItemSet.Get( ATTR_FONT_UNDERLINE );
305 eUnder = pUnderlineItem->GetValue();
306
307 const SvxOverlineItem* pOverlineItem = pCondSet->GetItemIfSet( ATTR_FONT_OVERLINE );
308 if ( !pOverlineItem )
309 pOverlineItem = &rItemSet.Get( ATTR_FONT_OVERLINE );
310 eOver = pOverlineItem->GetValue();
311
312 const SvxWordLineModeItem* pWordlineItem = pCondSet->GetItemIfSet( ATTR_FONT_WORDLINE );
313 if ( !pWordlineItem )
314 pWordlineItem = &rItemSet.Get( ATTR_FONT_WORDLINE );
315 bWordLine = pWordlineItem->GetValue();
316
317 const SvxCrossedOutItem* pCrossedOutItem = pCondSet->GetItemIfSet( ATTR_FONT_CROSSEDOUT );
318 if ( !pCrossedOutItem )
319 pCrossedOutItem = &rItemSet.Get( ATTR_FONT_CROSSEDOUT );
320 eStrike = pCrossedOutItem->GetValue();
321
322 const SvxContourItem* pContourItem = pCondSet->GetItemIfSet( ATTR_FONT_CONTOUR );
323 if ( !pContourItem )
324 pContourItem = &rItemSet.Get( ATTR_FONT_CONTOUR );
325 bOutline = pContourItem->GetValue();
326
327 const SvxShadowedItem* pShadowedItem = pCondSet->GetItemIfSet( ATTR_FONT_SHADOWED );
328 if ( !pShadowedItem )
329 pShadowedItem = &rItemSet.Get( ATTR_FONT_SHADOWED );
330 bShadow = pShadowedItem->GetValue();
331
332 const SvxEmphasisMarkItem* pEmphasisMarkItem = pCondSet->GetItemIfSet( ATTR_FONT_EMPHASISMARK );
333 if ( !pEmphasisMarkItem )
334 pEmphasisMarkItem = &rItemSet.Get( ATTR_FONT_EMPHASISMARK );
335 eEmphasis = pEmphasisMarkItem->GetEmphasisMark();
336
337 const SvxCharReliefItem* pCharReliefItem = pCondSet->GetItemIfSet( ATTR_FONT_RELIEF );
338 if ( !pCharReliefItem )
339 pCharReliefItem = &rItemSet.Get( ATTR_FONT_RELIEF );
340 eRelief = pCharReliefItem->GetValue();
341
342 const SvxColorItem* pColorItem = pCondSet->GetItemIfSet( ATTR_FONT_COLOR );
343 if ( !pColorItem )
344 pColorItem = &rItemSet.Get( ATTR_FONT_COLOR );
345 aColor = pColorItem->GetValue();
346
347 const SvxLanguageItem* pLanguageItem = pCondSet->GetItemIfSet( nLangId );
348 if ( !pLanguageItem )
349 pLanguageItem = &rItemSet.Get( nLangId );
350 eLang = pLanguageItem->GetLanguage();
351 }
352 else // Everything from rItemSet
353 {
354 pFontAttr = &rItemSet.Get( nFontId );
355 nFontHeight = rItemSet.Get( nHeightId ).GetHeight();
356 eWeight = rItemSet.Get( nWeightId ).GetValue();
357 eItalic = rItemSet.Get( nPostureId ).GetValue();
358 eUnder = rItemSet.Get( ATTR_FONT_UNDERLINE ).GetValue();
359 eOver = rItemSet.Get( ATTR_FONT_OVERLINE ).GetValue();
360 bWordLine = rItemSet.Get( ATTR_FONT_WORDLINE ).GetValue();
361 eStrike = rItemSet.Get( ATTR_FONT_CROSSEDOUT ).GetValue();
362 bOutline = rItemSet.Get( ATTR_FONT_CONTOUR ).GetValue();
363 bShadow = rItemSet.Get( ATTR_FONT_SHADOWED ).GetValue();
364 eEmphasis = rItemSet.Get( ATTR_FONT_EMPHASISMARK ).GetEmphasisMark();
365 eRelief = rItemSet.Get( ATTR_FONT_RELIEF ).GetValue();
366 aColor = rItemSet.Get( ATTR_FONT_COLOR ).GetValue();
367 // for graphite language features
368 eLang = rItemSet.Get( nLangId ).GetLanguage();
369 }
370 OSL_ENSURE(pFontAttr,"Oops?");
371
372 // Evaluate
373
374 // FontItem:
375
376 if (rFont.GetFamilyName() != pFontAttr->GetFamilyName())
377 rFont.SetFamilyName( pFontAttr->GetFamilyName() );
378 if (rFont.GetStyleName() != pFontAttr->GetStyleName())
379 rFont.SetStyleName( pFontAttr->GetStyleName() );
380
381 rFont.SetFamily( pFontAttr->GetFamily() );
382 rFont.SetCharSet( pFontAttr->GetCharSet() );
383 rFont.SetPitch( pFontAttr->GetPitch() );
384
385 rFont.SetLanguage(eLang);
386
387 // Size
388
389 if ( pOutDev != nullptr )
390 {
391 Size aEffSize;
392 Fraction aFraction( 1,1 );
393 if (pScale)
394 aFraction = *pScale;
395 Size aSize( 0, static_cast<tools::Long>(nFontHeight) );
396 MapMode aDestMode = pOutDev->GetMapMode();
397 MapMode aSrcMode( MapUnit::MapTwip, Point(), aFraction, aFraction );
398 if (aDestMode.GetMapUnit() == MapUnit::MapPixel && pOutDev->GetDPIX() > 0)
399 aEffSize = pOutDev->LogicToPixel( aSize, aSrcMode );
400 else
401 {
402 Fraction aFractOne(1,1);
403 aDestMode.SetScaleX( aFractOne );
404 aDestMode.SetScaleY( aFractOne );
405 aEffSize = OutputDevice::LogicToLogic( aSize, aSrcMode, aDestMode );
406 }
407 rFont.SetFontSize( aEffSize );
408 }
409 else /* if pOutDev != NULL */
410 {
411 rFont.SetFontSize( Size( 0, static_cast<tools::Long>(nFontHeight) ) );
412 }
413
414 // determine effective font color
415
416 if ( ( aColor == COL_AUTO && eAutoMode != SC_AUTOCOL_RAW ) ||
417 eAutoMode == SC_AUTOCOL_IGNOREFONT || eAutoMode == SC_AUTOCOL_IGNOREALL )
418 {
419 if ( eAutoMode == SC_AUTOCOL_BLACK )
420 aColor = COL_BLACK;
421 else
422 {
423 // get background color from conditional or own set
424 Color aBackColor;
425 if ( pCondSet )
426 {
427 const SvxBrushItem* pItem = pCondSet->GetItemIfSet( ATTR_BACKGROUND );
428 if ( !pItem )
429 pItem = &rItemSet.Get( ATTR_BACKGROUND );
430 aBackColor = pItem->GetColor();
431 }
432 else
433 aBackColor = rItemSet.Get( ATTR_BACKGROUND ).GetColor();
434
435 // if background color attribute is transparent, use window color for brightness comparisons
436 if ( aBackColor == COL_TRANSPARENT ||
437 eAutoMode == SC_AUTOCOL_IGNOREBACK || eAutoMode == SC_AUTOCOL_IGNOREALL )
438 {
439 if ( eAutoMode == SC_AUTOCOL_PRINT )
440 aBackColor = COL_WHITE;
441 else if ( pBackConfigColor )
442 {
443 // pBackConfigColor can be used to avoid repeated lookup of the configured color
444 aBackColor = *pBackConfigColor;
445 }
446 else
447 aBackColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
448 }
449
450 // get system text color for comparison
451 Color aSysTextColor;
452 if ( eAutoMode == SC_AUTOCOL_PRINT )
453 aSysTextColor = COL_BLACK;
454 else if ( pTextConfigColor )
455 {
456 // pTextConfigColor can be used to avoid repeated lookup of the configured color
457 aSysTextColor = *pTextConfigColor;
458 }
459 else
460 aSysTextColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor;
461
462 // select the resulting color
463 if ( aBackColor.IsDark() && aSysTextColor.IsDark() )
464 {
465 // use white instead of dark on dark
466 aColor = COL_WHITE;
467 }
468 else if ( aBackColor.IsBright() && aSysTextColor.IsBright() )
469 {
470 // use black instead of bright on bright
471 aColor = COL_BLACK;
472 }
473 else
474 {
475 // use aSysTextColor (black for SC_AUTOCOL_PRINT, from style settings otherwise)
476 aColor = aSysTextColor;
477 }
478 }
479 }
480
481 // set font effects
482 rFont.SetWeight( eWeight );
483 rFont.SetItalic( eItalic );
484 rFont.SetUnderline( eUnder );
485 rFont.SetOverline( eOver );
486 rFont.SetWordLineMode( bWordLine );
487 rFont.SetStrikeout( eStrike );
488 rFont.SetOutline( bOutline );
489 rFont.SetShadow( bShadow );
490 rFont.SetEmphasisMark( eEmphasis );
491 rFont.SetRelief( eRelief );
492 rFont.SetColor( aColor );
493 rFont.SetTransparent( true );
494}
495
497 vcl::Font& rFont, ScAutoFontColorMode eAutoMode,
498 const OutputDevice* pOutDev, const Fraction* pScale,
499 const SfxItemSet* pCondSet, SvtScriptType nScript,
500 const Color* pBackConfigColor, const Color* pTextConfigColor ) const
501{
502 GetFont( rFont, GetItemSet(), eAutoMode, pOutDev, pScale, pCondSet, nScript, pBackConfigColor, pTextConfigColor );
503}
504
506{
507 TypedWhichId<SvxFontItem> nFontId(0);
509 TypedWhichId<SvxWeightItem> nWeightId(0);
510 TypedWhichId<SvxPostureItem> nPostureId(0);
512 getFontIDsByScriptType(nScript, nFontId, nHeightId, nWeightId, nPostureId, nLangId);
513
514 ScDxfFont aReturn;
515
516 if ( const SvxFontItem* pItem = rItemSet.GetItemIfSet( nFontId ) )
517 {
518 aReturn.pFontAttr = pItem;
519 }
520
521 if ( const SvxFontHeightItem* pItem = rItemSet.GetItemIfSet( nHeightId ) )
522 {
523 aReturn.nFontHeight = pItem->GetHeight();
524 }
525
526 if ( const SvxWeightItem* pItem = rItemSet.GetItemIfSet( nWeightId ) )
527 {
528 aReturn.eWeight = pItem->GetValue();
529 }
530
531 if ( const SvxPostureItem* pItem = rItemSet.GetItemIfSet( nPostureId ) )
532 {
533 aReturn.eItalic = pItem->GetValue();
534 }
535
536 if ( const SvxUnderlineItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_UNDERLINE ) )
537 {
538 pItem = &rItemSet.Get( ATTR_FONT_UNDERLINE );
539 aReturn.eUnder = pItem->GetValue();
540 }
541
542 if ( const SvxOverlineItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_OVERLINE ) )
543 {
544 aReturn.eOver = pItem->GetValue();
545 }
546
547 if ( const SvxWordLineModeItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_WORDLINE ) )
548 {
549 aReturn.bWordLine = pItem->GetValue();
550 }
551
552 if ( const SvxCrossedOutItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_CROSSEDOUT ) )
553 {
554 pItem = &rItemSet.Get( ATTR_FONT_CROSSEDOUT );
555 aReturn.eStrike = pItem->GetValue();
556 }
557
558 if ( const SvxContourItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_CONTOUR ) )
559 {
560 aReturn.bOutline = pItem->GetValue();
561 }
562
563 if ( const SvxShadowedItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_SHADOWED ) )
564 {
565 pItem = &rItemSet.Get( ATTR_FONT_SHADOWED );
566 aReturn.bShadow = pItem->GetValue();
567 }
568
569 if ( const SvxEmphasisMarkItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_EMPHASISMARK ) )
570 {
571 aReturn.eEmphasis = pItem->GetEmphasisMark();
572 }
573
574 if ( const SvxCharReliefItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_RELIEF ) )
575 {
576 aReturn.eRelief = pItem->GetValue();
577 }
578
579 if ( const SvxColorItem* pItem = rItemSet.GetItemIfSet( ATTR_FONT_COLOR ) )
580 {
581 aReturn.aColor = pItem->GetValue();
582 }
583
584 if ( const SvxLanguageItem* pItem = rItemSet.GetItemIfSet( nLangId ) )
585 {
586 aReturn.eLang = pItem->GetLanguage();
587 }
588
589 return aReturn;
590}
591
592template <class T>
593static void lcl_populate( std::unique_ptr<T>& rxItem, TypedWhichId<T> nWhich, const SfxItemSet& rSrcSet, const SfxItemSet* pCondSet )
594{
595 const T* pItem = pCondSet->GetItemIfSet( nWhich );
596 if ( !pItem )
597 pItem = &rSrcSet.Get( nWhich );
598 rxItem.reset(pItem->Clone());
599}
600
601void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& rSrcSet, const SfxItemSet* pCondSet )
602{
603 // Read Items
604
605 std::unique_ptr<SvxColorItem> aColorItem(std::make_unique<SvxColorItem>(EE_CHAR_COLOR)); // use item as-is
606 std::unique_ptr<SvxFontItem> aFontItem(std::make_unique<SvxFontItem>(EE_CHAR_FONTINFO)); // use item as-is
607 std::unique_ptr<SvxFontItem> aCjkFontItem(std::make_unique<SvxFontItem>(EE_CHAR_FONTINFO_CJK)); // use item as-is
608 std::unique_ptr<SvxFontItem> aCtlFontItem(std::make_unique<SvxFontItem>(EE_CHAR_FONTINFO_CTL)); // use item as-is
609 tools::Long nTHeight, nCjkTHeight, nCtlTHeight; // Twips
610 FontWeight eWeight, eCjkWeight, eCtlWeight;
611 std::unique_ptr<SvxUnderlineItem> aUnderlineItem(std::make_unique<SvxUnderlineItem>(LINESTYLE_NONE, EE_CHAR_UNDERLINE));
612 std::unique_ptr<SvxOverlineItem> aOverlineItem(std::make_unique<SvxOverlineItem>(LINESTYLE_NONE, EE_CHAR_OVERLINE));
613 bool bWordLine;
614 FontStrikeout eStrike;
615 FontItalic eItalic, eCjkItalic, eCtlItalic;
616 bool bOutline;
617 bool bShadow;
618 bool bForbidden;
619 FontEmphasisMark eEmphasis;
620 FontRelief eRelief;
621 LanguageType eLang, eCjkLang, eCtlLang;
622 bool bHyphenate;
623 SvxFrameDirection eDirection;
624
625 //TODO: additional parameter to control if language is needed?
626
627 if ( pCondSet )
628 {
629 lcl_populate(aColorItem, ATTR_FONT_COLOR, rSrcSet, pCondSet);
630 lcl_populate(aFontItem, ATTR_FONT, rSrcSet, pCondSet);
631 lcl_populate(aCjkFontItem, ATTR_CJK_FONT, rSrcSet, pCondSet);
632 lcl_populate(aCtlFontItem, ATTR_CTL_FONT, rSrcSet, pCondSet);
633
634 const SvxFontHeightItem* pFontHeightItem = pCondSet->GetItemIfSet( ATTR_FONT_HEIGHT );
635 if (!pFontHeightItem)
636 pFontHeightItem = &rSrcSet.Get( ATTR_FONT_HEIGHT );
637 nTHeight = pFontHeightItem->GetHeight();
638 pFontHeightItem = pCondSet->GetItemIfSet( ATTR_CJK_FONT_HEIGHT );
639 if ( !pFontHeightItem )
640 pFontHeightItem = &rSrcSet.Get( ATTR_CJK_FONT_HEIGHT );
641 nCjkTHeight = pFontHeightItem->GetHeight();
642 pFontHeightItem = pCondSet->GetItemIfSet( ATTR_CTL_FONT_HEIGHT );
643 if ( !pFontHeightItem )
644 pFontHeightItem = &rSrcSet.Get( ATTR_CTL_FONT_HEIGHT );
645 nCtlTHeight = pFontHeightItem->GetHeight();
646
647 const SvxWeightItem* pWeightItem = pCondSet->GetItemIfSet( ATTR_FONT_WEIGHT );
648 if ( !pWeightItem )
649 pWeightItem = &rSrcSet.Get( ATTR_FONT_WEIGHT );
650 eWeight = pWeightItem->GetValue();
651 pWeightItem = pCondSet->GetItemIfSet( ATTR_CJK_FONT_WEIGHT );
652 if ( !pWeightItem )
653 pWeightItem = &rSrcSet.Get( ATTR_CJK_FONT_WEIGHT );
654 eCjkWeight = pWeightItem->GetValue();
655 pWeightItem = pCondSet->GetItemIfSet( ATTR_CTL_FONT_WEIGHT );
656 if ( !pWeightItem )
657 pWeightItem = &rSrcSet.Get( ATTR_CTL_FONT_WEIGHT );
658 eCtlWeight = pWeightItem->GetValue();
659
660 const SvxPostureItem* pPostureItem = pCondSet->GetItemIfSet( ATTR_FONT_POSTURE );
661 if ( !pPostureItem )
662 pPostureItem = &rSrcSet.Get( ATTR_FONT_POSTURE );
663 eItalic = pPostureItem->GetValue();
664 pPostureItem = pCondSet->GetItemIfSet( ATTR_CJK_FONT_POSTURE );
665 if ( !pPostureItem )
666 pPostureItem = &rSrcSet.Get( ATTR_CJK_FONT_POSTURE );
667 eCjkItalic = pPostureItem->GetValue();
668 pPostureItem = pCondSet->GetItemIfSet( ATTR_CTL_FONT_POSTURE );
669 if ( !pPostureItem )
670 pPostureItem = &rSrcSet.Get( ATTR_CTL_FONT_POSTURE );
671 eCtlItalic = pPostureItem->GetValue();
672
673 lcl_populate(aUnderlineItem, ATTR_FONT_UNDERLINE, rSrcSet, pCondSet);
674 lcl_populate(aOverlineItem, ATTR_FONT_OVERLINE, rSrcSet, pCondSet);
675
676 const SvxWordLineModeItem* pWordLineModeItem = pCondSet->GetItemIfSet( ATTR_FONT_WORDLINE );
677 if ( !pWordLineModeItem )
678 pWordLineModeItem = &rSrcSet.Get( ATTR_FONT_WORDLINE );
679 bWordLine = pWordLineModeItem->GetValue();
680
681 const SvxCrossedOutItem* pCrossedOutItem = pCondSet->GetItemIfSet( ATTR_FONT_CROSSEDOUT );
682 if ( !pCrossedOutItem )
683 pCrossedOutItem = &rSrcSet.Get( ATTR_FONT_CROSSEDOUT );
684 eStrike = pCrossedOutItem->GetValue();
685
686 const SvxContourItem* pContourItem = pCondSet->GetItemIfSet( ATTR_FONT_CONTOUR );
687 if ( !pContourItem )
688 pContourItem = &rSrcSet.Get( ATTR_FONT_CONTOUR );
689 bOutline = pContourItem->GetValue();
690
691 const SvxShadowedItem* pShadowedItem = pCondSet->GetItemIfSet( ATTR_FONT_SHADOWED );
692 if ( !pShadowedItem )
693 pShadowedItem = &rSrcSet.Get( ATTR_FONT_SHADOWED );
694 bShadow = pShadowedItem->GetValue();
695
696 const SvxForbiddenRuleItem* pForbiddenRuleItem = pCondSet->GetItemIfSet( ATTR_FORBIDDEN_RULES );
697 if ( !pForbiddenRuleItem )
698 pForbiddenRuleItem = &rSrcSet.Get( ATTR_FORBIDDEN_RULES );
699 bForbidden = pForbiddenRuleItem->GetValue();
700
701 const SvxEmphasisMarkItem* pEmphasisMarkItem = pCondSet->GetItemIfSet( ATTR_FONT_EMPHASISMARK );
702 if ( !pEmphasisMarkItem )
703 pEmphasisMarkItem = &rSrcSet.Get( ATTR_FONT_EMPHASISMARK );
704 eEmphasis = pEmphasisMarkItem->GetEmphasisMark();
705 const SvxCharReliefItem* pCharReliefItem = pCondSet->GetItemIfSet( ATTR_FONT_RELIEF );
706 if ( !pCharReliefItem )
707 pCharReliefItem = &rSrcSet.Get( ATTR_FONT_RELIEF );
708 eRelief = pCharReliefItem->GetValue();
709
710 const SvxLanguageItem* pLanguageItem = pCondSet->GetItemIfSet( ATTR_FONT_LANGUAGE );
711 if ( !pLanguageItem )
712 pLanguageItem = &rSrcSet.Get( ATTR_FONT_LANGUAGE );
713 eLang = pLanguageItem->GetLanguage();
714 pLanguageItem = pCondSet->GetItemIfSet( ATTR_CJK_FONT_LANGUAGE );
715 if ( !pLanguageItem )
716 pLanguageItem = &rSrcSet.Get( ATTR_CJK_FONT_LANGUAGE );
717 eCjkLang = pLanguageItem->GetLanguage();
718 pLanguageItem = pCondSet->GetItemIfSet( ATTR_CTL_FONT_LANGUAGE );
719 if ( !pLanguageItem )
720 pLanguageItem = &rSrcSet.Get( ATTR_CTL_FONT_LANGUAGE );
721 eCtlLang = pLanguageItem->GetLanguage();
722
723 const ScHyphenateCell* pHyphenateCell = pCondSet->GetItemIfSet( ATTR_HYPHENATE );
724 if ( !pHyphenateCell )
725 pHyphenateCell = &rSrcSet.Get( ATTR_HYPHENATE );
726 bHyphenate = pHyphenateCell->GetValue();
727
728 const SvxFrameDirectionItem* pFrameDirectionItem = pCondSet->GetItemIfSet( ATTR_WRITINGDIR );
729 if ( !pFrameDirectionItem )
730 pFrameDirectionItem = &rSrcSet.Get( ATTR_WRITINGDIR );
731 eDirection = pFrameDirectionItem->GetValue();
732 }
733 else // Everything directly from Pattern
734 {
735 aColorItem.reset(rSrcSet.Get(ATTR_FONT_COLOR).Clone());
736 aFontItem.reset(rSrcSet.Get(ATTR_FONT).Clone());
737 aCjkFontItem.reset(rSrcSet.Get(ATTR_CJK_FONT).Clone());
738 aCtlFontItem.reset(rSrcSet.Get(ATTR_CTL_FONT).Clone());
739 nTHeight = rSrcSet.Get( ATTR_FONT_HEIGHT ).GetHeight();
740 nCjkTHeight = rSrcSet.Get( ATTR_CJK_FONT_HEIGHT ).GetHeight();
741 nCtlTHeight = rSrcSet.Get( ATTR_CTL_FONT_HEIGHT ).GetHeight();
742 eWeight = rSrcSet.Get( ATTR_FONT_WEIGHT ).GetValue();
743 eCjkWeight = rSrcSet.Get( ATTR_CJK_FONT_WEIGHT ).GetValue();
744 eCtlWeight = rSrcSet.Get( ATTR_CTL_FONT_WEIGHT ).GetValue();
745 eItalic = rSrcSet.Get( ATTR_FONT_POSTURE ).GetValue();
746 eCjkItalic = rSrcSet.Get( ATTR_CJK_FONT_POSTURE ).GetValue();
747 eCtlItalic = rSrcSet.Get( ATTR_CTL_FONT_POSTURE ).GetValue();
748 aUnderlineItem.reset(rSrcSet.Get(ATTR_FONT_UNDERLINE).Clone());
749 aOverlineItem.reset(rSrcSet.Get(ATTR_FONT_OVERLINE).Clone());
750 bWordLine = rSrcSet.Get( ATTR_FONT_WORDLINE ).GetValue();
751 eStrike = rSrcSet.Get( ATTR_FONT_CROSSEDOUT ).GetValue();
752 bOutline = rSrcSet.Get( ATTR_FONT_CONTOUR ).GetValue();
753 bShadow = rSrcSet.Get( ATTR_FONT_SHADOWED ).GetValue();
754 bForbidden = rSrcSet.Get( ATTR_FORBIDDEN_RULES ).GetValue();
755 eEmphasis = rSrcSet.Get( ATTR_FONT_EMPHASISMARK ).GetEmphasisMark();
756 eRelief = rSrcSet.Get( ATTR_FONT_RELIEF ).GetValue();
757 eLang = rSrcSet.Get( ATTR_FONT_LANGUAGE ).GetLanguage();
758 eCjkLang = rSrcSet.Get( ATTR_CJK_FONT_LANGUAGE ).GetLanguage();
759 eCtlLang = rSrcSet.Get( ATTR_CTL_FONT_LANGUAGE ).GetLanguage();
760 bHyphenate = rSrcSet.Get( ATTR_HYPHENATE ).GetValue();
761 eDirection = rSrcSet.Get( ATTR_WRITINGDIR ).GetValue();
762 }
763
764 // Expect to be compatible to LogicToLogic, ie. 2540/1440 = 127/72, and round
765
766 tools::Long nHeight = convertTwipToMm100(nTHeight);
767 tools::Long nCjkHeight = convertTwipToMm100(nCjkTHeight);
768 tools::Long nCtlHeight = convertTwipToMm100(nCtlTHeight);
769
770 // put items into EditEngine ItemSet
771
772 if ( aColorItem->GetValue() == COL_AUTO )
773 {
774 // When cell attributes are converted to EditEngine paragraph attributes,
775 // don't create a hard item for automatic color, because that would be converted
776 // to black when the item's Store method is used in CreateTransferable/WriteBin.
777 // COL_AUTO is the EditEngine's pool default, so ClearItem will result in automatic
778 // color, too, without having to store the item.
779 rEditSet.ClearItem( EE_CHAR_COLOR );
780 }
781 else
782 {
783 // tdf#125054 adapt WhichID
784 rEditSet.Put( std::move(aColorItem), EE_CHAR_COLOR );
785 }
786
787 // tdf#125054 adapt WhichID
788 rEditSet.Put( std::move(aFontItem), EE_CHAR_FONTINFO );
789 rEditSet.Put( std::move(aCjkFontItem), EE_CHAR_FONTINFO_CJK );
790 rEditSet.Put( std::move(aCtlFontItem), EE_CHAR_FONTINFO_CTL );
791
792 rEditSet.Put( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
793 rEditSet.Put( SvxFontHeightItem( nCjkHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
794 rEditSet.Put( SvxFontHeightItem( nCtlHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
795 rEditSet.Put( SvxWeightItem ( eWeight, EE_CHAR_WEIGHT ) );
796 rEditSet.Put( SvxWeightItem ( eCjkWeight, EE_CHAR_WEIGHT_CJK ) );
797 rEditSet.Put( SvxWeightItem ( eCtlWeight, EE_CHAR_WEIGHT_CTL ) );
798
799 // tdf#125054 adapt WhichID
800 rEditSet.Put( std::move(aUnderlineItem), EE_CHAR_UNDERLINE );
801 rEditSet.Put( std::move(aOverlineItem), EE_CHAR_OVERLINE );
802
803 rEditSet.Put( SvxWordLineModeItem( bWordLine, EE_CHAR_WLM ) );
804 rEditSet.Put( SvxCrossedOutItem( eStrike, EE_CHAR_STRIKEOUT ) );
805 rEditSet.Put( SvxPostureItem ( eItalic, EE_CHAR_ITALIC ) );
806 rEditSet.Put( SvxPostureItem ( eCjkItalic, EE_CHAR_ITALIC_CJK ) );
807 rEditSet.Put( SvxPostureItem ( eCtlItalic, EE_CHAR_ITALIC_CTL ) );
808 rEditSet.Put( SvxContourItem ( bOutline, EE_CHAR_OUTLINE ) );
809 rEditSet.Put( SvxShadowedItem ( bShadow, EE_CHAR_SHADOW ) );
810 rEditSet.Put( SvxForbiddenRuleItem(bForbidden, EE_PARA_FORBIDDENRULES) );
811 rEditSet.Put( SvxEmphasisMarkItem( eEmphasis, EE_CHAR_EMPHASISMARK ) );
812 rEditSet.Put( SvxCharReliefItem( eRelief, EE_CHAR_RELIEF ) );
813 rEditSet.Put( SvxLanguageItem ( eLang, EE_CHAR_LANGUAGE ) );
814 rEditSet.Put( SvxLanguageItem ( eCjkLang, EE_CHAR_LANGUAGE_CJK ) );
815 rEditSet.Put( SvxLanguageItem ( eCtlLang, EE_CHAR_LANGUAGE_CTL ) );
816 rEditSet.Put( SfxBoolItem ( EE_PARA_HYPHENATE, bHyphenate ) );
817 rEditSet.Put( SvxFrameDirectionItem( eDirection, EE_PARA_WRITINGDIR ) );
818
819 // Script spacing is always off.
820 // The cell attribute isn't used here as long as there is no UI to set it
821 // (don't evaluate attributes that can't be changed).
822 // If a locale-dependent default is needed, it has to go into the cell
823 // style, like the fonts.
824 rEditSet.Put( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) );
825}
826
827void ScPatternAttr::FillEditItemSet( SfxItemSet* pEditSet, const SfxItemSet* pCondSet ) const
828{
829 if( pEditSet )
830 FillToEditItemSet( *pEditSet, GetItemSet(), pCondSet );
831}
832
834{
835 if (const SvxColorItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_COLOR))
836 rDestSet.Put( *pItem, ATTR_FONT_COLOR );
837
838 if (const SvxFontItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_FONTINFO))
839 rDestSet.Put( *pItem, ATTR_FONT );
840 if (const SvxFontItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_FONTINFO_CJK))
841 rDestSet.Put( *pItem, ATTR_CJK_FONT );
842 if (const SvxFontItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_FONTINFO_CTL))
843 rDestSet.Put( *pItem, ATTR_CTL_FONT );
844
845 if (const SvxFontHeightItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_FONTHEIGHT))
846 rDestSet.Put( SvxFontHeightItem(o3tl::toTwips(pItem->GetHeight(), o3tl::Length::mm100),
847 100, ATTR_FONT_HEIGHT ) );
848 if (const SvxFontHeightItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_FONTHEIGHT_CJK))
849 rDestSet.Put( SvxFontHeightItem(o3tl::toTwips(pItem->GetHeight(), o3tl::Length::mm100),
850 100, ATTR_CJK_FONT_HEIGHT ) );
851 if (const SvxFontHeightItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_FONTHEIGHT_CTL))
852 rDestSet.Put( SvxFontHeightItem(o3tl::toTwips(pItem->GetHeight(), o3tl::Length::mm100),
853 100, ATTR_CTL_FONT_HEIGHT ) );
854
855 if (const SvxWeightItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_WEIGHT))
856 rDestSet.Put( SvxWeightItem( pItem->GetValue(),
858 if (const SvxWeightItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_WEIGHT_CJK))
859 rDestSet.Put( SvxWeightItem( pItem->GetValue(),
861 if (const SvxWeightItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_WEIGHT_CTL))
862 rDestSet.Put( SvxWeightItem( pItem->GetValue(),
864
865 // SvxTextLineItem contains enum and color
866 if (const SvxUnderlineItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_UNDERLINE))
867 rDestSet.Put( *pItem, ATTR_FONT_UNDERLINE );
868 if (const SvxOverlineItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_OVERLINE))
869 rDestSet.Put( *pItem, ATTR_FONT_OVERLINE );
870 if (const SvxWordLineModeItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_WLM))
871 rDestSet.Put( SvxWordLineModeItem( pItem->GetValue(),
873
874 if (const SvxCrossedOutItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_STRIKEOUT))
875 rDestSet.Put( SvxCrossedOutItem( pItem->GetValue(),
877
878 if (const SvxPostureItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_ITALIC))
879 rDestSet.Put( SvxPostureItem( pItem->GetValue(),
881 if (const SvxPostureItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_ITALIC_CJK))
882 rDestSet.Put( SvxPostureItem( pItem->GetValue(),
884 if (const SvxPostureItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_ITALIC_CTL))
885 rDestSet.Put( SvxPostureItem( pItem->GetValue(),
887
888 if (const SvxContourItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_OUTLINE))
889 rDestSet.Put( SvxContourItem( pItem->GetValue(),
891 if (const SvxShadowedItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_SHADOW))
892 rDestSet.Put( SvxShadowedItem( pItem->GetValue(),
894 if (const SvxEmphasisMarkItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_EMPHASISMARK))
895 rDestSet.Put( SvxEmphasisMarkItem( pItem->GetEmphasisMark(),
897 if (const SvxCharReliefItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_RELIEF))
898 rDestSet.Put( SvxCharReliefItem( pItem->GetValue(),
900
901 if (const SvxLanguageItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_LANGUAGE))
902 rDestSet.Put( SvxLanguageItem(pItem->GetValue(), ATTR_FONT_LANGUAGE) );
903 if (const SvxLanguageItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_LANGUAGE_CJK))
904 rDestSet.Put( SvxLanguageItem(pItem->GetValue(), ATTR_CJK_FONT_LANGUAGE) );
905 if (const SvxLanguageItem* pItem = rEditSet.GetItemIfSet(EE_CHAR_LANGUAGE_CTL))
906 rDestSet.Put( SvxLanguageItem(pItem->GetValue(), ATTR_CTL_FONT_LANGUAGE) );
907
908 const SvxAdjustItem* pAdjustItem = rEditSet.GetItemIfSet(EE_PARA_JUST);
909
910 if (!pAdjustItem)
911 return;
912
914 switch ( pAdjustItem->GetAdjust() )
915 {
916 case SvxAdjust::Left:
917 // EditEngine Default is always set in the GetAttribs() ItemSet !
918 // whether left or right, is decided in text / number
919 eVal = SvxCellHorJustify::Standard;
920 break;
921 case SvxAdjust::Right:
922 eVal = SvxCellHorJustify::Right;
923 break;
924 case SvxAdjust::Block:
925 eVal = SvxCellHorJustify::Block;
926 break;
927 case SvxAdjust::Center:
928 eVal = SvxCellHorJustify::Center;
929 break;
930 case SvxAdjust::BlockLine:
931 eVal = SvxCellHorJustify::Block;
932 break;
933 case SvxAdjust::End:
934 eVal = SvxCellHorJustify::Right;
935 break;
936 default:
937 eVal = SvxCellHorJustify::Standard;
938 }
939 if ( eVal != SvxCellHorJustify::Standard )
940 rDestSet.Put( SvxHorJustifyItem( eVal, ATTR_HOR_JUSTIFY) );
941}
942
944{
945 if( !pEditSet )
946 return;
947 GetFromEditItemSet( GetItemSet(), *pEditSet );
948 mxHashCode.reset();
949}
950
952{
953 // already there in GetFromEditItemSet, but not in FillEditItemSet
954 // Default horizontal alignment is always implemented as left
955
956 const SfxItemSet& rMySet = GetItemSet();
957
958 SvxCellHorJustify eHorJust = rMySet.Get(ATTR_HOR_JUSTIFY).GetValue();
959
960 SvxAdjust eSvxAdjust;
961 switch (eHorJust)
962 {
963 case SvxCellHorJustify::Right: eSvxAdjust = SvxAdjust::Right; break;
964 case SvxCellHorJustify::Center: eSvxAdjust = SvxAdjust::Center; break;
965 case SvxCellHorJustify::Block: eSvxAdjust = SvxAdjust::Block; break;
966 default: eSvxAdjust = SvxAdjust::Left; break;
967 }
968 pEditSet->Put( SvxAdjustItem( eSvxAdjust, EE_PARA_JUST ) );
969}
970
972{
973 SfxItemSet& rThisSet = GetItemSet();
974 const SfxItemSet& rOldSet = pOldAttrs->GetItemSet();
975
976 const SfxPoolItem* pThisItem;
977 const SfxPoolItem* pOldItem;
978
979 for ( sal_uInt16 nSubWhich=ATTR_PATTERN_START; nSubWhich<=ATTR_PATTERN_END; nSubWhich++ )
980 {
981 // only items that are set are interesting
982 if ( rThisSet.GetItemState( nSubWhich, false, &pThisItem ) == SfxItemState::SET )
983 {
984 SfxItemState eOldState = rOldSet.GetItemState( nSubWhich, true, &pOldItem );
985 if ( eOldState == SfxItemState::SET )
986 {
987 // item is set in OldAttrs (or its parent) -> compare pointers
988 if ( pThisItem == pOldItem )
989 {
990 rThisSet.ClearItem( nSubWhich );
991 mxHashCode.reset();
992 }
993 }
994 else if ( eOldState != SfxItemState::DONTCARE )
995 {
996 // not set in OldAttrs -> compare item value to default item
997 if ( *pThisItem == rThisSet.GetPool()->GetDefaultItem( nSubWhich ) )
998 {
999 rThisSet.ClearItem( nSubWhich );
1000 mxHashCode.reset();
1001 }
1002 }
1003 }
1004 }
1005}
1006
1007bool ScPatternAttr::HasItemsSet( const sal_uInt16* pWhich ) const
1008{
1009 const SfxItemSet& rSet = GetItemSet();
1010 for (sal_uInt16 i=0; pWhich[i]; i++)
1011 if ( rSet.GetItemState( pWhich[i], false ) == SfxItemState::SET )
1012 return true;
1013 return false;
1014}
1015
1016void ScPatternAttr::ClearItems( const sal_uInt16* pWhich )
1017{
1019 for (sal_uInt16 i=0; pWhich[i]; i++)
1020 rSet.ClearItem(pWhich[i]);
1021 mxHashCode.reset();
1022}
1023
1025 (
1026 SfxStyleSheetBase* pSrcStyle,
1027 SfxStyleSheetBasePool* pSrcPool,
1028 SfxStyleSheetBasePool* pDestPool,
1029 const SvNumberFormatterIndexTable* pFormatExchangeList
1030 )
1031{
1032 if ( !pSrcStyle || !pDestPool || !pSrcPool )
1033 {
1034 OSL_FAIL( "CopyStyleToPool: Invalid Arguments :-/" );
1035 return nullptr;
1036 }
1037
1038 const OUString aStrSrcStyle = pSrcStyle->GetName();
1039 const SfxStyleFamily eFamily = pSrcStyle->GetFamily();
1040 SfxStyleSheetBase* pDestStyle = pDestPool->Find( aStrSrcStyle, eFamily );
1041
1042 if ( !pDestStyle )
1043 {
1044 const OUString aStrParent = pSrcStyle->GetParent();
1045 const SfxItemSet& rSrcSet = pSrcStyle->GetItemSet();
1046
1047 pDestStyle = &pDestPool->Make( aStrSrcStyle, eFamily, SfxStyleSearchBits::UserDefined );
1048 SfxItemSet& rDestSet = pDestStyle->GetItemSet();
1049 rDestSet.Put( rSrcSet );
1050
1051 // number format exchange list has to be handled here, too
1052 // (only called for cell styles)
1053
1054 const SfxUInt32Item* pSrcItem;
1055 if ( pFormatExchangeList &&
1056 (pSrcItem = rSrcSet.GetItemIfSet( ATTR_VALUE_FORMAT, false )) )
1057 {
1058 sal_uLong nOldFormat = pSrcItem->GetValue();
1059 SvNumberFormatterIndexTable::const_iterator it = pFormatExchangeList->find(nOldFormat);
1060 if (it != pFormatExchangeList->end())
1061 {
1062 sal_uInt32 nNewFormat = it->second;
1063 rDestSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
1064 }
1065 }
1066
1067 // if necessary create derivative Styles, if not available:
1068
1069 if ( ScResId(STR_STYLENAME_STANDARD) != aStrParent &&
1070 aStrSrcStyle != aStrParent &&
1071 !pDestPool->Find( aStrParent, eFamily ) )
1072 {
1073 lcl_CopyStyleToPool( pSrcPool->Find( aStrParent, eFamily ),
1074 pSrcPool, pDestPool, pFormatExchangeList );
1075 }
1076
1077 pDestStyle->SetParent( aStrParent );
1078 }
1079
1080 return pDestStyle;
1081}
1082
1084{
1085 const SfxItemSet* pSrcSet = &GetItemSet();
1086
1087 ScPatternAttr aDestPattern( pDestDoc->GetPool() );
1088 SfxItemSet* pDestSet = &aDestPattern.GetItemSet();
1089
1090 // Copy cell pattern style to other document:
1091
1092 if ( pDestDoc != pSrcDoc )
1093 {
1094 OSL_ENSURE( pStyle, "Missing Pattern-Style! :-/" );
1095
1096 // if pattern in DestDoc is available, use this, otherwise copy
1097 // parent style to style or create if necessary and attach DestDoc
1098
1100 pSrcDoc->GetStyleSheetPool(),
1101 pDestDoc->GetStyleSheetPool(),
1102 pDestDoc->GetFormatExchangeList() );
1103
1104 aDestPattern.SetStyleSheet( static_cast<ScStyleSheet*>(pStyleCpy) );
1105 }
1106
1107 for ( sal_uInt16 nAttrId = ATTR_PATTERN_START; nAttrId <= ATTR_PATTERN_END; nAttrId++ )
1108 {
1109 const SfxPoolItem* pSrcItem;
1110 SfxItemState eItemState = pSrcSet->GetItemState( nAttrId, false, &pSrcItem );
1111 if (eItemState==SfxItemState::SET)
1112 {
1113 std::unique_ptr<SfxPoolItem> pNewItem;
1114
1115 if ( nAttrId == ATTR_VALIDDATA )
1116 {
1117 // Copy validity to the new document
1118
1119 sal_uInt32 nNewIndex = 0;
1120 ScValidationDataList* pSrcList = pSrcDoc->GetValidationList();
1121 if ( pSrcList )
1122 {
1123 sal_uInt32 nOldIndex = static_cast<const SfxUInt32Item*>(pSrcItem)->GetValue();
1124 const ScValidationData* pOldData = pSrcList->GetData( nOldIndex );
1125 if ( pOldData )
1126 nNewIndex = pDestDoc->AddValidationEntry( *pOldData );
1127 }
1128 pNewItem.reset(new SfxUInt32Item( ATTR_VALIDDATA, nNewIndex ));
1129 }
1130 else if ( nAttrId == ATTR_VALUE_FORMAT && pDestDoc->GetFormatExchangeList() )
1131 {
1132 // Number format to Exchange List
1133
1134 sal_uLong nOldFormat = static_cast<const SfxUInt32Item*>(pSrcItem)->GetValue();
1135 SvNumberFormatterIndexTable::const_iterator it = pDestDoc->GetFormatExchangeList()->find(nOldFormat);
1136 if (it != pDestDoc->GetFormatExchangeList()->end())
1137 {
1138 sal_uInt32 nNewFormat = it->second;
1139 pNewItem.reset(new SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ));
1140 }
1141 }
1142
1143 if ( pNewItem )
1144 {
1145 pDestSet->Put(std::move(pNewItem));
1146 }
1147 else
1148 pDestSet->Put(*pSrcItem);
1149 }
1150 }
1151
1152 ScPatternAttr* pPatternAttr = const_cast<ScPatternAttr*>( &pDestDoc->GetPool()->Put(aDestPattern) );
1153 return pPatternAttr;
1154}
1155
1157{
1158 const SfxItemSet& rSet = GetItemSet();
1159
1160 if ( const SvxBrushItem* pItem = rSet.GetItemIfSet( ATTR_BACKGROUND ) )
1161 if ( pItem->GetColor() != COL_TRANSPARENT )
1162 return true;
1163
1164 if ( const SvxBoxItem* pBoxItem = rSet.GetItemIfSet( ATTR_BORDER ) )
1165 {
1166 if ( pBoxItem->GetTop() || pBoxItem->GetBottom() ||
1167 pBoxItem->GetLeft() || pBoxItem->GetRight() )
1168 return true;
1169 }
1170
1171 if ( const SvxLineItem* pItem = rSet.GetItemIfSet( ATTR_BORDER_TLBR ) )
1172 if( pItem->GetLine() )
1173 return true;
1174
1175 if ( const SvxLineItem* pItem = rSet.GetItemIfSet( ATTR_BORDER_BLTR ) )
1176 if( pItem->GetLine() )
1177 return true;
1178
1179 if ( const SvxShadowItem* pItem = rSet.GetItemIfSet( ATTR_SHADOW ) )
1180 if ( pItem->GetLocation() != SvxShadowLocation::NONE )
1181 return true;
1182
1183 return false;
1184}
1185
1186static bool OneEqual( const SfxItemSet& rSet1, const SfxItemSet& rSet2, sal_uInt16 nId )
1187{
1188 const SfxPoolItem* pItem1 = &rSet1.Get(nId);
1189 const SfxPoolItem* pItem2 = &rSet2.Get(nId);
1190 return ( pItem1 == pItem2 || *pItem1 == *pItem2 );
1191}
1192
1194{
1195 const SfxItemSet& rThisSet = GetItemSet();
1196 const SfxItemSet& rOtherSet = rOther.GetItemSet();
1197
1198 return OneEqual( rThisSet, rOtherSet, ATTR_BACKGROUND ) &&
1199 OneEqual( rThisSet, rOtherSet, ATTR_BORDER ) &&
1200 OneEqual( rThisSet, rOtherSet, ATTR_BORDER_TLBR ) &&
1201 OneEqual( rThisSet, rOtherSet, ATTR_BORDER_BLTR ) &&
1202 OneEqual( rThisSet, rOtherSet, ATTR_SHADOW );
1203
1204 //TODO: also here only check really visible values !!!
1205}
1206
1207const OUString* ScPatternAttr::GetStyleName() const
1208{
1209 return pName ? &*pName : ( pStyle ? &pStyle->GetName() : nullptr );
1210}
1211
1212void ScPatternAttr::SetStyleSheet( ScStyleSheet* pNewStyle, bool bClearDirectFormat )
1213{
1214 if (pNewStyle)
1215 {
1216 SfxItemSet& rPatternSet = GetItemSet();
1217 const SfxItemSet& rStyleSet = pNewStyle->GetItemSet();
1218
1219 if (bClearDirectFormat)
1220 {
1221 for (sal_uInt16 i=ATTR_PATTERN_START; i<=ATTR_PATTERN_END; i++)
1222 {
1223 if (rStyleSet.GetItemState(i) == SfxItemState::SET)
1224 rPatternSet.ClearItem(i);
1225 }
1226 }
1227 rPatternSet.SetParent(&pNewStyle->GetItemSet());
1228 pStyle = pNewStyle;
1229 pName.reset();
1230 }
1231 else
1232 {
1233 OSL_FAIL( "ScPatternAttr::SetStyleSheet( NULL ) :-|" );
1234 GetItemSet().SetParent(nullptr);
1235 pStyle = nullptr;
1236 }
1237 mxHashCode.reset();
1238}
1239
1241{
1242 if (pName)
1243 {
1244 pStyle = static_cast<ScStyleSheet*>(rDoc.GetStyleSheetPool()->Find(*pName, SfxStyleFamily::Para));
1245
1246 // use Standard if Style is not found,
1247 // to avoid empty display in Toolbox-Controller
1248 // Assumes that "Standard" is always the 1st entry!
1249 if (!pStyle)
1250 {
1251 std::unique_ptr<SfxStyleSheetIterator> pIter = rDoc.GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Para);
1252 pStyle = dynamic_cast< ScStyleSheet* >(pIter->First());
1253 }
1254
1255 if (pStyle)
1256 {
1258 pName.reset();
1259 }
1260 }
1261 else
1262 pStyle = nullptr;
1263 mxHashCode.reset();
1264}
1265
1267{
1268 // Style was deleted, remember name:
1269
1270 if ( pStyle )
1271 {
1272 pName = pStyle->GetName();
1273 pStyle = nullptr;
1274 GetItemSet().SetParent( nullptr );
1275 mxHashCode.reset();
1276 }
1277}
1278
1280{
1281 if( const SvxFontItem* pItem = GetItemSet().GetItemIfSet( ATTR_FONT ) )
1282 return pItem->GetCharSet() == RTL_TEXTENCODING_SYMBOL;
1283 else
1284 return false;
1285}
1286
1287namespace {
1288
1289sal_uInt32 getNumberFormatKey(const SfxItemSet& rSet)
1290{
1291 return rSet.Get(ATTR_VALUE_FORMAT).GetValue();
1292}
1293
1294LanguageType getLanguageType(const SfxItemSet& rSet)
1295{
1296 return rSet.Get(ATTR_LANGUAGE_FORMAT).GetLanguage();
1297}
1298
1299}
1300
1302{
1303 sal_uInt32 nFormat = getNumberFormatKey(GetItemSet());
1304 LanguageType eLang = getLanguageType(GetItemSet());
1305 if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLang == LANGUAGE_SYSTEM )
1306 ; // it remains as it is
1307 else if ( pFormatter )
1308 nFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nFormat, eLang );
1309 return nFormat;
1310}
1311
1312// the same if conditional formatting is in play:
1313
1315 const SfxItemSet* pCondSet ) const
1316{
1317 assert(pFormatter);
1318 if (!pCondSet)
1319 return GetNumberFormat(pFormatter);
1320
1321 // Conditional format takes precedence over style and even hard format.
1322
1323 sal_uInt32 nFormat;
1324 LanguageType eLang;
1325 if (pCondSet->GetItemState(ATTR_VALUE_FORMAT) == SfxItemState::SET )
1326 {
1327 nFormat = getNumberFormatKey(*pCondSet);
1328 if (pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT) == SfxItemState::SET)
1329 eLang = getLanguageType(*pCondSet);
1330 else
1331 eLang = getLanguageType(GetItemSet());
1332 }
1333 else
1334 {
1335 nFormat = getNumberFormatKey(GetItemSet());
1336 eLang = getLanguageType(GetItemSet());
1337 }
1338
1339 return pFormatter->GetFormatForLanguageIfBuiltIn(nFormat, eLang);
1340}
1341
1342const SfxPoolItem& ScPatternAttr::GetItem( sal_uInt16 nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet )
1343{
1344 const SfxPoolItem* pCondItem;
1345 if ( pCondSet && pCondSet->GetItemState( nWhich, true, &pCondItem ) == SfxItemState::SET )
1346 return *pCondItem;
1347 return rItemSet.Get(nWhich);
1348}
1349
1350const SfxPoolItem& ScPatternAttr::GetItem( sal_uInt16 nSubWhich, const SfxItemSet* pCondSet ) const
1351{
1352 return GetItem( nSubWhich, GetItemSet(), pCondSet );
1353}
1354
1355// GetRotateVal is tested before ATTR_ORIENTATION
1356
1358{
1359 Degree100 nAttrRotate(0);
1360 if ( GetCellOrientation() == SvxCellOrientation::Standard )
1361 {
1362 bool bRepeat = ( GetItem(ATTR_HOR_JUSTIFY, pCondSet).
1363 GetValue() == SvxCellHorJustify::Repeat );
1364 // ignore orientation/rotation if "repeat" is active
1365 if ( !bRepeat )
1366 nAttrRotate = GetItem( ATTR_ROTATE_VALUE, pCondSet ).GetValue();
1367 }
1368 return nAttrRotate;
1369}
1370
1372{
1374
1375 Degree100 nAttrRotate = GetRotateVal( pCondSet );
1376 if ( nAttrRotate )
1377 {
1378 SvxRotateMode eRotMode = GetItem(ATTR_ROTATE_MODE, pCondSet).GetValue();
1379
1380 if ( eRotMode == SVX_ROTATE_MODE_STANDARD || nAttrRotate == 18000_deg100 )
1381 nRet = ScRotateDir::Standard;
1382 else if ( eRotMode == SVX_ROTATE_MODE_CENTER )
1383 nRet = ScRotateDir::Center;
1384 else if ( eRotMode == SVX_ROTATE_MODE_TOP || eRotMode == SVX_ROTATE_MODE_BOTTOM )
1385 {
1386 Degree100 nRot180 = nAttrRotate % 18000_deg100; // 1/100 degrees
1387 if ( nRot180 == 9000_deg100 )
1388 nRet = ScRotateDir::Center;
1389 else if ( ( eRotMode == SVX_ROTATE_MODE_TOP && nRot180 < 9000_deg100 ) ||
1390 ( eRotMode == SVX_ROTATE_MODE_BOTTOM && nRot180 > 9000_deg100 ) )
1391 nRet = ScRotateDir::Left;
1392 else
1393 nRet = ScRotateDir::Right;
1394 }
1395 }
1396
1397 return nRet;
1398}
1399
1400void ScPatternAttr::SetKey(sal_uInt64 nKey)
1401{
1402 mnKey = nKey;
1403}
1404
1405sal_uInt64 ScPatternAttr::GetKey() const
1406{
1407 return mnKey;
1408}
1409
1411{
1412 auto const & rSet = GetItemSet();
1413 if( rSet.TotalCount() != compareSize ) // see EqualPatternSets()
1414 {
1415 mxHashCode = 0; // invalid
1416 return;
1417 }
1418 mxHashCode = 1; // Set up seed so that an empty pattern does not have an (invalid) hash of 0.
1419 boost::hash_range(*mxHashCode, rSet.GetItems_Impl(), rSet.GetItems_Impl() + compareSize);
1420}
1421
1422/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr auto convertTwipToMm100(N n)
const char * pName
sal_uInt32 GetValue() const
bool IsBright() const
bool IsDark() const
void SetScaleY(const Fraction &rScaleY)
MapUnit GetMapUnit() const
void SetScaleX(const Fraction &rScaleX)
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
const MapMode & GetMapMode() const
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6169
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6174
SC_DLLPUBLIC sal_uLong AddValidationEntry(const ScValidationData &rNew)
Definition: documen4.cxx:726
const ScValidationDataList * GetValidationList() const
Definition: document.hxx:1874
SvNumberFormatterIndexTable * GetFormatExchangeList() const
Definition: document.hxx:922
sal_uInt64 mnKey
Definition: patattr.hxx:58
bool IsSymbolFont() const
If font is an old symbol font StarBats/StarMath with text encoding RTL_TEXTENC_SYMBOL.
Definition: patattr.cxx:1279
void UpdateStyleSheet(const ScDocument &rDoc)
Definition: patattr.cxx:1240
void StyleToName()
Definition: patattr.cxx:1266
virtual lookup_iterator Lookup(lookup_iterator begin, lookup_iterator end) const override
Definition: patattr.cxx:167
virtual bool operator==(const SfxPoolItem &rCmp) const override
Definition: patattr.cxx:150
std::optional< size_t > mxHashCode
Definition: patattr.hxx:56
ScStyleSheet * pStyle
Definition: patattr.hxx:57
void ClearItems(const sal_uInt16 *pWhich)
Definition: patattr.cxx:1016
ScPatternAttr * PutInPool(ScDocument *pDestDoc, ScDocument *pSrcDoc) const
Definition: patattr.cxx:1083
void CalcHashCode() const
Definition: patattr.cxx:1410
std::optional< OUString > pName
Definition: patattr.hxx:55
bool IsVisible() const
Definition: patattr.cxx:1156
Degree100 GetRotateVal(const SfxItemSet *pCondSet) const
Definition: patattr.cxx:1357
static std::optional< bool > FastEqualPatternSets(const SfxItemSet &rSet1, const SfxItemSet &rSet2)
Definition: patattr.cxx:122
bool IsVisibleEqual(const ScPatternAttr &rOther) const
Definition: patattr.cxx:1193
const OUString * GetStyleName() const
Definition: patattr.cxx:1207
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
Definition: patattr.cxx:1212
sal_uInt32 GetNumberFormat(SvNumberFormatter *) const
Definition: patattr.cxx:1301
ScPatternAttr(SfxItemSet &&pItemSet, const OUString &rStyleName)
Definition: patattr.cxx:69
void DeleteUnchanged(const ScPatternAttr *pOldAttrs)
Definition: patattr.cxx:971
sal_uInt64 GetKey() const
Definition: patattr.cxx:1405
ScRotateDir GetRotateDir(const SfxItemSet *pCondSet) const
Definition: patattr.cxx:1371
static void FillToEditItemSet(SfxItemSet &rEditSet, const SfxItemSet &rSrcSet, const SfxItemSet *pCondSet=nullptr)
Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet.
Definition: patattr.cxx:601
static ScDxfFont GetDxfFont(const SfxItemSet &rSet, SvtScriptType nScript)
Definition: patattr.cxx:505
void SetKey(sal_uInt64 nKey)
Definition: patattr.cxx:1400
static void GetFont(vcl::Font &rFont, const SfxItemSet &rItemSet, ScAutoFontColorMode eAutoMode, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE, const Color *pBackConfigColor=nullptr, const Color *pTextConfigColor=nullptr)
Static helper function to fill a font object from the passed item set.
Definition: patattr.cxx:251
bool HasItemsSet(const sal_uInt16 *pWhich) const
Definition: patattr.cxx:1007
SfxItemSet & GetItemSet()
Definition: patattr.hxx:155
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:72
void FillEditItemSet(SfxItemSet *pEditSet, const SfxItemSet *pCondSet=nullptr) const
Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSe...
Definition: patattr.cxx:827
static void GetFromEditItemSet(SfxItemSet &rDestSet, const SfxItemSet &rEditSet)
Converts all edit engine items contained in rEditSet to Calc items and puts them into rDestSet.
Definition: patattr.cxx:833
static SvxCellOrientation GetCellOrientation(const SfxItemSet &rItemSet, const SfxItemSet *pCondSet)
Definition: patattr.cxx:189
virtual ScPatternAttr * Clone(SfxItemPool *pPool=nullptr) const override
Definition: patattr.cxx:99
void FillEditParaItems(SfxItemSet *pSet) const
Definition: patattr.cxx:951
virtual SC_DLLPUBLIC SfxItemSet & GetItemSet() override
Definition: stlsheet.cxx:128
ScValidationData * GetData(sal_uInt32 nKey)
Definition: validat.cxx:1023
bool GetValue() const
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
SfxItemPool * GetPool() const
void SetParent(const SfxItemSet *pNew)
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
SfxPoolItem const ** GetItems_Impl() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
sal_uInt16 TotalCount() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
std::vector< SfxPoolItem * >::const_iterator lookup_iterator
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All) const
virtual std::unique_ptr< SfxStyleSheetIterator > CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
virtual SfxStyleSheetBase & Make(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits nMask=SfxStyleSearchBits::All)
virtual const OUString & GetParent() const
const OUString & GetName() const
SfxStyleFamily GetFamily() const
virtual bool SetParent(const OUString &)
virtual SfxItemSet & GetItemSet()
sal_uInt32 GetFormatForLanguageIfBuiltIn(sal_uInt32 nFormat, LanguageType eLnge=LANGUAGE_DONTKNOW)
SvxAdjust GetAdjust() const
const Color & GetColor() const
const Color & GetValue() const
FontEmphasisMark GetEmphasisMark() const
sal_uInt32 GetHeight() const
FontFamily GetFamily() const
FontPitch GetPitch() const
const OUString & GetStyleName() const
rtl_TextEncoding GetCharSet() const
const OUString & GetFamilyName() const
LanguageType GetLanguage() const
void SetFontSize(const Size &)
void SetOutline(bool bOutline)
void SetStyleName(const OUString &rStyleName)
void SetWordLineMode(bool bWordLine)
void SetPitch(FontPitch ePitch)
void SetTransparent(bool bTransparent)
void SetColor(const Color &)
const OUString & GetStyleName() const
void SetItalic(FontItalic)
void SetWeight(FontWeight)
const OUString & GetFamilyName() const
void SetFamily(FontFamily)
void SetUnderline(FontLineStyle)
void SetCharSet(rtl_TextEncoding)
void SetOverline(FontLineStyle)
void SetFamilyName(const OUString &rFamilyName)
void SetLanguage(LanguageType)
void SetShadow(bool bShadow)
void SetRelief(FontRelief)
void SetEmphasisMark(FontEmphasisMark)
void SetStrikeout(FontStrikeout)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr TypedWhichId< SvxContourItem > EE_CHAR_OUTLINE(EE_CHAR_START+8)
constexpr TypedWhichId< SfxBoolItem > EE_PARA_HYPHENATE(EE_PARA_START+6)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxUnderlineItem > EE_CHAR_UNDERLINE(EE_CHAR_START+5)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+16)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxShadowedItem > EE_CHAR_SHADOW(EE_CHAR_START+9)
constexpr TypedWhichId< SvxOverlineItem > EE_CHAR_OVERLINE(EE_CHAR_START+29)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxCrossedOutItem > EE_CHAR_STRIKEOUT(EE_CHAR_START+6)
constexpr TypedWhichId< SvxForbiddenRuleItem > EE_PARA_FORBIDDENRULES(EE_PARA_START+3)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
constexpr TypedWhichId< SvxEmphasisMarkItem > EE_CHAR_EMPHASISMARK(EE_CHAR_START+25)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
constexpr TypedWhichId< SvxFrameDirectionItem > EE_PARA_WRITINGDIR(EE_PARA_START+0)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
constexpr TypedWhichId< SvxScriptSpaceItem > EE_PARA_ASIANCJKSPACING(EE_PARA_START+4)
constexpr TypedWhichId< SvxWordLineModeItem > EE_CHAR_WLM(EE_CHAR_START+13)
constexpr TypedWhichId< SvxCharReliefItem > EE_CHAR_RELIEF(EE_CHAR_START+26)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
ScRotateDir
Definition: fillinfo.hxx:40
FontRelief
FontLineStyle
LINESTYLE_NONE
FontStrikeout
FontItalic
FontEmphasisMark
SvxFrameDirection
#define LANGUAGE_SYSTEM
SvtScriptType
bool equal(T const &rfValA, T const &rfValB)
int i
constexpr auto toTwips(N number, Length from)
enumrange< T >::Iterator begin(enumrange< T >)
end
FontWeight
long Long
sal_Int16 nId
const char GetValue[]
constexpr size_t compareSize
Definition: patattr.cxx:120
static SfxStyleSheetBase * lcl_CopyStyleToPool(SfxStyleSheetBase *pSrcStyle, SfxStyleSheetBasePool *pSrcPool, SfxStyleSheetBasePool *pDestPool, const SvNumberFormatterIndexTable *pFormatExchangeList)
Definition: patattr.cxx:1025
static bool StrCmp(const OUString *pStr1, const OUString *pStr2)
Definition: patattr.cxx:109
static void lcl_populate(std::unique_ptr< T > &rxItem, TypedWhichId< T > nWhich, const SfxItemSet &rSrcSet, const SfxItemSet *pCondSet)
Definition: patattr.cxx:593
static bool EqualPatternSets(const SfxItemSet &rSet1, const SfxItemSet &rSet2)
Definition: patattr.cxx:142
static bool OneEqual(const SfxItemSet &rSet1, const SfxItemSet &rSet2, sal_uInt16 nId)
Definition: patattr.cxx:1186
ScAutoFontColorMode
how to treat COL_AUTO in GetFont:
Definition: patattr.hxx:43
@ SC_AUTOCOL_BLACK
always use black
Definition: patattr.hxx:45
@ SC_AUTOCOL_IGNOREBACK
like DISPLAY, but ignore stored background color (use configured color)
Definition: patattr.hxx:49
@ SC_AUTOCOL_RAW
COL_AUTO is returned.
Definition: patattr.hxx:44
@ SC_AUTOCOL_IGNOREFONT
like DISPLAY, but ignore stored font color (assume COL_AUTO)
Definition: patattr.hxx:48
@ SC_AUTOCOL_PRINT
black or white, depending on background
Definition: patattr.hxx:46
@ SC_AUTOCOL_IGNOREALL
like DISPLAY, but ignore stored font and background colors
Definition: patattr.hxx:50
SfxItemState
SvxRotateMode
SVX_ROTATE_MODE_BOTTOM
SVX_ROTATE_MODE_STANDARD
SVX_ROTATE_MODE_CENTER
SVX_ROTATE_MODE_TOP
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
constexpr TypedWhichId< SvxForbiddenRuleItem > ATTR_FORBIDDEN_RULES(128)
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< 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< SvxLineItem > ATTR_BORDER_TLBR(141)
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
constexpr TypedWhichId< SvxWordLineModeItem > ATTR_FONT_WORDLINE(123)
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
constexpr TypedWhichId< SvxLanguageItem > ATTR_CTL_FONT_LANGUAGE(120)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< SvxOverlineItem > ATTR_FONT_OVERLINE(105)
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
constexpr TypedWhichId< SvxLanguageItem > ATTR_LANGUAGE_FORMAT(147)
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr sal_uInt16 ATTR_PATTERN_START(100)
constexpr TypedWhichId< SvxRotateModeItem > ATTR_ROTATE_MODE(136)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SvxCharReliefItem > ATTR_FONT_RELIEF(124)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SvxFrameDirectionItem > ATTR_WRITINGDIR(138)
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
constexpr TypedWhichId< ScHyphenateCell > ATTR_HYPHENATE(125)
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< SvxLanguageItem > ATTR_FONT_LANGUAGE(110)
constexpr sal_uInt16 ATTR_PATTERN_END(155)
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
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< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
#define SC_MOD()
Definition: scmod.hxx:249
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
std::optional< bool > bShadow
Definition: fonthelper.hxx:32
std::optional< const SvxFontItem * > pFontAttr
Definition: fonthelper.hxx:23
std::optional< bool > bOutline
Definition: fonthelper.hxx:31
std::optional< bool > bWordLine
Definition: fonthelper.hxx:29
std::optional< FontLineStyle > eUnder
Definition: fonthelper.hxx:27
std::optional< FontItalic > eItalic
Definition: fonthelper.hxx:26
std::optional< FontLineStyle > eOver
Definition: fonthelper.hxx:28
std::optional< FontRelief > eRelief
Definition: fonthelper.hxx:34
std::optional< LanguageType > eLang
Definition: fonthelper.hxx:36
std::optional< FontStrikeout > eStrike
Definition: fonthelper.hxx:30
std::optional< FontEmphasisMark > eEmphasis
Definition: fonthelper.hxx:33
std::optional< sal_uInt32 > nFontHeight
Definition: fonthelper.hxx:24
std::optional< FontWeight > eWeight
Definition: fonthelper.hxx:25
std::optional< Color > aColor
Definition: fonthelper.hxx:35
SfxStyleFamily
SvxCellHorJustify
SvxCellOrientation
SvxAdjust
std::unordered_map< sal_uInt16, sal_uInt32 > SvNumberFormatterIndexTable
#define SV_COUNTRY_LANGUAGE_OFFSET