summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/cellsh1.cxx
diff options
context:
space:
mode:
authorTünde Tóth <toth.tunde@nisz.hu>2021-02-18 09:35:17 +0100
committerLászló Németh <nemeth@numbertext.org>2021-02-25 16:49:33 +0100
commit6ab08b3b1026a582352ea018b9d59e91d3e86d92 (patch)
tree2cfe282812fcba8522b58fadb7c407fd0f4a47b3 /sc/source/ui/view/cellsh1.cxx
parentca7855c24af858f52a11a593761ee9e6b9d6ba79 (diff)
tdf#36466 sc UI: add new options to deselect hidden cells
Implement "Select Visible Rows Only" option to deselect the cells of the hidden rows in the actual selection. Implement "Select Visible Columns Only" option to deselect the cells of the hidden columns in the actual selection. Test e.g. on some data on A1:C1: 1) hide column B (don't try to test with autofilter, because copying of the filtered cells has already worked this way). 2) Select A1:C1 (2 visible cells) 3) Choose Edit->Select->Select Visible Columns Only (no visual feedback) 4) Copy the selection. 5) Paste it e.g. in D2: only A1 and C1 are copied, but not B1. Change-Id: I354ebdf6be6bddae4440f3e9b4929c6e82abc1df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111100 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc/source/ui/view/cellsh1.cxx')
-rw-r--r--sc/source/ui/view/cellsh1.cxx40
1 files changed, 39 insertions, 1 deletions
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index f529e34b6140..d619b461d6c3 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2768,7 +2768,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
break;
- case SID_SELECT_VISIBLE_CELLS:
+ case SID_SELECT_VISIBLE_ROWS:
{
ScViewData& rData = GetViewData();
ScMarkData& rMark = rData.GetMarkData();
@@ -2806,6 +2806,44 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
break;
+ case SID_SELECT_VISIBLE_COLUMNS:
+ {
+ ScViewData& rData = GetViewData();
+ ScMarkData& rMark = rData.GetMarkData();
+ ScDocument& rDoc = rData.GetDocument();
+
+ rMark.MarkToMulti();
+
+ ScRange aMultiArea;
+ rMark.GetMultiMarkArea(aMultiArea);
+ SCCOL nStartCol = aMultiArea.aStart.Col();
+ SCROW nStartRow = aMultiArea.aStart.Row();
+ SCCOL nEndCol = aMultiArea.aEnd.Col();
+ SCROW nEndRow = aMultiArea.aEnd.Row();
+
+ bool bChanged = false;
+ for (const SCTAB& nTab : rMark)
+ {
+ for (SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol)
+ {
+ SCCOL nLastCol = nCol;
+ if (rDoc.ColHidden(nCol, nTab, nullptr, &nLastCol))
+ {
+ rMark.SetMultiMarkArea(
+ ScRange(nCol, nStartRow, nTab, nLastCol, nEndRow, nTab), false);
+ bChanged = true;
+ nCol = nLastCol;
+ }
+ }
+ }
+
+ if (bChanged && !rMark.HasAnyMultiMarks())
+ rMark.ResetMark();
+
+ rMark.MarkToSimple();
+ }
+ break;
+
case SID_CURRENT_FORMULA_RANGE:
{
const SfxInt32Item* param1 = rReq.GetArg<SfxInt32Item>(FN_PARAM_1);