From a4074e34039b0e570a3aa08cdffde1562892df17 Mon Sep 17 00:00:00 2001 From: August Sodora Date: Wed, 16 Nov 2011 14:50:26 -0500 Subject: Preparing to add option for line numbers in the basic ide --- basctl/sdi/baside.sdi | 5 ++++ basctl/source/basicide/basides1.cxx | 41 ++++++++++++++++++++++++++++ basctl/source/inc/basidesh.hxx | 1 + basctl/uiconfig/basicide/menubar/menubar.xml | 1 + 4 files changed, 48 insertions(+) (limited to 'basctl') diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index 37b2f08daf37..11a97fe62c99 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -39,6 +39,11 @@ shell BasicIDEShell // ======================================================== // Current, je nach aktuellem Fenster: // ======================================================== + SID_SHOWLINES + [ + StateMethod = GetState; + ExecMethod = ExecuteCurrent; + ] SID_BASICIDE_HIDECURPAGE [ ExecMethod = ExecuteCurrent; diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 234fad7fe7d2..d7caa9541352 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -85,6 +85,19 @@ using namespace ::com::sun::star::frame; class SvxSearchItem; +// until we have some configuration lets just keep +// persist this value for the process lifetime +bool& lcl_GetSourceLinesEnabledValue() +{ + static bool bSourceLinesEnabled(false); + return bSourceLinesEnabled; +} + +bool BasicIDEShell::SourceLinesDisplayed() +{ + return lcl_GetSourceLinesEnabledValue(); +} + void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) { if ( !pCurWin ) @@ -92,6 +105,20 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) switch ( rReq.GetSlot() ) { + case SID_SHOWLINES: + { + SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), sal_False); + bool bValue = false; + if ( pItem ) + bValue = pItem->GetValue(); + lcl_GetSourceLinesEnabledValue() = bValue; + if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) ) + { +// (ModuleWindow*)(pCurWin)->SetLineNumberDisplay( bValue ); + } + } + break; + case SID_BASICIDE_HIDECURPAGE: { pCurWin->StoreData(); @@ -797,6 +824,20 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) { switch ( nWh ) { + case SID_SHOWLINES: + { + // if this is not a module window hide the + // setting, doesn't make sense for example if the + // dialog editor is open + if( pCurWin && !pCurWin->IsA( TYPE( ModulWindow ) ) ) + { + rSet.DisableItem( nWh ); + rSet.Put(SfxVisibilityItem(nWh, sal_False)); + } + else + rSet.Put( SfxBoolItem( nWh, lcl_GetSourceLinesEnabledValue() ) ); + break; + } case SID_DOCINFO: { rSet.DisableItem( nWh ); diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 15fd8f2779e6..9d66a6dfde8f 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -227,6 +227,7 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > GetCurrentDocument() const; + bool SourceLinesDisplayed(); }; diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml index d9174bf9218c..24322b8f2603 100644 --- a/basctl/uiconfig/basicide/menubar/menubar.xml +++ b/basctl/uiconfig/basicide/menubar/menubar.xml @@ -49,6 +49,7 @@ + -- cgit