include/svx/autoformathelper.hxx      |   18 ------------------
 sc/inc/autoform.hxx                   |   22 ++++++++++++++++++++++
 sc/source/core/tool/autoform.cxx      |   16 ++++++++++++++++
 svx/source/items/autoformathelper.cxx |   17 +----------------
 sw/source/core/doc/tblafmt.cxx        |    7 -------
 5 files changed, 39 insertions(+), 41 deletions(-)

New commits:
commit 5f8b323db5b7435f3f7ce426b70ed7c6f1e9af0f
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Mar 5 21:06:37 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Mar 6 09:28:59 2026 +0100

    Move Calc-only AutoFormatBase members to ScAutoFormatDataField
    
    Change-Id: If6dc71dcbe9b7a69cd6059fb5fd19ef7b6aa7566
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201077
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Jenkins

diff --git a/include/svx/autoformathelper.hxx b/include/svx/autoformathelper.hxx
index a36ae88cffc3..7b8462fcfd71 100644
--- a/include/svx/autoformathelper.hxx
+++ b/include/svx/autoformathelper.hxx
@@ -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 );
 
 
 };
diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx
index 2d3d5df8759c..035409f4bee1 100644
--- a/sc/inc/autoform.hxx
+++ b/sc/inc/autoform.hxx
@@ -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
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index f1e18ed13213..fa4f9a98a31c 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -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++)
diff --git a/svx/source/items/autoformathelper.cxx 
b/svx/source/items/autoformathelper.cxx
index fe6437c1bc58..0f03e6b83262 100644
--- a/svx/source/items/autoformathelper.cxx
+++ b/svx/source/items/autoformathelper.cxx
@@ -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;
 }
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 0fcc2e27453c..89ba4fc49f02 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -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,

Reply via email to