basctl/sdi/baside.sdi | 6 ++ basctl/source/basicide/baside2.cxx | 5 ++ basctl/source/basicide/baside2b.cxx | 7 +- basctl/uiconfig/basicide/menubar/menubar.xml | 1 basic/source/classes/codecompletecache.cxx | 7 ++ basic/source/classes/sbxmod.cxx | 2 include/basic/codecompletecache.hxx | 4 - include/sfx2/sfxsids.hrc | 1 officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu | 5 ++ sfx2/sdi/sfx.sdi | 24 ++++++++++ 10 files changed, 53 insertions(+), 9 deletions(-)
New commits: commit 29325bddce79943d956194009aa82ca1e5849f42 Author: Gergo Mocsi <gmocs...@gmail.com> Date: Mon Jul 22 14:32:00 2013 +0200 GSOC work menu entry + code fix Fixed the definition of GLOB_KEY, NOT_FOUND from const to static const. Added a new menu entry for code completition under View->Enable Code Completition. Change-Id: If8ac25ee43a7ba780ccdee2e5e909777115a1f27 diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index 5582c1d..7dfe68a 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -138,6 +138,12 @@ shell basctl_Shell StateMethod = GetState; ] + SID_BASICIDE_CODECOMPLETITION + [ + ExecMethod = ExecuteCurrent; + StateMethod = GetState; + ] + SID_BASICIDE_LIBSELECTED [ ExecMethod = ExecuteGlobal; diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 962658f..4fc6674 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1009,6 +1009,11 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) rLayout.BasicRemoveWatch(); } break; + case SID_BASICIDE_CODECOMPLETITION: + { + std::cerr << "code completition enabled" << std::endl; + } + break; case SID_CUT: { if ( !IsReadOnly() ) diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index bfa8285..0dddf7f 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -519,8 +519,8 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) aVect.push_back( aLine.copy(r.nBegin, r.nEnd - r.nBegin) ); } OUString sBaseName = aVect[0];//variable name - OUString sVarType = aCodeCompleteCache.GetVariableType(sBaseName, aCodeCompleteCache.GLOB_KEY); - if( sVarType == aCodeCompleteCache.NOT_FOUND ) + OUString sVarType = aCodeCompleteCache.GetVariableType(sBaseName, CodeCompleteDataCache::GLOB_KEY); + if( sVarType == CodeCompleteDataCache::NOT_FOUND ) sVarType = aCodeCompleteCache.GetVariableType(sBaseName, sActSub); Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW ); @@ -569,7 +569,6 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) } } } - } if ( !bDone && ( !TextEngine::DoesKeyChangeText( rKEvt ) || ImpCanModify() ) ) { @@ -878,7 +877,7 @@ OUString EditorWindow::GetActualSubName( sal_uLong nLine ) } } } - return aCodeCompleteCache.GLOB_KEY; + return CodeCompleteDataCache::GLOB_KEY; } void EditorWindow::SetScrollBarRanges() diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml index 2c12262..2e16130 100644 --- a/basctl/uiconfig/basicide/menubar/menubar.xml +++ b/basctl/uiconfig/basicide/menubar/menubar.xml @@ -61,6 +61,7 @@ <menu:menuitem menu:id=".uno:StatusBarVisible"/> <menu:menuitem menu:id=".uno:ShowImeStatusWindow"/> <menu:menuitem menu:id=".uno:ShowLines"/> + <menu:menuitem menu:id=".uno:BasicCodeCompletition"/> <menu:menuitem menu:id=".uno:GotoLine"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:FullScreen"/> diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx index e45e20a..fc23e7a 100644 --- a/basic/source/classes/codecompletecache.cxx +++ b/basic/source/classes/codecompletecache.cxx @@ -19,6 +19,9 @@ #include <basic/codecompletecache.hxx> +const OUString CodeCompleteDataCache::GLOB_KEY = OUString("global key"); +const OUString CodeCompleteDataCache::NOT_FOUND = OUString("not found"); + std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache) { for( CodeCompleteVarScopes::const_iterator aIt = aCache.aVarScopes.begin(); aIt != aCache.aVarScopes.end(); ++aIt ) @@ -52,12 +55,12 @@ OUString CodeCompleteDataCache::GetVariableType( const OUString& sVarName, const { CodeCompleteVarScopes::const_iterator aIt = aVarScopes.find( sProcName ); if( aIt == aVarScopes.end() )//procedure does not exist - return NOT_FOUND; + return CodeCompleteDataCache::NOT_FOUND; CodeCompleteVarTypes aVarTypes = aIt->second; CodeCompleteVarTypes::const_iterator aOtherIt = aVarTypes.find( sVarName ); if( aOtherIt == aVarTypes.end() ) - return NOT_FOUND; + return CodeCompleteDataCache::NOT_FOUND; else return aOtherIt->second; } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 8b679c3..f09291d 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -1821,7 +1821,7 @@ CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse() } aCache.InsertProcedure( pSymDef->GetName(), aLocVarTypes ); } - aCache.InsertProcedure( aCache.GLOB_KEY, aGlobVarTypes ); + aCache.InsertProcedure( CodeCompleteDataCache::GLOB_KEY, aGlobVarTypes ); delete pParser; return aCache; diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx index bba25d9..a1428e3 100644 --- a/include/basic/codecompletecache.hxx +++ b/include/basic/codecompletecache.hxx @@ -42,8 +42,8 @@ private: CodeCompleteVarScopes aVarScopes; public: - const OUString GLOB_KEY = OUString("global key"); - const OUString NOT_FOUND = OUString("not found"); + static const OUString GLOB_KEY; + static const OUString NOT_FOUND; CodeCompleteDataCache(){} virtual ~CodeCompleteDataCache(){} diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index c838c32..802be65 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -667,6 +667,7 @@ #define SID_BASICIDE_ARG_DOCUMENT_MODEL ( SID_BASICIDE_START + 51 ) #define SID_BASICIDE_MANAGE_LANG ( SID_BASICIDE_START + 52 ) #define SID_BASICIDE_CURRENT_LANG ( SID_BASICIDE_START + 53 ) +#define SID_BASICIDE_CODECOMPLETITION ( SID_BASICIDE_START + 54 ) // SlotIds for Apps -------------------------------------------------------- #define FN_PARAM (SID_SW_START + 1100) diff --git a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu index be70ad7..88bca68 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu @@ -8,6 +8,11 @@ <value xml:lang="en-US">Goto Line Number...</value> </prop> </node> + <node oor:name=".uno:BasicCodeCompletition" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Enable Code Completition</value> + </prop> + </node> <node oor:name=".uno:ShowLines" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Line Numbers</value> diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index b34e2a2..576e7fb 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -3874,6 +3874,30 @@ SfxVoidItem MatchGroup SID_BASICIDE_MATCHGROUP GroupId = GID_MACRO; ] +SfxBoolItem BasicCodeCompletition SID_BASICIDE_CODECOMPLETITION + +[ + /* flags: */ + AutoUpdate = TRUE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = FALSE, + ReadOnlyDoc = TRUE, + Toggle = TRUE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_MACRO; +] + //-------------------------------------------------------------------------- SfxBoolItem MenuBarVisible SID_TOGGLE_MENUBAR _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits