summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2021-01-05 20:43:57 +0530
committerPranam Lashkari <lpranam@collabora.com>2021-01-22 07:51:53 +0100
commit820984cdd2bc8f1bd8675606ec92eb42e01fff75 (patch)
treeadad4caaa87f7636fef8e1008b46d21fd80307c9
parent5bb263f945abda08dc1a54748e9ca70c81cff7cc (diff)
Added uno command for formula range selection
Change-Id: I01cd06ed51197ffe21102fb1fd0fcdce88ab333b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108810 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> (cherry picked from commit e8a9157878f156e599e66349d7fb60ca39e62514) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109746 Reviewed-by: Pranam Lashkari <lpranam@collabora.com>
-rw-r--r--sc/inc/sc.hrc2
-rw-r--r--sc/sdi/cellsh.sdi1
-rw-r--r--sc/sdi/scalc.sdi17
-rw-r--r--sc/source/ui/view/cellsh1.cxx34
4 files changed, 53 insertions, 1 deletions
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 52b945ea9441..9ada93af7dfa 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -614,7 +614,7 @@
#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)
// idl parameter
#define SID_SORT_BYROW (SC_PARAM_START)
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index e58ef8de34a8..5a257fe690ac 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -228,6 +228,7 @@ interface CellSelection
SID_DEC_INDENT [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
SID_INC_INDENT [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
SID_SELECT_UNPROTECTED_CELLS [ ExecMethod = ExecuteEdit;]
+ SID_CURRENT_FORMULA_RANGE [ 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 23b9c72fbe0f..3f14637f3d4b 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -4436,6 +4436,23 @@ SfxVoidItem SelectUnprotectedCells SID_SELECT_UNPROTECTED_CELLS
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)
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = FALSE,
+ MenuConfig = FALSE,
+ 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 07e6ad15a44e..ccd17f217fa1 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2704,6 +2704,40 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
}
break;
+ case SID_CURRENT_FORMULA_RANGE:
+ {
+ const SfxInt32Item* param1 = rReq.GetArg<SfxInt32Item>(FN_PARAM_1);
+ SCCOL colStart = param1 ? param1->GetValue() : 0;
+
+ const SfxInt32Item* param2 = rReq.GetArg<SfxInt32Item>(FN_PARAM_2);
+ SCROW rowStart = param2 ? param2->GetValue() : 0;
+
+ const SfxInt32Item* param3 = rReq.GetArg<SfxInt32Item>(FN_PARAM_3);
+ SCCOL colEnd = param3 ? param3->GetValue() : 0;
+
+ const SfxInt32Item* param4 = rReq.GetArg<SfxInt32Item>(FN_PARAM_4);
+ SCROW rowEnd = param4 ? param4->GetValue() : 0;
+
+ const SfxInt32Item* param5 = rReq.GetArg<SfxInt32Item>(FN_PARAM_5);
+ SCROW table = param5 ? param5->GetValue() : 0;
+
+ ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
+
+ if(param3 && param4 && pInputHdl && pTabViewShell)
+ {
+ ScViewData& rViewData = pTabViewShell->GetViewData();
+ ScTabView* pTabView = dynamic_cast< ScTabView* >( rViewData.GetView() );
+
+ if (param1 && param2)
+ rViewData.SetRefStart(colStart, rowStart, table);
+
+ pTabView->UpdateRef( colEnd, rowEnd, table ); // setup the end & refresh formula
+
+ pInputHdl->UpdateLokReferenceMarks();
+ }
+ }
+ break;
+
default:
OSL_FAIL("incorrect slot in ExecuteEdit");
break;