sc/sdi/scalc.sdi | 2 +- sc/source/ui/view/cellsh3.cxx | 32 ++++++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-)
New commits: commit 4b2c9e9b6641160829af143885fda48a78a2a3a7 Author: Pranav Kant <pran...@collabora.com> Date: Wed Jun 1 12:58:30 2016 +0530 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 <c...@libreoffice.org> Reviewed-by: pranavk <pran...@collabora.com> (cherry picked from commit c14627d66ca8d9fe14272fadb5305857101f513e) Reviewed-on: https://gerrit.libreoffice.org/25788 Tested-by: pranavk <pran...@collabora.com> diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 129076d..234100c 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 b1b5d7f..d01607e 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(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits