[Libreoffice-commits] core.git: cui/source sc/inc sc/qa sc/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 11 13:18:47 UTC 2019
cui/source/tabpages/align.cxx | 7 ++++++-
sc/inc/attrib.hxx | 12 ++++++++++++
sc/inc/globstr.hrc | 2 ++
sc/qa/extras/anchor.cxx | 1 +
sc/source/core/data/attrib.cxx | 20 ++++++++++++++++++++
sc/source/core/data/docpool.cxx | 2 +-
sc/source/core/tool/autoform.cxx | 2 +-
sc/source/filter/excel/xistyle.cxx | 2 +-
sc/source/filter/oox/stylesbuffer.cxx | 2 +-
sc/source/ui/unoobj/afmtuno.cxx | 10 +++++-----
sc/source/ui/unoobj/cellsuno.cxx | 10 +++++-----
sc/source/ui/unoobj/styleuno.cxx | 10 +++++-----
sc/source/ui/view/formatsh.cxx | 2 +-
13 files changed, 61 insertions(+), 21 deletions(-)
New commits:
commit 2579895f2c18fd7d606715f91b1463900f6d6937
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 10 16:14:25 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 11 14:17:53 2019 +0100
Related: tdf#129300 add ScVerticalStackCell to provide a description
Change-Id: I8ed99f19ff6f4751c0867147fc1a60ac917f083b
Reviewed-on: https://gerrit.libreoffice.org/84876
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 44203405b9ff..9238ff52f11f 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -270,7 +270,12 @@ bool AlignmentTabPage::FillItemSet( SfxItemSet* rSet )
if (m_xCbStacked->get_state_changed_from_saved())
{
- rSet->Put(SfxBoolItem(GetWhich(SID_ATTR_ALIGN_STACKED), m_xCbStacked->get_active()));
+ const SfxBoolItem* pStackItem = static_cast<const SfxBoolItem*>(GetOldItem(
+ *rSet, SID_ATTR_ALIGN_STACKED));
+ assert(pStackItem);
+ std::unique_ptr<SfxBoolItem> pNewStackItem(static_cast<SfxBoolItem*>(pStackItem->Clone()));
+ pNewStackItem->SetValue(m_xCbStacked->get_active());
+ rSet->Put(*pNewStackItem);
bChanged = true;
}
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index a19a3ec0952d..9b6a6b956320 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -309,6 +309,18 @@ public:
const IntlWrapper& rIntl) const override;
};
+class SC_DLLPUBLIC ScVerticalStackCell final : public SfxBoolItem
+{
+public:
+ ScVerticalStackCell(bool bStack = false);
+ virtual ScVerticalStackCell* Clone(SfxItemPool *pPool = nullptr) const override;
+ virtual bool GetPresentation(SfxItemPresentation ePres,
+ MapUnit eCoreMetric,
+ MapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper& rIntl) const override;
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index 4582d832cfb2..ceedfbebcd35 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -517,6 +517,8 @@
#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")
+#define STR_VERTICALSTACKCELL_ON NC_("STR_VERTICALSTACKCELL_ON", "Vertically stacked: On")
+#define STR_VERTICALSTACKCELL_OFF NC_("STR_VERTICALSTACKCELL_OFF", "Vertically stacked: Off")
#endif
diff --git a/sc/qa/extras/anchor.cxx b/sc/qa/extras/anchor.cxx
index c003c09d8084..5d759afa9293 100644
--- a/sc/qa/extras/anchor.cxx
+++ b/sc/qa/extras/anchor.cxx
@@ -16,6 +16,7 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/text/XText.hpp>
+#include <attrib.hxx>
#include <docsh.hxx>
#include <drwlayer.hxx>
#include <scitems.hxx>
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 4cbd076b4423..24d1a0901a26 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -768,4 +768,24 @@ bool ScShrinkToFitCell::GetPresentation(SfxItemPresentation,
return true;
}
+ScVerticalStackCell::ScVerticalStackCell(bool bStack)
+ : SfxBoolItem(ATTR_STACKED, bStack)
+{
+}
+
+ScVerticalStackCell* ScVerticalStackCell::Clone(SfxItemPool*) const
+{
+ return new ScVerticalStackCell(GetValue());
+}
+
+bool ScVerticalStackCell::GetPresentation(SfxItemPresentation,
+ MapUnit, MapUnit,
+ OUString& rText,
+ const IntlWrapper&) const
+{
+ const char* pId = GetValue() ? STR_VERTICALSTACKCELL_ON : STR_VERTICALSTACKCELL_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 d5d6918587ed..e379f75b1d16 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -249,7 +249,7 @@ ScDocumentPool::ScDocumentPool()
mvPoolDefaults[ ATTR_INDENT - ATTR_STARTINDEX ] = new SfxUInt16Item( ATTR_INDENT, 0 );
mvPoolDefaults[ ATTR_VER_JUSTIFY - ATTR_STARTINDEX ] = new SvxVerJustifyItem( SvxCellVerJustify::Standard, ATTR_VER_JUSTIFY);
mvPoolDefaults[ ATTR_VER_JUSTIFY_METHOD - ATTR_STARTINDEX ] = new SvxJustifyMethodItem( SvxCellJustifyMethod::Auto, ATTR_VER_JUSTIFY_METHOD);
- mvPoolDefaults[ ATTR_STACKED - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_STACKED, false );
+ mvPoolDefaults[ ATTR_STACKED - ATTR_STARTINDEX ] = new ScVerticalStackCell(false);
mvPoolDefaults[ ATTR_ROTATE_VALUE - ATTR_STARTINDEX ] = new ScRotateValueItem( 0 );
mvPoolDefaults[ ATTR_ROTATE_MODE - ATTR_STARTINDEX ] = new SvxRotateModeItem( SVX_ROTATE_MODE_BOTTOM, ATTR_ROTATE_MODE );
mvPoolDefaults[ ATTR_VERTICAL_ASIAN - ATTR_STARTINDEX ] = new SfxBoolItem( ATTR_VERTICAL_ASIAN );
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index 63ae9fd8e956..d5f290ecff84 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -369,7 +369,7 @@ void ScAutoFormatData::PutItem( sal_uInt16 nIndex, const SfxPoolItem& rItem )
case ATTR_BACKGROUND: rField.SetBackground( static_cast<const SvxBrushItem&>(rItem) ); break;
case ATTR_HOR_JUSTIFY: rField.SetHorJustify( static_cast<const SvxHorJustifyItem&>(rItem) ); break;
case ATTR_VER_JUSTIFY: rField.SetVerJustify( static_cast<const SvxVerJustifyItem&>(rItem) ); break;
- case ATTR_STACKED: rField.SetStacked( static_cast<const SfxBoolItem&>(rItem) ); break;
+ case ATTR_STACKED: rField.SetStacked( static_cast<const ScVerticalStackCell&>(rItem) ); break;
case ATTR_MARGIN: rField.SetMargin( static_cast<const SvxMarginItem&>(rItem) ); break;
case ATTR_LINEBREAK: rField.SetLinebreak( static_cast<const SfxBoolItem&>(rItem) ); break;
case ATTR_ROTATE_VALUE: rField.SetRotateAngle( static_cast<const ScRotateValueItem&>(rItem) ); break;
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 6d97fa2bdbfc..00320dd2c3a6 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -830,7 +830,7 @@ void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFo
// text orientation/rotation (BIFF2-BIFF7 sets mnOrient)
sal_uInt8 nXclRot = (mnOrient == EXC_ORIENT_NONE) ? mnRotation : XclTools::GetXclRotFromOrient( mnOrient );
bool bStacked = (nXclRot == EXC_ROT_STACKED);
- ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_STACKED, bStacked ), bSkipPoolDefs );
+ ScfTools::PutItem( rItemSet, ScShrinkToFitCell( bStacked ), bSkipPoolDefs );
// set an angle in the range from -90 to 90 degrees
sal_Int32 nAngle = XclTools::GetScRotation( nXclRot, 0 );
ScfTools::PutItem( rItemSet, ScRotateValueItem( nAngle ), bSkipPoolDefs );
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index e600c7f7ef33..378ae7c2dcf1 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -1297,7 +1297,7 @@ void Alignment::fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs ) const
// set an angle in the range from -90 to 90 degrees
ScfTools::PutItem( rItemSet, ScRotateValueItem( maApiData.mnRotation ), bSkipPoolDefs );
// Orientation
- ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_STACKED, maApiData.meOrientation == css::table::CellOrientation_STACKED ), bSkipPoolDefs );
+ ScfTools::PutItem( rItemSet, ScVerticalStackCell( maApiData.meOrientation == css::table::CellOrientation_STACKED ), bSkipPoolDefs );
// indent
ScfTools::PutItem( rItemSet, SfxUInt16Item( ATTR_INDENT, maApiData.mnIndent ), bSkipPoolDefs );
// line wrap
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index 0bd7b7baf669..1c637d2cd480 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -592,18 +592,18 @@ void SAL_CALL ScAutoFormatFieldObj::setPropertyValue(
switch( eOrient )
{
case table::CellOrientation_STANDARD:
- pData->PutItem( nFieldIndex, SfxBoolItem( ATTR_STACKED, false ) );
+ pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
break;
case table::CellOrientation_TOPBOTTOM:
- pData->PutItem( nFieldIndex, SfxBoolItem( ATTR_STACKED, false ) );
+ pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
pData->PutItem( nFieldIndex, ScRotateValueItem( 27000 ) );
break;
case table::CellOrientation_BOTTOMTOP:
- pData->PutItem( nFieldIndex, SfxBoolItem( ATTR_STACKED, false ) );
+ pData->PutItem( nFieldIndex, ScVerticalStackCell( false ) );
pData->PutItem( nFieldIndex, ScRotateValueItem( 9000 ) );
break;
case table::CellOrientation_STACKED:
- pData->PutItem( nFieldIndex, SfxBoolItem( ATTR_STACKED, true ) );
+ pData->PutItem( nFieldIndex, ScVerticalStackCell( true ) );
break;
default:
{
@@ -688,7 +688,7 @@ uno::Any SAL_CALL ScAutoFormatFieldObj::getPropertyValue( const OUString& aPrope
{
const ScRotateValueItem* pRotItem = pData->GetItem( nFieldIndex, ATTR_ROTATE_VALUE );
sal_Int32 nRot = pRotItem ? pRotItem->GetValue() : 0;
- bool bStacked = static_cast<const SfxBoolItem*>(pItem)->GetValue();
+ bool bStacked = static_cast<const ScVerticalStackCell*>(pItem)->GetValue();
SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aVal );
}
break;
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 676ab2bd4fe6..a5ffd152b5e0 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2124,20 +2124,20 @@ static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const
switch( eOrient )
{
case table::CellOrientation_STANDARD:
- rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
+ rSet.Put( ScVerticalStackCell( false ) );
break;
case table::CellOrientation_TOPBOTTOM:
- rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
+ rSet.Put( ScVerticalStackCell( false ) );
rSet.Put( ScRotateValueItem( 27000 ) );
rSecondItemId = ATTR_ROTATE_VALUE;
break;
case table::CellOrientation_BOTTOMTOP:
- rSet.Put( SfxBoolItem( ATTR_STACKED, false ) );
+ rSet.Put( ScVerticalStackCell( false ) );
rSet.Put( ScRotateValueItem( 9000 ) );
rSecondItemId = ATTR_ROTATE_VALUE;
break;
case table::CellOrientation_STACKED:
- rSet.Put( SfxBoolItem( ATTR_STACKED, true ) );
+ rSet.Put( ScVerticalStackCell( true ) );
break;
default:
{
@@ -2415,7 +2415,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
case ATTR_STACKED:
{
sal_Int32 nRot = pDataSet->Get(ATTR_ROTATE_VALUE).GetValue();
- bool bStacked = static_cast<const SfxBoolItem&>(pDataSet->Get(pEntry->nWID)).GetValue();
+ bool bStacked = static_cast<const ScVerticalStackCell&>(pDataSet->Get(pEntry->nWID)).GetValue();
SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( rAny );
}
break;
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 493c77c84781..37af7b737f8b 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -1545,18 +1545,18 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx
switch (eOrient)
{
case table::CellOrientation_STANDARD:
- rSet.Put(SfxBoolItem(ATTR_STACKED, false));
+ rSet.Put(ScVerticalStackCell(false));
break;
case table::CellOrientation_TOPBOTTOM:
- rSet.Put(SfxBoolItem(ATTR_STACKED, false));
+ rSet.Put(ScVerticalStackCell(false));
rSet.Put(ScRotateValueItem(27000));
break;
case table::CellOrientation_BOTTOMTOP:
- rSet.Put(SfxBoolItem(ATTR_STACKED, false));
+ rSet.Put(ScVerticalStackCell(false));
rSet.Put(ScRotateValueItem(9000));
break;
case table::CellOrientation_STACKED:
- rSet.Put(SfxBoolItem(ATTR_STACKED, true));
+ rSet.Put(ScVerticalStackCell(true));
break;
default:
{
@@ -1795,7 +1795,7 @@ uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName )
case ATTR_STACKED:
{
sal_Int32 nRot = pItemSet->Get(ATTR_ROTATE_VALUE).GetValue();
- bool bStacked = static_cast<const SfxBoolItem&>(pItemSet->Get(nWhich)).GetValue();
+ bool bStacked = static_cast<const ScVerticalStackCell&>(pItemSet->Get(nWhich)).GetValue();
SvxOrientationItem( nRot, bStacked, 0 ).QueryValue( aAny );
}
break;
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 3460d6e3d927..28fe4e829ee2 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2688,7 +2688,7 @@ void ScFormatShell::ExecuteTextDirection( const SfxRequest& rReq )
bool bVert = (nSlot == SID_TEXTDIRECTION_TOP_TO_BOTTOM);
ScPatternAttr aAttr( GetViewData()->GetDocument()->GetPool() );
SfxItemSet& rItemSet = aAttr.GetItemSet();
- rItemSet.Put( SfxBoolItem( ATTR_STACKED, bVert ) );
+ rItemSet.Put( ScVerticalStackCell( bVert ) );
rItemSet.Put( SfxBoolItem( ATTR_VERTICAL_ASIAN, bVert ) );
pTabViewShell->ApplySelectionPattern( aAttr );
pTabViewShell->AdjustBlockHeight();
More information about the Libreoffice-commits
mailing list