diff options
-rw-r--r-- | basctl/source/basicide/baside2.hxx | 16 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 107 | ||||
-rw-r--r-- | basic/Library_sb.mk | 1 | ||||
-rw-r--r-- | basic/source/classes/codecompletecache.cxx | 50 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 44 | ||||
-rw-r--r-- | include/basic/codecompletecache.hxx | 61 | ||||
-rw-r--r-- | include/basic/sbmod.hxx | 7 |
7 files changed, 235 insertions, 51 deletions
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 8bb34cf6f5ed..8f361bed7ead 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -52,6 +52,7 @@ class SvxSearchItem; #include <boost/scoped_ptr.hpp> #include <vcl/textdata.hxx> +#include <basic/codecompletecache.hxx> namespace com { namespace sun { namespace star { namespace beans { class XMultiPropertySet; @@ -114,8 +115,10 @@ private: virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface(sal_Bool bCreate = true); - std::vector< CodeCompleteData > aCodeCompleteCache; - CodeCompleteWindow* pCodeCompleteWnd; + //std::vector< CodeCompleteData > aCodeCompleteCache; + CodeCompleteDataCache aCodeCompleteCache; + //CodeCompleteWindow* pCodeCompleteWnd; + boost::scoped_ptr< CodeCompleteWindow > pCodeCompleteWnd; OUString GetActualSubName( sal_uLong nLine ); // gets the actual subroutine name according to line number protected: @@ -492,8 +495,9 @@ public: void ResizeListBox(); void SelectFirstEntry(); //selects first entry in ListBox -protected: - virtual void KeyInput( const KeyEvent& rKeyEvt ); +/*protected: + //virtual void KeyInput( const KeyEvent& rKeyEvt ); + virtual void LoseFocus();*/ }; class CodeCompleteListBox: public ListBox @@ -520,6 +524,10 @@ public: DECL_LINK(ImplDoubleClickHdl, void*); virtual long PreNotify( NotifyEvent& rNEvt ); + +/*protected: + virtual void LoseFocus();*/ + }; } // namespace basctl diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index fe37210cfff0..513894baef55 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -232,7 +232,8 @@ EditorWindow::EditorWindow (Window* pParent, ModulWindow* pModulWindow) : nCurTextWidth(0), bHighlightning(false), bDoSyntaxHighlight(true), - bDelayHighlight(true) + bDelayHighlight(true), + pCodeCompleteWnd(new CodeCompleteWindow(this)) { SetBackground(Wallpaper(GetSettings().GetStyleSettings().GetFieldColor())); SetPointer( Pointer( POINTER_TEXT ) ); @@ -250,9 +251,6 @@ EditorWindow::EditorWindow (Window* pParent, ModulWindow* pModulWindow) : s[0] = OUString( "FontHeight" ); s[1] = OUString( "FontName" ); n->addPropertiesChangeListener(s, listener_.get()); - //aListBox = new CodeCompleteListBox(this); - //pCodeCopleteWnd = new CodeCompleteWindow(this); - pCodeCompleteWnd = new CodeCompleteWindow( this ); } @@ -274,8 +272,6 @@ EditorWindow::~EditorWindow() EndListening( *pEditEngine ); pEditEngine->RemoveView(pEditView.get()); } - - delete pCodeCompleteWnd; } OUString EditorWindow::GetWordAtCursor() @@ -510,7 +506,6 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) TextSelection aSel = GetEditView()->GetSelection(); sal_uLong nLine = aSel.GetStart().GetPara(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified - OUString aStr = aLine.copy( std::max(aLine.lastIndexOf(" "), aLine.lastIndexOf("\t"))+1 ); // variable name OUString sActSub = GetActualSubName( nLine ); std::vector< OUString > aVect; @@ -522,18 +517,22 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) if( r.tokenType == 1 ) // extract the identifers(methods, base variable) aVect.push_back( aLine.copy(r.nBegin, r.nEnd - r.nBegin) ); } - OUString sBaseName = aVect[0]; - for( unsigned int i = 0; i < aCodeCompleteCache.size(); ++i) - { - if( aCodeCompleteCache[i].sVarName.equalsIgnoreAsciiCase( sBaseName ) && + OUString sBaseName = aVect[0];//variable name + OUString sVarType = aCodeCompleteCache.GetVariableType(sBaseName, sActSub); + + /*for( unsigned int i = 0; i < aCodeCompleteCache.size(); ++i) + {*/ + /*if( aCodeCompleteCache[i].sVarName.equalsIgnoreAsciiCase( sBaseName ) && ( aCodeCompleteCache[i].sVarParent == sActSub || aCodeCompleteCache[i].IsGlobal() ) ) + {*/ + if( sVarType != aCodeCompleteCache.NOT_FOUND ) { Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), UNO_SET_THROW ); Reference< reflection::XIdlReflection > xRefl( xFactory->createInstance("com.sun.star.reflection.CoreReflection"), UNO_QUERY_THROW ); if( xRefl.is() ) { - Reference< reflection::XIdlClass > xClass = xRefl->forName(aCodeCompleteCache[i].sVarType);//get the base class for reflection + Reference< reflection::XIdlClass > xClass = xRefl->forName(sVarType);//get the base class for reflection if( xClass != NULL ) { unsigned int j = 1; @@ -558,8 +557,6 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) if( aMethods.getLength() != 0 ) { Rectangle aRect = ( (TextEngine*) GetEditEngine() )->PaMtoEditCursor( aSel.GetEnd() , false ); - //GetEditView()->EnableCursor( false ); - aSel.GetStart().GetIndex() += 1; aSel.GetEnd().GetIndex() += 1; pCodeCompleteWnd->ClearListBox(); @@ -570,15 +567,16 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) { pCodeCompleteWnd->InsertEntry( OUString(aMethods[l]->getName()) ); } - pCodeCompleteWnd->ResizeListBox(); pCodeCompleteWnd->Show(); + pCodeCompleteWnd->ResizeListBox(); pCodeCompleteWnd->SelectFirstEntry(); } } } - break; } - } + /*break; + }*/ + //} } if ( !bDone && ( !TextEngine::DoesKeyChangeText( rKEvt ) || ImpCanModify() ) ) { @@ -840,12 +838,12 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) ParagraphInsertedDeleted( rTextHint.GetValue(), true ); DoDelayedSyntaxHighlight( rTextHint.GetValue() ); rModulWindow.UpdateModule(); - aCodeCompleteCache = rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(); + aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars()); } else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED ) { ParagraphInsertedDeleted( rTextHint.GetValue(), false ); - aCodeCompleteCache = rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(); + aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars()); } else if( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED ) { @@ -861,7 +859,7 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) } else if( rTextHint.GetId() == TEXT_HINT_MODIFIED ) { - aCodeCompleteCache = rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(); + aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars()); } } } @@ -884,7 +882,7 @@ OUString EditorWindow::GetActualSubName( sal_uLong nLine ) } } } - return OUString(""); + return aCodeCompleteCache.GLOB_KEY; } void EditorWindow::SetScrollBarRanges() @@ -2363,7 +2361,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped ) } CodeCompleteListBox::CodeCompleteListBox( CodeCompleteWindow* pPar ) -: ListBox(pPar, WB_SORT | WB_BORDER), +: ListBox(pPar, WB_SORT | WB_BORDER ), pCodeCompleteWindow(pPar) { SetDoubleClickHdl(LINK(this, CodeCompleteListBox, ImplDoubleClickHdl)); @@ -2382,7 +2380,7 @@ IMPL_LINK_NOARG(CodeCompleteListBox, ImplDoubleClickHdl) void CodeCompleteListBox::InsertSelectedEntry() { - if( GetEntry( GetSelectEntryPos() ) != OUString("") ) + if( aFuncBuffer.toString() != OUString("") ) { // if the user typed in something: remove, and insert TextPaM aEnd(pCodeCompleteWindow->aTextSelection.GetEnd().GetPara(), pCodeCompleteWindow->aTextSelection.GetEnd().GetIndex() + aFuncBuffer.getLength()); @@ -2390,16 +2388,35 @@ void CodeCompleteListBox::InsertSelectedEntry() pCodeCompleteWindow->pParent->GetEditView()->SetSelection(TextSelection(aStart, aEnd)); pCodeCompleteWindow->pParent->GetEditView()->DeleteSelected(); - pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True ); - pCodeCompleteWindow->Hide(); - pCodeCompleteWindow->pParent->GetEditView()->SetSelection( pCodeCompleteWindow->pParent->GetEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetStart()) ); - pCodeCompleteWindow->pParent->GrabFocus(); + if( GetEntry( GetSelectEntryPos() ) != OUString("") ) + {//if the user selected something + pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True ); + pCodeCompleteWindow->Hide(); + pCodeCompleteWindow->pParent->GetEditView()->SetSelection( pCodeCompleteWindow->pParent->GetEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetStart()) ); + pCodeCompleteWindow->pParent->GrabFocus(); + } + else + { + pCodeCompleteWindow->Hide(); + pCodeCompleteWindow->pParent->GetEditView()->SetSelection( pCodeCompleteWindow->pParent->GetEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetStart()) ); + pCodeCompleteWindow->pParent->GrabFocus(); + } + } + else + { + if( GetEntry( GetSelectEntryPos() ) != OUString("") ) + {//if the user selected something + pCodeCompleteWindow->pParent->GetEditView()->InsertText( (OUString) GetEntry(GetSelectEntryPos()), sal_True ); + pCodeCompleteWindow->Hide(); + pCodeCompleteWindow->pParent->GetEditView()->SetSelection( pCodeCompleteWindow->pParent->GetEditView()->CursorEndOfLine(pCodeCompleteWindow->GetTextSelection().GetStart()) ); + pCodeCompleteWindow->pParent->GrabFocus(); + } } } long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt ) { - if( ( rNEvt.GetType() == EVENT_KEYINPUT ) ) + if( rNEvt.GetType() == EVENT_KEYINPUT ) { KeyEvent aKeyEvt = *rNEvt.GetKeyEvent(); sal_Unicode aChar = aKeyEvt.GetKeyCode().GetCode(); @@ -2445,6 +2462,11 @@ long CodeCompleteListBox::PreNotify( NotifyEvent& rNEvt ) } } } + /*if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN ) + { + //MouseEvent rMEvt = *rNEvt.GetMouseEvent(); + std::cerr << "parent active: " << (pCodeCompleteWindow->pParent->IsActive() == sal_True) << std::endl; + }*/ return ListBox::PreNotify( rNEvt ); } @@ -2460,12 +2482,19 @@ void CodeCompleteListBox::SetVisibleEntries() } } +/*void CodeCompleteListBox::LoseFocus() +{ + std::cerr << "CodeCompleteListBox::LoseFocus" << std::endl; + Window::LoseFocus(); + //pCodeCompleteWindow->Hide(); +}*/ + CodeCompleteWindow::CodeCompleteWindow( EditorWindow* pPar ) -: Window( pPar, WB_BORDER ), +: Window( pPar ), pParent(pPar) { + SetSizePixel( Size(151,151) ); //default, later it changes InitListBox(); - SetSizePixel( Size(150,150) ); //default, later it changes } void CodeCompleteWindow::InitListBox() @@ -2473,7 +2502,7 @@ void CodeCompleteWindow::InitListBox() pListBox = new CodeCompleteListBox( this ); pListBox->SetSizePixel( Size(150,150) ); //default, this will adopt the line length pListBox->Show(); - pListBox->GrabFocus(); + //pListBox->GrabFocus(); } CodeCompleteWindow::~CodeCompleteWindow() @@ -2493,15 +2522,14 @@ void CodeCompleteWindow::ClearListBox() pListBox->aEntryVect.clear(); pListBox->aFuncBuffer.makeStringAndClear(); } - +/* void CodeCompleteWindow::KeyInput( const KeyEvent& rKeyEvt ) { if( rKeyEvt.GetKeyCode().GetCode() == KEY_ESCAPE ) {// ESC key closes the window: does not modify anything - //pParent->GetEditView()->EnableCursor( true ); Hide(); } -} +}*/ void CodeCompleteWindow::SetTextSelection( const TextSelection& aSel ) { @@ -2531,8 +2559,11 @@ void CodeCompleteWindow::ResizeListBox() aSize.setWidth( pListBox->CalcSize(aLongestEntry.getLength(),pListBox->GetEntryCount()).getWidth() ); pListBox->SetSizePixel( aSize ); + aSize.setWidth( aSize.getWidth() + 1 ); + aSize.setHeight( aSize.getHeight() + 1 ); SetSizePixel( aSize ); } + //pListBox->GrabFocus(); } void CodeCompleteWindow::SelectFirstEntry() @@ -2540,10 +2571,16 @@ void CodeCompleteWindow::SelectFirstEntry() if( pListBox->GetEntryCount() > 0 ) { pListBox->SelectEntryPos( 0 ); - pListBox->GrabFocus(); } + //pListBox->GrabFocus(); } +/*void CodeCompleteWindow::LoseFocus() +{ + std::cerr << "CodeCompleteWindow::LoseFocus" << std::endl; + Window::LoseFocus(); +}*/ + } // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk index c89214389b8b..b325a159bcb4 100644 --- a/basic/Library_sb.mk +++ b/basic/Library_sb.mk @@ -59,6 +59,7 @@ $(eval $(call gb_Library_add_exception_objects,sb,\ basic/source/basmgr/basicmanagerrepository \ basic/source/basmgr/basmgr \ basic/source/basmgr/vbahelper \ + basic/source/classes/codecompletecache \ basic/source/classes/errobject \ basic/source/classes/eventatt \ basic/source/classes/global \ diff --git a/basic/source/classes/codecompletecache.cxx b/basic/source/classes/codecompletecache.cxx new file mode 100644 index 000000000000..f4831039ed6d --- /dev/null +++ b/basic/source/classes/codecompletecache.cxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <basic/codecompletecache.hxx> + +const CodeCompleteVarScopes& CodeCompleteDataCache::GetVars() const +{ + return aVarScopes; +} + +void CodeCompleteDataCache::InsertProcedure( const OUString& sProcName, const CodeCompleteVarTypes& aVarTypes ) +{ + aVarScopes.insert( CodeCompleteVarScopes::value_type(sProcName, aVarTypes) ); +} +void CodeCompleteDataCache::SetVars( const CodeCompleteVarScopes& aScopes ) +{ + aVarScopes = aScopes; +} + +const OUString& CodeCompleteDataCache::GetVariableType( const OUString& sVarName, const OUString& sProcName ) const +{ + CodeCompleteVarScopes::const_iterator aIt = aVarScopes.find( sProcName ); + if( aIt == aVarScopes.end() )//procedure does not exist + return NOT_FOUND; + + CodeCompleteVarTypes aVarTypes = aIt->second; + CodeCompleteVarTypes::const_iterator aOtherIt = aVarTypes.find( sVarName ); + if( aOtherIt == aVarTypes.end() ) + return NOT_FOUND; + else + return aOtherIt->second; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 7f85be207f14..15774d811bde 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -90,6 +90,9 @@ typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap; ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue ); +/*const OUString CodeCompleteDataCache::GLOB_KEY = OUString("global key"); +const OUString CodeCompleteDataCache::NOT_FOUND = OUString("not found");*/ + class DocObjectWrapper : public DocObjectWrapper_BASE { Reference< XAggregation > m_xAggProxy; @@ -1777,9 +1780,11 @@ IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/) return 0; } - -std::vector< CodeCompleteData > SbModule::GetCodeCompleteDataFromParse() +//std::vector< CodeCompleteData > SbModule::GetCodeCompleteDataFromParse() +CodeCompleteDataCache SbModule::GetCodeCompleteDataFromParse() { + CodeCompleteDataCache aCache; + ErrorHdlResetter aErrHdl; SbxBase::ResetError(); @@ -1788,37 +1793,56 @@ std::vector< CodeCompleteData > SbModule::GetCodeCompleteDataFromParse() while( pParser->Parse() ) {} SbiSymPool* pPool = pParser->pPool; - std::vector< CodeCompleteData > aRet; + //std::vector< CodeCompleteData > aRet; for( sal_uInt16 i = 0; i < pPool->GetSize(); ++i ) { SbiSymDef* pSymDef = pPool->Get(i); if( pSymDef->GetType() == SbxOBJECT ) { - CodeCompleteData aCodeCompleteData; - aCodeCompleteData.sVarName = pSymDef->GetName(); + //CodeCompleteData aCodeCompleteData; + CodeCompleteVarTypes aVarTypes; + /*aCodeCompleteData.sVarName = pSymDef->GetName(); aCodeCompleteData.sVarParent = OUString(""); aCodeCompleteData.sVarType = pParser->aGblStrings.Find( pSymDef->GetTypeId() ); if(!aCodeCompleteData.sVarType.isEmpty()) + { aRet.push_back(aCodeCompleteData); + aVarTypes.insert(CodeCompleteVarTypes::value_type( pSymDef->GetName(), pParser->aGblStrings.Find( pSymDef->GetTypeId() ) ) ); + aCache.InsertProcedure( aCache.GLOB_KEY, aVarTypes ); + }*/ + if(pParser->aGblStrings.Find( pSymDef->GetTypeId() ).isEmpty() ) + { + aVarTypes.insert(CodeCompleteVarTypes::value_type( pSymDef->GetName(), pParser->aGblStrings.Find( pSymDef->GetTypeId() ) ) ); + aCache.InsertProcedure( aCache.GLOB_KEY, aVarTypes ); + } } SbiSymPool& pChildPool = pSymDef->GetPool(); for(sal_uInt16 j = 0; j < pChildPool.GetSize(); ++j ) { - CodeCompleteData aCodeCompleteData; + //CodeCompleteData aCodeCompleteData; + CodeCompleteVarTypes aVarTypes; + SbiSymDef* pChildSymDef = pChildPool.Get(j); if( pChildSymDef->GetType() == SbxOBJECT ) { - aCodeCompleteData.sVarName = pChildSymDef->GetName(); + /*aCodeCompleteData.sVarName = pChildSymDef->GetName(); aCodeCompleteData.sVarParent = pSymDef->GetName(); aCodeCompleteData.sVarType = pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ); - if(!aCodeCompleteData.sVarType.isEmpty()) - aRet.push_back(aCodeCompleteData); + if(!aCodeCompleteData.sVarType.isEmpty())*/ + if( pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ).isEmpty() ) + { + //aRet.push_back(aCodeCompleteData); + aVarTypes.insert(CodeCompleteVarTypes::value_type( pChildSymDef->GetName(), pParser->aGblStrings.Find( pChildSymDef->GetTypeId() ) ) ); + aCache.InsertProcedure( pSymDef->GetName(), aVarTypes ); + } } } } + //std::cerr << aCache << std::endl; delete pParser; - return aRet; + //return aRet; + return aCache; } SbxArrayRef SbModule::GetMethods() diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx new file mode 100644 index 000000000000..f375f04d0484 --- /dev/null +++ b/include/basic/codecompletecache.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef CODECOMPLETECACHE_H +#define CODECOMPLETECACHE_H + +#include <basic/sbdef.hxx> +#include <basic/sbxobj.hxx> +#include <basic/sbxdef.hxx> +#include <boost/utility.hpp> +#include <boost/unordered_map.hpp> +#include <rtl/ustring.hxx> + +typedef boost::unordered_map< OUString, OUString, OUStringHash > CodeCompleteVarTypes; +/* variable name, type */ +typedef boost::unordered_map< OUString, CodeCompleteVarTypes, OUStringHash > CodeCompleteVarScopes; +/* procedure, CodeCompleteVarTypes */ + +class CodeCompleteDataCache +{ +/* + * cache to store data for + * code completition + * */ +private: + CodeCompleteVarScopes aVarScopes; + +public: + const OUString GLOB_KEY = OUString("global key"); + const OUString NOT_FOUND = OUString("not found"); + CodeCompleteDataCache(){} + + virtual ~CodeCompleteDataCache(){} + + void SetVars( const CodeCompleteVarScopes& aScopes ); + const CodeCompleteVarScopes& GetVars() const; + + void InsertProcedure( const OUString& sProcName, const CodeCompleteVarTypes& aVarTypes ); + const OUString& GetVariableType( const OUString& sVarName, const OUString& sProcName ) const; + +}; + +#endif // CODECOMPLETECACHE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx index 65dab93173c4..763beefe3c5d 100644 --- a/include/basic/sbmod.hxx +++ b/include/basic/sbmod.hxx @@ -29,6 +29,7 @@ #include <deque> #include <boost/utility.hpp> #include "basicdllapi.h" +#include <basic/codecompletecache.hxx> class SbMethod; class SbProperty; @@ -44,6 +45,7 @@ class ModuleInitDependencyMap; struct ClassModuleRunInitItem; struct SbClassData; +/* struct CodeCompleteData { OUString sVarName; @@ -59,7 +61,7 @@ struct CodeCompleteData { return ( sVarParent == OUString("") ); } -}; +};*/ class BASIC_DLLPUBLIC SbModule : public SbxObject, private ::boost::noncopyable { @@ -150,7 +152,8 @@ public: void RemoveVars(); ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule(); bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ); - std::vector< CodeCompleteData > GetCodeCompleteDataFromParse(); + //std::vector< CodeCompleteData > GetCodeCompleteDataFromParse(); + CodeCompleteDataCache GetCodeCompleteDataFromParse(); SbxArrayRef GetMethods(); }; |