diff options
author | Pranav Kant <pranavk@collabora.com> | 2016-06-01 12:58:30 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.com> | 2016-06-01 16:04:06 +0000 |
commit | 4b2c9e9b6641160829af143885fda48a78a2a3a7 (patch) | |
tree | 7f7ae87f2339e5c1accf8b2a12236fe594c9c39a | |
parent | 7283f2e2ddb7a2b7dac2d2a2417a1de866eb7124 (diff) |
sc lok: Add new param to .uno:EnterString to prevent committing
If new param, DontCommit, is specified start the edit engine and
edit the current cell. This helps in not triggering calculations
that depend on the current cell. In case DontCommit param is
missing, it will work as it used to.
Change-Id: I62408932e52ff68fa11568cfc16a43e4c1e919c5
Reviewed-on: https://gerrit.libreoffice.org/25753
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: pranavk <pranavk@collabora.com>
(cherry picked from commit c14627d66ca8d9fe14272fadb5305857101f513e)
Reviewed-on: https://gerrit.libreoffice.org/25788
Tested-by: pranavk <pranavk@collabora.com>
-rw-r--r-- | sc/sdi/scalc.sdi | 2 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh3.cxx | 32 |
2 files changed, 27 insertions, 7 deletions
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 129076d3e3db..234100c09611 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -8923,7 +8923,7 @@ SfxVoidItem Ungroup SID_OUTLINE_REMOVE ] SfxVoidItem EnterString SID_ENTER_STRING -(SfxStringItem StringName SID_ENTER_STRING) +(SfxStringItem StringName SID_ENTER_STRING,SfxBoolItem DontCommit FN_PARAM_1) [ /* flags: */ AutoUpdate = FALSE, diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index b1b5d7f6a8ed..d01607e0bfab 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -18,6 +18,8 @@ */ #include "scitems.hxx" +#include <editeng/editview.hxx> +#include <editeng/editeng.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> @@ -177,19 +179,37 @@ void ScCellShell::Execute( SfxRequest& rReq ) { OUString aStr( static_cast<const SfxStringItem&>(pReqArgs-> Get( SID_ENTER_STRING )).GetValue() ); - - pTabViewShell->EnterData( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), - GetViewData()->GetTabNo(), - aStr ); + const SfxPoolItem* pDontCommitItem; + bool bCommit = true; + if (pReqArgs->HasItem(FN_PARAM_1, &pDontCommitItem)) + bCommit = !(static_cast<const SfxBoolItem*>(pDontCommitItem)->GetValue()); ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pTabViewShell ); + if (bCommit) + { + pTabViewShell->EnterData( GetViewData()->GetCurX(), + GetViewData()->GetCurY(), + GetViewData()->GetTabNo(), + aStr ); + } + else + { + SC_MOD()->SetInputMode(SC_INPUT_TABLE); + + EditView* pTableView = pHdl->GetActiveView(); + pHdl->DataChanging(); + if (pTableView) + pTableView->GetEditEngine()->SetText(aStr); + pHdl->DataChanged(); + + SC_MOD()->SetInputMode(SC_INPUT_NONE); + } + if ( !pHdl || !pHdl->IsInEnterHandler() ) { // UpdateInputHandler is needed after the cell content // has changed, but if called from EnterHandler, UpdateInputHandler // will be called later when moving the cursor. - pTabViewShell->UpdateInputHandler(); } |