include/svx/svxids.hrc                                       |    8 
 officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu |    2 
 sd/sdi/_drvwsh.sdi                                           |   30 +
 sd/source/ui/view/drviews2.cxx                               |    6 
 sd/source/ui/view/drviewsf.cxx                               |   27 +
 svx/sdi/svx.sdi                                              |   98 ++++
 svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.cxx  |  203 +++++++++
 svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.hxx  |   22 
 svx/uiconfig/ui/sidebartextcolumnspanel.ui                   |  245 +++++++++--
 9 files changed, 597 insertions(+), 44 deletions(-)

New commits:
commit 890dcf9cf2223cd597eb0a9dad3dafe5d5c064f2
Author:     siddhisalunkhe1998 <[email protected]>
AuthorDate: Sun Oct 26 11:07:03 2025 +0000
Commit:     Heiko Tietze <[email protected]>
CommitDate: Thu Nov 13 08:53:07 2025 +0100

    tdf#149411 Improve Columns deck at the sidebar
    
    Renamed Columns Property Panel to Text Attributes.
    Adds controls for text fitting - fit width,
    fit height, fit to frame.
    Added spacing controls: left, right, top, bottom padding.
    
    Change-Id: I65d2a75bae649507092a385fcecdbe05ef562756
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193003
    Tested-by: Heiko Tietze <[email protected]>
    Reviewed-by: Heiko Tietze <[email protected]>
    Tested-by: Jenkins

diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc
index fad6714ff2c7..d45ea15666fe 100644
--- a/include/svx/svxids.hrc
+++ b/include/svx/svxids.hrc
@@ -1112,9 +1112,15 @@ class XFillGradientItem;
 #define SID_CONNECTOR_LINES_CIRCLE_START                ( SID_SVX_START + 1248 
)
 #define SID_CONNECTOR_LINES_CIRCLE_END                  ( SID_SVX_START + 1249 
)
 #define SID_CONNECTOR_LINES_CIRCLES                     ( SID_SVX_START + 1250 
)
+#define SID_ATTR_TEXT_AUTOGROWWIDTH                     ( SID_SVX_START + 1251 
)
+#define SID_ATTR_TEXT_AUTOGROWHEIGHT                    ( SID_SVX_START + 1252 
)
+#define SID_ATTR_TEXT_LEFTDIST                          ( SID_SVX_START + 1253 
)
+#define SID_ATTR_TEXT_RIGHTDIST                         ( SID_SVX_START + 1254 
)
+#define SID_ATTR_TEXT_UPPERDIST                         ( SID_SVX_START + 1255 
)
+#define SID_ATTR_TEXT_LOWERDIST                         ( SID_SVX_START + 1256 
)
 
 // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id
-#define SID_SVX_FIRSTFREE                               (SID_SVX_START + 1250 
+ 1)
+#define SID_SVX_FIRSTFREE                               ( SID_SVX_START + 1256 
+ 1 )
 
 // Overflow check for slot IDs
 #if SID_SVX_FIRSTFREE > SID_SVX_END
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu 
b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
index d3f75547be7a..aa211cc7ca25 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
@@ -2222,7 +2222,7 @@
 
       <node oor:name="TextColumnsPropertyPanel" oor:op="replace">
         <prop oor:name="Title" oor:type="xs:string">
-          <value xml:lang="en-US">Columns</value>
+          <value xml:lang="en-US">Text Attributes</value>
         </prop>
         <prop oor:name="Id" oor:type="xs:string">
           <value>TextColumnsPropertyPanel</value>
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 7af2d314744c..a6fe096036f4 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2983,6 +2983,36 @@ interface DrawView
         ExecMethod = FuTemporary;
         StateMethod = GetAttrState;
     ]
