diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2015-06-25 17:26:20 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-07-13 13:19:43 +0000 |
commit | f3d748937a177cbbc0033bcf54d0d0fd57a1b409 (patch) | |
tree | 513f0d536bc0c9880a3499c46fcaaf34afa1bdd4 /sc/source | |
parent | 6e7c923d632c757c9a38a724cad2d55a84755570 (diff) |
tdf#89031 remove agressiveness from Calc function suggestions
Change-Id: I7751a038f8482addc0e45c0461666bbd1c959d12
Reviewed-on: https://gerrit.libreoffice.org/16478
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 51 | ||||
-rw-r--r-- | sc/source/ui/inc/inputhdl.hxx | 3 |
2 files changed, 20 insertions, 34 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 001aa27bb664..09308b8e8ae7 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 9cdf44cf729f..e53d7de3c16b 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* ); |