Move Calc-only AutoFormatBase members to ScAutoFormatDataField

Change-Id: If6dc71dcbe9b7a69cd6059fb5fd19ef7b6aa7566
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201077
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara
2026-03-06 09:28:59 +01:00
parent 61a0ed0a8d
commit 5f8b323db5
5 changed files with 39 additions and 41 deletions
-18
View File
@@ -81,16 +81,8 @@ protected:
// Writer specific
std::unique_ptr<SvxAdjustItem> m_aAdjust;
// Calc specific
std::unique_ptr<SvxHorJustifyItem> m_aHorJustify;
std::unique_ptr<SvxVerJustifyItem> m_aVerJustify;
std::unique_ptr<SfxBoolItem> m_aStacked;
std::unique_ptr<SvxMarginItem> m_aMargin;
std::unique_ptr<SfxBoolItem> m_aLinebreak;
// from SO5, 504k on, rotated text
std::unique_ptr<SfxInt32Item> m_aRotateAngle;
std::unique_ptr<SvxRotateModeItem> m_aRotateMode;
// assignment-op is protected due to this being a tooling
// class, so callers need to be aware of what they do
@@ -130,11 +122,6 @@ public:
const SvxAdjustItem &GetAdjust() const { return *m_aAdjust; }
const SvxHorJustifyItem& GetHorJustify() const { return *m_aHorJustify; }
const SvxVerJustifyItem& GetVerJustify() const { return *m_aVerJustify; }
const SfxBoolItem& GetStacked() const { return *m_aStacked; }
const SvxMarginItem& GetMargin() const { return *m_aMargin; }
const SfxBoolItem& GetLinebreak() const { return *m_aLinebreak; }
const SfxInt32Item& GetRotateAngle() const { return *m_aRotateAngle; }
const SvxRotateModeItem& GetRotateMode() const { return *m_aRotateMode; }
// The set-methods.
void SetFont( const SvxFontItem& rNew );
@@ -162,11 +149,6 @@ public:
void SetAdjust( const SvxAdjustItem& rNew );
void SetHorJustify( const SvxHorJustifyItem& rNew );
void SetVerJustify( const SvxVerJustifyItem& rNew );
void SetStacked( const SfxBoolItem& rNew );
void SetMargin( const SvxMarginItem& rNew );
void SetLinebreak( const SfxBoolItem& rNew );
void SetRotateAngle( const SfxInt32Item& rNew );
void SetRotateMode( const SvxRotateModeItem& rNew );
};
+22
View File
@@ -24,18 +24,40 @@
#include <svx/TableStylesParser.hxx>
#include "scdllapi.h"
#include <svl/eitem.hxx>
#include <svl/intitem.hxx>
#include <svx/algitem.hxx>
#include <svx/rotmodit.hxx>
#include <array>
#include <memory>
#include "document.hxx"
class ScAutoFormatDataField : public SvxAutoFormatDataField
{
std::unique_ptr<SfxBoolItem> m_aStacked;
std::unique_ptr<SvxMarginItem> m_aMargin;
std::unique_ptr<SfxBoolItem> m_aLinebreak;
std::unique_ptr<SfxInt32Item> m_aRotateAngle;
std::unique_ptr<SvxRotateModeItem> m_aRotateMode;
public:
ScAutoFormatDataField();
ScAutoFormatDataField(const ScAutoFormatDataField& rCopy);
ScAutoFormatDataField(const SvxAutoFormatDataField& rCopy);
~ScAutoFormatDataField();
const SfxBoolItem& GetStacked() const { return *m_aStacked; }
const SvxMarginItem& GetMargin() const { return *m_aMargin; }
const SfxBoolItem& GetLinebreak() const { return *m_aLinebreak; }
const SfxInt32Item& GetRotateAngle() const { return *m_aRotateAngle; }
const SvxRotateModeItem& GetRotateMode() const { return *m_aRotateMode; }
void SetStacked( const SfxBoolItem& rNew );
void SetMargin( const SvxMarginItem& rNew );
void SetLinebreak( const SfxBoolItem& rNew );
void SetRotateAngle( const SfxInt32Item& rNew );
void SetRotateMode( const SvxRotateModeItem& rNew );
};
class SAL_DLLPUBLIC_RTTI ScAutoFormatData : public SvxAutoFormatData
+16
View File
@@ -87,16 +87,32 @@ ScAutoFormatDataField::ScAutoFormatDataField()
ScAutoFormatDataField::ScAutoFormatDataField(const ScAutoFormatDataField& rCopy)
: SvxAutoFormatDataField(rCopy)
, m_aStacked(rCopy.m_aStacked->Clone())
, m_aMargin(rCopy.m_aMargin->Clone())
, m_aLinebreak(rCopy.m_aLinebreak->Clone())
, m_aRotateAngle(rCopy.m_aRotateAngle->Clone())
, m_aRotateMode(rCopy.m_aRotateMode->Clone())
{
}
ScAutoFormatDataField::ScAutoFormatDataField(const SvxAutoFormatDataField& rCopy)
: SvxAutoFormatDataField(rCopy)
, m_aStacked(std::make_unique<ScVerticalStackCell>(ATTR_STACKED))
, m_aMargin(std::make_unique<SvxMarginItem>(ATTR_MARGIN))
, m_aLinebreak(std::make_unique<ScLineBreakCell>(ATTR_LINEBREAK))
, m_aRotateAngle(std::make_unique<ScRotateValueItem>(0_deg100))
, m_aRotateMode(std::make_unique<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE))
{
}
ScAutoFormatDataField::~ScAutoFormatDataField() {}
void ScAutoFormatDataField::SetStacked( const SfxBoolItem& rNew ) { m_aStacked.reset(rNew.Clone()); }
void ScAutoFormatDataField::SetMargin( const SvxMarginItem& rNew ) { m_aMargin.reset(rNew.Clone()); }
void ScAutoFormatDataField::SetLinebreak( const SfxBoolItem& rNew ) { m_aLinebreak.reset(rNew.Clone()); }
void ScAutoFormatDataField::SetRotateAngle( const SfxInt32Item& rNew ) { m_aRotateAngle.reset(rNew.Clone()); }
void ScAutoFormatDataField::SetRotateMode( const SvxRotateModeItem& rNew ) { m_aRotateMode.reset(rNew.Clone()); }
ScAutoFormatData::ScAutoFormatData()
{
for (size_t n = 0; n < ELEMENT_COUNT; n++)
+1 -16
View File
@@ -67,11 +67,6 @@ void AutoFormatBase::SetBackground( const SvxBrushItem& rNew ) { m_aBackgro
void AutoFormatBase::SetAdjust( const SvxAdjustItem& rNew ) { m_aAdjust.reset(rNew.Clone()); }
void AutoFormatBase::SetHorJustify( const SvxHorJustifyItem& rNew ) { m_aHorJustify.reset(rNew.Clone()); }
void AutoFormatBase::SetVerJustify( const SvxVerJustifyItem& rNew ) { m_aVerJustify.reset(rNew.Clone()); }
void AutoFormatBase::SetStacked( const SfxBoolItem& rNew ) { m_aStacked.reset(rNew.Clone()); }
void AutoFormatBase::SetMargin( const SvxMarginItem& rNew ) { m_aMargin.reset(rNew.Clone()); }
void AutoFormatBase::SetLinebreak( const SfxBoolItem& rNew ) { m_aLinebreak.reset(rNew.Clone()); }
void AutoFormatBase::SetRotateAngle( const SfxInt32Item& rNew ) { m_aRotateAngle.reset(rNew.Clone()); }
void AutoFormatBase::SetRotateMode( const SvxRotateModeItem& rNew ) { m_aRotateMode.reset(rNew.Clone()); }
AutoFormatBase::AutoFormatBase()
{
@@ -102,12 +97,7 @@ AutoFormatBase::AutoFormatBase( const AutoFormatBase& rNew )
m_aBackground(rNew.m_aBackground->Clone()),
m_aAdjust(rNew.m_aAdjust->Clone()),
m_aHorJustify(rNew.m_aHorJustify->Clone()),
m_aVerJustify(rNew.m_aVerJustify->Clone()),
m_aStacked(rNew.m_aStacked->Clone()),
m_aMargin(rNew.m_aMargin->Clone()),
m_aLinebreak(rNew.m_aLinebreak->Clone()),
m_aRotateAngle(rNew.m_aRotateAngle->Clone()),
m_aRotateMode(rNew.m_aRotateMode->Clone())
m_aVerJustify(rNew.m_aVerJustify->Clone())
{
}
@@ -149,11 +139,6 @@ AutoFormatBase& AutoFormatBase::operator=(const AutoFormatBase& rRef)
SetAdjust(rRef.GetAdjust());
SetHorJustify(rRef.GetHorJustify());
SetVerJustify(rRef.GetVerJustify());
SetStacked(rRef.GetStacked());
SetMargin(rRef.GetMargin());
SetLinebreak(rRef.GetLinebreak());
SetRotateAngle(rRef.GetRotateAngle());
SetRotateMode(rRef.GetRotateMode());
return *this;
}
-7
View File
@@ -91,13 +91,6 @@ SwBoxAutoFormat::SwBoxAutoFormat()
m_aAdjust = std::make_unique<SvxAdjustItem>(SvxAdjust::Left, RES_PARATR_ADJUST);
m_aHorJustify = std::make_unique<SvxHorJustifyItem>(SvxCellHorJustify::Standard, 0);
m_aVerJustify = std::make_unique<SvxVerJustifyItem>(SvxCellVerJustify::Standard, 0);
m_aStacked = std::make_unique<SfxBoolItem>(0);
m_aMargin = std::make_unique<SvxMarginItem>(TypedWhichId<SvxMarginItem>(0));
m_aLinebreak = std::make_unique<SfxBoolItem>(0);
m_aRotateAngle = std::make_unique<SfxInt32Item>(0);
m_aRotateMode = std::make_unique<SvxRotateModeItem>(SVX_ROTATE_MODE_STANDARD,
TypedWhichId<SvxRotateModeItem>(0));
m_aTextOrientation
= std::make_unique<SvxFrameDirectionItem>(SvxFrameDirection::Environment, RES_FRAMEDIR);
m_aVerticalAlignment = std::make_unique<SwFormatVertOrient>(0, text::VertOrientation::TOP,