officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 16 ++ sc/inc/sc.hrc | 2 sc/sdi/cellsh.sdi | 2 sc/sdi/scalc.sdi | 34 ++++ sc/source/ui/view/cellsh1.cxx | 76 ++++++++++ sc/uiconfig/scalc/menubar/menubar.xml | 2 6 files changed, 132 insertions(+)
New commits: commit 22cc241e94a0308d6bf581408dc4b061feaceb9d Author: Tünde Tóth <[email protected]> AuthorDate: Thu Feb 18 09:35:17 2021 +0100 Commit: Gabor Kelemen <[email protected]> CommitDate: Tue Jun 29 12:57:29 2021 +0200 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 <[email protected]> Reviewed-by: László Németh <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114490 Tested-by: Gabor Kelemen <[email protected]> Reviewed-by: Gabor Kelemen <[email protected]> (cherry picked from commit 0fde09cbce71a0083e6935bb8f2483ee658cbb5e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118069 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index eaa4e6f6c184..a2d162ac926d 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -582,6 +582,22 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:SelectVisibleRows" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Csak látható sorok kijelölése</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:SelectVisibleColumns" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Csak látható oszlopok kijelölése</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:ConditionalFormatMenu" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">C~onditional</value> diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index e80825624dea..6524e631604d 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -604,6 +604,8 @@ #define FID_DELETE_ALL_NOTES (SID_NEW_SLOTS+104) #define SID_SCATTR_CELLPROTECTION (SID_NEW_SLOTS+105) #define SID_SELECT_UNPROTECTED_CELLS (SID_NEW_SLOTS+106) +#define SID_SELECT_VISIBLE_ROWS (SID_NEW_SLOTS+107) +#define SID_SELECT_VISIBLE_COLUMNS (SID_NEW_SLOTS+108) // idl parameter diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 902cf8a639e9..2ca365d5c594 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -230,6 +230,8 @@ interface CellSelection SID_DEC_INDENT [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] SID_INC_INDENT [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] SID_SELECT_UNPROTECTED_CELLS [ ExecMethod = ExecuteEdit;] + SID_SELECT_VISIBLE_ROWS [ ExecMethod = ExecuteEdit;] + SID_SELECT_VISIBLE_COLUMNS [ ExecMethod = ExecuteEdit;] SID_THESAURUS [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ] SID_SPELL_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 077fa4adf9d9..d3d531d4c292 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -4453,6 +4453,40 @@ SfxVoidItem SelectUnprotectedCells SID_SELECT_UNPROTECTED_CELLS GroupId = SfxGroupId::Edit; ] +SfxVoidItem SelectVisibleRows SID_SELECT_VISIBLE_ROWS +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = TRUE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Edit; +] + +SfxVoidItem SelectVisibleColumns SID_SELECT_VISIBLE_COLUMNS +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = TRUE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Edit; +] + SfxVoidItem SelectOLE SID_OLE_SELECT () [ diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 1da99b474f0a..88f4ae18ec42 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2771,6 +2771,82 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; + case SID_SELECT_VISIBLE_ROWS: + { + 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 (SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow) + { + SCROW nLastRow = nRow; + if (rDoc->RowHidden(nRow, nTab, nullptr, &nLastRow)) + { + rMark.SetMultiMarkArea( + ScRange(nStartCol, nRow, nTab, nEndCol, nLastRow, nTab), false); + bChanged = true; + nRow = nLastRow; + } + } + } + + if (bChanged && !rMark.HasAnyMultiMarks()) + rMark.ResetMark(); + + rMark.MarkToSimple(); + } + 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; + default: OSL_FAIL("incorrect slot in ExecuteEdit"); break; diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index f2a1015f2ed6..48c0a9e9063e 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -110,6 +110,8 @@ <menu:menuitem menu:id=".uno:SelectColumn"/> <menu:menuitem menu:id=".uno:SelectData"/> <menu:menuitem menu:id=".uno:SelectUnprotectedCells"/> + <menu:menuitem menu:id=".uno:SelectVisibleRows"/> + <menu:menuitem menu:id=".uno:SelectVisibleColumns"/> </menu:menupopup> </menu:menu> <menu:menuseparator/> _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
