20 #include <com/sun/star/util/CellProtection.hpp>
24 #include <editeng/editeng.hxx>
30 #include <libxml/xmlwriter.h>
36 #include <globstr.hrc>
48 bool ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther )
56 sal_uInt16 nThisSize = pThis->GetScaledWidth();
57 sal_uInt16 nOtherSize = pOther->GetScaledWidth();
59 if (nThisSize > nOtherSize)
61 else if (nThisSize < nOtherSize)
65 if ( pOther->GetInWidth() && !pThis->GetInWidth() )
67 else if ( pThis->GetInWidth() && !pOther->GetInWidth() )
118 xmlTextWriterStartElement(pWriter, BAD_CAST(
"ScMergeAttr"));
119 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"col-merge"), BAD_CAST(OString::number(
GetColMerge()).getStr()));
120 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"row-merge"), BAD_CAST(OString::number(
GetRowMerge()).getStr()));
121 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"merged"), BAD_CAST(OString::boolean(
IsMerged()).getStr()));
122 xmlTextWriterEndElement(pWriter);
159 xmlTextWriterStartElement(pWriter, BAD_CAST(
"ScMergeFlagAttr"));
160 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"overlapped"), BAD_CAST(OString::boolean(
IsOverlapped()).getStr()));
161 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"hor_overlapped"), BAD_CAST(OString::boolean(
IsHorOverlapped()).getStr()));
162 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"ver_overlapped"), BAD_CAST(OString::boolean(
IsVerOverlapped()).getStr()));
163 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"autofilter"), BAD_CAST(OString::boolean(
HasAutoFilter()).getStr()));
164 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"scenario"), BAD_CAST(OString::boolean(
IsScenario()).getStr()));
165 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"pivot-button"), BAD_CAST(OString::boolean(
HasPivotButton()).getStr()));
166 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"pivot-popup-button"), BAD_CAST(OString::boolean(
HasPivotPopupButton()).getStr()));
167 xmlTextWriterEndElement(pWriter);
183 bool bHCell,
bool bHPrint):
185 bProtection(bProtect),
186 bHideFormula(bHFormula),
212 util::CellProtection aProtection;
217 rVal <<= aProtection;
229 OSL_FAIL(
"Wrong MemberID!");
245 util::CellProtection aProtection;
246 if ( rVal >>= aProtection )
256 OSL_FAIL(
"exception - wrong argument");
261 bRet = (rVal >>= bVal);
if (bRet)
bProtection=bVal;
break;
263 bRet = (rVal >>= bVal);
if (bRet)
bHideFormula=bVal;
break;
265 bRet = (rVal >>= bVal);
if (bRet)
bHideCell=bVal;
break;
267 bRet = (rVal >>= bVal);
if (bRet)
bHidePrint=bVal;
break;
269 OSL_FAIL(
"Wrong MemberID!");
277 const OUString aStrYes (
ScResId(STR_YES) );
278 const OUString aStrNo (
ScResId(STR_NO) );
280 const OUString aValue =
"("
302 const OUString aStrYes (
ScResId(STR_YES) );
303 const OUString aStrNo (
ScResId(STR_NO) );
307 case SfxItemPresentation::Nameless:
308 rText = GetValueText();
311 case SfxItemPresentation::Complete:
312 rText =
ScResId(STR_PROTECTION)
314 + (bProtection ? aStrYes : aStrNo)
318 + (!bHideFormula ? aStrYes : aStrNo)
322 + (bHideCell ? aStrYes : aStrNo)
326 + (!bHidePrint ? aStrYes : aStrNo);
398 uno::Reference<sheet::XHeaderFooterContent> xCont(xContent.get());
407 uno::Reference<sheet::XHeaderFooterContent>
xContent;
408 if ( rVal >>= xContent )
450 OSL_FAIL(
"exception - wrong argument");
458 assert(SfxPoolItem::operator==(rItem));
518 case SfxItemPresentation::Complete:
522 rText =
ScResId(STR_VOBJ_CHART) + aDel;
526 rText =
ScResId(STR_VOBJ_OBJECT) + aDel;
530 rText =
ScResId(STR_VOBJ_DRAWINGS) + aDel;
536 case SfxItemPresentation::Nameless:
538 rText +=
ScResId(STR_VOBJ_MODE_SHOW);
540 rText +=
ScResId(STR_VOBJ_MODE_HIDE);
586 assert(SfxPoolItem::operator==(rCmp));
592 void lclAppendScalePageCount( OUString& rText, sal_uInt16 nPages )
597 OUString aPages(
ScResId(STR_SCATTR_PAGE_SCALE_PAGES, nPages));
598 rText += aPages.replaceFirst(
"%1", OUString::number( nPages ) );
601 rText +=
ScResId( STR_SCATTR_PAGE_SCALE_AUTO );
613 OUString aValue(
ScResId( STR_SCATTR_PAGE_SCALE_WIDTH ) );
614 lclAppendScalePageCount( aValue,
mnWidth );
615 aValue +=
", " +
ScResId( STR_SCATTR_PAGE_SCALE_HEIGHT );
616 lclAppendScalePageCount( aValue,
mnHeight );
620 case SfxItemPresentation::Nameless:
625 case SfxItemPresentation::Complete:
626 rText = aName +
" (" + aValue +
")";
631 OSL_FAIL(
"ScPageScaleToItem::GetPresentation - unknown presentation mode" );
644 OSL_FAIL(
"ScPageScaleToItem::QueryValue - unknown member ID" );
658 OSL_FAIL(
"ScPageScaleToItem::PutValue - unknown member ID" );
682 maIndex(
std::move(aIndex) )
692 if (!SfxPoolItem::operator==(rCmp))
722 xmlTextWriterStartElement(pWriter, BAD_CAST(
"ScCondFormatItem"));
723 for (
const auto& nItem :
maIndex)
725 std::string aStrVal = std::to_string(nItem);
726 xmlTextWriterStartElement(pWriter, BAD_CAST(aStrVal.c_str()));
727 xmlTextWriterEndElement(pWriter);
729 xmlTextWriterEndElement(pWriter);
748 if (bRet && ePresentation == SfxItemPresentation::Complete)
749 rText =
ScResId(STR_TEXTORIENTANGLE) +
" " + rText;
768 const char* pId =
GetValue() ? STR_SHRINKTOFITCELL_ON : STR_SHRINKTOFITCELL_OFF;
788 const char* pId =
GetValue() ? STR_VERTICALSTACKCELL_ON : STR_VERTICALSTACKCELL_OFF;
808 const char* pId =
GetValue() ? STR_LINEBREAKCELL_ON : STR_LINEBREAKCELL_OFF;
828 const char* pId =
GetValue() ? STR_HYPHENATECELL_ON : STR_HYPHENATECELL_OFF;
852 case SfxItemPresentation::Complete:
853 rText =
ScResId(STR_INDENTCELL);
855 case SfxItemPresentation::Nameless:
virtual bool operator==(const SfxPoolItem &) const override
SCCOL GetColMerge() const
std::unique_ptr< EditTextObject > pLeftArea
virtual ~ScPageHFItem() override
bool bHideFormula
hide formula
virtual ~ScMergeFlagAttr() override
ScPageScaleToItem()
Default c'tor sets the width and height to 0.
static bool EETextObjEqual(const EditTextObject *pObj1, const EditTextObject *pObj2)
struct _xmlTextWriter * xmlTextWriterPtr
bool HasPivotPopupButton() const
ScVerticalStackCell(bool bStack=false)
virtual bool operator==(const SfxPoolItem &) const =0
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const override
ScMergeFlagAttr * Clone(SfxItemPool *pPool=nullptr) const override
ScLineBreakCell(bool bLineBreak=false)
virtual bool QueryValue(css::uno::Any &rAny, sal_uInt8 nMemberId=0) const override
const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH
Member ID for "page scale to width" value in QueryValue() and PutValue().
bool IsOverlapped() const
bool HasPivotButton() const
ScProtectionAttr()
Protection.
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
sal_uInt16 GetValue() const
virtual ScShrinkToFitCell * Clone(SfxItemPool *pPool=nullptr) const override
void SetHidePrint(bool bHPrint)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
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().
void SetProtection(bool bProtect)
ScShrinkToFitCell(bool bShrink=false)
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
constexpr TypedWhichId< ScPageScaleToItem > ATTR_PAGE_SCALETO(185)
constexpr TypedWhichId< ScIndentItem > ATTR_INDENT(131)
const Value & front() const
void SetLeftArea(const EditTextObject &rNew)
OUString GetValueText() const
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void SetCenterArea(const EditTextObject &rNew)
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
constexpr TypedWhichId< ScShrinkToFitCell > ATTR_SHRINKTOFIT(140)
virtual ScVerticalStackCell * Clone(SfxItemPool *pPool=nullptr) const override
#define SID_SCATTR_PAGE_OBJECTS
virtual ScPageHFItem * Clone(SfxItemPool *pPool=nullptr) const override
static SfxPoolItem * CreateDefault()
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
virtual ScLineBreakCell * Clone(SfxItemPool *pPool=nullptr) const override
bool IsVerOverlapped() const
ScMergeFlagAttr()
MergeFlag.
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual ScProtectionAttr * Clone(SfxItemPool *pPool=nullptr) const override
bool bProtection
protect cell
ScRotateValueItem(Degree100 nAngle)
virtual ~ScProtectionAttr() override
virtual bool PutValue(const css::uno::Any &rAny, sal_uInt8 nMemberId) override
bool ScHasPriority(const ::editeng::SvxBorderLine *pThis, const ::editeng::SvxBorderLine *pOther)
General Help Function.
virtual ScIndentItem * Clone(SfxItemPool *pPool=nullptr) const override
OUString GetMetricText(tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper *pIntl)
std::unique_ptr< EditTextObject > CreateTextObject()
ScHyphenateCell(bool bHyphenate=false)
OUString ScResId(const char *pId)
virtual ~ScViewObjectModeItem() override
virtual ScHyphenateCell * Clone(SfxItemPool *pPool=nullptr) const override
void SetRightArea(const EditTextObject &rNew)
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
const char * GetMetricId(MapUnit eUnit)
std::unique_ptr< EditTextObject > pRightArea
std::unique_ptr< EditTextObject > pCenterArea
constexpr TypedWhichId< ScHyphenateCell > ATTR_HYPHENATE(125)
static SfxItemPool * CreatePool()
bool IsHorOverlapped() const
ScIndentItem(sal_uInt16 nIndent=0)
ScPageHFItem(sal_uInt16 nWhich)
ScPageHFItem - Dates from the Head and Foot lines.
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual ScRotateValueItem * Clone(SfxItemPool *pPool=nullptr) const override
void SetHideCell(bool bHCell)
Contains the "scale to width/height" attribute in page styles.
OUString EditResId(const char *pId)
#define SID_SCATTR_PAGE_DRAWINGS
void SetHideFormula(bool bHFormula)
virtual ~ScPageScaleToItem() override
Degree100 GetValue() const
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual ~ScMergeAttr() override
virtual bool operator==(const SfxPoolItem &) const override
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &rIntl) const override
uno::Reference< ucb::XContent > xContent
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
virtual bool operator==(const SfxPoolItem &) const override
bool bHidePrint
don't print cell
SCROW GetRowMerge() const
virtual bool operator==(const SfxPoolItem &rCmp) const override
bool HasAutoFilter() const
ScMergeAttr()
Item - Implementations.
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &rIntl) const override
std::pair< const_iterator, bool > insert(Value &&x)
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
std::unique_ptr< EditTextObject > Clone() const
#define SID_SCATTR_PAGE_CHARTS
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntl) const override
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit, MapUnit, OUString &rText, const IntlWrapper &) const override
virtual ScViewObjectModeItem * Clone(SfxItemPool *pPool=nullptr) const override
virtual ScPageScaleToItem * Clone(SfxItemPool *=nullptr) const override
virtual ScMergeAttr * Clone(SfxItemPool *pPool=nullptr) const override
ScViewObjectModeItem(sal_uInt16 nWhich)
ScViewObjectModeItem - Display Mode of View Objects.
virtual sal_uInt16 GetValueCount() const override