sw/inc/cmdid.h | 1 sw/sdi/_tabsh.sdi | 7 sw/sdi/swriter.sdi | 18 ++ sw/source/uibase/shells/tabsh.cxx | 22 ++ sw/source/uibase/sidebar/TableEditPanel.cxx | 73 +++++++- sw/source/uibase/sidebar/TableEditPanel.hxx | 6 sw/uiconfig/swriter/ui/sidebartableedit.ui | 228 +++++++++------------------- 7 files changed, 194 insertions(+), 161 deletions(-)
New commits: commit 902c56218a06e4ed80202a71a3c2e4dceefb2c57 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue Oct 29 13:39:00 2019 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Mon Nov 4 17:52:37 2019 +0100 Table panel: Redesign the panel a bit * Remove some labels. * Move 'Merge Cells' button next to the insert / delete buttons. Change-Id: Ibe0acc8e8825dbaa84464bc7347f7711f8185680 Reviewed-on: https://gerrit.libreoffice.org/81896 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 9b400e84b1689997378f6738b97b71b09cdb7be6) Reviewed-on: https://gerrit.libreoffice.org/82027 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sw/uiconfig/swriter/ui/sidebartableedit.ui b/sw/uiconfig/swriter/ui/sidebartableedit.ui index e48865b0f8a8..6f9c477bffd6 100644 --- a/sw/uiconfig/swriter/ui/sidebartableedit.ui +++ b/sw/uiconfig/swriter/ui/sidebartableedit.ui @@ -18,84 +18,57 @@ <object class="GtkBox" id="box5"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="spacing">20</property> <child> - <object class="GtkBox" id="box6"> + <object class="sfxlo-SidebarToolBox" id="insert"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> <child> - <object class="GtkLabel" id="insertlabel"> + <object class="GtkToolButton" id="insertrowsbefore"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes" context="sidebatableedit|insertlabel">Insert:</property> + <property name="action_name">.uno:InsertRowsBefore</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">insert</property> - <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="homogeneous">True</property> </packing> </child> <child> - <object class="sfxlo-SidebarToolBox" id="insert"> + <object class="GtkToolButton" id="insertrowsafter"> <property name="visible">True</property> <property name="can_focus">False</property> - <child> - <object class="GtkToolButton" id="insertrowsbefore"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">.uno:InsertRowsBefore</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="insertrowsafter"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">.uno:InsertRowsAfter</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="insertcolumnsbefore"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">.uno:InsertColumnsBefore</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="insertcolumnsafter"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">.uno:InsertColumnsAfter</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> + <property name="action_name">.uno:InsertRowsAfter</property> + <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="insertcolumnsbefore"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">.uno:InsertColumnsBefore</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="insertcolumnsafter"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">.uno:InsertColumnsAfter</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> </packing> </child> </object> @@ -106,81 +79,75 @@ </packing> </child> <child> - <object class="GtkBox" id="box7"> + <object class="sfxlo-SidebarToolBox" id="delete"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> <child> - <object class="GtkLabel" id="deletelabel"> + <object class="GtkToolButton" id="deleterows"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes" context="sidebatableedit|deletelabel">Delete:</property> + <property name="action_name">.uno:DeleteRows</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">delete</property> - <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="homogeneous">True</property> </packing> </child> <child> - <object class="sfxlo-SidebarToolBox" id="delete"> + <object class="GtkToolButton" id="deletecolumns"> <property name="visible">True</property> <property name="can_focus">False</property> - <child> - <object class="GtkToolButton" id="deleterows"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">.uno:DeleteRows</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="deletecolumns"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">.uno:DeleteColumns</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - <child> - <object class="GtkToolButton" id="deletetable"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">.uno:DeleteTable</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> + <property name="action_name">.uno:DeleteColumns</property> + <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="deletetable"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">.uno:DeleteTable</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> </packing> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="pack_type">end</property> <property name="position">1</property> </packing> </child> + <child> + <object class="sfxlo-SidebarToolBox" id="merge"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkToolButton" id="mergecells"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="action_name">.uno:MergeCells</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> </object> <packing> <property name="left_attach">0</property> @@ -192,7 +159,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="label" translatable="yes" context="sidebatableedit|deletelabel">Size:</property> + <property name="label" translatable="yes" context="sidebatableedit|sizelabel">Size:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">box3</property> <property name="xalign">0</property> @@ -235,7 +202,7 @@ <property name="text">0</property> <child internal-child="accessible"> <object class="AtkObject" id="rowheight-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="sidebatableedit|rowheight-atkobject">Row Height</property> + <property name="AtkObject::accessible-name" translatable="yes" context="rowheight-atkobject">Row Height</property> </object> </child> </object> @@ -281,7 +248,7 @@ <property name="text">0</property> <child internal-child="accessible"> <object class="AtkObject" id="columnwidth-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="sidebatableedit|columnwidth-atkobject">Column Width</property> + <property name="AtkObject::accessible-name" translatable="yes" context="columnwidth-atkobject">Column Width</property> </object> </child> </object> @@ -411,43 +378,6 @@ <property name="top_attach">3</property> </packing> </child> - <child> - <object class="GtkLabel" id="layoutlabel"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="label" translatable="yes" context="sidebatableedit|deletelabel">Layout:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">layouting</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - </packing> - </child> - <child> - <object class="sfxlo-SidebarToolBox" id="layouting"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <child> - <object class="GtkToolButton" id="mergecells"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="action_name">.uno:MergeCells</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="homogeneous">True</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">5</property> - </packing> - </child> </object> <packing> <property name="left_attach">0</property> commit e300e4382b89e180dbb30cbf7d77c48a77a94af1 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon Oct 28 17:11:21 2019 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Mon Nov 4 17:52:25 2019 +0100 Table panel: Implement functionality of Column Width spinbutton Change-Id: I809cfe4af82cebabe80c171cdd488ff43d749a86 Reviewed-on: https://gerrit.libreoffice.org/81895 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit ac48a33060304a62372b00bfef08b067cec6ceb6) Reviewed-on: https://gerrit.libreoffice.org/82026 Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index d5e29e239df2..2cdf32150685 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -411,6 +411,7 @@ #define FN_TABLE_MODE_VARIABLE (FN_FORMAT + 191) /* -"- */ #define FN_TABLE_BOX_TEXTORIENTATION (FN_FORMAT + 192) /* text orientation of table cells */ #define SID_ATTR_TABLE_ROW_HEIGHT (FN_FORMAT + 193) +#define SID_ATTR_TABLE_COLUMN_WIDTH (FN_FORMAT2 + 194) #define FN_TABLE_AUTOSUM (FN_FORMAT + 195) /* */ diff --git a/sw/sdi/_tabsh.sdi b/sw/sdi/_tabsh.sdi index 948d6e5476f6..e39edc61c3c0 100644 --- a/sw/sdi/_tabsh.sdi +++ b/sw/sdi/_tabsh.sdi @@ -444,5 +444,12 @@ interface BaseTextTable StateMethod = GetState ; DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] + + SID_ATTR_TABLE_COLUMN_WIDTH + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] } diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 9c8eee8fd5b4..f1381c15b0d4 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -7808,3 +7808,21 @@ SfxUInt32Item TableRowHeight SID_ATTR_TABLE_ROW_HEIGHT ToolBoxConfig = TRUE, GroupId = SfxGroupId::Table; ] + +SfxUInt32Item TableColumWidth SID_ATTR_TABLE_COLUMN_WIDTH + +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Table; +] diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index b719c989ff8f..8a380d6d325c 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -1120,6 +1120,18 @@ void SwTableShell::Execute(SfxRequest &rReq) } return; } + case SID_ATTR_TABLE_COLUMN_WIDTH: + { + const SfxUInt32Item* pItem2 = rReq.GetArg<SfxUInt32Item>(SID_ATTR_TABLE_COLUMN_WIDTH); + if (pItem2) + { + long nNewWidth = pItem2->GetValue(); + SwTableFUNC aFunc( &rSh ); + aFunc.InitTabCols(); + aFunc.SetColWidth(aFunc.GetCurColNum(), nNewWidth); + } + return; + } default: bMore = true; } @@ -1407,6 +1419,16 @@ void SwTableShell::GetState(SfxItemSet &rSet) } break; } + case SID_ATTR_TABLE_COLUMN_WIDTH: + { + SfxUInt32Item aColumnWidth(SID_ATTR_TABLE_COLUMN_WIDTH); + SwTableFUNC aFunc( &rSh ); + aFunc.InitTabCols(); + SwTwips nWidth = aFunc.GetColWidth(aFunc.GetCurColNum()); + aColumnWidth.SetValue(nWidth); + rSet.Put(aColumnWidth); + break; + } } nSlot = aIter.NextWhich(); } diff --git a/sw/source/uibase/sidebar/TableEditPanel.cxx b/sw/source/uibase/sidebar/TableEditPanel.cxx index f5650a374309..c61292dd43ec 100644 --- a/sw/source/uibase/sidebar/TableEditPanel.cxx +++ b/sw/source/uibase/sidebar/TableEditPanel.cxx @@ -52,17 +52,39 @@ void TableEditPanel::NotifyItemUpdate(const sal_uInt16 nSID, const SfxItemState if (pItem) { long nNewHeight = pItem->GetValue(); - nNewHeight = m_pHeightEdit->Normalize(nNewHeight); - m_pHeightEdit->SetValue(nNewHeight, FieldUnit::TWIP); + nNewHeight = m_pRowHeightEdit->Normalize(nNewHeight); + m_pRowHeightEdit->SetValue(nNewHeight, FieldUnit::TWIP); } } else if (eState == SfxItemState::DISABLED) { - m_pHeightEdit->Disable(); + m_pRowHeightEdit->Disable(); } else { - m_pHeightEdit->SetEmptyFieldValue(); + m_pRowHeightEdit->SetEmptyFieldValue(); + } + break; + } + case SID_ATTR_TABLE_COLUMN_WIDTH: + { + if (pState && eState >= SfxItemState::DEFAULT) + { + const SfxUInt32Item* pItem = static_cast<const SfxUInt32Item*>(pState); + if (pItem) + { + long nNewWidth = pItem->GetValue(); + nNewWidth = m_pColumnWidthEdit->Normalize(nNewWidth); + m_pColumnWidthEdit->SetValue(nNewWidth, FieldUnit::TWIP); + } + } + else if (eState == SfxItemState::DISABLED) + { + m_pColumnWidthEdit->Disable(); + } + else + { + m_pColumnWidthEdit->SetEmptyFieldValue(); } break; } @@ -75,9 +97,13 @@ TableEditPanel::TableEditPanel(vcl::Window* pParent, : PanelLayout(pParent, "TableEditPanel", "modules/swriter/ui/sidebartableedit.ui", rxFrame) , m_pBindings(pBindings) , m_aRowHeightController(SID_ATTR_TABLE_ROW_HEIGHT, *pBindings, *this) + , m_aColumnWidthController(SID_ATTR_TABLE_COLUMN_WIDTH, *pBindings, *this) { - get(m_pHeightEdit, "rowheight"); + get(m_pRowHeightEdit, "rowheight"); + get(m_pColumnWidthEdit, "columnwidth"); + InitRowHeightToolitem(); + InitColumnWidthToolitem(); } TableEditPanel::~TableEditPanel() { disposeOnce(); } @@ -85,19 +111,33 @@ TableEditPanel::~TableEditPanel() { disposeOnce(); } void TableEditPanel::InitRowHeightToolitem() { Link<Edit&, void> aLink = LINK(this, TableEditPanel, RowHeightMofiyHdl); - m_pHeightEdit->SetModifyHdl(aLink); + m_pRowHeightEdit->SetModifyHdl(aLink); FieldUnit eFieldUnit = SW_MOD()->GetUsrPref(false)->GetMetric(); - SetFieldUnit(*m_pHeightEdit, eFieldUnit); + SetFieldUnit(*m_pRowHeightEdit, eFieldUnit); - m_pHeightEdit->SetMin(MINLAY, FieldUnit::TWIP); - m_pHeightEdit->SetMax(SAL_MAX_INT32, FieldUnit::TWIP); + m_pRowHeightEdit->SetMin(MINLAY, FieldUnit::TWIP); + m_pRowHeightEdit->SetMax(SAL_MAX_INT32, FieldUnit::TWIP); +} + +void TableEditPanel::InitColumnWidthToolitem() +{ + Link<Edit&, void> aLink = LINK(this, TableEditPanel, ColumnWidthMofiyHdl); + m_pColumnWidthEdit->SetModifyHdl(aLink); + + FieldUnit eFieldUnit = SW_MOD()->GetUsrPref(false)->GetMetric(); + SetFieldUnit(*m_pColumnWidthEdit, eFieldUnit); + + m_pColumnWidthEdit->SetMin(MINLAY, FieldUnit::TWIP); + m_pColumnWidthEdit->SetMax(SAL_MAX_INT32, FieldUnit::TWIP); } void TableEditPanel::dispose() { - m_pHeightEdit.clear(); + m_pRowHeightEdit.clear(); + m_pColumnWidthEdit.clear(); m_aRowHeightController.dispose(); + m_aColumnWidthController.dispose(); PanelLayout::dispose(); } @@ -105,13 +145,24 @@ void TableEditPanel::dispose() IMPL_LINK_NOARG(TableEditPanel, RowHeightMofiyHdl, Edit&, void) { SwTwips nNewHeight = static_cast<SwTwips>( - m_pHeightEdit->Denormalize(m_pHeightEdit->GetValue(FieldUnit::TWIP))); + m_pRowHeightEdit->Denormalize(m_pRowHeightEdit->GetValue(FieldUnit::TWIP))); SfxUInt32Item aRowHeight(SID_ATTR_TABLE_ROW_HEIGHT); aRowHeight.SetValue(nNewHeight); m_pBindings->GetDispatcher()->ExecuteList(SID_ATTR_TABLE_ROW_HEIGHT, SfxCallMode::RECORD, { &aRowHeight }); } + +IMPL_LINK_NOARG(TableEditPanel, ColumnWidthMofiyHdl, Edit&, void) +{ + SwTwips nNewWidth = static_cast<SwTwips>( + m_pColumnWidthEdit->Denormalize(m_pColumnWidthEdit->GetValue(FieldUnit::TWIP))); + SfxUInt32Item aColumnWidth(SID_ATTR_TABLE_COLUMN_WIDTH); + aColumnWidth.SetValue(nNewWidth); + + m_pBindings->GetDispatcher()->ExecuteList(SID_ATTR_TABLE_COLUMN_WIDTH, SfxCallMode::RECORD, + { &aColumnWidth }); +} } } // end of namespace ::sw::sidebar diff --git a/sw/source/uibase/sidebar/TableEditPanel.hxx b/sw/source/uibase/sidebar/TableEditPanel.hxx index ea9a2bad3637..6d7a9c63f732 100644 --- a/sw/source/uibase/sidebar/TableEditPanel.hxx +++ b/sw/source/uibase/sidebar/TableEditPanel.hxx @@ -40,13 +40,17 @@ private: virtual void dispose() override; void InitRowHeightToolitem(); + void InitColumnWidthToolitem(); SfxBindings* m_pBindings; - VclPtr<SvxRelativeField> m_pHeightEdit; + VclPtr<SvxRelativeField> m_pRowHeightEdit; + VclPtr<SvxRelativeField> m_pColumnWidthEdit; ::sfx2::sidebar::ControllerItem m_aRowHeightController; + ::sfx2::sidebar::ControllerItem m_aColumnWidthController; DECL_LINK(RowHeightMofiyHdl, Edit&, void); + DECL_LINK(ColumnWidthMofiyHdl, Edit&, void); }; } } // end of namespace sw::sidebar _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits