diff options
Diffstat (limited to 'sc/source/ui/app')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 51 |
1 files changed, 19 insertions, 32 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 ); } } } |