sc/source/ui/app/inputwin.cxx |   36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

New commits:
commit 10e3880eb10d8e5c08bd7a254577ba4b0bd25534
Author: Tsutomu Uchino <ha...@apache.org>
Date:   Fri Jan 10 11:47:19 2014 +0000

    Resolves: #i42309# change behavior for equal button of input line...
    
    according to the current content of the cell
    
    (cherry picked from commit ff1d1ea1f5f15ce7888957d09f4783d8055c7654)
    
    Conflicts:
        sc/source/ui/app/inputwin.cxx
    
    Change-Id: I054aa55de14e2dec5a9ace1124d7eb6aa261162f

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 0407276..5f7b032 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -510,12 +510,44 @@ void ScInputWindow::Select()
             if ( pScMod->IsEditMode() )         // nicht, wenn z.B. geschuetzt
             {
                 aTextWindow.StartEditEngine();
-                aTextWindow.SetTextString(OUString('='));
+
+                sal_Int32 nStartPos = 1;
+                sal_Int32 nEndPos = 1;
+
+                ScTabViewShell* pViewSh = PTR_CAST( ScTabViewShell, 
SfxViewShell::Current() );
+                if ( pViewSh )
+                {
+                    const OUString& rString = aTextWindow.GetTextString();
+                    const sal_Int32 nLen = rString.getLength();
+
+                    ScDocument* pDoc = pViewSh->GetViewData()->GetDocument();
+                    CellType eCellType = pDoc->GetCellType( 
pViewSh->GetViewData()->GetCurPos() );
+                    switch ( eCellType )
+                    {
+                        case CELLTYPE_VALUE:
+                        {
+                            nEndPos = nLen + 1;
+                            aTextWindow.SetTextString("=" +  rString);
+                            break;
+                        }
+                        case CELLTYPE_STRING:
+                        case CELLTYPE_EDIT:
+                            nStartPos = 0;
+                            nEndPos = nLen;
+                            break;
+                        case CELLTYPE_FORMULA:
+                            nEndPos = nLen;
+                            break;
+                        default:
+                            aTextWindow.SetTextString("=");
+                            break;
+                    }
+                }
 
                 EditView* pView = aTextWindow.GetEditView();
                 if (pView)
                 {
-                    pView->SetSelection( ESelection(0,1, 0,1) );
+                    pView->SetSelection( ESelection(0, nStartPos, 0, nEndPos) 
);
                     pScMod->InputChanged(pView);
                     SetOkCancelMode();
                     pView->SetEditEngineUpdateMode(sal_True);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to