diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2024-06-20 15:12:05 +0200 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2024-06-25 09:15:25 +0200 |
commit | e932e2ab943a9941fcfc7073c9b6c11b982c2c4c (patch) | |
tree | 0ad5c77390f959bad1f3be728d11a759fc9be309 | |
parent | 3cb32bf100a0f50390ae3390fa84f2b8bba6e6ff (diff) |
Resolves tdf#161641 - Select data area before select all
Advanced option SelectRangeBeforeAll to restore original behavior
Change-Id: Iab4b4e61dffc1ecf2ffed01a994c9894c84ab74d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169276
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Calc.xcs | 7 | ||||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh3.cxx | 27 |
3 files changed, 35 insertions, 1 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs index 7303d1bacd00..b9f74d9724fa 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs @@ -763,6 +763,13 @@ </info> <value>true</value> </prop> + <prop oor:name="SelectRangeBeforeAll" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Disable to always select all</desc> + <label>Select range before all</label> + </info> + <value>true</value> + </prop> </group> <group oor:name="Grid"> <info> diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 08a1eeb3848b..ae1edf38147e 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2121,6 +2121,8 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf108654) ScDocument* pDoc = getScDoc(); dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); + // first .uno:SelectAll selects the range, second all (tdf#161641) + dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {}); dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index c62500c7e124..dfb7b4d5e92b 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -49,6 +49,7 @@ #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <inputwin.hxx> +#include <officecfg/Office/Calc.hxx> #include <memory> @@ -657,7 +658,31 @@ void ScCellShell::Execute( SfxRequest& rReq ) case SID_SELECTALL: { - pTabViewShell->SelectAll(); + SCTAB nTab = GetViewData().GetTabNo(); + SCCOL nStartCol = GetViewData().GetCurX(); + SCROW nStartRow = GetViewData().GetCurY(); + SCCOL nEndCol = nStartCol; + SCROW nEndRow = nStartRow; + bool bCanMark = false; + + ScMarkData& rMarkdata = GetViewData().GetMarkData(); + const bool bSelectFirst(officecfg::Office::Calc::Input::SelectRangeBeforeAll::get()); + + if (bSelectFirst && !rMarkdata.IsMarked()) + { + const ScDocument& rDoc = GetViewData().GetDocument(); + rDoc.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, true, false ); + bCanMark = nStartCol != nEndCol || nStartRow != nEndRow; + } + + if (bCanMark) + { + const ScRange aRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab); + pTabViewShell->MarkRange(aRange, false); + } + else + pTabViewShell->SelectAll(); + rReq.Done(); } break; |