sc/sdi/scalc.sdi              |    2 +-
 sc/source/ui/view/cellsh3.cxx |   32 ++++++++++++++++++++++++++------
 2 files changed, 27 insertions(+), 7 deletions(-)

New commits:
commit c14627d66ca8d9fe14272fadb5305857101f513e
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>

diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 028e703..d55eca4 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 8545781..8ce210d 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();
                     }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to