summaryrefslogtreecommitdiff
path: root/basctl/source
diff options
context:
space:
mode:
Diffstat (limited to 'basctl/source')
-rw-r--r--basctl/source/basicide/baside2b.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index e408b299fcfe..9221e4415355 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -579,6 +579,11 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
void EditorWindow::HandleAutoCorrect()
{
+ if( CodeCompleteOptions::IsExtendedTypeDeclaration() )
+ {
+ rModulWindow.UpdateModule();
+ rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(aCodeCompleteCache);
+ }
TextSelection aSel = GetEditView()->GetSelection();
sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
@@ -590,7 +595,7 @@ void EditorWindow::HandleAutoCorrect()
return;
HighlightPortion& r = aPortions[aPortions.size()-1];
- if( r.tokenType == 9 ) // correct the last entered keyword
+ if( r.tokenType == TT_KEYWORDS ) // correct the last entered keyword
{
OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
if( !sStr.isEmpty() )
@@ -600,8 +605,9 @@ void EditorWindow::HandleAutoCorrect()
// if it is a keyword, get its correct case
sStr = rModulWindow.GetSbModule()->GetKeywordCase(sStr);
else
- // else capitalize first letter/select the correct one, and replace
+ {// else capitalize first letter/select the correct one, and replace
sStr = sStr.replaceAt( 0, 1, OUString(sStr[0]).toAsciiUpperCase() );
+ }
TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
@@ -609,6 +615,18 @@ void EditorWindow::HandleAutoCorrect()
pEditView->SetSelection( aSel );
}
}
+ if( r.tokenType == TT_IDENTIFIER )
+ {// correct uno types
+ OUString sStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin);
+ if( !sStr.isEmpty() && !aCodeCompleteCache.GetCorrectCaseVarName(sStr).isEmpty() )
+ {
+ sStr = aCodeCompleteCache.GetCorrectCaseVarName(sStr);
+ TextPaM aStart(nLine, aSel.GetStart().GetIndex() - sStr.getLength() );
+ TextSelection sTextSelection(aStart, TextPaM(nLine, aSel.GetStart().GetIndex()));
+ pEditEngine->ReplaceText( sTextSelection, sStr );
+ pEditView->SetSelection( aSel );
+ }
+ }
}
void EditorWindow::HandleAutoCloseParen()