summaryrefslogtreecommitdiff
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 13:30:13 +0000
commit579f5cbfc4636ae28e545b0d2e456e100b08b4ad (patch)
tree59955f3e994b8924e21f4daaaa580b8b6394d346
parente0d7f9a7ca24f06b393f37a34c099cd10b9d2da0 (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
-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 2b6be65a197a..fe9ef00e709f 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 5b0e83728976..bfb8e62a5fac 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* );