+    SID_ATTR_TEXT_AUTOGROWWIDTH
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
+    SID_ATTR_TEXT_AUTOGROWHEIGHT
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
+    SID_ATTR_TEXT_LEFTDIST
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
+    SID_ATTR_TEXT_RIGHTDIST
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
+    SID_ATTR_TEXT_UPPERDIST
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
+    SID_ATTR_TEXT_LOWERDIST
+    [
+        ExecMethod = FuTemporary;
+        StateMethod = GetAttrState;
+    ]
     SID_THEME_DIALOG
     [
         ExecMethod = FuTemporary;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 79bc59887adf..55315e54479e 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -4269,6 +4269,12 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         case SID_ATTR_SOFTEDGE_RADIUS:
         case SID_ATTR_TEXTCOLUMNS_NUMBER:
         case SID_ATTR_TEXTCOLUMNS_SPACING:
+        case SID_ATTR_TEXT_AUTOGROWWIDTH:
+        case SID_ATTR_TEXT_AUTOGROWHEIGHT:
+        case SID_ATTR_TEXT_LEFTDIST:
+        case SID_ATTR_TEXT_RIGHTDIST:
+        case SID_ATTR_TEXT_UPPERDIST:
+        case SID_ATTR_TEXT_LOWERDIST:
             if (const SfxItemSet* pNewArgs = rReq.GetArgs())
                 mpDrawView->SetAttributes(*pNewArgs);
             rReq.Done();
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index d5ae57361155..4377b3282bc0 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -471,6 +471,33 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet )
             }
             break;
 
+            case SID_ATTR_TEXT_AUTOGROWWIDTH:
+            case SID_ATTR_TEXT_AUTOGROWHEIGHT:
+            {
+                SfxItemSet aAttrs(GetDoc()->GetPool());
+                mpDrawView->GetAttributes(aAttrs);
+                const sal_uInt16 nActWhich = nSlotId == 
SID_ATTR_TEXT_AUTOGROWWIDTH
+                                                    ? 
SDRATTR_TEXT_AUTOGROWWIDTH
+                                                    : 
SDRATTR_TEXT_AUTOGROWHEIGHT;
+                rSet.Put(aAttrs.Get(nActWhich).CloneSetWhich(nSlotId));
+            }
+            break;
+            case SID_ATTR_TEXT_LEFTDIST:
+            case SID_ATTR_TEXT_RIGHTDIST:
+            case SID_ATTR_TEXT_UPPERDIST:
+            case SID_ATTR_TEXT_LOWERDIST:
+            {
+                SfxItemSet aAttrs(GetDoc()->GetPool());
+                mpDrawView->GetAttributes(aAttrs);
+                const sal_uInt16 nActWhich =
+                    nSlotId == SID_ATTR_TEXT_LEFTDIST   ? 
SDRATTR_TEXT_LEFTDIST :
+                    nSlotId == SID_ATTR_TEXT_RIGHTDIST  ? 
SDRATTR_TEXT_RIGHTDIST :
+                    nSlotId == SID_ATTR_TEXT_UPPERDIST  ? 
SDRATTR_TEXT_UPPERDIST :
+                                                        SDRATTR_TEXT_LOWERDIST;
+                rSet.Put(aAttrs.Get(nActWhich).CloneSetWhich(nSlotId));
+            }
+            break;
+
             case SID_HYPHENATION:
             {
                 SfxItemSet aAttrs( GetDoc()->GetPool() );
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 03555bbe795f..46d2210e53f1 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -13389,6 +13389,104 @@ SfxInt16Item TextColumnsNumber 
SID_ATTR_TEXTCOLUMNS_NUMBER
     GroupId = SfxGroupId::Format;
 ]
 
+
+SfxBoolItem TextAutoGrowWidth SID_ATTR_TEXT_AUTOGROWWIDTH
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = TRUE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE;
+    GroupId = SfxGroupId::Format;
+]
+
+SfxBoolItem TextAutoGrowHeight SID_ATTR_TEXT_AUTOGROWHEIGHT
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = TRUE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE;
+    GroupId = SfxGroupId::Format;
+]
+
+SdrMetricItem TextLeftDist SID_ATTR_TEXT_LEFTDIST
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = SfxGroupId::Format;
+]
+
+SdrMetricItem TextRightDist SID_ATTR_TEXT_RIGHTDIST
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = SfxGroupId::Format;
+]
+
+SdrMetricItem TextUpperDist SID_ATTR_TEXT_UPPERDIST
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = SfxGroupId::Format;
+]
+
+SdrMetricItem TextLowerDist SID_ATTR_TEXT_LOWERDIST
+[
+    AutoUpdate = TRUE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = FALSE,
+    MenuConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = SfxGroupId::Format;
+]
+
+
 SdrMetricItem TextColumnsSpacing SID_ATTR_TEXTCOLUMNS_SPACING
 
 [
diff --git a/svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.cxx 
b/svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.cxx
index 97b7b5c0c861..ba2a2a54f1d0 100644
--- a/svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.cxx
+++ b/svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.cxx
@@ -20,6 +20,11 @@
 #include <svx/svddef.hxx>
 #include <svx/svxids.hrc>
 #include <svl/itemset.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdpool.hxx>
+#include <svl/eitem.hxx>
+#include <svx/sdtfsitm.hxx>
+#include <svx/svdoattr.hxx>
 
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 
@@ -50,11 +55,34 @@ 
TextColumnsPropertyPanel::TextColumnsPropertyPanel(weld::Widget* pParent, SfxBin
           m_xBuilder->weld_metric_spin_button(u"MTR_FLD_COL_SPACING"_ustr, 
FieldUnit::CM))
     , maColumnsNumberController(SID_ATTR_TEXTCOLUMNS_NUMBER, *pBindings, *this)
     , maColumnsSpacingController(SID_ATTR_TEXTCOLUMNS_SPACING, *pBindings, 
*this)
+    , m_xFitWidth(m_xBuilder->weld_check_button(u"CBX_FIT_WIDTH"_ustr))
+    , m_xFitHeight(m_xBuilder->weld_check_button(u"CBX_FIT_HEIGHT"_ustr))
+    , m_xFitFrame(m_xBuilder->weld_check_button(u"CBX_FIT_FRAME"_ustr))
+    , maFitController(SID_ATTR_TEXT_FITTOSIZE, *pBindings, *this)
+    , maFitWidthController(SID_ATTR_TEXT_AUTOGROWWIDTH, *pBindings, *this)
+    , maFitHeightController(SID_ATTR_TEXT_AUTOGROWHEIGHT, *pBindings, *this)
+    , 
m_xPaddingLeft(m_xBuilder->weld_metric_spin_button(u"MTR_PADDING_LEFT"_ustr, 
FieldUnit::CM))
+    , 
m_xPaddingRight(m_xBuilder->weld_metric_spin_button(u"MTR_PADDING_RIGHT"_ustr, 
FieldUnit::CM))
+    , 
m_xPaddingTop(m_xBuilder->weld_metric_spin_button(u"MTR_PADDING_TOP"_ustr, 
FieldUnit::CM))
+    , m_xPaddingBottom(
+          m_xBuilder->weld_metric_spin_button(u"MTR_PADDING_BOTTOM"_ustr, 
FieldUnit::CM))
+    , maLeftDistController(SID_ATTR_TEXT_LEFTDIST, *pBindings, *this)
+    , maRightDistController(SID_ATTR_TEXT_RIGHTDIST, *pBindings, *this)
+    , maUpperDistController(SID_ATTR_TEXT_UPPERDIST, *pBindings, *this)
+    , maLowerDistController(SID_ATTR_TEXT_LOWERDIST, *pBindings, *this)
+
 {
     m_xColumnsNumber->connect_value_changed(
         LINK(this, TextColumnsPropertyPanel, ModifyColumnsNumberHdl));
     m_xColumnsSpacing->connect_value_changed(
         LINK(this, TextColumnsPropertyPanel, ModifyColumnsSpacingHdl));
+    m_xFitWidth->connect_toggled(LINK(this, TextColumnsPropertyPanel, 
ClickFitOptionHdl));
+    m_xFitHeight->connect_toggled(LINK(this, TextColumnsPropertyPanel, 
ClickFitOptionHdl));
+    m_xFitFrame->connect_toggled(LINK(this, TextColumnsPropertyPanel, 
ClickFitOptionHdl));
+    m_xPaddingLeft->connect_value_changed(LINK(this, TextColumnsPropertyPanel, 
ModifyPaddingHdl));
+    m_xPaddingRight->connect_value_changed(LINK(this, 
TextColumnsPropertyPanel, ModifyPaddingHdl));
+    m_xPaddingTop->connect_value_changed(LINK(this, TextColumnsPropertyPanel, 
ModifyPaddingHdl));
+    m_xPaddingBottom->connect_value_changed(LINK(this, 
TextColumnsPropertyPanel, ModifyPaddingHdl));
 }
 
 TextColumnsPropertyPanel::~TextColumnsPropertyPanel()
@@ -64,10 +92,24 @@ TextColumnsPropertyPanel::~TextColumnsPropertyPanel()
 
     m_xColumnsSpacing.reset();
     m_xColumnsNumber.reset();
+
+    m_xFitWidth.reset();
+    m_xFitHeight.reset();
+    m_xFitFrame.reset();
+
+    maFitController.dispose();
+    maFitWidthController.dispose();
+    maFitHeightController.dispose();
+
+    maLeftDistController.dispose();
+    maRightDistController.dispose();
+    maUpperDistController.dispose();
+    maLowerDistController.dispose();
 }
 
 IMPL_LINK_NOARG(TextColumnsPropertyPanel, ModifyColumnsNumberHdl, 
weld::SpinButton&, void)
 {
+    m_xColumnsSpacing->set_sensitive(m_xColumnsNumber->get_value() > 1);
     SfxInt16Item aItem(SDRATTR_TEXTCOLUMNS_NUMBER, 
m_xColumnsNumber->get_value());
     mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_TEXTCOLUMNS_NUMBER, 
SfxCallMode::RECORD,
                                              { &aItem });
