summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2015-06-25 17:26:20 +0200
committerEike Rathke <erack@redhat.com>2015-07-13 14:33:30 +0000
commit865afb6ed25891129efb6907595c892e417a191a (patch)
tree57e50243370169cc5a4a21b44fabcfc443cab32b /sc
parent776618f628ea6302374c90722c3dbd0a6dac1c19 (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> (cherry picked from commit f3d748937a177cbbc0033bcf54d0d0fd57a1b409) Reviewed-on: https://gerrit.libreoffice.org/17009 Reviewed-on: https://gerrit.libreoffice.org/17013
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/app/inputhdl.cxx51
-rw-r--r--sc/source/ui/inc/inputhdl.hxx3
2 files changed, 20 insertions, 34 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index c44257b45e30..3b7dddbfa7d6 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -799,8 +799,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);
@@ -927,34 +926,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;
@@ -981,7 +952,7 @@ void ScInputHandler::ShowTipCursor()
{
OUString aSelText( aParagraph.copy( 0, aSel.nEndPos ));
- ShowArgumentsTip( aParagraph, aSelText, aSel, true);
+ ShowArgumentsTip( aSelText );
}
}
}
@@ -1077,6 +1048,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 )
{
@@ -1092,6 +1069,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 );
@@ -1102,7 +1089,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 65ea47c3c927..b03be1807215 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -156,8 +156,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* );