LibreOffice Module sc (master)  1
attrib.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 <com/sun/star/util/CellProtection.hpp>
21 
22 #include <scitems.hxx>
23 
24 #include <editeng/editeng.hxx>
25 #include <editeng/editobj.hxx>
26 #include <editeng/eerdll.hxx>
27 #include <editeng/borderline.hxx>
28 #include <editeng/itemtype.hxx>
29 #include <svl/itempool.hxx>
30 
31 #include <libxml/xmlwriter.h>
32 
33 #include <attrib.hxx>
34 #include <global.hxx>
35 #include <editutil.hxx>
36 #include <mid.h>
37 #include <globstr.hrc>
38 #include <scresid.hxx>
39 #include <textuno.hxx>
40 
41 using namespace com::sun::star;
42 
43 
45 
49 bool ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther )
50 {
51 
52  if (!pThis)
53  return false;
54  if (!pOther)
55  return true;
56 
57  sal_uInt16 nThisSize = pThis->GetScaledWidth();
58  sal_uInt16 nOtherSize = pOther->GetScaledWidth();
59 
60  if (nThisSize > nOtherSize)
61  return true;
62  else if (nThisSize < nOtherSize)
63  return false;
64  else
65  {
66  if ( pOther->GetInWidth() && !pThis->GetInWidth() )
67  return true;
68  else if ( pThis->GetInWidth() && !pOther->GetInWidth() )
69  return false;
70  else
71  {
72  return true; // FIXME: What is this?
73  }
74  }
75 }
76 
84  nColMerge(0),
85  nRowMerge(0)
86 {}
87 
90  nColMerge(nCol),
91  nRowMerge(nRow)
92 {}
93 
96 {
97  nColMerge = rItem.nColMerge;
98  nRowMerge = rItem.nRowMerge;
99 }
100 
102 {
103 }
104 
105 bool ScMergeAttr::operator==( const SfxPoolItem& rItem ) const
106 {
107  return SfxPoolItem::operator==(rItem)
108  && (nColMerge == static_cast<const ScMergeAttr&>(rItem).nColMerge)
109  && (nRowMerge == static_cast<const ScMergeAttr&>(rItem).nRowMerge);
110 }
111 
113 {
114  return new ScMergeAttr(*this);
115 }
116 
118 {
119  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScMergeAttr"));
120  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("col-merge"), BAD_CAST(OString::number(GetColMerge()).getStr()));
121  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("row-merge"), BAD_CAST(OString::number(GetRowMerge()).getStr()));
122  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("merged"), BAD_CAST(OString::boolean(IsMerged()).getStr()));
123  (void)xmlTextWriterEndElement(pWriter);
124 }
125 
131 {
132 }
133 
135  SfxInt16Item(ATTR_MERGE_FLAG, static_cast<sal_Int16>(nFlags))
136 {
137 }
138 
140 {
141 }
142 
144 {
145  return new ScMergeFlagAttr(*this);
146 }
147 
149 {
150  return bool(GetValue() & ScMF::Button);
151 }
152 
154 {
155  return bool(GetValue() & ScMF::ButtonPopup);
156 }
157 
159 {
160  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScMergeFlagAttr"));
161  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("overlapped"), BAD_CAST(OString::boolean(IsOverlapped()).getStr()));
162  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("hor_overlapped"), BAD_CAST(OString::boolean(IsHorOverlapped()).getStr()));
163  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("ver_overlapped"), BAD_CAST(OString::boolean(IsVerOverlapped()).getStr()));
164  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("autofilter"), BAD_CAST(OString::boolean(HasAutoFilter()).getStr()));
165  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("scenario"), BAD_CAST(OString::boolean(IsScenario()).getStr()));
166  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("pivot-button"), BAD_CAST(OString::boolean(HasPivotButton()).getStr()));
167  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("pivot-popup-button"), BAD_CAST(OString::boolean(HasPivotPopupButton()).getStr()));
168  (void)xmlTextWriterEndElement(pWriter);
169 }
170 
176  bProtection(true),
177  bHideFormula(false),
178  bHideCell(false),
179  bHidePrint(false)
180 {
181 }
182 
183 ScProtectionAttr::ScProtectionAttr( bool bProtect, bool bHFormula,
184  bool bHCell, bool bHPrint):
186  bProtection(bProtect),
187  bHideFormula(bHFormula),
188  bHideCell(bHCell),
189  bHidePrint(bHPrint)
190 {
191 }
192 
195 {
196  bProtection = rItem.bProtection;
197  bHideFormula = rItem.bHideFormula;
198  bHideCell = rItem.bHideCell;
199  bHidePrint = rItem.bHidePrint;
200 }
201 
203 {
204 }
205 
206 bool ScProtectionAttr::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
207 {
208  nMemberId &= ~CONVERT_TWIPS;
209  switch ( nMemberId )
210  {
211  case 0 :
212  {
213  util::CellProtection aProtection;
214  aProtection.IsLocked = bProtection;
215  aProtection.IsFormulaHidden = bHideFormula;
216  aProtection.IsHidden = bHideCell;
217  aProtection.IsPrintHidden = bHidePrint;
218  rVal <<= aProtection;
219  break;
220  }
221  case MID_1 :
222  rVal <<= bProtection; break;
223  case MID_2 :
224  rVal <<= bHideFormula; break;
225  case MID_3 :
226  rVal <<= bHideCell; break;
227  case MID_4 :
228  rVal <<= bHidePrint; break;
229  default:
230  OSL_FAIL("Wrong MemberID!");
231  return false;
232  }
233 
234  return true;
235 }
236 
237 bool ScProtectionAttr::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
238 {
239  bool bRet = false;
240  bool bVal = false;
241  nMemberId &= ~CONVERT_TWIPS;
242  switch ( nMemberId )
243  {
244  case 0 :
245  {
246  util::CellProtection aProtection;
247  if ( rVal >>= aProtection )
248  {
249  bProtection = aProtection.IsLocked;
250  bHideFormula = aProtection.IsFormulaHidden;
251  bHideCell = aProtection.IsHidden;
252  bHidePrint = aProtection.IsPrintHidden;
253  bRet = true;
254  }
255  else
256  {
257  OSL_FAIL("exception - wrong argument");
258  }
259  break;
260  }
261  case MID_1 :
262  bRet = (rVal >>= bVal); if (bRet) bProtection=bVal; break;
263  case MID_2 :
264  bRet = (rVal >>= bVal); if (bRet) bHideFormula=bVal; break;
265  case MID_3 :
266  bRet = (rVal >>= bVal); if (bRet) bHideCell=bVal; break;
267  case MID_4 :
268  bRet = (rVal >>= bVal); if (bRet) bHidePrint=bVal; break;
269  default:
270  OSL_FAIL("Wrong MemberID!");
271  }
272 
273  return bRet;
274 }
275 
277 {
278  const OUString aStrYes ( ScResId(STR_YES) );
279  const OUString aStrNo ( ScResId(STR_NO) );
280 
281  const OUString aValue = "("
282  + (bProtection ? aStrYes : aStrNo)
283  + ","
284  + (bHideFormula ? aStrYes : aStrNo)
285  + ","
286  + (bHideCell ? aStrYes : aStrNo)
287  + ","
288  + (bHidePrint ? aStrYes : aStrNo)
289  + ")";
290 
291  return aValue;
292 }
293 
295  (
296  SfxItemPresentation ePres,
297  MapUnit /* eCoreMetric */,
298  MapUnit /* ePresMetric */,
299  OUString& rText,
300  const IntlWrapper& /* rIntl */
301  ) const
302 {
303  const OUString aStrYes ( ScResId(STR_YES) );
304  const OUString aStrNo ( ScResId(STR_NO) );
305 
306  switch ( ePres )
307  {
308  case SfxItemPresentation::Nameless:
309  rText = GetValueText();
310  break;
311 
312  case SfxItemPresentation::Complete:
313  rText = ScResId(STR_PROTECTION)
314  + ": "
315  + (bProtection ? aStrYes : aStrNo)
316  + ", "
317  + ScResId(STR_FORMULAS)
318  + ": "
319  + (!bHideFormula ? aStrYes : aStrNo)
320  + ", "
321  + ScResId(STR_HIDE)
322  + ": "
323  + (bHideCell ? aStrYes : aStrNo)
324  + ", "
325  + ScResId(STR_PRINT)
326  + ": "
327  + (!bHidePrint ? aStrYes : aStrNo);
328  break;
329 
330  default: break;
331  }
332 
333  return true;
334 }
335 
336 bool ScProtectionAttr::operator==( const SfxPoolItem& rItem ) const
337 {
338  return SfxPoolItem::operator==(rItem)
339  && (bProtection == static_cast<const ScProtectionAttr&>(rItem).bProtection)
340  && (bHideFormula == static_cast<const ScProtectionAttr&>(rItem).bHideFormula)
341  && (bHideCell == static_cast<const ScProtectionAttr&>(rItem).bHideCell)
342  && (bHidePrint == static_cast<const ScProtectionAttr&>(rItem).bHidePrint);
343 }
344 
346 {
347  return new ScProtectionAttr(*this);
348 }
349 
351 {
352  bProtection = bProtect;
353 }
354 
355 void ScProtectionAttr::SetHideFormula( bool bHFormula)
356 {
357  bHideFormula = bHFormula;
358 }
359 
361 {
362  bHideCell = bHCell;
363 }
364 
366 {
367  bHidePrint = bHPrint;
368 }
369 
371 {
372  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScProtectionAttr"));
373  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("protection"), BAD_CAST(OString::boolean(GetProtection()).getStr()));
374  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("hide-formula"), BAD_CAST(OString::boolean(GetHideFormula()).getStr()));
375  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("hide-cell"), BAD_CAST(OString::boolean(GetHideCell()).getStr()));
376  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("hide-print"), BAD_CAST(OString::boolean(GetHidePrint()).getStr()));
377  (void)xmlTextWriterEndElement(pWriter);
378 }
379 
383 ScPageHFItem::ScPageHFItem( sal_uInt16 nWhichP )
384  : SfxPoolItem ( nWhichP )
385 {
386 }
387 
389  : SfxPoolItem ( rItem )
390 {
391  if ( rItem.pLeftArea )
392  pLeftArea = rItem.pLeftArea->Clone();
393  if ( rItem.pCenterArea )
394  pCenterArea = rItem.pCenterArea->Clone();
395  if ( rItem.pRightArea )
396  pRightArea = rItem.pRightArea->Clone();
397 }
398 
400 {
401 }
402 
403 bool ScPageHFItem::QueryValue( uno::Any& rVal, sal_uInt8 /* nMemberId */ ) const
404 {
407  xContent->Init(pLeftArea.get(), pCenterArea.get(), pRightArea.get());
408 
409  uno::Reference<sheet::XHeaderFooterContent> xCont(xContent);
410 
411  rVal <<= xCont;
412  return true;
413 }
414 
415 bool ScPageHFItem::PutValue( const uno::Any& rVal, sal_uInt8 /* nMemberId */ )
416 {
417  bool bRet = false;
418  uno::Reference<sheet::XHeaderFooterContent> xContent;
419  if ( rVal >>= xContent )
420  {
421  if ( xContent.is() )
422  {
425  if (pImp.is())
426  {
427  const EditTextObject* pImpLeft = pImp->GetLeftEditObject();
428  pLeftArea.reset();
429  if (pImpLeft)
430  pLeftArea = pImpLeft->Clone();
431 
432  const EditTextObject* pImpCenter = pImp->GetCenterEditObject();
433  pCenterArea.reset();
434  if (pImpCenter)
435  pCenterArea = pImpCenter->Clone();
436 
437  const EditTextObject* pImpRight = pImp->GetRightEditObject();
438  pRightArea.reset();
439  if (pImpRight)
440  pRightArea = pImpRight->Clone();
441 
442  if ( !pLeftArea || !pCenterArea || !pRightArea )
443  {
444  // no Text with Null are left
445  ScEditEngineDefaulter aEngine( EditEngine::CreatePool().get(), true );
446  if (!pLeftArea)
447  pLeftArea = aEngine.CreateTextObject();
448  if (!pCenterArea)
449  pCenterArea = aEngine.CreateTextObject();
450  if (!pRightArea)
451  pRightArea = aEngine.CreateTextObject();
452  }
453 
454  bRet = true;
455  }
456  }
457  }
458 
459  if (!bRet)
460  {
461  OSL_FAIL("exception - wrong argument");
462  }
463 
464  return true;
465 }
466 
467 bool ScPageHFItem::operator==( const SfxPoolItem& rItem ) const
468 {
469  assert(SfxPoolItem::operator==(rItem));
470 
471  const ScPageHFItem& r = static_cast<const ScPageHFItem&>(rItem);
472 
473  return ScGlobal::EETextObjEqual(pLeftArea.get(), r.pLeftArea.get())
476 }
477 
479 {
480  return new ScPageHFItem( *this );
481 }
482 
484 {
485  pLeftArea = rNew.Clone();
486 }
487 
489 {
490  pCenterArea = rNew.Clone();
491 }
492 
494 {
495  pRightArea = rNew.Clone();
496 }
498 {
499  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScPageHFItem"));
500  GetLeftArea()->dumpAsXml(pWriter);
501  GetCenterArea()->dumpAsXml(pWriter);
502  GetRightArea()->dumpAsXml(pWriter);
503  (void)xmlTextWriterEndElement(pWriter);
504 }
505 
510  : SfxEnumItem( nWhichP, VOBJ_MODE_SHOW )
511 {
512 }
513 
515  : SfxEnumItem( nWhichP, eMode )
516 {
517 }
518 
520 {
521 }
522 
524 (
525  SfxItemPresentation ePres,
526  MapUnit /* eCoreUnit */,
527  MapUnit /* ePresUnit */,
528  OUString& rText,
529  const IntlWrapper& /* rIntl */
530 ) const
531 {
532  OUString aDel(": ");
533  rText.clear();
534 
535  switch ( ePres )
536  {
537  case SfxItemPresentation::Complete:
538  switch( Which() )
539  {
541  rText = ScResId(STR_VOBJ_CHART) + aDel;
542  break;
543 
545  rText = ScResId(STR_VOBJ_OBJECT) + aDel;
546  break;
547 
549  rText = ScResId(STR_VOBJ_DRAWINGS) + aDel;
550  break;
551 
552  default: break;
553  }
554  [[fallthrough]];
555  case SfxItemPresentation::Nameless:
556  if (GetValue() == VOBJ_MODE_SHOW)
557  rText += ScResId(STR_VOBJ_MODE_SHOW);
558  else
559  rText += ScResId(STR_VOBJ_MODE_HIDE);
560  return true;
561 
562  default: break;
563  // added to avoid warnings
564  }
565 
566  return false;
567 }
568 
570 {
571  return 2;
572 }
573 
575 {
576  return new ScViewObjectModeItem( *this );
577 }
578 
581  mnWidth( 0 ),
582  mnHeight( 0 )
583 {
584 }
585 
586 ScPageScaleToItem::ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight ) :
588  mnWidth( nWidth ),
589  mnHeight( nHeight )
590 {
591 }
592 
594 {
595 }
596 
598 {
599  return new ScPageScaleToItem( *this );
600 }
601 
603 {
604  assert(SfxPoolItem::operator==(rCmp));
605  const ScPageScaleToItem& rPageCmp = static_cast< const ScPageScaleToItem& >( rCmp );
606  return (mnWidth == rPageCmp.mnWidth) && (mnHeight == rPageCmp.mnHeight);
607 }
608 
609 namespace {
610 void lclAppendScalePageCount( OUString& rText, sal_uInt16 nPages )
611 {
612  rText += ": ";
613  if( nPages )
614  {
615  OUString aPages(ScResId(STR_SCATTR_PAGE_SCALE_PAGES, nPages));
616  rText += aPages.replaceFirst( "%1", OUString::number( nPages ) );
617  }
618  else
619  rText += ScResId( STR_SCATTR_PAGE_SCALE_AUTO );
620 }
621 } // namespace
622 
624  SfxItemPresentation ePres, MapUnit, MapUnit, OUString& rText, const IntlWrapper& ) const
625 {
626  rText.clear();
627  if( !IsValid())
628  return false;
629 
630  OUString aName( ScResId( STR_SCATTR_PAGE_SCALETO ) );
631  OUString aValue( ScResId( STR_SCATTR_PAGE_SCALE_WIDTH ) );
632  lclAppendScalePageCount( aValue, mnWidth );
633  aValue += ", " + ScResId( STR_SCATTR_PAGE_SCALE_HEIGHT );
634  lclAppendScalePageCount( aValue, mnHeight );
635 
636  switch( ePres )
637  {
638  case SfxItemPresentation::Nameless:
639  rText = aValue;
640  return true;
641 
642  case SfxItemPresentation::Complete:
643  rText = aName + " (" + aValue + ")";
644  return true;
645 
646  default:
647  OSL_FAIL( "ScPageScaleToItem::GetPresentation - unknown presentation mode" );
648  }
649  return false;
650 }
651 
652 bool ScPageScaleToItem::QueryValue( uno::Any& rAny, sal_uInt8 nMemberId ) const
653 {
654  bool bRet = true;
655  switch( nMemberId )
656  {
657  case SC_MID_PAGE_SCALETO_WIDTH: rAny <<= mnWidth; break;
658  case SC_MID_PAGE_SCALETO_HEIGHT: rAny <<= mnHeight; break;
659  default:
660  OSL_FAIL( "ScPageScaleToItem::QueryValue - unknown member ID" );
661  bRet = false;
662  }
663  return bRet;
664 }
665 
666 bool ScPageScaleToItem::PutValue( const uno::Any& rAny, sal_uInt8 nMemberId )
667 {
668  bool bRet = false;
669  switch( nMemberId )
670  {
671  case SC_MID_PAGE_SCALETO_WIDTH: bRet = rAny >>= mnWidth; break;
672  case SC_MID_PAGE_SCALETO_HEIGHT: bRet = rAny >>= mnHeight; break;
673  default:
674  OSL_FAIL( "ScPageScaleToItem::PutValue - unknown member ID" );
675  }
676  return bRet;
677 }
679 {
680  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScPageScaleToItem"));
681  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("width"), BAD_CAST(OString::number(GetWidth()).getStr()));
682  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("height"), BAD_CAST(OString::number(GetHeight()).getStr()));
683  (void)xmlTextWriterEndElement(pWriter);
684 }
685 
688 {
689 }
690 
693 {
694  maIndex.insert(nIndex);
695 }
696 
699  maIndex( rIndex )
700 {
701 }
702 
705  maIndex( std::move(aIndex) )
706 {
707 }
708 
710 {
711 }
712 
713 bool ScCondFormatItem::operator==( const SfxPoolItem& rCmp ) const
714 {
715  if (!SfxPoolItem::operator==(rCmp))
716  return false;
717  auto const & other = static_cast<const ScCondFormatItem&>(rCmp);
718  if (maIndex.empty() && other.maIndex.empty())
719  return true;
720  // memcmp is faster than operator== on std::vector
721  return maIndex.size() == other.maIndex.size()
722  && memcmp(&maIndex.front(), &other.maIndex.front(), maIndex.size() * sizeof(sal_uInt32)) == 0;
723 }
724 
725 bool ScCondFormatItem::operator<( const SfxPoolItem& rCmp ) const
726 {
727  auto const & other = static_cast<const ScCondFormatItem&>(rCmp);
728  if ( maIndex.size() < other.maIndex.size() )
729  return true;
730  if ( maIndex.size() > other.maIndex.size() )
731  return false;
732  if (maIndex.empty() && other.maIndex.empty())
733  return false;
734  // memcmp is faster than operator< on std::vector
735  // Note that on little-endian this results in a confusing ordering (256 < 1),
736  // which technically doesn't matter as the ordering may be arbitrary.
737  return memcmp(&maIndex.front(), &other.maIndex.front(), maIndex.size() * sizeof(sal_uInt32)) < 0;
738 }
739 
741 {
742  return new ScCondFormatItem(maIndex);
743 }
744 
746 {
747  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScCondFormatItem"));
748  for (const auto& nItem : maIndex)
749  {
750  std::string aStrVal = std::to_string(nItem);
751  (void)xmlTextWriterStartElement(pWriter, BAD_CAST(aStrVal.c_str()));
752  (void)xmlTextWriterEndElement(pWriter);
753  }
754  (void)xmlTextWriterEndElement(pWriter);
755 }
756 
759 {
760 }
761 
763 {
764  return new ScRotateValueItem(GetValue());
765 }
766 
768  MapUnit eCoreMetric, MapUnit ePresMetric,
769  OUString& rText,
770  const IntlWrapper& rWrapper) const
771 {
772  bool bRet = SdrAngleItem::GetPresentation(SfxItemPresentation::Nameless, eCoreMetric, ePresMetric, rText, rWrapper);
773  if (bRet && ePresentation == SfxItemPresentation::Complete)
774  rText = ScResId(STR_TEXTORIENTANGLE) + " " + rText;
775  return bRet;
776 }
777 
779  : SfxBoolItem(ATTR_SHRINKTOFIT, bShrink)
780 {
781 }
782 
784 {
785  return new ScShrinkToFitCell(GetValue());
786 }
787 
789  MapUnit, MapUnit,
790  OUString& rText,
791  const IntlWrapper&) const
792 {
793  TranslateId pId = GetValue() ? STR_SHRINKTOFITCELL_ON : STR_SHRINKTOFITCELL_OFF;
794  rText = ScResId(pId);
795  return true;
796 }
797 
799  : SfxBoolItem(ATTR_STACKED, bStack)
800 {
801 }
802 
804 {
805  return new ScVerticalStackCell(GetValue());
806 }
807 
809  MapUnit, MapUnit,
810  OUString& rText,
811  const IntlWrapper&) const
812 {
813  TranslateId pId = GetValue() ? STR_VERTICALSTACKCELL_ON : STR_VERTICALSTACKCELL_OFF;
814  rText = ScResId(pId);
815  return true;
816 }
817 
819  : SfxBoolItem(ATTR_LINEBREAK, bStack)
820 {
821 }
822 
824 {
825  return new ScLineBreakCell(GetValue());
826 }
827 
829  MapUnit, MapUnit,
830  OUString& rText,
831  const IntlWrapper&) const
832 {
833  TranslateId pId = GetValue() ? STR_LINEBREAKCELL_ON : STR_LINEBREAKCELL_OFF;
834  rText = ScResId(pId);
835  return true;
836 }
837 
839  : SfxBoolItem(ATTR_HYPHENATE, bHyphenate)
840 {
841 }
842 
844 {
845  return new ScHyphenateCell(GetValue());
846 }
847 
849  MapUnit, MapUnit,
850  OUString& rText,
851  const IntlWrapper&) const
852 {
853  TranslateId pId = GetValue() ? STR_HYPHENATECELL_ON : STR_HYPHENATECELL_OFF;
854  rText = ScResId(pId);
855  return true;
856 }
857 
858 ScIndentItem::ScIndentItem(sal_uInt16 nIndent)
859  : SfxUInt16Item(ATTR_INDENT, nIndent)
860 {
861 }
862 
864 {
865  return new ScIndentItem(GetValue());
866 }
867 
869  MapUnit eCoreUnit, MapUnit,
870  OUString& rText,
871  const IntlWrapper& rIntl) const
872 {
873  auto nValue = GetValue();
874 
875  switch (ePres)
876  {
877  case SfxItemPresentation::Complete:
878  rText = ScResId(STR_INDENTCELL);
879  [[fallthrough]];
880  case SfxItemPresentation::Nameless:
881  rText += GetMetricText( nValue, eCoreUnit, MapUnit::MapPoint, &rIntl ) +
882  " " + EditResId(GetMetricId(MapUnit::MapPoint));
883  return true;
884  default: ; //prevent warning
885  }
886  return false;
887 }
888 
889 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool GetValue() const
virtual ~ScCondFormatItem() override
Definition: attrib.cxx:709
virtual bool operator==(const SfxPoolItem &) const override
Definition: attrib.cxx:105
double mnHeight
sal_uInt16 GetHeight() const
Definition: attrib.hxx:243
SCCOL GetColMerge() const
Definition: attrib.hxx:68
std::unique_ptr< EditTextObject > pLeftArea
Definition: attrib.hxx:170
virtual ~ScPageHFItem() override
Definition: attrib.cxx:399
bool bHideFormula
hide formula
Definition: attrib.hxx:116
virtual ~ScMergeFlagAttr() override
Definition: attrib.cxx:139
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
ScPageScaleToItem()
Default c'tor sets the width and height to 0.
Definition: attrib.cxx:579
static bool EETextObjEqual(const EditTextObject *pObj1, const EditTextObject *pObj2)
Definition: global.cxx:758
struct _xmlTextWriter * xmlTextWriterPtr
bool HasPivotPopupButton() const
Definition: attrib.cxx:153
#define MID_2
Definition: mid.h:24
ScVerticalStackCell(bool bStack=false)
Definition: attrib.cxx:798
virtual bool operator==(const SfxPoolItem &) const =0
std::string GetValue
bool bHideCell
hide cell
Definition: attrib.hxx:117
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const override
ScMergeFlagAttr * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:143
ScLineBreakCell(bool bLineBreak=false)
Definition: attrib.cxx:818
virtual bool QueryValue(css::uno::Any &rAny, sal_uInt8 nMemberId=0) const override
Definition: attrib.cxx:652
ScMF GetValue() const
Definition: attrib.hxx:97
const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH
Member ID for "page scale to width" value in QueryValue() and PutValue().
Definition: attrib.hxx:219
const EditTextObject * GetCenterArea() const
Definition: attrib.hxx:186
bool IsOverlapped() const
Definition: attrib.hxx:101
bool HasPivotButton() const
Definition: attrib.cxx:148
ScProtectionAttr()
Protection.
Definition: attrib.cxx:174
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:808
sal_uInt16 GetValue() const
#define MID_4
Definition: mid.h:26
virtual ScShrinkToFitCell * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:783
void SetHidePrint(bool bHPrint)
Definition: attrib.cxx:365
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: attrib.cxx:117
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
const sal_uInt8 SC_MID_PAGE_SCALETO_HEIGHT
Member ID for "page scale to height" value in QueryValue() and PutValue().
Definition: attrib.hxx:221
void SetProtection(bool bProtect)
Definition: attrib.cxx:350
ScShrinkToFitCell(bool bShrink=false)
Definition: attrib.cxx:778
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
constexpr TypedWhichId< ScIndentItem > ATTR_INDENT(131)
const Value & front() const
void SetLeftArea(const EditTextObject &rNew)
Definition: attrib.cxx:483
OUString GetValueText() const
Definition: attrib.cxx:276
static rtl::Reference< SfxItemPool > CreatePool()
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
SCROW nRowMerge
Definition: attrib.hxx:58
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: attrib.cxx:158
sal_uInt16 mnWidth
Definition: attrib.hxx:261
bool IsValid() const
Definition: attrib.hxx:244
void SetCenterArea(const EditTextObject &rNew)
Definition: attrib.cxx:488
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:828
ScCondFormatIndexes maIndex
Definition: attrib.hxx:287
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: attrib.cxx:403
TranslateId GetMetricId(MapUnit eUnit)
constexpr TypedWhichId< ScShrinkToFitCell > ATTR_SHRINKTOFIT(140)
virtual ScVerticalStackCell * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:803
#define SID_SCATTR_PAGE_OBJECTS
Definition: scitems.hxx:216
virtual ScPageHFItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:478
static SfxPoolItem * CreateDefault()
Definition: attrib.cxx:44
size_type size() const
static rtl::Reference< ScHeaderFooterContentObj > getImplementation(const css::uno::Reference< css::sheet::XHeaderFooterContent > &rObj)
Definition: textuno.cxx:147
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:295
virtual ScLineBreakCell * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:823
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: attrib.cxx:678
bool GetHideCell() const
Definition: attrib.hxx:147
sal_uInt16 GetWidth() const
Definition: attrib.hxx:242
bool IsVerOverlapped() const
Definition: attrib.hxx:100
SfxItemPresentation
ScMergeFlagAttr()
MergeFlag.
Definition: attrib.cxx:129
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: attrib.cxx:206
virtual ScProtectionAttr * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:345
bool bProtection
protect cell
Definition: attrib.hxx:115
ScRotateValueItem(Degree100 nAngle)
Definition: attrib.cxx:757
virtual ~ScProtectionAttr() override
Definition: attrib.cxx:202
virtual bool operator<(const SfxPoolItem &rCmp) const override
Definition: attrib.cxx:725
virtual bool PutValue(const css::uno::Any &rAny, sal_uInt8 nMemberId) override
Definition: attrib.cxx:666
sal_Int16 SCCOL
Definition: types.hxx:21
bool ScHasPriority(const ::editeng::SvxBorderLine *pThis, const ::editeng::SvxBorderLine *pOther)
General Help Function.
Definition: attrib.cxx:49
bool GetHideFormula() const
Definition: attrib.hxx:145
virtual ScIndentItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:863
autofilter arrow
#define MID_3
Definition: mid.h:25
OUString GetMetricText(tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper *pIntl)
std::unique_ptr< EditTextObject > CreateTextObject()
ScHyphenateCell(bool bHyphenate=false)
Definition: attrib.cxx:838
virtual ~ScViewObjectModeItem() override
Definition: attrib.cxx:519
virtual ScHyphenateCell * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:843
void SetRightArea(const EditTextObject &rNew)
Definition: attrib.cxx:493
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
bool empty() const
std::unique_ptr< EditTextObject > pRightArea
Definition: attrib.hxx:172
bool GetHidePrint() const
Definition: attrib.hxx:149
std::unique_ptr< EditTextObject > pCenterArea
Definition: attrib.hxx:171
sal_uInt16 mnHeight
Definition: attrib.hxx:262
constexpr TypedWhichId< ScPageScaleToItem > ATTR_PAGE_SCALETO(188)
constexpr TypedWhichId< ScHyphenateCell > ATTR_HYPHENATE(125)
bool IsMerged() const
Definition: attrib.hxx:71
bool IsHorOverlapped() const
Definition: attrib.hxx:99
ScIndentItem(sal_uInt16 nIndent=0)
Definition: attrib.cxx:858
ScPageHFItem(sal_uInt16 nWhich)
ScPageHFItem - Dates from the Head and Foot lines.
Definition: attrib.cxx:383
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
sal_Int32 SCROW
Definition: types.hxx:17
#define MID_1
Definition: mid.h:23
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: attrib.cxx:415
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: attrib.cxx:370
ScMF
Definition: attrib.hxx:34
virtual ScRotateValueItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:762
void SetHideCell(bool bHCell)
Definition: attrib.cxx:360
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:224
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const =0
unsigned char sal_uInt8
virtual bool operator==(const SfxPoolItem &rCmp) const override
Definition: attrib.cxx:713
const EditTextObject * GetRightArea() const
Definition: attrib.hxx:187
const EditTextObject * GetLeftArea() const
Definition: attrib.hxx:185
#define SID_SCATTR_PAGE_DRAWINGS
Definition: scitems.hxx:217
bool GetProtection() const
Definition: attrib.hxx:143
void SetHideFormula(bool bHFormula)
Definition: attrib.cxx:355
OUString aName
double mnWidth
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: attrib.cxx:497
virtual std::unique_ptr< EditTextObject > Clone() const =0
virtual ~ScPageScaleToItem() override
Definition: attrib.cxx:593
Degree100 GetValue() const
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: attrib.cxx:237
SCCOL nColMerge
Definition: attrib.hxx:57
virtual ~ScMergeAttr() override
Definition: attrib.cxx:101
virtual bool operator==(const SfxPoolItem &) const override
Definition: attrib.cxx:467
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:767
virtual ScCondFormatItem * Clone(SfxItemPool *=nullptr) const override
Definition: attrib.cxx:740
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:524
::rtl::Reference< OContentHelper > xContent
ScVObjMode
Definition: global.hxx:365
virtual bool operator==(const SfxPoolItem &) const override
Definition: attrib.cxx:336
bool bHidePrint
don't print cell
Definition: attrib.hxx:118
MapUnit
SCROW GetRowMerge() const
Definition: attrib.hxx:69
virtual bool operator==(const SfxPoolItem &rCmp) const override
Definition: attrib.cxx:602
bool IsScenario() const
Definition: attrib.hxx:105
bool HasAutoFilter() const
Definition: attrib.hxx:103
ScMergeAttr()
Item - Implementations.
Definition: attrib.cxx:82
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:868
std::pair< const_iterator, bool > insert(Value &&x)
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:848
#define SID_SCATTR_PAGE_CHARTS
Definition: scitems.hxx:215
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: attrib.cxx:745
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
Definition: attrib.cxx:788
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
Definition: attrib.cxx:623
virtual ScViewObjectModeItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:574
virtual ScPageScaleToItem * Clone(SfxItemPool *=nullptr) const override
Definition: attrib.cxx:597
virtual ScMergeAttr * Clone(SfxItemPool *pPool=nullptr) const override
Definition: attrib.cxx:112
ScViewObjectModeItem(sal_uInt16 nWhich)
ScViewObjectModeItem - Display Mode of View Objects.
Definition: attrib.cxx:509
sal_Int16 nValue
bool m_bDetectedRangeSegmentation false
virtual sal_uInt16 GetValueCount() const override
Definition: attrib.cxx:569
#define CONVERT_TWIPS
OUString EditResId(TranslateId aId)
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo