diff options
author | Noel Power <noel.power@novell.com> | 2011-11-16 14:53:38 +0000 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2011-11-16 14:54:21 +0000 |
commit | 73d3c9504a479e62126d1e7a1766173370603aa1 (patch) | |
tree | 4018908cd6a4a5e84b25c84867f1ba579a589f61 /basctl | |
parent | Move cursor to the right of brace when the closing brace is typed. (diff) | |
download | core-73d3c9504a479e62126d1e7a1766173370603aa1.tar.gz core-73d3c9504a479e62126d1e7a1766173370603aa1.zip |
add new 'Goto Line' menu item to Basic IDE
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/inc/basidesh.hrc | 6 | ||||
-rw-r--r-- | basctl/sdi/baside.sdi | 6 | ||||
-rw-r--r-- | basctl/source/basicide/basides1.cxx | 30 | ||||
-rw-r--r-- | basctl/source/basicide/basidesh.src | 4 | ||||
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 35 | ||||
-rw-r--r-- | basctl/source/basicide/moduldlg.hxx | 12 | ||||
-rw-r--r-- | basctl/source/basicide/moduldlg.src | 38 | ||||
-rw-r--r-- | basctl/uiconfig/basicide/menubar/menubar.xml | 1 |
8 files changed, 132 insertions, 0 deletions
diff --git a/basctl/inc/basidesh.hrc b/basctl/inc/basidesh.hrc index f3a1e641b8bb..9e5ccb2b9398 100644 --- a/basctl/inc/basidesh.hrc +++ b/basctl/inc/basidesh.hrc @@ -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 diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index f40e239b01bf..37b2f08daf37 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -116,6 +116,12 @@ shell BasicIDEShell StateMethod = GetState; ] + SID_GOTOLINE + [ + ExecMethod = ExecuteCurrent; + StateMethod = GetState; + ] + FID_SEARCH_NOW [ ExecMethod = ExecuteCurrent; diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 6a5cd1332c10..234fad7fe7d2 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -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 ) diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src index 368bad4244de..c0ca7b413877 100644 --- a/basctl/source/basicide/basidesh.src +++ b/basctl/source/basicide/basidesh.src @@ -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 diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 81413a838282..0e5b380bbf9c 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -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 //---------------------------------------------------------------------------- diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index b75e88a53d31..f61f64c60534 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -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: diff --git a/basctl/source/basicide/moduldlg.src b/basctl/source/basicide/moduldlg.src index e2e6690581bc..fa80b0f8c44f 100644 --- a/basctl/source/basicide/moduldlg.src +++ b/basctl/source/basicide/moduldlg.src @@ -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"; diff --git a/basctl/uiconfig/basicide/menubar/menubar.xml b/basctl/uiconfig/basicide/menubar/menubar.xml index 4583ca294dc0..d9174bf9218c 100644 --- a/basctl/uiconfig/basicide/menubar/menubar.xml +++ b/basctl/uiconfig/basicide/menubar/menubar.xml @@ -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> |