diff options
author | Pranav Kant <pranavk@collabora.com> | 2016-06-01 12:58:30 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.com> | 2016-06-01 16:02:24 +0000 |
commit | c14627d66ca8d9fe14272fadb5305857101f513e (patch) | |
tree | c6b8824cb39fcc66f81ee72257888562b6d5cfc1 | |
parent | 9be9c58e8867d5bf356a5d8c704723a3eb5b23b1 (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>
-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 028e703cb054..d55eca4428c1 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -6553,7 +6553,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) [ AutoUpdate = FALSE, FastCall = FALSE, diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 8545781c7d7b..8ce210d42f39 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> @@ -176,19 +178,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(); } |