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
This commit is contained in:
parent
1b8b4864c1
commit
3ce1f554de
@ -138,6 +138,12 @@ shell basctl_Shell
|
||||
StateMethod = GetState;
|
||||
]
|
||||
|
||||
SID_BASICIDE_CODECOMPLETITION
|
||||
[
|
||||
ExecMethod = ExecuteCurrent;
|
||||
StateMethod = GetState;
|
||||
]
|
||||
|
||||
SID_BASICIDE_LIBSELECTED
|
||||
[
|
||||
ExecMethod = ExecuteGlobal;
|
||||
|
@ -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() )
|
||||
|
@ -525,8 +525,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 );
|
||||
@ -575,7 +575,6 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ( !bDone && ( !TextEngine::DoesKeyChangeText( rKEvt ) || ImpCanModify() ) )
|
||||
{
|
||||
@ -884,7 +883,7 @@ OUString EditorWindow::GetActualSubName( sal_uLong nLine )
|
||||
}
|
||||
}
|
||||
}
|
||||
return aCodeCompleteCache.GLOB_KEY;
|
||||
return CodeCompleteDataCache::GLOB_KEY;
|
||||
}
|
||||
|
||||
void EditorWindow::SetScrollBarRanges()
|
||||
|
@ -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"/>
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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(){}
|
||||
|
@ -671,6 +671,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)
|
||||
|
@ -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>
|
||||
|
@ -3819,6 +3819,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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user