@@ -81,6 +123,97 @@ IMPL_LINK_NOARG(TextColumnsPropertyPanel, 
ModifyColumnsSpacingHdl, weld::MetricS
                                              { &aItem });
 }
 
+IMPL_LINK(TextColumnsPropertyPanel, ClickFitOptionHdl, weld::Toggleable&, 
rButton, void)
+{
+    const bool bFitWidth = m_xFitWidth->get_active();
+    const bool bFitHeight = m_xFitHeight->get_active();
+    const bool bFitFrame = m_xFitFrame->get_active();
+
+    if (&rButton == m_xFitFrame.get())
+    {
+        css::drawing::TextFitToSizeType eType = bFitFrame
+                                                    ? 
css::drawing::TextFitToSizeType_PROPORTIONAL
+                                                    : 
css::drawing::TextFitToSizeType_NONE;
+        SdrTextFitToSizeTypeItem aItem(eType);
+        mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_TEXT_FITTOSIZE, 
SfxCallMode::RECORD,
+                                                 { &aItem });
+
+        if (bFitFrame && m_xFitFrame->get_sensitive())
+        {
+            // Disable Fit Width / Fit Height when Fit to Frame is On
+            m_xFitWidth->set_active(false);
+            m_xFitHeight->set_active(false);
+            m_xFitWidth->set_sensitive(false);
+            m_xFitHeight->set_sensitive(false);
+        }
+        else
+        {
+            // Re-enable both options when Fit to Frame is Off
+            m_xFitWidth->set_sensitive(true);
+            m_xFitHeight->set_sensitive(true);
+        }
+    }
+    else if (&rButton == m_xFitWidth.get() || &rButton == m_xFitHeight.get())
+    {
+        if (&rButton == m_xFitWidth.get())
+        {
+            SfxBoolItem aItem(SDRATTR_TEXT_AUTOGROWWIDTH, bFitWidth);
+            
mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_TEXT_AUTOGROWWIDTH,
+                                                     SfxCallMode::RECORD, { 
&aItem });
+        }
+        else
+        {
+            SfxBoolItem aItem(SDRATTR_TEXT_AUTOGROWHEIGHT, bFitHeight);
+            
mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_TEXT_AUTOGROWHEIGHT,
+                                                     SfxCallMode::RECORD, { 
&aItem });
+        }
+
+        if (bFitWidth || bFitHeight)
+        {
+            m_xFitFrame->set_active(false);
+            m_xFitFrame->set_sensitive(false);
+        }
+        else
+        {
+            m_xFitFrame->set_sensitive(true);
+        }
+    }
+}
+
+IMPL_LINK(TextColumnsPropertyPanel, ModifyPaddingHdl, weld::MetricSpinButton&, 
rCtrl, void)
+{
+    const MapUnit aUnit = GetUnit(mpBindings, SDRATTR_TEXT_LEFTDIST);
+    sal_uInt16 nSID = 0;
+    sal_uInt16 nWhich = 0;
+
+    if (&rCtrl == m_xPaddingLeft.get())
+    {
+        nSID = SID_ATTR_TEXT_LEFTDIST;
+        nWhich = SDRATTR_TEXT_LEFTDIST;
+    }
+    else if (&rCtrl == m_xPaddingRight.get())
+    {
+        nSID = SID_ATTR_TEXT_RIGHTDIST;
+        nWhich = SDRATTR_TEXT_RIGHTDIST;
+    }
+    else if (&rCtrl == m_xPaddingTop.get())
+    {
+        nSID = SID_ATTR_TEXT_UPPERDIST;
+        nWhich = SDRATTR_TEXT_UPPERDIST;
+    }
+    else if (&rCtrl == m_xPaddingBottom.get())
+    {
+        nSID = SID_ATTR_TEXT_LOWERDIST;
+        nWhich = SDRATTR_TEXT_LOWERDIST;
+    }
+
+    if (nSID && nWhich)
+    {
+        SdrMetricItem aItem(TypedWhichId<SdrMetricItem>(nWhich), 
GetCoreValue(rCtrl, aUnit));
+        mpBindings->GetDispatcher()->ExecuteList(nSID, SfxCallMode::RECORD, { 
&aItem });
+    }
+}
+
 void TextColumnsPropertyPanel::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState 
