1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/util/CellProtection.hpp>
22 #include <scitems.hxx>
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>
31 #include <libxml/xmlwriter.h>
35 #include <editutil.hxx>
37 #include <globstr.hrc>
38 #include <scresid.hxx>
39 #include <textuno.hxx>
41 using namespace com::sun::star
;
44 SfxPoolItem
* ScProtectionAttr::CreateDefault() { return new ScProtectionAttr
; }
47 * General Help Function
49 bool ScHasPriority( const ::editeng::SvxBorderLine
* pThis
, const ::editeng::SvxBorderLine
* pOther
)
57 sal_uInt16 nThisSize
= pThis
->GetScaledWidth();
58 sal_uInt16 nOtherSize
= pOther
->GetScaledWidth();
60 if (nThisSize
> nOtherSize
)
62 else if (nThisSize
< nOtherSize
)
66 if ( pOther
->GetInWidth() && !pThis
->GetInWidth() )
68 else if ( pThis
->GetInWidth() && !pOther
->GetInWidth() )
72 return true; // FIXME: What is this?
77 /** Item - Implementations */
82 ScMergeAttr::ScMergeAttr():
83 SfxPoolItem(ATTR_MERGE
, SfxItemType::ScMergeAttrType
),
88 ScMergeAttr::ScMergeAttr( SCCOL nCol
, SCROW nRow
):
89 SfxPoolItem(ATTR_MERGE
, SfxItemType::ScMergeAttrType
),
94 ScMergeAttr::ScMergeAttr(const ScMergeAttr
& rItem
):
95 SfxPoolItem(ATTR_MERGE
, SfxItemType::ScMergeAttrType
)
97 nColMerge
= rItem
.nColMerge
;
98 nRowMerge
= rItem
.nRowMerge
;
101 ScMergeAttr::~ScMergeAttr()
105 bool ScMergeAttr::operator==( const SfxPoolItem
& rItem
) const
107 return SfxPoolItem::operator==(rItem
)
108 && (nColMerge
== static_cast<const ScMergeAttr
&>(rItem
).nColMerge
)
109 && (nRowMerge
== static_cast<const ScMergeAttr
&>(rItem
).nRowMerge
);
112 ScMergeAttr
* ScMergeAttr::Clone( SfxItemPool
* ) const
114 return new ScMergeAttr(*this);
117 void ScMergeAttr::dumpAsXml(xmlTextWriterPtr pWriter
) const
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
);
129 ScMergeFlagAttr::ScMergeFlagAttr():
130 SfxInt16Item(ATTR_MERGE_FLAG
, 0)
134 ScMergeFlagAttr::ScMergeFlagAttr(ScMF nFlags
):
135 SfxInt16Item(ATTR_MERGE_FLAG
, static_cast<sal_Int16
>(nFlags
))
139 ScMergeFlagAttr::~ScMergeFlagAttr()
143 ScMergeFlagAttr
* ScMergeFlagAttr::Clone(SfxItemPool
*) const
145 return new ScMergeFlagAttr(*this);
148 bool ScMergeFlagAttr::HasPivotButton() const
150 return bool(GetValue() & ScMF::Button
);
153 bool ScMergeFlagAttr::HasPivotPopupButton() const
155 return bool(GetValue() & ScMF::ButtonPopup
);
158 bool ScMergeFlagAttr::HasPivotToggle() const
160 auto nFlags
= GetValue();
161 return (nFlags
& ScMF::DpCollapse
) || (nFlags
& ScMF::DpExpand
);
164 bool ScMergeFlagAttr::HasPivotMultiFieldPopupButton() const
166 return bool(GetValue() & ScMF::ButtonPopup2
);
169 void ScMergeFlagAttr::dumpAsXml(xmlTextWriterPtr pWriter
) const
171 (void)xmlTextWriterStartElement(pWriter
, BAD_CAST("ScMergeFlagAttr"));
172 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("overlapped"), BAD_CAST(OString::boolean(IsOverlapped()).getStr()));
173 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("hor_overlapped"), BAD_CAST(OString::boolean(IsHorOverlapped()).getStr()));
174 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("ver_overlapped"), BAD_CAST(OString::boolean(IsVerOverlapped()).getStr()));
175 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("autofilter"), BAD_CAST(OString::boolean(HasAutoFilter()).getStr()));
176 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("scenario"), BAD_CAST(OString::boolean(IsScenario()).getStr()));
177 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("pivot-button"), BAD_CAST(OString::boolean(HasPivotButton()).getStr()));
178 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("pivot-popup-button"), BAD_CAST(OString::boolean(HasPivotPopupButton()).getStr()));
179 (void)xmlTextWriterEndElement(pWriter
);
185 ScProtectionAttr::ScProtectionAttr():
186 SfxPoolItem(ATTR_PROTECTION
, SfxItemType::ScProtectionAttrType
),
194 ScProtectionAttr::ScProtectionAttr( bool bProtect
, bool bHFormula
,
195 bool bHCell
, bool bHPrint
):
196 SfxPoolItem(ATTR_PROTECTION
, SfxItemType::ScProtectionAttrType
),
197 bProtection(bProtect
),
198 bHideFormula(bHFormula
),
204 ScProtectionAttr::ScProtectionAttr(const ScProtectionAttr
& rItem
):
205 SfxPoolItem(ATTR_PROTECTION
, SfxItemType::ScProtectionAttrType
)
207 bProtection
= rItem
.bProtection
;
208 bHideFormula
= rItem
.bHideFormula
;
209 bHideCell
= rItem
.bHideCell
;
210 bHidePrint
= rItem
.bHidePrint
;
213 ScProtectionAttr::~ScProtectionAttr()
217 bool ScProtectionAttr::QueryValue( uno::Any
& rVal
, sal_uInt8 nMemberId
) const
219 nMemberId
&= ~CONVERT_TWIPS
;
224 util::CellProtection aProtection
;
225 aProtection
.IsLocked
= bProtection
;
226 aProtection
.IsFormulaHidden
= bHideFormula
;
227 aProtection
.IsHidden
= bHideCell
;
228 aProtection
.IsPrintHidden
= bHidePrint
;
229 rVal
<<= aProtection
;
233 rVal
<<= bProtection
; break;
235 rVal
<<= bHideFormula
; break;
237 rVal
<<= bHideCell
; break;
239 rVal
<<= bHidePrint
; break;
241 OSL_FAIL("Wrong MemberID!");
248 bool ScProtectionAttr::PutValue( const uno::Any
& rVal
, sal_uInt8 nMemberId
)
252 nMemberId
&= ~CONVERT_TWIPS
;
257 util::CellProtection aProtection
;
258 if ( rVal
>>= aProtection
)
260 bProtection
= aProtection
.IsLocked
;
261 bHideFormula
= aProtection
.IsFormulaHidden
;
262 bHideCell
= aProtection
.IsHidden
;
263 bHidePrint
= aProtection
.IsPrintHidden
;
268 OSL_FAIL("exception - wrong argument");
273 bRet
= (rVal
>>= bVal
); if (bRet
) bProtection
=bVal
; break;
275 bRet
= (rVal
>>= bVal
); if (bRet
) bHideFormula
=bVal
; break;
277 bRet
= (rVal
>>= bVal
); if (bRet
) bHideCell
=bVal
; break;
279 bRet
= (rVal
>>= bVal
); if (bRet
) bHidePrint
=bVal
; break;
281 OSL_FAIL("Wrong MemberID!");
287 OUString
ScProtectionAttr::GetValueText() const
289 const OUString
aStrYes ( ScResId(STR_YES
) );
290 const OUString
aStrNo ( ScResId(STR_NO
) );
292 const OUString aValue
= "("
293 + (bProtection
? aStrYes
: aStrNo
)
295 + (bHideFormula
? aStrYes
: aStrNo
)
297 + (bHideCell
? aStrYes
: aStrNo
)
299 + (bHidePrint
? aStrYes
: aStrNo
)
305 bool ScProtectionAttr::GetPresentation
307 SfxItemPresentation ePres
,
308 MapUnit
/* eCoreMetric */,
309 MapUnit
/* ePresMetric */,
311 const IntlWrapper
& /* rIntl */
314 const OUString
aStrYes ( ScResId(STR_YES
) );
315 const OUString
aStrNo ( ScResId(STR_NO
) );
319 case SfxItemPresentation::Nameless
:
320 rText
= GetValueText();
323 case SfxItemPresentation::Complete
:
324 rText
= ScResId(STR_PROTECTION
)
326 + (bProtection
? aStrYes
: aStrNo
)
328 + ScResId(STR_FORMULAS
)
330 + (!bHideFormula
? aStrYes
: aStrNo
)
334 + (bHideCell
? aStrYes
: aStrNo
)
338 + (!bHidePrint
? aStrYes
: aStrNo
);
347 bool ScProtectionAttr::operator==( const SfxPoolItem
& rItem
) const
349 return SfxPoolItem::operator==(rItem
)
350 && (bProtection
== static_cast<const ScProtectionAttr
&>(rItem
).bProtection
)
351 && (bHideFormula
== static_cast<const ScProtectionAttr
&>(rItem
).bHideFormula
)
352 && (bHideCell
== static_cast<const ScProtectionAttr
&>(rItem
).bHideCell
)
353 && (bHidePrint
== static_cast<const ScProtectionAttr
&>(rItem
).bHidePrint
);
356 ScProtectionAttr
* ScProtectionAttr::Clone( SfxItemPool
* ) const
358 return new ScProtectionAttr(*this);
361 void ScProtectionAttr::SetProtection( bool bProtect
)
363 bProtection
= bProtect
;
366 void ScProtectionAttr::SetHideFormula( bool bHFormula
)
368 bHideFormula
= bHFormula
;
371 void ScProtectionAttr::SetHideCell( bool bHCell
)
376 void ScProtectionAttr::SetHidePrint( bool bHPrint
)
378 bHidePrint
= bHPrint
;
381 void ScProtectionAttr::dumpAsXml(xmlTextWriterPtr pWriter
) const
383 (void)xmlTextWriterStartElement(pWriter
, BAD_CAST("ScProtectionAttr"));
384 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("protection"), BAD_CAST(OString::boolean(GetProtection()).getStr()));
385 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("hide-formula"), BAD_CAST(OString::boolean(GetHideFormula()).getStr()));
386 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("hide-cell"), BAD_CAST(OString::boolean(GetHideCell()).getStr()));
387 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("hide-print"), BAD_CAST(OString::boolean(GetHidePrint()).getStr()));
388 (void)xmlTextWriterEndElement(pWriter
);
392 * ScPageHFItem - Dates from the Head and Foot lines
394 ScPageHFItem::ScPageHFItem( sal_uInt16 nWhichP
)
395 : SfxPoolItem( nWhichP
, SfxItemType::ScPageHFItemType
)
399 ScPageHFItem::ScPageHFItem( const ScPageHFItem
& rItem
)
400 : SfxPoolItem ( rItem
)
402 if ( rItem
.pLeftArea
)
403 pLeftArea
= rItem
.pLeftArea
->Clone();
404 if ( rItem
.pCenterArea
)
405 pCenterArea
= rItem
.pCenterArea
->Clone();
406 if ( rItem
.pRightArea
)
407 pRightArea
= rItem
.pRightArea
->Clone();
410 ScPageHFItem::~ScPageHFItem()
414 bool ScPageHFItem::QueryValue( uno::Any
& rVal
, sal_uInt8
/* nMemberId */ ) const
416 rtl::Reference
<ScHeaderFooterContentObj
> xContent
=
417 new ScHeaderFooterContentObj();
418 xContent
->Init(pLeftArea
.get(), pCenterArea
.get(), pRightArea
.get());
420 uno::Reference
<sheet::XHeaderFooterContent
> xCont(xContent
);
426 bool ScPageHFItem::PutValue( const uno::Any
& rVal
, sal_uInt8
/* nMemberId */ )
429 uno::Reference
<sheet::XHeaderFooterContent
> xContent
;
430 if ( rVal
>>= xContent
)
434 rtl::Reference
<ScHeaderFooterContentObj
> pImp
=
435 ScHeaderFooterContentObj::getImplementation( xContent
);
438 const EditTextObject
* pImpLeft
= pImp
->GetLeftEditObject();
441 pLeftArea
= pImpLeft
->Clone();
443 const EditTextObject
* pImpCenter
= pImp
->GetCenterEditObject();
446 pCenterArea
= pImpCenter
->Clone();
448 const EditTextObject
* pImpRight
= pImp
->GetRightEditObject();
451 pRightArea
= pImpRight
->Clone();
453 if ( !pLeftArea
|| !pCenterArea
|| !pRightArea
)
455 // no Text with Null are left
456 ScEditEngineDefaulter
aEngine( EditEngine::CreatePool().get(), true );
458 pLeftArea
= aEngine
.CreateTextObject();
460 pCenterArea
= aEngine
.CreateTextObject();
462 pRightArea
= aEngine
.CreateTextObject();
472 OSL_FAIL("exception - wrong argument");
478 bool ScPageHFItem::operator==( const SfxPoolItem
& rItem
) const
480 assert(SfxPoolItem::operator==(rItem
));
482 const ScPageHFItem
& r
= static_cast<const ScPageHFItem
&>(rItem
);
484 return ScGlobal::EETextObjEqual(pLeftArea
.get(), r
.pLeftArea
.get())
485 && ScGlobal::EETextObjEqual(pCenterArea
.get(), r
.pCenterArea
.get())
486 && ScGlobal::EETextObjEqual(pRightArea
.get(), r
.pRightArea
.get());
489 ScPageHFItem
* ScPageHFItem::Clone( SfxItemPool
* ) const
491 return new ScPageHFItem( *this );
494 void ScPageHFItem::SetLeftArea( const EditTextObject
& rNew
)
496 pLeftArea
= rNew
.Clone();
499 void ScPageHFItem::SetCenterArea( const EditTextObject
& rNew
)
501 pCenterArea
= rNew
.Clone();
504 void ScPageHFItem::SetRightArea( const EditTextObject
& rNew
)
506 pRightArea
= rNew
.Clone();
508 void ScPageHFItem::dumpAsXml(xmlTextWriterPtr pWriter
) const
510 (void)xmlTextWriterStartElement(pWriter
, BAD_CAST("ScPageHFItem"));
511 GetLeftArea()->dumpAsXml(pWriter
);
512 GetCenterArea()->dumpAsXml(pWriter
);
513 GetRightArea()->dumpAsXml(pWriter
);
514 (void)xmlTextWriterEndElement(pWriter
);
518 * ScViewObjectModeItem - Display Mode of View Objects
520 ScViewObjectModeItem::ScViewObjectModeItem( sal_uInt16 nWhichP
)
521 : SfxEnumItem( nWhichP
, SfxItemType::ScViewObjectModeItemType
, VOBJ_MODE_SHOW
)
525 ScViewObjectModeItem::ScViewObjectModeItem( sal_uInt16 nWhichP
, ScVObjMode eMode
)
526 : SfxEnumItem( nWhichP
, SfxItemType::ScViewObjectModeItemType
, eMode
)
530 ScViewObjectModeItem::~ScViewObjectModeItem()
534 bool ScViewObjectModeItem::GetPresentation
536 SfxItemPresentation ePres
,
537 MapUnit
/* eCoreUnit */,
538 MapUnit
/* ePresUnit */,
540 const IntlWrapper
& /* rIntl */
543 OUString
aDel(u
": "_ustr
);
548 case SfxItemPresentation::Complete
:
551 case SID_SCATTR_PAGE_CHARTS
:
552 rText
= ScResId(STR_VOBJ_CHART
) + aDel
;
555 case SID_SCATTR_PAGE_OBJECTS
:
556 rText
= ScResId(STR_VOBJ_OBJECT
) + aDel
;
559 case SID_SCATTR_PAGE_DRAWINGS
:
560 rText
= ScResId(STR_VOBJ_DRAWINGS
) + aDel
;
566 case SfxItemPresentation::Nameless
:
567 if (GetValue() == VOBJ_MODE_SHOW
)
568 rText
+= ScResId(STR_VOBJ_MODE_SHOW
);
570 rText
+= ScResId(STR_VOBJ_MODE_HIDE
);
574 // added to avoid warnings
580 sal_uInt16
ScViewObjectModeItem::GetValueCount() const
585 ScViewObjectModeItem
* ScViewObjectModeItem::Clone( SfxItemPool
* ) const
587 return new ScViewObjectModeItem( *this );
590 ScPageScaleToItem::ScPageScaleToItem() :
591 SfxPoolItem( ATTR_PAGE_SCALETO
, SfxItemType::ScPageScaleToItemType
),
597 ScPageScaleToItem::ScPageScaleToItem( sal_uInt16 nWidth
, sal_uInt16 nHeight
) :
598 SfxPoolItem( ATTR_PAGE_SCALETO
, SfxItemType::ScPageScaleToItemType
),
604 ScPageScaleToItem::~ScPageScaleToItem()
608 ScPageScaleToItem
* ScPageScaleToItem::Clone( SfxItemPool
* ) const
610 return new ScPageScaleToItem( *this );
613 bool ScPageScaleToItem::operator==( const SfxPoolItem
& rCmp
) const
615 assert(SfxPoolItem::operator==(rCmp
));
616 const ScPageScaleToItem
& rPageCmp
= static_cast< const ScPageScaleToItem
& >( rCmp
);
617 return (mnWidth
== rPageCmp
.mnWidth
) && (mnHeight
== rPageCmp
.mnHeight
);
621 void lclAppendScalePageCount( OUString
& rText
, sal_uInt16 nPages
)
626 OUString
aPages(ScResId(STR_SCATTR_PAGE_SCALE_PAGES
, nPages
));
627 rText
+= aPages
.replaceFirst( "%1", OUString::number( nPages
) );
630 rText
+= ScResId( STR_SCATTR_PAGE_SCALE_AUTO
);
634 bool ScPageScaleToItem::GetPresentation(
635 SfxItemPresentation ePres
, MapUnit
, MapUnit
, OUString
& rText
, const IntlWrapper
& ) const
641 OUString
aName( ScResId( STR_SCATTR_PAGE_SCALETO
) );
642 OUString
aValue( ScResId( STR_SCATTR_PAGE_SCALE_WIDTH
) );
643 lclAppendScalePageCount( aValue
, mnWidth
);
644 aValue
+= ", " + ScResId( STR_SCATTR_PAGE_SCALE_HEIGHT
);
645 lclAppendScalePageCount( aValue
, mnHeight
);
649 case SfxItemPresentation::Nameless
:
653 case SfxItemPresentation::Complete
:
654 rText
= aName
+ " (" + aValue
+ ")";
658 OSL_FAIL( "ScPageScaleToItem::GetPresentation - unknown presentation mode" );
663 bool ScPageScaleToItem::QueryValue( uno::Any
& rAny
, sal_uInt8 nMemberId
) const
668 case SC_MID_PAGE_SCALETO_WIDTH
: rAny
<<= mnWidth
; break;
669 case SC_MID_PAGE_SCALETO_HEIGHT
: rAny
<<= mnHeight
; break;
671 OSL_FAIL( "ScPageScaleToItem::QueryValue - unknown member ID" );
677 bool ScPageScaleToItem::PutValue( const uno::Any
& rAny
, sal_uInt8 nMemberId
)
682 case SC_MID_PAGE_SCALETO_WIDTH
: bRet
= rAny
>>= mnWidth
; break;
683 case SC_MID_PAGE_SCALETO_HEIGHT
: bRet
= rAny
>>= mnHeight
; break;
685 OSL_FAIL( "ScPageScaleToItem::PutValue - unknown member ID" );
689 void ScPageScaleToItem::dumpAsXml(xmlTextWriterPtr pWriter
) const
691 (void)xmlTextWriterStartElement(pWriter
, BAD_CAST("ScPageScaleToItem"));
692 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("width"), BAD_CAST(OString::number(GetWidth()).getStr()));
693 (void)xmlTextWriterWriteAttribute(pWriter
, BAD_CAST("height"), BAD_CAST(OString::number(GetHeight()).getStr()));
694 (void)xmlTextWriterEndElement(pWriter
);
697 ScCondFormatItem::ScCondFormatItem():
698 SfxPoolItem( ATTR_CONDITIONAL
, SfxItemType::ScCondFormatItemType
)
702 ScCondFormatItem::ScCondFormatItem( sal_uInt32 nIndex
):
703 SfxPoolItem( ATTR_CONDITIONAL
, SfxItemType::ScCondFormatItemType
)
705 maIndex
.insert(nIndex
);
708 ScCondFormatItem::ScCondFormatItem( const ScCondFormatIndexes
& rIndex
):
709 SfxPoolItem( ATTR_CONDITIONAL
, SfxItemType::ScCondFormatItemType
),
714 ScCondFormatItem::ScCondFormatItem( ScCondFormatIndexes
&& aIndex
) noexcept
:
715 SfxPoolItem( ATTR_CONDITIONAL
, SfxItemType::ScCondFormatItemType
),
716 maIndex( std::move(aIndex
) )
720 ScCondFormatItem::~ScCondFormatItem()
724 bool ScCondFormatItem::operator==( const SfxPoolItem
& rCmp
) const
726 if (!SfxPoolItem::operator==(rCmp
))
728 auto const & other
= static_cast<const ScCondFormatItem
&>(rCmp
);
729 if (maIndex
.empty() && other
.maIndex
.empty())
731 // memcmp is faster than operator== on std::vector
732 return maIndex
.size() == other
.maIndex
.size()
733 && memcmp(&maIndex
.front(), &other
.maIndex
.front(), maIndex
.size() * sizeof(sal_uInt32
)) == 0;
736 ScCondFormatItem
* ScCondFormatItem::Clone(SfxItemPool
*) const
738 return new ScCondFormatItem(maIndex
);
741 void ScCondFormatItem::dumpAsXml(xmlTextWriterPtr pWriter
) const
743 (void)xmlTextWriterStartElement(pWriter
, BAD_CAST("ScCondFormatItem"));
744 for (const auto& nItem
: maIndex
)
746 std::string aStrVal
= std::to_string(nItem
);
747 (void)xmlTextWriterStartElement(pWriter
, BAD_CAST(aStrVal
.c_str()));
748 (void)xmlTextWriterEndElement(pWriter
);
750 (void)xmlTextWriterEndElement(pWriter
);
753 ScRotateValueItem::ScRotateValueItem(Degree100 nAngle
)
754 : SdrAngleItem(ATTR_ROTATE_VALUE
, nAngle
, SfxItemType::ScRotateValueItemType
)
758 ScRotateValueItem
* ScRotateValueItem::Clone(SfxItemPool
*) const
760 return new ScRotateValueItem(GetValue());
763 bool ScRotateValueItem::GetPresentation(SfxItemPresentation ePresentation
,
764 MapUnit eCoreMetric
, MapUnit ePresMetric
,
766 const IntlWrapper
& rWrapper
) const
768 bool bRet
= SdrAngleItem::GetPresentation(SfxItemPresentation::Nameless
, eCoreMetric
, ePresMetric
, rText
, rWrapper
);
769 if (bRet
&& ePresentation
== SfxItemPresentation::Complete
)
770 rText
= ScResId(STR_TEXTORIENTANGLE
) + " " + rText
;
774 ScShrinkToFitCell::ScShrinkToFitCell(bool bShrink
)
775 : SfxBoolItem(ATTR_SHRINKTOFIT
, bShrink
, SfxItemType::ScShrinkToFitCellType
)
779 ScShrinkToFitCell
* ScShrinkToFitCell::Clone(SfxItemPool
*) const
781 return new ScShrinkToFitCell(GetValue());
784 bool ScShrinkToFitCell::GetPresentation(SfxItemPresentation
,
787 const IntlWrapper
&) const
789 TranslateId pId
= GetValue() ? STR_SHRINKTOFITCELL_ON
: STR_SHRINKTOFITCELL_OFF
;
790 rText
= ScResId(pId
);
794 ScVerticalStackCell::ScVerticalStackCell(bool bStack
)
795 : SfxBoolItem(ATTR_STACKED
, bStack
, SfxItemType::ScVerticalStackCellType
)
799 ScVerticalStackCell
* ScVerticalStackCell::Clone(SfxItemPool
*) const
801 return new ScVerticalStackCell(GetValue());
804 bool ScVerticalStackCell::GetPresentation(SfxItemPresentation
,
807 const IntlWrapper
&) const
809 TranslateId pId
= GetValue() ? STR_VERTICALSTACKCELL_ON
: STR_VERTICALSTACKCELL_OFF
;
810 rText
= ScResId(pId
);
814 ScLineBreakCell::ScLineBreakCell(bool bStack
)
815 : SfxBoolItem(ATTR_LINEBREAK
, bStack
, SfxItemType::ScLineBreakCellType
)
819 ScLineBreakCell
* ScLineBreakCell::Clone(SfxItemPool
*) const
821 return new ScLineBreakCell(GetValue());
824 bool ScLineBreakCell::GetPresentation(SfxItemPresentation
,
827 const IntlWrapper
&) const
829 TranslateId pId
= GetValue() ? STR_LINEBREAKCELL_ON
: STR_LINEBREAKCELL_OFF
;
830 rText
= ScResId(pId
);
834 ScHyphenateCell::ScHyphenateCell(bool bHyphenate
)
835 : SfxBoolItem(ATTR_HYPHENATE
, bHyphenate
, SfxItemType::ScHyphenateCellType
)
839 ScHyphenateCell
* ScHyphenateCell::Clone(SfxItemPool
*) const
841 return new ScHyphenateCell(GetValue());
844 bool ScHyphenateCell::GetPresentation(SfxItemPresentation
,
847 const IntlWrapper
&) const
849 TranslateId pId
= GetValue() ? STR_HYPHENATECELL_ON
: STR_HYPHENATECELL_OFF
;
850 rText
= ScResId(pId
);
854 ScIndentItem::ScIndentItem(sal_uInt16 nIndent
)
855 : SfxUInt16Item(ATTR_INDENT
, nIndent
, SfxItemType::ScIndentItemType
)
859 ScIndentItem
* ScIndentItem::Clone(SfxItemPool
*) const
861 return new ScIndentItem(GetValue());
864 bool ScIndentItem::GetPresentation(SfxItemPresentation ePres
,
865 MapUnit eCoreUnit
, MapUnit
,
867 const IntlWrapper
& rIntl
) const
869 auto nValue
= GetValue();
873 case SfxItemPresentation::Complete
:
874 rText
= ScResId(STR_INDENTCELL
);
876 case SfxItemPresentation::Nameless
:
877 rText
+= GetMetricText( nValue
, eCoreUnit
, MapUnit::MapPoint
, &rIntl
) +
878 " " + EditResId(GetMetricId(MapUnit::MapPoint
));
880 default: ; //prevent warning
885 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */