diff options
author | Gergo Mocsi <gmocsi91@gmail.com> | 2013-07-23 12:42:37 +0200 |
---|---|---|
committer | Gergo Mocsi <gmocsi91@gmail.com> | 2013-09-02 18:16:47 +0200 |
commit | 61ee2598b18890eb5798a3943fbedd22a24e7aea (patch) | |
tree | 81ba813855079ba888902514511e94ccf0b036c0 /basctl | |
parent | b0b511e9b5b18069b6f4dc9565e2a485d05e1cdd (diff) |
GSOC work, code complete option, menu entry fixes
Menu entry is added under View->Enable Code Completition when in Experimental mode.
Fixed the call of funtion SbModule::GetCodeCompleteDataFromParse() to be called only when code completition is enabled.
Replaced the occurences of SvtMiscOptions to CodeCompleteOptions.
Change-Id: If0520123ab5f612d7d24fb98f8e9bf6881af76cb
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/sdi/baside.sdi | 13 | ||||
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 20 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 20 |
3 files changed, 38 insertions, 15 deletions
diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index 7dfe68a8a798..42873f6cd303 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -35,6 +35,13 @@ shell basctl_Shell StateMethod = GetState; ExecMethod = ExecuteCurrent; ] + + SID_BASICIDE_CODECOMPLETITION + [ + StateMethod = GetState; + ExecMethod = ExecuteCurrent; + ] + SID_BASICIDE_HIDECURPAGE [ ExecMethod = ExecuteCurrent; @@ -138,12 +145,6 @@ 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 04d27f6f261b..9687b75ac014 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -52,6 +52,8 @@ #include <toolkit/helper/vclunohelper.hxx> #include <vcl/msgbox.hxx> #include <cassert> +#include <basic/codecompletecache.hxx> +#include <svtools/miscopt.hxx> namespace basctl { @@ -1011,7 +1013,8 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) break; case SID_BASICIDE_CODECOMPLETITION: { - std::cerr << "code completition enabled" << std::endl; + SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), false); + CodeCompleteOptions::SetCodeCompleteOn( pItem && pItem->GetValue() ); } break; case SID_CUT: @@ -1160,6 +1163,21 @@ void ModulWindow::GetState( SfxItemSet &rSet ) rSet.Put(SfxBoolItem(nWh, bSourceLinesEnabled)); break; } + case SID_BASICIDE_CODECOMPLETITION: + { + SvtMiscOptions aMiscOptions; + if( aMiscOptions.IsExperimentalMode() ) + { + rSet.Put(SfxBoolItem( nWh, CodeCompleteOptions::IsCodeCompleteOn() )); + std::cerr <<"code complete set to: " << CodeCompleteOptions::IsCodeCompleteOn() << std::endl; + } + else + { + rSet.Put( SfxVisibilityItem(nWh, false) ); + //CodeCompleteOptions::SetCodeCompleteOn( false ); + } + } + break; } } } diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 7433a389a939..7afb16defe46 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -48,7 +48,6 @@ #include <vcl/help.hxx> #include <vector> -#include <svtools/miscopt.hxx> #include "com/sun/star/reflection/XIdlReflection.hpp" #include <comphelper/namedvaluecollection.hxx> #include <comphelper/processfactory.hxx> @@ -492,7 +491,6 @@ bool EditorWindow::ImpCanModify() void EditorWindow::KeyInput( const KeyEvent& rKEvt ) { - SvtMiscOptions aMiscOptions; if ( !pEditView ) // Happens in Win95 return; @@ -507,7 +505,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) // see if there is an accelerator to be processed first bool bDone = SfxViewShell::Current()->KeyInput( rKEvt ); - if( rKEvt.GetKeyCode().GetCode() == KEY_POINT && aMiscOptions.IsExperimentalMode() ) + if( rKEvt.GetKeyCode().GetCode() == KEY_POINT && CodeCompleteOptions::IsCodeCompleteOn() ) { rModulWindow.UpdateModule(); TextSelection aSel = GetEditView()->GetSelection(); @@ -835,14 +833,20 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { ParagraphInsertedDeleted( rTextHint.GetValue(), true ); DoDelayedSyntaxHighlight( rTextHint.GetValue() ); - rModulWindow.UpdateModule(); - aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars()); + if( CodeCompleteOptions::IsCodeCompleteOn() ) + { + rModulWindow.UpdateModule(); + aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars()); + } } else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED ) { ParagraphInsertedDeleted( rTextHint.GetValue(), false ); - rModulWindow.UpdateModule(); - aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars()); + if( CodeCompleteOptions::IsCodeCompleteOn() ) + { + rModulWindow.UpdateModule(); + aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars()); + } } else if( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED ) { @@ -856,7 +860,7 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) pBindings->Invalidate( SID_COPY ); } } - else if( rTextHint.GetId() == TEXT_HINT_MODIFIED ) + else if( rTextHint.GetId() == TEXT_HINT_MODIFIED && CodeCompleteOptions::IsCodeCompleteOn() ) { rModulWindow.UpdateModule(); aCodeCompleteCache.SetVars(rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse().GetVars()); |