diff options
-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(); } |