summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2024-01-30 17:07:46 +0100
committerGabor Kelemen <gabor.kelemen.extern@allotropia.de>2024-02-12 18:17:18 +0100
commit828d2637fd3120bfd342b41548caf9c55fc0f603 (patch)
treed4f14d46abd17c833b574c4ab61d78216d809ced /sw
parente42b2827b5d392479791632877fc00b6add0307d (diff)
tdf#159662 Add table alignment and left/right spacing to sidebar in Writer
Change-Id: I12d898f21ca8c7d581aaa1c587c5b6434a35f516 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162769 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/cmdid.h5
-rw-r--r--sw/inc/strings.hrc7
-rw-r--r--sw/sdi/_tabsh.sdi20
-rw-r--r--sw/sdi/swriter.sdi50
-rw-r--r--sw/source/uibase/shells/tabsh.cxx144
-rw-r--r--sw/source/uibase/sidebar/TableEditPanel.cxx147
-rw-r--r--sw/source/uibase/sidebar/TableEditPanel.hxx11
-rw-r--r--sw/uiconfig/swriter/ui/sidebartableedit.ui115
8 files changed, 491 insertions, 8 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 4773f173d603..e8521380c62c 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -520,7 +520,10 @@ class SwUINumRuleItem;
#define FN_FORMAT_APPLY_DEFAULT (FN_FORMAT2 + 157)
#define FN_FORMAT_APPLY_TEXTBODY (FN_FORMAT2 + 158)
#define FN_REMOVE_DIRECT_CHAR_FORMATS (FN_FORMAT2 + 159)
-//free (160)
+#define SID_ATTR_TABLE_ALIGNMENT (FN_FORMAT2 + 160)
+#define SID_ATTR_TABLE_LEFT_SPACE (FN_FORMAT2 + 161)
+#define SID_ATTR_TABLE_RIGHT_SPACE (FN_FORMAT2 + 162)
+//free (163 except 194 already used above)
// Region: Extras
#define FN_LINE_NUMBERING_DLG (FN_EXTRA + 2 ) /* */
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 8f3eadcab6d8..b3e9a9370bfc 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1492,6 +1492,13 @@
#define STR_COMPAT_OPT_USEVARIABLEWIDTHNBSP NC_("STR_COMPAT_OPT_USEVARIABLEWIDTHNBSP", "Render non-breaking spaces (NBSP) as standard-space-width (off for fixed size)")
#define STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER NC_("STR_COMPAT_OPT_NOGAPAFTERNOTENUMBER", "Do not add an extra space after number in footnotes / endnotes with hanging first line")
+#define STR_TABLE_PANEL_ALIGN_AUTO NC_("sidebartableedit|alignautolabel", "Automatic")
+#define STR_TABLE_PANEL_ALIGN_LEFT NC_("sidebartableedit|alignleftlabel", "Left")
+#define STR_TABLE_PANEL_ALIGN_FROM_LEFT NC_("sidebartableedit|alignfromleftlabel", "From left")
+#define STR_TABLE_PANEL_ALIGN_RIGHT NC_("sidebartableedit|alignrightlabel", "Right")
+#define STR_TABLE_PANEL_ALIGN_CENTER NC_("sidebartableedit|aligncenterlabel", "Center")
+#define STR_TABLE_PANEL_ALIGN_MANUAL NC_("sidebartableedit|alignmanuallabel", "Manual")
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/sdi/_tabsh.sdi b/sw/sdi/_tabsh.sdi
index e4b6b9a2dd6c..7596d2c29bda 100644
--- a/sw/sdi/_tabsh.sdi
+++ b/sw/sdi/_tabsh.sdi
@@ -446,5 +446,25 @@ interface BaseTextTable
StateMethod = GetState ;
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
+
+ SID_ATTR_TABLE_ALIGNMENT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+ ]
+
+ SID_ATTR_TABLE_LEFT_SPACE
+ [
+ StateMethod = GetState ;
+ DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+ ]
+
+ SID_ATTR_TABLE_RIGHT_SPACE
+ [
+ StateMethod = GetState ;
+ DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+ ]
+
}
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 861d5ccec21a..16d939a8903d 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -8693,6 +8693,56 @@ SfxUInt32Item TableColumWidth SID_ATTR_TABLE_COLUMN_WIDTH
GroupId = SfxGroupId::Table;
]
+SfxUInt32Item TableAlignment SID_ATTR_TABLE_ALIGNMENT
+(SfxInt32Item TableLeftSpace SID_ATTR_TABLE_LEFT_SPACE, SfxInt32Item TableRightSpace SID_ATTR_TABLE_RIGHT_SPACE)
+[
+ AutoUpdate = TRUE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = SfxGroupId::Table;
+]
+
+SfxInt32Item TableLeftSpace SID_ATTR_TABLE_LEFT_SPACE
+[
+ AutoUpdate = FALSE,
+ FastCall = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = SfxGroupId::Table;
+]
+
+SfxInt32Item TableRightSpace SID_ATTR_TABLE_RIGHT_SPACE
+[
+ AutoUpdate = FALSE,
+ FastCall = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ ToolBoxConfig = FALSE,
+ GroupId = SfxGroupId::Table;
+]
+
SfxVoidItem OutlineLevelsShown FN_OUTLINE_LEVELS_SHOWN
()
[
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 8b1280dcbab7..492cd041d081 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -232,8 +232,7 @@ static std::shared_ptr<SwTableRep> lcl_TableParamToItemSet( SfxItemSet& rSet, Sw
SvxLRSpaceItem aLRSpace( pFormat->GetLRSpace() );
SwTwips nLeft = aLRSpace.GetLeft();
SwTwips nRight = aLRSpace.GetRight();
- SwTwips nDiff = pRep->GetSpace() - nRight - nLeft - nWidth;
- if(nAlign != text::HoriOrientation::FULL && std::abs(nDiff) > 2)
+ if(nAlign != text::HoriOrientation::FULL)
{
SwTwips nLR = pRep->GetSpace() - nWidth;
switch ( nAlign )
@@ -1223,6 +1222,96 @@ void SwTableShell::Execute(SfxRequest &rReq)
}
return;
}
+ case SID_ATTR_TABLE_ALIGNMENT:
+ {
+ const SfxUInt16Item* pAlignItem = rReq.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_ALIGNMENT);
+ if (pAlignItem && pAlignItem->GetValue() <= text::HoriOrientation::LEFT_AND_WIDTH)
+ {
+ SfxItemSetFixed<RES_FRMATR_BEGIN, RES_FRMATR_END - 1> aSet( GetPool());
+ rSh.StartUndo(SwUndoId::TABLE_ATTR);
+ SwFormatHoriOrient aAttr( 0, pAlignItem->GetValue());
+
+ const SfxInt32Item* pLeftItem = rReq.GetArg<SfxInt32Item>(SID_ATTR_TABLE_LEFT_SPACE);
+ const SfxInt32Item* pRightItem = rReq.GetArg<SfxInt32Item>(SID_ATTR_TABLE_RIGHT_SPACE);
+
+ SvxLRSpaceItem aLRSpace( RES_LR_SPACE );
+ SwTwips nLeft = pLeftItem ? pLeftItem->GetValue() : 0;
+ SwTwips nRight = pRightItem ? pRightItem->GetValue() : 0;
+ SwTabCols aTabCols;
+ rSh.GetTabCols(aTabCols);
+ tools::Long nSpace = aTabCols.GetRightMax();
+ SwTwips nWidth = nSpace;
+ switch (pAlignItem->GetValue())
+ {
+ case text::HoriOrientation::LEFT:
+ if (MINLAY < nSpace - nRight)
+ nWidth = nSpace - nRight;
+ else
+ {
+ nWidth = MINLAY;
+ nRight = nSpace - MINLAY;
+ }
+ nLeft = 0;
+ break;
+ case text::HoriOrientation::RIGHT:
+ if (MINLAY < nSpace - nLeft)
+ nWidth = nSpace - nLeft;
+ else
+ {
+ nWidth = MINLAY;
+ nLeft = nSpace - MINLAY;
+ }
+ nRight = 0;
+ break;
+ case text::HoriOrientation::LEFT_AND_WIDTH:
+ // width doesn't change
+ nRight = 0;
+ nLeft = std::min(nLeft, nSpace);
+ break;
+ case text::HoriOrientation::FULL:
+ nLeft = nRight = 0;
+ break;
+ case text::HoriOrientation::CENTER:
+ if (MINLAY < nSpace - 2 * nLeft)
+ nWidth = nSpace - 2 * nLeft;
+ else
+ {
+ nWidth = MINLAY;
+ nLeft = nRight = (nSpace - MINLAY) / 2;
+ }
+ break;
+ case text::HoriOrientation::NONE:
+ if (MINLAY < nSpace - nLeft - nRight)
+ nWidth = nSpace - nLeft - nRight;
+ else
+ {
+ nWidth = MINLAY;
+ //TODO: keep the previous value - if possible and reduce the 'new one' only
+ nLeft = nRight = (nSpace - MINLAY) / 2;
+ }
+ break;
+ default:
+ break;
+ }
+ SwFormatFrameSize aSz( SwFrameSize::Variable, nWidth );
+ aSet.Put(aSz);
+
+ aLRSpace.SetLeft(nLeft);
+ aLRSpace.SetRight(nRight);
+ aSet.Put( aLRSpace );
+
+ aSet.Put( aAttr );
+ rSh.SetTableAttr( aSet );
+ rSh.EndUndo(SwUndoId::TABLE_ATTR);
+ static sal_uInt16 aInva[] =
+ { SID_ATTR_TABLE_LEFT_SPACE,
+ SID_ATTR_TABLE_RIGHT_SPACE,
+ 0
+ };
+ GetView().GetViewFrame().GetBindings().Invalidate( aInva );
+ }
+ return;
+ }
default:
bMore = true;
}
@@ -1569,6 +1658,57 @@ void SwTableShell::GetState(SfxItemSet &rSet)
break;
}
+ case SID_ATTR_TABLE_ALIGNMENT:
+ {
+ const sal_uInt16 nAlign = pFormat->GetHoriOrient().GetHoriOrient();
+ rSet.Put(SfxUInt16Item(nSlot, nAlign));
+ break;
+ }
+ case SID_ATTR_TABLE_LEFT_SPACE:
+ case SID_ATTR_TABLE_RIGHT_SPACE:
+ {
+ SwTabCols aTabCols;
+ rSh.GetTabCols(aTabCols);
+ tools::Long nSpace = aTabCols.GetRightMax();
+ SvxLRSpaceItem aLRSpace(pFormat->GetLRSpace());
+ SwTwips nLeft = aLRSpace.GetLeft();
+ SwTwips nRight = aLRSpace.GetRight();
+
+ sal_uInt16 nPercent = 0;
+ auto nWidth = ::GetTableWidth(pFormat, aTabCols, &nPercent, &rSh );
+ // The table width is wrong for relative values.
+ if (nPercent)
+ nWidth = nSpace * nPercent / 100;
+ const sal_uInt16 nAlign = pFormat->GetHoriOrient().GetHoriOrient();
+ if(nAlign != text::HoriOrientation::FULL )
+ {
+ SwTwips nLR = nSpace - nWidth;
+ switch ( nAlign )
+ {
+ case text::HoriOrientation::CENTER:
+ nLeft = nRight = nLR / 2;
+ break;
+ case text::HoriOrientation::LEFT:
+ nRight = nLR;
+ nLeft = 0;
+ break;
+ case text::HoriOrientation::RIGHT:
+ nLeft = nLR;
+ nRight = 0;
+ break;
+ case text::HoriOrientation::LEFT_AND_WIDTH:
+ nRight = nLR - nLeft;
+ break;
+ case text::HoriOrientation::NONE:
+ if(!nPercent)
+ nWidth = nSpace - nLeft - nRight;
+ break;
+ }
+ }
+ rSet.Put(SfxInt32Item(SID_ATTR_TABLE_LEFT_SPACE, nLeft));
+ rSet.Put(SfxInt32Item(SID_ATTR_TABLE_RIGHT_SPACE, nRight));
+ break;
+ }
}
nSlot = aIter.NextWhich();
}
diff --git a/sw/source/uibase/sidebar/TableEditPanel.cxx b/sw/source/uibase/sidebar/TableEditPanel.cxx
index 61dcd2d4e52a..1022804cbbf0 100644
--- a/sw/source/uibase/sidebar/TableEditPanel.cxx
+++ b/sw/source/uibase/sidebar/TableEditPanel.cxx
@@ -12,6 +12,7 @@
#include <sal/config.h>
#include <swtypes.hxx>
#include <cmdid.h>
+#include <strings.hrc>
#include <svl/intitem.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx>
@@ -21,7 +22,9 @@
#include <comphelper/lok.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+using namespace ::com::sun::star;
namespace sw::sidebar
{
std::unique_ptr<PanelLayout>
@@ -84,6 +87,42 @@ void TableEditPanel::NotifyItemUpdate(const sal_uInt16 nSID, const SfxItemState
break;
}
+ case SID_ATTR_TABLE_ALIGNMENT:
+ if (pState && eState >= SfxItemState::DEFAULT)
+ {
+ const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pState);
+ if (pItem)
+ {
+ sal_uInt16 nAlignment = pItem->GetValue();
+ m_xAlignment->set_active_id(OUString::number(nAlignment));
+ EnableLeftRight(nAlignment);
+ }
+ }
+ break;
+ case SID_ATTR_TABLE_LEFT_SPACE:
+ case SID_ATTR_TABLE_RIGHT_SPACE:
+ {
+ if (pState && eState >= SfxItemState::DEFAULT)
+ {
+ const SfxInt32Item* pItem = static_cast<const SfxInt32Item*>(pState);
+ if (pItem)
+ {
+ if (SID_ATTR_TABLE_LEFT_SPACE == nSID)
+ {
+ m_aLeftSpacingEdit.set_value(
+ m_aLeftSpacingEdit.normalize(pItem->GetValue()), FieldUnit::TWIP);
+ m_aLeftSpacingEdit.save_value();
+ }
+ else
+ {
+ m_aRightSpacingEdit.set_value(
+ m_aRightSpacingEdit.normalize(pItem->GetValue()), FieldUnit::TWIP);
+ m_aRightSpacingEdit.save_value();
+ }
+ }
+ }
+ break;
+ }
}
}
@@ -106,10 +145,16 @@ TableEditPanel::TableEditPanel(weld::Widget* pParent,
, m_xDeleteDispatch(new ToolbarUnoDispatcher(*m_xDelete, *m_xBuilder, rxFrame))
, m_xSplitMerge(m_xBuilder->weld_toolbar("split_merge"))
, m_xSplitMergeDispatch(new ToolbarUnoDispatcher(*m_xSplitMerge, *m_xBuilder, rxFrame))
+ , m_xAlignment(m_xBuilder->weld_combo_box("alignmentLB"))
+ , m_aLeftSpacingEdit(m_xBuilder->weld_metric_spin_button("leftspace", FieldUnit::CM))
+ , m_aRightSpacingEdit(m_xBuilder->weld_metric_spin_button("rightspace", FieldUnit::CM))
, m_xMisc(m_xBuilder->weld_toolbar("misc"))
, m_xMiscDispatch(new ToolbarUnoDispatcher(*m_xMisc, *m_xBuilder, rxFrame))
, m_aRowHeightController(SID_ATTR_TABLE_ROW_HEIGHT, *pBindings, *this)
, m_aColumnWidthController(SID_ATTR_TABLE_COLUMN_WIDTH, *pBindings, *this)
+ , m_aAlignmentController(SID_ATTR_TABLE_ALIGNMENT, *pBindings, *this)
+ , m_aLeftSpacingController(SID_ATTR_TABLE_LEFT_SPACE, *pBindings, *this)
+ , m_aRightSpacingController(SID_ATTR_TABLE_RIGHT_SPACE, *pBindings, *this)
, m_aInsertRowsBeforeController(FN_TABLE_INSERT_ROW_BEFORE, *pBindings, *this)
, m_aInsertRowsAfterController(FN_TABLE_INSERT_ROW_AFTER, *pBindings, *this)
, m_aInsertColumnsBeforeController(FN_TABLE_INSERT_COL_BEFORE, *pBindings, *this)
@@ -133,7 +178,7 @@ TableEditPanel::TableEditPanel(weld::Widget* pParent,
InitRowHeightToolitem();
InitColumnWidthToolitem();
-
+ InitAlignmentControls();
if (comphelper::LibreOfficeKit::isActive())
m_xMisc->set_item_visible(".uno:InsertFormula", false);
}
@@ -166,6 +211,29 @@ void TableEditPanel::InitColumnWidthToolitem()
limitWidthForSidebar(m_aColumnWidthEdit);
}
+void TableEditPanel::InitAlignmentControls()
+{
+ m_xAlignment->connect_changed(LINK(this, TableEditPanel, AlignmentHdl));
+ m_aLeftSpacingEdit.connect_value_changed(LINK(this, TableEditPanel, SpacingHdl));
+ m_aRightSpacingEdit.connect_value_changed(LINK(this, TableEditPanel, SpacingHdl));
+ m_xAlignment->append(OUString::number(text::HoriOrientation::FULL),
+ SwResId(STR_TABLE_PANEL_ALIGN_AUTO));
+ m_xAlignment->append(OUString::number(text::HoriOrientation::LEFT),
+ SwResId(STR_TABLE_PANEL_ALIGN_LEFT));
+ m_xAlignment->append(OUString::number(text::HoriOrientation::LEFT_AND_WIDTH),
+ SwResId(STR_TABLE_PANEL_ALIGN_FROM_LEFT));
+ m_xAlignment->append(OUString::number(text::HoriOrientation::RIGHT),
+ SwResId(STR_TABLE_PANEL_ALIGN_RIGHT));
+ m_xAlignment->append(OUString::number(text::HoriOrientation::CENTER),
+ SwResId(STR_TABLE_PANEL_ALIGN_CENTER));
+ m_xAlignment->append(OUString::number(text::HoriOrientation::NONE),
+ SwResId(STR_TABLE_PANEL_ALIGN_MANUAL));
+
+ FieldUnit eFieldUnit = SW_MOD()->GetUsrPref(false)->GetMetric();
+ m_aLeftSpacingEdit.SetFieldUnit(eFieldUnit);
+ m_aRightSpacingEdit.SetFieldUnit(eFieldUnit);
+}
+
TableEditPanel::~TableEditPanel()
{
m_xMiscDispatch.reset();
@@ -207,6 +275,33 @@ TableEditPanel::~TableEditPanel()
m_aMergeCellsController.dispose();
}
+void TableEditPanel::EnableLeftRight(sal_uInt16 nAlignment)
+{
+ bool enableLeft = true;
+ bool enableRight = true;
+ switch (nAlignment)
+ {
+ case text::HoriOrientation::FULL:
+ enableLeft = false;
+ enableRight = false;
+ break;
+ case text::HoriOrientation::LEFT:
+ enableLeft = false;
+ break;
+ case text::HoriOrientation::CENTER:
+ case text::HoriOrientation::RIGHT:
+ enableRight = false;
+ break;
+ case text::HoriOrientation::LEFT_AND_WIDTH:
+ enableRight = false;
+ break;
+ default:
+ break;
+ }
+ m_aLeftSpacingEdit.set_sensitive(enableLeft);
+ m_aRightSpacingEdit.set_sensitive(enableRight);
+}
+
IMPL_LINK_NOARG(TableEditPanel, RowHeightMofiyHdl, weld::MetricSpinButton&, void)
{
SwTwips nNewHeight = static_cast<SwTwips>(
@@ -228,6 +323,56 @@ IMPL_LINK_NOARG(TableEditPanel, ColumnWidthMofiyHdl, weld::MetricSpinButton&, vo
m_pBindings->GetDispatcher()->ExecuteList(SID_ATTR_TABLE_COLUMN_WIDTH, SfxCallMode::RECORD,
{ &aColumnWidth });
}
+
+IMPL_LINK_NOARG(TableEditPanel, AlignmentHdl, weld::ComboBox&, void) { AlignmentModify(true); }
+
+IMPL_LINK(TableEditPanel, SpacingHdl, weld::MetricSpinButton&, rField, void)
+{
+ if (!rField.get_value_changed_from_saved())
+ return;
+ rField.save_value();
+ AlignmentModify(false);
+}
+
+void TableEditPanel::AlignmentModify(bool alignmentChanged)
+{
+ sal_uInt16 nAlign = m_xAlignment->get_active_id().toUInt32();
+ SwTwips nLeft = static_cast<SwTwips>(
+ m_aLeftSpacingEdit.denormalize(m_aLeftSpacingEdit.get_value(FieldUnit::TWIP)));
+ SwTwips nRight = static_cast<SwTwips>(
+ m_aRightSpacingEdit.denormalize(m_aRightSpacingEdit.get_value(FieldUnit::TWIP)));
+ if (alignmentChanged)
+ {
+ EnableLeftRight(nAlign);
+ switch (nAlign)
+ {
+ case text::HoriOrientation::CENTER:
+ nLeft = nRight = (nLeft + nRight) / 2;
+ break;
+ case text::HoriOrientation::LEFT:
+ nRight = nLeft + nRight;
+ nLeft = 0;
+ break;
+ case text::HoriOrientation::RIGHT:
+ nLeft = nLeft + nRight;
+ nRight = 0;
+ break;
+ default:
+ if (!m_aLeftSpacingEdit.get_sensitive())
+ nLeft = 0;
+ if (!m_aRightSpacingEdit.get_sensitive())
+ nRight = 0;
+ break;
+ }
+ }
+
+ SfxUInt16Item aAlign(SID_ATTR_TABLE_ALIGNMENT, nAlign);
+ SfxInt32Item aLeft(SID_ATTR_TABLE_LEFT_SPACE, nLeft);
+ SfxInt32Item aRight(SID_ATTR_TABLE_RIGHT_SPACE, nRight);
+ m_pBindings->GetDispatcher()->ExecuteList(SID_ATTR_TABLE_ALIGNMENT, SfxCallMode::RECORD,
+ { &aAlign, &aLeft, &aRight });
+}
+
} // end of namespace ::sw::sidebar
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/sidebar/TableEditPanel.hxx b/sw/source/uibase/sidebar/TableEditPanel.hxx
index 140de8653896..8aee8b4cea6d 100644
--- a/sw/source/uibase/sidebar/TableEditPanel.hxx
+++ b/sw/source/uibase/sidebar/TableEditPanel.hxx
@@ -39,6 +39,9 @@ public:
private:
void InitRowHeightToolitem();
void InitColumnWidthToolitem();
+ void InitAlignmentControls();
+ void EnableLeftRight(sal_uInt16 nAlignment);
+ void AlignmentModify(bool alignmentChanged);
SfxBindings* m_pBindings;
@@ -56,11 +59,17 @@ private:
std::unique_ptr<ToolbarUnoDispatcher> m_xDeleteDispatch;
std::unique_ptr<weld::Toolbar> m_xSplitMerge;
std::unique_ptr<ToolbarUnoDispatcher> m_xSplitMergeDispatch;
+ std::unique_ptr<weld::ComboBox> m_xAlignment;
+ SvxRelativeField m_aLeftSpacingEdit;
+ SvxRelativeField m_aRightSpacingEdit;
std::unique_ptr<weld::Toolbar> m_xMisc;
std::unique_ptr<ToolbarUnoDispatcher> m_xMiscDispatch;
::sfx2::sidebar::ControllerItem m_aRowHeightController;
::sfx2::sidebar::ControllerItem m_aColumnWidthController;
+ ::sfx2::sidebar::ControllerItem m_aAlignmentController;
+ ::sfx2::sidebar::ControllerItem m_aLeftSpacingController;
+ ::sfx2::sidebar::ControllerItem m_aRightSpacingController;
::sfx2::sidebar::ControllerItem m_aInsertRowsBeforeController;
::sfx2::sidebar::ControllerItem m_aInsertRowsAfterController;
::sfx2::sidebar::ControllerItem m_aInsertColumnsBeforeController;
@@ -78,6 +87,8 @@ private:
DECL_LINK(RowHeightMofiyHdl, weld::MetricSpinButton&, void);
DECL_LINK(ColumnWidthMofiyHdl, weld::MetricSpinButton&, void);
+ DECL_LINK(AlignmentHdl, weld::ComboBox&, void);
+ DECL_LINK(SpacingHdl, weld::MetricSpinButton&, void);
};
} // end of namespace sw::sidebar
diff --git a/sw/uiconfig/swriter/ui/sidebartableedit.ui b/sw/uiconfig/swriter/ui/sidebartableedit.ui
index 55c4a839ef30..e3a50c34321e 100644
--- a/sw/uiconfig/swriter/ui/sidebartableedit.ui
+++ b/sw/uiconfig/swriter/ui/sidebartableedit.ui
@@ -12,12 +12,24 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="lower">-99.98999999999999</property>
+ <property name="upper">99.98999999999999</property>
+ <property name="step-increment">0.05</property>
+ <property name="page-increment">1</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment4">
+ <property name="lower">-99.98999999999999</property>
+ <property name="upper">99.98999999999999</property>
+ <property name="step-increment">0.05</property>
+ <property name="page-increment">1</property>
+ </object>
<!-- n-columns=1 n-rows=1 -->
<object class="GtkGrid" id="TableEditPanel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
- <!-- n-columns=2 n-rows=10 -->
+ <!-- n-columns=2 n-rows=14 -->
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -453,6 +465,95 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="align_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes" context="sidebartableedit|align_label">Alignment:</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">alignmentLB</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="alignmentLB">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="tooltip-text" translatable="yes" context="sidebartableedit|alignmentLB|tooltip_text">Set the alignment options for the selected table.</property>
+ <property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="leftspace_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes" context="sidebartableedit|leftspace_label">Left spacing:</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">leftspace</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="rightspace_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="label" translatable="yes" context="sidebartableedit|align_label">Right spacing:</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">rightspace</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="leftspace">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="tooltip-text" translatable="yes" context="sidebatableedit|leftspace|tooltip_text">Left Spacing</property>
+ <property name="hexpand">True</property>
+ <property name="text">0</property>
+ <property name="truncate-multiline">True</property>
+ <property name="adjustment">adjustment3</property>
+ <property name="digits">2</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">11</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="rightspace">
+ <property name="visible">True</property>
+ <property name="can-focus">True</property>
+ <property name="tooltip-text" translatable="yes" context="sidebatableedit|rightspace|tooltip_text">Right Spacing</property>
+ <property name="hexpand">True</property>
+ <property name="text">0</property>
+ <property name="truncate-multiline">True</property>
+ <property name="adjustment">adjustment4</property>
+ <property name="digits">2</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">11</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkToolbar" id="misc">
<property name="visible">True</property>
<property name="can-focus">True</property>
@@ -496,7 +597,7 @@
</object>
<packing>
<property name="left-attach">1</property>
- <property name="top-attach">9</property>
+ <property name="top-attach">13</property>
</packing>
</child>
<child>
@@ -510,7 +611,7 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">9</property>
+ <property name="top-attach">13</property>
</packing>
</child>
<child>
@@ -520,10 +621,16 @@
</object>
<packing>
<property name="left-attach">0</property>
- <property name="top-attach">8</property>
+ <property name="top-attach">12</property>
<property name="width">2</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="left-attach">0</property>