eState,
                                                 const SfxPoolItem* pState)
 {
@@ -90,7 +223,10 @@ void TextColumnsPropertyPanel::NotifyItemUpdate(sal_uInt16 
nSID, SfxItemState eS
             if (eState >= SfxItemState::DEFAULT)
             {
                 if (const auto pItem = dynamic_cast<const 
SfxInt16Item*>(pState))
+                {
                     m_xColumnsNumber->set_value(pItem->GetValue());
+                    m_xColumnsSpacing->set_sensitive(pItem->GetValue() > 1);
+                }
             }
             break;
         case SID_ATTR_TEXTCOLUMNS_SPACING:
@@ -101,7 +237,56 @@ void TextColumnsPropertyPanel::NotifyItemUpdate(sal_uInt16 
nSID, SfxItemState eS
                     SetMetricValue(*m_xColumnsSpacing, pItem->GetValue(), 
aUnit);
             }
             break;
+        case SID_ATTR_TEXT_FITTOSIZE:
+            if (eState >= SfxItemState::DEFAULT)
+            {
+                if (const auto pFit = dynamic_cast<const 
SdrTextFitToSizeTypeItem*>(pState))
+                {
+                    bool bFrame
+                        = (pFit->GetValue() == 
css::drawing::TextFitToSizeType_PROPORTIONAL);
+                    m_xFitFrame->set_active(bFrame);
+                    if (bFrame)
+                    {
+                        m_xFitWidth->set_active(false);
+                        m_xFitHeight->set_active(false);
+                    }
+                }
+            }
+            break;
+
+        case SID_ATTR_TEXT_AUTOGROWWIDTH:
+            if (eState >= SfxItemState::DEFAULT)
+                if (const auto pBool = dynamic_cast<const 
SfxBoolItem*>(pState))
+                    m_xFitWidth->set_active(pBool->GetValue());
+            break;
+
+        case SID_ATTR_TEXT_AUTOGROWHEIGHT:
+            if (eState >= SfxItemState::DEFAULT)
+                if (const auto pBool = dynamic_cast<const 
SfxBoolItem*>(pState))
+                    m_xFitHeight->set_active(pBool->GetValue());
+            break;
+        case SID_ATTR_TEXT_LEFTDIST:
+            if (eState >= SfxItemState::DEFAULT)
+                if (const auto pItem = dynamic_cast<const 
SdrMetricItem*>(pState))
+                    SetMetricValue(*m_xPaddingLeft, pItem->GetValue(), 
GetUnit(mpBindings, nSID));
+            break;
+        case SID_ATTR_TEXT_RIGHTDIST:
+            if (eState >= SfxItemState::DEFAULT)
+                if (const auto pItem = dynamic_cast<const 
SdrMetricItem*>(pState))
+                    SetMetricValue(*m_xPaddingRight, pItem->GetValue(), 
GetUnit(mpBindings, nSID));
+            break;
+        case SID_ATTR_TEXT_UPPERDIST:
+            if (eState >= SfxItemState::DEFAULT)
+                if (const auto pItem = dynamic_cast<const 
SdrMetricItem*>(pState))
+                    SetMetricValue(*m_xPaddingTop, pItem->GetValue(), 
GetUnit(mpBindings, nSID));
+            break;
+        case SID_ATTR_TEXT_LOWERDIST:
+            if (eState >= SfxItemState::DEFAULT)
+                if (const auto pItem = dynamic_cast<const 
SdrMetricItem*>(pState))
+                    SetMetricValue(*m_xPaddingBottom, pItem->GetValue(), 
GetUnit(mpBindings, nSID));
+            break;
     }
+    UpdateFitControls();
 }
 
 std::unique_ptr<PanelLayout> TextColumnsPropertyPanel::Create(weld::Widget* 
pParent,
@@ -116,6 +301,24 @@ std::unique_ptr<PanelLayout> 
TextColumnsPropertyPanel::Create(weld::Widget* pPar
 
     return std::make_unique<TextColumnsPropertyPanel>(pParent, pBindings);
 }
+
+void TextColumnsPropertyPanel::UpdateFitControls()
+{
+    const bool bFitFrame = m_xFitFrame->get_active();
+    const bool bFitWidth = m_xFitWidth->get_active();
+    const bool bFitHeight = m_xFitHeight->get_active();
+
+    // fit frame disable width/height
+    m_xFitWidth->set_sensitive(!bFitFrame);
+    m_xFitHeight->set_sensitive(!bFitFrame);
+
+    // width/height disable Fit Frame
+    const bool bDisableFrame = (bFitWidth || bFitHeight);
+    m_xFitFrame->set_sensitive(!bDisableFrame);
+
+    if (bDisableFrame)
+        m_xFitFrame->set_active(false);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.hxx 
b/svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.hxx
index 0888cb9d75d8..17ae0b55c45e 100644
--- a/svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.hxx
+++ b/svx/source/sidebar/textcolumns/TextColumnsPropertyPanel.hxx
@@ -38,8 +38,30 @@ private:
     sfx2::sidebar::ControllerItem maColumnsNumberController;
     sfx2::sidebar::ControllerItem maColumnsSpacingController;
 
+    std::unique_ptr<weld::CheckButton> m_xFitWidth;
+    std::unique_ptr<weld::CheckButton> m_xFitHeight;
+    std::unique_ptr<weld::CheckButton> m_xFitFrame;
+
+    sfx2::sidebar::ControllerItem maFitController;
+    sfx2::sidebar::ControllerItem maFitWidthController;
+    sfx2::sidebar::ControllerItem maFitHeightController;
+
+    std::unique_ptr<weld::MetricSpinButton> m_xPaddingLeft;
+    std::unique_ptr<weld::MetricSpinButton> m_xPaddingRight;
+    std::unique_ptr<weld::MetricSpinButton> m_xPaddingTop;
+    std::unique_ptr<weld::MetricSpinButton> m_xPaddingBottom;
+
+    sfx2::sidebar::ControllerItem maLeftDistController;
+    sfx2::sidebar::ControllerItem maRightDistController;
+    sfx2::sidebar::ControllerItem maUpperDistController;
+    sfx2::sidebar::ControllerItem maLowerDistController;
+
     DECL_LINK(ModifyColumnsNumberHdl, weld::SpinButton&, void);
     DECL_LINK(ModifyColumnsSpacingHdl, weld::MetricSpinButton&, void);
+    DECL_LINK(ClickFitOptionHdl, weld::Toggleable&, void);
+    DECL_LINK(ModifyPaddingHdl, weld::MetricSpinButton&, void);
+
+    void UpdateFitControls();
 };
 }
 
diff --git a/svx/uiconfig/ui/sidebartextcolumnspanel.ui 
b/svx/uiconfig/ui/sidebartextcolumnspanel.ui
index 65298f833940..76b833ffb11c 100644
--- a/svx/uiconfig/ui/sidebartextcolumnspanel.ui
+++ b/svx/uiconfig/ui/sidebartextcolumnspanel.ui
@@ -4,38 +4,109 @@
   <requires lib="gtk+" version="3.24"/>
   <object class="GtkAdjustment" id="adjustmentColNumber">
     <property name="lower">1</property>
-    <!-- MSO has an upper limit of 16 in UI -->
     <property name="upper">16</property>
     <property name="step-increment">1</property>
-    <property name="page-increment">10</property>
   </object>
   <object class="GtkAdjustment" id="adjustmentColSpacing">
     <property name="lower">0</property>
     <property name="upper">2147483647</property>
     <property name="step-increment">1</property>
-    <property name="page-increment">10</property>
   </object>
-  <!-- n-columns=1 n-rows=1 -->
+  <object class="GtkAdjustment" id="adjustmentPaddingLeft">
+    <property name="lower">0</property>
+    <property name="upper">1000</property>
+    <property name="step-increment">0.1</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustmentPaddingRight">
+    <property name="lower">0</property>
+    <property name="upper">1000</property>
+    <property name="step-increment">0.1</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustmentPaddingTop">
+    <property name="lower">0</property>
+    <property name="upper">1000</property>
+    <property name="step-increment">0.1</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustmentPaddingBottom">
+    <property name="lower">0</property>
+    <property name="upper">1000</property>
+    <property name="step-increment">0.1</property>
+  </object>
   <object class="GtkGrid" id="TextColumnsPropertyPanel">
     <property name="visible">True</property>
