From 59ed21b1720db5fd0326e1b723483b288725e662 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Thu, 20 Sep 2018 17:16:14 +0300 Subject: tdf#64242 sw add minimize table col/row UI A followup commit will modify the optimize functions, which currently function as a minimize, so lets make sure that the ability to minimize is still available. Minimize column width: Adjusts the width of the selected columns to fit the selected content. The table can shrink if necessary, but will not grow. (This is how Optimize column width worked in LO <= 6.1.) Minimize row height: Adjusts the height of the selected rows to fit the content, causing the table to shrink. (This is how Optimize row height worked in LO <= 6.1.) Change-Id: I2c0b8c7b7a05c31328f2feef464ef0e131318ff8 Reviewed-on: https://gerrit.libreoffice.org/60902 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- include/svx/svxids.hrc | 3 +- .../org/openoffice/Office/UI/WriterCommands.xcu | 16 ++++++++++ sw/sdi/_tabsh.sdi | 14 +++++++++ sw/sdi/swriter.sdi | 34 ++++++++++++++++++++++ sw/source/uibase/shells/tabsh.cxx | 12 +++++++- sw/uiconfig/sglobal/menubar/menubar.xml | 2 ++ sw/uiconfig/sglobal/popupmenu/table.xml | 10 ++++--- sw/uiconfig/sglobal/toolbar/optimizetablebar.xml | 8 +++-- sw/uiconfig/sweb/menubar/menubar.xml | 2 ++ sw/uiconfig/sweb/popupmenu/table.xml | 10 ++++--- sw/uiconfig/sweb/toolbar/optimizetablebar.xml | 8 +++-- sw/uiconfig/swform/menubar/menubar.xml | 10 ++++--- sw/uiconfig/swform/popupmenu/table.xml | 10 ++++--- sw/uiconfig/swform/toolbar/optimizetablebar.xml | 8 +++-- sw/uiconfig/swreport/menubar/menubar.xml | 10 ++++--- sw/uiconfig/swreport/popupmenu/table.xml | 10 ++++--- sw/uiconfig/swreport/toolbar/optimizetablebar.xml | 8 +++-- sw/uiconfig/swriter/menubar/menubar.xml | 2 ++ sw/uiconfig/swriter/popupmenu/table.xml | 10 ++++--- sw/uiconfig/swriter/toolbar/optimizetablebar.xml | 8 +++-- sw/uiconfig/swriter/ui/notebookbar.ui | 14 +++++++++ sw/uiconfig/swriter/ui/notebookbar_compact.ui | 14 +++++++++ .../swriter/ui/notebookbar_groupedbar_compact.ui | 14 +++++++++ .../swriter/ui/notebookbar_groupedbar_full.ui | 14 +++++++++ sw/uiconfig/swriter/ui/notebookbar_groups.ui | 9 ++++++ sw/uiconfig/swxform/menubar/menubar.xml | 2 ++ sw/uiconfig/swxform/popupmenu/table.xml | 10 ++++--- sw/uiconfig/swxform/toolbar/optimizetablebar.xml | 8 +++-- 28 files changed, 228 insertions(+), 52 deletions(-) diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 54cab86e69da..acd2df632a1a 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -970,7 +970,8 @@ class SfxStringItem; #define SID_SIGN_SIGNATURELINE ( SID_SVX_START + 1175 ) #define SID_MEASURE_DLG ( SID_SVX_START + 1176 ) - +#define SID_TABLE_MINIMAL_COLUMN_WIDTH ( SID_SVX_START + 1185 ) +#define SID_TABLE_MINIMAL_ROW_HEIGHT ( SID_SVX_START + 1186 ) #define SID_TABLE_OPTIMAL_COLUMN_WIDTH ( SID_SVX_START + 1187 ) #define SID_TABLE_OPTIMAL_ROW_HEIGHT ( SID_SVX_START + 1188 ) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu index eba4246e8d63..4e1dfe6b1b34 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu @@ -2298,6 +2298,14 @@ ~First Paragraph + + + Minimize Column Width + + + 1 + + ~Distribute Columns Evenly @@ -2311,6 +2319,14 @@ Increment Indent Value + + + Minimize Row Height + + + 1 + + Distribute Rows Evenly diff --git a/sw/sdi/_tabsh.sdi b/sw/sdi/_tabsh.sdi index 1bdcc330adcb..6b89dea2438b 100644 --- a/sw/sdi/_tabsh.sdi +++ b/sw/sdi/_tabsh.sdi @@ -210,6 +210,13 @@ interface BaseTextTable StateMethod = GetState ; ] + SID_TABLE_MINIMAL_COLUMN_WIDTH // status() + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] + FN_TABLE_ADJUST_CELLS // status(final|play) [ ExecMethod = Execute ; @@ -224,6 +231,13 @@ interface BaseTextTable DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; ] + SID_TABLE_MINIMAL_ROW_HEIGHT // status() + [ + ExecMethod = Execute ; + StateMethod = GetState ; + DisableFlags="SfxDisableFlags::SwOnProtectedCursor"; + ] + FN_TABLE_BALANCE_ROWS // status() [ ExecMethod = Execute ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 19aa9dfeae05..52e73878e655 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -949,6 +949,23 @@ SfxVoidItem DelToStartOfWord FN_DELETE_BACK_WORD GroupId = SfxGroupId::Edit; ] +SfxVoidItem SetMinimalColumnWidth SID_TABLE_MINIMAL_COLUMN_WIDTH +() +[ + AutoUpdate = FALSE, + FastCall = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Table; +] + SfxVoidItem DistributeColumns FN_TABLE_BALANCE_CELLS () [ @@ -966,6 +983,23 @@ SfxVoidItem DistributeColumns FN_TABLE_BALANCE_CELLS GroupId = SfxGroupId::Table; ] +SfxVoidItem SetMinimalRowHeight SID_TABLE_MINIMAL_ROW_HEIGHT +() +[ + AutoUpdate = FALSE, + FastCall = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Table; +] + SfxVoidItem DistributeRows FN_TABLE_BALANCE_ROWS () [ diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 00f1df7a0e2b..75ec7e57c888 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -772,6 +772,7 @@ void SwTableShell::Execute(SfxRequest &rReq) break; } break; + case SID_TABLE_MINIMAL_COLUMN_WIDTH: case FN_TABLE_ADJUST_CELLS: case FN_TABLE_BALANCE_CELLS: { @@ -787,6 +788,13 @@ void SwTableShell::Execute(SfxRequest &rReq) bCallDone = true; break; } + case SID_TABLE_MINIMAL_ROW_HEIGHT: + { + const SwFormatFrameSize aSz; + rSh.SetRowHeight( aSz ); + bCallDone = true; + break; + } case FN_TABLE_BALANCE_ROWS: if ( rSh.BalanceRowHeight(true) ) rSh.BalanceRowHeight(false); @@ -1221,9 +1229,10 @@ void SwTableShell::GetState(SfxItemSet &rSet) if ( !rSh.IsTableMode() ) rSet.DisableItem(FN_TABLE_MERGE_CELLS); break; + case SID_TABLE_MINIMAL_COLUMN_WIDTH: case FN_TABLE_ADJUST_CELLS: if ( !rSh.IsAdjustCellWidthAllowed() ) - rSet.DisableItem(FN_TABLE_ADJUST_CELLS); + rSet.DisableItem(nSlot); break; case FN_TABLE_BALANCE_CELLS: @@ -1257,6 +1266,7 @@ void SwTableShell::GetState(SfxItemSet &rSet) } break; + case SID_TABLE_MINIMAL_ROW_HEIGHT: case FN_TABLE_OPTIMAL_HEIGHT: { // Disable if auto height already is enabled. diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml index 1a6390cc9e64..dd478981d280 100644 --- a/sw/uiconfig/sglobal/menubar/menubar.xml +++ b/sw/uiconfig/sglobal/menubar/menubar.xml @@ -610,10 +610,12 @@ + + diff --git a/sw/uiconfig/sglobal/popupmenu/table.xml b/sw/uiconfig/sglobal/popupmenu/table.xml index 627b4aa562b4..60e3bb047c41 100644 --- a/sw/uiconfig/sglobal/popupmenu/table.xml +++ b/sw/uiconfig/sglobal/popupmenu/table.xml @@ -45,13 +45,15 @@ - - - - + + + + + + diff --git a/sw/uiconfig/sglobal/toolbar/optimizetablebar.xml b/sw/uiconfig/sglobal/toolbar/optimizetablebar.xml index 21c5e2757bbe..e1bab26b2bae 100644 --- a/sw/uiconfig/sglobal/toolbar/optimizetablebar.xml +++ b/sw/uiconfig/sglobal/toolbar/optimizetablebar.xml @@ -18,8 +18,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - - + + - \ No newline at end of file + + + diff --git a/sw/uiconfig/sweb/menubar/menubar.xml b/sw/uiconfig/sweb/menubar/menubar.xml index 0eb7501234d8..621628271160 100644 --- a/sw/uiconfig/sweb/menubar/menubar.xml +++ b/sw/uiconfig/sweb/menubar/menubar.xml @@ -485,10 +485,12 @@ + + diff --git a/sw/uiconfig/sweb/popupmenu/table.xml b/sw/uiconfig/sweb/popupmenu/table.xml index 627b4aa562b4..60e3bb047c41 100644 --- a/sw/uiconfig/sweb/popupmenu/table.xml +++ b/sw/uiconfig/sweb/popupmenu/table.xml @@ -45,13 +45,15 @@ - - - - + + + + + + diff --git a/sw/uiconfig/sweb/toolbar/optimizetablebar.xml b/sw/uiconfig/sweb/toolbar/optimizetablebar.xml index 21c5e2757bbe..e1bab26b2bae 100644 --- a/sw/uiconfig/sweb/toolbar/optimizetablebar.xml +++ b/sw/uiconfig/sweb/toolbar/optimizetablebar.xml @@ -18,8 +18,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - - + + - \ No newline at end of file + + + diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml index 7db1f104ae1a..e8409e3f8b9e 100644 --- a/sw/uiconfig/swform/menubar/menubar.xml +++ b/sw/uiconfig/swform/menubar/menubar.xml @@ -399,14 +399,16 @@ - - - - + + + + + + diff --git a/sw/uiconfig/swform/popupmenu/table.xml b/sw/uiconfig/swform/popupmenu/table.xml index 627b4aa562b4..60e3bb047c41 100644 --- a/sw/uiconfig/swform/popupmenu/table.xml +++ b/sw/uiconfig/swform/popupmenu/table.xml @@ -45,13 +45,15 @@ - - - - + + + + + + diff --git a/sw/uiconfig/swform/toolbar/optimizetablebar.xml b/sw/uiconfig/swform/toolbar/optimizetablebar.xml index 21c5e2757bbe..e1bab26b2bae 100644 --- a/sw/uiconfig/swform/toolbar/optimizetablebar.xml +++ b/sw/uiconfig/swform/toolbar/optimizetablebar.xml @@ -18,8 +18,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - - + + - \ No newline at end of file + + + diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml index 036963d78c4a..b091a8af79c5 100644 --- a/sw/uiconfig/swreport/menubar/menubar.xml +++ b/sw/uiconfig/swreport/menubar/menubar.xml @@ -400,14 +400,16 @@ - - - - + + + + + + diff --git a/sw/uiconfig/swreport/popupmenu/table.xml b/sw/uiconfig/swreport/popupmenu/table.xml index 627b4aa562b4..60e3bb047c41 100644 --- a/sw/uiconfig/swreport/popupmenu/table.xml +++ b/sw/uiconfig/swreport/popupmenu/table.xml @@ -45,13 +45,15 @@ - - - - + + + + + + diff --git a/sw/uiconfig/swreport/toolbar/optimizetablebar.xml b/sw/uiconfig/swreport/toolbar/optimizetablebar.xml index 21c5e2757bbe..e1bab26b2bae 100644 --- a/sw/uiconfig/swreport/toolbar/optimizetablebar.xml +++ b/sw/uiconfig/swreport/toolbar/optimizetablebar.xml @@ -18,8 +18,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - - + + - \ No newline at end of file + + + diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index e8b9f31fea51..bec1b1644f76 100644 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -610,10 +610,12 @@ + + diff --git a/sw/uiconfig/swriter/popupmenu/table.xml b/sw/uiconfig/swriter/popupmenu/table.xml index 92d143884e9d..6861b07dfc61 100644 --- a/sw/uiconfig/swriter/popupmenu/table.xml +++ b/sw/uiconfig/swriter/popupmenu/table.xml @@ -45,13 +45,15 @@ - - - - + + + + + + diff --git a/sw/uiconfig/swriter/toolbar/optimizetablebar.xml b/sw/uiconfig/swriter/toolbar/optimizetablebar.xml index 21c5e2757bbe..e1bab26b2bae 100644 --- a/sw/uiconfig/swriter/toolbar/optimizetablebar.xml +++ b/sw/uiconfig/swriter/toolbar/optimizetablebar.xml @@ -18,8 +18,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - - + + - \ No newline at end of file + + + diff --git a/sw/uiconfig/swriter/ui/notebookbar.ui b/sw/uiconfig/swriter/ui/notebookbar.ui index 604a8d623a35..86d16e0a5a74 100644 --- a/sw/uiconfig/swriter/ui/notebookbar.ui +++ b/sw/uiconfig/swriter/ui/notebookbar.ui @@ -1492,6 +1492,13 @@ .uno:SetRowHeight + + + True + False + .uno:SetMinimalRowHeight + + True @@ -1513,6 +1520,13 @@ .uno:SetColumnWidth + + + True + False + .uno:SetMinimalColumnWidth + + True diff --git a/sw/uiconfig/swriter/ui/notebookbar_compact.ui b/sw/uiconfig/swriter/ui/notebookbar_compact.ui index c8cfdbed2e98..42bd0e309104 100644 --- a/sw/uiconfig/swriter/ui/notebookbar_compact.ui +++ b/sw/uiconfig/swriter/ui/notebookbar_compact.ui @@ -1608,6 +1608,13 @@ .uno:SetRowHeight + + + True + False + .uno:SetMinimalRowHeight + + True @@ -1629,6 +1636,13 @@ .uno:SetColumnWidth + + + True + False + .uno:SetMinimalColumnWidth + + True diff --git a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui index 7f82770797ba..586897ea6596 100644 --- a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui +++ b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_compact.ui @@ -2498,6 +2498,13 @@ .uno:SetRowHeight + + + True + False + .uno:SetMinimalRowHeight + + True @@ -2525,6 +2532,13 @@ .uno:SetColumnWidth + + + True + False + .uno:SetMinimalColumnWidth + + True diff --git a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui index d5841adec13f..79b6b8f0c440 100644 --- a/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui +++ b/sw/uiconfig/swriter/ui/notebookbar_groupedbar_full.ui @@ -2520,6 +2520,13 @@ .uno:SetRowHeight + + + True + False + .uno:SetMinimalRowHeight + + True @@ -2547,6 +2554,13 @@ .uno:SetColumnWidth + + + True + False + .uno:SetMinimalColumnWidth + + True diff --git a/sw/uiconfig/swriter/ui/notebookbar_groups.ui b/sw/uiconfig/swriter/ui/notebookbar_groups.ui index 315e8e8a2a9d..76bef4c3011b 100644 --- a/sw/uiconfig/swriter/ui/notebookbar_groups.ui +++ b/sw/uiconfig/swriter/ui/notebookbar_groups.ui @@ -520,6 +520,15 @@ True + + + True + False + .uno:SetMinimalRowHeight + Minimal Row Height + True + + True diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml index 92d25d001568..74edeca31dc1 100644 --- a/sw/uiconfig/swxform/menubar/menubar.xml +++ b/sw/uiconfig/swxform/menubar/menubar.xml @@ -610,10 +610,12 @@ + + diff --git a/sw/uiconfig/swxform/popupmenu/table.xml b/sw/uiconfig/swxform/popupmenu/table.xml index 627b4aa562b4..60e3bb047c41 100644 --- a/sw/uiconfig/swxform/popupmenu/table.xml +++ b/sw/uiconfig/swxform/popupmenu/table.xml @@ -45,13 +45,15 @@ - - - - + + + + + + diff --git a/sw/uiconfig/swxform/toolbar/optimizetablebar.xml b/sw/uiconfig/swxform/toolbar/optimizetablebar.xml index 21c5e2757bbe..e1bab26b2bae 100644 --- a/sw/uiconfig/swxform/toolbar/optimizetablebar.xml +++ b/sw/uiconfig/swxform/toolbar/optimizetablebar.xml @@ -18,8 +18,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> - - + + - \ No newline at end of file + + + -- cgit v1.2.3