summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGergo Mocsi <gmocsi91@gmail.com>2013-07-22 14:32:00 +0200
committerGergo Mocsi <gmocsi91@gmail.com>2013-07-22 14:32:00 +0200
commit29325bddce79943d956194009aa82ca1e5849f42 (patch)
treee34ee22d1d8a6fbe935f24ed735bb05eba3e05bf
parent5692833cb94cbfe8a456007d8674f87c24c4efa0 (diff)
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
-rw-r--r--basctl/sdi/baside.sdi6
-rw-r--r--basctl/source/basicide/baside2.cxx5
-rw-r--r--basctl/source/basicide/baside2b.cxx7
-rw-r--r--basctl/uiconfig/basicide/menubar/menubar.xml1
-rw-r--r--basic/source/classes/codecompletecache.cxx7
-rw-r--r--basic/source/classes/sbxmod.cxx2
-rw-r--r--include/basic/codecompletecache.hxx4
-rw-r--r--include/sfx2/sfxsids.hrc1
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/BasicIDECommands.xcu5
-rw-r--r--sfx2/sdi/sfx.sdi24
10 files changed, 53 insertions, 9 deletions
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi
index 5582c1d343d5..7dfe68a8a798 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 962658ffda91..4fc6674aae57 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 bfa82850117d..0dddf7f14895 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 2c12262e28c1..2e161305e628 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 e45e20a512b6..fc23e7a580d4 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 8b679c3600fc..f09291deaf00 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 bba25d9b0659..a1428e351624 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 c838c32b6f82..802be65cd975 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 be70ad736809..88bca682a86a 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 b34e2a205269..576e7fb3598a 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