-    <property name="can-focus">False</property>
+    <property name="column-spacing">12</property>
+    <property name="row-spacing">6</property>
+    <property name="border-width">6</property>
+    <property name="hexpand">True</property>
     <child>
-      <!-- n-columns=2 n-rows=2 -->
-      <object class="GtkGrid" id="grid1">
+      <object class="GtkGrid" id="gridTextFitting">
         <property name="visible">True</property>
-        <property name="can-focus">False</property>
+        <property name="row-spacing">6</property>
         <property name="hexpand">True</property>
-        <property name="border-width">6</property>
-        <property name="row-spacing">3</property>
-        <property name="column-spacing">6</property>
         <child>
-          <object class="GtkLabel" id="labelColNumber">
+          <object class="GtkCheckButton" id="CBX_FIT_WIDTH">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|fitWidth">Fit width to text</property>
             <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="label" translatable="yes" 
context="sidebartextcolumns|labelColNumber">_Number of columns:</property>
-            <property name="use-underline">True</property>
-            <property name="mnemonic-widget">FLD_COL_NUMBER</property>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="top-attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="CBX_FIT_HEIGHT">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|fitHeight">Fit height to text</property>
+            <property name="visible">True</property>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="top-attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkCheckButton" id="CBX_FIT_FRAME">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|fitFrame">Fit text to frame</property>
+            <property name="visible">True</property>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="top-attach">2</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left-attach">0</property>
+        <property name="top-attach">0</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="labelPaddingSection">
+        <property name="label" translatable="yes" 
context="sidebartextcolumns|framePadding">Spacing to borders:</property>
+        <property name="visible">True</property>
+        <property name="xalign">0</property>
+        <property name="margin-top">6</property>
+      </object>
+      <packing>
+        <property name="left-attach">0</property>
+        <property name="top-attach">1</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid" id="gridPadding">
+        <property name="visible">True</property>
+        <property name="column-spacing">12</property>
+        <property name="row-spacing">6</property>
+        <property name="hexpand">True</property>
+        <property name="margin-top">6</property>
+        <property name="margin-start">12</property>
+        <child>
+          <object class="GtkLabel" id="labelPaddingLeft">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|paddingLeft">Left:</property>
             <property name="xalign">0</property>
+            <property name="visible">True</property>
+            <property name="mnemonic-widget">MTR_PADDING_LEFT</property>
           </object>
           <packing>
             <property name="left-attach">0</property>
@@ -43,13 +114,47 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="labelColSpacing">
+          <object class="GtkSpinButton" id="MTR_PADDING_LEFT">
+            <property name="adjustment">adjustmentPaddingLeft</property>
+            <property name="digits">2</property>
             <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="label" translatable="yes" 
context="sidebartextcolumns|labelColSpacing">_Spacing:</property>
-            <property name="use-underline">True</property>
-            <property name="mnemonic-widget">MTR_FLD_COL_SPACING</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left-attach">1</property>
+            <property name="top-attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="labelPaddingRight">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|paddingRight">Right:</property>
             <property name="xalign">0</property>
