From 9b534193a3132764f7c5a659025ab2c49bfb2605 Mon Sep 17 00:00:00 2001 From: Gergo Mocsi Date: Tue, 13 Aug 2013 18:11:26 +0200 Subject: GSOC work, behavior fixes Code completition: left/right arrow keys handled. Left arrow dismisses the dialog when reaches the dot. Right arrow dismissed the dialog when reaches the next line. ListBox appearance fixed. TAB key can insert the first matching entry. Autocorrect: "Autocorrect Keywords" has been renamed to "Autcorrect" (in the UI, and the config file, after this patch a make dev-install is needed). Keyword case correction is not just capitalizing the first letter ( eg. Elseif -> ElseIf ). Autoclose procedures: cursor is being placed inside the preocedure. Change-Id: Ie7e9ae96b49bd94562db83f96e1c4ad63ab3f3d6 --- basic/source/classes/codecompletecache.cxx | 2 +- basic/source/classes/sbxmod.cxx | 5 +++++ basic/source/comp/parser.cxx | 1 - basic/source/comp/token.cxx | 21 +++++++++++++++++++++ basic/source/inc/token.hxx | 1 + 5 files changed, 28 insertions(+), 2 deletions(-) (limited to 'basic') diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx index 172954331cf4..999c3241eb50 100644 --- a/basic/source/classes/codecompletecache.cxx +++ b/basic/source/classes/codecompletecache.cxx @@ -29,7 +29,7 @@ namespace CodeCompleteOptions::CodeCompleteOptions() { - bIsAutoCorrectKeywordsOn = officecfg::Office::BasicIDE::Autocomplete::AutoCorrectKeywords::get(); + bIsAutoCorrectKeywordsOn = officecfg::Office::BasicIDE::Autocomplete::AutoCorrect::get(); bIsAutoCloseParenthesisOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseParenthesis::get(); bIsAutoCloseQuotesOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseDoubleQuotes::get(); bIsProcedureAutoCompleteOn = officecfg::Office::BasicIDE::Autocomplete::AutocloseProc::get(); diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 053c13ed5ede..a3fa77931e1c 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1832,6 +1832,11 @@ SbxArrayRef SbModule::GetMethods() return pMethods; } +OUString SbModule::GetKeywordCase( const OUString& sKeyword ) const +{ + return SbiParser::GetKeywordCase( sKeyword ); +} + bool SbModule::HasExeCode() { // And empty Image always has the Global Chain set up diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index e24f89b020a8..680f4dcd40cc 100644 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -155,7 +155,6 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm ) } - // part of the runtime-library? SbiSymDef* SbiParser::CheckRTLForSym( const OUString& rSym, SbxDataType eType ) { diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx index 57614271c857..a2df363308f6 100644 --- a/basic/source/comp/token.cxx +++ b/basic/source/comp/token.cxx @@ -547,4 +547,25 @@ bool SbiTokenizer::MayBeLabel( bool bNeedsColon ) } } + +OUString SbiTokenizer::GetKeywordCase( const OUString& sKeyword ) +{ + if( !nToken ) + { + TokenTable *tp; + for( nToken = 0, tp = pTokTable; tp->t; nToken++, tp++ ) + {} + } + TokenTable* tp = pTokTable; + for( short i = 0; i < nToken; i++, tp++ ) + { + OUString sStr = OStringToOUString(tp->s, RTL_TEXTENCODING_ASCII_US); + if( sStr.equalsIgnoreAsciiCase(sKeyword) ) + { + return sStr; + } + } + return OUString(""); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx index 0ce9cf443f58..cf127bc798f2 100644 --- a/basic/source/inc/token.hxx +++ b/basic/source/inc/token.hxx @@ -167,6 +167,7 @@ public: { return t >= FIRSTKWD && t <= LASTKWD; } static bool IsExtra( SbiToken t ) { return t >= FIRSTEXTRA; } + static OUString GetKeywordCase( const OUString& sKeyword ); }; -- cgit