Related: tdf#129300 add ScShrinkToFitCell to provide a description
Change-Id: I628562f1013825e5ba3c0daaf5ee6b098616b6d0
Reviewed-on: https://gerrit.libreoffice.org/84866
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 940f64a..7e68685 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -237,9 +237,9 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
const SdrAngleItem* pAngleItem = static_cast<const SdrAngleItem*>(GetOldItem(
*rSet, SID_ATTR_ALIGN_DEGREES));
assert(pAngleItem);
std::unique_ptr<SdrAngleItem> pNewAngletem(static_cast<SdrAngleItem*>(pAngleItem->Clone()));
pNewAngletem->SetValue(m_aCtrlDial.GetRotation());
rSet->Put(*pNewAngletem);
std::unique_ptr<SdrAngleItem> pNewAngleItem(static_cast<SdrAngleItem*>(pAngleItem->Clone()));
pNewAngleItem->SetValue(m_aCtrlDial.GetRotation());
rSet->Put(*pNewAngleItem);
bChanged = true;
}
@@ -289,7 +289,12 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xBtnShrink->get_state_changed_from_saved())
{
rSet->Put(SfxBoolItem(GetWhich(SID_ATTR_ALIGN_SHRINKTOFIT), m_xBtnShrink->get_active()));
const SfxBoolItem* pShrinkItem = static_cast<const SfxBoolItem*>(GetOldItem(
*rSet, SID_ATTR_ALIGN_SHRINKTOFIT));
assert(pShrinkItem);
std::unique_ptr<SfxBoolItem> pNewShrinkItem(static_cast<SfxBoolItem*>(pShrinkItem->Clone()));
pNewShrinkItem->SetValue(m_xBtnShrink->get_active());
rSet->Put(*pNewShrinkItem);
bChanged = true;
}
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index 4865e15..a19a3ec 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -294,7 +294,19 @@ public:
virtual bool GetPresentation( SfxItemPresentation ePresentation,
MapUnit, MapUnit,
OUString& rText,
const IntlWrapper& ) const override;
const IntlWrapper& rIntl) const override;
};
class SC_DLLPUBLIC ScShrinkToFitCell final : public SfxBoolItem
{
public:
ScShrinkToFitCell(bool bShrink = false);
virtual ScShrinkToFitCell* Clone(SfxItemPool *pPool = nullptr) const override;
virtual bool GetPresentation(SfxItemPresentation ePres,
MapUnit eCoreMetric,
MapUnit ePresMetric,
OUString &rText,
const IntlWrapper& rIntl) const override;
};
#endif
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index d9b92b5..4582d83 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -515,6 +515,8 @@
#define STR_ERR_NAME_INVALID_CELL_REF NC_("STR_ERR_NAME_INVALID_CELL_REF", "Invalid name. Reference to a cell, or a range of cells not allowed.")
#define STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK NC_("STR_ERR_LONG_LINK_FORMULA_NEEDING_CHECK", "External content disabled.")
#define STR_TEXTORIENTANGLE NC_("STR_TEXTORIENTANGLE", "Text orientation angle")
#define STR_SHRINKTOFITCELL_ON NC_("STR_SHRINKTOFITCELL_ON", "Shrink to fit cell: On")
#define STR_SHRINKTOFITCELL_OFF NC_("STR_SHRINKTOFITCELL_OFF", "Shrink to fit cell: Off")
#endif
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index bc2271f..4cbd076 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -748,4 +748,24 @@ bool ScRotateValueItem::GetPresentation(SfxItemPresentation ePresentation,
return bRet;
}
ScShrinkToFitCell::ScShrinkToFitCell(bool bShrink)
: SfxBoolItem(ATTR_SHRINKTOFIT, bShrink)
{
}
ScShrinkToFitCell* ScShrinkToFitCell::Clone(SfxItemPool*) const
{
return new ScShrinkToFitCell(GetValue());
}
bool ScShrinkToFitCell::GetPresentation(SfxItemPresentation,
MapUnit, MapUnit,
OUString& rText,
const IntlWrapper&) const
{
const char* pId = GetValue() ? STR_SHRINKTOFITCELL_ON : STR_SHRINKTOFITCELL_OFF;
rText = ScResId(pId);
return true;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index db067aa..d5d6918 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -258,7 +258,7 @@ ScDocumentPool::ScDocumentPool()
// The value from the page style is set as DefaultHorizontalTextDirection for the EditEngine.
mvPoolDefaults[ ATTR_WRITINGDIR - ATTR_STARTINDEX ] = new SvxFrameDirectionItem( SvxFrameDirection::Environment, ATTR_WRITINGDIR );
mvPoolDefaults[ ATTR_LINEBREAK - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_LINEBREAK );
mvPoolDefaults[ ATTR_SHRINKTOFIT - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_SHRINKTOFIT );
mvPoolDefaults[ ATTR_SHRINKTOFIT - ATTR_STARTINDEX ] = new ScShrinkToFitCell();
mvPoolDefaults[ ATTR_BORDER_TLBR - ATTR_STARTINDEX ] = new SvxLineItem( ATTR_BORDER_TLBR );
mvPoolDefaults[ ATTR_BORDER_BLTR - ATTR_STARTINDEX ] = new SvxLineItem( ATTR_BORDER_BLTR );
mvPoolDefaults[ ATTR_MARGIN - ATTR_STARTINDEX ] = new SvxMarginItem( ATTR_MARGIN );
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 014eb81..52f5d0f 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -825,7 +825,7 @@ void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFo
ScfTools::PutItem( rItemSet, SfxUInt16Item( ATTR_INDENT, nScIndent ), bSkipPoolDefs );
// shrink to fit
ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_SHRINKTOFIT, mbShrink ), bSkipPoolDefs );
ScfTools::PutItem( rItemSet, ScShrinkToFitCell( mbShrink ), bSkipPoolDefs );
// text orientation/rotation (BIFF2-BIFF7 sets mnOrient)
sal_uInt8 nXclRot = (mnOrient == EXC_ORIENT_NONE) ? mnRotation : XclTools::GetXclRotFromOrient( mnOrient );
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 48df2d7..e600c7f 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -1302,7 +1302,7 @@ void Alignment::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
ScfTools::PutItem( rItemSet, SfxUInt16Item( ATTR_INDENT, maApiData.mnIndent ), bSkipPoolDefs );
// line wrap
ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_LINEBREAK, maApiData.mbWrapText ), bSkipPoolDefs );
ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_SHRINKTOFIT, maApiData.mbShrink ), bSkipPoolDefs );
ScfTools::PutItem( rItemSet, ScShrinkToFitCell( maApiData.mbShrink ), bSkipPoolDefs );
}
ProtectionModel::ProtectionModel() :