+            <property name="visible">True</property>
+            <property name="mnemonic-widget">MTR_PADDING_RIGHT</property>
+          </object>
+          <packing>
+            <property name="left-attach">2</property>
+            <property name="top-attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSpinButton" id="MTR_PADDING_RIGHT">
+            <property name="adjustment">adjustmentPaddingRight</property>
+            <property name="digits">2</property>
+            <property name="visible">True</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left-attach">3</property>
+            <property name="top-attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="labelPaddingTop">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|paddingTop">Top:</property>
+            <property name="xalign">0</property>
+            <property name="visible">True</property>
+            <property name="mnemonic-widget">MTR_PADDING_TOP</property>
           </object>
           <packing>
             <property name="left-attach">0</property>
@@ -57,19 +162,71 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="FLD_COL_NUMBER">
+          <object class="GtkSpinButton" id="MTR_PADDING_TOP">
+            <property name="adjustment">adjustmentPaddingTop</property>
+            <property name="digits">2</property>
             <property name="visible">True</property>
-            <property name="can-focus">True</property>
             <property name="hexpand">True</property>
-            <property name="activates-default">True</property>
-            <property name="truncate-multiline">True</property>
+          </object>
+          <packing>
+            <property name="left-attach">1</property>
+            <property name="top-attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="labelPaddingBottom">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|paddingBottom">Bottom:</property>
+            <property name="xalign">0</property>
+            <property name="visible">True</property>
+            <property name="mnemonic-widget">MTR_PADDING_BOTTOM</property>
+          </object>
+          <packing>
+            <property name="left-attach">2</property>
+            <property name="top-attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSpinButton" id="MTR_PADDING_BOTTOM">
+            <property name="adjustment">adjustmentPaddingBottom</property>
+            <property name="digits">2</property>
+            <property name="visible">True</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left-attach">3</property>
+            <property name="top-attach">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left-attach">0</property>
+        <property name="top-attach">2</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid" id="gridColumns">
+        <property name="visible">True</property>
+        <property name="margin-top">6</property>
+        <property name="column-spacing">12</property>
+        <property name="row-spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="labelColNumber">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|colNumber">Number of columns:</property>
+            <property name="xalign">0</property>
+            <property name="visible">True</property>
+            <property name="mnemonic-widget">FLD_COL_NUMBER</property>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="top-attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSpinButton" id="FLD_COL_NUMBER">
             <property name="adjustment">adjustmentColNumber</property>
             <property name="value">1</property>
-            <child internal-child="accessible">
-              <object class="AtkObject" id="FLD_COL_NUMBER-atkobject">
-                <property name="AtkObject::accessible-description" 
translatable="yes" 
context="sidebartextcolumns|extended_tip|FLD_COL_NUMBER">Enter the number of 
columns to use for the text.</property>
-              </object>
-            </child>
+            <property name="visible">True</property>
           </object>
           <packing>
             <property name="left-attach">1</property>
@@ -77,19 +234,22 @@
           </packing>
         </child>
         <child>
-          <object class="GtkSpinButton" id="MTR_FLD_COL_SPACING">
+          <object class="GtkLabel" id="labelColSpacing">
+            <property name="label" translatable="yes" 
context="sidebartextcolumns|colSpacing">Spacing between columns:</property>
+            <property name="xalign">0</property>
             <property name="visible">True</property>
-            <property name="can-focus">True</property>
-            <property name="hexpand">True</property>
-            <property name="activates-default">True</property>
-            <property name="truncate-multiline">True</property>
+            <property name="mnemonic-widget">MTR_FLD_COL_SPACING</property>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="top-attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkSpinButton" id="MTR_FLD_COL_SPACING">
             <property name="adjustment">adjustmentColSpacing</property>
             <property name="digits">2</property>
-            <child internal-child="accessible">
-              <object class="AtkObject" id="MTR_FLD_COL_SPACING-atkobject">
-                <property name="AtkObject::accessible-description" 
translatable="yes" 
context="sidebartextcolumns|extended_tip|MTR_FLD_COL_SPACING">Enter the amount 
of space to leave between the columns.</property>
-              </object>
-            </child>
+            <property name="visible">True</property>
           </object>
           <packing>
             <property name="left-attach">1</property>
@@ -99,8 +259,9 @@
       </object>
       <packing>
         <property name="left-attach">0</property>
-        <property name="top-attach">0</property>
+        <property name="top-attach">3</property>
+        <property name="width">2</property>
       </packing>
     </child>
   </object>
-</interface>
+</interface>
\ No newline at end of file

Reply via email to