Preparing to add option for line numbers in the basic ide

This commit is contained in:
August Sodora
2011-11-16 14:50:26 -05:00
committed by Norbert Thiebaud
parent deb6bcf8d9
commit a4074e3403
7 changed files with 80 additions and 1 deletions

View File

@@ -39,6 +39,11 @@ shell BasicIDEShell
// ========================================================
// Current, je nach aktuellem Fenster:
// ========================================================
SID_SHOWLINES
[
StateMethod = GetState;
ExecMethod = ExecuteCurrent;
]
SID_BASICIDE_HIDECURPAGE
[
ExecMethod = ExecuteCurrent;

View File

@@ -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 );

View File

@@ -227,6 +227,7 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
GetCurrentDocument() const;
bool SourceLinesDisplayed();
};

View File

@@ -49,6 +49,7 @@
<menu:menuitem menu:id=".uno:StatusBarVisible"/>
<menu:menuitem menu:id=".uno:ShowImeStatusWindow"/>
<menu:menuitem menu:id=".uno:GotoLine"/>
<menu:menuitem menu:id=".uno:ShowLines"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:FullScreen"/>
</menu:menupopup>

View File

@@ -8,6 +8,12 @@
<value xml:lang="en-US">Goto Line Number...</value>
</prop>
</node>
<node oor:name=".uno:ShowLines" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Display Source Line Number...</value>
</prop>
</node>
</node>
<node oor:name="Popups">
</node>

View File

@@ -315,7 +315,8 @@
#define SID_ENCRYPTIONDATA (SID_SFX_START + 1722)
#define SID_PASSWORDINTERACTION (SID_SFX_START + 1723)
#define SID_GOTOLINE (SID_SFX_START + 1724)
#define SID_SFX_free_START (SID_SFX_START + 1725)
#define SID_SHOWLINES (SID_SFX_START + 1725)
#define SID_SFX_free_START (SID_SFX_START + 1726)
#define SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)

View File

@@ -3593,6 +3593,30 @@ SfxBoolItem ReccomendReadonly SID_RECOMMENDREADONLY
GroupId = ;
]
//----------------------------------------------------FALSE
SfxBoolItem ShowLines SID_SHOWLINES
[
/* 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;
]
//--------------------------------------------------------------------------
SfxVoidItem RunMacro SID_RUNMACRO