[Libreoffice-commits] core.git: officecfg/registry sc/inc sc/sdi sc/source sc/uiconfig

Tünde Tóth (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 17 12:21:36 UTC 2021


 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |    8 ++
 sc/inc/sc.hrc                                                     |    3 
 sc/sdi/cellsh.sdi                                                 |    1 
 sc/sdi/scalc.sdi                                                  |   17 ++++
 sc/source/ui/view/cellsh1.cxx                                     |   38 ++++++++++
 sc/uiconfig/scalc/menubar/menubar.xml                             |    1 
 6 files changed, 67 insertions(+), 1 deletion(-)

New commits:
commit f89f806c88a8374e1dfd1d09747801377b8c0f36
Author:     Tünde Tóth <toth.tunde at nisz.hu>
AuthorDate: Mon Feb 15 13:45:54 2021 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Feb 17 13:20:54 2021 +0100

    tdf#36466 calc UI: add option to Select Visible Cells Only
    
    Implement "Select Visible Cells Only" option to deselect
    the cells of the hidden rows in the actual selection.
    
    Change-Id: Ifa5a5c3aeeb45a7960a387d91b176cc66733ab10
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110937
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index e247c92524d0..919237963507 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -585,6 +585,14 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:SelectVisibleCells" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Select Visible Cells Only</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 4f7ed6980636..55be197e79c4 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -603,7 +603,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_CURRENT_FORMULA_RANGE              (SID_NEW_SLOTS+107)
+#define SID_SELECT_VISIBLE_CELLS     (SID_NEW_SLOTS+107)
+#define SID_CURRENT_FORMULA_RANGE    (SID_NEW_SLOTS+108)
 // idl parameter
 
 #define SID_SORT_BYROW          (SC_PARAM_START)
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index de9f537de767..cbc20f2f8959 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -230,6 +230,7 @@ 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_CELLS            [ ExecMethod = ExecuteEdit;]
     SID_CURRENT_FORMULA_RANGE           [ ExecMethod = ExecuteEdit;]
 
     SID_THESAURUS   [ ExecMethod = ExecuteEdit; StateMethod = GetCellState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 47b429465197..fae369fa24a8 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -4453,6 +4453,23 @@ SfxVoidItem SelectUnprotectedCells SID_SELECT_UNPROTECTED_CELLS
     GroupId = SfxGroupId::Edit;
 ]
 
+SfxVoidItem SelectVisibleCells SID_SELECT_VISIBLE_CELLS
+()
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    AccelConfig = FALSE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = FALSE,
+    GroupId = SfxGroupId::Edit;
+]
+
 SfxVoidItem CurrentFormulaRange SID_CURRENT_FORMULA_RANGE
 (SfxInt32Item StartCol FN_PARAM_1,SfxInt32Item StartRow FN_PARAM_2,SfxInt32Item EndCol FN_PARAM_3,SfxInt32Item EndRow FN_PARAM_4, SfxInt32Item Table FN_PARAM_5)
 [
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 6b1c50b3e011..f529e34b6140 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2768,6 +2768,44 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             }
             break;
 
+        case SID_SELECT_VISIBLE_CELLS:
+            {
+                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_CURRENT_FORMULA_RANGE:
             {
                 const SfxInt32Item* param1 = rReq.GetArg<SfxInt32Item>(FN_PARAM_1);
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index a8089440f73c..f413f7a6b627 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -110,6 +110,7 @@
           <menu:menuitem menu:id=".uno:SelectColumn"/>
           <menu:menuitem menu:id=".uno:SelectData"/>
           <menu:menuitem menu:id=".uno:SelectUnprotectedCells"/>
+          <menu:menuitem menu:id=".uno:SelectVisibleCells"/>
         </menu:menupopup>
       </menu:menu>
       <menu:menuseparator/>


More information about the Libreoffice-commits mailing list