[Libreoffice-commits] core.git: Branch 'libreoffice-5-0-0' - sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Mon Jul 13 08:23:49 PDT 2015


 sc/source/ui/app/inputhdl.cxx |   51 +++++++++++++++---------------------------
 sc/source/ui/inc/inputhdl.hxx |    3 --
 2 files changed, 20 insertions(+), 34 deletions(-)

New commits:
commit 0d83531e915cf5dda33c41025d4d6afba4d6908d
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Thu Jun 25 17:26:20 2015 +0200

    tdf#89031 remove agressiveness from Calc function suggestions
    
    Change-Id: I7751a038f8482addc0e45c0461666bbd1c959d12
    Reviewed-on: https://gerrit.libreoffice.org/16478
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit f3d748937a177cbbc0033bcf54d0d0fd57a1b409)
    Reviewed-on: https://gerrit.libreoffice.org/17009
    (cherry picked from commit 579f5cbfc4636ae28e545b0d2e456e100b08b4ad)
    Reviewed-on: https://gerrit.libreoffice.org/17014
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 2b6be65..fe9ef00 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -804,8 +804,7 @@ void ScInputHandler::HideTipBelow()
     aManualTip.clear();
 }
 
-void ScInputHandler::ShowArgumentsTip( const OUString& rParagraph, OUString& rSelText, const ESelection& rSel,
-        bool bTryFirstSel )
+void ScInputHandler::ShowArgumentsTip( OUString& rSelText )
 {
     ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell();
     const sal_Unicode cSep = ScCompiler::GetNativeSymbolChar(ocSep);
@@ -932,34 +931,6 @@ void ScInputHandler::ShowArgumentsTip( const OUString& rParagraph, OUString& rSe
                 }
             }
         }
-        else if (bTryFirstSel)
-        {
-            sal_Int32 nPosition = 0;
-            OUString aText = pEngine->GetWord( 0, rSel.nEndPos-1 );
-            /* XXX: dubious, what is this condition supposed to exactly match? */
-            if (rSel.nEndPos <= aText.getLength() && aText[ rSel.nEndPos-1 ] == '=')
-            {
-                break;
-            }
-            OUString aNew;
-            nPosition = aText.getLength()+1;
-            ScTypedCaseStrSet::const_iterator it =
-                findText(*pFormulaDataPara, pFormulaDataPara->end(), aText, aNew, false);
-            if (it != pFormulaDataPara->end())
-            {
-                if( nPosition < rParagraph.getLength() && rParagraph[ nPosition ] =='(' )
-                {
-                    ShowTipBelow( aNew );
-                    bFound = true;
-                }
-                else
-                    break;
-            }
-            else
-            {
-                break;
-            }
-        }
         else
         {
             break;
@@ -986,7 +957,7 @@ void ScInputHandler::ShowTipCursor()
         {
             OUString aSelText( aParagraph.copy( 0, aSel.nEndPos ));
 
-            ShowArgumentsTip( aParagraph, aSelText, aSel, true);
+            ShowArgumentsTip( aSelText );
         }
     }
 }
@@ -1087,6 +1058,12 @@ void ScInputHandler::UseFormulaData()
         if ( aSel.nEndPos > aParagraph.getLength() )
             return;
 
+        if ( aParagraph.getLength() > aSel.nEndPos &&
+             ( ScGlobal::pCharClass->isLetterNumeric( aParagraph, aSel.nEndPos ) ||
+               aParagraph[ aSel.nEndPos ] == '_' ||
+               aParagraph[ aSel.nEndPos ] == '.'   ) )
+            return;
+
         //  Is the cursor at the end of a word?
         if ( aSel.nEndPos > 0 )
         {
@@ -1102,6 +1079,16 @@ void ScInputHandler::UseFormulaData()
                 miAutoPosFormula = findText(*pFormulaData, miAutoPosFormula, aText, aNew, false);
                 if (miAutoPosFormula != pFormulaData->end())
                 {
+                    // check if partial function name is not Between quotes
+                    bool bBetweenQuotes = false;
+                    for ( int n = 0; n < aSelText.getLength(); n++ )
+                    {
+                        if ( aSelText[ n ] == '"' )
+                            bBetweenQuotes = !bBetweenQuotes;
+                    }
+                    if ( bBetweenQuotes )
+                        return;  // we're between quotes
+
                     if (aNew[aNew.getLength()-1] == cParenthesesReplacement)
                         aNew = aNew.copy( 0, aNew.getLength()-1) + "()";
                     ShowTip( aNew );
@@ -1112,7 +1099,7 @@ void ScInputHandler::UseFormulaData()
 
             // function name is complete:
             // show tip below the cell with function name and arguments of function
-            ShowArgumentsTip( aParagraph, aSelText, aSel, false);
+            ShowArgumentsTip( aSelText );
         }
     }
 }
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 5b0e837..bfb8e62 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -157,8 +157,7 @@ private:
     bool            CursorAtClosingPar();
     void            SkipClosingPar();
     bool            GetFuncName( OUString& aStart, OUString& aResult );  // fdo75264
-    void            ShowArgumentsTip( const OUString& rParagraph, OUString& rSelText, const ESelection& rSel,
-                                      bool bTryFirstSel );
+    void            ShowArgumentsTip( OUString& rSelText );
     DECL_LINK( ModifyHdl, void* );
     DECL_LINK( ShowHideTipVisibleParentListener, VclWindowEvent* );
     DECL_LINK( ShowHideTipVisibleSecParentListener, VclWindowEvent* );


More information about the Libreoffice-commits mailing list