Kaydet (Commit) 73d3c950 authored tarafından Noel Power's avatar Noel Power

add new 'Goto Line' menu item to Basic IDE

üst 20dde373
......@@ -169,6 +169,12 @@
#define RID_STR_NORMAL_MODULES ( RID_BASICIDE_START + 120 )
#define RID_STR_CLASS_MODULES ( RID_BASICIDE_START + 121 )
#define RID_DLG_GOTOLINE ( RID_BASICIDE_START + 122 )
#define RID_FT_LINE ( RID_BASICIDE_START + 123 )
#define RID_ED_LINE ( RID_BASICIDE_START + 124 )
#define RID_STR_GETLINE ( RID_BASICIDE_START + 125 )
#endif // _SVX_NOIDERESIDS
#endif // _BASIDESH_HRC
......@@ -116,6 +116,12 @@ shell BasicIDEShell
StateMethod = GetState;
]
SID_GOTOLINE
[
ExecMethod = ExecuteCurrent;
StateMethod = GetState;
]
FID_SEARCH_NOW
[
ExecMethod = ExecuteCurrent;
......
......@@ -34,6 +34,7 @@
#include <basic/sbx.hxx>
#define _SVSTDARR_STRINGS
#include <svl/svstdarr.hxx>
#include <svl/visitem.hxx>
#include <ide_pch.hxx>
#define _SOLAR__PRIVATE 1
......@@ -57,6 +58,7 @@
#include <managelang.hxx>
#include <localizationmgr.hxx>
#include <helpid.hrc>
#include <moduldlg.hxx>
#include <svtools/texteng.hxx>
#include <svtools/textview.hxx>
......@@ -251,6 +253,22 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
}
}
break;
case SID_GOTOLINE:
{
if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) )
{
std::auto_ptr< GotoLineDialog > xGotoDlg( new GotoLineDialog( pCurWin ) );
if ( xGotoDlg->Execute() )
{
rtl::OUString sText = xGotoDlg->GetText();
sal_Int32 nLine = xGotoDlg->GetLineNumber();
if ( nLine )
((ModulWindow*)pCurWin)->GetEditView()->SetSelection( TextSelection( TextPaM( nLine - 1 , 0 ), TextPaM( nLine - 1, 0 ) ) );
}
}
}
default:
{
pCurWin->ExecuteCommand( rReq );
......@@ -1017,6 +1035,18 @@ void BasicIDEShell::GetState(SfxItemSet &rSet)
rSet.DisableItem( nWh );
}
break;
case SID_GOTOLINE:
{
// 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));
}
break;
}
}
}
if ( pCurWin )
......
......@@ -615,6 +615,10 @@ String RID_STR_DLGIMP_MISMATCH_TEXT
Text [ en-US ] = "The dialog to be imported supports other languages than the target library.\n\nAdd these languages to the library to keep additional language resources provided by the dialog or omit them to stay with the current library languages.\n\nNote: For languages not supported by the dialog the resources of the dialog's default language will be used.\n " ;
};
String RID_STR_GETLINE
{
Text [ en-US ] = "Goto Line";
};
#define MN_EDIT 20
#define MN_VIEW 21
......
......@@ -439,6 +439,41 @@ NewObjectDialog::~NewObjectDialog()
{
}
//----------------------------------------------------------------------------
// GotoLineDialog
//----------------------------------------------------------------------------
GotoLineDialog::GotoLineDialog(Window * pParent )
: ModalDialog( pParent, IDEResId( RID_DLG_GOTOLINE ) ),
aText( this, IDEResId( RID_FT_LINE ) ),
aEdit( this, IDEResId( RID_ED_LINE ) ),
aOKButton( this, IDEResId( RID_PB_OK ) ),
aCancelButton( this, IDEResId( RID_PB_CANCEL ) )
{
FreeResource();
aEdit.GrabFocus();
SetText( String( IDEResId( RID_STR_GETLINE ) ) );
aOKButton.SetClickHdl(LINK(this, GotoLineDialog, OkButtonHandler));
}
sal_Int32 GotoLineDialog::GetLineNumber()
{
return rtl::OUString( aEdit.GetText() ).toInt32();
}
IMPL_LINK(GotoLineDialog, OkButtonHandler, Button *, EMPTYARG)
{
if ( GetLineNumber() )
EndDialog(1);
else
aEdit.SetText( aEdit.GetText(), Selection(0, aEdit.GetText().Len() ));
return 0;
}
//----------------------------------------------------------------------------
// ExportDialog
//----------------------------------------------------------------------------
......
......@@ -70,6 +70,18 @@ public:
void SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );}
};
class GotoLineDialog : public ModalDialog
{
FixedText aText;
Edit aEdit;
OKButton aOKButton;
CancelButton aCancelButton;
DECL_LINK(OkButtonHandler, Button *);
public:
GotoLineDialog( Window * pParent );
sal_Int32 GetLineNumber();
};
class ExportDialog : public ModalDialog
{
private:
......
......@@ -331,6 +331,44 @@ ModalDialog RID_DLG_LIBS
Text [ en-US ] = "Replace existing libraries" ;
};
};
ModalDialog RID_DLG_GOTOLINE
{
HelpID = "basctl:ModalDialog:RID_DLG_GOTOLINE";
OutputSize = TRUE ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 160 , 55 ) ;
Moveable = TRUE ;
Closeable = TRUE ;
OKButton RID_PB_OK
{
Pos = MAP_APPFONT ( 104 , 6 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
DefButton = TRUE ;
};
CancelButton RID_PB_CANCEL
{
Pos = MAP_APPFONT ( 104 , 23 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
TabStop = TRUE ;
};
FixedText RID_FT_LINE
{
Pos = MAP_APPFONT ( 6 , 6 ) ;
Size = MAP_APPFONT ( 96 , 10 ) ;
Text [ en-US ] = "~Line Number:" ;
};
Edit RID_ED_LINE
{
HelpID = "basctl:Edit:RID_DLG_GOTOLINE:RID_ED_LINE";
Border = TRUE ;
Pos = MAP_APPFONT ( 6 , 19 ) ;
Size = MAP_APPFONT ( 62 , 12 ) ;
TabStop = TRUE ;
};
};
ModalDialog RID_DLG_NEWLIB
{
HelpID = "basctl:ModalDialog:RID_DLG_NEWLIB";
......
......@@ -48,6 +48,7 @@
<menu:menuitem menu:id=".uno:AvailableToolbars"/>
<menu:menuitem menu:id=".uno:StatusBarVisible"/>
<menu:menuitem menu:id=".uno:ShowImeStatusWindow"/>
<menu:menuitem menu:id=".uno:GotoLine"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:FullScreen"/>
</menu:menupopup>
......
......@@ -198,6 +198,11 @@
<value xml:lang="en-US">.uno:ToggleBreakPointEnabled</value>
</prop>
</node>
<node oor:name="L_MOD1" oor:op="replace">
<prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="en-US">.uno:GotoLine</value>
</prop>
</node>
</node>
<node oor:name="com.sun.star.frame.StartModule" oor:op="replace">
<node oor:name="A_MOD1" oor:op="replace">
......
......@@ -3,6 +3,11 @@
<oor:component-data oor:name="BasicIDECommands" oor:package="org.openoffice.Office.UI" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="UserInterface">
<node oor:name="Commands">
<node oor:name=".uno:GotoLine" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Goto Line Number...</value>
</prop>
</node>
</node>
<node oor:name="Popups">
</node>
......
......@@ -314,7 +314,8 @@
#define SID_SUGGESTEDSAVEASNAME (SID_SFX_START + 1721)
#define SID_ENCRYPTIONDATA (SID_SFX_START + 1722)
#define SID_PASSWORDINTERACTION (SID_SFX_START + 1723)
#define SID_SFX_free_START (SID_SFX_START + 1724)
#define SID_GOTOLINE (SID_SFX_START + 1724)
#define SID_SFX_free_START (SID_SFX_START + 1725)
#define SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)
......
......@@ -3619,6 +3619,30 @@ SfxVoidItem RunMacro SID_RUNMACRO
GroupId = GID_MACRO;
]
SfxVoidItem GotoLine SID_GOTOLINE
[
/* 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 MacroDialog SID_BASICCHOOSER
()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment