diff options
95 files changed, 2302 insertions, 2205 deletions
diff --git a/basctl/inc/iderdll.hxx b/basctl/inc/iderdll.hxx index 2c9f40155008..a0e2765a1dde 100644 --- a/basctl/inc/iderdll.hxx +++ b/basctl/inc/iderdll.hxx @@ -17,23 +17,25 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _IDERDLL_HXX -#define _IDERDLL_HXX +#ifndef BASCTL_IDERDLL_HXX +#define BASCTL_IDERDLL_HXX -class BasicIDEShell; -class BasicIDEData; - -namespace BasicIDEGlobals +namespace basctl { - void ensure(); - void ShellCreated(BasicIDEShell* pShell); - BasicIDEShell* GetShell(); - void ShellDestroyed(BasicIDEShell* pShell); +class Shell; +class ExtraData; + +void EnsureIde (); + +void ShellCreated (Shell* pShell); +Shell* GetShell(); +void ShellDestroyed (Shell* pShell); + +ExtraData* GetExtraData(); - BasicIDEData* GetExtraData(); -} +} // namespace basctl -#endif //_IDERDLL_HXX +#endif // BASCTL_IDERDLL_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/sdi/baside.sdi b/basctl/sdi/baside.sdi index d4618921cda2..5582c1d343d5 100644 --- a/basctl/sdi/baside.sdi +++ b/basctl/sdi/baside.sdi @@ -23,7 +23,7 @@ interface BasicIDEView { } -shell BasicIDEShell +shell basctl_Shell { import BasicIDEView [Automation]; @@ -512,7 +512,7 @@ interface BasicIDEDocument { } -shell BasicDocShell +shell basctl_DocShell { import BasicIDEDocument [Automation]; } diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index ccfd4af7247b..4b58550e92d0 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -33,6 +33,9 @@ #include <toolkit/helper/vclunohelper.hxx> #include <vcl/svapp.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -45,7 +48,7 @@ using namespace ::comphelper; // class AccessibleDialogControlShape // ----------------------------------------------------------------------------- -AccessibleDialogControlShape::AccessibleDialogControlShape (basctl::DialogWindow* pDialogWindow, DlgEdObj* pDlgEdObj) +AccessibleDialogControlShape::AccessibleDialogControlShape (DialogWindow* pDialogWindow, DlgEdObj* pDlgEdObj) :AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ) ,m_pDialogWindow( pDialogWindow ) ,m_pDlgEdObj( pDlgEdObj ) @@ -607,4 +610,6 @@ Reference< awt::XFont > AccessibleDialogControlShape::getFont( ) throw (Runtime // ----------------------------------------------------------------------------- +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index a36c5b2b221e..c9b19717bf3e 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -36,6 +36,9 @@ #include <toolkit/helper/convert.hxx> #include <vcl/svapp.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -538,26 +541,26 @@ void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint ) } else if (DlgEdHint const* pDlgEdHint = dynamic_cast<DlgEdHint const*>(&rHint)) { - switch ( pDlgEdHint->GetKind() ) + switch (pDlgEdHint->GetKind()) { - case DLGED_HINT_WINDOWSCROLLED: + case DlgEdHint::WINDOWSCROLLED: { UpdateChildren(); UpdateBounds(); } break; - case DLGED_HINT_LAYERCHANGED: + case DlgEdHint::LAYERCHANGED: { if (DlgEdObj* pDlgEdObj = pDlgEdHint->GetObject()) UpdateChild( ChildDescriptor( pDlgEdObj ) ); } break; - case DLGED_HINT_OBJORDERCHANGED: + case DlgEdHint::OBJORDERCHANGED: { SortChildren(); } break; - case DLGED_HINT_SELECTIONCHANGED: + case DlgEdHint::SELECTIONCHANGED: { UpdateFocused(); UpdateSelected(); @@ -1093,4 +1096,6 @@ void AccessibleDialogWindow::deselectAccessibleChild( sal_Int32 nChildIndex ) th // ----------------------------------------------------------------------------- +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx index 75f3c6edebfd..67f358c13599 100644 --- a/basctl/source/basicide/basdoc.cxx +++ b/basctl/source/basicide/basdoc.cxx @@ -27,22 +27,25 @@ #include "unomodel.hxx" #include <basdoc.hxx> -#define BasicDocShell // This CANNOT come before basdoc apparently +#define basctl_DocShell // This CANNOT come before basdoc apparently #include <basslots.hxx> #include <sfx2/sfxmodelfactory.hxx> #include <svx/svxids.hrc> -TYPEINIT1(BasicDocShell, SfxObjectShell); -DBG_NAME(BasicDocShell); +namespace basctl +{ + +TYPEINIT1(DocShell, SfxObjectShell); +DBG_NAME(DocShell); -SFX_IMPL_OBJECTFACTORY( BasicDocShell, SvGlobalName(), SFXOBJECTSHELL_STD_NORMAL, "sbasic" ) +SFX_IMPL_OBJECTFACTORY( DocShell, SvGlobalName(), SFXOBJECTSHELL_STD_NORMAL, "sbasic" ) -SFX_IMPL_INTERFACE( BasicDocShell, SfxObjectShell, IDEResId( 0 ) ) +SFX_IMPL_INTERFACE( basctl_DocShell, SfxObjectShell, IDEResId( 0 ) ) { SFX_STATUSBAR_REGISTRATION( IDEResId( SID_BASICIDE_STATUSBAR ) ); } -BasicDocShell::BasicDocShell() +DocShell::DocShell() :SfxObjectShell( SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) { pPrinter = 0; @@ -50,12 +53,12 @@ BasicDocShell::BasicDocShell() SetBaseModel( new SIDEModel(this) ); } -BasicDocShell::~BasicDocShell() +DocShell::~DocShell() { delete pPrinter; } -SfxPrinter* BasicDocShell::GetPrinter( bool bCreate ) +SfxPrinter* DocShell::GetPrinter( bool bCreate ) { if ( !pPrinter && bCreate ) pPrinter = new SfxPrinter( new SfxItemSet( GetPool(), SID_PRINTER_NOTFOUND_WARN , SID_PRINTER_NOTFOUND_WARN ) ); @@ -63,7 +66,7 @@ SfxPrinter* BasicDocShell::GetPrinter( bool bCreate ) return pPrinter; } -void BasicDocShell::SetPrinter( SfxPrinter* pPr ) +void DocShell::SetPrinter( SfxPrinter* pPr ) { if ( pPr != pPrinter ) { @@ -72,13 +75,15 @@ void BasicDocShell::SetPrinter( SfxPrinter* pPr ) } } -void BasicDocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, String*, sal_Int32, sal_Bool bTemplate) const +void DocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, String*, sal_Int32, sal_Bool bTemplate) const { (void)bTemplate; DBG_ASSERT( !bTemplate, "No template for Basic" ); } -void BasicDocShell::Draw( OutputDevice *, const JobSetup &, sal_uInt16 ) +void DocShell::Draw( OutputDevice *, const JobSetup &, sal_uInt16 ) {} +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx index 0c72add19d5e..8a302d7b9c29 100644 --- a/basctl/source/basicide/basdoc.hxx +++ b/basctl/source/basicide/basdoc.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASDOC_HXX -#define _BASDOC_HXX +#ifndef BASCTL_BASDOC_HXX +#define BASCTL_BASDOC_HXX #include <iderid.hxx> #include <sfx2/docfac.hxx> @@ -27,7 +27,10 @@ class SfxPrinter; -class BasicDocShell: public SfxObjectShell +namespace basctl +{ + +class DocShell: public SfxObjectShell { SfxPrinter* pPrinter; @@ -48,13 +51,19 @@ public: using SotObject::GetInterface; SFX_DECL_OBJECTFACTORY(); SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_DOCSH ) - BasicDocShell(); - ~BasicDocShell(); + DocShell(); + ~DocShell(); SfxPrinter* GetPrinter( bool bCreate ); void SetPrinter( SfxPrinter* pPrinter ); }; -#endif // _BASDOC_HXX +} // namespace basctl + +// This typedef helps baside.sdi, +// because I don't know how to use nested names in it. +typedef basctl::DocShell basctl_DocShell; + +#endif // BASCTL_BASDOC_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx index 34158fcfadd7..2cc65d197c39 100644 --- a/basctl/source/basicide/basicbox.cxx +++ b/basctl/source/basicide/basicbox.cxx @@ -37,6 +37,9 @@ #include <sfx2/dispatch.hxx> #include <svtools/langtab.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; @@ -58,7 +61,7 @@ LibBoxControl::~LibBoxControl() void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState ) { - BasicLibBox* pBox = (BasicLibBox*) GetToolBox().GetItemWindow( GetId() ); + LibBox* pBox = (LibBox*)GetToolBox().GetItemWindow(GetId()); DBG_ASSERT( pBox, "Box not found" ); if ( !pBox ) @@ -77,7 +80,7 @@ void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPool Window* LibBoxControl::CreateItemWindow( Window *pParent ) { - return new BasicLibBox( pParent, m_xFrame ); + return new LibBox( pParent, m_xFrame ); } //============================================================================= @@ -141,9 +144,9 @@ void DocListenerBox::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ } //============================================================================= -//= BasicLibBox +//= basctl::LibBox //============================================================================= -BasicLibBox::BasicLibBox( Window* pParent, const uno::Reference< frame::XFrame >& rFrame ) : +LibBox::LibBox( Window* pParent, const uno::Reference< frame::XFrame >& rFrame ) : DocListenerBox( pParent ), m_xFrame( rFrame ) { @@ -158,12 +161,12 @@ BasicLibBox::BasicLibBox( Window* pParent, const uno::Reference< frame::XFrame > -BasicLibBox::~BasicLibBox() +LibBox::~LibBox() { ClearBox(); } -void BasicLibBox::Update( const SfxStringItem* pItem ) +void LibBox::Update( const SfxStringItem* pItem ) { // if ( !pItem || !pItem->GetValue().Len() ) @@ -180,7 +183,7 @@ void BasicLibBox::Update( const SfxStringItem* pItem ) SelectEntry( aCurText ); } -void BasicLibBox::ReleaseFocus() +void LibBox::ReleaseFocus() { SfxViewShell* pCurSh = SfxViewShell::Current(); DBG_ASSERT( pCurSh, "Current ViewShell not found!" ); @@ -195,7 +198,7 @@ void BasicLibBox::ReleaseFocus() } } -void BasicLibBox::FillBox() +void LibBox::FillBox() { SetUpdateMode(false); bIgnoreSelect = true; @@ -207,7 +210,7 @@ void BasicLibBox::FillBox() // create list box entries sal_uInt16 nPos = InsertEntry( String( IDEResId( RID_STR_ALL ) ), LISTBOX_APPEND ); - SetEntryData( nPos, new BasicLibEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_UNKNOWN, String() ) ); + SetEntryData( nPos, new LibEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_UNKNOWN, String() ) ); InsertEntries( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER ); InsertEntries( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE ); @@ -231,7 +234,7 @@ void BasicLibBox::FillBox() bIgnoreSelect = false; } -void BasicLibBox::InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation ) +void LibBox::InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation ) { // get a sorted list of library names Sequence< ::rtl::OUString > aLibNames = rDocument.getLibraryNames(); @@ -246,12 +249,12 @@ void BasicLibBox::InsertEntries( const ScriptDocument& rDocument, LibraryLocatio String aName( rDocument.getTitle( eLocation ) ); String aEntryText( CreateMgrAndLibStr( aName, aLibName ) ); sal_uInt16 nPos = InsertEntry( aEntryText, LISTBOX_APPEND ); - SetEntryData( nPos, new BasicLibEntry( rDocument, eLocation, aLibName ) ); + SetEntryData( nPos, new LibEntry( rDocument, eLocation, aLibName ) ); } } } -long BasicLibBox::PreNotify( NotifyEvent& rNEvt ) +long LibBox::PreNotify( NotifyEvent& rNEvt ) { long nDone = 0; if( rNEvt.GetType() == EVENT_KEYINPUT ) @@ -296,7 +299,7 @@ long BasicLibBox::PreNotify( NotifyEvent& rNEvt ) return nDone ? nDone : ListBox::PreNotify( rNEvt ); } -void BasicLibBox::Select() +void LibBox::Select() { if ( !IsTravelSelect() ) { @@ -307,34 +310,30 @@ void BasicLibBox::Select() } } -void BasicLibBox::NotifyIDE() +void LibBox::NotifyIDE() { sal_uInt16 nSelPos = GetSelectEntryPos(); - BasicLibEntry* pEntry = static_cast<BasicLibEntry*>(GetEntryData( nSelPos )); - if ( pEntry ) + if (LibEntry* pEntry = static_cast<LibEntry*>(GetEntryData(nSelPos))) { ScriptDocument aDocument( pEntry->GetDocument() ); SfxUsrAnyItem aDocumentItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, uno::makeAny( aDocument.getDocumentOrNull() ) ); String aLibName = pEntry->GetLibName(); SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_LIBSELECTED, - SFX_CALLMODE_SYNCHRON, &aDocumentItem, &aLibNameItem, 0L ); - } + if (SfxDispatcher* pDispatcher = GetDispatcher()) + pDispatcher->Execute( + SID_BASICIDE_LIBSELECTED, + SFX_CALLMODE_SYNCHRON, &aDocumentItem, &aLibNameItem, 0L + ); } ReleaseFocus(); } -void BasicLibBox::ClearBox() +void LibBox::ClearBox() { sal_uInt16 nCount = GetEntryCount(); for ( sal_uInt16 i = 0; i < nCount; ++i ) { - BasicLibEntry* pEntry = static_cast<BasicLibEntry*>(GetEntryData( i )); + LibEntry* pEntry = static_cast<LibEntry*>(GetEntryData( i )); delete pEntry; } ListBox::Clear(); @@ -356,7 +355,7 @@ LanguageBoxControl::~LanguageBoxControl() void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, const SfxPoolItem* pItem ) { (void)nID; - if (BasicLanguageBox* pBox = static_cast<BasicLanguageBox*>(GetToolBox().GetItemWindow(GetId()))) + if (LanguageBox* pBox = static_cast<LanguageBox*>(GetToolBox().GetItemWindow(GetId()))) { if (eState != SFX_ITEM_AVAILABLE) pBox->Disable(); @@ -370,12 +369,12 @@ void LanguageBoxControl::StateChanged( sal_uInt16 nID, SfxItemState eState, cons Window* LanguageBoxControl::CreateItemWindow( Window *pParent ) { - return new BasicLanguageBox( pParent ); + return new LanguageBox( pParent ); } -// class BasicLanguageBox ------------------------------------------------ +// class basctl::LanguageBox ----------------------------------------------- -BasicLanguageBox::BasicLanguageBox( Window* pParent ) : +LanguageBox::LanguageBox( Window* pParent ) : DocListenerBox( pParent ), @@ -390,19 +389,19 @@ BasicLanguageBox::BasicLanguageBox( Window* pParent ) : FillBox(); } -BasicLanguageBox::~BasicLanguageBox() +LanguageBox::~LanguageBox() { ClearBox(); } -void BasicLanguageBox::FillBox() +void LanguageBox::FillBox() { SetUpdateMode(false); m_bIgnoreSelect = true; m_sCurrentText = GetSelectEntry(); ClearBox(); - boost::shared_ptr<LocalizationMgr> pCurMgr(BasicIDEGlobals::GetShell()->GetCurLocalizationMgr()); + boost::shared_ptr<LocalizationMgr> pCurMgr(GetShell()->GetCurLocalizationMgr()); if ( pCurMgr->isLibraryLocalized() ) { Enable(); @@ -448,7 +447,7 @@ void BasicLanguageBox::FillBox() m_bIgnoreSelect = false; } -void BasicLanguageBox::ClearBox() +void LanguageBox::ClearBox() { sal_uInt16 nCount = GetEntryCount(); for ( sal_uInt16 i = 0; i < nCount; ++i ) @@ -459,14 +458,14 @@ void BasicLanguageBox::ClearBox() ListBox::Clear(); } -void BasicLanguageBox::SetLanguage() +void LanguageBox::SetLanguage() { LanguageEntry* pEntry = (LanguageEntry*)GetEntryData( GetSelectEntryPos() ); if ( pEntry ) - BasicIDEGlobals::GetShell()->GetCurLocalizationMgr()->handleSetCurrentLocale( pEntry->m_aLocale ); + GetShell()->GetCurLocalizationMgr()->handleSetCurrentLocale( pEntry->m_aLocale ); } -void BasicLanguageBox::Select() +void LanguageBox::Select() { if ( !m_bIgnoreSelect ) SetLanguage(); @@ -474,7 +473,7 @@ void BasicLanguageBox::Select() SelectEntry( m_sCurrentText ); // Select after Escape } -long BasicLanguageBox::PreNotify( NotifyEvent& rNEvt ) +long LanguageBox::PreNotify( NotifyEvent& rNEvt ) { long nDone = 0; if( rNEvt.GetType() == EVENT_KEYINPUT ) @@ -507,7 +506,7 @@ long BasicLanguageBox::PreNotify( NotifyEvent& rNEvt ) return nDone ? nDone : ListBox::PreNotify( rNEvt ); } -void BasicLanguageBox::Update( const SfxStringItem* pItem ) +void LanguageBox::Update( const SfxStringItem* pItem ) { FillBox(); @@ -519,4 +518,7 @@ void BasicLanguageBox::Update( const SfxStringItem* pItem ) } } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx index ce55433ff865..a19ec43e65cd 100644 --- a/basctl/source/basicide/basicbox.hxx +++ b/basctl/source/basicide/basicbox.hxx @@ -16,9 +16,9 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -// -#ifndef _BASICBOX_HXX -#define _BASICBOX_HXX + +#ifndef BASCTL_BASICBOX_HXX +#define BASCTL_BASICBOX_HXX #include "doceventnotifier.hxx" #include <svl/stritem.hxx> @@ -26,6 +26,8 @@ #include <sfx2/tbxctrl.hxx> #include <vcl/lstbox.hxx> +namespace basctl +{ class LibBoxControl: public SfxToolBoxControl { @@ -44,7 +46,7 @@ public: of open documents */ class DocListenerBox :public ListBox - ,public ::basctl::DocumentEventListener + ,public DocumentEventListener { protected: DocListenerBox( Window* pParent ); @@ -66,12 +68,12 @@ private: virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ); private: - ::basctl::DocumentEventNotifier m_aNotifier; + DocumentEventNotifier m_aNotifier; }; // -class BasicLibBox : public DocListenerBox +class LibBox : public DocListenerBox { private: String aCurText; @@ -93,9 +95,9 @@ protected: virtual long PreNotify( NotifyEvent& rNEvt ); public: - BasicLibBox( Window* pParent, + LibBox( Window* pParent, const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); - ~BasicLibBox(); + ~LibBox(); using Window::Update; void Update( const SfxStringItem* pItem ); @@ -113,7 +115,7 @@ public: virtual Window* CreateItemWindow( Window *pParent ); }; -class BasicLanguageBox : public DocListenerBox +class LanguageBox : public DocListenerBox { private: String m_sNotLocalizedStr; @@ -133,13 +135,15 @@ protected: virtual long PreNotify( NotifyEvent& rNEvt ); public: - BasicLanguageBox( Window* pParent ); - ~BasicLanguageBox(); + LanguageBox( Window* pParent ); + ~LanguageBox(); using Window::Update; void Update( const SfxStringItem* pItem ); }; -#endif // _BASICBOX_HXX +} // namespace basctl + +#endif // BASCTL_BASICBOX_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicmod.hxx b/basctl/source/basicide/basicmod.hxx index 070829e43d16..8cb661304468 100644 --- a/basctl/source/basicide/basicmod.hxx +++ b/basctl/source/basicide/basicmod.hxx @@ -18,23 +18,27 @@ */ -#ifndef BASICMOD_HXX -#define BASICMOD_HXX +#ifndef BASCTL_BASICMOD_HXX +#define BASCTL_BASICMOD_HXX #include <sfx2/module.hxx> #include <tools/shl.hxx> -class BasicIDEModule : public SfxModule +namespace basctl +{ + +class Module : public SfxModule { public: - BasicIDEModule( ResMgr *pMgr, SfxObjectFactory *pObjFact) : - SfxModule( pMgr, false, pObjFact, NULL ) - {} + Module ( ResMgr *pMgr, SfxObjectFactory *pObjFact) : + SfxModule( pMgr, false, pObjFact, NULL ) + { } +public: + static Module*& Get () { return *reinterpret_cast<Module**>(GetAppData(SHL_IDE)); } }; +} // namespace basctl -#define BASIC_MOD() ( *(BasicIDEModule**) GetAppData(SHL_IDE) ) - -#endif +#endif // BASCTL_BASICMOD_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx index 9d58d71db6e2..8aafe05d423a 100644 --- a/basctl/source/basicide/basicrenderable.cxx +++ b/basctl/source/basicide/basicrenderable.cxx @@ -27,11 +27,13 @@ #include "tools/multisel.hxx" #include "tools/resary.hxx" +namespace basctl +{ + using namespace com::sun::star; using namespace com::sun::star::uno; -using namespace basicide; -BasicRenderable::BasicRenderable( IDEBaseWindow* pWin ) +Renderable::Renderable (BaseWindow* pWin) : cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >( maMutex ) , mpWindow( pWin ) { @@ -75,11 +77,11 @@ BasicRenderable::BasicRenderable( IDEBaseWindow* pWin ) ); } -BasicRenderable::~BasicRenderable() +Renderable::~Renderable() { } -Printer* BasicRenderable::getPrinter() +Printer* Renderable::getPrinter() { Printer* pPrinter = NULL; Any aValue( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) ); @@ -94,7 +96,7 @@ Printer* BasicRenderable::getPrinter() return pPrinter; } -sal_Int32 SAL_CALL BasicRenderable::getRendererCount ( +sal_Int32 SAL_CALL Renderable::getRendererCount ( const Any&, const Sequence<beans::PropertyValue >& i_xOptions ) throw (lang::IllegalArgumentException, RuntimeException) { @@ -103,8 +105,7 @@ sal_Int32 SAL_CALL BasicRenderable::getRendererCount ( sal_Int32 nCount = 0; if( mpWindow ) { - Printer* pPrinter = getPrinter(); - if( pPrinter ) + if (Printer* pPrinter = getPrinter()) { nCount = mpWindow->countPages( pPrinter ); sal_Int64 nContent = getIntValue( "PrintContent", -1 ); @@ -127,7 +128,7 @@ sal_Int32 SAL_CALL BasicRenderable::getRendererCount ( return nCount; } -Sequence<beans::PropertyValue> SAL_CALL BasicRenderable::getRenderer ( +Sequence<beans::PropertyValue> SAL_CALL Renderable::getRenderer ( sal_Int32, const Any&, const Sequence<beans::PropertyValue>& i_xOptions ) throw (lang::IllegalArgumentException, RuntimeException) { @@ -154,7 +155,7 @@ Sequence<beans::PropertyValue> SAL_CALL BasicRenderable::getRenderer ( return aVals; } -void SAL_CALL BasicRenderable::render ( +void SAL_CALL Renderable::render ( sal_Int32 nRenderer, const Any&, const Sequence<beans::PropertyValue>& i_xOptions ) throw (lang::IllegalArgumentException, RuntimeException) @@ -163,8 +164,7 @@ void SAL_CALL BasicRenderable::render ( if( mpWindow ) { - Printer* pPrinter = getPrinter(); - if( pPrinter ) + if (Printer* pPrinter = getPrinter()) { sal_Int64 nContent = getIntValue( "PrintContent", -1 ); if( nContent == 1 ) @@ -192,5 +192,6 @@ void SAL_CALL BasicRenderable::render ( } } +} // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basicrenderable.hxx b/basctl/source/basicide/basicrenderable.hxx index b9bc99902447..b53c92763057 100644 --- a/basctl/source/basicide/basicrenderable.hxx +++ b/basctl/source/basicide/basicrenderable.hxx @@ -16,29 +16,30 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASICRENDERABLE_HXX -#define _BASICRENDERABLE_HXX +#ifndef BASCTL_BASICRENDERABLE_HXX +#define BASCTL_BASICRENDERABLE_HXX #include "com/sun/star/view/XRenderable.hpp" #include "cppuhelper/compbase1.hxx" #include "vcl/print.hxx" -class IDEBaseWindow; - -namespace basicide +namespace basctl { -class BasicRenderable : - public cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >, - public vcl::PrinterOptionsHelper + +class BaseWindow; + +class Renderable : + public cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >, + public vcl::PrinterOptionsHelper { - IDEBaseWindow* mpWindow; + BaseWindow* mpWindow; osl::Mutex maMutex; Printer* getPrinter(); public: - BasicRenderable( IDEBaseWindow* pWin ); - virtual ~BasicRenderable(); + Renderable (BaseWindow*); + virtual ~Renderable(); // XRenderable virtual sal_Int32 SAL_CALL getRendererCount ( @@ -60,8 +61,8 @@ public: }; -} // namespace +} // namespace basctl -#endif +#endif // BASCTL_BASICRENDERABLE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 2475ef68d2a9..d0726d474341 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -77,7 +77,7 @@ using namespace comphelper; DBG_NAME( ModulWindow ) -TYPEINIT1( ModulWindow , IDEBaseWindow ); +TYPEINIT1( ModulWindow , BaseWindow ); namespace { @@ -185,7 +185,7 @@ ModulWindow::ModulWindow ( ScriptDocument const& rDocument, rtl::OUString aLibName, rtl::OUString aName, rtl::OUString& aModule ) : - IDEBaseWindow(pParent, rDocument, aLibName, aName), + BaseWindow(pParent, rDocument, aLibName, aName), rLayout(*pParent), nValid(VALIDWINDOW), aXEditorWindow(this), @@ -280,8 +280,7 @@ void ModulWindow::CheckCompileBasic() { bool bDone = false; - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - pIDEShell->GetViewFrame()->GetWindow().EnterWait(); + GetShell()->GetViewFrame()->GetWindow().EnterWait(); if( bModified ) { @@ -300,7 +299,7 @@ void ModulWindow::CheckCompileBasic() GetBreakPoints().SetBreakPointsInBasic( xModule ); } - pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); + GetShell()->GetViewFrame()->GetWindow().LeaveWait(); aStatus.bError = !bDone; aStatus.bIsRunning = false; @@ -355,13 +354,13 @@ bool ModulWindow::BasicExecute() if ( !pMethod ) { // If not in a method then prompt the user - return ( !BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), false, rtl::OUString() ).isEmpty() ); + return ( !ChooseMacro( uno::Reference< frame::XModel >(), false, rtl::OUString() ).isEmpty() ); } if ( pMethod ) { pMethod->SetDebugFlags( aStatus.nBasicFlags ); BasicDLL::SetDebugMode( true ); - BasicIDE::RunMethod( pMethod ); + RunMethod( pMethod ); BasicDLL::SetDebugMode( false ); // if cancelled during Interactive=false BasicDLL::EnableBreak( true ); @@ -536,13 +535,8 @@ bool ModulWindow::SaveBasicSource() return bDone; } -} // namespace basctl - bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName ); -namespace basctl -{ - bool ModulWindow::ImportDialog() { const ScriptDocument& rDocument = GetDocument(); @@ -746,7 +740,7 @@ long ModulWindow::BasicBreakHdl( StarBASIC* pBasic ) AddStatus( BASWIN_INRESCHEDULE ); - BasicIDE::InvalidateDebuggerSlots(); + InvalidateDebuggerSlots(); while( aStatus.bIsRunning ) Application::Yield(); @@ -872,7 +866,7 @@ void ModulWindow::UpdateData() setTextEngineText( GetEditEngine(), xModule->GetSource32() ); GetEditView()->SetSelection( aSel ); GetEditEngine()->SetModified( false ); - BasicIDE::MarkDocumentModified( GetDocument() ); + MarkDocumentModified( GetDocument() ); } } } @@ -1046,7 +1040,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) if ( !IsReadOnly() ) { GetEditView()->Cut(); - if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr()) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } } @@ -1061,7 +1055,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) if ( !IsReadOnly() ) { GetEditView()->Paste(); - if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr()) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } } @@ -1082,7 +1076,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq) { if (QueryDelModule(m_aName, this)) if (m_aDocument.removeModule(m_aLibName, m_aName)) - BasicIDE::MarkDocumentModified(m_aDocument); + MarkDocumentModified(m_aDocument); } break; case FID_SEARCH_OFF: @@ -1108,11 +1102,11 @@ void ModulWindow::ExecuteGlobal (SfxRequest& rReq) { case SID_SIGNATURE: { - basctl::DocumentSignature aSignature(m_aDocument); + DocumentSignature aSignature(m_aDocument); if (aSignature.supportsSignatures()) { aSignature.signScriptingContent(); - if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr()) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate(SID_SIGNATURE); } } @@ -1216,7 +1210,7 @@ bool ModulWindow::IsModified() void ModulWindow::GoOnTop() { - BasicIDEGlobals::GetShell()->GetViewFrame()->ToTop(); + GetShell()->GetViewFrame()->ToTop(); } ::rtl::OUString ModulWindow::GetSbModuleName() @@ -1366,7 +1360,7 @@ void ModulWindow::BasicStopped() GetBreakPointWindow().SetMarkerPos( MARKER_NOMARKER ); } -BasicEntryDescriptor ModulWindow::CreateEntryDescriptor() +EntryDescriptor ModulWindow::CreateEntryDescriptor() { ScriptDocument aDocument( GetDocument() ); String aLibName( GetLibName() ); @@ -1403,7 +1397,7 @@ BasicEntryDescriptor ModulWindow::CreateEntryDescriptor() break; } } - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE ); + return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE ); } void ModulWindow::SetReadOnly (bool b) @@ -1450,9 +1444,9 @@ char const* ModulWindow::GetHid () const { return HID_BASICIDE_MODULWINDOW; } -BasicIDEType ModulWindow::GetType () const +ItemType ModulWindow::GetType () const { - return BASICIDE_TYPE_MODULE; + return TYPE_MODULE; } bool ModulWindow::HasActiveEditor () const @@ -1475,7 +1469,7 @@ void ModulWindow::UpdateModule () OSL_VERIFY(m_aDocument.updateModule(m_aLibName, m_aName, aModule)); GetEditEngine()->SetModified(false); - BasicIDE::MarkDocumentModified(m_aDocument); + MarkDocumentModified(m_aDocument); } @@ -1512,7 +1506,7 @@ void ModulWindowLayout::DataChanged (DataChangedEvent const& rDCEvt) } -void ModulWindowLayout::Activating (IDEBaseWindow& rChild) +void ModulWindowLayout::Activating (BaseWindow& rChild) { assert(dynamic_cast<ModulWindow*>(&rChild)); pChild = &static_cast<ModulWindow&>(rChild); diff --git a/basctl/source/basicide/baside2.hrc b/basctl/source/basicide/baside2.hrc index 52942fb7fe1f..7c87e33aa212 100644 --- a/basctl/source/basicide/baside2.hrc +++ b/basctl/source/basicide/baside2.hrc @@ -15,8 +15,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASIDE2_HRC -#define _BASIDE2_HRC +#ifndef BASCTL_BASIDE2_HRC +#define BASCTL_BASIDE2_HRC #include <basidesh.hrc> @@ -38,4 +38,4 @@ #define IMGID_STEPMARKER ( SID_BASICIDE_IMAGESTART + 22 ) #define IMGID_ERRORMARKER ( SID_BASICIDE_IMAGESTART + 23 ) -#endif // _BASIDE2_HRC +#endif // BASCTL_BASIDE2_HRC diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index 0ad755c7692a..297ebd67e57a 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -229,7 +229,7 @@ public: -class WatchWindow : public BasicDockingWindow +class WatchWindow : public DockingWindow { private: String aWatchStr; @@ -260,7 +260,7 @@ public: }; -class StackWindow : public BasicDockingWindow +class StackWindow : public DockingWindow { private: SvTreeListBox aTreeListBox; @@ -304,7 +304,7 @@ public: }; -class ModulWindow: public IDEBaseWindow +class ModulWindow: public BaseWindow { private: ModulWindowLayout& rLayout; @@ -348,7 +348,7 @@ public: // print page virtual void printPage( sal_Int32 nPage, Printer* pPrinter ); virtual ::rtl::OUString GetTitle(); - virtual BasicEntryDescriptor CreateEntryDescriptor(); + virtual EntryDescriptor CreateEntryDescriptor(); virtual bool AllowUndo(); virtual void SetReadOnly (bool bReadOnly); virtual bool IsReadOnly(); @@ -418,7 +418,7 @@ public: virtual void OnNewDocument (); virtual char const* GetHid () const; - virtual BasicIDEType GetType () const; + virtual ItemType GetType () const; virtual bool HasActiveEditor () const; void UpdateModule (); @@ -430,7 +430,7 @@ public: ModulWindowLayout (Window* pParent, ObjectCatalog&); public: // Layout: - virtual void Activating (IDEBaseWindow&); + virtual void Activating (BaseWindow&); virtual void Deactivating (); virtual void GetState (SfxItemSet&, unsigned nWhich); virtual void UpdateDebug (bool bBasicStopped); diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index a784d4dba7c5..41e31c7e49c4 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -109,7 +109,10 @@ void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr ) pEngine->Read( aMemStream ); } -void lcl_DrawIDEWindowFrame( BasicDockingWindow* pWin ) +namespace +{ + +void lcl_DrawIDEWindowFrame( DockingWindow* pWin ) { if ( pWin->IsFloatingMode() ) return; @@ -157,6 +160,8 @@ void lcl_SeparateNameAndIndex( const String& rVName, String& rVar, String& rInde } } +} // namespace + // // EditorWindow @@ -397,8 +402,7 @@ void EditorWindow::MouseButtonUp( const MouseEvent &rEvt ) if ( pEditView ) { pEditView->MouseButtonUp( rEvt ); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_STAT_POS ); } } @@ -407,9 +411,7 @@ void EditorWindow::MouseButtonDown( const MouseEvent &rEvt ) { GrabFocus(); if ( pEditView ) - { pEditView->MouseButtonDown( rEvt ); - } } void EditorWindow::Command( const CommandEvent& rCEvt ) @@ -436,7 +438,7 @@ bool EditorWindow::ImpCanModify() if ( QueryBox( 0, WB_OK_CANCEL, String( IDEResId( RID_STR_WILLSTOPPRG ) ) ).Execute() == RET_OK ) { rModulWindow.GetBasicStatus().bIsRunning = false; - BasicIDE::StopBasic(); + StopBasic(); } else bCanModify = false; @@ -491,8 +493,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt ) } else { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_BASICIDE_STAT_POS ); if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR ) @@ -539,8 +540,6 @@ bool EditorWindow::SetSourceInBasic() return bChanged; } -} // namespace basctl - // Returns the position of the last character of any of the following // EOL char combinations: CR, CR/LF, LF, return -1 if no EOL is found sal_Int32 searchEOL( const ::rtl::OUString& rStr, sal_Int32 fromIndex ) @@ -559,10 +558,6 @@ sal_Int32 searchEOL( const ::rtl::OUString& rStr, sal_Int32 fromIndex ) return iRetPos; } - -namespace basctl -{ - void EditorWindow::CreateEditEngine() { if ( pEditEngine ) @@ -596,7 +591,11 @@ void EditorWindow::CreateEditEngine() // nLines*4: SetText+Formatting+DoHighlight+Formatting // it could be cut down on one formatting but you would wait even longer // for the text then if the source code is long... - pProgress = new ProgressInfo( BasicIDEGlobals::GetShell()->GetViewFrame()->GetObjectShell(), String( IDEResId( RID_STR_GENERATESOURCE ) ), nLines*4 ); + pProgress = new ProgressInfo( + GetShell()->GetViewFrame()->GetObjectShell(), + String(IDEResId(RID_STR_GENERATESOURCE)), + nLines*4 + ); setTextEngineText( pEditEngine, aOUSource ); pEditView->SetStartDocPos( Point( 0, 0 ) ); @@ -626,8 +625,7 @@ void EditorWindow::CreateEditEngine() InitScrollBars(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_STAT_POS ); DBG_ASSERT( rModulWindow.GetBreakPointWindow().GetCurYOffset() == 0, "CreateEditEngine: Brechpunkte verschoben?" ); @@ -931,7 +929,11 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, bool bInserted ) void EditorWindow::CreateProgress( const String& rText, sal_uLong nRange ) { DBG_ASSERT( !pProgress, "ProgressInfo existiert schon" ); - pProgress = new ProgressInfo( BasicIDEGlobals::GetShell()->GetViewFrame()->GetObjectShell(), rText, nRange ); + pProgress = new ProgressInfo( + GetShell()->GetViewFrame()->GetObjectShell(), + rText, + nRange + ); } void EditorWindow::DestroyProgress() @@ -1179,7 +1181,7 @@ namespace } WatchWindow::WatchWindow (Layout* pParent) : - BasicDockingWindow(pParent), + DockingWindow(pParent), aWatchStr( IDEResId( RID_STR_REMOVEWATCH ) ), aXEdit( this, IDEResId( RID_EDT_WATCHEDIT ) ), aRemoveWatchButton( this, IDEResId( RID_IMGBTN_REMOVEWATCH ) ), @@ -1430,16 +1432,9 @@ bool WatchWindow::RemoveSelectedWatch() IMPL_LINK_INLINE_START( WatchWindow, ButtonHdl, ImageButton *, pButton ) { - if ( pButton == &aRemoveWatchButton ) - { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { - pDispatcher->Execute( SID_BASICIDE_REMOVEWATCH ); - } - } + if (pButton == &aRemoveWatchButton) + if (SfxDispatcher* pDispatcher = GetDispatcher()) + pDispatcher->Execute(SID_BASICIDE_REMOVEWATCH); return 0; } IMPL_LINK_INLINE_END( WatchWindow, ButtonHdl, ImageButton *, pButton ) @@ -1528,7 +1523,7 @@ void WatchWindow::UpdateWatches( bool bBasicStopped ) // StackWindow::StackWindow (Layout* pParent) : - BasicDockingWindow(pParent), + DockingWindow(pParent), aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ), aStackStr( IDEResId( RID_STR_STACK ) ) { diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 951b5beffb17..6bfe6e4acc19 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -54,6 +54,9 @@ #include <vcl/msgbox.hxx> #include <xmlscript/xmldlg_imexp.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; @@ -61,9 +64,6 @@ using namespace ::com::sun::star::io; using namespace ::com::sun::star::resource; using namespace ::com::sun::star::ui::dialogs; -namespace basctl -{ - #if defined(UNX) #define FILTERMASK_ALL "*" #else @@ -72,7 +72,7 @@ namespace basctl DBG_NAME( DialogWindow ) -TYPEINIT1( DialogWindow, IDEBaseWindow ); +TYPEINIT1( DialogWindow, BaseWindow ); DialogWindow::DialogWindow ( DialogWindowLayout* pParent, @@ -80,7 +80,7 @@ DialogWindow::DialogWindow ( rtl::OUString aLibName, rtl::OUString aName, com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> const& xDialogModel ) : - IDEBaseWindow(pParent, rDocument, aLibName, aName), + BaseWindow(pParent, rDocument, aLibName, aName), rLayout(*pParent), pUndoMgr(0) { @@ -144,8 +144,7 @@ void DialogWindow::MouseButtonDown( const MouseEvent& rMEvt ) { pEditor->MouseButtonDown( rMEvt ); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER ); } @@ -154,14 +153,13 @@ void DialogWindow::MouseButtonDown( const MouseEvent& rMEvt ) void DialogWindow::MouseButtonUp( const MouseEvent& rMEvt ) { pEditor->MouseButtonUp( rMEvt ); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if( (pEditor->GetMode() == DLGED_INSERT) && !pEditor->IsCreateOK() ) + if( (pEditor->GetMode() == DlgEditor::INSERT) && !pEditor->IsCreateOK() ) { - pEditor->SetMode( DLGED_SELECT ); - if ( pBindings ) + pEditor->SetMode( DlgEditor::SELECT ); + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_CHOOSE_CONTROLS ); } - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER ); pBindings->Invalidate( SID_DOC_MODIFIED ); @@ -182,19 +180,14 @@ void DialogWindow::KeyInput( const KeyEvent& rKEvt ) { if( rKEvt.GetKeyCode() == KEY_BACKSPACE ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BACKSPACE ); - } } else { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if( pBindings && rKEvt.GetKeyCode() == KEY_TAB ) - pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER ); + if (rKEvt.GetKeyCode() == KEY_TAB) + if (SfxBindings* pBindings = GetBindingsPtr()) + pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER ); if( !pEditor->KeyInput( rKEvt ) ) { @@ -214,10 +207,7 @@ void DialogWindow::Command( const CommandEvent& rCEvt ) } else if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) + if (SfxDispatcher* pDispatcher = GetDispatcher()) { SdrView* pView = GetView(); if( !rCEvt.IsMouseEvent() && pView->AreObjectsMarked() ) @@ -235,7 +225,7 @@ void DialogWindow::Command( const CommandEvent& rCEvt ) } } else - IDEBaseWindow::Command( rCEvt ); + BaseWindow::Command( rCEvt ); } @@ -321,8 +311,8 @@ void DialogWindow::GetState( SfxItemSet& rSet ) case SID_DIALOG_TESTMODE: { // is the IDE still active? - bool const bBool = BasicIDEGlobals::GetShell()->GetFrame() && - pEditor->GetMode() == DLGED_TEST; + bool const bBool = GetShell()->GetFrame() && + pEditor->GetMode() == DlgEditor::TEST; rSet.Put(SfxBoolItem(SID_DIALOG_TESTMODE, bBool)); } break; @@ -336,7 +326,7 @@ void DialogWindow::GetState( SfxItemSet& rSet ) else { SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS ); - if ( GetEditor()->GetMode() == DLGED_SELECT ) + if ( GetEditor()->GetMode() == DlgEditor::SELECT ) aItem.SetValue( SVX_SNAP_SELECT ); else { @@ -384,8 +374,8 @@ void DialogWindow::GetState( SfxItemSet& rSet ) case SID_SHOW_PROPERTYBROWSER: { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; + Shell* pShell = GetShell(); + SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : NULL; if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !pEditor->GetView()->AreObjectsMarked() ) rSet.DisableItem( nWh ); @@ -426,8 +416,7 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) if ( !IsReadOnly() ) { GetEditor()->Cut(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } break; @@ -435,8 +424,7 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) if ( !IsReadOnly() ) { GetEditor()->Delete(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } break; @@ -447,37 +435,36 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) if ( !IsReadOnly() ) { GetEditor()->Paste(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } break; case SID_INSERT_FORM_RADIO: - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FORMRADIO ); break; case SID_INSERT_FORM_CHECK: - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FORMCHECK ); break; case SID_INSERT_FORM_LIST: - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FORMLIST ); break; case SID_INSERT_FORM_COMBO: - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FORMCOMBO ); break; case SID_INSERT_FORM_SPIN: - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FORMSPIN ); break; case SID_INSERT_FORM_VSCROLL: - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FORMVSCROLL ); break; case SID_INSERT_FORM_HSCROLL: - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FORMHSCROLL ); break; case SID_CHOOSE_CONTROLS: @@ -490,170 +477,168 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) { case SVX_SNAP_PUSHBUTTON: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_PUSHBUTTON ); } break; case SVX_SNAP_RADIOBUTTON: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_RADIOBUTTON ); } break; case SVX_SNAP_CHECKBOX: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_CHECKBOX); } break; case SVX_SNAP_LISTBOX: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_LISTBOX ); } break; case SVX_SNAP_COMBOBOX: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_COMBOBOX ); } break; case SVX_SNAP_GROUPBOX: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_GROUPBOX ); } break; case SVX_SNAP_EDIT: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_EDIT ); } break; case SVX_SNAP_FIXEDTEXT: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FIXEDTEXT ); } break; case SVX_SNAP_IMAGECONTROL: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_IMAGECONTROL ); } break; case SVX_SNAP_PROGRESSBAR: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_PROGRESSBAR ); } break; case SVX_SNAP_HSCROLLBAR: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_HSCROLLBAR ); } break; case SVX_SNAP_VSCROLLBAR: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_VSCROLLBAR ); } break; case SVX_SNAP_HFIXEDLINE: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_HFIXEDLINE ); } break; case SVX_SNAP_VFIXEDLINE: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_VFIXEDLINE ); } break; case SVX_SNAP_DATEFIELD: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_DATEFIELD ); } break; case SVX_SNAP_TIMEFIELD: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_TIMEFIELD ); } break; case SVX_SNAP_NUMERICFIELD: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_NUMERICFIELD ); } break; case SVX_SNAP_CURRENCYFIELD: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_CURRENCYFIELD ); } break; case SVX_SNAP_FORMATTEDFIELD: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FORMATTEDFIELD ); } break; case SVX_SNAP_PATTERNFIELD: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_PATTERNFIELD ); } break; case SVX_SNAP_FILECONTROL: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_FILECONTROL ); } break; case SVX_SNAP_SPINBUTTON: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_SPINBUTTON ); } break; case SVX_SNAP_TREECONTROL: { - GetEditor()->SetMode( DLGED_INSERT ); + GetEditor()->SetMode( DlgEditor::INSERT ); GetEditor()->SetInsertObj( OBJ_DLG_TREECONTROL ); } break; case SVX_SNAP_SELECT: { - GetEditor()->SetMode( DLGED_SELECT ); + GetEditor()->SetMode( DlgEditor::SELECT ); } break; } if ( rReq.GetModifier() & KEY_MOD1 ) { - if ( GetEditor()->GetMode() == DLGED_INSERT ) + if ( GetEditor()->GetMode() == DlgEditor::INSERT ) GetEditor()->CreateDefaultObject(); } - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); } break; case SID_DIALOG_TESTMODE: { - DlgEdMode eOldMode = GetEditor()->GetMode(); - GetEditor()->SetMode( DLGED_TEST ); + DlgEditor::Mode eOldMode = GetEditor()->GetMode(); + GetEditor()->SetMode( DlgEditor::TEST ); GetEditor()->SetMode( eOldMode ); rReq.Done(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DIALOG_TESTMODE ); return; } @@ -668,10 +653,10 @@ void DialogWindow::ExecuteCommand( SfxRequest& rReq ) case SID_BASICIDE_DELETECURRENT: if (QueryDelDialog(m_aName, this)) { - if (BasicIDE::RemoveDialog(m_aDocument, m_aLibName, m_aName)) + if (RemoveDialog(m_aDocument, m_aLibName, m_aName)) { - BasicIDE::MarkDocumentModified(m_aDocument); - BasicIDEGlobals::GetShell()->RemoveWindow(this, true); + MarkDocumentModified(m_aDocument); + GetShell()->RemoveWindow(this, true); } } break; @@ -687,11 +672,10 @@ Reference< container::XNameContainer > DialogWindow::GetDialog() const bool DialogWindow::RenameDialog( const ::rtl::OUString& rNewName ) { - if ( !BasicIDE::RenameDialog( this, GetDocument(), GetLibName(), GetName(), rNewName ) ) + if ( !basctl::RenameDialog( this, GetDocument(), GetLibName(), GetName(), rNewName ) ) return false; - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_DOC_MODIFIED ); return true; @@ -699,20 +683,20 @@ bool DialogWindow::RenameDialog( const ::rtl::OUString& rNewName ) void DialogWindow::DisableBrowser() { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : NULL; + Shell* pShell = GetShell(); + SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : 0; + SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : 0; if( pChildWin ) ((PropBrw*)(pChildWin->GetWindow()))->Update( NULL ); } void DialogWindow::UpdateBrowser() { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : NULL; + Shell* pShell = GetShell(); + SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : 0; + SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : 0; if( pChildWin ) - ((PropBrw*)(pChildWin->GetWindow()))->Update( pIDEShell ); + ((PropBrw*)(pChildWin->GetWindow()))->Update( pShell ); } static ::rtl::OUString aResourceResolverPropName( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" )); @@ -893,9 +877,6 @@ bool DialogWindow::SaveDialog() return bDone; } -} // namespace basctl - - extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft, const ::com::sun::star::lang::Locale& rLocaleRight ); @@ -1098,10 +1079,10 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri } } - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if( pIDEShell == NULL ) + Shell* pShell = GetShell(); + if (!pShell) { - OSL_ASSERT( pIDEShell != NULL ); + OSL_ASSERT(pShell); return bDone; } @@ -1163,7 +1144,7 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri bool bCopyResourcesForDialog = true; if( bAddDialogLanguagesToLib ) { - boost::shared_ptr<LocalizationMgr> pCurMgr = pIDEShell->GetCurLocalizationMgr(); + boost::shared_ptr<LocalizationMgr> pCurMgr = pShell->GetCurLocalizationMgr(); lang::Locale aFirstLocale; aFirstLocale = aOnlyInImportLanguages[0]; @@ -1225,12 +1206,12 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri if( eNameClashMode == CLASH_OVERWRITE_DIALOG ) { - if ( BasicIDE::RemoveDialog( rDocument, aLibName, aNewDlgName ) ) + if (basctl::RemoveDialog( rDocument, aLibName, aNewDlgName ) ) { - IDEBaseWindow* pDlgWin = pIDEShell->FindDlgWin( rDocument, aLibName, aNewDlgName, false, true ); + BaseWindow* pDlgWin = pShell->FindDlgWin( rDocument, aLibName, aNewDlgName, false, true ); if( pDlgWin != NULL ) - pIDEShell->RemoveWindow( pDlgWin, true ); - BasicIDE::MarkDocumentModified( rDocument ); + pShell->RemoveWindow( pDlgWin, true ); + MarkDocumentModified( rDocument ); } else { @@ -1271,8 +1252,8 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP ); if( bSuccess ) { - basctl::DialogWindow* pNewDlgWin = pIDEShell->CreateDlgWin( rDocument, aLibName, aNewDlgName ); - pIDEShell->SetCurWindow( pNewDlgWin, true ); + DialogWindow* pNewDlgWin = pShell->CreateDlgWin( rDocument, aLibName, aNewDlgName ); + pShell->SetCurWindow( pNewDlgWin, true ); } bDone = true; @@ -1285,9 +1266,6 @@ bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const Scri } -namespace basctl -{ - bool DialogWindow::ImportDialog() { DBG_CHKTHIS( DialogWindow, 0 ); @@ -1327,24 +1305,24 @@ bool DialogWindow::IsModified() return GetName(); } -BasicEntryDescriptor DialogWindow::CreateEntryDescriptor() +EntryDescriptor DialogWindow::CreateEntryDescriptor() { ScriptDocument aDocument( GetDocument() ); ::rtl::OUString aLibName( GetLibName() ); ::rtl::OUString aLibSubName; LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName ); - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG ); + return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG ); } void DialogWindow::SetReadOnly (bool bReadOnly) { if (pEditor) - pEditor->SetMode(bReadOnly ? DLGED_READONLY : DLGED_SELECT); + pEditor->SetMode(bReadOnly ? DlgEditor::READONLY : DlgEditor::SELECT); } bool DialogWindow::IsReadOnly () { - return pEditor && pEditor->GetMode() == DLGED_READONLY; + return pEditor && pEditor->GetMode() == DlgEditor::READONLY; } bool DialogWindow::IsPasteAllowed() @@ -1379,7 +1357,7 @@ void DialogWindow::StoreData() { DBG_UNHANDLED_EXCEPTION(); } - BasicIDE::MarkDocumentModified( GetDocument() ); + MarkDocumentModified( GetDocument() ); pEditor->ClearModifyFlag(); } } @@ -1394,7 +1372,7 @@ void DialogWindow::Deactivating() { Hide(); if ( IsModified() ) - BasicIDE::MarkDocumentModified( GetDocument() ); + MarkDocumentModified( GetDocument() ); DisableBrowser(); } @@ -1416,7 +1394,7 @@ void DialogWindow::DataChanged( const DataChangedEvent& rDCEvt ) Invalidate(); } else - IDEBaseWindow::DataChanged( rDCEvt ); + BaseWindow::DataChanged( rDCEvt ); } void DialogWindow::InitSettings(bool bFont, bool bForeground, bool bBackground) @@ -1448,9 +1426,9 @@ char const* DialogWindow::GetHid () const { return HID_BASICIDE_DIALOGWINDOW; } -BasicIDEType DialogWindow::GetType () const +ItemType DialogWindow::GetType () const { - return BASICIDE_TYPE_DIALOG; + return TYPE_DIALOG; } @@ -1465,7 +1443,7 @@ DialogWindowLayout::DialogWindowLayout (Window* pParent, ObjectCatalog& rObjectC rObjectCatalog(rObjectCatalog_) { } -void DialogWindowLayout::Activating (IDEBaseWindow& rChild) +void DialogWindowLayout::Activating (BaseWindow& rChild) { assert(dynamic_cast<DialogWindow*>(&rChild)); pChild = &static_cast<DialogWindow&>(rChild); diff --git a/basctl/source/basicide/basidectrlr.cxx b/basctl/source/basicide/basidectrlr.cxx index 05d511e8df47..262afb10e06c 100644 --- a/basctl/source/basicide/basidectrlr.cxx +++ b/basctl/source/basicide/basidectrlr.cxx @@ -17,16 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "basidectrlr.hxx" + +#include "basidesh.hxx" -#include <basidectrlr.hxx> #include <cppuhelper/queryinterface.hxx> #include <comphelper/sequence.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <vcl/syswin.hxx> -#include <basidesh.hxx> - +namespace basctl +{ using namespace com::sun::star; using namespace com::sun::star::uno; @@ -39,7 +41,7 @@ using namespace com::sun::star::beans; //---------------------------------------------------------------------------- -BasicIDEController::BasicIDEController( BasicIDEShell* pViewShell ) +Controller::Controller (Shell* pViewShell) :OPropertyContainer( m_aBHelper ) ,SfxBaseController( pViewShell ) ,m_nIconId( ICON_MACROLIBRARY ) @@ -49,14 +51,13 @@ BasicIDEController::BasicIDEController( BasicIDEShell* pViewShell ) //---------------------------------------------------------------------------- -BasicIDEController::~BasicIDEController() -{ -} +Controller::~Controller() +{ } // XInterface //---------------------------------------------------------------------------- -Any SAL_CALL BasicIDEController::queryInterface( const Type & rType ) throw(RuntimeException) +Any SAL_CALL Controller::queryInterface( const Type & rType ) throw(RuntimeException) { Any aReturn = SfxBaseController::queryInterface( rType ); if ( !aReturn.hasValue() ) @@ -67,14 +68,14 @@ Any SAL_CALL BasicIDEController::queryInterface( const Type & rType ) throw(Runt //---------------------------------------------------------------------------- -void SAL_CALL BasicIDEController::acquire() throw() +void SAL_CALL Controller::acquire() throw() { SfxBaseController::acquire(); } //---------------------------------------------------------------------------- -void SAL_CALL BasicIDEController::release() throw() +void SAL_CALL Controller::release() throw() { SfxBaseController::release(); } @@ -83,19 +84,19 @@ void SAL_CALL BasicIDEController::release() throw() // XTypeProvider ( ::SfxBaseController ) //---------------------------------------------------------------------------- -Sequence< Type > SAL_CALL BasicIDEController::getTypes() throw(RuntimeException) +Sequence< Type > SAL_CALL Controller::getTypes() throw(RuntimeException) { Sequence< Type > aTypes = ::comphelper::concatSequences( SfxBaseController::getTypes(), OPropertyContainer::getTypes() - ); + ); return aTypes; } //---------------------------------------------------------------------------- -Sequence< sal_Int8 > SAL_CALL BasicIDEController::getImplementationId() throw(RuntimeException) +Sequence< sal_Int8 > SAL_CALL Controller::getImplementationId() throw(RuntimeException) { static ::cppu::OImplementationId * pId = 0; if ( !pId ) @@ -113,7 +114,7 @@ Sequence< sal_Int8 > SAL_CALL BasicIDEController::getImplementationId() throw(Ru // XPropertySet //---------------------------------------------------------------------------- -Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySetInfo() throw(RuntimeException) +Reference< beans::XPropertySetInfo > SAL_CALL Controller::getPropertySetInfo() throw(RuntimeException) { Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); return xInfo; @@ -122,7 +123,7 @@ Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySet // OPropertySetHelper //---------------------------------------------------------------------------- -::cppu::IPropertyArrayHelper& BasicIDEController::getInfoHelper() +::cppu::IPropertyArrayHelper& Controller::getInfoHelper() { return *getArrayHelper(); } @@ -130,7 +131,7 @@ Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySet // OPropertyArrayUsageHelper //---------------------------------------------------------------------------- -::cppu::IPropertyArrayHelper* BasicIDEController::createArrayHelper( ) const +::cppu::IPropertyArrayHelper* Controller::createArrayHelper( ) const { Sequence< Property > aProps; describeProperties( aProps ); @@ -139,4 +140,6 @@ Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySet //---------------------------------------------------------------------------- +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 233e01cdf667..e36eaf3cbd64 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -52,16 +52,14 @@ #include <vcl/xtextedt.hxx> #include <vcl/msgbox.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; -using basctl::ModulWindow; -using basctl::ModulWindowLayout; -using basctl::DialogWindow; -using basctl::DialogWindowLayout; - -void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) +void Shell::ExecuteCurrent( SfxRequest& rReq ) { if ( !pCurWin ) return; @@ -92,24 +90,24 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) DBG_ASSERT(dynamic_cast<SvxSearchItem const*>(&rItem), "no searchitem!"); SvxSearchItem const& rSearchItem = static_cast<SvxSearchItem const&>(rItem); // memorize item because of the adjustments... - BasicIDEGlobals::GetExtraData()->SetSearchItem(rSearchItem); + GetExtraData()->SetSearchItem(rSearchItem); sal_Int32 nFound = 0; bool bCanceled = false; if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) { sal_uInt16 nActModWindows = 0; - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if (pWin->HasActiveEditor()) nActModWindows++; } if ( nActModWindows <= 1 || ( !rSearchItem.GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String(IDEResId(RID_STR_SEARCHALLMODULES)) ).Execute() == RET_YES ) ) { - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; nFound += pWin->StartSearchAndReplace(rSearchItem); } } @@ -128,12 +126,12 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) // search other modules... bool bChangeCurWindow = false; WindowTableIt it; - for (it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + for (it = aWindowTable.begin(); it != aWindowTable.end(); ++it) if (it->second == pCurWin) break; - if (it != aIDEWindowTable.end()) + if (it != aWindowTable.end()) ++it; - IDEBaseWindow* pWin = it != aIDEWindowTable.end() ? it->second : 0; + BaseWindow* pWin = it != aWindowTable.end() ? it->second : 0; bool bSearchedFromStart = false; while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) ) @@ -146,8 +144,8 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) QueryBox aQuery(pParent, WB_YES_NO|WB_DEF_YES, IDE_RESSTR(RID_STR_SEARCHFROMSTART)); if ( aQuery.Execute() == RET_YES ) { - it = aIDEWindowTable.begin(); - if ( it != aIDEWindowTable.end() ) + it = aWindowTable.begin(); + if ( it != aWindowTable.end() ) pWin = it->second; bSearchedFromStart = true; } @@ -171,9 +169,9 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) } if ( pWin && ( pWin != pCurWin ) ) { - if ( it != aIDEWindowTable.end() ) + if ( it != aWindowTable.end() ) ++it; - pWin = it != aIDEWindowTable.end() ? it->second : 0; + pWin = it != aWindowTable.end() ? it->second : 0; } else pWin = 0; @@ -201,7 +199,7 @@ void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq ) } // no matter who's at the top, influence on the shell: -void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) +void Shell::ExecuteGlobal( SfxRequest& rReq ) { sal_uInt16 nSlot = rReq.GetSlot(); switch ( nSlot ) @@ -211,7 +209,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) // maybe do not simply stop if on breakpoint! if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) pMCurWin->BasicStop(); - BasicIDE::StopBasic(); + StopBasic(); } break; @@ -252,8 +250,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) aDocument.saveDocument( xStatusIndicator ); } - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_DOC_MODIFIED ); pBindings->Invalidate( SID_SAVEDOC ); @@ -267,15 +264,15 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) if ( rReq.GetArgs() ) { const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ); - BasicIDE::Organize( rTabId.GetValue() ); + Organize( rTabId.GetValue() ); } else - BasicIDE::Organize( 0 ); + Organize( 0 ); } break; case SID_BASICIDE_CHOOSEMACRO: { - BasicIDE::ChooseMacro( NULL, false, ::rtl::OUString() ); + ChooseMacro( NULL, false, ::rtl::OUString() ); } break; case SID_BASICIDE_CREATEMACRO: @@ -302,7 +299,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) // get Basic pBasic = pBasMgr->GetLib( aLibName ); } - DBG_ASSERT( pBasic, "Kein Basic!" ); + DBG_ASSERT( pBasic, "No Basic!" ); SetCurLib( aDocument, aLibName ); @@ -324,7 +321,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) } DBG_ASSERT( pModule, "Kein Modul!" ); if ( !pModule->GetMethods()->Find( rInfo.GetMethod(), SbxCLASS_METHOD ) ) - BasicIDE::CreateMacro( pModule, rInfo.GetMethod() ); + CreateMacro( pModule, rInfo.GetMethod() ); } SfxViewFrame* pViewFrame = GetViewFrame(); if ( pViewFrame ) @@ -342,7 +339,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) if (pLayout) pLayout->ArrangeWindows(); // refresh the button state - if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr()) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate(SID_BASICIDE_OBJCAT); break; @@ -351,9 +348,9 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID ); const SfxStringItem &rModName = (const SfxStringItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MODULENAME ); - if ( aIDEWindowTable.find( rTabId.GetValue() ) != aIDEWindowTable.end() ) + if ( aWindowTable.find( rTabId.GetValue() ) != aWindowTable.end() ) { - IDEBaseWindow* pWin = aIDEWindowTable[ rTabId.GetValue() ]; + BaseWindow* pWin = aWindowTable[ rTabId.GetValue() ]; ::rtl::OUString aNewName( rModName.GetValue() ); ::rtl::OUString aOldName( pWin->GetName() ); if ( aNewName != aOldName ) @@ -364,7 +361,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) rtl::OUString aLibName = pModWin->GetLibName(); ScriptDocument aDocument( pWin->GetDocument() ); - if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) ) + if (RenameModule(pModWin, aDocument, aLibName, aOldName, aNewName)) { bRenameOk = true; // Because we listen for container events for script @@ -380,12 +377,12 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) } if ( bRenameOk ) { - BasicIDE::MarkDocumentModified( pWin->GetDocument() ); + MarkDocumentModified( pWin->GetDocument() ); } else { // set old name in TabWriter - sal_uInt16 nId = GetIDEWindowId( pWin ); + sal_uInt16 nId = GetWindowId( pWin ); DBG_ASSERT( nId, "No entry in Tabbar!" ); if ( nId ) pTabBar->SetPageText( nId, aOldName ); @@ -418,9 +415,9 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) case SID_BASICIDE_STOREALLMODULESOURCES: case SID_BASICIDE_UPDATEALLMODULESOURCES: { - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if (!pWin->IsSuspended() && dynamic_cast<ModulWindow*>(pWin)) { if ( rReq.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES ) @@ -468,8 +465,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) else { // adjust old value... - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate(SID_BASICIDE_LIBSELECTOR, true, false); } } @@ -483,8 +479,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) m_aCurDocument = ScriptDocument::getApplicationScriptDocument(); m_aCurLibName = String(); // no UpdateWindows! - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR ); } } @@ -521,9 +516,9 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) ::rtl::OUString aName( rSbxItem.GetName() ); if ( m_aCurLibName.isEmpty() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) ) { - if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE ) + if ( rSbxItem.GetType() == TYPE_MODULE ) FindBasWin( aDocument, aLibName, aName, true ); - else if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG ) + else if ( rSbxItem.GetType() == TYPE_DIALOG ) FindDlgWin( aDocument, aLibName, aName, true ); } } @@ -533,7 +528,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) DBG_ASSERT( rReq.GetArgs(), "arguments expected" ); const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX ); ScriptDocument aDocument( rSbxItem.GetDocument() ); - IDEBaseWindow* pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), true ); + BaseWindow* pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), true ); if ( pWin ) RemoveWindow( pWin, true ); } @@ -546,19 +541,19 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) ::rtl::OUString aLibName( rSbxItem.GetLibName() ); ::rtl::OUString aName( rSbxItem.GetName() ); SetCurLib( aDocument, aLibName ); - IDEBaseWindow* pWin = 0; - if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG ) + BaseWindow* pWin = 0; + if ( rSbxItem.GetType() == TYPE_DIALOG ) { pWin = FindDlgWin( aDocument, aLibName, aName, true ); } - else if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE ) + else if ( rSbxItem.GetType() == TYPE_MODULE ) { pWin = FindBasWin( aDocument, aLibName, aName, true ); } - else if ( rSbxItem.GetType() == BASICIDE_TYPE_METHOD ) + else if ( rSbxItem.GetType() == TYPE_METHOD ) { pWin = FindBasWin( aDocument, aLibName, aName, true ); - ((ModulWindow*)pWin)->EditMacro( rSbxItem.GetMethodName() ); + static_cast<ModulWindow*>(pWin)->EditMacro( rSbxItem.GetMethodName() ); } DBG_ASSERT( pWin, "Fenster wurde nicht erzeugt!" ); SetCurWindow( pWin, true ); @@ -612,7 +607,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) if ( pTypeItem ) aType = pTypeItem->GetValue(); - IDEBaseWindow* pWin = 0; + BaseWindow* pWin = 0; if ( aType == aModType ) pWin = FindBasWin( *pDocument, aLibName, aName, false ); else if ( aType == aDlgType ) @@ -705,7 +700,7 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq ) } } -void BasicIDEShell::GetState(SfxItemSet &rSet) +void Shell::GetState(SfxItemSet &rSet) { SfxWhichIter aIter(rSet); for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() ) @@ -750,7 +745,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) sal_uInt16 nState = 0; if ( pCurWin ) { - ::basctl::DocumentSignature aSignature( pCurWin->GetDocument() ); + DocumentSignature aSignature( pCurWin->GetDocument() ); nState = aSignature.getScriptingSignatureState(); } rSet.Put( SfxUInt16Item( SID_SIGNATURE, nState ) ); @@ -861,7 +856,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) case SID_SEARCH_ITEM: { ::rtl::OUString aSelected = GetSelectionText(true); - SvxSearchItem& rItem = BasicIDEGlobals::GetExtraData()->GetSearchItem(); + SvxSearchItem& rItem = GetExtraData()->GetSearchItem(); rItem.SetSearchString( aSelected ); rSet.Put( rItem ); } @@ -984,7 +979,7 @@ void BasicIDEShell::GetState(SfxItemSet &rSet) pCurWin->GetState( rSet ); } -sal_Bool BasicIDEShell::HasUIFeature( sal_uInt32 nFeature ) +sal_Bool Shell::HasUIFeature( sal_uInt32 nFeature ) { bool bResult = false; @@ -998,7 +993,7 @@ sal_Bool BasicIDEShell::HasUIFeature( sal_uInt32 nFeature ) return bResult; } -void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bool bRememberAsCurrent ) +void Shell::SetCurWindow( BaseWindow* pNewWin, bool bUpdateTabBar, bool bRememberAsCurrent ) { if ( pNewWin != pCurWin ) { @@ -1007,7 +1002,7 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bo pLayout->Deactivating(); if (pCurWin) { - if (pCurWin->GetType() == BASICIDE_TYPE_MODULE) + if (pCurWin->GetType() == TYPE_MODULE) pLayout = pModulLayout.get(); else pLayout = pDialogLayout.get(); @@ -1019,7 +1014,7 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bo if (GetViewFrame()->GetWindow().IsVisible()) // SFX will do it later otherwise pCurWin->Show(); pCurWin->Init(); - if ( !BasicIDEGlobals::GetExtraData()->ShellInCriticalSection() ) + if (!GetExtraData()->ShellInCriticalSection()) { Window* pFrameWindow = &GetViewFrame()->GetWindow(); Window* pFocusWindow = Application::GetFocusWindow(); @@ -1033,7 +1028,7 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bo pLayout = 0; if ( bUpdateTabBar ) { - sal_uLong nKey = GetIDEWindowId( pCurWin ); + sal_uLong nKey = GetWindowId( pCurWin ); if ( pCurWin && ( pTabBar->GetPagePos( (sal_uInt16)nKey ) == TAB_PAGE_NOTFOUND ) ) pTabBar->InsertPage( (sal_uInt16)nKey, pCurWin->GetTitle() ); // has just been faded in pTabBar->SetCurPageId( (sal_uInt16)nKey ); @@ -1067,7 +1062,7 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar, bo } } -void BasicIDEShell::ManageToolbars() +void Shell::ManageToolbars() { static ::rtl::OUString aLayoutManagerName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )); static ::rtl::OUString aMacroBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/macrobar" )); @@ -1110,27 +1105,27 @@ void BasicIDEShell::ManageToolbars() } } -IDEBaseWindow* BasicIDEShell::FindApplicationWindow() +BaseWindow* Shell::FindApplicationWindow() { return FindWindow( ScriptDocument::getApplicationScriptDocument() ); } -IDEBaseWindow* BasicIDEShell::FindWindow( +BaseWindow* Shell::FindWindow( ScriptDocument const& rDocument, rtl::OUString const& rLibName, rtl::OUString const& rName, - BasicIDEType eType, bool bFindSuspended + ItemType eType, bool bFindSuspended ) { - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* const pWin = it->second; + BaseWindow* const pWin = it->second; if (pWin->Is(rDocument, rLibName, rName, eType, bFindSuspended)) return pWin; } return 0; } -long BasicIDEShell::CallBasicErrorHdl( StarBASIC* pBasic ) +long Shell::CallBasicErrorHdl( StarBASIC* pBasic ) { long nRet = 0; ModulWindow* pModWin = ShowActiveModuleWindow( pBasic ); @@ -1139,7 +1134,7 @@ long BasicIDEShell::CallBasicErrorHdl( StarBASIC* pBasic ) return nRet; } -long BasicIDEShell::CallBasicBreakHdl( StarBASIC* pBasic ) +long Shell::CallBasicBreakHdl( StarBASIC* pBasic ) { long nRet = 0; ModulWindow* pModWin = ShowActiveModuleWindow( pBasic ); @@ -1148,7 +1143,7 @@ long BasicIDEShell::CallBasicBreakHdl( StarBASIC* pBasic ) bool bAppWindowDisabled, bDispatcherLocked; sal_uInt16 nWaitCount; SfxUInt16Item *pSWActionCount, *pSWLockViewCount; - BasicIDE::BasicStopped( &bAppWindowDisabled, &bDispatcherLocked, + BasicStopped( &bAppWindowDisabled, &bDispatcherLocked, &nWaitCount, &pSWActionCount, &pSWLockViewCount ); nRet = pModWin->BasicBreakHdl( pBasic ); @@ -1160,16 +1155,16 @@ long BasicIDEShell::CallBasicBreakHdl( StarBASIC* pBasic ) if ( nWaitCount ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); + Shell* pShell = GetShell(); for ( sal_uInt16 n = 0; n < nWaitCount; n++ ) - pIDEShell->GetViewFrame()->GetWindow().EnterWait(); + pShell->GetViewFrame()->GetWindow().EnterWait(); } } } return nRet; } -ModulWindow* BasicIDEShell::ShowActiveModuleWindow( StarBASIC* pBasic ) +ModulWindow* Shell::ShowActiveModuleWindow( StarBASIC* pBasic ) { SetCurLib( ScriptDocument::getApplicationScriptDocument(), ::rtl::OUString(), false ); @@ -1184,8 +1179,7 @@ ModulWindow* BasicIDEShell::ShowActiveModuleWindow( StarBASIC* pBasic ) SbxObject* pParent = pActiveModule->GetParent(); if (StarBASIC* pLib = dynamic_cast<StarBASIC*>(pParent)) { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pLib ); - if ( pBasMgr ) + if (BasicManager* pBasMgr = FindBasicManager(pLib)) { ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); ::rtl::OUString aLibName = pLib->GetName(); @@ -1196,16 +1190,15 @@ ModulWindow* BasicIDEShell::ShowActiveModuleWindow( StarBASIC* pBasic ) } } else - DBG_ASSERT(false, "Kein BASIC!"); - BasicManager* pBasicMgr = BasicIDE::FindBasicManager( pBasic ); - if ( pBasicMgr ) + DBG_ASSERT(false, "No BASIC!"); + if (BasicManager* pBasicMgr = FindBasicManager(pBasic)) StartListening( *pBasicMgr, true /* log on only once */ ); return pWin; } return 0; } -void BasicIDEShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) +void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) { // not if iconified because the whole text would be displaced then at restore if ( GetViewFrame()->GetWindow().GetOutputSizePixel().Height() == 0 ) @@ -1240,7 +1233,7 @@ void BasicIDEShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) pLayout->SetPosSizePixel(rPos, dynamic_cast<DialogWindow*>(pCurWin) ? aSz : aOutSz); } -Reference< XModel > BasicIDEShell::GetCurrentDocument() const +Reference< XModel > Shell::GetCurrentDocument() const { Reference< XModel > xDocument; if ( pCurWin && pCurWin->GetDocument().isDocument() ) @@ -1248,7 +1241,7 @@ Reference< XModel > BasicIDEShell::GetCurrentDocument() const return xDocument; } -void BasicIDEShell::Activate( sal_Bool bMDI ) +void Shell::Activate( sal_Bool bMDI ) { SfxViewShell::Activate( bMDI ); @@ -1259,7 +1252,7 @@ void BasicIDEShell::Activate( sal_Bool bMDI ) } } -void BasicIDEShell::Deactivate( sal_Bool bMDI ) +void Shell::Deactivate( sal_Bool bMDI ) { // bMDI == true means that another MDI has been activated; in case of a // deactivate due to a MessageBox bMDI is false @@ -1269,14 +1262,14 @@ void BasicIDEShell::Deactivate( sal_Bool bMDI ) { pXDlgWin->DisableBrowser(); if( pXDlgWin->IsModified() ) - BasicIDE::MarkDocumentModified( pXDlgWin->GetDocument() ); + MarkDocumentModified( pXDlgWin->GetDocument() ); } // test CanClose to also test during deactivating the BasicIDE whether // the sourcecode is too large in one of the modules... - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if ( /* !pWin->IsSuspended() && */ !pWin->CanClose() ) { if ( !m_aCurLibName.isEmpty() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) ) @@ -1288,4 +1281,6 @@ void BasicIDEShell::Deactivate( sal_Bool bMDI ) } } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index 6a1a5b4a064e..16e73fef6430 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -41,19 +41,19 @@ #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; namespace css = ::com::sun::star; -using basctl::ModulWindow; -using basctl::ModulWindowLayout; - -Reference< view::XRenderable > BasicIDEShell::GetRenderable() +Reference< view::XRenderable > Shell::GetRenderable() { - return Reference< view::XRenderable >( new basicide::BasicRenderable( pCurWin ) ); + return Reference<view::XRenderable>( new Renderable(pCurWin) ); } -sal_Bool BasicIDEShell::HasSelection( sal_Bool /* bText */ ) const +sal_Bool Shell::HasSelection( sal_Bool /* bText */ ) const { if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) { @@ -64,7 +64,7 @@ sal_Bool BasicIDEShell::HasSelection( sal_Bool /* bText */ ) const return false; } -String BasicIDEShell::GetSelectionText( sal_Bool bWholeWord ) +String Shell::GetSelectionText( sal_Bool bWholeWord ) { String aText; if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) @@ -86,27 +86,27 @@ String BasicIDEShell::GetSelectionText( sal_Bool bWholeWord ) return aText; } -SfxPrinter* BasicIDEShell::GetPrinter( sal_Bool bCreate ) +SfxPrinter* Shell::GetPrinter( sal_Bool bCreate ) { if ( pCurWin ) { - BasicDocShell* pDocShell = (BasicDocShell*)GetViewFrame()->GetObjectShell(); + DocShell* pDocShell = (DocShell*)GetViewFrame()->GetObjectShell(); DBG_ASSERT( pDocShell, "DocShell ?!" ); return pDocShell->GetPrinter( bCreate ); } return 0; } -sal_uInt16 BasicIDEShell::SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags, bool ) +sal_uInt16 Shell::SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags, bool ) { (void)nDiffFlags; - BasicDocShell* pDocShell = (BasicDocShell*)GetViewFrame()->GetObjectShell(); + DocShell* pDocShell = (DocShell*)GetViewFrame()->GetObjectShell(); DBG_ASSERT( pDocShell, "DocShell ?!" ); pDocShell->SetPrinter( pNewPrinter ); return 0; } -void BasicIDEShell::SetMDITitle() +void Shell::SetMDITitle() { ::rtl::OUStringBuffer aTitleBuf; if ( !m_aCurLibName.isEmpty() ) @@ -119,7 +119,7 @@ void BasicIDEShell::SetMDITitle() else aTitleBuf.append(IDE_RESSTR(RID_STR_ALL)); - ::basctl::DocumentSignature aCurSignature( m_aCurDocument ); + DocumentSignature aCurSignature( m_aCurDocument ); if ( aCurSignature.getScriptingSignatureState() == SIGNATURESTATE_SIGNATURES_OK ) { aTitleBuf.append(' '); @@ -145,7 +145,7 @@ void BasicIDEShell::SetMDITitle() } } -ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName ) +ModulWindow* Shell::CreateBasWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName ) { bCreatingWindow = true; @@ -193,7 +193,7 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const else { pWin->SetStatus( pWin->GetStatus() & ~BASWIN_SUSPENDED ); - nKey = GetIDEWindowId( pWin ); + nKey = GetWindowId( pWin ); DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" ); } if( nKey && xLib.is() && rDocument.isInVBAMode() ) @@ -222,41 +222,40 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const return pWin; } -ModulWindow* BasicIDEShell::FindBasWin ( +ModulWindow* Shell::FindBasWin ( ScriptDocument const& rDocument, rtl::OUString const& rLibName, rtl::OUString const& rName, bool bCreateIfNotExist, bool bFindSuspended ) { - if (IDEBaseWindow* pWin = FindWindow(rDocument, rLibName, rName, BASICIDE_TYPE_MODULE, bFindSuspended)) + if (BaseWindow* pWin = FindWindow(rDocument, rLibName, rName, TYPE_MODULE, bFindSuspended)) return static_cast<ModulWindow*>(pWin); return bCreateIfNotExist ? CreateBasWin(rDocument, rLibName, rName) : 0; } -void BasicIDEShell::Move() +void Shell::Move() { if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) pMCurWin->FrameWindowMoved(); } -void BasicIDEShell::ShowCursor( bool bOn ) +void Shell::ShowCursor( bool bOn ) { if (ModulWindow* pMCurWin = dynamic_cast<ModulWindow*>(pCurWin)) pMCurWin->ShowCursor(bOn); } -// Hack for #101048 -sal_Int32 getBasicIDEShellCount( void ); - // only if basic window above: -void BasicIDEShell::ExecuteBasic( SfxRequest& rReq ) +void Shell::ExecuteBasic( SfxRequest& rReq ) { if (dynamic_cast<ModulWindow*>(pCurWin)) { pCurWin->ExecuteCommand( rReq ); - if (getBasicIDEShellCount()) + if (nShellCount) CheckWindows(); } } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx index ed0af7e9ca9a..f7bb0ef194b9 100644 --- a/basctl/source/basicide/basides3.cxx +++ b/basctl/source/basicide/basides3.cxx @@ -36,15 +36,15 @@ #include <sfx2/request.hxx> #include <tools/diagnose_ex.h> +namespace basctl +{ + using namespace comphelper; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::io; -using basctl::DialogWindow; -using basctl::DialogWindowLayout; - -DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName ) +DialogWindow* Shell::CreateDlgWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName ) { bCreatingWindow = true; @@ -103,7 +103,7 @@ DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, cons else { pWin->SetStatus( pWin->GetStatus() & ~BASWIN_SUSPENDED ); - nKey = GetIDEWindowId( pWin ); + nKey = GetWindowId( pWin ); DBG_ASSERT( nKey, "CreateDlgWin: Kein Key - Fenster nicht gefunden!" ); } @@ -120,26 +120,26 @@ DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, cons return pWin; } -DialogWindow* BasicIDEShell::FindDlgWin ( +DialogWindow* Shell::FindDlgWin ( ScriptDocument const& rDocument, rtl::OUString const& rLibName, rtl::OUString const& rName, bool bCreateIfNotExist, bool bFindSuspended ) { - if (IDEBaseWindow* pWin = FindWindow(rDocument, rLibName, rName, BASICIDE_TYPE_DIALOG, bFindSuspended)) + if (BaseWindow* pWin = FindWindow(rDocument, rLibName, rName, TYPE_DIALOG, bFindSuspended)) return static_cast<DialogWindow*>(pWin); return bCreateIfNotExist ? CreateDlgWin(rDocument, rLibName, rName) : 0; } -sal_uInt16 BasicIDEShell::GetIDEWindowId(const IDEBaseWindow* pWin) const +sal_uInt16 Shell::GetWindowId(const BaseWindow* pWin) const { - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) if ( it->second == pWin ) return it->first; return 0; } -SdrView* BasicIDEShell::GetCurDlgView() const +SdrView* Shell::GetCurDlgView() const { if (DialogWindow* pDCurWin = dynamic_cast<DialogWindow*>(pCurWin)) return pDCurWin->GetView(); @@ -148,10 +148,12 @@ SdrView* BasicIDEShell::GetCurDlgView() const } // only if dialogue window above: -void BasicIDEShell::ExecuteDialog( SfxRequest& rReq ) +void Shell::ExecuteDialog( SfxRequest& rReq ) { if (pCurWin && (dynamic_cast<DialogWindow*>(pCurWin) || rReq.GetSlot() == SID_IMPORT_DIALOG)) pCurWin->ExecuteCommand(rReq); } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index c1b7dfe4dee2..e81b3a6d2b53 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -20,6 +20,8 @@ // CLOOKS: #define _SPIN_HXX +#include "basidesh.hxx" + #define _SOLAR__PRIVATE 1 #include <tools/diagnose_ex.h> #include <basic/basmgr.hxx> @@ -43,7 +45,7 @@ #include <svl/intitem.hxx> #include <svl/srchitem.hxx> -#define BasicIDEShell +#define basctl_Shell #define SFX_TYPEMAP #include <idetemp.hxx> #include <basslots.hxx> @@ -58,6 +60,9 @@ #include <sfx2/viewfac.hxx> #include <vcl/msgbox.hxx> +namespace basctl +{ + using namespace ::com::sun::star::uno; using namespace ::com::sun::star; using ::rtl::OUString; @@ -66,14 +71,13 @@ typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListen class ContainerListenerImpl : public ContainerListenerBASE { - BasicIDEShell* mpShell; + Shell* mpShell; public: - ContainerListenerImpl (BasicIDEShell* pShell) : mpShell(pShell) { } + ContainerListenerImpl (Shell* pShell) : mpShell(pShell) { } ~ContainerListenerImpl() - { - } + { } void addContainerListener( const ScriptDocument& rScriptDocument, const ::rtl::OUString& aLibName ) { @@ -118,7 +122,7 @@ public: rtl::OUString sModuleName; if( mpShell && ( Event.Accessor >>= sModuleName ) ) { - basctl::ModulWindow* pWin = mpShell->FindBasWin(mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, false, true); + ModulWindow* pWin = mpShell->FindBasWin(mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, false, true); if( pWin ) mpShell->RemoveWindow( pWin, true, true ); } @@ -126,15 +130,15 @@ public: }; -TYPEINIT1( BasicIDEShell, SfxViewShell ); +TYPEINIT1( Shell, SfxViewShell ); -SFX_IMPL_NAMED_VIEWFACTORY( BasicIDEShell, "Default" ) +SFX_IMPL_NAMED_VIEWFACTORY( Shell, "Default" ) { - SFX_VIEW_REGISTRATION( BasicDocShell ); + SFX_VIEW_REGISTRATION( DocShell ); } -SFX_IMPL_INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) +SFX_IMPL_INTERFACE( basctl_Shell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) { SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG ); SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_SHOW_PROPERTYBROWSER, BASICIDE_UI_FEATURE_SHOW_BROWSER); @@ -143,14 +147,12 @@ SFX_IMPL_INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) ) -#define IDE_VIEWSHELL_FLAGS SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW +#define IDE_VIEWSHELL_FLAGS (SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW) -static sal_Int32 GnBasicIDEShellCount; -sal_Int32 getBasicIDEShellCount( void ) - { return GnBasicIDEShellCount; } +unsigned Shell::nShellCount = 0; -BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) : +Shell::Shell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) : SfxViewShell( pFrame_, IDE_VIEWSHELL_FLAGS ), m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ), aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ), @@ -163,12 +165,10 @@ BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell { m_xLibListener = new ContainerListenerImpl( this ); Init(); - GnBasicIDEShellCount++; + nShellCount++; } - - -void BasicIDEShell::Init() +void Shell::Init() { TbxControls::RegisterControl( SID_CHOOSE_CONTROLS ); SvxPosSizeStatusBarControl::RegisterControl(); @@ -179,7 +179,7 @@ void BasicIDEShell::Init() SvxSearchDialogWrapper::RegisterChildWindow(false); - BasicIDEGlobals::GetExtraData()->ShellInCriticalSection() = true; + GetExtraData()->ShellInCriticalSection() = true; SetName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BasicIDE" ) ) ); SetHelpId( SVX_INTERFACE_BASIDE_VIEWSH ); @@ -195,8 +195,8 @@ void BasicIDEShell::Init() m_aCurDocument = ScriptDocument::getApplicationScriptDocument(); bCreatingWindow = false; - pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() ); - pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) ); + pTabBar = new TabBar( &GetViewFrame()->GetWindow() ); + pTabBar->SetSplitHdl( LINK( this, Shell, TabBarSplitHdl ) ); bTabBarSplitted = false; nCurKey = 100; @@ -205,13 +205,13 @@ void BasicIDEShell::Init() SetCurLib( ScriptDocument::getApplicationScriptDocument(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Standard")), false, false ); - BasicIDEGlobals::ShellCreated(this); + ShellCreated(this); - BasicIDEGlobals::GetExtraData()->ShellInCriticalSection() = false; + GetExtraData()->ShellInCriticalSection() = false; // It's enough to create the controller ... // It will be public by using magic :-) - new BasicIDEController( this ); + new Controller(this); // Force updating the title ! Because it must be set to the controller // it has to be called directly after creating those controller. @@ -220,86 +220,84 @@ void BasicIDEShell::Init() UpdateWindows(); } -BasicIDEShell::~BasicIDEShell() +Shell::~Shell() { m_aNotifier.dispose(); - BasicIDEGlobals::ShellDestroyed(this); + ShellDestroyed(this); // so that on a basic saving error, the shell doesn't pop right up again - BasicIDEGlobals::GetExtraData()->ShellInCriticalSection() = true; + GetExtraData()->ShellInCriticalSection() = true; SetWindow( 0 ); SetCurWindow( 0 ); - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { // no store; does already happen when the BasicManagers are destroyed delete it->second; } - aIDEWindowTable.clear(); delete pTabBar; // Destroy all ContainerListeners for Basic Container. if (ContainerListenerImpl* pListener = static_cast<ContainerListenerImpl*>(m_xLibListener.get())) pListener->removeContainerListener(m_aCurDocument, m_aCurLibName); - BasicIDEGlobals::GetExtraData()->ShellInCriticalSection() = false; + GetExtraData()->ShellInCriticalSection() = false; - GnBasicIDEShellCount--; + nShellCount--; } -void BasicIDEShell::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) +void Shell::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) { if (pCurWin) pCurWin->OnNewDocument(); UpdateWindows(); } -void BasicIDEShell::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) +void Shell::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) { if (pCurWin) pCurWin->OnNewDocument(); UpdateWindows(); } -void BasicIDEShell::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) +void Shell::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) { StoreAllWindowData(); } -void BasicIDEShell::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) +void Shell::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) { // #i115671: Update SID_SAVEDOC after saving is completed - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_SAVEDOC ); } -void BasicIDEShell::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) +void Shell::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) { StoreAllWindowData(); } -void BasicIDEShell::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) +void Shell::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) { // not interested in } -void BasicIDEShell::onDocumentClosed( const ScriptDocument& _rDocument ) +void Shell::onDocumentClosed( const ScriptDocument& _rDocument ) { if ( !_rDocument.isValid() ) return; bool bSetCurWindow = false; bool bSetCurLib = ( _rDocument == m_aCurDocument ); - std::vector<IDEBaseWindow*> aDeleteVec; + std::vector<BaseWindow*> aDeleteVec; // remove all windows which belong to this document - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if ( pWin->IsDocument( _rDocument ) ) { if ( pWin->GetStatus() & (BASWIN_RUNNINGBASIC|BASWIN_INRESCHEDULE) ) @@ -315,9 +313,9 @@ void BasicIDEShell::onDocumentClosed( const ScriptDocument& _rDocument ) } } // delete windows outside main loop so we don't invalidate the original iterator - for( std::vector<IDEBaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) + for (std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it) { - IDEBaseWindow* pWin = *it; + BaseWindow* pWin = *it; pWin->StoreData(); if ( pWin == pCurWin ) bSetCurWindow = true; @@ -325,8 +323,7 @@ void BasicIDEShell::onDocumentClosed( const ScriptDocument& _rDocument ) } // remove lib info - BasicIDEData* pData = BasicIDEGlobals::GetExtraData(); - if ( pData ) + if (ExtraData* pData = GetExtraData()) pData->GetLibInfos().RemoveInfoFor( _rDocument ); if ( bSetCurLib ) @@ -335,29 +332,28 @@ void BasicIDEShell::onDocumentClosed( const ScriptDocument& _rDocument ) SetCurWindow( FindApplicationWindow(), true ); } -void BasicIDEShell::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) +void Shell::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR, true, false ); SetMDITitle(); } -void BasicIDEShell::onDocumentModeChanged( const ScriptDocument& _rDocument ) +void Shell::onDocumentModeChanged( const ScriptDocument& _rDocument ) { - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if ( pWin->IsDocument( _rDocument ) && _rDocument.isDocument() ) pWin->SetReadOnly( _rDocument.isReadOnly() ); } } -void BasicIDEShell::StoreAllWindowData( bool bPersistent ) +void Shell::StoreAllWindowData( bool bPersistent ) { - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; DBG_ASSERT( pWin, "PrepareClose: NULL-Pointer in Table?" ); if ( !pWin->IsSuspended() ) pWin->StoreData(); @@ -368,8 +364,7 @@ void BasicIDEShell::StoreAllWindowData( bool bPersistent ) SFX_APP()->SaveBasicAndDialogContainer(); SetAppBasicModified(false); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_SAVEDOC ); pBindings->Update( SID_SAVEDOC ); @@ -378,7 +373,7 @@ void BasicIDEShell::StoreAllWindowData( bool bPersistent ) } -sal_uInt16 BasicIDEShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ) +sal_uInt16 Shell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ) { (void)bForBrowsing; @@ -397,9 +392,9 @@ sal_uInt16 BasicIDEShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ) else { bool bCanClose = true; - for (WindowTableIt it = aIDEWindowTable.begin(); bCanClose && (it != aIDEWindowTable.end()); ++it) + for (WindowTableIt it = aWindowTable.begin(); bCanClose && (it != aWindowTable.end()); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if ( !pWin->CanClose() ) { if ( !m_aCurLibName.isEmpty() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) ) @@ -416,7 +411,7 @@ sal_uInt16 BasicIDEShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ) } } -void BasicIDEShell::InitScrollBars() +void Shell::InitScrollBars() { aVScrollBar.SetLineSize( 300 ); aVScrollBar.SetPageSize( 2000 ); @@ -431,28 +426,28 @@ void BasicIDEShell::InitScrollBars() -void BasicIDEShell::InitTabBar() +void Shell::InitTabBar() { pTabBar->Enable(); pTabBar->Show(); - pTabBar->SetSelectHdl( LINK( this, BasicIDEShell, TabBarHdl ) ); + pTabBar->SetSelectHdl( LINK( this, Shell, TabBarHdl ) ); } -Size BasicIDEShell::GetOptimalSizePixel() const +Size Shell::GetOptimalSizePixel() const { return Size( 400, 300 ); } -void BasicIDEShell::OuterResizePixel( const Point &rPos, const Size &rSize ) +void Shell::OuterResizePixel( const Point &rPos, const Size &rSize ) { AdjustPosSizePixel( rPos, rSize ); } -IMPL_LINK_INLINE_START( BasicIDEShell, TabBarSplitHdl, TabBar *, pTBar ) +IMPL_LINK_INLINE_START( Shell, TabBarSplitHdl, TabBar *, pTBar ) { (void)pTBar; bTabBarSplitted = true; @@ -460,14 +455,14 @@ IMPL_LINK_INLINE_START( BasicIDEShell, TabBarSplitHdl, TabBar *, pTBar ) return 0; } -IMPL_LINK_INLINE_END( BasicIDEShell, TabBarSplitHdl, TabBar *, pTBar ) +IMPL_LINK_INLINE_END( Shell, TabBarSplitHdl, TabBar *, pTBar ) -IMPL_LINK( BasicIDEShell, TabBarHdl, TabBar *, pCurTabBar ) +IMPL_LINK( Shell, TabBarHdl, TabBar *, pCurTabBar ) { sal_uInt16 nCurId = pCurTabBar->GetCurPageId(); - IDEBaseWindow* pWin = aIDEWindowTable[ nCurId ]; + BaseWindow* pWin = aWindowTable[ nCurId ]; DBG_ASSERT( pWin, "Eintrag in TabBar passt zu keinem Fenster!" ); SetCurWindow( pWin ); @@ -476,7 +471,7 @@ IMPL_LINK( BasicIDEShell, TabBarHdl, TabBar *, pCurTabBar ) -bool BasicIDEShell::NextPage( bool bPrev ) +bool Shell::NextPage( bool bPrev ) { bool bRet = false; sal_uInt16 nPos = pTabBar->GetPagePos( pTabBar->GetCurPageId() ); @@ -488,7 +483,7 @@ bool BasicIDEShell::NextPage( bool bPrev ) if ( nPos < pTabBar->GetPageCount() ) { - IDEBaseWindow* pWin = aIDEWindowTable[ pTabBar->GetPageId( nPos ) ]; + BaseWindow* pWin = aWindowTable[ pTabBar->GetPageId( nPos ) ]; SetCurWindow( pWin, true ); bRet = true; } @@ -498,7 +493,7 @@ bool BasicIDEShell::NextPage( bool bPrev ) -void BasicIDEShell::ArrangeTabBar() +void Shell::ArrangeTabBar() { long nBoxPos = aScrollBarBox.GetPosPixel().X() - 1; long nPos = pTabBar->GetSplitSize(); @@ -515,7 +510,7 @@ void BasicIDEShell::ArrangeTabBar() -::svl::IUndoManager* BasicIDEShell::GetUndoManager() +::svl::IUndoManager* Shell::GetUndoManager() { ::svl::IUndoManager* pMgr = NULL; if( pCurWin ) @@ -526,10 +521,10 @@ void BasicIDEShell::ArrangeTabBar() -void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, +void Shell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, const SfxHint& rHint, const TypeId& ) { - if ( BasicIDEGlobals::GetShell() ) + if (GetShell()) { if (SfxSimpleHint const* pSimpleHint = dynamic_cast<SfxSimpleHint const*>(&rHint)) { @@ -549,7 +544,7 @@ void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, if ( ( nHintId == SBX_HINT_BASICSTART ) || ( nHintId == SBX_HINT_BASICSTOP ) ) { - if (SfxBindings* pBindings = BasicIDE::GetBindingsPtr()) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_BASICRUN ); pBindings->Update( SID_BASICRUN ); @@ -577,7 +572,7 @@ void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, { // not only at error/break or explicit stoppage, // if the update is turned off due to a programming bug - BasicIDE::BasicStopped(); + BasicStopped(); if (pLayout) pLayout->UpdateDebug(true); // clear... if( m_pCurLocalizationMgr ) @@ -588,9 +583,9 @@ void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, m_pCurLocalizationMgr->handleBasicStarted(); } - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if ( nHintId == SBX_HINT_BASICSTART ) pWin->BasicStarted(); else @@ -604,19 +599,19 @@ void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&, -void BasicIDEShell::CheckWindows() +void Shell::CheckWindows() { bool bSetCurWindow = false; - std::vector<IDEBaseWindow*> aDeleteVec; - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + std::vector<BaseWindow*> aDeleteVec; + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if ( pWin->GetStatus() & BASWIN_TOBEKILLED ) aDeleteVec.push_back( pWin ); } - for ( std::vector<IDEBaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) + for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) { - IDEBaseWindow* pWin = *it; + BaseWindow* pWin = *it; pWin->StoreData(); if ( pWin == pCurWin ) bSetCurWindow = true; @@ -628,19 +623,19 @@ void BasicIDEShell::CheckWindows() -void BasicIDEShell::RemoveWindows( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, bool bDestroy ) +void Shell::RemoveWindows( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, bool bDestroy ) { bool bChangeCurWindow = pCurWin ? false : true; - std::vector<IDEBaseWindow*> aDeleteVec; - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + std::vector<BaseWindow*> aDeleteVec; + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName ) aDeleteVec.push_back( pWin ); } - for ( std::vector<IDEBaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) + for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) { - IDEBaseWindow* pWin = *it; + BaseWindow* pWin = *it; if ( pWin == pCurWin ) bChangeCurWindow = true; pWin->StoreData(); @@ -652,16 +647,16 @@ void BasicIDEShell::RemoveWindows( const ScriptDocument& rDocument, const ::rtl: -void BasicIDEShell::UpdateWindows() +void Shell::UpdateWindows() { // remove all windows that may not be displayed bool bChangeCurWindow = pCurWin ? false : true; if ( !m_aCurLibName.isEmpty() ) { - std::vector<IDEBaseWindow*> aDeleteVec; - for (WindowTableIt it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it) + std::vector<BaseWindow*> aDeleteVec; + for (WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if ( !pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) { if ( pWin == pCurWin ) @@ -674,7 +669,7 @@ void BasicIDEShell::UpdateWindows() aDeleteVec.push_back( pWin ); } } - for ( std::vector<IDEBaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) + for ( std::vector<BaseWindow*>::const_iterator it = aDeleteVec.begin(); it != aDeleteVec.end(); ++it ) { RemoveWindow( *it, false, false ); } @@ -683,7 +678,7 @@ void BasicIDEShell::UpdateWindows() if ( bCreatingWindow ) return; - IDEBaseWindow* pNextActiveWindow = 0; + BaseWindow* pNextActiveWindow = 0; // show all windows that are to be shown ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::AllWithApplication ) ); @@ -719,10 +714,9 @@ void BasicIDEShell::UpdateWindows() if ( !bProtected ) { - LibInfoItem* pLibInfoItem = 0; - BasicIDEData* pData = BasicIDEGlobals::GetExtraData(); - if ( pData ) - pLibInfoItem = pData->GetLibInfos().GetInfo( LibInfoKey( *doc, aLibName ) ); + LibInfos::Item const* pLibInfoItem = 0; + if (ExtraData* pData = GetExtraData()) + pLibInfoItem = pData->GetLibInfos().GetInfo(*doc, aLibName); // modules if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) @@ -740,13 +734,13 @@ void BasicIDEShell::UpdateWindows() for ( sal_Int32 j = 0 ; j < nModCount ; j++ ) { ::rtl::OUString aModName = pModNames[ j ]; - basctl::ModulWindow* pWin = FindBasWin( *doc, aLibName, aModName, false ); + ModulWindow* pWin = FindBasWin( *doc, aLibName, aModName, false ); if ( !pWin ) pWin = CreateBasWin( *doc, aLibName, aModName ); if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aModName && - pLibInfoItem->GetCurrentType() == BASICIDE_TYPE_MODULE ) + pLibInfoItem->GetCurrentType() == TYPE_MODULE ) { - pNextActiveWindow = (IDEBaseWindow*)pWin; + pNextActiveWindow = (BaseWindow*)pWin; } } } @@ -771,13 +765,13 @@ void BasicIDEShell::UpdateWindows() ::rtl::OUString aDlgName = pDlgNames[ j ]; // this find only looks for non-suspended windows; // suspended windows are handled in CreateDlgWin - basctl::DialogWindow* pWin = FindDlgWin( *doc, aLibName, aDlgName, false ); + DialogWindow* pWin = FindDlgWin( *doc, aLibName, aDlgName, false ); if ( !pWin ) pWin = CreateDlgWin( *doc, aLibName, aDlgName ); if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aDlgName && - pLibInfoItem->GetCurrentType() == BASICIDE_TYPE_DIALOG ) + pLibInfoItem->GetCurrentType() == TYPE_DIALOG ) { - pNextActiveWindow = (IDEBaseWindow*)pWin; + pNextActiveWindow = (BaseWindow*)pWin; } } } @@ -799,12 +793,12 @@ void BasicIDEShell::UpdateWindows() } } -void BasicIDEShell::RemoveWindow( IDEBaseWindow* pWindow_, bool bDestroy, bool bAllowChangeCurWindow ) +void Shell::RemoveWindow( BaseWindow* pWindow_, bool bDestroy, bool bAllowChangeCurWindow ) { DBG_ASSERT( pWindow_, "Kann keinen NULL-Pointer loeschen!" ); - sal_uLong nKey = GetIDEWindowId( pWindow_ ); + sal_uLong nKey = GetWindowId( pWindow_ ); pTabBar->RemovePage( (sal_uInt16)nKey ); - aIDEWindowTable.erase( nKey ); + aWindowTable.erase( nKey ); if ( pWindow_ == pCurWin ) { if ( bAllowChangeCurWindow ) @@ -838,37 +832,36 @@ void BasicIDEShell::RemoveWindow( IDEBaseWindow* pWindow_, bool bDestroy, bool b // there will be no notify... pWindow_->BasicStopped(); } - aIDEWindowTable[ nKey ] = pWindow_; // jump in again + aWindowTable[ nKey ] = pWindow_; // jump in again } } else { pWindow_->AddStatus( BASWIN_SUSPENDED ); pWindow_->Deactivating(); - aIDEWindowTable[ nKey ] = pWindow_; // jump in again + aWindowTable[ nKey ] = pWindow_; // jump in again } } -sal_uInt16 BasicIDEShell::InsertWindowInTable( IDEBaseWindow* pNewWin ) +sal_uInt16 Shell::InsertWindowInTable( BaseWindow* pNewWin ) { nCurKey++; - aIDEWindowTable[ nCurKey ] = pNewWin; + aWindowTable[ nCurKey ] = pNewWin; return nCurKey; } -void BasicIDEShell::InvalidateBasicIDESlots() +void Shell::InvalidateBasicIDESlots() { // only those that have an optic effect... - if ( BasicIDEGlobals::GetShell() ) + if (GetShell()) { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_UNDO ); pBindings->Invalidate( SID_REDO ); @@ -905,21 +898,13 @@ void BasicIDEShell::InvalidateBasicIDESlots() } } -void BasicIDEShell::EnableScrollbars( bool bEnable ) +void Shell::EnableScrollbars( bool bEnable ) { - if ( bEnable ) - { - aHScrollBar.Enable(); - aVScrollBar.Enable(); - } - else - { - aHScrollBar.Disable(); - aVScrollBar.Disable(); - } + aHScrollBar.Enable(bEnable); + aVScrollBar.Enable(bEnable); } -void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString aLibName, bool bUpdateWindows, bool bCheck ) +void Shell::SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString aLibName, bool bUpdateWindows, bool bCheck ) { if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) ) { @@ -941,8 +926,7 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString SetCurLibForLocalization( rDocument, aLibName ); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR ); pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); @@ -951,7 +935,7 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, ::rtl::OUString } } -void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, ::rtl::OUString aLibName ) +void Shell::SetCurLibForLocalization( const ScriptDocument& rDocument, ::rtl::OUString aLibName ) { // Create LocalizationMgr Reference< resource::XStringResourceManager > xStringResourceManager; @@ -970,9 +954,11 @@ void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, : m_pCurLocalizationMgr->handleTranslationbar(); } -void BasicIDEShell::ImplStartListening( StarBASIC* pBasic ) +void Shell::ImplStartListening( StarBASIC* pBasic ) { StartListening( pBasic->GetBroadcaster(), true /* log on only once */ ); } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index ab9d9a085ad1..7990efbed7f3 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -43,6 +43,9 @@ #include <algorithm> #include <memory> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::container; @@ -55,7 +58,7 @@ extern "C" { { ::rtl::OUString aMacroDesc( pMacroDesc ); Reference< frame::XModel > aDocument( static_cast< frame::XModel* >( pOnlyInDocument_AsXModel ) ); - ::rtl::OUString aScriptURL = BasicIDE::ChooseMacro( aDocument, bChooseOnly, aMacroDesc ); + ::rtl::OUString aScriptURL = basctl::ChooseMacro( aDocument, bChooseOnly, aMacroDesc ); rtl_uString* pScriptURL = aScriptURL.pData; rtl_uString_acquire( pScriptURL ); @@ -64,31 +67,23 @@ extern "C" { SAL_DLLPUBLIC_EXPORT void basicide_macro_organizer( sal_Int16 nTabId ) { OSL_TRACE("in basicide_macro_organizer"); - BasicIDE::Organize( nTabId ); + basctl::Organize( nTabId ); } } -namespace BasicIDE -{ //---------------------------------------------------------------------------- void Organize( sal_Int16 tabId ) { - BasicIDEGlobals::ensure(); + EnsureIde(); - BasicEntryDescriptor aDesc; - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) - { - IDEBaseWindow* pCurWin = pIDEShell->GetCurWindow(); - if ( pCurWin ) + EntryDescriptor aDesc; + if (Shell* pShell = GetShell()) + if (BaseWindow* pCurWin = pShell->GetCurWindow()) aDesc = pCurWin->CreateEntryDescriptor(); - } Window* pParent = Application::GetDefDialogParent(); - OrganizeDialog* pDlg = new OrganizeDialog( pParent, tabId, aDesc ); - pDlg->Execute(); - delete pDlg; + OrganizeDialog(pParent, tabId, aDesc).Execute(); } //---------------------------------------------------------------------------- @@ -160,11 +155,17 @@ Sequence< ::rtl::OUString > GetMergedLibraryNames( const Reference< script::XLib //---------------------------------------------------------------------------- -bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rOldName, const ::rtl::OUString& rNewName ) +bool RenameModule ( + Window* pErrorParent, + const ScriptDocument& rDocument, + const ::rtl::OUString& rLibName, + const ::rtl::OUString& rOldName, + const ::rtl::OUString& rNewName +) { if ( !rDocument.hasModule( rLibName, rOldName ) ) { - OSL_FAIL( "BasicIDE::RenameModule: old module name is invalid!" ); + OSL_FAIL( "basctl::RenameModule: old module name is invalid!" ); return false; } @@ -186,9 +187,9 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const if ( !rDocument.renameModule( rLibName, rOldName, rNewName ) ) return false; - if (BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell()) + if (Shell* pShell = GetShell()) { - if (basctl::ModulWindow* pWin = pIDEShell->FindBasWin(rDocument, rLibName, rNewName, false, true)) + if (ModulWindow* pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true)) { // set new name in window pWin->SetName( rNewName ); @@ -197,14 +198,14 @@ bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const pWin->SetSbModule( (SbModule*)pWin->GetBasic()->FindModule( rNewName ) ); // update tabwriter - sal_uInt16 nId = pIDEShell->GetIDEWindowId( pWin ); + sal_uInt16 nId = pShell->GetWindowId( pWin ); DBG_ASSERT( nId, "No entry in Tabbar!" ); if ( nId ) { - BasicIDETabBar* pTabBar = (BasicIDETabBar*)pIDEShell->GetTabBar(); - pTabBar->SetPageText( nId, rNewName ); - pTabBar->Sort(); - pTabBar->MakeVisible( pTabBar->GetCurPageId() ); + TabBar& rTabBar = pShell->GetTabBar(); + rTabBar.SetPageText(nId, rNewName); + rTabBar.Sort(); + rTabBar.MakeVisible(rTabBar.GetCurPageId()); } } } @@ -250,7 +251,7 @@ namespace if ( pData->aDocument.isDocument() ) pUndoGuard.reset( new ::framework::DocumentUndoGuard( pData->aDocument.getDocument() ) ); - BasicIDE::RunMethod( pData->xMethod ); + RunMethod(pData->xMethod); return 1L; } @@ -262,9 +263,9 @@ namespace { (void)rMacroDesc; - BasicIDEGlobals::ensure(); + EnsureIde(); - BasicIDEGlobals::GetExtraData()->ChoosingMacro() = true; + GetExtraData()->ChoosingMacro() = true; String aScriptURL; bool bError = false; @@ -280,7 +281,7 @@ namespace short nRetValue = pChooser->Execute(); - BasicIDEGlobals::GetExtraData()->ChoosingMacro() = false; + GetExtraData()->ChoosingMacro() = false; switch ( nRetValue ) { @@ -296,21 +297,21 @@ namespace SbModule* pModule = pMethod->GetModule(); if ( !pModule ) { - SAL_WARN( "basctl.basicide", "BasicIDE::ChooseMacro: No Module found!" ); + SAL_WARN( "basctl.basicide", "basctl::ChooseMacro: No Module found!" ); break; } StarBASIC* pBasic = dynamic_cast<StarBASIC*>(pModule->GetParent()); if ( !pBasic ) { - SAL_WARN( "basctl.basicide", "BasicIDE::ChooseMacro: No Basic found!" ); + SAL_WARN( "basctl.basicide", "basctl::ChooseMacro: No Basic found!" ); break; } - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); + BasicManager* pBasMgr = FindBasicManager( pBasic ); if ( !pBasMgr ) { - SAL_WARN( "basctl.basicide", "BasicIDE::ChooseMacro: No BasicManager found!" ); + SAL_WARN( "basctl.basicide", "basctl::ChooseMacro: No BasicManager found!" ); break; } @@ -348,7 +349,7 @@ namespace xLimitToDocument.set( xScripts, UNO_QUERY ); if ( !xLimitToDocument.is() ) { - OSL_ENSURE( false, "BasicIDE::ChooseMacro: a script container which is no document!?" ); + OSL_ENSURE( false, "basctl::ChooseMacro: a script container which is no document!?" ); xLimitToDocument = rxLimitToDocument; } } @@ -432,7 +433,12 @@ Sequence< ::rtl::OUString > GetMethodNames( const ScriptDocument& rDocument, con //---------------------------------------------------------------------------- -bool HasMethod( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName, const ::rtl::OUString& rMethName ) +bool HasMethod ( + ScriptDocument const& rDocument, + rtl::OUString const& rLibName, + rtl::OUString const& rModName, + rtl::OUString const& rMethName +) { bool bHasMethod = false; @@ -452,7 +458,8 @@ bool HasMethod( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName return bHasMethod; } -} //namespace BasicIDE + //---------------------------------------------------------------------------- +} // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 731d4021a3cf..576ab8b2f521 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -52,6 +52,9 @@ #include <osl/process.h> #include <osl/file.hxx> +namespace basctl +{ + using namespace comphelper; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -63,20 +66,15 @@ using namespace ::com::sun::star::container; extern "C" { SAL_DLLPUBLIC_EXPORT long basicide_handle_basic_error( void* pPtr ) { - return BasicIDE::HandleBasicError( (StarBASIC*)pPtr ); + return HandleBasicError( (StarBASIC*)pPtr ); } } -namespace BasicIDE -{ //---------------------------------------------------------------------------- SbMethod* CreateMacro( SbModule* pModule, const String& rMacroName ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - + SfxDispatcher* pDispatcher = GetDispatcher(); if( pDispatcher ) { pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); @@ -131,15 +129,15 @@ SbMethod* CreateMacro( SbModule* pModule, const String& rMacroName ) // update module in library ScriptDocument aDocument( ScriptDocument::NoDocument ); StarBASIC* pBasic = dynamic_cast<StarBASIC*>(pModule->GetParent()); - DBG_ASSERT(pBasic, "BasicIDE::CreateMacro: No Basic found!"); + DBG_ASSERT(pBasic, "basctl::CreateMacro: No Basic found!"); if ( pBasic ) { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - DBG_ASSERT(pBasMgr, "BasicIDE::CreateMacro: No BasicManager found!"); + BasicManager* pBasMgr = FindBasicManager( pBasic ); + DBG_ASSERT(pBasMgr, "basctl::CreateMacro: No BasicManager found!"); if ( pBasMgr ) { aDocument = ScriptDocument::getDocumentForBasicManager( pBasMgr ); - OSL_ENSURE( aDocument.isValid(), "BasicIDE::CreateMacro: no document for the given BasicManager!" ); + OSL_ENSURE( aDocument.isValid(), "basctl::CreateMacro: no document for the given BasicManager!" ); if ( aDocument.isValid() ) { String aLibName = pBasic->GetName(); @@ -157,19 +155,25 @@ SbMethod* CreateMacro( SbModule* pModule, const String& rMacroName ) } if ( aDocument.isAlive() ) - BasicIDE::MarkDocumentModified( aDocument ); + MarkDocumentModified( aDocument ); return pMethod; } //---------------------------------------------------------------------------- -bool RenameDialog( Window* pErrorParent, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rOldName, const ::rtl::OUString& rNewName ) +bool RenameDialog ( + Window* pErrorParent, + ScriptDocument const& rDocument, + rtl::OUString const& rLibName, + rtl::OUString const& rOldName, + rtl::OUString const& rNewName +) throw(ElementExistException, NoSuchElementException) { if ( !rDocument.hasDialog( rLibName, rOldName ) ) { - OSL_FAIL( "BasicIDE::RenameDialog: old module name is invalid!" ); + OSL_FAIL( "basctl::RenameDialog: old module name is invalid!" ); return false; } @@ -188,8 +192,8 @@ bool RenameDialog( Window* pErrorParent, const ScriptDocument& rDocument, const return false; } - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - basctl::DialogWindow* pWin = pIDEShell ? pIDEShell->FindDlgWin(rDocument, rLibName, rOldName) : 0; + Shell* pShell = GetShell(); + DialogWindow* pWin = pShell ? pShell->FindDlgWin(rDocument, rLibName, rOldName) : 0; Reference< XNameContainer > xExistingDialog; if ( pWin ) xExistingDialog = pWin->GetEditor()->GetDialog(); @@ -209,14 +213,14 @@ bool RenameDialog( Window* pErrorParent, const ScriptDocument& rDocument, const pWin->UpdateBrowser(); // update tabwriter - sal_uInt16 nId = pIDEShell->GetIDEWindowId( pWin ); + sal_uInt16 nId = pShell->GetWindowId( pWin ); DBG_ASSERT( nId, "No entry in Tabbar!" ); if ( nId ) { - BasicIDETabBar* pTabBar = (BasicIDETabBar*)pIDEShell->GetTabBar(); - pTabBar->SetPageText( nId, rNewName ); - pTabBar->Sort(); - pTabBar->MakeVisible( pTabBar->GetCurPageId() ); + TabBar& rTabBar = pShell->GetTabBar(); + rTabBar.SetPageText( nId, rNewName ); + rTabBar.Sort(); + rTabBar.MakeVisible( rTabBar.GetCurPageId() ); } } return true; @@ -226,10 +230,9 @@ bool RenameDialog( Window* pErrorParent, const ScriptDocument& rDocument, const bool RemoveDialog( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) + if (Shell* pShell = GetShell()) { - if (basctl::DialogWindow* pDlgWin = pIDEShell->FindDlgWin(rDocument, rLibName, rDlgName)) + if (DialogWindow* pDlgWin = pShell->FindDlgWin(rDocument, rLibName, rDlgName)) { Reference< container::XNameContainer > xDialogModel = pDlgWin->GetDialog(); LocalizationMgr::removeResourceForDialog( rDocument, rLibName, rDlgName, xDialogModel ); @@ -260,7 +263,7 @@ BasicManager* FindBasicManager( StarBASIC* pLib ) ) { BasicManager* pBasicMgr = doc->getBasicManager(); - OSL_ENSURE( pBasicMgr, "BasicIDE::FindBasicManager: no basic manager for the document!" ); + OSL_ENSURE( pBasicMgr, "basctl::FindBasicManager: no basic manager for the document!" ); if ( !pBasicMgr ) continue; @@ -285,10 +288,10 @@ void MarkDocumentModified( const ScriptDocument& rDocument ) // does not have to come from a document... if ( rDocument.isApplication() ) { - if (BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell()) + if (Shell* pShell = GetShell()) { - pIDEShell->SetAppBasicModified(); - pIDEShell->UpdateObjectCatalog(); + pShell->SetAppBasicModified(); + pShell->UpdateObjectCatalog(); } } else @@ -296,8 +299,7 @@ void MarkDocumentModified( const ScriptDocument& rDocument ) rDocument.setDocumentModified(); } - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_SIGNATURE ); pBindings->Invalidate( SID_SAVEDOC ); @@ -319,26 +321,28 @@ void RunMethod( SbMethod* pMethod ) void StopBasic() { StarBASIC::Stop(); - BasicIDEShell* pShell = BasicIDEGlobals::GetShell(); - if ( pShell ) + if (Shell* pShell = GetShell()) { - IDEWindowTable& rWindows = pShell->GetIDEWindowTable(); - for( IDEWindowTable::const_iterator it = rWindows.begin(); it != rWindows.end(); ++it ) + Shell::WindowTable& rWindows = pShell->GetWindowTable(); + for (Shell::WindowTableIt it = rWindows.begin(); it != rWindows.end(); ++it ) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; // call BasicStopped manually because the Stop-Notify // might not get through otherwise pWin->BasicStopped(); } } - BasicIDE::BasicStopped(); + BasicStopped(); } //---------------------------------------------------------------------------- -void BasicStopped( bool* pbAppWindowDisabled, - bool* pbDispatcherLocked, sal_uInt16* pnWaitCount, - SfxUInt16Item** ppSWActionCount, SfxUInt16Item** ppSWLockViewCount ) +void BasicStopped( + bool* pbAppWindowDisabled, + bool* pbDispatcherLocked, + sal_uInt16* pnWaitCount, + SfxUInt16Item** ppSWActionCount, SfxUInt16Item** ppSWLockViewCount +) { // maybe there are some locks to be removed after an error // or an explicit cancelling of the basic... @@ -355,13 +359,12 @@ void BasicStopped( bool* pbAppWindowDisabled, *ppSWLockViewCount = 0; // AppWait ? - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if( pIDEShell ) + if (Shell* pShell = GetShell()) { sal_uInt16 nWait = 0; - while ( pIDEShell->GetViewFrame()->GetWindow().IsWait() ) + while ( pShell->GetViewFrame()->GetWindow().IsWait() ) { - pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); + pShell->GetViewFrame()->GetWindow().LeaveWait(); nWait++; } if ( pnWaitCount ) @@ -382,8 +385,7 @@ void BasicStopped( bool* pbAppWindowDisabled, void InvalidateDebuggerSlots() { - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_BASICSTOP ); pBindings->Update( SID_BASICSTOP ); @@ -408,25 +410,25 @@ void InvalidateDebuggerSlots() long HandleBasicError( StarBASIC* pBasic ) { - BasicIDEGlobals::ensure(); - BasicIDE::BasicStopped(); + EnsureIde(); + BasicStopped(); // no error output during macro choosing - if ( BasicIDEGlobals::GetExtraData()->ChoosingMacro() ) + if (GetExtraData()->ChoosingMacro()) return 1; - if ( BasicIDEGlobals::GetExtraData()->ShellInCriticalSection() ) + if (GetExtraData()->ShellInCriticalSection()) return 2; long nRet = 0; - BasicIDEShell* pIDEShell = 0; + Shell* pShell = 0; if ( SvtModuleOptions().IsBasicIDE() ) { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); + BasicManager* pBasMgr = FindBasicManager( pBasic ); if ( pBasMgr ) { bool bProtected = false; ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - OSL_ENSURE( aDocument.isValid(), "BasicIDE::HandleBasicError: no document for the given BasicManager!" ); + OSL_ENSURE( aDocument.isValid(), "basctl::HandleBasicError: no document for the given BasicManager!" ); if ( aDocument.isValid() ) { ::rtl::OUString aOULibName( pBasic->GetName() ); @@ -443,20 +445,20 @@ long HandleBasicError( StarBASIC* pBasic ) if ( !bProtected ) { - pIDEShell = BasicIDEGlobals::GetShell(); - if ( !pIDEShell ) + pShell = GetShell(); + if ( !pShell ) { SfxAllItemSet aArgs( SFX_APP()->GetPool() ); SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); SFX_APP()->ExecuteSlot( aRequest ); - pIDEShell = BasicIDEGlobals::GetShell(); + pShell = GetShell(); } } } } - if ( pIDEShell ) - nRet = pIDEShell->CallBasicErrorHdl( pBasic ); + if ( pShell ) + nRet = pShell->CallBasicErrorHdl( pBasic ); else ErrorHandler::HandleError( StarBASIC::GetErrorCode() ); @@ -470,17 +472,16 @@ SfxBindings* GetBindingsPtr() SfxBindings* pBindings = NULL; SfxViewFrame* pFrame = NULL; - if ( BasicIDEGlobals::GetShell() ) + if (Shell* pShell = GetShell()) { - pFrame = BasicIDEGlobals::GetShell()->GetViewFrame(); + pFrame = pShell->GetViewFrame(); } else { SfxViewFrame* pView = SfxViewFrame::GetFirst(); while ( pView ) { - SfxObjectShell* pObjShell = pView->GetObjectShell(); - if (dynamic_cast<BasicDocShell*>(pObjShell)) + if (dynamic_cast<DocShell*>(pView->GetObjectShell())) { pFrame = pView; break; @@ -494,7 +495,18 @@ SfxBindings* GetBindingsPtr() return pBindings; } -} //namespace BasicIDE +//---------------------------------------------------------------------------- +SfxDispatcher* GetDispatcher () +{ + if (Shell* pShell = GetShell()) + if (SfxViewFrame* pViewFrame = pShell->GetViewFrame()) + if (SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher()) + return pDispatcher; + return 0; +} + +//---------------------------------------------------------------------------- +} // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index 801560a6232a..40c84a2c99a3 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -49,6 +49,9 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/container/XNamed.hpp> +namespace basctl +{ + using namespace ::com::sun::star::uno; using namespace ::com::sun::star; @@ -87,102 +90,102 @@ sal_Int32 ModuleInfoHelper::getModuleType( const uno::Reference< container::XNa return nType; } -BasicEntry::~BasicEntry() -{ -} - -BasicDocumentEntry::BasicDocumentEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, BasicEntryType eType ) - :BasicEntry( eType ) - ,m_aDocument( rDocument ) - ,m_eLocation( eLocation ) -{ - OSL_ENSURE( m_aDocument.isValid(), "BasicDocumentEntry::BasicDocumentEntry: illegal document!" ); -} - -BasicDocumentEntry::~BasicDocumentEntry() -{ -} - -BasicLibEntry::BasicLibEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, BasicEntryType eType ) - :BasicDocumentEntry( rDocument, eLocation, eType ) - ,m_aLibName( rLibName ) -{ -} - -BasicLibEntry::~BasicLibEntry() -{ -} - -BasicEntryDescriptor::BasicEntryDescriptor() - :m_aDocument( ScriptDocument::getApplicationScriptDocument() ) - ,m_eLocation( LIBRARY_LOCATION_UNKNOWN ) - ,m_eType( OBJ_TYPE_UNKNOWN ) -{ -} - -BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, const ::rtl::OUString& rLibSubName, const ::rtl::OUString& rName, BasicEntryType eType ) - :m_aDocument( rDocument ) - ,m_eLocation( eLocation ) - ,m_aLibName( rLibName ) - ,m_aLibSubName( rLibSubName ) - ,m_aName( rName ) - ,m_eType( eType ) -{ - OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" ); -} - -BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, const ::rtl::OUString& rLibSubName, const ::rtl::OUString& rName, const ::rtl::OUString& rMethodName, BasicEntryType eType ) - :m_aDocument( rDocument ) - ,m_eLocation( eLocation ) - ,m_aLibName( rLibName ) - ,m_aLibSubName( rLibSubName ) - ,m_aName( rName ) - ,m_aMethodName( rMethodName ) - ,m_eType( eType ) -{ - OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" ); -} - -BasicEntryDescriptor::~BasicEntryDescriptor() -{ -} - -BasicEntryDescriptor::BasicEntryDescriptor( const BasicEntryDescriptor& rDesc ) - :m_aDocument( rDesc.m_aDocument ) - ,m_eLocation( rDesc.m_eLocation ) - ,m_aLibName( rDesc.m_aLibName ) - ,m_aLibSubName( rDesc.m_aLibSubName ) - ,m_aName( rDesc.m_aName ) - ,m_aMethodName( rDesc.m_aMethodName ) - ,m_eType( rDesc.m_eType ) -{ -} - -BasicEntryDescriptor& BasicEntryDescriptor::operator=( const BasicEntryDescriptor& rDesc ) -{ - m_aDocument = rDesc.m_aDocument; - m_eLocation = rDesc.m_eLocation; - m_aLibName = rDesc.m_aLibName; - m_aLibSubName = rDesc.m_aLibSubName; - m_aName = rDesc.m_aName; - m_aMethodName = rDesc.m_aMethodName; - m_eType = rDesc.m_eType; - - return *this; -} - -bool BasicEntryDescriptor::operator==( const BasicEntryDescriptor& rDesc ) const -{ - return m_aDocument == rDesc.m_aDocument && - m_eLocation == rDesc.m_eLocation && - m_aLibName == rDesc.m_aLibName && - m_aLibSubName == rDesc.m_aLibSubName && - m_aName == rDesc.m_aName && - m_aMethodName == rDesc.m_aMethodName && - m_eType == rDesc.m_eType; -} - -BasicTreeListBox::BasicTreeListBox( Window* pParent, const ResId& rRes ) : +Entry::~Entry() +{ } + +DocumentEntry::DocumentEntry ( + ScriptDocument const& rDocument, + LibraryLocation eLocation, + EntryType eType +) : + Entry(eType), + m_aDocument(rDocument), + m_eLocation(eLocation) +{ + OSL_ENSURE( m_aDocument.isValid(), "DocumentEntry::DocumentEntry: illegal document!" ); +} + +DocumentEntry::~DocumentEntry() +{ } + +LibEntry::LibEntry ( + ScriptDocument const& rDocument, + LibraryLocation eLocation, + rtl::OUString const& rLibName, + EntryType eType +) : + DocumentEntry(rDocument, eLocation, eType), + m_aLibName(rLibName) +{ } + +LibEntry::~LibEntry() +{ } + +EntryDescriptor::EntryDescriptor () : + m_aDocument(ScriptDocument::getApplicationScriptDocument()), + m_eLocation(LIBRARY_LOCATION_UNKNOWN), + m_eType(OBJ_TYPE_UNKNOWN) +{ } + +EntryDescriptor::EntryDescriptor ( + ScriptDocument const& rDocument, + LibraryLocation eLocation, + rtl::OUString const& rLibName, + rtl::OUString const& rLibSubName, + rtl::OUString const& rName, + EntryType eType +) : + m_aDocument(rDocument), + m_eLocation(eLocation), + m_aLibName(rLibName), + m_aLibSubName(rLibSubName), + m_aName(rName), + m_eType(eType) +{ + OSL_ENSURE( m_aDocument.isValid(), "EntryDescriptor::EntryDescriptor: invalid document!" ); +} + +EntryDescriptor::EntryDescriptor ( + ScriptDocument const& rDocument, + LibraryLocation eLocation, + rtl::OUString const& rLibName, + rtl::OUString const& rLibSubName, + rtl::OUString const& rName, + rtl::OUString const& rMethodName, + EntryType eType +) : + m_aDocument(rDocument), + m_eLocation(eLocation), + m_aLibName(rLibName), + m_aLibSubName(rLibSubName), + m_aName(rName), + m_aMethodName(rMethodName), + m_eType(eType) +{ + OSL_ENSURE( m_aDocument.isValid(), "EntryDescriptor::EntryDescriptor: invalid document!" ); +} + +EntryDescriptor::~EntryDescriptor() +{ } + +bool EntryDescriptor::operator == (EntryDescriptor const& rDesc) const +{ + return + m_aDocument == rDesc.m_aDocument && + m_eLocation == rDesc.m_eLocation && + m_aLibName == rDesc.m_aLibName && + m_aLibSubName == rDesc.m_aLibSubName && + m_aName == rDesc.m_aName && + m_aMethodName == rDesc.m_aMethodName && + m_eType == rDesc.m_eType; +} + +// +// TreeListBox +// =========== +// + +TreeListBox::TreeListBox (Window* pParent, ResId const& rRes) : SvTreeListBox( pParent, IDEResId( sal::static_int_cast<sal_uInt16>( rRes.GetId() ) ) ), m_aNotifier( *this ) { @@ -191,9 +194,7 @@ BasicTreeListBox::BasicTreeListBox( Window* pParent, const ResId& rRes ) : nMode = 0xFF; // everything } - - -BasicTreeListBox::~BasicTreeListBox() +TreeListBox::~TreeListBox () { m_aNotifier.dispose(); @@ -201,14 +202,14 @@ BasicTreeListBox::~BasicTreeListBox() SvLBoxEntry* pEntry = First(); while ( pEntry ) { - delete (BasicEntry*)pEntry->GetUserData(); + delete static_cast<Entry*>(pEntry->GetUserData()); pEntry = Next( pEntry ); } } -void BasicTreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) +void TreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) { - OSL_ENSURE( rDocument.isAlive(), "BasicTreeListBox::ScanEntry: illegal document!" ); + OSL_ENSURE( rDocument.isAlive(), "TreeListBox::ScanEntry: illegal document!" ); if ( !rDocument.isAlive() ) return; @@ -231,14 +232,15 @@ void BasicTreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocati aRootName, aImage, 0, true, - std::auto_ptr< BasicEntry >( new BasicDocumentEntry( rDocument, eLocation ) ) ); + std::auto_ptr<Entry>(new DocumentEntry(rDocument, eLocation)) + ); SAL_WNODEPRECATED_DECLARATIONS_POP } SetUpdateMode(true); } -void BasicTreeListBox::ImpCreateLibEntries( SvLBoxEntry* pDocumentRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation ) +void TreeListBox::ImpCreateLibEntries( SvLBoxEntry* pDocumentRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation ) { // get a sorted list of library names Sequence< ::rtl::OUString > aLibNames( rDocument.getLibraryNames() ); @@ -295,13 +297,14 @@ void BasicTreeListBox::ImpCreateLibEntries( SvLBoxEntry* pDocumentRootEntry, con aLibName, Image( IDEResId( nId ) ), pDocumentRootEntry, true, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_LIBRARY ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_LIBRARY)) + ); } } } } -void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName ) +void TreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName ) { // modules if ( nMode & BROWSEMODE_MODULES ) @@ -330,12 +333,13 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const aModName, Image( IDEResId( RID_IMG_MODULE ) ), pLibRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_MODULE)) + ); // methods if ( nMode & BROWSEMODE_SUBS ) { - Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); + Sequence< ::rtl::OUString > aNames = GetMethodNames( rDocument, rLibName, aModName ); sal_Int32 nCount = aNames.getLength(); const ::rtl::OUString* pNames = aNames.getConstArray(); @@ -348,7 +352,8 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const aName, Image( IDEResId( RID_IMG_MACRO ) ), pModuleEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_METHOD)) + ); } } } @@ -384,7 +389,8 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const aDlgName, Image( IDEResId( RID_IMG_DIALOG ) ), pLibRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_DIALOG ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_DIALOG)) + ); } } catch (const container::NoSuchElementException& ) @@ -395,20 +401,20 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const } } -void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName ) +void TreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName ) { - ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > > aEntries; + std::vector<std::pair<EntryType, rtl::OUString> > aEntries; aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, IDE_RESSTR(RID_STR_DOCUMENT_OBJECTS) ) ); aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, IDE_RESSTR(RID_STR_USERFORMS) ) ); aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, IDE_RESSTR(RID_STR_NORMAL_MODULES) ) ); aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, IDE_RESSTR(RID_STR_CLASS_MODULES) ) ); - ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter; + std::vector<std::pair<EntryType, rtl::OUString> >::iterator iter; for( iter = aEntries.begin(); iter != aEntries.end(); ++iter ) { - BasicEntryType eType = iter->first; - ::rtl::OUString aEntryName = iter->second; + EntryType eType = iter->first; + rtl::OUString aEntryName = iter->second; SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType ); if( pLibSubRootEntry ) { @@ -422,12 +428,13 @@ void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEnt aEntryName, Image( IDEResId( RID_IMG_MODLIB ) ), pLibRootEntry, true, - std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) ); + std::auto_ptr<Entry>(new Entry(eType)) + ); } } } -void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName ) +void TreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const ::rtl::OUString& rLibName ) { uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName ); if( !xLib.is() ) @@ -440,13 +447,13 @@ void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubR sal_Int32 nModCount = aModNames.getLength(); const ::rtl::OUString* pModNames = aModNames.getConstArray(); - BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) ); - BasicEntryType eCurrentType( aDesc.GetType() ); + EntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) ); + EntryType eCurrentType( aDesc.GetType() ); for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) { ::rtl::OUString aModName = pModNames[ i ]; - BasicEntryType eType = OBJ_TYPE_UNKNOWN; + EntryType eType = OBJ_TYPE_UNKNOWN; switch( ModuleInfoHelper::getModuleType( xLib, aModName ) ) { case script::ModuleType::DOCUMENT: @@ -486,12 +493,13 @@ void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubR aEntryName, Image( IDEResId( RID_IMG_MODULE ) ), pLibSubRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_MODULE)) + ); // methods if ( nMode & BROWSEMODE_SUBS ) { - Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); + Sequence< ::rtl::OUString > aNames = GetMethodNames( rDocument, rLibName, aModName ); sal_Int32 nCount = aNames.getLength(); const ::rtl::OUString* pNames = aNames.getConstArray(); @@ -504,7 +512,8 @@ void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubR aName, Image( IDEResId( RID_IMG_MACRO ) ), pModuleEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_METHOD)) + ); } } } @@ -515,7 +524,7 @@ void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubR } } -SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const ::rtl::OUString& rText ) +SvLBoxEntry* TreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const ::rtl::OUString& rText ) { sal_uLong nRootPos = 0; SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos ); @@ -529,37 +538,37 @@ SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const ::rtl:: return 0; } -void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) +void TreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) { UpdateEntries(); } -void BasicTreeListBox::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) +void TreeListBox::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) { UpdateEntries(); } -void BasicTreeListBox::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) +void TreeListBox::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) { // not interested in } -void BasicTreeListBox::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) +void TreeListBox::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) { // not interested in } -void BasicTreeListBox::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) +void TreeListBox::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) { // not interested in } -void BasicTreeListBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) +void TreeListBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) { UpdateEntries(); } -void BasicTreeListBox::onDocumentClosed( const ScriptDocument& rDocument ) +void TreeListBox::onDocumentClosed( const ScriptDocument& rDocument ) { UpdateEntries(); // The document is not yet actually deleted, so we need to remove its entry @@ -567,19 +576,19 @@ void BasicTreeListBox::onDocumentClosed( const ScriptDocument& rDocument ) RemoveEntry(rDocument); } -void BasicTreeListBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) +void TreeListBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) { // not interested in } -void BasicTreeListBox::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ ) +void TreeListBox::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ ) { // not interested in } -void BasicTreeListBox::UpdateEntries() +void TreeListBox::UpdateEntries() { - BasicEntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) ); + EntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) ); // removing the invalid entries SvLBoxEntry* pLastValid = 0; @@ -599,16 +608,16 @@ void BasicTreeListBox::UpdateEntries() } // Removes the entry from the tree. -void BasicTreeListBox::RemoveEntry (SvLBoxEntry* pEntry) +void TreeListBox::RemoveEntry (SvLBoxEntry* pEntry) { // removing the associated user data - delete (BasicEntry*)pEntry->GetUserData(); + delete static_cast<Entry*>(pEntry->GetUserData()); // removing the entry GetModel()->Remove( pEntry ); } // Removes the entry of rDocument. -void BasicTreeListBox::RemoveEntry (ScriptDocument const& rDocument) +void TreeListBox::RemoveEntry (ScriptDocument const& rDocument) { // finding the entry of rDocument for (SvLBoxEntry* pEntry = First(); pEntry; pEntry = Next(pEntry)) @@ -619,27 +628,27 @@ void BasicTreeListBox::RemoveEntry (ScriptDocument const& rDocument) } } -SvLBoxEntry* BasicTreeListBox::CloneEntry( SvLBoxEntry* pSource ) +SvLBoxEntry* TreeListBox::CloneEntry( SvLBoxEntry* pSource ) { SvLBoxEntry* pNew = SvTreeListBox::CloneEntry( pSource ); - BasicEntry* pUser = (BasicEntry*)pSource->GetUserData(); + Entry* pUser = static_cast<Entry*>(pSource->GetUserData()); DBG_ASSERT( pUser, "User-Daten?!" ); - DBG_ASSERT( pUser->GetType() != OBJ_TYPE_DOCUMENT, "BasicTreeListBox::CloneEntry: document?!" ); + DBG_ASSERT( pUser->GetType() != OBJ_TYPE_DOCUMENT, "TreeListBox::CloneEntry: document?!" ); - BasicEntry* pNewUser = new BasicEntry( *pUser ); + Entry* pNewUser = new Entry( *pUser ); pNew->SetUserData( pNewUser ); return pNew; } -SvLBoxEntry* BasicTreeListBox::FindEntry( SvLBoxEntry* pParent, const ::rtl::OUString& rText, BasicEntryType eType ) +SvLBoxEntry* TreeListBox::FindEntry( SvLBoxEntry* pParent, const ::rtl::OUString& rText, EntryType eType ) { sal_uLong nRootPos = 0; SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos ); while ( pEntry ) { - BasicEntry* pBasicEntry = (BasicEntry*)pEntry->GetUserData(); - DBG_ASSERT( pBasicEntry, "FindEntry: Kein BasicEntry ?!" ); + Entry* pBasicEntry = static_cast<Entry*>(pEntry->GetUserData()); + DBG_ASSERT( pBasicEntry, "FindEntry: no Entry ?!" ); if ( ( pBasicEntry->GetType() == eType ) && ( rText.equals(GetEntryText( pEntry )) ) ) return pEntry; @@ -648,16 +657,16 @@ SvLBoxEntry* BasicTreeListBox::FindEntry( SvLBoxEntry* pParent, const ::rtl::OUS return 0; } -long BasicTreeListBox::ExpandingHdl() +long TreeListBox::ExpandingHdl() { // expanding or collapsing? bool bOK = true; if ( GetModel()->GetDepth( GetHdlEntry() ) == 1 ) { SvLBoxEntry* pCurEntry = GetCurEntry(); - BasicEntryDescriptor aDesc( GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc( GetEntryDescriptor( pCurEntry ) ); ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::ExpandingHdl: no document, or document is dead!" ); + OSL_ENSURE( aDocument.isAlive(), "TreeListBox::ExpandingHdl: no document, or document is dead!" ); if ( aDocument.isAlive() ) { ::rtl::OUString aLibName( aDesc.GetLibName() ); @@ -684,14 +693,14 @@ long BasicTreeListBox::ExpandingHdl() return bOK; } -bool BasicTreeListBox::IsEntryProtected( SvLBoxEntry* pEntry ) +bool TreeListBox::IsEntryProtected( SvLBoxEntry* pEntry ) { bool bProtected = false; if ( pEntry && ( GetModel()->GetDepth( pEntry ) == 1 ) ) { - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); + EntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::IsEntryProtected: no document, or document is dead!" ); + OSL_ENSURE( aDocument.isAlive(), "TreeListBox::IsEntryProtected: no document, or document is dead!" ); if ( aDocument.isAlive() ) { ::rtl::OUString aOULibName( aDesc.GetLibName() ); @@ -710,28 +719,29 @@ bool BasicTreeListBox::IsEntryProtected( SvLBoxEntry* pEntry ) } SAL_WNODEPRECATED_DECLARATIONS_PUSH -SvLBoxEntry* BasicTreeListBox::AddEntry( - const ::rtl::OUString& rText, +SvLBoxEntry* TreeListBox::AddEntry( + rtl::OUString const& rText, const Image& rImage, SvLBoxEntry* pParent, bool bChildrenOnDemand, - std::auto_ptr< BasicEntry > aUserData + std::auto_ptr<Entry> aUserData ) { SvLBoxEntry* p = InsertEntry( rText, rImage, rImage, pParent, bChildrenOnDemand, LIST_APPEND, - aUserData.release() ); // XXX possible leak + aUserData.release() // XXX possible leak + ); return p; } SAL_WNODEPRECATED_DECLARATIONS_POP -void BasicTreeListBox::SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage ) +void TreeListBox::SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage ) { SetExpandedEntryBmp( pEntry, rImage ); SetCollapsedEntryBmp( pEntry, rImage ); } -LibraryType BasicTreeListBox::GetLibraryType() const +LibraryType TreeListBox::GetLibraryType() const { LibraryType eType = LIBRARY_TYPE_ALL; if ( ( nMode & BROWSEMODE_MODULES ) && !( nMode & BROWSEMODE_DIALOGS ) ) @@ -741,14 +751,14 @@ LibraryType BasicTreeListBox::GetLibraryType() const return eType; } -::rtl::OUString BasicTreeListBox::GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const +::rtl::OUString TreeListBox::GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const { return rDocument.getTitle( eLocation, GetLibraryType() ); } -void BasicTreeListBox::GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage ) +void TreeListBox::GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage ) { - OSL_ENSURE( rDocument.isValid(), "BasicTreeListBox::GetRootEntryBitmaps: illegal document!" ); + OSL_ENSURE( rDocument.isValid(), "TreeListBox::GetRootEntryBitmaps: illegal document!" ); if ( !rDocument.isValid() ) return; @@ -801,20 +811,21 @@ void BasicTreeListBox::GetRootEntryBitmaps( const ScriptDocument& rDocument, Ima } } -void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc ) +void TreeListBox::SetCurrentEntry (EntryDescriptor& rDesc) { SvLBoxEntry* pCurEntry = 0; - BasicEntryDescriptor aDesc( rDesc ); + EntryDescriptor aDesc = rDesc; if ( aDesc.GetType() == OBJ_TYPE_UNKNOWN ) { - aDesc = BasicEntryDescriptor( + aDesc = EntryDescriptor( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER, "Standard", - ::rtl::OUString(), ".", OBJ_TYPE_UNKNOWN ); + ::rtl::OUString(), ".", OBJ_TYPE_UNKNOWN + ); } - ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" ); - LibraryLocation eLocation( aDesc.GetLocation() ); + ScriptDocument aDocument = aDesc.GetDocument(); + OSL_ENSURE( aDocument.isValid(), "TreeListBox::SetCurrentEntry: invalid document!" ); + LibraryLocation eLocation = aDesc.GetLocation(); SvLBoxEntry* pRootEntry = FindRootEntry( aDocument, eLocation ); if ( pRootEntry ) { @@ -841,7 +852,7 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc ) if ( !aName.isEmpty() ) { Expand( pCurEntry ); - BasicEntryType eType = OBJ_TYPE_MODULE; + EntryType eType = OBJ_TYPE_MODULE; if ( aDesc.GetType() == OBJ_TYPE_DIALOG ) eType = OBJ_TYPE_DIALOG; SvLBoxEntry* pEntry = FindEntry( pCurEntry, aName, eType ); @@ -891,19 +902,16 @@ void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc ) SetCurEntry( pCurEntry ); } -void BasicTreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) +void TreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) { SvTreeListBox::MouseButtonDown( rMEvt ); if ( rMEvt.IsLeft() && ( rMEvt.GetClicks() == 2 ) ) { - BasicEntryDescriptor aDesc( GetEntryDescriptor( GetCurEntry() ) ); + EntryDescriptor aDesc( GetEntryDescriptor( GetCurEntry() ) ); if ( aDesc.GetType() == OBJ_TYPE_METHOD ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) + if (SfxDispatcher* pDispatcher = GetDispatcher()) { SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), aDesc.GetName(), aDesc.GetMethodName(), ConvertType( aDesc.GetType() ) ); @@ -914,4 +922,7 @@ void BasicTreeListBox::MouseButtonDown( const MouseEvent& rMEvt ) } } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx index 397be358215f..0178fa829d0d 100644 --- a/basctl/source/basicide/bastype2.hxx +++ b/basctl/source/basicide/bastype2.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASTYPE2_HXX -#define _BASTYPE2_HXX +#ifndef BASCTL_BASTYPE2_HXX +#define BASCTL_BASTYPE2_HXX #include "doceventnotifier.hxx" @@ -30,7 +30,14 @@ #include <sbxitem.hxx> #include "basobj.hxx" -enum BasicEntryType +class SbModule; +class SvLBoxEntry; +class SbxVariable; + +namespace basctl +{ + +enum EntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, @@ -48,74 +55,88 @@ enum BasicEntryType #define BROWSEMODE_SUBS 0x02 #define BROWSEMODE_DIALOGS 0x04 -class SbModule; -class SvLBoxEntry; -class SbxVariable; - - -class BasicEntry +class Entry { private: - BasicEntryType m_eType; + EntryType m_eType; public: - BasicEntry( BasicEntryType eType ) { m_eType = eType; } - BasicEntry( const BasicEntry& r ) { m_eType = r.m_eType; } - virtual ~BasicEntry(); + Entry (EntryType eType) : m_eType(eType) { } + virtual ~Entry (); - BasicEntryType GetType() const { return m_eType; } + EntryType GetType () const { return m_eType; } }; -class BasicDocumentEntry : public BasicEntry +class DocumentEntry : public Entry { private: ScriptDocument m_aDocument; LibraryLocation m_eLocation; public: - BasicDocumentEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, BasicEntryType eType = OBJ_TYPE_DOCUMENT ); - virtual ~BasicDocumentEntry(); - - const ScriptDocument& - GetDocument() const { return m_aDocument; } + DocumentEntry ( + ScriptDocument const& rDocument, + LibraryLocation eLocation, + EntryType eType = OBJ_TYPE_DOCUMENT + ); + virtual ~DocumentEntry (); + + ScriptDocument const& GetDocument() const { return m_aDocument; } LibraryLocation GetLocation() const { return m_eLocation; } }; -class BasicLibEntry : public BasicDocumentEntry +class LibEntry : public DocumentEntry { private: - ::rtl::OUString m_aLibName; + rtl::OUString m_aLibName; public: - BasicLibEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, BasicEntryType eType = OBJ_TYPE_LIBRARY ); - virtual ~BasicLibEntry(); - - const ::rtl::OUString& GetLibName() const { return m_aLibName; } + LibEntry ( + ScriptDocument const& rDocument, + LibraryLocation eLocation, + rtl::OUString const& rLibName, + EntryType eType = OBJ_TYPE_LIBRARY + ); + virtual ~LibEntry (); + + rtl::OUString const& GetLibName () const { return m_aLibName; } }; -class BasicEntryDescriptor +class EntryDescriptor { - ScriptDocument m_aDocument; - LibraryLocation m_eLocation; - ::rtl::OUString m_aLibName; - ::rtl::OUString m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules - ::rtl::OUString m_aName; - ::rtl::OUString m_aMethodName; - BasicEntryType m_eType; + ScriptDocument m_aDocument; + LibraryLocation m_eLocation; + rtl::OUString m_aLibName; + rtl::OUString m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules + rtl::OUString m_aName; + rtl::OUString m_aMethodName; + EntryType m_eType; public: - BasicEntryDescriptor(); - BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, const ::rtl::OUString& rLibSubName, const ::rtl::OUString& rName, BasicEntryType eType ); - BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const ::rtl::OUString& rLibName, const ::rtl::OUString& rLibSubName, const ::rtl::OUString& rName, const ::rtl::OUString& rMethodName, BasicEntryType eType ); - virtual ~BasicEntryDescriptor(); - - BasicEntryDescriptor( const BasicEntryDescriptor& rDesc ); - BasicEntryDescriptor& operator=( const BasicEntryDescriptor& rDesc ); - bool operator==( const BasicEntryDescriptor& rDesc ) const; - - const ScriptDocument& - GetDocument() const { return m_aDocument; } - void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } + EntryDescriptor (); + EntryDescriptor ( + ScriptDocument const& rDocument, + LibraryLocation eLocation, + rtl::OUString const& rLibName, + rtl::OUString const& rLibSubName, + rtl::OUString const& rName, + EntryType eType + ); + EntryDescriptor ( + ScriptDocument const& rDocument, + LibraryLocation eLocation, + rtl::OUString const& rLibName, + rtl::OUString const& rLibSubName, + rtl::OUString const& rName, + rtl::OUString const& rMethodName, + EntryType eType + ); + virtual ~EntryDescriptor (); + + bool operator == (EntryDescriptor const& rDesc) const; + + ScriptDocument const& GetDocument() const { return m_aDocument; } + void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } LibraryLocation GetLocation() const { return m_eLocation; } void SetLocation( LibraryLocation eLocation ) { m_eLocation = eLocation; } @@ -132,28 +153,27 @@ public: const ::rtl::OUString& GetMethodName() const { return m_aMethodName; } void SetMethodName( const ::rtl::OUString& aMethodName ) { m_aMethodName = aMethodName; } - BasicEntryType GetType() const { return m_eType; } - void SetType( BasicEntryType eType ) { m_eType = eType; } + EntryType GetType() const { return m_eType; } + void SetType( EntryType eType ) { m_eType = eType; } }; /************************************************************ - Classification of types and pointers in the BasicEntries: + Classification of types and pointers in the Entries: - OBJ_TYPE_DOCUMENT BasicDocumentEntry - OBJ_TYPE_LIBRARY BasicEntry - OBJ_TYPE_MODULE BasicEntry - OBJ_TYPE_DIALOG BasicEntry - OBJ_TYPE_METHOD BasicEntry + OBJ_TYPE_DOCUMENT DocumentEntry + OBJ_TYPE_LIBRARY Entry + OBJ_TYPE_MODULE Entry + OBJ_TYPE_DIALOG Entry + OBJ_TYPE_METHOD Entry **************************************************************/ -class BasicTreeListBox :public SvTreeListBox - ,public ::basctl::DocumentEventListener +class TreeListBox : public SvTreeListBox, public DocumentEventListener { private: - sal_uInt16 nMode; - ::basctl::DocumentEventNotifier m_aNotifier; + sal_uInt16 nMode; + DocumentEventNotifier m_aNotifier; void SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage ); virtual void MouseButtonDown( const MouseEvent& rMEvt ); @@ -182,8 +202,8 @@ protected: virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ); public: - BasicTreeListBox( Window* pParent, const ResId& rRes ); - ~BasicTreeListBox(); + TreeListBox( Window* pParent, const ResId& rRes ); + ~TreeListBox(); void ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ); void ScanAllEntries(); @@ -197,28 +217,32 @@ public: SbModule* FindModule( SvLBoxEntry* pEntry ); SbxVariable* FindVariable( SvLBoxEntry* pEntry ); SvLBoxEntry* FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ); - SvLBoxEntry* FindEntry( SvLBoxEntry* pParent, const ::rtl::OUString& rText, BasicEntryType eType ); + SvLBoxEntry* FindEntry( SvLBoxEntry* pParent, const ::rtl::OUString& rText, EntryType eType ); - BasicEntryDescriptor GetEntryDescriptor( SvLBoxEntry* pEntry ); + EntryDescriptor GetEntryDescriptor( SvLBoxEntry* pEntry ); - BasicIDEType ConvertType( BasicEntryType eType ); + ItemType ConvertType (EntryType eType); bool IsValidEntry( SvLBoxEntry* pEntry ); - SvLBoxEntry* AddEntry( const ::rtl::OUString& rText, const Image& rImage, - SvLBoxEntry* pParent, bool bChildrenOnDemand, - std::auto_ptr< BasicEntry > aUserData ); + SvLBoxEntry* AddEntry( + const ::rtl::OUString& rText, const Image& rImage, + SvLBoxEntry* pParent, bool bChildrenOnDemand, + std::auto_ptr<Entry> aUserData + ); void RemoveEntry (SvLBoxEntry*); void RemoveEntry (ScriptDocument const&); ::rtl::OUString GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const; void GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage ); - void SetCurrentEntry( BasicEntryDescriptor& rDesc ); + void SetCurrentEntry (EntryDescriptor&); private: LibraryType GetLibraryType() const; }; -#endif // _BASTYPE2_HXX +} // namespace basctl + +#endif // BASCTL_BASTYPE2_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index bd5f3bcc0234..19ecab328f77 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -31,6 +31,9 @@ #include <deque> #include <sfx2/docfac.hxx> +namespace basctl +{ + using namespace ::com::sun::star::uno; using namespace ::com::sun::star; @@ -38,16 +41,16 @@ using namespace ::com::sun::star; typedef std::deque< SvLBoxEntry* > EntryArray; -void BasicTreeListBox::RequestingChildren( SvLBoxEntry* pEntry ) +void TreeListBox::RequestingChildren( SvLBoxEntry* pEntry ) { - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); - ScriptDocument aDocument( aDesc.GetDocument() ); - OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::RequestingChildren: invalid document!" ); + EntryDescriptor aDesc = GetEntryDescriptor(pEntry); + ScriptDocument aDocument = aDesc.GetDocument(); + OSL_ENSURE( aDocument.isAlive(), "basctl::TreeListBox::RequestingChildren: invalid document!" ); if ( !aDocument.isAlive() ) return; - LibraryLocation eLocation( aDesc.GetLocation() ); - BasicEntryType eType( aDesc.GetType() ); + LibraryLocation eLocation = aDesc.GetLocation(); + EntryType eType = aDesc.GetType(); if ( eType == OBJ_TYPE_DOCUMENT ) { @@ -111,7 +114,7 @@ void BasicTreeListBox::RequestingChildren( SvLBoxEntry* pEntry ) } else { - OSL_FAIL( "BasicTreeListBox::RequestingChildren: Error loading library!" ); + OSL_FAIL( "basctl::TreeListBox::RequestingChildren: Error loading library!" ); } } } @@ -124,11 +127,11 @@ void BasicTreeListBox::RequestingChildren( SvLBoxEntry* pEntry ) ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName ); } else { - OSL_FAIL( "BasicTreeListBox::RequestingChildren: Unknown Type!" ); + OSL_FAIL( "basctl::TreeListBox::RequestingChildren: Unknown Type!" ); } } -void BasicTreeListBox::ExpandedHdl() +void TreeListBox::ExpandedHdl() { SvLBoxEntry* pEntry = GetHdlEntry(); DBG_ASSERT( pEntry, "Was wurde zugeklappt?" ); @@ -144,7 +147,7 @@ void BasicTreeListBox::ExpandedHdl() } } -void BasicTreeListBox::ScanAllEntries() +void TreeListBox::ScanAllEntries() { ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER ); ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE ); @@ -160,7 +163,7 @@ void BasicTreeListBox::ScanAllEntries() } } -SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) +SbxVariable* TreeListBox::FindVariable( SvLBoxEntry* pEntry ) { if ( !pEntry ) return 0; @@ -183,7 +186,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) break; case 0: { - aDocument = static_cast<BasicDocumentEntry*>(pEntry->GetUserData())->GetDocument(); + aDocument = static_cast<DocumentEntry*>(pEntry->GetUserData())->GetDocument(); } break; } @@ -198,7 +201,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) { SvLBoxEntry* pLE = aEntries[n]; DBG_ASSERT( pLE, "Can not find entry in array" ); - BasicEntry* pBE = static_cast<BasicEntry*>(pLE->GetUserData()); + Entry* pBE = static_cast<Entry*>(pLE->GetUserData()); DBG_ASSERT( pBE, "The data in the entry not found!" ); String aName( GetEntryText( pLE ) ); @@ -257,7 +260,7 @@ SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry ) return pVar; } -BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) +EntryDescriptor TreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) { ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() ); LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN; @@ -265,10 +268,10 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) String aLibSubName; String aName; String aMethodName; - BasicEntryType eType = OBJ_TYPE_UNKNOWN; + EntryType eType = OBJ_TYPE_UNKNOWN; if ( !pEntry ) - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); + return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); EntryArray aEntries; @@ -287,10 +290,10 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) break; case 0: { - if (BasicDocumentEntry* pBasicDocumentEntry = static_cast<BasicDocumentEntry*>(pEntry->GetUserData())) + if (DocumentEntry* pDocumentEntry = static_cast<DocumentEntry*>(pEntry->GetUserData())) { - aDocument = pBasicDocumentEntry->GetDocument(); - eLocation = pBasicDocumentEntry->GetLocation(); + aDocument = pDocumentEntry->GetDocument(); + eLocation = pDocumentEntry->GetLocation(); eType = OBJ_TYPE_DOCUMENT; } } @@ -305,7 +308,7 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) { SvLBoxEntry* pLE = aEntries[n]; DBG_ASSERT( pLE, "Entrie im Array nicht gefunden" ); - BasicEntry* pBE = static_cast<BasicEntry*>(pLE->GetUserData()); + Entry* pBE = static_cast<Entry*>(pLE->GetUserData()); DBG_ASSERT( pBE, "Keine Daten im Eintrag gefunden!" ); switch ( pBE->GetType() ) @@ -356,57 +359,34 @@ BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry ) } } - return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); + return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); } -BasicIDEType BasicTreeListBox::ConvertType( BasicEntryType eType ) +ItemType TreeListBox::ConvertType (EntryType eType) { - BasicIDEType nType = static_cast<BasicIDEType>(OBJ_TYPE_UNKNOWN); - - switch ( eType ) + switch (eType) { - case OBJ_TYPE_DOCUMENT: - { - nType = BASICIDE_TYPE_SHELL; - } - break; - case OBJ_TYPE_LIBRARY: - { - nType = BASICIDE_TYPE_LIBRARY; - } - break; - case OBJ_TYPE_MODULE: - { - nType = BASICIDE_TYPE_MODULE; - } - break; - case OBJ_TYPE_DIALOG: - { - nType = BASICIDE_TYPE_DIALOG; - } - break; - case OBJ_TYPE_METHOD: - { - nType = BASICIDE_TYPE_METHOD; - } - break; - default: ; + case OBJ_TYPE_DOCUMENT: return TYPE_SHELL; + case OBJ_TYPE_LIBRARY: return TYPE_LIBRARY; + case OBJ_TYPE_MODULE: return TYPE_MODULE; + case OBJ_TYPE_DIALOG: return TYPE_DIALOG; + case OBJ_TYPE_METHOD: return TYPE_METHOD; + default: + return static_cast<ItemType>(OBJ_TYPE_UNKNOWN); } - - return nType; } -bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry ) +bool TreeListBox::IsValidEntry( SvLBoxEntry* pEntry ) { bool bIsValid = false; - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); + EntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); ScriptDocument aDocument( aDesc.GetDocument() ); LibraryLocation eLocation( aDesc.GetLocation() ); String aLibName( aDesc.GetLibName() ); String aName( aDesc.GetName() ); String aMethodName( aDesc.GetMethodName() ); - BasicEntryType eType( aDesc.GetType() ); + EntryType eType( aDesc.GetType() ); switch ( eType ) { @@ -434,7 +414,7 @@ bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry ) break; case OBJ_TYPE_METHOD: { - bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName ); + bIsValid = HasMethod( aDocument, aLibName, aName, aMethodName ); } break; case OBJ_TYPE_DOCUMENT_OBJECTS: @@ -451,20 +431,20 @@ bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry ) return bIsValid; } -SbModule* BasicTreeListBox::FindModule( SvLBoxEntry* pEntry ) +SbModule* TreeListBox::FindModule( SvLBoxEntry* pEntry ) { return dynamic_cast<SbModule*>(FindVariable(pEntry)); } -SvLBoxEntry* BasicTreeListBox::FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) +SvLBoxEntry* TreeListBox::FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation ) { - OSL_ENSURE( rDocument.isValid(), "BasicTreeListBox::FindRootEntry: invalid document!" ); + OSL_ENSURE( rDocument.isValid(), "basctl::TreeListBox::FindRootEntry: invalid document!" ); sal_uLong nRootPos = 0; SvLBoxEntry* pRootEntry = GetEntry( nRootPos ); while ( pRootEntry ) { - DBG_ASSERT( static_cast<BasicEntry*>(pRootEntry->GetUserData())->GetType() == OBJ_TYPE_DOCUMENT, "Kein Shelleintrag?" ); - BasicDocumentEntry* pBDEntry = static_cast<BasicDocumentEntry*>(pRootEntry->GetUserData()); + DBG_ASSERT( static_cast<Entry*>(pRootEntry->GetUserData())->GetType() == OBJ_TYPE_DOCUMENT, "Kein Shelleintrag?" ); + DocumentEntry* pBDEntry = static_cast<DocumentEntry*>(pRootEntry->GetUserData()); if (pBDEntry && pBDEntry->GetDocument() == rDocument && pBDEntry->GetLocation() == eLocation) return pRootEntry; pRootEntry = GetEntry( ++nRootPos ); @@ -483,4 +463,7 @@ SvLBoxEntry* BasicTreeListBox::FindRootEntry( const ScriptDocument& rDocument, L return aName.makeStringAndClear(); } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastype3.hxx b/basctl/source/basicide/bastype3.hxx index b2228287188a..5d51783e8fd8 100644 --- a/basctl/source/basicide/bastype3.hxx +++ b/basctl/source/basicide/bastype3.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASTYPE3_HXX -#define _BASTYPE3_HXX +#ifndef BASCTL_BASTYPE3_HXX +#define BASCTL_BASTYPE3_HXX #include <svheader.hxx> @@ -27,6 +27,9 @@ #ifndef NO_SPECIALEDIT +namespace basctl +{ + class ExtendedEdit : public Edit { private: @@ -49,8 +52,10 @@ public: Accelerator& GetAccelerator() { return aAcc; } }; -#endif //NO_SPECIALEDIT +} // namespace basctl + +#endif // NO_SPECIALEDIT -#endif // _BASTYPE3_HXX +#endif // BASCTL_BASTYPE3_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index 616f281d62c3..1166221e0509 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -37,32 +37,38 @@ #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> +namespace basctl +{ + using namespace ::com::sun::star::uno; using namespace ::com::sun::star; -using ::std::vector; -using basctl::Layout; -DBG_NAME( IDEBaseWindow ) +// +// BaseWindow +// ========== +// + +DBG_NAME( BaseWindow ) -TYPEINIT0( IDEBaseWindow ) +TYPEINIT0( BaseWindow ) TYPEINIT1( SbxItem, SfxPoolItem ); -IDEBaseWindow::IDEBaseWindow( Window* pParent, const ScriptDocument& rDocument, ::rtl::OUString aLibName, ::rtl::OUString aName ) +BaseWindow::BaseWindow( Window* pParent, const ScriptDocument& rDocument, ::rtl::OUString aLibName, ::rtl::OUString aName ) :Window( pParent, WinBits( WB_3DLOOK ) ) ,m_aDocument( rDocument ) ,m_aLibName( aLibName ) ,m_aName( aName ) { - DBG_CTOR( IDEBaseWindow, 0 ); + DBG_CTOR( BaseWindow, 0 ); pShellHScrollBar = 0; pShellVScrollBar = 0; nStatus = 0; } -IDEBaseWindow::~IDEBaseWindow() +BaseWindow::~BaseWindow() { - DBG_DTOR( IDEBaseWindow, 0 ); + DBG_DTOR( BaseWindow, 0 ); if ( pShellVScrollBar ) pShellVScrollBar->SetScrollHdl( Link() ); if ( pShellHScrollBar ) @@ -71,27 +77,26 @@ IDEBaseWindow::~IDEBaseWindow() -void IDEBaseWindow::Init() +void BaseWindow::Init() { - DBG_CHKTHIS( IDEBaseWindow, 0 ); + DBG_CHKTHIS( BaseWindow, 0 ); if ( pShellVScrollBar ) - pShellVScrollBar->SetScrollHdl( LINK( this, IDEBaseWindow, ScrollHdl ) ); + pShellVScrollBar->SetScrollHdl( LINK( this, BaseWindow, ScrollHdl ) ); if ( pShellHScrollBar ) - pShellHScrollBar->SetScrollHdl( LINK( this, IDEBaseWindow, ScrollHdl ) ); + pShellHScrollBar->SetScrollHdl( LINK( this, BaseWindow, ScrollHdl ) ); DoInit(); // virtual... } -void IDEBaseWindow::DoInit() -{ -} +void BaseWindow::DoInit() +{ } -void IDEBaseWindow::GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ) +void BaseWindow::GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ) { - DBG_CHKTHIS( IDEBaseWindow, 0 ); + DBG_CHKTHIS( BaseWindow, 0 ); pShellHScrollBar = pHScroll; pShellVScrollBar = pVScroll; // Init(); // does not make sense, leads to flickering and errors... @@ -99,23 +104,23 @@ void IDEBaseWindow::GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll ) -IMPL_LINK_INLINE_START( IDEBaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) +IMPL_LINK_INLINE_START( BaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) { - DBG_CHKTHIS( IDEBaseWindow, 0 ); + DBG_CHKTHIS( BaseWindow, 0 ); DoScroll( pCurScrollBar ); return 0; } -IMPL_LINK_INLINE_END( IDEBaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) +IMPL_LINK_INLINE_END( BaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar ) -void IDEBaseWindow::ExecuteCommand (SfxRequest&) +void BaseWindow::ExecuteCommand (SfxRequest&) { } -void IDEBaseWindow::ExecuteGlobal (SfxRequest&) +void BaseWindow::ExecuteGlobal (SfxRequest&) { } -long IDEBaseWindow::Notify( NotifyEvent& rNEvt ) +long BaseWindow::Notify( NotifyEvent& rNEvt ) { long nDone = 0; @@ -132,10 +137,8 @@ long IDEBaseWindow::Notify( NotifyEvent& rNEvt ) { if ( aCode.IsMod1() ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) - pIDEShell->NextPage( nCode == KEY_PAGEUP ); - + if (Shell* pShell = GetShell()) + pShell->NextPage( nCode == KEY_PAGEUP ); nDone = 1; } } @@ -147,38 +150,38 @@ long IDEBaseWindow::Notify( NotifyEvent& rNEvt ) } -void IDEBaseWindow::DoScroll( ScrollBar* ) +void BaseWindow::DoScroll( ScrollBar* ) { - DBG_CHKTHIS( IDEBaseWindow, 0 ); + DBG_CHKTHIS( BaseWindow, 0 ); } -void IDEBaseWindow::StoreData() +void BaseWindow::StoreData() { } -bool IDEBaseWindow::CanClose() +bool BaseWindow::CanClose() { return true; } -bool IDEBaseWindow::AllowUndo() +bool BaseWindow::AllowUndo() { return true; } -void IDEBaseWindow::UpdateData() +void BaseWindow::UpdateData() { } -::rtl::OUString IDEBaseWindow::GetTitle() +::rtl::OUString BaseWindow::GetTitle() { return ::rtl::OUString(); } -::rtl::OUString IDEBaseWindow::CreateQualifiedName() +::rtl::OUString BaseWindow::CreateQualifiedName() { ::rtl::OUStringBuffer aName; if ( !m_aLibName.isEmpty() ) @@ -193,72 +196,68 @@ void IDEBaseWindow::UpdateData() return aName.makeStringAndClear(); } -void IDEBaseWindow::SetReadOnly (bool) +void BaseWindow::SetReadOnly (bool) { } -bool IDEBaseWindow::IsReadOnly () +bool BaseWindow::IsReadOnly () { return false; } -void IDEBaseWindow::BasicStarted() +void BaseWindow::BasicStarted() { } -void IDEBaseWindow::BasicStopped() +void BaseWindow::BasicStopped() { } -bool IDEBaseWindow::IsModified () +bool BaseWindow::IsModified () { return true; } -bool IDEBaseWindow::IsPasteAllowed () +bool BaseWindow::IsPasteAllowed () { return false; } -::svl::IUndoManager* IDEBaseWindow::GetUndoManager() +::svl::IUndoManager* BaseWindow::GetUndoManager() { return NULL; } -sal_uInt16 IDEBaseWindow::GetSearchOptions() +sal_uInt16 BaseWindow::GetSearchOptions() { return 0; } -sal_uInt16 IDEBaseWindow::StartSearchAndReplace (SvxSearchItem const&, bool bFromStart) +sal_uInt16 BaseWindow::StartSearchAndReplace (SvxSearchItem const&, bool bFromStart) { static_cast<void>(bFromStart); return 0; } -void IDEBaseWindow::OnNewDocument () +void BaseWindow::OnNewDocument () { } -void IDEBaseWindow::InsertLibInfo () const +void BaseWindow::InsertLibInfo () const { - if (BasicIDEData* pData = BasicIDEGlobals::GetExtraData()) - { - pData->GetLibInfos().InsertInfo( - new LibInfoItem(m_aDocument, m_aLibName, m_aName, GetType()) - ); - } + if (ExtraData* pData = GetExtraData()) + pData->GetLibInfos().InsertInfo(m_aDocument, m_aLibName, m_aName, GetType()); } -bool IDEBaseWindow::Is ( +bool BaseWindow::Is ( ScriptDocument const& rDocument, rtl::OUString const& rLibName, rtl::OUString const& rName, - BasicIDEType eType, bool bFindSuspended + ItemType eType, bool bFindSuspended ) { if (bFindSuspended || !IsSuspended()) { // any non-suspended window is ok - if (rLibName.isEmpty() || rName.isEmpty() || eType == BASICIDE_TYPE_UNKNOWN) + if (rLibName.isEmpty() || rName.isEmpty() || eType == TYPE_UNKNOWN) return true; // ok if the parameters match if (m_aDocument == rDocument && m_aLibName == rLibName && m_aName == rName && GetType() == eType) @@ -267,37 +266,37 @@ bool IDEBaseWindow::Is ( return false; } -bool IDEBaseWindow::HasActiveEditor () const +bool BaseWindow::HasActiveEditor () const { return false; } // -// BasicDockingWindow -// ================== +// DockingWindow +// ============= // -// style bits for BasicDockingWindow -WinBits const BasicDockingWindow::StyleBits = +// style bits for DockingWindow +WinBits const DockingWindow::StyleBits = WB_BORDER | WB_3DLOOK | WB_CLIPCHILDREN | WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_DOCKABLE; -BasicDockingWindow::BasicDockingWindow (Window* pParent) : - DockingWindow(pParent, StyleBits), +DockingWindow::DockingWindow (Window* pParent) : + ::DockingWindow(pParent, StyleBits), pLayout(0), nShowCount(0) { } -BasicDockingWindow::BasicDockingWindow (Layout* pParent) : - DockingWindow(pParent, StyleBits), +DockingWindow::DockingWindow (Layout* pParent) : + ::DockingWindow(pParent, StyleBits), pLayout(pParent), nShowCount(0) { } // Sets the position and the size of the docking window. This property is saved // when the window is floating. Called by Layout. -void BasicDockingWindow::ResizeIfDocking (Point const& rPos, Size const& rSize) +void DockingWindow::ResizeIfDocking (Point const& rPos, Size const& rSize) { Rectangle const rRect(rPos, rSize); if (rRect != aDockingRect) @@ -312,7 +311,7 @@ void BasicDockingWindow::ResizeIfDocking (Point const& rPos, Size const& rSize) // Sets the parent Layout window. // The physical parent is set only when the window is docking. -void BasicDockingWindow::SetLayoutWindow (Layout* pLayout_) +void DockingWindow::SetLayoutWindow (Layout* pLayout_) { pLayout = pLayout_; if (!IsFloatingMode()) @@ -322,28 +321,28 @@ void BasicDockingWindow::SetLayoutWindow (Layout* pLayout_) // Increases the "show" reference count. // The window is shown when the reference count is positive. -void BasicDockingWindow::Show (bool bShow) // = true +void DockingWindow::Show (bool bShow) // = true { if (bShow) { if (++nShowCount == 1) - DockingWindow::Show(); + ::DockingWindow::Show(); } else { if (--nShowCount == 0) - DockingWindow::Hide(); + ::DockingWindow::Hide(); } } // Decreases the "show" reference count. // The window is hidden when the reference count reaches zero. -void BasicDockingWindow::Hide () +void DockingWindow::Hide () { Show(false); } -sal_Bool BasicDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) +sal_Bool DockingWindow::Docking( const Point& rPos, Rectangle& rRect ) { if (!IsDockingPrevented() && aDockingRect.IsInside(rPos)) { @@ -358,10 +357,10 @@ sal_Bool BasicDockingWindow::Docking( const Point& rPos, Rectangle& rRect ) } } -void BasicDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) +void DockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode ) { if ( bFloatMode ) - DockingWindow::EndDocking( rRect, bFloatMode ); + ::DockingWindow::EndDocking( rRect, bFloatMode ); else { SetFloatingMode(false); @@ -369,7 +368,7 @@ void BasicDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode } } -void BasicDockingWindow::ToggleFloatingMode() +void DockingWindow::ToggleFloatingMode() { if (IsFloatingMode()) { @@ -382,7 +381,7 @@ void BasicDockingWindow::ToggleFloatingMode() DockThis(); } -sal_Bool BasicDockingWindow::PrepareToggleFloatingMode() +sal_Bool DockingWindow::PrepareToggleFloatingMode() { if (IsFloatingMode()) { @@ -395,7 +394,7 @@ sal_Bool BasicDockingWindow::PrepareToggleFloatingMode() return true; } -void BasicDockingWindow::StartDocking() +void DockingWindow::StartDocking() { if (IsFloatingMode()) { @@ -406,7 +405,7 @@ void BasicDockingWindow::StartDocking() } } -void BasicDockingWindow::DockThis () +void DockingWindow::DockThis () { // resizing when floating -> docking if (!IsFloatingMode()) @@ -462,44 +461,33 @@ IMPL_LINK_INLINE_START( ExtendedEdit, EditAccHdl, Accelerator *, pAcc ) IMPL_LINK_INLINE_END( ExtendedEdit, EditAccHdl, Accelerator *, pAcc ) +// +// TabBar +// ======== +// -struct TabBarDDInfo -{ - sal_uLong npTabBar; - sal_uInt16 nPage; - - TabBarDDInfo() { npTabBar = 0; nPage = 0; } - TabBarDDInfo( sal_uLong _npTabBar, sal_uInt16 _nPage ) { npTabBar = _npTabBar; nPage = _nPage; } -}; - - -BasicIDETabBar::BasicIDETabBar( Window* pParent ) : - TabBar( pParent, WinBits( WB_3DLOOK | WB_SCROLL | WB_BORDER | WB_SIZEABLE | WB_DRAG ) ) +TabBar::TabBar( Window* pParent ) : + ::TabBar( pParent, WinBits( WB_3DLOOK | WB_SCROLL | WB_BORDER | WB_SIZEABLE | WB_DRAG ) ) { EnableEditMode(true); SetHelpId( HID_BASICIDE_TABBAR ); } -void BasicIDETabBar::MouseButtonDown( const MouseEvent& rMEvt ) +void TabBar::MouseButtonDown( const MouseEvent& rMEvt ) { if ( rMEvt.IsLeft() && ( rMEvt.GetClicks() == 2 ) && !IsInEditMode() ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_MODULEDLG ); - } } else { - TabBar::MouseButtonDown( rMEvt ); + ::TabBar::MouseButtonDown( rMEvt ); // base class version } } -void BasicIDETabBar::Command( const CommandEvent& rCEvt ) +void TabBar::Command( const CommandEvent& rCEvt ) { if ( ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) && !IsInEditMode() ) { @@ -508,7 +496,7 @@ void BasicIDETabBar::Command( const CommandEvent& rCEvt ) { Point aP = PixelToLogic( aPos ); MouseEvent aMouseEvent( aP, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT ); - TabBar::MouseButtonDown( aMouseEvent ); + ::TabBar::MouseButtonDown( aMouseEvent ); // base class } PopupMenu aPopup( IDEResId( RID_POPUP_TABBAR ) ); @@ -526,11 +514,10 @@ void BasicIDETabBar::Command( const CommandEvent& rCEvt ) aPopup.EnableItem(SID_BASICIDE_MODULEDLG, false); } - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) + if (Shell* pShell = GetShell()) { - ScriptDocument aDocument( pIDEShell->GetCurDocument() ); - ::rtl::OUString aOULibName( pIDEShell->GetCurLibName() ); + ScriptDocument aDocument( pShell->GetCurDocument() ); + ::rtl::OUString aOULibName( pShell->GetCurLibName() ); Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY ); if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) || @@ -548,9 +535,9 @@ void BasicIDETabBar::Command( const CommandEvent& rCEvt ) { if (StarBASIC* pBasic = pBasMgr->GetLib(aOULibName)) { - IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); - IDEWindowTable::const_iterator it = aIDEWindowTable.find( GetCurPageId() ); - if (it != aIDEWindowTable.end() && dynamic_cast<basctl::ModulWindow*>(it->second)) + Shell::WindowTable& aWindowTable = pShell->GetWindowTable(); + Shell::WindowTableIt it = aWindowTable.find( GetCurPageId() ); + if (it != aWindowTable.end() && dynamic_cast<ModulWindow*>(it->second)) { SbModule* pActiveModule = (SbModule*)pBasic->FindModule( it->second->GetName() ); if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) ) @@ -563,18 +550,14 @@ void BasicIDETabBar::Command( const CommandEvent& rCEvt ) } } } - - - if (pIDEShell) - if (SfxViewFrame* pViewFrame = pIDEShell->GetViewFrame()) - if (SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher()) - pDispatcher->Execute(aPopup.Execute(this, aPos)); + if (SfxDispatcher* pDispatcher = GetDispatcher()) + pDispatcher->Execute(aPopup.Execute(this, aPos)); } } -long BasicIDETabBar::AllowRenaming() +long TabBar::AllowRenaming() { - bool const bValid = BasicIDE::IsValidSbxName( GetEditText() ); + bool const bValid = IsValidSbxName(GetEditText()); if ( !bValid ) ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); @@ -583,20 +566,15 @@ long BasicIDETabBar::AllowRenaming() } -void BasicIDETabBar::EndRenaming() +void TabBar::EndRenaming() { if ( !IsEditModeCanceled() ) { SfxUInt16Item aID( SID_BASICIDE_ARG_TABID, GetEditPageId() ); SfxStringItem aNewName( SID_BASICIDE_ARG_MODULENAME, GetEditText() ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_NAMECHANGEDONTAB, SFX_CALLMODE_SYNCHRON, &aID, &aNewName, 0L ); - } } } @@ -618,15 +596,14 @@ struct TabBarSortHelper } // namespace -void BasicIDETabBar::Sort() +void TabBar::Sort() { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) + if (Shell* pShell = GetShell()) { - IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); + Shell::WindowTable& aWindowTable = pShell->GetWindowTable(); TabBarSortHelper aTabBarSortHelper; - ::std::vector<TabBarSortHelper> aModuleList; - ::std::vector<TabBarSortHelper> aDialogList; + std::vector<TabBarSortHelper> aModuleList; + std::vector<TabBarSortHelper> aDialogList; sal_uInt16 nPageCount = GetPageCount(); sal_uInt16 i; @@ -636,13 +613,13 @@ void BasicIDETabBar::Sort() sal_uInt16 nId = GetPageId( i ); aTabBarSortHelper.nPageId = nId; aTabBarSortHelper.aPageText = GetPageText( nId ); - IDEBaseWindow* pWin = aIDEWindowTable[ nId ]; + BaseWindow* pWin = aWindowTable[ nId ]; - if (dynamic_cast<basctl::ModulWindow*>(pWin)) + if (dynamic_cast<ModulWindow*>(pWin)) { aModuleList.push_back( aTabBarSortHelper ); } - else if (dynamic_cast<basctl::DialogWindow*>(pWin)) + else if (dynamic_cast<DialogWindow*>(pWin)) { aDialogList.push_back( aTabBarSortHelper ); } @@ -743,109 +720,78 @@ sal_uLong CalcLineCount( SvStream& rStream ) return nCRs; } -LibInfoKey::LibInfoKey( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName ) - :m_aDocument( rDocument ) - ,m_aLibName( rLibName ) -{ -} +// +// LibInfos +// ======== +// -LibInfoKey::~LibInfoKey() -{ -} +LibInfos::LibInfos () +{ } -bool LibInfoKey::operator==( const LibInfoKey& rKey ) const -{ - bool bRet = false; - if ( m_aDocument == rKey.m_aDocument && m_aLibName == rKey.m_aLibName ) - bRet = true; - return bRet; -} +LibInfos::~LibInfos () +{ } -LibInfoItem::LibInfoItem( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rCurrentName, sal_uInt16 nCurrentType ) - :m_aDocument( rDocument ) - ,m_aLibName( rLibName ) - ,m_aCurrentName( rCurrentName ) - ,m_nCurrentType( nCurrentType ) +void LibInfos::InsertInfo ( + ScriptDocument const& rDocument, + rtl::OUString const& rLibName, + rtl::OUString const& rCurrentName, + ItemType eCurrentType +) { + Key aKey(rDocument, rLibName); + m_aMap.erase(aKey); + m_aMap.insert(Map::value_type(aKey, Item(rDocument, rLibName, rCurrentName, eCurrentType))); } -LibInfoItem::~LibInfoItem() +void LibInfos::RemoveInfoFor (ScriptDocument const& rDocument) { + Map::iterator it; + for (it = m_aMap.begin(); it != m_aMap.end(); ++it) + if (it->first.GetDocument() == rDocument) + break; + if (it != m_aMap.end()) + m_aMap.erase(it); } -LibInfoItem::LibInfoItem( const LibInfoItem& rItem ) - :m_aDocument( rItem.m_aDocument ) - ,m_aLibName( rItem.m_aLibName ) - ,m_aCurrentName( rItem.m_aCurrentName ) - ,m_nCurrentType( rItem.m_nCurrentType ) +LibInfos::Item const* LibInfos::GetInfo ( + ScriptDocument const& rDocument, rtl::OUString const& rLibName +) { + Map::iterator it = m_aMap.find(Key(rDocument, rLibName)); + return it != m_aMap.end() ? &it->second : 0; } -LibInfoItem& LibInfoItem::operator=( const LibInfoItem& rItem ) -{ - m_aDocument = rItem.m_aDocument; - m_aLibName = rItem.m_aLibName; - m_aCurrentName = rItem.m_aCurrentName; - m_nCurrentType = rItem.m_nCurrentType; - - return *this; -} +LibInfos::Key::Key (ScriptDocument const& rDocument, rtl::OUString const& rLibName) : + m_aDocument(rDocument), m_aLibName(rLibName) +{ } -LibInfos::LibInfos() -{ -} +LibInfos::Key::~Key () +{ } -LibInfos::~LibInfos() +bool LibInfos::Key::operator == (Key const& rKey) const { - LibInfoMap::iterator end = m_aLibInfoMap.end(); - for ( LibInfoMap::iterator it = m_aLibInfoMap.begin(); it != end; ++it ) - delete it->second; - m_aLibInfoMap.clear(); + return m_aDocument == rKey.m_aDocument && m_aLibName == rKey.m_aLibName; } -void LibInfos::InsertInfo( LibInfoItem* pItem ) +size_t LibInfos::Key::Hash::operator () (Key const& rKey) const { - LibInfoKey aKey( pItem->GetDocument(), pItem->GetLibName() ); - LibInfoMap::iterator it = m_aLibInfoMap.find( aKey ); - if ( it != m_aLibInfoMap.end() ) - { - LibInfoItem* pI = it->second; - m_aLibInfoMap.erase( it ); - delete pI; - } - m_aLibInfoMap.insert( LibInfoMap::value_type( aKey, pItem ) ); + return rKey.m_aDocument.hashCode() + rKey.m_aLibName.hashCode(); } -void LibInfos::RemoveInfoFor( const ScriptDocument& _rDocument ) -{ - for ( LibInfoMap::iterator it = m_aLibInfoMap.begin(); - it != m_aLibInfoMap.end(); - ) - { - if ( it->first.GetDocument() != _rDocument ) - { - ++it; - continue; - } - - LibInfoItem* pItem = it->second; - - LibInfoMap::iterator next_it = it; ++next_it; - m_aLibInfoMap.erase( it ); - it = next_it; - - delete pItem; - } -} +LibInfos::Item::Item ( + ScriptDocument const& rDocument, + rtl::OUString const& rLibName, + rtl::OUString const& rCurrentName, + ItemType eCurrentType +) : + m_aDocument(rDocument), + m_aLibName(rLibName), + m_aCurrentName(rCurrentName), + m_eCurrentType(eCurrentType) +{ } -LibInfoItem* LibInfos::GetInfo( const LibInfoKey& rKey ) -{ - LibInfoItem* pItem = 0; - LibInfoMap::iterator it = m_aLibInfoMap.find( rKey ); - if ( it != m_aLibInfoMap.end() ) - pItem = it->second; - return pItem; -} +LibInfos::Item::~Item () +{ } bool QueryDel( const ::rtl::OUString& rName, const ResId& rId, Window* pParent ) { @@ -933,4 +879,7 @@ bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, return bOK; } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/breakpoint.cxx b/basctl/source/basicide/breakpoint.cxx index 5f95797da9a7..6af136525451 100644 --- a/basctl/source/basicide/breakpoint.cxx +++ b/basctl/source/basicide/breakpoint.cxx @@ -24,6 +24,9 @@ #include <stddef.h> +namespace basctl +{ + BreakPointList::BreakPointList() {} @@ -164,4 +167,7 @@ void BreakPointList::clear() { maBreakPoints.clear(); } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/breakpoint.hxx b/basctl/source/basicide/breakpoint.hxx index c99966e4ed84..39e70e27e236 100644 --- a/basctl/source/basicide/breakpoint.hxx +++ b/basctl/source/basicide/breakpoint.hxx @@ -17,14 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BREAKPOINT_HXX -#define _BREAKPOINT_HXX +#ifndef BASCTL_BREAKPOINT_HXX +#define BASCTL_BREAKPOINT_HXX #include <cstddef> #include <vector> class SbModule; +namespace basctl +{ + struct BreakPoint { bool bEnabled; @@ -66,6 +69,8 @@ public: BreakPoint* remove(BreakPoint* ptr); }; -#endif // _BREAKPOINT_HXX +} // namespace basctl + +#endif // BASCTL_BREAKPOINT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx index 2fbc61f70bb4..5ee425e6dc37 100644 --- a/basctl/source/basicide/brkdlg.cxx +++ b/basctl/source/basicide/brkdlg.cxx @@ -29,9 +29,15 @@ #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> +namespace basctl +{ + // FIXME Why does BreakPointDialog allow only sal_uInt16 for break-point line // numbers, whereas BreakPoint supports sal_uLong? +namespace +{ + bool lcl_ParseText(rtl::OUString const &rText, size_t& rLineNr ) { // aText should look like "# n" where @@ -54,6 +60,8 @@ bool lcl_ParseText(rtl::OUString const &rText, size_t& rLineNr ) return true; } +} // namespace + BreakPointDialog::BreakPointDialog( Window* pParent, BreakPointList& rBrkPntList ) : ModalDialog( pParent, IDEResId( RID_BASICIDE_BREAKPOINTDLG ) ), aComboBox( this, IDEResId( RID_CB_BRKPOINTS ) ), @@ -130,7 +138,7 @@ void BreakPointDialog::CheckButtons() } } -IMPL_LINK_INLINE_START( BreakPointDialog, CheckBoxHdl, CheckBox *, pChkBx ) +IMPL_LINK_INLINE_START( BreakPointDialog, CheckBoxHdl, ::CheckBox *, pChkBx ) { BreakPoint* pBrk = GetSelectedBreakPoint(); if ( pBrk ) @@ -138,7 +146,7 @@ IMPL_LINK_INLINE_START( BreakPointDialog, CheckBoxHdl, CheckBox *, pChkBx ) return 0; } -IMPL_LINK_INLINE_END( BreakPointDialog, CheckBoxHdl, CheckBox *, pChkBx ) +IMPL_LINK_INLINE_END( BreakPointDialog, CheckBoxHdl, ::CheckBox *, pChkBx ) @@ -195,13 +203,8 @@ IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton ) String aEntryStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) ); aEntryStr += String::CreateFromInt32( pBrk->nLine ); aComboBox.InsertEntry( aEntryStr, COMBOBOX_APPEND ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_BRKPNTSCHANGED ); - } } else { @@ -221,14 +224,8 @@ IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton ) if ( nEntry && !( nEntry < aComboBox.GetEntryCount() ) ) nEntry--; aComboBox.SetText( aComboBox.GetEntry( nEntry ) ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_BRKPNTSCHANGED ); - } } CheckButtons(); } @@ -256,6 +253,6 @@ BreakPoint* BreakPointDialog::GetSelectedBreakPoint() return pBrk; } - +} // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/brkdlg.hrc b/basctl/source/basicide/brkdlg.hrc index ae684b69547e..4425841829d6 100644 --- a/basctl/source/basicide/brkdlg.hrc +++ b/basctl/source/basicide/brkdlg.hrc @@ -15,8 +15,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BRKDLG_HRC -#define _BRKDLG_HRC +#ifndef BASCTL_BRKDLG_HRC +#define BASCTL_BRKDLG_HRC #include <svl/solar.hrc> @@ -32,5 +32,5 @@ #define RID_FT_BRKPOINTS 9 #define RID_FLD_PASS 10 -#endif // _BRKDLG_HRC +#endif // BASCTL_BRKDLG_HRC diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx index e417f711504e..fafbb65e7c17 100644 --- a/basctl/source/basicide/brkdlg.hxx +++ b/basctl/source/basicide/brkdlg.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BRKDLG_HXX -#define _BRKDLG_HXX +#ifndef BASCTL_BRKDLG_HXX +#define BASCTL_BRKDLG_HXX #include <svheader.hxx> #include <bastypes.hxx> @@ -28,6 +28,9 @@ #include <vcl/field.hxx> #include <vcl/fixed.hxx> +namespace basctl +{ + class BreakPointDialog : public ModalDialog { private: @@ -37,7 +40,7 @@ private: PushButton aNewButton; PushButton aDelButton; // PushButton aShowButton; - CheckBox aCheckBox; + ::CheckBox aCheckBox; FixedText aBrkText; FixedText aPassText; NumericField aNumericField; @@ -47,7 +50,7 @@ private: protected: void CheckButtons(); - DECL_LINK( CheckBoxHdl, CheckBox * ); + DECL_LINK( CheckBoxHdl, ::CheckBox * ); DECL_LINK( ComboBoxHighlightHdl, ComboBox * ); DECL_LINK( EditModifyHdl, Edit * ); DECL_LINK( ButtonHdl, Button * ); @@ -61,6 +64,8 @@ public: void SetCurrentBreakPoint( BreakPoint* pBrk ); }; -#endif // _BRKDLG_HXX +} // namespace basctl + +#endif // BASCTL_BRKDLG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx index 357a3ddd56de..75b5c31f347c 100644 --- a/basctl/source/basicide/iderdll.cxx +++ b/basctl/source/basicide/iderdll.cxx @@ -41,127 +41,135 @@ #include <svl/srchitem.hxx> #include <com/sun/star/script/XLibraryContainerPassword.hpp> +#include <boost/scoped_ptr.hpp> + +namespace basctl +{ + using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; -class BasicIDEDLL +namespace +{ + +class Dll { - BasicIDEShell* m_pShell; - BasicIDEData* m_pExtraData; + Shell* m_pShell; + boost::scoped_ptr<ExtraData> m_pExtraData; public: - BasicIDEDLL(); - ~BasicIDEDLL(); + Dll (); - BasicIDEShell* GetShell() const { return m_pShell; } - void SetShell(BasicIDEShell* pShell) { m_pShell = pShell; } - BasicIDEData* GetExtraData(); + Shell* GetShell() const { return m_pShell; } + void SetShell (Shell* pShell) { m_pShell = pShell; } + ExtraData* GetExtraData (); }; -namespace +// Holds a basctl::Dll and release it on exit, or dispose of the +//default XComponent, whichever comes first +class DllInstance : public comphelper::scoped_disposing_solar_mutex_reset_ptr<Dll> { - //Holds a BasicIDEDLL and release it on exit, or dispose of the - //default XComponent, whichever comes first - class BasicIDEDLLInstance : public comphelper::scoped_disposing_solar_mutex_reset_ptr<BasicIDEDLL> - { - public: - BasicIDEDLLInstance() : comphelper::scoped_disposing_solar_mutex_reset_ptr<BasicIDEDLL>(::com::sun::star::uno::Reference<com::sun::star::lang::XComponent>(comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), ::com::sun::star::uno::UNO_QUERY_THROW), new BasicIDEDLL) - { - } - }; - - struct theBasicIDEDLLInstance : public rtl::Static<BasicIDEDLLInstance, theBasicIDEDLLInstance> {}; -} +public: + DllInstance() : comphelper::scoped_disposing_solar_mutex_reset_ptr<Dll>(::com::sun::star::uno::Reference<com::sun::star::lang::XComponent>(comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop"))), ::com::sun::star::uno::UNO_QUERY_THROW), new Dll) + { } +}; -namespace BasicIDEGlobals -{ - void ensure() - { - theBasicIDEDLLInstance::get(); - } +struct theDllInstance : public rtl::Static<DllInstance, theDllInstance> { }; - BasicIDEShell* GetShell() - { - BasicIDEDLL *pIDEGlobals = theBasicIDEDLLInstance::get().get(); - return pIDEGlobals ? pIDEGlobals->GetShell() : NULL; - } +} // namespace - void ShellCreated(BasicIDEShell* pShell) - { - BasicIDEDLL *pIDEGlobals = theBasicIDEDLLInstance::get().get(); - if (pIDEGlobals && pIDEGlobals->GetShell() == NULL) - pIDEGlobals->SetShell(pShell); - } +void EnsureIde () +{ + theDllInstance::get(); +} - void ShellDestroyed(BasicIDEShell* pShell) - { - BasicIDEDLL *pIDEGlobals = theBasicIDEDLLInstance::get().get(); - if (pIDEGlobals && pIDEGlobals->GetShell() == pShell) - pIDEGlobals->SetShell(NULL); - } +Shell* GetShell () +{ + if (Dll* pDll = theDllInstance::get().get()) + return pDll->GetShell(); + return 0; +} - BasicIDEData* GetExtraData() - { - BasicIDEDLL *pIDEGlobals = theBasicIDEDLLInstance::get().get(); - return pIDEGlobals ? pIDEGlobals->GetExtraData() : NULL; - } +void ShellCreated (Shell* pShell) +{ + Dll* pDll = theDllInstance::get().get(); + if (pDll && !pDll->GetShell()) + pDll->SetShell(pShell); } -IDEResId::IDEResId( sal_uInt16 nId ): - ResId( nId, *(BASIC_MOD())->GetResMgr() ) +void ShellDestroyed (Shell* pShell) { + Dll* pDll = theDllInstance::get().get(); + if (pDll && pDll->GetShell() == pShell) + pDll->SetShell(0); } -BasicIDEDLL::~BasicIDEDLL() +ExtraData* GetExtraData() { - delete m_pExtraData; + if (Dll* pDll = theDllInstance::get().get()) + return pDll->GetExtraData(); + return 0; } -BasicIDEDLL::BasicIDEDLL() - : m_pShell(0) - , m_pExtraData(0) + +IDEResId::IDEResId( sal_uInt16 nId ): + ResId(nId, *Module::Get()->GetResMgr()) +{ } + +namespace { - SfxObjectFactory* pFact = &BasicDocShell::Factory(); + +Dll::Dll () : + m_pShell(0) +{ + SfxObjectFactory* pFact = &DocShell::Factory(); (void)pFact; ResMgr* pMgr = ResMgr::CreateResMgr( - "basctl", Application::GetSettings().GetUILocale() ); + "basctl", Application::GetSettings().GetUILocale() + ); - BASIC_MOD() = new BasicIDEModule( pMgr, &BasicDocShell::Factory() ); + Module::Get() = new Module( pMgr, &DocShell::Factory() ); GetExtraData(); // to cause GlobalErrorHdl to be set - SfxModule* pMod = BASIC_MOD(); + SfxModule* pMod = Module::Get(); - SfxObjectFactory& rFactory = BasicDocShell::Factory(); + SfxObjectFactory& rFactory = DocShell::Factory(); rFactory.SetDocumentServiceName( rtl::OUString("com.sun.star.script.BasicIDE") ); - BasicDocShell::RegisterInterface( pMod ); - BasicIDEShell::RegisterFactory( SVX_INTERFACE_BASIDE_VIEWSH ); - BasicIDEShell::RegisterInterface( pMod ); + DocShell::RegisterInterface( pMod ); + Shell::RegisterFactory( SVX_INTERFACE_BASIDE_VIEWSH ); + Shell::RegisterInterface( pMod ); PropBrwMgr::RegisterChildWindow(); } -BasicIDEData* BasicIDEDLL::GetExtraData() +ExtraData* Dll::GetExtraData () { if (!m_pExtraData) - m_pExtraData = new BasicIDEData; - return m_pExtraData; + m_pExtraData.reset(new ExtraData); + return m_pExtraData.get(); } -BasicIDEData::BasicIDEData() -{ - nBasicDialogCount = 0; - bChoosingMacro = false; - bShellInCriticalSection = false; - pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM ); +} // namespace - StarBASIC::SetGlobalBreakHdl( LINK( this, BasicIDEData, GlobalBasicBreakHdl ) ); +// +// basctl::ExtraData +// =================== +// + +ExtraData::ExtraData () : + pSearchItem(new SvxSearchItem(SID_SEARCH_ITEM)), + nBasicDialogCount(0), + bChoosingMacro(false), + bShellInCriticalSection(false) +{ + StarBASIC::SetGlobalBreakHdl(LINK(this, ExtraData, GlobalBasicBreakHdl)); } -BasicIDEData::~BasicIDEData() +ExtraData::~ExtraData () { // Resetting ErrorHdl is cleaner indeed but this instance is destroyed // pretty late, after the last Basic, anyway. @@ -170,36 +178,26 @@ BasicIDEData::~BasicIDEData() // StarBASIC::SetGlobalErrorHdl( Link() ); // StarBASIC::SetGlobalBreakHdl( Link() ); // StarBASIC::setGlobalStarScriptListener( XEngineListenerRef() ); - - delete pSearchItem; } -SvxSearchItem& BasicIDEData::GetSearchItem() const +void ExtraData::SetSearchItem (const SvxSearchItem& rItem) { - return *pSearchItem; + pSearchItem.reset((SvxSearchItem*)rItem.Clone()); } -void BasicIDEData::SetSearchItem( const SvxSearchItem& rItem ) -{ - delete pSearchItem; - pSearchItem = (SvxSearchItem*)rItem.Clone(); -} - -IMPL_LINK( BasicIDEData, GlobalBasicBreakHdl, StarBASIC *, pBasic ) +IMPL_LINK(ExtraData, GlobalBasicBreakHdl, StarBASIC *, pBasic ) { long nRet = 0; - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) + if (Shell* pShell = GetShell()) { - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); - if ( pBasMgr ) + if (BasicManager* pBasMgr = FindBasicManager(pBasic)) { // I do get here twice if Step into protected Basic // => bad, if password query twice, also you don't see // the lib in the PasswordDlg... // => start no password query at this point ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); - OSL_ENSURE( aDocument.isValid(), "BasicIDEData::GlobalBasicBreakHdl: no document for the basic manager!" ); + OSL_ENSURE( aDocument.isValid(), "basctl::ExtraData::GlobalBasicBreakHdl: no document for the basic manager!" ); if ( aDocument.isValid() ) { ::rtl::OUString aOULibName( pBasic->GetName() ); @@ -214,7 +212,7 @@ IMPL_LINK( BasicIDEData, GlobalBasicBreakHdl, StarBASIC *, pBasic ) } else { - nRet = pIDEShell->CallBasicBreakHdl( pBasic ); + nRet = pShell->CallBasicBreakHdl( pBasic ); } } } @@ -224,4 +222,7 @@ IMPL_LINK( BasicIDEData, GlobalBasicBreakHdl, StarBASIC *, pBasic ) return nRet; } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/iderdll2.hxx b/basctl/source/basicide/iderdll2.hxx index 1ed344c459b8..2e30deee1e6e 100644 --- a/basctl/source/basicide/iderdll2.hxx +++ b/basctl/source/basicide/iderdll2.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _IDERDLL2_HXX -#define _IDERDLL2_HXX +#ifndef BASCTL_IDERDLL2_HXX +#define BASCTL_IDERDLL2_HXX class StarBASIC; class SvxSearchItem; @@ -29,21 +29,24 @@ class SvxSearchItem; #include <bastypes.hxx> #include <bastype2.hxx> -#define INVPOSITION 0x7fff +#include <boost/scoped_ptr.hpp> -class BasicIDEData +namespace basctl +{ + +class ExtraData { private: - SvxSearchItem* pSearchItem; + boost::scoped_ptr<SvxSearchItem> pSearchItem; LibInfos aLibInfos; - BasicEntryDescriptor m_aLastEntryDesc; + EntryDescriptor m_aLastEntryDesc; String aAddLibPath; String aAddLibFilter; - sal_uInt16 nBasicDialogCount; + sal_uInt16 nBasicDialogCount; bool bChoosingMacro; bool bShellInCriticalSection; @@ -52,32 +55,33 @@ protected: DECL_LINK( GlobalBasicBreakHdl, StarBASIC * ); public: - BasicIDEData(); - ~BasicIDEData(); + ExtraData(); + ~ExtraData(); - LibInfos& GetLibInfos() { return aLibInfos; } + LibInfos& GetLibInfos () { return aLibInfos; } - BasicEntryDescriptor& GetLastEntryDescriptor() { return m_aLastEntryDesc; } - void SetLastEntryDescriptor( BasicEntryDescriptor& rDesc ) { m_aLastEntryDesc = rDesc; } + EntryDescriptor& GetLastEntryDescriptor () { return m_aLastEntryDesc; } + void SetLastEntryDescriptor (EntryDescriptor& rDesc) { m_aLastEntryDesc = rDesc; } - bool& ChoosingMacro() { return bChoosingMacro; } - bool& ShellInCriticalSection() { return bShellInCriticalSection; } + bool& ChoosingMacro() { return bChoosingMacro; } + bool& ShellInCriticalSection() { return bShellInCriticalSection; } - sal_uInt16 GetBasicDialogCount() const { return nBasicDialogCount; } - void IncBasicDialogCount() { nBasicDialogCount++; } - void DecBasicDialogCount() { nBasicDialogCount--; } + sal_uInt16 GetBasicDialogCount() const { return nBasicDialogCount; } + void IncBasicDialogCount() { nBasicDialogCount++; } + void DecBasicDialogCount() { nBasicDialogCount--; } - SvxSearchItem& GetSearchItem() const; - void SetSearchItem( const SvxSearchItem& rItem ); + SvxSearchItem& GetSearchItem() const { return *pSearchItem; } + void SetSearchItem( const SvxSearchItem& rItem ); - const String& GetAddLibPath() const { return aAddLibPath; } - void SetAddLibPath( const String& rPath ) { aAddLibPath = rPath; } + const String& GetAddLibPath() const { return aAddLibPath; } + void SetAddLibPath( const String& rPath ) { aAddLibPath = rPath; } - const String& GetAddLibFilter() const { return aAddLibFilter; } - void SetAddLibFilter( const String& rFilter ) { aAddLibFilter = rFilter; } + const String& GetAddLibFilter() const { return aAddLibFilter; } + void SetAddLibFilter( const String& rFilter ) { aAddLibFilter = rFilter; } }; +} // namespace basctl -#endif //_IDERDLL2_HXX +#endif // BASCTL_IDERDLL2_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/idetemp.hxx b/basctl/source/basicide/idetemp.hxx index 517043ccc7f5..01c09879c5e3 100644 --- a/basctl/source/basicide/idetemp.hxx +++ b/basctl/source/basicide/idetemp.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _IDETEMP_HXX -#define _IDETEMP_HXX +#ifndef BASCTL_IDETEMP_HXX +#define BASCTL_IDETEMP_HXX enum SvxChooseControlEnum @@ -53,6 +53,6 @@ enum SvxChooseControlEnum #define SvxChooseControlItem SfxAllEnumItem -#endif +#endif // BASCTL_IDETEMP_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx index fdc234553ce1..5d1be2e2f278 100644 --- a/basctl/source/basicide/layout.cxx +++ b/basctl/source/basicide/layout.cxx @@ -33,7 +33,7 @@ static int const nSplitThickness = 3; } // namespace // ctor for derived classes -// pParent: the parent window (BasicIDEShell) +// pParent: the parent window (Shell) Layout::Layout (Window* pParent) : Window(pParent, WB_CLIPCHILDREN), pChild(0), @@ -91,10 +91,10 @@ void Layout::DockaWindow (DockingWindow*) ArrangeWindows(); } -void Layout::Activating (IDEBaseWindow& rIdeWindow) +void Layout::Activating (BaseWindow& rWindow) { // first activation - pChild = &rIdeWindow; + pChild = &rWindow; ArrangeWindows(); Show(); pChild->Activating(); @@ -154,7 +154,7 @@ Layout::SplittedSide::SplittedSide (Layout* pParent, Side eSide) : // Add() -- adds a new window to the side (after construction) -void Layout::SplittedSide::Add (BasicDockingWindow* pWin, Size const& rSize) +void Layout::SplittedSide::Add (DockingWindow* pWin, Size const& rSize) { int const nSize1 = (bVertical ? rSize.Width() : rSize.Height()) + nSplitThickness; int const nSize2 = bVertical ? rSize.Height() : rSize.Width(); @@ -245,7 +245,7 @@ void Layout::SplittedSide::ArrangeIn (Rectangle const& rRect) for (unsigned i = 0; i != vWindows.size(); ++i) { // window - BasicDockingWindow& rWin = *vWindows[i]; + DockingWindow& rWin = *vWindows[i]; bool const bDocked = rWin.IsVisible() && !rWin.IsFloatingMode(); // The window is docked between nStartPos and nEndPos along. int const nEndPos = i == vWindows.size() - 1 ? diff --git a/basctl/source/basicide/layout.hxx b/basctl/source/basicide/layout.hxx index 2f733f852348..6adaeebde151 100644 --- a/basctl/source/basicide/layout.hxx +++ b/basctl/source/basicide/layout.hxx @@ -28,14 +28,15 @@ #include <boost/shared_ptr.hpp> class DockingWindow; -class BasicDockingWindow; -class IDEBaseWindow; class SfxRequest; class SfxItemSet; namespace basctl { +class DockingWindow; +class BaseWindow; + // // Layout -- the common base of ModulLayout and DialogLayout. // Handles the splitting lines and the dockable windows. @@ -46,7 +47,7 @@ public: void DockaWindow (DockingWindow*); void ArrangeWindows (); - virtual void Activating (IDEBaseWindow&); + virtual void Activating (BaseWindow&); virtual void Deactivating (); virtual void GetState (SfxItemSet&, unsigned nWhich) = 0; virtual void UpdateDebug (bool bBasicStopped ) = 0; @@ -55,8 +56,8 @@ protected: Layout (Window* pParent); virtual ~Layout (); - void AddToLeft (BasicDockingWindow* pWin, Size const& rSize) { aLeftSide.Add(pWin, rSize); } - void AddToBottom (BasicDockingWindow* pWin, Size const& rSize) { aBottomSide.Add(pWin, rSize); } + void AddToLeft (DockingWindow* pWin, Size const& rSize) { aLeftSide.Add(pWin, rSize); } + void AddToBottom (DockingWindow* pWin, Size const& rSize) { aBottomSide.Add(pWin, rSize); } protected: // Window: @@ -67,7 +68,7 @@ protected: private: // the main child window (either ModulWindow or DialogWindow) - IDEBaseWindow* pChild; + BaseWindow* pChild; // when this window has at first (nonempty) size bool bFirstSize; @@ -78,7 +79,7 @@ private: public: enum Side {Right, Top, Left, Bottom}; SplittedSide (Layout*, Side); - void Add (BasicDockingWindow*, Size const&); + void Add (DockingWindow*, Size const&); bool IsEmpty () const; int GetSize () const; void ArrangeIn (Rectangle const&); @@ -101,7 +102,7 @@ private: // the main splitting line Splitter aSplitter; // the dockable windows - std::vector<BasicDockingWindow*> vWindows; + std::vector<DockingWindow*> vWindows; // splitting lines between the docking windows (vWindows.size() - 1) std::vector<boost::shared_ptr<Splitter> > vSplitters; diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx index 40093ed9e41a..56445830d8ac 100644 --- a/basctl/source/basicide/linenumberwindow.cxx +++ b/basctl/source/basicide/linenumberwindow.cxx @@ -32,7 +32,10 @@ #include <vcl/xtextedt.hxx> #include <vcl/textview.hxx> -LineNumberWindow::LineNumberWindow (Window* pParent, basctl::ModulWindow* pModulWindow) : +namespace basctl +{ + +LineNumberWindow::LineNumberWindow (Window* pParent, ModulWindow* pModulWindow) : Window(pParent, WB_BORDER), m_pModulWindow(pModulWindow), m_nCurYOffset(0) @@ -42,7 +45,8 @@ LineNumberWindow::LineNumberWindow (Window* pParent, basctl::ModulWindow* pModul m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2; } -LineNumberWindow::~LineNumberWindow() { } +LineNumberWindow::~LineNumberWindow() +{ } void LineNumberWindow::Paint( const Rectangle& ) { @@ -132,4 +136,7 @@ int LineNumberWindow::GetWidth() { return m_nWidth; } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/linenumberwindow.hxx b/basctl/source/basicide/linenumberwindow.hxx index 7c8f7171c908..053c361ffcb9 100644 --- a/basctl/source/basicide/linenumberwindow.hxx +++ b/basctl/source/basicide/linenumberwindow.hxx @@ -25,30 +25,30 @@ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable * instead of those above. */ -#ifndef BASICIDE_LINENUMBERWINDOW_HXX -#define BASICIDE_LINENUMBERWINDOW_HXX +#ifndef BASCTL_LINENUMBERWINDOW_HXX +#define BASCTL_LINENUMBERWINDOW_HXX #include <vcl/window.hxx> namespace basctl { - class ModulWindow; -} + +class ModulWindow; class LineNumberWindow : public Window { private: - basctl::ModulWindow* m_pModulWindow; + ModulWindow* m_pModulWindow; int m_nWidth; long m_nCurYOffset; int m_nBaseWidth; - virtual void DataChanged(DataChangedEvent const & rDCEvt); + virtual void DataChanged (DataChangedEvent const& rDCEvt); protected: virtual void Paint( const Rectangle& ); public: - LineNumberWindow (Window* pParent, basctl::ModulWindow* pModulWin); + LineNumberWindow (Window* pParent, ModulWindow* pModulWin); ~LineNumberWindow(); void DoScroll( long nHorzScroll, long nVertScroll ); @@ -59,5 +59,8 @@ public: int GetWidth(); }; -#endif // BASICIDE_LINENUMBERWINDOW_HXX +} // namespace basctl + +#endif // BASCTL_LINENUMBERWINDOW_HXX + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index 8df518bd3f25..c4c55b25ff61 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -29,25 +29,25 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <sfx2/dispatch.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::resource; -using basctl::DialogWindow; -using basctl::ModulWindow; - static ::rtl::OUString aDot( RTL_CONSTASCII_USTRINGPARAM( "." )); static ::rtl::OUString aEsc( RTL_CONSTASCII_USTRINGPARAM( "&" )); static ::rtl::OUString aSemi( RTL_CONSTASCII_USTRINGPARAM( ";" )); -LocalizationMgr::LocalizationMgr( BasicIDEShell* pIDEShell, +LocalizationMgr::LocalizationMgr( Shell* pShell, const ScriptDocument& rDocument, ::rtl::OUString aLibName, const Reference< XStringResourceManager >& xStringResourceManager ) : m_xStringResourceManager( xStringResourceManager ) - , m_pIDEShell( pIDEShell ) + , m_pShell( pShell ) , m_aDocument( rDocument ) , m_aLibName( aLibName ) { @@ -70,7 +70,7 @@ void LocalizationMgr::handleTranslationbar( void ) static ::rtl::OUString aToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/translationbar" )); Reference< beans::XPropertySet > xFrameProps - ( m_pIDEShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); + ( m_pShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if ( xFrameProps.is() ) { Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; @@ -139,7 +139,7 @@ void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResou for( sal_Int32 i = 0 ; i < nDlgCount ; i++ ) { String aDlgName = pDlgNames[ i ]; - if (DialogWindow* pWin = m_pIDEShell->FindDlgWin(m_aDocument, m_aLibName, aDlgName)) + if (DialogWindow* pWin = m_pShell->FindDlgWin(m_aDocument, m_aLibName, aDlgName)) { Reference< container::XNameContainer > xDialog = pWin->GetDialog(); if( xDialog.is() ) @@ -670,11 +670,10 @@ void LocalizationMgr::handleAddLocales( Sequence< Locale > aLocaleSeq ) enableResourceForAllLibraryDialogs(); } - BasicIDE::MarkDocumentModified( m_aDocument ); + MarkDocumentModified( m_aDocument ); // update locale toolbar - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); handleTranslationbar(); @@ -725,11 +724,10 @@ void LocalizationMgr::handleRemoveLocales( Sequence< Locale > aLocaleSeq ) } if( bModified ) { - BasicIDE::MarkDocumentModified( m_aDocument ); + MarkDocumentModified( m_aDocument ); // update slots - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); pBindings->Invalidate( SID_BASICIDE_MANAGE_LANG ); @@ -757,8 +755,7 @@ void LocalizationMgr::handleSetDefaultLocale( Locale aLocale ) } // update locale toolbar - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); } } @@ -777,11 +774,10 @@ void LocalizationMgr::handleSetCurrentLocale( ::com::sun::star::lang::Locale aLo } // update locale toolbar - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); - if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(m_pIDEShell->GetCurWindow())) + if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(m_pShell->GetCurWindow())) if (!pDlgWin->IsSuspended()) if (DlgEditor* pWinEditor = pDlgWin->GetEditor()) pWinEditor->UpdatePropertyBrowserDelayed(); @@ -809,11 +805,10 @@ void LocalizationMgr::handleBasicStopped( void ) DialogWindow* FindDialogWindowForEditor( DlgEditor* pEditor ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable(); - for( IDEWindowTable::const_iterator it = aIDEWindowTable.begin(); it != aIDEWindowTable.end(); ++it ) + Shell::WindowTable const& aWindowTable = GetShell()->GetWindowTable(); + for (Shell::WindowTableIt it = aWindowTable.begin(); it != aWindowTable.end(); ++it ) { - IDEBaseWindow* pWin = it->second; + BaseWindow* pWin = it->second; if (!pWin->IsSuspended()) if (DialogWindow* pDlgWin = dynamic_cast<DialogWindow*>(pWin)) { @@ -853,7 +848,7 @@ void LocalizationMgr::setControlResourceIDsForNewEditorObject( DlgEditor* pEdito xDummyStringResolver, SET_IDS ); if( nChangedCount ) - BasicIDE::MarkDocumentModified( aDocument ); + MarkDocumentModified( aDocument ); } void LocalizationMgr::renameControlResourceIDsForEditorObject( DlgEditor* pEditor, @@ -907,7 +902,7 @@ void LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject( DlgEditor* xDummyStringResolver, REMOVE_IDS_FROM_RESOURCE ); if( nChangedCount ) - BasicIDE::MarkDocumentModified( aDocument ); + MarkDocumentModified( aDocument ); } void LocalizationMgr::setStringResourceAtDialog( const ScriptDocument& rDocument, const ::rtl::OUString& aLibName, @@ -1159,4 +1154,6 @@ Reference< XStringResourceManager > LocalizationMgr::getStringResourceFromDialog return xStringResourceManager; } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index 97422a023cea..66978826b160 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -49,6 +49,10 @@ #include <com/sun/star/document/MacroExecMode.hpp> #include <map> + +namespace basctl +{ + using ::std::map; using ::std::pair; @@ -117,13 +121,8 @@ MacroChooser::MacroChooser( Window* pParnt, bool bCreateEntries ) : WB_HASBUTTONS | WB_HASBUTTONSATROOT | WB_HSCROLL ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); - } if ( bCreateEntries ) aBasicBox.ScanAllEntries(); @@ -137,7 +136,7 @@ MacroChooser::~MacroChooser() void MacroChooser::StoreMacroDescription() { - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( aBasicBox.FirstSelected() ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(aBasicBox.FirstSelected()); String aMethodName; SvLBoxEntry* pEntry = aMacroBox.FirstSelected(); if ( pEntry ) @@ -150,25 +149,21 @@ void MacroChooser::StoreMacroDescription() aDesc.SetType( OBJ_TYPE_METHOD ); } - BasicIDEData* pData = BasicIDEGlobals::GetExtraData(); - if ( pData ) + if (ExtraData* pData = basctl::GetExtraData()) pData->SetLastEntryDescriptor( aDesc ); } void MacroChooser::RestoreMacroDescription() { - BasicEntryDescriptor aDesc; - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) + EntryDescriptor aDesc; + if (Shell* pShell = GetShell()) { - IDEBaseWindow* pCurWin = pIDEShell->GetCurWindow(); - if ( pCurWin ) + if (BaseWindow* pCurWin = pShell->GetCurWindow()) aDesc = pCurWin->CreateEntryDescriptor(); } else { - BasicIDEData* pData = BasicIDEGlobals::GetExtraData(); - if ( pData ) + if (ExtraData* pData = basctl::GetExtraData()) aDesc = pData->GetLastEntryDescriptor(); } @@ -208,7 +203,7 @@ short MacroChooser::Execute() // #104198 Check if "wrong" document is active SvLBoxEntry* pSelectedEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pSelectedEntry ) ); + EntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pSelectedEntry ) ); const ScriptDocument& rSelectedDoc( aDesc.GetDocument() ); // App Basic is always ok, so only check if shell was found @@ -219,7 +214,7 @@ short MacroChooser::Execute() SvLBoxEntry* pRootEntry = aBasicBox.GetEntry( nRootPos ); while( pRootEntry ) { - BasicEntryDescriptor aCmpDesc( aBasicBox.GetEntryDescriptor( pRootEntry ) ); + EntryDescriptor aCmpDesc( aBasicBox.GetEntryDescriptor( pRootEntry ) ); const ScriptDocument& rCmpDoc( aCmpDesc.GetDocument() ); if ( rCmpDoc.isDocument() && rCmpDoc.isActive() ) { @@ -258,12 +253,7 @@ void MacroChooser::EnableButton( Button& rButton, bool bEnable ) if ( bEnable ) { if ( nMode == MACROCHOOSER_CHOOSEONLY || nMode == MACROCHOOSER_RECORDING ) - { - if ( &rButton == &aRunButton ) - rButton.Enable(); - else - rButton.Disable(); - } + rButton.Enable(&rButton == &aRunButton); else rButton.Enable(); } @@ -298,25 +288,19 @@ void MacroChooser::DeleteMacro() DBG_ASSERT( pMethod, "DeleteMacro: Kein Macro !" ); if ( pMethod && QueryDelMacro( pMethod->GetName(), this ) ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); - } // mark current doc as modified: - StarBASIC* pBasic = BasicIDE::FindBasic( pMethod ); + StarBASIC* pBasic = FindBasic(pMethod); DBG_ASSERT( pBasic, "Basic?!" ); - BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic ); + BasicManager* pBasMgr = FindBasicManager( pBasic ); DBG_ASSERT( pBasMgr, "BasMgr?" ); ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); if ( aDocument.isDocument() ) { aDocument.setDocumentModified(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_SAVEDOC ); } @@ -345,7 +329,7 @@ SbMethod* MacroChooser::CreateMacro() { SbMethod* pMethod = 0; SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); ScriptDocument aDocument( aDesc.GetDocument() ); OSL_ENSURE( aDocument.isAlive(), "MacroChooser::CreateMacro: no document!" ); if ( !aDocument.isAlive() ) @@ -393,7 +377,7 @@ SbMethod* MacroChooser::CreateMacro() String aSubName = aMacroNameEdit.GetText(); DBG_ASSERT( !pModule || !pModule->GetMethods()->Find( aSubName, SbxCLASS_METHOD ), "Macro existiert schon!" ); - pMethod = pModule ? BasicIDE::CreateMacro( pModule, aSubName ) : NULL; + pMethod = pModule ? basctl::CreateMacro( pModule, aSubName ) : NULL; } return pMethod; @@ -414,7 +398,7 @@ void MacroChooser::SaveSetCurEntry( SvTreeListBox& rBox, SvLBoxEntry* pEntry ) void MacroChooser::CheckButtons() { SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); SvLBoxEntry* pMacroEntry = aMacroBox.FirstSelected(); SbMethod* pMethod = GetMacro(); @@ -470,22 +454,11 @@ void MacroChooser::CheckButtons() if ( nMode == MACROCHOOSER_RECORDING ) { // save button - if ( !bProtected && !bReadOnly && !bShare ) - aRunButton.Enable(); - else - aRunButton.Disable(); - + aRunButton.Enable(!bProtected && !bReadOnly && !bShare); // new library button - if ( !bShare ) - aNewLibButton.Enable(); - else - aNewLibButton.Disable(); - + aNewLibButton.Enable(!bShare); // new module button - if ( !bProtected && !bReadOnly && !bShare ) - aNewModButton.Enable(); - else - aNewModButton.Disable(); + aNewModButton.Enable(!bProtected && !bReadOnly && !bShare); } } @@ -650,7 +623,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) SbMethod* pMethod = GetMacro(); SbModule* pModule = pMethod ? pMethod->GetModule() : NULL; StarBASIC* pBasic = pModule ? (StarBASIC*)pModule->GetParent() : NULL; - BasicManager* pBasMgr = pBasic ? BasicIDE::FindBasicManager( pBasic ) : NULL; + BasicManager* pBasMgr = pBasic ? FindBasicManager(pBasic) : NULL; if ( pBasMgr ) { ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) ); @@ -663,7 +636,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) } else if ( nMode == MACROCHOOSER_RECORDING ) { - if ( !BasicIDE::IsValidSbxName(aMacroNameEdit.GetText()) ) + if ( !IsValidSbxName(aMacroNameEdit.GetText()) ) { ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); aMacroNameEdit.SetSelection( Selection( 0, aMacroNameEdit.GetText().Len() ) ); @@ -686,7 +659,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) else if ( ( pButton == &aEditButton ) || ( pButton == &aNewDelButton ) ) { SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); ScriptDocument aDocument( aDesc.GetDocument() ); DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" ); if ( !aDocument.isAlive() ) @@ -712,10 +685,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); SFX_APP()->ExecuteSlot( aRequest ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L ); EndDialog( MACRO_EDIT ); } @@ -724,14 +694,9 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) if ( bNewDelIsDel ) { DeleteMacro(); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_UPDATEMODULESOURCE, SFX_CALLMODE_SYNCHRON, &aInfoItem, 0L ); - } CheckButtons(); UpdateFields(); //if ( aMacroBox.GetCurEntry() ) // OV-Bug ? @@ -739,7 +704,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) } else { - if ( !BasicIDE::IsValidSbxName(aMacroNameEdit.GetText()) ) + if ( !IsValidSbxName(aMacroNameEdit.GetText()) ) { ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); aMacroNameEdit.SetSelection( Selection( 0, aMacroNameEdit.GetText().Len() ) ); @@ -756,10 +721,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); SFX_APP()->ExecuteSlot( aRequest ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L ); StoreMacroDescription(); EndDialog( MACRO_NEW ); @@ -771,7 +733,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) else if ( pButton == &aAssignButton ) { SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); ScriptDocument aDocument( aDesc.GetDocument() ); DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" ); if ( !aDocument.isAlive() ) @@ -793,14 +755,14 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) else if ( pButton == &aNewLibButton ) { SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); ScriptDocument aDocument( aDesc.GetDocument() ); createLibImpl( static_cast<Window*>( this ), aDocument, NULL, &aBasicBox ); } else if ( pButton == &aNewModButton ) { SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); ScriptDocument aDocument( aDesc.GetDocument() ); String aLibName( aDesc.GetLibName() ); String aModName; @@ -811,7 +773,7 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) { StoreMacroDescription(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( aBasicBox.FirstSelected() ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(aBasicBox.FirstSelected()); OrganizeDialog* pDlg = new OrganizeDialog( this, 0, aDesc ); sal_uInt16 nRet = pDlg->Execute(); delete pDlg; @@ -822,8 +784,8 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton ) return 0; } - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell && pIDEShell->IsAppBasicModified() ) + Shell* pShell = GetShell(); + if ( pShell && pShell->IsAppBasicModified() ) bForceStoreBasic = true; aBasicBox.UpdateEntries(); @@ -892,4 +854,7 @@ String MacroChooser::GetInfo( SbxVariable* pVar ) return aComment; } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/macrodlg.hrc b/basctl/source/basicide/macrodlg.hrc index d0fd34571f74..6ca7749ae1ff 100644 --- a/basctl/source/basicide/macrodlg.hrc +++ b/basctl/source/basicide/macrodlg.hrc @@ -15,8 +15,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _MACRODLG_HRC -#define _MACRODLG_HRC +#ifndef BASCTL_MACRODLG_HRC +#define BASCTL_MACRODLG_HRC #include <svl/solar.hrc> @@ -46,5 +46,5 @@ #define RID_PB_NEWLIB 19 #define RID_PB_NEWMOD 20 -#endif // _MACRODLG_HRC +#endif // BASCTL_MACRODLG_HRC diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx index 6ccd88329d4c..c771ef9016d7 100644 --- a/basctl/source/basicide/macrodlg.hxx +++ b/basctl/source/basicide/macrodlg.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ // -#ifndef _MACRODLG_HXX -#define _MACRODLG_HXX +#ifndef BASCTL_MACRODLG_HXX +#define BASCTL_MACRODLG_HXX #include <svheader.hxx> @@ -29,6 +29,9 @@ #include <vcl/button.hxx> +namespace basctl +{ + #define MACRO_CLOSE 10 #define MACRO_OK_RUN 11 #define MACRO_NEW 12 @@ -45,7 +48,7 @@ private: Edit aMacroNameEdit; FixedText aMacroFromTxT; FixedText aMacrosSaveInTxt; - BasicTreeListBox aBasicBox; + TreeListBox aBasicBox; FixedText aMacrosInTxt; String aMacrosInTxtBaseStr; SvTreeListBox aMacroBox; @@ -60,8 +63,8 @@ private: PushButton aNewLibButton; PushButton aNewModButton; - bool bNewDelIsDel; - bool bForceStoreBasic; + bool bNewDelIsDel; + bool bForceStoreBasic; sal_uInt16 nMode; @@ -93,9 +96,11 @@ public: virtual short Execute(); void SetMode( sal_uInt16 nMode ); - sal_uInt16 GetMode() const { return nMode; } + sal_uInt16 GetMode() const { return nMode; } }; -#endif // _MACRODLG_HXX +} // namespace basctl + +#endif // BASCTL_MACRODLG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 6588d46c3114..5a7df8fc59a5 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -60,6 +60,9 @@ #include <com/sun/star/util/VetoException.hpp> #include <com/sun/star/script/ModuleSizeExceededRequest.hpp> +namespace basctl +{ + using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -70,6 +73,9 @@ using namespace ::com::sun::star::ui::dialogs; typedef ::cppu::WeakImplHelper1< task::XInteractionHandler > HandlerImpl_BASE; +namespace +{ + class DummyInteractionHandler : public HandlerImpl_BASE { Reference< task::XInteractionHandler > m_xHandler; @@ -88,30 +94,28 @@ public: }; //---------------------------------------------------------------------------- -// BasicLibUserData +// LibUserData //---------------------------------------------------------------------------- -class BasicLibUserData +class LibUserData { private: - ScriptDocument m_aDocument; + ScriptDocument m_aDocument; public: - BasicLibUserData( const ScriptDocument& rDocument ) : m_aDocument( rDocument ) { } - virtual ~BasicLibUserData() {}; + LibUserData (ScriptDocument const& rDocument) : m_aDocument(rDocument) { } + virtual ~LibUserData() {}; - const ScriptDocument& - GetDocument() const { return m_aDocument; } + const ScriptDocument& GetDocument() const { return m_aDocument; } }; - //---------------------------------------------------------------------------- -// BasicLibLBoxString +// LibLBoxString //---------------------------------------------------------------------------- -class BasicLibLBoxString : public SvLBoxString +class LibLBoxString : public SvLBoxString { public: - BasicLibLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rTxt ) : + LibLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rTxt ) : SvLBoxString( pEntry, nFlags, rTxt ) {} virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry ); @@ -119,14 +123,14 @@ public: //---------------------------------------------------------------------------- -void BasicLibLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* pEntry ) +void LibLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* pEntry ) { // Change text color if library is read only: bool bReadOnly = false; if (pEntry && pEntry->GetUserData()) { ScriptDocument aDocument( - static_cast< BasicLibUserData * >(pEntry->GetUserData())-> + static_cast<LibUserData*>(pEntry->GetUserData())-> GetDocument() ); rtl::OUString aLibName( @@ -147,12 +151,14 @@ void BasicLibLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvL rDev.DrawText(rPos, GetText()); } +} // namespace + //---------------------------------------------------------------------------- -// BasicCheckBox +// basctl::CheckBox //---------------------------------------------------------------------------- -BasicCheckBox::BasicCheckBox( Window* pParent, const ResId& rResId ) +CheckBox::CheckBox( Window* pParent, const ResId& rResId ) :SvTabListBox( pParent, rResId ) ,m_aDocument( ScriptDocument::getApplicationScriptDocument() ) { @@ -165,7 +171,7 @@ BasicCheckBox::BasicCheckBox( Window* pParent, const ResId& rResId ) //---------------------------------------------------------------------------- -BasicCheckBox::~BasicCheckBox() +CheckBox::~CheckBox() { delete pCheckButton; @@ -173,14 +179,14 @@ BasicCheckBox::~BasicCheckBox() SvLBoxEntry* pEntry = First(); while ( pEntry ) { - delete static_cast<BasicLibUserData*>(pEntry->GetUserData()); + delete static_cast<LibUserData*>(pEntry->GetUserData()); pEntry = Next( pEntry ); } } //---------------------------------------------------------------------------- -void BasicCheckBox::Init() +void CheckBox::Init() { pCheckButton = new SvLBoxButtonData(this); @@ -194,7 +200,7 @@ void BasicCheckBox::Init() //---------------------------------------------------------------------------- -void BasicCheckBox::SetMode( NewObjectMode n ) +void CheckBox::SetMode( NewObjectMode n ) { nMode = n; @@ -206,14 +212,14 @@ void BasicCheckBox::SetMode( NewObjectMode n ) //---------------------------------------------------------------------------- -SvLBoxEntry* BasicCheckBox::DoInsertEntry( const String& rStr, sal_uLong nPos ) +SvLBoxEntry* CheckBox::DoInsertEntry( const String& rStr, sal_uLong nPos ) { return SvTabListBox::InsertEntryToColumn( rStr, nPos, 0 ); } //---------------------------------------------------------------------------- -SvLBoxEntry* BasicCheckBox::FindEntry( const String& rName ) +SvLBoxEntry* CheckBox::FindEntry( const String& rName ) { sal_uLong nCount = GetEntryCount(); for ( sal_uLong i = 0; i < nCount; i++ ) @@ -228,7 +234,7 @@ SvLBoxEntry* BasicCheckBox::FindEntry( const String& rName ) //---------------------------------------------------------------------------- -void BasicCheckBox::CheckEntryPos( sal_uLong nPos ) +void CheckBox::CheckEntryPos( sal_uLong nPos ) { if ( nPos < GetEntryCount() ) { @@ -241,7 +247,7 @@ void BasicCheckBox::CheckEntryPos( sal_uLong nPos ) //---------------------------------------------------------------------------- -bool BasicCheckBox::IsChecked( sal_uLong nPos ) const +bool CheckBox::IsChecked( sal_uLong nPos ) const { if ( nPos < GetEntryCount() ) return GetCheckButtonState(GetEntry(nPos)) == SV_BUTTON_CHECKED; @@ -250,7 +256,7 @@ bool BasicCheckBox::IsChecked( sal_uLong nPos ) const //---------------------------------------------------------------------------- -void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind ) +void CheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind ) { SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind ); @@ -261,7 +267,7 @@ void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const for ( sal_uInt16 nCol = 1; nCol < nCount; ++nCol ) { SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol ); - BasicLibLBoxString* pStr = new BasicLibLBoxString( pEntry, 0, pCol->GetText() ); + LibLBoxString* pStr = new LibLBoxString( pEntry, 0, pCol->GetText() ); pEntry->ReplaceItem( pStr, nCol ); } } @@ -269,7 +275,7 @@ void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const //---------------------------------------------------------------------------- -sal_Bool BasicCheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) +sal_Bool CheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) { if ( nMode != NEWOBJECTMODE_MOD ) return false; @@ -317,9 +323,9 @@ sal_Bool BasicCheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) //---------------------------------------------------------------------------- -sal_Bool BasicCheckBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& rNewName ) +sal_Bool CheckBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& rNewName ) { - bool bValid = ( rNewName.getLength() <= 30 ) && BasicIDE::IsValidSbxName( rNewName ); + bool bValid = rNewName.getLength() <= 30 && IsValidSbxName(rNewName); rtl::OUString aOldName( GetEntryText( pEntry, 0 ) ); if ( bValid && ( aOldName != rNewName ) ) { @@ -333,9 +339,8 @@ sal_Bool BasicCheckBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& r if ( xDlgLibContainer.is() ) xDlgLibContainer->renameLibrary( aOldName, rNewName ); - BasicIDE::MarkDocumentModified( m_aDocument ); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + MarkDocumentModified( m_aDocument ); + if (SfxBindings* pBindings = GetBindingsPtr()) { pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR ); pBindings->Update( SID_BASICIDE_LIBSELECTOR ); @@ -370,7 +375,7 @@ sal_Bool BasicCheckBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& r IMPL_LINK_NOARG(NewObjectDialog, OkButtonHandler) { - if (BasicIDE::IsValidSbxName(aEdit.GetText())) + if (IsValidSbxName(aEdit.GetText())) EndDialog(1); else { @@ -538,7 +543,7 @@ LibPage::~LibPage() sal_uInt16 nCount = aBasicsBox.GetEntryCount(); for ( sal_uInt16 i = 0; i < nCount; ++i ) { - BasicDocumentEntry* pEntry = (BasicDocumentEntry*)aBasicsBox.GetEntryData( i ); + DocumentEntry* pEntry = (DocumentEntry*)aBasicsBox.GetEntryData( i ); delete pEntry; } } @@ -649,14 +654,9 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton ) DBG_ASSERT( pCurEntry, "Entry?!" ); String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) ); SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if ( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_LIBSELECTED, SFX_CALLMODE_ASYNCHRON, &aDocItem, &aLibNameItem, 0L ); - } EndTabDialog( 1 ); return 0; } @@ -682,24 +682,24 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton ) Reference< script::XLibraryContainer > xModLibContainer = m_aCurDocument.getLibraryContainer( E_SCRIPTS ); if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && !xModLibContainer->isLibraryLoaded( aLibName ) ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) - pIDEShell->GetViewFrame()->GetWindow().EnterWait(); + Shell* pShell = GetShell(); + if (pShell) + pShell->GetViewFrame()->GetWindow().EnterWait(); xModLibContainer->loadLibrary( aLibName ); - if ( pIDEShell ) - pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); + if (pShell) + pShell->GetViewFrame()->GetWindow().LeaveWait(); } // load dialog library (if not loaded) Reference< script::XLibraryContainer > xDlgLibContainer = m_aCurDocument.getLibraryContainer( E_DIALOGS ); if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && !xDlgLibContainer->isLibraryLoaded( aLibName ) ) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - if ( pIDEShell ) - pIDEShell->GetViewFrame()->GetWindow().EnterWait(); + Shell* pShell = GetShell(); + if (pShell) + pShell->GetViewFrame()->GetWindow().EnterWait(); xDlgLibContainer->loadLibrary( aLibName ); - if ( pIDEShell ) - pIDEShell->GetViewFrame()->GetWindow().LeaveWait(); + if (pShell) + pShell->GetViewFrame()->GetWindow().LeaveWait(); } // check, if library is password protected @@ -726,7 +726,7 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton ) aLibBox.SetCurEntry( aLibBox.GetEntry( nPos ) ); } - BasicIDE::MarkDocumentModified( m_aCurDocument ); + MarkDocumentModified( m_aCurDocument ); } delete pDlg; } @@ -806,7 +806,7 @@ void LibPage::InsertLib() xFltMgr->appendFilter( aTitle, aFilter ); // set display directory and filter - ::rtl::OUString aPath( BasicIDEGlobals::GetExtraData()->GetAddLibPath() ); + ::rtl::OUString aPath(GetExtraData()->GetAddLibPath()); if ( !aPath.isEmpty() ) xFP->setDisplayDirectory( aPath ); else @@ -815,7 +815,7 @@ void LibPage::InsertLib() xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); } - ::rtl::OUString aLastFilter( BasicIDEGlobals::GetExtraData()->GetAddLibFilter() ); + rtl::OUString aLastFilter(GetExtraData()->GetAddLibFilter()); if ( !aLastFilter.isEmpty() ) xFltMgr->setCurrentFilter( aLastFilter ); else @@ -823,8 +823,8 @@ void LibPage::InsertLib() if ( xFP->execute() == RET_OK ) { - BasicIDEGlobals::GetExtraData()->SetAddLibPath( xFP->getDisplayDirectory() ); - BasicIDEGlobals::GetExtraData()->SetAddLibFilter( xFltMgr->getCurrentFilter() ); + GetExtraData()->SetAddLibPath( xFP->getDisplayDirectory() ); + GetExtraData()->SetAddLibFilter( xFltMgr->getCurrentFilter() ); // library containers for import Reference< script::XLibraryContainer2 > xModLibContImport; @@ -875,7 +875,7 @@ void LibPage::InsertLib() Reference< script::XLibraryContainer > xModLibContImp( xModLibContImport, UNO_QUERY ); Reference< script::XLibraryContainer > xDlgLibContImp( xDlgLibContImport, UNO_QUERY ); - Sequence< ::rtl::OUString > aLibNames = BasicIDE::GetMergedLibraryNames( xModLibContImp, xDlgLibContImp ); + Sequence< ::rtl::OUString > aLibNames = GetMergedLibraryNames( xModLibContImp, xDlgLibContImp ); sal_Int32 nLibCount = aLibNames.getLength(); const ::rtl::OUString* pLibNames = aLibNames.getConstArray(); for ( sal_Int32 i = 0 ; i < nLibCount ; i++ ) @@ -1142,7 +1142,7 @@ void LibPage::InsertLib() delete pLibDlg; if ( bChanges ) - BasicIDE::MarkDocumentModified( m_aCurDocument ); + MarkDocumentModified( m_aCurDocument ); } } } @@ -1275,7 +1275,7 @@ void LibPage::ExportAsPackage( const String& aLibName ) xFltMgr->appendFilter( aTitle, aFilter ); // set display directory and filter - String aPath( BasicIDEGlobals::GetExtraData()->GetAddLibPath() ); + String aPath = GetExtraData()->GetAddLibPath(); if ( aPath.Len() ) { xFP->setDisplayDirectory( aPath ); @@ -1289,7 +1289,7 @@ void LibPage::ExportAsPackage( const String& aLibName ) if ( xFP->execute() == RET_OK ) { - BasicIDEGlobals::GetExtraData()->SetAddLibPath( xFP->getDisplayDirectory() ); + GetExtraData()->SetAddLibPath(xFP->getDisplayDirectory()); Sequence< ::rtl::OUString > aFiles = xFP->getFiles(); INetURLObject aURL( aFiles[0] ); @@ -1401,7 +1401,7 @@ void LibPage::ExportAsBasic( const String& aLibName ) xFolderPicker->setTitle( String( IDEResId( RID_STR_EXPORTBASIC ) ) ); // set display directory and filter - String aPath( BasicIDEGlobals::GetExtraData()->GetAddLibPath() ); + String aPath =GetExtraData()->GetAddLibPath(); if( !aPath.Len() ) aPath = SvtPathOptions().GetWorkPath(); @@ -1411,7 +1411,7 @@ void LibPage::ExportAsBasic( const String& aLibName ) if( nRet == RET_OK ) { String aTargetURL = xFolderPicker->getDirectory(); - BasicIDEGlobals::GetExtraData()->SetAddLibPath( aTargetURL ); + GetExtraData()->SetAddLibPath(aTargetURL); Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) ); implExportLib( aLibName, aTargetURL, xDummyHandler ); @@ -1442,14 +1442,9 @@ void LibPage::DeleteCurrent() // inform BasicIDE SfxUsrAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( m_aCurDocument.getDocumentOrNull() ) ); SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_LIBREMOVED, SFX_CALLMODE_SYNCHRON, &aDocItem, &aLibNameItem, 0L ); - } // remove library from module and dialog library containers if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) @@ -1457,8 +1452,8 @@ void LibPage::DeleteCurrent() if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) ) xDlgLibContainer->removeLibrary( aOULibName ); - ((SvLBox&)aLibBox).GetModel()->Remove( pCurEntry ); - BasicIDE::MarkDocumentModified( m_aCurDocument ); + static_cast<SvLBox&>(aLibBox).GetModel()->Remove( pCurEntry ); + MarkDocumentModified( m_aCurDocument ); } } @@ -1494,7 +1489,7 @@ void LibPage::InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocati { String aEntryText( rDocument.getTitle( eLocation ) ); sal_uInt16 nPos = aBasicsBox.InsertEntry( aEntryText, LISTBOX_APPEND ); - aBasicsBox.SetEntryData( nPos, new BasicDocumentEntry( rDocument, eLocation ) ); + aBasicsBox.SetEntryData( nPos, new DocumentEntry(rDocument, eLocation) ); } //---------------------------------------------------------------------------- @@ -1502,7 +1497,7 @@ void LibPage::InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocati void LibPage::SetCurLib() { sal_uInt16 nSelPos = aBasicsBox.GetSelectEntryPos(); - BasicDocumentEntry* pEntry = (BasicDocumentEntry*)aBasicsBox.GetEntryData( nSelPos ); + DocumentEntry* pEntry = (DocumentEntry*)aBasicsBox.GetEntryData( nSelPos ); if ( pEntry ) { ScriptDocument aDocument( pEntry->GetDocument() ); @@ -1555,7 +1550,7 @@ SvLBoxEntry* LibPage::ImpInsertLibEntry( const String& rLibName, sal_uLong nPos } SvLBoxEntry* pNewEntry = aLibBox.DoInsertEntry( rLibName, nPos ); - pNewEntry->SetUserData( new BasicLibUserData( m_aCurDocument ) ); + pNewEntry->SetUserData( new LibUserData(m_aCurDocument) ); if (bProtected) { @@ -1578,7 +1573,7 @@ SvLBoxEntry* LibPage::ImpInsertLibEntry( const String& rLibName, sal_uLong nPos // Helper function void createLibImpl( Window* pWin, const ScriptDocument& rDocument, - BasicCheckBox* pLibBox, BasicTreeListBox* pBasicBox ) + CheckBox* pLibBox, TreeListBox* pBasicBox ) { OSL_ENSURE( rDocument.isAlive(), "createLibImpl: invalid document!" ); if ( !rDocument.isAlive() ) @@ -1611,7 +1606,7 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument, { ErrorBox( pWin, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_LIBNAMETOLONG ) ) ).Execute(); } - else if ( !BasicIDE::IsValidSbxName( aLibName ) ) + else if ( !IsValidSbxName( aLibName ) ) { ErrorBox( pWin, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute(); @@ -1632,7 +1627,7 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument, if( pLibBox ) { SvLBoxEntry* pEntry = pLibBox->DoInsertEntry( aLibName ); - pEntry->SetUserData( new BasicLibUserData( rDocument ) ); + pEntry->SetUserData( new LibUserData( rDocument ) ); pLibBox->SetCurEntry( pEntry ); } @@ -1642,15 +1637,10 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument, if ( !rDocument.createModule( aLibName, aModName, true, sModuleCode ) ) throw Exception(); - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, TYPE_MODULE ); + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_SBXINSERTED, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } if( pBasicBox ) { @@ -1669,7 +1659,8 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument, aLibName, Image( IDEResId( nId ) ), pRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_LIBRARY ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_LIBRARY)) + ); DBG_ASSERT( pNewLibEntry, "InsertEntry fehlgeschlagen!" ); if( pNewLibEntry ) @@ -1678,7 +1669,8 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument, aModName, Image( IDEResId( RID_IMG_MODULE ) ), pNewLibEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_MODULE)) + ); DBG_ASSERT( pEntry_, "InsertEntry fehlgeschlagen!" ); pBasicBox->SetCurEntry( pEntry_ ); pBasicBox->Select( pBasicBox->GetCurEntry() ); // OV-Bug?! @@ -1695,4 +1687,6 @@ void createLibImpl( Window* pWin, const ScriptDocument& rDocument, //---------------------------------------------------------------------------- +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx index 968a7631192d..4ad0faaf06f9 100644 --- a/basctl/source/basicide/moduldlg.cxx +++ b/basctl/source/basicide/moduldlg.cxx @@ -41,20 +41,26 @@ #include <tools/diagnose_ex.h> #include <xmlscript/xmldlg_imexp.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::resource; -ExtBasicTreeListBox::ExtBasicTreeListBox( Window* pParent, const ResId& rRes ) - : BasicTreeListBox( pParent, rRes ) -{ -} +// +// ExtTreeListBox +// ============== +// -ExtBasicTreeListBox::~ExtBasicTreeListBox() -{ -} +ExtTreeListBox::ExtTreeListBox (Window* pParent, ResId const& rRes) : + TreeListBox( pParent, rRes ) +{ } + +ExtTreeListBox::~ExtTreeListBox () +{ } -sal_Bool ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) +sal_Bool ExtTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) { bool bRet = false; @@ -63,7 +69,7 @@ sal_Bool ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) sal_uInt16 nDepth = GetModel()->GetDepth( pEntry ); if ( nDepth >= 2 ) { - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); + EntryDescriptor aDesc = GetEntryDescriptor(pEntry); ScriptDocument aDocument( aDesc.GetDocument() ); ::rtl::OUString aLibName( aDesc.GetLibName() ); Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); @@ -80,9 +86,9 @@ sal_Bool ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) return bRet; } -sal_Bool ExtBasicTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& rNewText ) +sal_Bool ExtTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUString& rNewText ) { - if ( !BasicIDE::IsValidSbxName(rNewText) ) + if ( !IsValidSbxName(rNewText) ) { ErrorBox( this, WB_OK | WB_DEF_OK, IDE_RESSTR(RID_STR_BADSBXNAME) ).Execute(); return false; @@ -93,27 +99,24 @@ sal_Bool ExtBasicTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUStr // nothing to do return true; - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); + EntryDescriptor aDesc = GetEntryDescriptor(pEntry); ScriptDocument aDocument( aDesc.GetDocument() ); - DBG_ASSERT( aDocument.isValid(), "ExtBasicTreeListBox::EditedEntry: no document!" ); + DBG_ASSERT( aDocument.isValid(), "ExtTreeListBox::EditedEntry: no document!" ); if ( !aDocument.isValid() ) return false; ::rtl::OUString aLibName( aDesc.GetLibName() ); - BasicEntryType eType( aDesc.GetType() ); + EntryType eType = aDesc.GetType(); - bool bSuccess = ( eType == OBJ_TYPE_MODULE ) - ? BasicIDE::RenameModule( this, aDocument, aLibName, aCurText, rNewText ) - : BasicIDE::RenameDialog( this, aDocument, aLibName, aCurText, rNewText ); + bool bSuccess = eType == OBJ_TYPE_MODULE ? + RenameModule(this, aDocument, aLibName, aCurText, rNewText) : + RenameDialog(this, aDocument, aLibName, aCurText, rNewText); if ( !bSuccess ) return false; - BasicIDE::MarkDocumentModified( aDocument ); + MarkDocumentModified( aDocument ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) + if (SfxDispatcher* pDispatcher = GetDispatcher()) { SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, rNewText, ConvertType( eType ) ); pDispatcher->Execute( SID_BASICIDE_SBXRENAMED, @@ -131,7 +134,7 @@ sal_Bool ExtBasicTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const rtl::OUStr } -DragDropMode ExtBasicTreeListBox::NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* pEntry ) +DragDropMode ExtTreeListBox::NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* pEntry ) { DragDropMode nMode_ = SV_DRAGDROP_NONE; @@ -141,7 +144,7 @@ DragDropMode ExtBasicTreeListBox::NotifyStartDrag( TransferDataContainer&, SvLBo if ( nDepth >= 2 ) { nMode_ = SV_DRAGDROP_CTRL_COPY; - BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) ); + EntryDescriptor aDesc = GetEntryDescriptor(pEntry); ScriptDocument aDocument( aDesc.GetDocument() ); ::rtl::OUString aLibName( aDesc.GetLibName() ); // allow MOVE mode only for libraries, which are not readonly @@ -171,7 +174,7 @@ DragDropMode ExtBasicTreeListBox::NotifyStartDrag( TransferDataContainer&, SvLBo } -sal_Bool ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry ) +sal_Bool ExtTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry ) { // don't drop on a BasicManager (nDepth == 0) sal_uInt16 nDepth = pEntry ? GetModel()->GetDepth( pEntry ) : 0; @@ -189,14 +192,14 @@ sal_Bool ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry ) if ( bValid && ( nDepth > 0 ) ) { // get source module/dialog name - BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) ); - ::rtl::OUString aSourceName( aSourceDesc.GetName() ); - BasicEntryType eSourceType( aSourceDesc.GetType() ); + EntryDescriptor aSourceDesc = GetEntryDescriptor(pSelected); + rtl::OUString aSourceName = aSourceDesc.GetName(); + EntryType eSourceType = aSourceDesc.GetType(); // get target shell and target library name - BasicEntryDescriptor aDestDesc( GetEntryDescriptor( pEntry ) ); - const ScriptDocument& rDestDoc( aDestDesc.GetDocument() ); - ::rtl::OUString aDestLibName( aDestDesc.GetLibName() ); + EntryDescriptor aDestDesc = GetEntryDescriptor(pEntry); + ScriptDocument const& rDestDoc = aDestDesc.GetDocument(); + rtl::OUString aDestLibName = aDestDesc.GetLibName(); // check if module library is not loaded, readonly or password protected Reference< script::XLibraryContainer2 > xModLibContainer( rDestDoc.getLibraryContainer( E_SCRIPTS ), UNO_QUERY ); @@ -235,14 +238,14 @@ sal_Bool ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry ) return bValid; } -sal_Bool ExtBasicTreeListBox::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, +sal_Bool ExtTreeListBox::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) { return NotifyCopyingMoving( pTarget, pEntry, rpNewParent, rNewChildPos, true ); } -sal_Bool ExtBasicTreeListBox::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, +sal_Bool ExtTreeListBox::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos ) { // return false; // how do I copy an SBX?! @@ -250,9 +253,14 @@ sal_Bool ExtBasicTreeListBox::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* rpNewParent, rNewChildPos, false ); } -void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >& io_xISP, - const ScriptDocument& rSourceDoc, const ::rtl::OUString& rSourceLibName, const ScriptDocument& rDestDoc, - const ::rtl::OUString& rDestLibName, const ::rtl::OUString& rDlgName ) +void Shell::CopyDialogResources( + Reference< io::XInputStreamProvider >& io_xISP, + ScriptDocument const& rSourceDoc, + rtl::OUString const& rSourceLibName, + ScriptDocument const& rDestDoc, + rtl::OUString const& rDestLibName, + rtl::OUString const& rDlgName +) { if ( !io_xISP.is() ) return; @@ -306,7 +314,7 @@ void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >& } -sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, +sal_Bool ExtTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry, SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos, sal_Bool bMove ) { (void)pEntry; @@ -328,21 +336,19 @@ sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxE } // get target shell and target library name - BasicEntryDescriptor aDestDesc( GetEntryDescriptor( rpNewParent ) ); + EntryDescriptor aDestDesc = GetEntryDescriptor(rpNewParent); const ScriptDocument& rDestDoc( aDestDesc.GetDocument() ); ::rtl::OUString aDestLibName( aDestDesc.GetLibName() ); // get source shell, library name and module/dialog name - BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( FirstSelected() ) ); + EntryDescriptor aSourceDesc = GetEntryDescriptor(FirstSelected()); const ScriptDocument rSourceDoc( aSourceDesc.GetDocument() ); ::rtl::OUString aSourceLibName( aSourceDesc.GetLibName() ); ::rtl::OUString aSourceName( aSourceDesc.GetName() ); - BasicEntryType eType( aSourceDesc.GetType() ); + EntryType eType = aSourceDesc.GetType(); // get dispatcher - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; + SfxDispatcher* pDispatcher = GetDispatcher(); if ( bMove ) // move { @@ -368,11 +374,11 @@ sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxE // remove module from source library if ( rSourceDoc.removeModule( aSourceLibName, aSourceName ) ) { - BasicIDE::MarkDocumentModified( rSourceDoc ); + MarkDocumentModified( rSourceDoc ); // insert module into target library if ( rDestDoc.insertModule( aDestLibName, aSourceName, aModule ) ) - BasicIDE::MarkDocumentModified( rDestDoc ); + MarkDocumentModified( rDestDoc ); } } } @@ -382,17 +388,17 @@ sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxE Reference< io::XInputStreamProvider > xISP; if ( rSourceDoc.getDialog( aSourceLibName, aSourceName, xISP ) ) { - BasicIDEShell::CopyDialogResources( xISP, rSourceDoc, + Shell::CopyDialogResources( xISP, rSourceDoc, aSourceLibName, rDestDoc, aDestLibName, aSourceName ); // remove dialog from source library - if ( BasicIDE::RemoveDialog( rSourceDoc, aSourceLibName, aSourceName ) ) + if (RemoveDialog(rSourceDoc, aSourceLibName, aSourceName)) { - BasicIDE::MarkDocumentModified( rSourceDoc ); + MarkDocumentModified(rSourceDoc); // insert dialog into target library if ( rDestDoc.insertDialog( aDestLibName, aSourceName, xISP ) ) - BasicIDE::MarkDocumentModified( rDestDoc ); + MarkDocumentModified(rDestDoc); } } } @@ -414,7 +420,7 @@ sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxE { // insert module into target library if ( rDestDoc.insertModule( aDestLibName, aSourceName, aModule ) ) - BasicIDE::MarkDocumentModified( rDestDoc ); + MarkDocumentModified( rDestDoc ); } } else if ( eType == OBJ_TYPE_DIALOG ) // dialog @@ -423,12 +429,12 @@ sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxE Reference< io::XInputStreamProvider > xISP; if ( rSourceDoc.getDialog( aSourceLibName, aSourceName, xISP ) ) { - BasicIDEShell::CopyDialogResources( xISP, rSourceDoc, + Shell::CopyDialogResources( xISP, rSourceDoc, aSourceLibName, rDestDoc, aDestLibName, aSourceName ); // insert dialog into target library if ( rDestDoc.insertDialog( aDestLibName, aSourceName, xISP ) ) - BasicIDE::MarkDocumentModified( rDestDoc ); + MarkDocumentModified( rDestDoc ); } } } @@ -452,7 +458,12 @@ sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxE return 2; // open... } -OrganizeDialog::OrganizeDialog( Window* pParent, sal_Int16 tabId, BasicEntryDescriptor& rDesc ) +// +// OrganizeDialog +// ============== +// + +OrganizeDialog::OrganizeDialog( Window* pParent, sal_Int16 tabId, EntryDescriptor& rDesc ) :TabDialog( pParent, IDEResId( RID_TD_ORGANIZE ) ) ,aTabCtrl( this, IDEResId( RID_TC_ORGANIZE ) ) ,m_aCurEntry( rDesc ) @@ -474,13 +485,8 @@ OrganizeDialog::OrganizeDialog( Window* pParent, sal_Int16 tabId, BasicEntryDesc ActivatePageHdl( &aTabCtrl ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES ); - } } OrganizeDialog::~OrganizeDialog() @@ -510,22 +516,25 @@ IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl ) { case RID_TP_MOD: { - pNewTabPage = new ObjectPage( pTabCtrl, IDEResId( RID_TP_MODULS ), BROWSEMODE_MODULES ); - ((ObjectPage*)pNewTabPage)->SetTabDlg( this ); - ((ObjectPage*)pNewTabPage)->SetCurrentEntry( m_aCurEntry ); + ObjectPage* pObjectPage = new ObjectPage(pTabCtrl, IDEResId(RID_TP_MODULS), BROWSEMODE_MODULES); + pNewTabPage = pObjectPage; + pObjectPage->SetTabDlg(this); + pObjectPage->SetCurrentEntry(m_aCurEntry); } break; case RID_TP_DLG: { - pNewTabPage = new ObjectPage( pTabCtrl, IDEResId( RID_TP_DLGS ), BROWSEMODE_DIALOGS ); - ((ObjectPage*)pNewTabPage)->SetTabDlg( this ); - ((ObjectPage*)pNewTabPage)->SetCurrentEntry( m_aCurEntry ); + ObjectPage* pObjectPage = new ObjectPage( pTabCtrl, IDEResId( RID_TP_DLGS ), BROWSEMODE_DIALOGS ); + pNewTabPage = pObjectPage; + pObjectPage->SetTabDlg(this); + pObjectPage->SetCurrentEntry(m_aCurEntry); } break; case RID_TP_LIB: { - pNewTabPage = new LibPage( pTabCtrl ); - ((LibPage*)pNewTabPage)->SetTabDlg( this ); + LibPage* pLibPage = new LibPage( pTabCtrl ); + pNewTabPage = pLibPage; + pLibPage->SetTabDlg( this ); } break; default: OSL_FAIL( "PageHdl: Unbekannte ID!" ); @@ -536,6 +545,11 @@ IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl ) return 0; } +// +// ObjectPage +// ========== +// + ObjectPage::ObjectPage( Window * pParent, const ResId& rResId, sal_uInt16 nMode ) : TabPage( pParent, rResId ), aLibText( this, IDEResId( RID_STR_LIB ) ), @@ -578,7 +592,7 @@ ObjectPage::ObjectPage( Window * pParent, const ResId& rResId, sal_uInt16 nMode CheckButtons(); } -void ObjectPage::SetCurrentEntry( BasicEntryDescriptor& rDesc ) +void ObjectPage::SetCurrentEntry (EntryDescriptor& rDesc) { aBasicBox.SetCurrentEntry( rDesc ); } @@ -596,7 +610,7 @@ void ObjectPage::CheckButtons() { // enable/disable edit button SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); ScriptDocument aDocument( aDesc.GetDocument() ); ::rtl::OUString aLibName( aDesc.GetLibName() ); ::rtl::OUString aLibSubName( aDesc.GetLibSubName() ); @@ -650,7 +664,7 @@ void ObjectPage::CheckButtons() aDelButton.Disable(); } -IMPL_LINK( ObjectPage, BasicBoxHighlightHdl, BasicTreeListBox *, pBox ) +IMPL_LINK( ObjectPage, BasicBoxHighlightHdl, TreeListBox *, pBox ) { if ( !pBox->IsSelected( pBox->GetHdlEntry() ) ) return 0; @@ -667,14 +681,12 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton ) SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs ); SFX_APP()->ExecuteSlot( aRequest ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; + SfxDispatcher* pDispatcher = GetDispatcher(); SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); DBG_ASSERT( pCurEntry, "Entry?!" ); if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) >= 2 ) { - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); if ( pDispatcher ) { ::rtl::OUString aModName( aDesc.GetName() ); @@ -696,9 +708,9 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton ) SvLBoxEntry* pParentEntry = aBasicBox.GetParent( pCurEntry ); if ( pParentEntry ) { - BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pParentEntry->GetUserData(); - if ( pBasicDocumentEntry ) - aDocument = pBasicDocumentEntry->GetDocument(); + DocumentEntry* pDocumentEntry = (DocumentEntry*)pParentEntry->GetUserData(); + if (pDocumentEntry) + aDocument = pDocumentEntry->GetDocument(); } SfxUsrAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( aDocument.getDocumentOrNull() ) ); ::rtl::OUString aLibName( aBasicBox.GetEntryText( pCurEntry ) ); @@ -727,7 +739,7 @@ bool ObjectPage::GetSelection( ScriptDocument& rDocument, ::rtl::OUString& rLibN bool bRet = false; SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc = aBasicBox.GetEntryDescriptor(pCurEntry); rDocument = aDesc.GetDocument(); rLibName = aDesc.GetLibName(); if ( rLibName.isEmpty() ) @@ -814,15 +826,10 @@ void ObjectPage::NewDialog() if ( !aDocument.createDialog( aLibName, aDlgName, xISP ) ) return; - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, aDlgName, BASICIDE_TYPE_DIALOG ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, aDlgName, TYPE_DIALOG ); + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_SBXINSERTED, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName ); SvLBoxEntry* pRootEntry = aBasicBox.FindRootEntry( aDocument, eLocation ); if ( pRootEntry ) @@ -843,7 +850,8 @@ void ObjectPage::NewDialog() aDlgName, Image( IDEResId( RID_IMG_DIALOG ) ), pLibEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_DIALOG ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_DIALOG)) + ); SAL_WNODEPRECATED_DECLARATIONS_POP DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" ); } @@ -860,14 +868,14 @@ void ObjectPage::DeleteCurrent() { SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry(); DBG_ASSERT( pCurEntry, "Kein aktueller Eintrag!" ); - BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); + EntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) ); ScriptDocument aDocument( aDesc.GetDocument() ); DBG_ASSERT( aDocument.isAlive(), "ObjectPage::DeleteCurrent: no document!" ); if ( !aDocument.isAlive() ) return; ::rtl::OUString aLibName( aDesc.GetLibName() ); ::rtl::OUString aName( aDesc.GetName() ); - BasicEntryType eType( aDesc.GetType() ); + EntryType eType = aDesc.GetType(); if ( ( eType == OBJ_TYPE_MODULE && QueryDelModule( aName, this ) ) || ( eType == OBJ_TYPE_DIALOG && QueryDelDialog( aName, this ) ) ) @@ -875,10 +883,7 @@ void ObjectPage::DeleteCurrent() aBasicBox.GetModel()->Remove( pCurEntry ); if ( aBasicBox.GetCurEntry() ) // OV-Bug ? aBasicBox.Select( aBasicBox.GetCurEntry() ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) + if (SfxDispatcher* pDispatcher = GetDispatcher()) { SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, aName, aBasicBox.ConvertType( eType ) ); pDispatcher->Execute( SID_BASICIDE_SBXDELETED, @@ -891,10 +896,10 @@ void ObjectPage::DeleteCurrent() if ( eType == OBJ_TYPE_MODULE ) bSuccess = aDocument.removeModule( aLibName, aName ); else if ( eType == OBJ_TYPE_DIALOG ) - bSuccess = BasicIDE::RemoveDialog( aDocument, aLibName, aName ); + bSuccess = RemoveDialog( aDocument, aLibName, aName ); if ( bSuccess ) - BasicIDE::MarkDocumentModified( aDocument ); + MarkDocumentModified( aDocument ); } catch (const container::NoSuchElementException& ) { @@ -941,7 +946,7 @@ void LibDialog::SetStorageName( const ::rtl::OUString& rName ) // Helper function SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, - BasicTreeListBox& rBasicBox, const ::rtl::OUString& rLibName, ::rtl::OUString aModName, bool bMain ) + TreeListBox& rBasicBox, const ::rtl::OUString& rLibName, ::rtl::OUString aModName, bool bMain ) { OSL_ENSURE( rDocument.isAlive(), "createModImpl: invalid document!" ); if ( !rDocument.isAlive() ) @@ -976,15 +981,10 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0; if ( pBasic ) pModule = pBasic->FindModule( aModName ); - SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE ); - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; - SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL; - if( pDispatcher ) - { + SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, TYPE_MODULE ); + if (SfxDispatcher* pDispatcher = GetDispatcher()) pDispatcher->Execute( SID_BASICIDE_SBXINSERTED, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L ); - } LibraryLocation eLocation = rDocument.getLibraryLocation( aLibName ); SvLBoxEntry* pRootEntry = rBasicBox.FindRootEntry( rDocument, eLocation ); if ( pRootEntry ) @@ -1018,7 +1018,8 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, aModName, Image( IDEResId( RID_IMG_MODULE ) ), pSubRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); + std::auto_ptr<Entry>(new Entry(OBJ_TYPE_MODULE)) + ); SAL_WNODEPRECATED_DECLARATIONS_POP DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" ); } @@ -1040,4 +1041,7 @@ SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, return pModule; } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/moduldlg.hrc b/basctl/source/basicide/moduldlg.hrc index 3864641be3a7..e0a669b363ed 100644 --- a/basctl/source/basicide/moduldlg.hrc +++ b/basctl/source/basicide/moduldlg.hrc @@ -16,8 +16,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _MODULDLG_HRC -#define _MODULDLG_HRC +#ifndef BASCTL_MODULDLG_HRC +#define BASCTL_MODULDLG_HRC #include <svl/solar.hrc> @@ -56,4 +56,4 @@ #define RB_EXPORTASPACKAGE 42 #define RB_EXPORTASBASIC 43 -#endif // _MODULDLG_HRC +#endif // BASCTL_MODULDLG_HRC diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index 81fff6afd922..cef214336345 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _MODULDLG_HXX -#define _MODULDLG_HXX +#ifndef BASCTL_MODULDLG_HXX +#define BASCTL_MODULDLG_HXX #include <svheader.hxx> @@ -35,6 +35,11 @@ #include <vcl/tabctrl.hxx> #include <vcl/lstbox.hxx> +class SvxPasswordDialog; + +namespace basctl +{ + enum NewObjectMode { NEWOBJECTMODE_LIB = 1, @@ -93,7 +98,7 @@ public: }; -class ExtBasicTreeListBox : public BasicTreeListBox +class ExtTreeListBox : public TreeListBox { protected: virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSel ); @@ -110,14 +115,14 @@ protected: SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos, sal_Bool bMove ); public: - ExtBasicTreeListBox( Window* pParent, const ResId& rRes ); - ~ExtBasicTreeListBox(); + ExtTreeListBox( Window* pParent, const ResId& rRes ); + ~ExtTreeListBox(); }; #define LIBMODE_CHOOSER 1 #define LIBMODE_MANAGER 2 -class BasicCheckBox : public SvTabListBox +class CheckBox : public SvTabListBox { private: NewObjectMode nMode; @@ -126,8 +131,8 @@ private: void Init(); public: - BasicCheckBox( Window* pParent, const ResId& rResId ); - ~BasicCheckBox(); + CheckBox( Window* pParent, const ResId& rResId ); + ~CheckBox(); SvLBoxEntry* DoInsertEntry( const String& rStr, sal_uLong nPos = LISTBOX_APPEND ); SvLBoxEntry* FindEntry( const String& rName ); @@ -151,10 +156,10 @@ private: OKButton aOKButton; CancelButton aCancelButton; FixedText aStorageName; - BasicCheckBox aLibBox; + CheckBox aLibBox; FixedLine aFixedLine; - CheckBox aReferenceBox; - CheckBox aReplaceBox; + ::CheckBox aReferenceBox; + ::CheckBox aReplaceBox; public: LibDialog( Window* pParent ); @@ -162,7 +167,7 @@ public: void SetStorageName( const ::rtl::OUString& rName ); - BasicCheckBox& GetLibBox() { return aLibBox; } + CheckBox& GetLibBox() { return aLibBox; } bool IsReference() const { return aReferenceBox.IsChecked(); } bool IsReplace() const { return aReplaceBox.IsChecked(); } @@ -174,12 +179,12 @@ public: class OrganizeDialog : public TabDialog { private: - TabControl aTabCtrl; - BasicEntryDescriptor m_aCurEntry; + TabControl aTabCtrl; + EntryDescriptor m_aCurEntry; public: - OrganizeDialog( Window* pParent, sal_Int16 tabId, BasicEntryDescriptor& rDesc ); - ~OrganizeDialog(); + OrganizeDialog( Window* pParent, sal_Int16 tabId, EntryDescriptor& rDesc ); + ~OrganizeDialog(); virtual short Execute(); @@ -190,14 +195,14 @@ class ObjectPage: public TabPage { protected: FixedText aLibText; - ExtBasicTreeListBox aBasicBox; + ExtTreeListBox aBasicBox; PushButton aEditButton; CancelButton aCloseButton; PushButton aNewModButton; PushButton aNewDlgButton; PushButton aDelButton; - DECL_LINK( BasicBoxHighlightHdl, BasicTreeListBox * ); + DECL_LINK( BasicBoxHighlightHdl, TreeListBox * ); DECL_LINK( ButtonHdl, Button * ); void CheckButtons(); bool GetSelection( ScriptDocument& rDocument, ::rtl::OUString& rLibName ); @@ -214,20 +219,18 @@ protected: public: ObjectPage( Window* pParent, const ResId& rResId, sal_uInt16 nMode ); - void SetCurrentEntry( BasicEntryDescriptor& rDesc ); + void SetCurrentEntry( EntryDescriptor& rDesc ); void SetTabDlg( TabDialog* p ) { pTabDlg = p;} }; -class SvxPasswordDialog; - class LibPage: public TabPage { protected: FixedText aBasicsText; ListBox aBasicsBox; FixedText aLibText; - BasicCheckBox aLibBox; + CheckBox aLibBox; PushButton aEditButton; CancelButton aCloseButton; PushButton aPasswordButton; @@ -271,10 +274,12 @@ public: // Helper functions SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument, - BasicTreeListBox& rBasicBox, const ::rtl::OUString& rLibName, ::rtl::OUString aModName, bool bMain = false ); + TreeListBox& rBasicBox, const ::rtl::OUString& rLibName, ::rtl::OUString aModName, bool bMain = false ); void createLibImpl( Window* pWin, const ScriptDocument& rDocument, - BasicCheckBox* pLibBox, BasicTreeListBox* pBasicBox ); + CheckBox* pLibBox, TreeListBox* pBasicBox ); + +} // namespace basctl -#endif // _MODULDLG_HXX +#endif // BASCTL_MODULDLG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/moptions.hrc b/basctl/source/basicide/moptions.hrc index 68a5a0e1e054..4cb01d8c5f5c 100644 --- a/basctl/source/basicide/moptions.hrc +++ b/basctl/source/basicide/moptions.hrc @@ -15,8 +15,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _MOPTIONS_HRC -#define _MOPTIONS_HRC +#ifndef BASCTL_MOPTIONS_HRC +#define BASCTL_MOPTIONS_HRC #include <svl/solar.hrc> @@ -34,5 +34,5 @@ #define RID_FT_HELPNAME 11 #define RID_ED_HELPNAME 12 -#endif // _MOPTIONS_HRC +#endif // BASCTL_MOPTIONS_HRC diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx index 37800397d278..cb707e9119fe 100644 --- a/basctl/source/basicide/objdlg.cxx +++ b/basctl/source/basicide/objdlg.cxx @@ -38,7 +38,7 @@ namespace basctl { ObjectCatalog::ObjectCatalog (Window* pParent) : - BasicDockingWindow(pParent), + DockingWindow(pParent), aTitle(this), aTree(this, IDEResId(RID_TLB_MACROS)) { @@ -92,7 +92,7 @@ void ObjectCatalog::Resize () void ObjectCatalog::ToggleFloatingMode () { // base class version - BasicDockingWindow::ToggleFloatingMode(); + DockingWindow::ToggleFloatingMode(); // rearranging the controls (title) ArrangeWindows(); } @@ -132,9 +132,9 @@ void ObjectCatalog::ArrangeWindows () aTree.Hide(); } -void ObjectCatalog::SetCurrentEntry (IDEBaseWindow* pCurWin) +void ObjectCatalog::SetCurrentEntry (BaseWindow* pCurWin) { - BasicEntryDescriptor aDescriptor; + EntryDescriptor aDescriptor; if (pCurWin) aDescriptor = pCurWin->CreateEntryDescriptor(); aTree.SetCurrentEntry(aDescriptor); diff --git a/basctl/source/basicide/objdlg.hxx b/basctl/source/basicide/objdlg.hxx index d4477212448a..fd5420ff073b 100644 --- a/basctl/source/basicide/objdlg.hxx +++ b/basctl/source/basicide/objdlg.hxx @@ -36,20 +36,20 @@ namespace basctl // ObjectCatalog -- a docking window that contains the currently loaded macros // in a tree structure. // -class ObjectCatalog : public BasicDockingWindow +class ObjectCatalog : public DockingWindow { public: ObjectCatalog (Window* pParent); virtual ~ObjectCatalog (); public: void UpdateEntries () { aTree.UpdateEntries(); } - void SetCurrentEntry (IDEBaseWindow* pCurWin); + void SetCurrentEntry (BaseWindow* pCurWin); private: // title: "Object Catalog" FixedText aTitle; // the tree-list of the objects - BasicTreeListBox aTree; + TreeListBox aTree; private: virtual void Resize (); // Window diff --git a/basctl/source/basicide/register.cxx b/basctl/source/basicide/register.cxx index a2c04defad7f..b2846591dc63 100644 --- a/basctl/source/basicide/register.cxx +++ b/basctl/source/basicide/register.cxx @@ -26,12 +26,14 @@ #include "unomodel.hxx" +namespace basctl +{ + using ::rtl::OUString; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; - extern "C" { SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, @@ -71,8 +73,9 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImple // Return with result of this operation. return pReturn ; } -} // extern "C" +} // extern "C" +} // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/sbxitem.cxx b/basctl/source/basicide/sbxitem.cxx index ab75ee8ad34b..a53b1b28323a 100644 --- a/basctl/source/basicide/sbxitem.cxx +++ b/basctl/source/basicide/sbxitem.cxx @@ -19,34 +19,38 @@ #include "sbxitem.hxx" -SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName, const ::rtl::OUString& aName, BasicIDEType nType) - :SfxPoolItem( nWhich_ ) - ,m_aDocument(rDocument) - ,m_aLibName(aLibName) - ,m_aName(aName) - ,m_nType(nType) +namespace basctl { -} -SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName, const ::rtl::OUString& aName, const ::rtl::OUString& aMethodName, BasicIDEType nType) - :SfxPoolItem( nWhich_ ) - ,m_aDocument(rDocument) - ,m_aLibName(aLibName) - ,m_aName(aName) - ,m_aMethodName(aMethodName) - ,m_nType(nType) -{ -} +SbxItem::SbxItem ( + sal_uInt16 nWhichItem, + ScriptDocument const& rDocument, + rtl::OUString const& aLibName, + rtl::OUString const& aName, + ItemType eType +) : + SfxPoolItem(nWhichItem), + m_aDocument(rDocument), + m_aLibName(aLibName), + m_aName(aName), + m_eType(eType) +{ } -SbxItem::SbxItem(const SbxItem& rCopy) - :SfxPoolItem(rCopy) - ,m_aDocument(rCopy.m_aDocument) - ,m_aLibName(rCopy.m_aLibName) - ,m_aName(rCopy.m_aName) - ,m_aMethodName(rCopy.m_aMethodName) - ,m_nType(rCopy.m_nType) -{ -} +SbxItem::SbxItem ( + sal_uInt16 nWhichItem, + ScriptDocument const& rDocument, + rtl::OUString const& aLibName, + rtl::OUString const& aName, + rtl::OUString const& aMethodName, + ItemType eType +) : + SfxPoolItem(nWhichItem), + m_aDocument(rDocument), + m_aLibName(aLibName), + m_aName(aName), + m_aMethodName(aMethodName), + m_eType(eType) +{ } SfxPoolItem *SbxItem::Clone(SfxItemPool*) const { @@ -63,32 +67,9 @@ int SbxItem::operator==(const SfxPoolItem& rCmp) const m_aLibName == pSbxItem->m_aLibName && m_aName == pSbxItem->m_aName && m_aMethodName == pSbxItem->m_aMethodName && - m_nType == pSbxItem->m_nType; + m_eType == pSbxItem->m_eType; } -const ScriptDocument& SbxItem::GetDocument() const -{ - return m_aDocument; -} - -const ::rtl::OUString& SbxItem::GetLibName() const -{ - return m_aLibName; -} - -const ::rtl::OUString& SbxItem::GetName() const -{ - return m_aName; -} - -const ::rtl::OUString& SbxItem::GetMethodName() const -{ - return m_aMethodName; -} - -BasicIDEType SbxItem::GetType() const -{ - return m_nType; -} +} // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index e9b0a30d011d..751a33219215 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -191,7 +191,7 @@ namespace basctl } } - class ScriptDocument_Impl : public DocumentEventListener + class ScriptDocument::Impl : public DocumentEventListener { private: bool m_bIsApplication; @@ -204,9 +204,9 @@ namespace basctl m_pDocListener; public: - ScriptDocument_Impl( ); - ScriptDocument_Impl( const Reference< XModel >& _rxDocument ); - ~ScriptDocument_Impl(); + Impl (); + Impl (Reference<XModel> const& rxDocument); + ~Impl (); /** determines whether the instance refers to a valid "document" with script and dialog libraries @@ -295,16 +295,16 @@ namespace basctl }; //==================================================================== - //= ScriptDocument_Impl - implementation + //= ScriptDocument::Impl - implementation //==================================================================== - ScriptDocument_Impl::ScriptDocument_Impl() + ScriptDocument::Impl::Impl() :m_bIsApplication( true ) ,m_bValid( true ) ,m_bDocumentClosed( false ) { } - ScriptDocument_Impl::ScriptDocument_Impl( const Reference< XModel >& _rxDocument ) + ScriptDocument::Impl::Impl( const Reference< XModel >& _rxDocument ) :m_bIsApplication( false ) ,m_bValid( false ) ,m_bDocumentClosed( false ) @@ -317,12 +317,12 @@ namespace basctl } } - ScriptDocument_Impl::~ScriptDocument_Impl() + ScriptDocument::Impl::~Impl() { invalidate(); } - void ScriptDocument_Impl::invalidate() + void ScriptDocument::Impl::invalidate() { m_bIsApplication = false; m_bValid = false; @@ -336,7 +336,7 @@ namespace basctl m_pDocListener->dispose(); } - bool ScriptDocument_Impl::impl_initDocument_nothrow( const Reference< XModel >& _rxModel ) + bool ScriptDocument::Impl::impl_initDocument_nothrow( const Reference< XModel >& _rxModel ) { try { @@ -363,9 +363,9 @@ namespace basctl return m_bValid; } - Reference< XLibraryContainer > ScriptDocument_Impl::getLibraryContainer( LibraryContainerType _eType ) const + Reference< XLibraryContainer > ScriptDocument::Impl::getLibraryContainer( LibraryContainerType _eType ) const { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getLibraryContainer: invalid!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::getLibraryContainer: invalid!" ); Reference< XLibraryContainer > xContainer; if ( !isValid() ) @@ -389,10 +389,10 @@ namespace basctl return xContainer; } - bool ScriptDocument_Impl::isReadOnly() const + bool ScriptDocument::Impl::isReadOnly() const { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::isReadOnly: invalid state!" ); - OSL_ENSURE( !isApplication(), "ScriptDocument_Impl::isReadOnly: not allowed to be called for the application!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::isReadOnly: invalid state!" ); + OSL_ENSURE( !isApplication(), "ScriptDocument::Impl::isReadOnly: not allowed to be called for the application!" ); bool bIsReadOnly = true; if ( isValid() && !isApplication() ) @@ -411,7 +411,7 @@ namespace basctl return bIsReadOnly; } - bool ScriptDocument_Impl::isInVBAMode() const + bool ScriptDocument::Impl::isInVBAMode() const { bool bResult = false; if ( !isApplication() ) @@ -424,9 +424,9 @@ namespace basctl } - BasicManager* ScriptDocument_Impl::getBasicManager() const + BasicManager* ScriptDocument::Impl::getBasicManager() const { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getBasicManager: invalid state!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::getBasicManager: invalid state!" ); if ( !isValid() ) return NULL; @@ -437,10 +437,10 @@ namespace basctl } - Reference< XModel > ScriptDocument_Impl::getDocument() const + Reference< XModel > ScriptDocument::Impl::getDocument() const { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getDocument: invalid state!" ); - OSL_ENSURE( isDocument(), "ScriptDocument_Impl::getDocument: for documents only!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::getDocument: invalid state!" ); + OSL_ENSURE( isDocument(), "ScriptDocument::Impl::getDocument: for documents only!" ); if ( !isValid() || !isDocument() ) return NULL; @@ -448,10 +448,10 @@ namespace basctl } - Reference< XNameContainer > ScriptDocument_Impl::getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const + Reference< XNameContainer > ScriptDocument::Impl::getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const SAL_THROW((NoSuchElementException)) { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getLibrary: invalid state!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::getLibrary: invalid state!" ); Reference< XNameContainer > xContainer; try @@ -483,7 +483,7 @@ namespace basctl } - bool ScriptDocument_Impl::hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const + bool ScriptDocument::Impl::hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const { bool bHas = false; try @@ -499,7 +499,7 @@ namespace basctl } - Reference< XNameContainer > ScriptDocument_Impl::getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const + Reference< XNameContainer > ScriptDocument::Impl::getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const { Reference< XNameContainer > xLibrary; try @@ -521,7 +521,7 @@ namespace basctl } - void ScriptDocument_Impl::loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary ) + void ScriptDocument::Impl::loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary ) { try { @@ -536,9 +536,9 @@ namespace basctl } - bool ScriptDocument_Impl::removeModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ) + bool ScriptDocument::Impl::removeModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ) { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::removeModuleOrDialog: invalid!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::removeModuleOrDialog: invalid!" ); if ( isValid() ) { try @@ -559,9 +559,9 @@ namespace basctl } - bool ScriptDocument_Impl::hasModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName ) const + bool ScriptDocument::Impl::hasModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName ) const { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::hasModuleOrDialog: invalid!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::hasModuleOrDialog: invalid!" ); if ( !isValid() ) return false; @@ -579,9 +579,9 @@ namespace basctl } - bool ScriptDocument_Impl::getModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, Any& _out_rModuleOrDialog ) + bool ScriptDocument::Impl::getModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, Any& _out_rModuleOrDialog ) { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::getModuleOrDialog: invalid!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::getModuleOrDialog: invalid!" ); if ( !isValid() ) return false; @@ -603,10 +603,10 @@ namespace basctl } - bool ScriptDocument_Impl::renameModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, + bool ScriptDocument::Impl::renameModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel ) { - OSL_ENSURE( isValid(), "ScriptDocument_Impl::renameModuleOrDialog: invalid!" ); + OSL_ENSURE( isValid(), "ScriptDocument::Impl::renameModuleOrDialog: invalid!" ); if ( !isValid() ) return false; @@ -671,7 +671,7 @@ namespace basctl } - bool ScriptDocument_Impl::createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const + bool ScriptDocument::Impl::createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const { _out_rNewModuleCode = ::rtl::OUString(); try @@ -698,7 +698,7 @@ namespace basctl } - bool ScriptDocument_Impl::insertModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, const Any& _rElement ) const + bool ScriptDocument::Impl::insertModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, const Any& _rElement ) const { try { @@ -717,7 +717,7 @@ namespace basctl } - bool ScriptDocument_Impl::updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const + bool ScriptDocument::Impl::updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const { try { @@ -735,7 +735,7 @@ namespace basctl } - bool ScriptDocument_Impl::createDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const + bool ScriptDocument::Impl::createDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const { try { @@ -771,9 +771,9 @@ namespace basctl } - void ScriptDocument_Impl::setDocumentModified() const + void ScriptDocument::Impl::setDocumentModified() const { - OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::setDocumentModified: only to be called for real documents!" ); + OSL_ENSURE( isValid() && isDocument(), "ScriptDocument::Impl::setDocumentModified: only to be called for real documents!" ); if ( isValid() && isDocument() ) { try @@ -788,9 +788,9 @@ namespace basctl } - bool ScriptDocument_Impl::isDocumentModified() const + bool ScriptDocument::Impl::isDocumentModified() const { - OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::isDocumentModified: only to be called for real documents!" ); + OSL_ENSURE( isValid() && isDocument(), "ScriptDocument::Impl::isDocumentModified: only to be called for real documents!" ); bool bIsModified = false; if ( isValid() && isDocument() ) { @@ -807,7 +807,7 @@ namespace basctl } - bool ScriptDocument_Impl::saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const + bool ScriptDocument::Impl::saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const { Reference< XFrame > xFrame; if ( !getCurrentFrame( xFrame ) ) @@ -846,9 +846,9 @@ namespace basctl } - ::rtl::OUString ScriptDocument_Impl::getTitle() const + ::rtl::OUString ScriptDocument::Impl::getTitle() const { - OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getTitle: for documents only!" ); + OSL_PRECOND( isValid() && isDocument(), "ScriptDocument::Impl::getTitle: for documents only!" ); ::rtl::OUString sTitle; if ( isValid() && isDocument() ) @@ -859,9 +859,9 @@ namespace basctl } - ::rtl::OUString ScriptDocument_Impl::getURL() const + ::rtl::OUString ScriptDocument::Impl::getURL() const { - OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getURL: for documents only!" ); + OSL_PRECOND( isValid() && isDocument(), "ScriptDocument::Impl::getURL: for documents only!" ); ::rtl::OUString sURL; if ( isValid() && isDocument() ) @@ -879,9 +879,9 @@ namespace basctl } - bool ScriptDocument_Impl::allowMacros() const + bool ScriptDocument::Impl::allowMacros() const { - OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::allowMacros: for documents only!" ); + OSL_ENSURE( isValid() && isDocument(), "ScriptDocument::Impl::allowMacros: for documents only!" ); bool bAllow = false; if ( isValid() && isDocument() ) { @@ -898,10 +898,10 @@ namespace basctl } - bool ScriptDocument_Impl::getCurrentFrame( Reference< XFrame >& _out_rxFrame ) const + bool ScriptDocument::Impl::getCurrentFrame( Reference< XFrame >& _out_rxFrame ) const { _out_rxFrame.clear(); - OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getCurrentFrame: documents only!" ); + OSL_PRECOND( isValid() && isDocument(), "ScriptDocument::Impl::getCurrentFrame: documents only!" ); if ( !isValid() || !isDocument() ) return false; @@ -920,7 +920,7 @@ namespace basctl } - bool ScriptDocument_Impl::isLibraryShared( const ::rtl::OUString& _rLibName, LibraryContainerType _eType ) + bool ScriptDocument::Impl::isLibraryShared( const ::rtl::OUString& _rLibName, LibraryContainerType _eType ) { bool bIsShared = false; try @@ -991,43 +991,43 @@ namespace basctl } - void ScriptDocument_Impl::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) + void ScriptDocument::Impl::onDocumentCreated( const ScriptDocument& /*_rDocument*/ ) { // not interested in } - void ScriptDocument_Impl::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) + void ScriptDocument::Impl::onDocumentOpened( const ScriptDocument& /*_rDocument*/ ) { // not interested in } - void ScriptDocument_Impl::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) + void ScriptDocument::Impl::onDocumentSave( const ScriptDocument& /*_rDocument*/ ) { // not interested in } - void ScriptDocument_Impl::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) + void ScriptDocument::Impl::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ ) { // not interested in } - void ScriptDocument_Impl::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) + void ScriptDocument::Impl::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ ) { // not interested in } - void ScriptDocument_Impl::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) + void ScriptDocument::Impl::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ ) { // not interested in } - void ScriptDocument_Impl::onDocumentClosed( const ScriptDocument& _rDocument ) + void ScriptDocument::Impl::onDocumentClosed( const ScriptDocument& _rDocument ) { DBG_TESTSOLARMUTEX(); - OSL_PRECOND( isValid(), "ScriptDocument_Impl::onDocumentClosed: should not be listening if I'm not valid!" ); + OSL_PRECOND( isValid(), "ScriptDocument::Impl::onDocumentClosed: should not be listening if I'm not valid!" ); bool bMyDocument = m_xDocument == _rDocument.getDocument(); - OSL_PRECOND( bMyDocument, "ScriptDocument_Impl::onDocumentClosed: didn't want to know *this*!" ); + OSL_PRECOND( bMyDocument, "ScriptDocument::Impl::onDocumentClosed: didn't want to know *this*!" ); if ( bMyDocument ) { m_bDocumentClosed = true; @@ -1035,12 +1035,12 @@ namespace basctl } - void ScriptDocument_Impl::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) + void ScriptDocument::Impl::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ ) { // not interested in } - void ScriptDocument_Impl::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ ) + void ScriptDocument::Impl::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ ) { // not interested in } @@ -1049,13 +1049,12 @@ namespace basctl //= ScriptDocument //==================================================================== ScriptDocument::ScriptDocument() - :m_pImpl( new ScriptDocument_Impl() ) - { - } + :m_pImpl(new Impl) + { } ScriptDocument::ScriptDocument( ScriptDocument::SpecialDocument _eType ) - :m_pImpl( new ScriptDocument_Impl( Reference< XModel >() ) ) + :m_pImpl( new Impl( Reference< XModel >() ) ) { OSL_ENSURE( _eType == NoDocument, "ScriptDocument::ScriptDocument: unknown SpecialDocument type!" ); (void)_eType; @@ -1063,7 +1062,7 @@ namespace basctl ScriptDocument::ScriptDocument( const Reference< XModel >& _rxDocument ) - :m_pImpl( new ScriptDocument_Impl( _rxDocument ) ) + :m_pImpl( new Impl( _rxDocument ) ) { OSL_ENSURE( _rxDocument.is(), "ScriptDocument::ScriptDocument: document must not be NULL!" ); // a NULL document results in an uninitialized instance, and for this @@ -1319,7 +1318,7 @@ namespace basctl Sequence< ::rtl::OUString > ScriptDocument::getLibraryNames() const { - return BasicIDE::GetMergedLibraryNames( getLibraryContainer( E_SCRIPTS ), getLibraryContainer( E_DIALOGS ) ); + return GetMergedLibraryNames( getLibraryContainer( E_SCRIPTS ), getLibraryContainer( E_DIALOGS ) ); } @@ -1394,7 +1393,7 @@ namespace basctl return false; // doc shell modified - BasicIDE::MarkDocumentModified( *const_cast< ScriptDocument* >( this ) ); // here? + MarkDocumentModified( *const_cast< ScriptDocument* >( this ) ); // here? return true; } @@ -1444,7 +1443,7 @@ namespace basctl if ( !m_pImpl->createDialog( _rLibName, _rDialogName, _out_rDialogProvider ) ) return false; - BasicIDE::MarkDocumentModified( *const_cast< ScriptDocument* >( this ) ); // here? + MarkDocumentModified( *const_cast< ScriptDocument* >( this ) ); // here? return true; } @@ -1576,6 +1575,6 @@ namespace basctl return m_pImpl->allowMacros(); } -} +} // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx index 6052b47ea28a..11d8068829c2 100644 --- a/basctl/source/basicide/tbxctl.cxx +++ b/basctl/source/basicide/tbxctl.cxx @@ -29,9 +29,15 @@ #include <svl/aeitem.hxx> #include <vcl/toolbox.hxx> +namespace basctl +{ + using namespace ::com::sun::star::uno; -static ::rtl::OUString aSubToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertcontrolsbar" ) ); +namespace +{ + rtl::OUString aSubToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertcontrolsbar" ) ); +} SFX_IMPL_TOOLBOX_CONTROL( TbxControls, SfxAllEnumItem ) @@ -145,4 +151,6 @@ SfxPopupWindow* TbxControls::CreatePopupWindow() } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/tbxctl.hxx b/basctl/source/basicide/tbxctl.hxx index 2f5a9e4c61d5..320336093782 100644 --- a/basctl/source/basicide/tbxctl.hxx +++ b/basctl/source/basicide/tbxctl.hxx @@ -16,12 +16,15 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASIDE_TBXCTL_HXX -#define _BASIDE_TBXCTL_HXX +#ifndef BASCTL_TBXCTL_HXX +#define BASCTL_TBXCTL_HXX #include <sfx2/tbxctrl.hxx> #include <com/sun/star/frame/XLayoutManager.hpp> +namespace basctl +{ + //------------------- // class TbxControls //------------------- @@ -53,7 +56,8 @@ public: void Select( sal_uInt16 nModifier ); }; +} // namespace basctl -#endif // _BASIDE_TBXCTL_HXX +#endif // BASCTL_TBXCTL_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/unomodel.cxx b/basctl/source/basicide/unomodel.cxx index b4abf211cff4..ef959567f120 100644 --- a/basctl/source/basicide/unomodel.cxx +++ b/basctl/source/basicide/unomodel.cxx @@ -28,6 +28,9 @@ #include <iderdll.hxx> #include <basdoc.hxx> +namespace basctl +{ + using ::rtl::OUString; using namespace ::cppu; using namespace ::std; @@ -110,9 +113,11 @@ uno::Reference< uno::XInterface > SAL_CALL SIDEModel_createInstance( const uno::Reference< lang::XMultiServiceFactory > & ) throw( uno::Exception ) { SolarMutexGuard aGuard; - BasicIDEGlobals::ensure(); - SfxObjectShell* pShell = new BasicDocShell(); + EnsureIde(); + SfxObjectShell* pShell = new DocShell(); return uno::Reference< uno::XInterface >( pShell->GetModel() ); } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/basicide/unomodel.hxx b/basctl/source/basicide/unomodel.hxx index 53a988fe0e79..41ce8fe2fa9a 100644 --- a/basctl/source/basicide/unomodel.hxx +++ b/basctl/source/basicide/unomodel.hxx @@ -16,13 +16,16 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef UNOMODEL_HXX -#define UNOMODEL_HXX +#ifndef BASCTL_UNOMODEL_HXX +#define BASCTL_UNOMODEL_HXX #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <sfx2/sfxbasemodel.hxx> +namespace basctl +{ + //----------------------------------------------------------------------------- class SIDEModel : public SfxBaseModel, public com::sun::star::lang::XServiceInfo @@ -55,6 +58,8 @@ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SIDEM const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( com::sun::star::uno::Exception ); -#endif +} // namespace basctl + +#endif // BASCTL_UNOMODEL_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index bab57fbd5cbb..857ac1df8230 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -45,6 +45,9 @@ #include <xmlscript/xml_helper.hxx> #include <xmlscript/xmldlg_imexp.hxx> +namespace basctl +{ + using namespace comphelper; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -63,22 +66,19 @@ static ::rtl::OUString aTitlePropName( RTL_CONSTASCII_USTRINGPARAM( "Title" )); TYPEINIT1( DlgEdHint, SfxHint ); -DlgEdHint::DlgEdHint( DlgEdHintKind eHint ) - :eHintKind( eHint ) -{ -} +DlgEdHint::DlgEdHint (Kind eHint) : + eKind(eHint) +{ } -DlgEdHint::DlgEdHint( DlgEdHintKind eHint, DlgEdObj* pObj ) - :eHintKind( eHint ) - ,pDlgEdObj( pObj ) -{ -} +DlgEdHint::DlgEdHint (Kind eHint, DlgEdObj* pObj) : + eKind(eHint), + pDlgEdObj(pObj) +{ } DlgEdHint::~DlgEdHint() -{ -} +{ } //============================================================================ @@ -187,7 +187,7 @@ DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star:: ,pObjFac(NULL) ,pWindow(NULL) ,pFunc(NULL) - ,eMode( DLGED_SELECT ) + ,eMode( DlgEditor::SELECT ) ,eActObj( OBJ_DLG_PUSHBUTTON ) ,bFirstDraw(false) ,aGridSize( 100, 100 ) // 100TH_MM @@ -344,7 +344,7 @@ void DlgEditor::DoScroll( ScrollBar* ) pWindow->SetMapMode( aMap ); pWindow->Update(); - DlgEdHint aHint( DLGED_HINT_WINDOWSCROLLED ); + DlgEdHint aHint( DlgEdHint::WINDOWSCROLLED ); Broadcast( aHint ); } @@ -474,7 +474,7 @@ void DlgEditor::MouseButtonUp( const MouseEvent& rMEvt ) { bool bRet = pFunc->MouseButtonUp( rMEvt ); - if( eMode == DLGED_INSERT ) + if( eMode == DlgEditor::INSERT ) bCreateOK = bRet; } @@ -608,37 +608,36 @@ IMPL_LINK_NOARG(DlgEditor, PaintTimeout) IMPL_LINK_NOARG(DlgEditor, MarkTimeout) { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; + Shell* pShell = GetShell(); + SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : NULL; SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SHOW_PROPERTYBROWSER ) : NULL; if ( !pChildWin ) return 0L; - ((PropBrw*)(pChildWin->GetWindow()))->Update( pIDEShell ); + ((PropBrw*)(pChildWin->GetWindow()))->Update(pShell); return 1; } -void DlgEditor::SetMode( DlgEdMode eNewMode ) +void DlgEditor::SetMode (Mode eNewMode ) { if ( eNewMode != eMode ) { delete pFunc; - if ( eNewMode == DLGED_INSERT ) + if ( eNewMode == INSERT ) pFunc = new DlgEdFuncInsert( this ); else pFunc = new DlgEdFuncSelect( this ); - if ( eNewMode == DLGED_READONLY ) + if ( eNewMode == READONLY ) pDlgEdModel->SetReadOnly( true ); else pDlgEdModel->SetReadOnly( false ); } - if ( eNewMode == DLGED_TEST ) + if ( eNewMode == TEST ) ShowDialog(); eMode = eNewMode; @@ -1129,8 +1128,8 @@ bool DlgEditor::IsPasteAllowed() void DlgEditor::ShowProperties() { - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL; + Shell* pShell = GetShell(); + SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : NULL; if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) ) pViewFrame->ToggleChildWindow( SID_SHOW_PROPERTYBROWSER ); } @@ -1325,4 +1324,7 @@ bool DlgEditor::AdjustPageSize() return bAdjustedPageSize; } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedclip.cxx b/basctl/source/dlged/dlgedclip.cxx index b6e34b4d9bbc..54735168e340 100644 --- a/basctl/source/dlged/dlgedclip.cxx +++ b/basctl/source/dlged/dlgedclip.cxx @@ -24,6 +24,8 @@ #include <com/sun/star/datatransfer/XMimeContentType.hpp> #include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp> +namespace basctl +{ using namespace comphelper; using namespace ::com::sun::star; @@ -129,4 +131,7 @@ void SAL_CALL DlgEdTransferableImpl::lostOwnership( const Reference< XClipboard m_SeqData = Sequence< Any >(); } + +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx index 899697e357f0..781d96b54236 100644 --- a/basctl/source/dlged/dlgedfac.cxx +++ b/basctl/source/dlged/dlgedfac.cxx @@ -25,6 +25,9 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/ScrollBarOrientation.hpp> +namespace basctl +{ + using namespace ::com::sun::star; @@ -234,4 +237,6 @@ IMPL_LINK( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory ) return 0; } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedfunc.cxx b/basctl/source/dlged/dlgedfunc.cxx index 4c66c99a8889..5d49ee5ac01d 100644 --- a/basctl/source/dlged/dlgedfunc.cxx +++ b/basctl/source/dlged/dlgedfunc.cxx @@ -24,6 +24,8 @@ #include "dlgedview.hxx" #include <vcl/seleng.hxx> +namespace basctl +{ //---------------------------------------------------------------------------- @@ -399,7 +401,7 @@ bool DlgEdFuncInsert::MouseButtonDown( const MouseEvent& rMEvt ) else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 ) { // if object was hit, show property browser - if ( pView->IsMarkedHit(aPos, nHitLog) && pParent->GetMode() != DLGED_READONLY ) + if ( pView->IsMarkedHit(aPos, nHitLog) && pParent->GetMode() != DlgEditor::READONLY ) pParent->ShowProperties(); } @@ -533,7 +535,7 @@ bool DlgEdFuncSelect::MouseButtonDown( const MouseEvent& rMEvt ) else if ( rMEvt.IsLeft() && rMEvt.GetClicks() == 2 ) { // if object was hit, show property browser - if ( pView->IsMarkedHit(aMDPos, nHitLog) && pParent->GetMode() != DLGED_READONLY ) + if ( pView->IsMarkedHit(aMDPos, nHitLog) && pParent->GetMode() != DlgEditor::READONLY ) pParent->ShowProperties(); } @@ -604,4 +606,6 @@ bool DlgEdFuncSelect::MouseMove( const MouseEvent& rMEvt ) //---------------------------------------------------------------------------- +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedlist.cxx b/basctl/source/dlged/dlgedlist.cxx index 0f44205e8399..d719ec5a27d3 100644 --- a/basctl/source/dlged/dlgedlist.cxx +++ b/basctl/source/dlged/dlgedlist.cxx @@ -20,6 +20,9 @@ #include "dlgedlist.hxx" #include "dlgedobj.hxx" +namespace basctl +{ + //============================================================================ // DlgEdPropListenerImpl //============================================================================ @@ -102,4 +105,6 @@ void SAL_CALL DlgEdEvtContListenerImpl::elementRemoved(const ::com::sun::star::c //---------------------------------------------------------------------------- +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedmod.cxx b/basctl/source/dlged/dlgedmod.cxx index 39de48d572fc..d786633ad103 100644 --- a/basctl/source/dlged/dlgedmod.cxx +++ b/basctl/source/dlged/dlgedmod.cxx @@ -21,6 +21,8 @@ #include "dlgedpage.hxx" #include <tools/debug.hxx> +namespace basctl +{ DBG_NAME(DlgEdModel) @@ -65,4 +67,6 @@ Window* DlgEdModel::GetCurDocViewWin() //---------------------------------------------------------------------------- +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index 38f4fbcb8866..0227bd6b3d7a 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -41,6 +41,9 @@ #include <unotools/sharedunocomponent.hxx> #include <vcl/svapp.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -1289,7 +1292,7 @@ void DlgEdObj::SetLayer(SdrLayerID nLayer) { SdrUnoObj::SetLayer( nLayer ); - DlgEdHint aHint( DLGED_HINT_LAYERCHANGED, this ); + DlgEdHint aHint( DlgEdHint::LAYERCHANGED, this ); GetDlgEdForm()->GetDlgEditor()->Broadcast( aHint ); } } @@ -1850,5 +1853,6 @@ bool DlgEdObj::MakeDataAware( const Reference< frame::XModel >& xModel ) } //---------------------------------------------------------------------------- +} // namespace basctl /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedpage.cxx b/basctl/source/dlged/dlgedpage.cxx index ac1b07e2f447..95e39156a6f1 100644 --- a/basctl/source/dlged/dlgedpage.cxx +++ b/basctl/source/dlged/dlgedpage.cxx @@ -22,6 +22,8 @@ #include "dlgedmod.hxx" #include "dlgedobj.hxx" +namespace basctl +{ TYPEINIT1( DlgEdPage, SdrPage ); @@ -60,7 +62,7 @@ SdrObject* DlgEdPage::SetObjectOrdNum(sal_uLong nOldObjNum, sal_uLong nNewObjNum { SdrObject* pObj = SdrPage::SetObjectOrdNum( nOldObjNum, nNewObjNum ); - DlgEdHint aHint( DLGED_HINT_OBJORDERCHANGED ); + DlgEdHint aHint( DlgEdHint::OBJORDERCHANGED ); if ( pDlgEdForm ) { DlgEditor* pDlgEditor = pDlgEdForm->GetDlgEditor(); @@ -73,4 +75,6 @@ SdrObject* DlgEdPage::SetObjectOrdNum(sal_uLong nOldObjNum, sal_uLong nNewObjNum //---------------------------------------------------------------------------- +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/dlgedview.cxx b/basctl/source/dlged/dlgedview.cxx index 67b11cd970bf..f3ff732ffec5 100644 --- a/basctl/source/dlged/dlgedview.cxx +++ b/basctl/source/dlged/dlgedview.cxx @@ -28,6 +28,9 @@ #include <iderdll.hxx> #include "dlgedobj.hxx" +namespace basctl +{ + TYPEINIT1( DlgEdView, SdrView ); //---------------------------------------------------------------------------- @@ -53,7 +56,7 @@ void DlgEdView::MarkListHasChanged() { SdrView::MarkListHasChanged(); - DlgEdHint aHint( DLGED_HINT_SELECTIONCHANGED ); + DlgEdHint aHint( DlgEdHint::SELECTIONCHANGED ); if ( pDlgEditor ) { pDlgEditor->Broadcast( aHint ); @@ -127,7 +130,7 @@ void DlgEdView::MakeVisible( const Rectangle& rRect, Window& rWin ) if ( pDlgEditor ) pDlgEditor->UpdateScrollBars(); - DlgEdHint aHint( DLGED_HINT_WINDOWSCROLLED ); + DlgEdHint aHint( DlgEdHint::WINDOWSCROLLED ); if ( pDlgEditor ) pDlgEditor->Broadcast( aHint ); } @@ -198,4 +201,6 @@ SdrObject* DlgEdView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol return pRetval; } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index 87999a63b6ac..aff7467057ff 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -39,6 +39,9 @@ #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> +namespace basctl +{ + using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::resource; @@ -108,8 +111,8 @@ ManageLanguageDialog::~ManageLanguageDialog() void ManageLanguageDialog::Init() { // get current IDE - BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell(); - ::rtl::OUString sLibName = pIDEShell->GetCurLibName(); + Shell* pShell = GetShell(); + ::rtl::OUString sLibName = pShell->GetCurLibName(); // set dialog title with library name ::rtl::OUString sText = GetText(); sText = sText.replaceAll("$1", sLibName); @@ -206,8 +209,7 @@ IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl) ClearLanguageBox(); FillLanguageBox(); - SfxBindings* pBindings = BasicIDE::GetBindingsPtr(); - if ( pBindings ) + if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); } return 1; @@ -400,4 +402,6 @@ Sequence< Locale > SetDefaultLanguageDialog::GetLocales() const return aLocaleSeq; } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/dlged/managelang.hrc b/basctl/source/dlged/managelang.hrc index a1acc69e568f..d7605ffbce36 100644 --- a/basctl/source/dlged/managelang.hrc +++ b/basctl/source/dlged/managelang.hrc @@ -16,8 +16,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_MANAGELANG_HRC -#define _BASCTL_MANAGELANG_HRC +#ifndef BASCTL_MANAGELANG_HRC +#define BASCTL_MANAGELANG_HRC // Include ----------------------------------------------------------------------- @@ -93,5 +93,5 @@ #define SETDEF_LB_WIDTH (SETDEF_COL4A - SETDEF_COL1) #define SETDEF_LB_HEIGHT (SETDEF_ROW3A - SETDEF_ROW2) -#endif // _BASCTL_MANAGELANG_HRC +#endif // BASCTL_MANAGELANG_HRC diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index 0c976baa71ea..40695f3a09ba 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -37,6 +37,9 @@ #include <tools/diagnose_ex.h> #include <vcl/stdtext.hxx> +namespace basctl +{ + using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -68,25 +71,22 @@ PropBrwMgr::PropBrwMgr( Window* _pParent, sal_uInt16 nId, } -void PropBrw::Update( const SfxViewShell* _pShell ) +void PropBrw::Update( const SfxViewShell* pShell ) { - const BasicIDEShell* pBasicIDEShell = dynamic_cast< const BasicIDEShell* >( _pShell ); - OSL_ENSURE( pBasicIDEShell || !_pShell, "PropBrw::Update: invalid shell!" ); - if ( pBasicIDEShell ) - { - ImplUpdate( pBasicIDEShell->GetCurrentDocument(), pBasicIDEShell->GetCurDlgView() ); - } - else if ( _pShell ) - { - ImplUpdate( NULL, _pShell->GetDrawView() ); - } + Shell const* pIdeShell = dynamic_cast<Shell const*>(pShell); + OSL_ENSURE( pIdeShell || !pShell, "PropBrw::Update: invalid shell!" ); + if (pIdeShell) + ImplUpdate(pIdeShell->GetCurrentDocument(), pIdeShell->GetCurDlgView()); + else if (pShell) + ImplUpdate(NULL, pShell->GetDrawView()); else - { - ImplUpdate( NULL, NULL ); - } + ImplUpdate(NULL, NULL); } +namespace +{ + const long STD_WIN_SIZE_X = 300; const long STD_WIN_SIZE_Y = 350; @@ -95,6 +95,9 @@ const long STD_MIN_SIZE_Y = 250; const long WIN_BORDER = 2; +} // namespace + + DBG_NAME(PropBrw) @@ -551,4 +554,6 @@ void PropBrw::ImplUpdate( const Reference< XModel >& _rxContextDocument, SdrView } } +} // namespace basctl + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/accessibledialogcontrolshape.hxx b/basctl/source/inc/accessibledialogcontrolshape.hxx index eae49f2a9146..60683189a6d2 100644 --- a/basctl/source/inc/accessibledialogcontrolshape.hxx +++ b/basctl/source/inc/accessibledialogcontrolshape.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_ -#define _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_ +#ifndef BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX +#define BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -26,17 +26,18 @@ #include <cppuhelper/implbase3.hxx> class Window; -class DlgEdObj; class VCLExternalSolarLock; -namespace basctl -{ - class DialogWindow; -} namespace utl { -class AccessibleStateSetHelper; + class AccessibleStateSetHelper; } +namespace basctl +{ + +class DlgEdObj; +class DialogWindow; + // ---------------------------------------------------- // class AccessibleDialogControlShape // ---------------------------------------------------- @@ -55,7 +56,7 @@ class AccessibleDialogControlShape : public AccessibleExtendedComponentHelper private: VCLExternalSolarLock* m_pExternalLock; - basctl::DialogWindow* m_pDialogWindow; + DialogWindow* m_pDialogWindow; DlgEdObj* m_pDlgEdObj; bool m_bFocused; bool m_bSelected; @@ -86,7 +87,7 @@ protected: virtual void SAL_CALL disposing(); public: - AccessibleDialogControlShape (basctl::DialogWindow*, DlgEdObj*); + AccessibleDialogControlShape (DialogWindow*, DlgEdObj*); virtual ~AccessibleDialogControlShape(); // XInterface @@ -133,7 +134,8 @@ public: virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); }; +} // namespace basctl -#endif // _BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX_ +#endif // BASCTL_ACCESSIBLEDIALOGCONTROLSHAPE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/accessibledialogwindow.hxx b/basctl/source/inc/accessibledialogwindow.hxx index b763b29b9013..c8885eae09ed 100644 --- a/basctl/source/inc/accessibledialogwindow.hxx +++ b/basctl/source/inc/accessibledialogwindow.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_ -#define _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_ +#ifndef BASCTL_ACCESSIBLEDIALOGWINDOW_HXX +#define BASCTL_ACCESSIBLEDIALOGWINDOW_HXX #include <com/sun/star/accessibility/XAccessibleSelection.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -27,21 +27,21 @@ #include <svl/lstner.hxx> #include <tools/link.hxx> -class DlgEditor; -class DlgEdModel; -class DlgEdObj; class VCLExternalSolarLock; class VclSimpleEvent; class VclWindowEvent; -namespace basctl -{ - class DialogWindow; -} namespace utl { -class AccessibleStateSetHelper; + class AccessibleStateSetHelper; } +namespace basctl +{ + +class DialogWindow; +class DlgEditor; +class DlgEdModel; +class DlgEdObj; // ---------------------------------------------------- // class AccessibleDialogWindow @@ -162,7 +162,8 @@ public: virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); }; +} // namespace basctl -#endif // _BASCTL_ACCESSIBLEDIALOGWINDOW_HXX_ +#endif // BASCTL_ACCESSIBLEDIALOGWINDOW_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx index dda678b7c395..feb679dbcdb7 100644 --- a/basctl/source/inc/baside3.hxx +++ b/basctl/source/inc/baside3.hxx @@ -33,19 +33,20 @@ class Printer; class StarBASIC; class SfxItemSet; -class DlgEditor; -class DlgEdModel; -class DlgEdPage; -class DlgEdView; class SfxUndoManager; namespace basctl { +class DlgEditor; +class DlgEdModel; +class DlgEdPage; +class DlgEdView; + class DialogWindowLayout; class ObjectCatalog; -class DialogWindow: public IDEBaseWindow +class DialogWindow: public BaseWindow { private: DialogWindowLayout& rLayout; @@ -91,7 +92,7 @@ public: bool ImportDialog(); virtual ::rtl::OUString GetTitle(); - virtual BasicEntryDescriptor CreateEntryDescriptor(); + virtual EntryDescriptor CreateEntryDescriptor(); virtual void SetReadOnly (bool bReadOnly); virtual bool IsReadOnly(); @@ -99,8 +100,7 @@ public: virtual bool IsModified(); virtual bool IsPasteAllowed(); - virtual ::svl::IUndoManager* - GetUndoManager(); + virtual svl::IUndoManager* GetUndoManager(); // return number of pages to be printed virtual sal_Int32 countPages( Printer* pPrinter ); // print page @@ -112,7 +112,7 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); virtual char const* GetHid () const; - virtual BasicIDEType GetType () const; + virtual ItemType GetType () const; }; // @@ -124,7 +124,7 @@ public: DialogWindowLayout (Window* pParent, ObjectCatalog&); public: // Layout: - virtual void Activating (IDEBaseWindow&); + virtual void Activating (BaseWindow&); virtual void Deactivating (); virtual void GetState (SfxItemSet&, unsigned nWhich); virtual void UpdateDebug (bool){}; @@ -143,6 +143,6 @@ private: } // namespace basctl -#endif // BASCTL_BASIDE3_HXX +#endif // BASCTL_BASIDE3_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/basidectrlr.hxx b/basctl/source/inc/basidectrlr.hxx index e0601ff7a35d..feac8229c16e 100644 --- a/basctl/source/inc/basidectrlr.hxx +++ b/basctl/source/inc/basidectrlr.hxx @@ -17,28 +17,32 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_BASICIDECTRLR_HXX -#define _BASCTL_BASICIDECTRLR_HXX +#ifndef BASCTL_BASICIDECTRLR_HXX +#define BASCTL_BASICIDECTRLR_HXX #include <comphelper/broadcasthelper.hxx> #include <comphelper/propertycontainer.hxx> #include <comphelper/proparrhlp.hxx> #include <sfx2/sfxbasecontroller.hxx> -class BasicIDEShell; +namespace basctl +{ + +class Shell; -class BasicIDEController :public comphelper::OMutexAndBroadcastHelper - ,public ::comphelper::OPropertyContainer - ,public ::comphelper::OPropertyArrayUsageHelper< BasicIDEController > - ,public SfxBaseController +class Controller : + public comphelper::OMutexAndBroadcastHelper, + public comphelper::OPropertyContainer, + public comphelper::OPropertyArrayUsageHelper<Controller>, + public SfxBaseController { private: // properties sal_Int32 m_nIconId; public: - BasicIDEController( BasicIDEShell* pViewShell ); - virtual ~BasicIDEController(); + Controller (Shell* pViewShell); + virtual ~Controller(); // XInterface virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); @@ -60,6 +64,8 @@ protected: virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; }; -#endif // _BASCTL_BASICIDECTRLR_HXX +} // namespace basctl + +#endif // BASCTL_BASICIDECTRLR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 69862ce27775..c021a0583155 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -31,78 +31,67 @@ #include <boost/scoped_ptr.hpp> class SfxViewFactory; +class SdrView; +class TabBar; +class SbxObject; +class SbModule; +class StarBASIC; +namespace basctl +{ //---------------------------------------------------------------------------- const sal_uLong BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001; //---------------------------------------------------------------------------- -namespace basctl -{ - class Layout; - class ModulWindow; - class ModulWindowLayout; - class DialogWindow; - class DialogWindowLayout; -} -class SdrView; -class BasicIDETabBar; +class Layout; +class ModulWindow; +class ModulWindowLayout; +class DialogWindow; +class DialogWindowLayout; class TabBar; -class IDEBaseWindow; -class SbxObject; -class SbModule; -class StarBASIC; +class BaseWindow; class LocalizationMgr; -#if _SOLAR__PRIVATE -typedef std::map<sal_uInt16, IDEBaseWindow*> IDEWindowTable; -#else -typedef std::map<sal_uInt16, void*> IDEWindowTable; -#endif - -namespace BasicIDE -{ - bool RemoveDialog( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName ); -} +bool RemoveDialog( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName ); -class BasicIDEShell : +class Shell : public SfxViewShell, - public basctl::DocumentEventListener + public DocumentEventListener { - typedef basctl::DialogWindow DialogWindow; - typedef basctl::ModulWindow ModulWindow; +public: + typedef std::map<sal_uInt16, BaseWindow*> WindowTable; + typedef WindowTable::const_iterator WindowTableIt; +private: friend class JavaDebuggingListenerImpl; friend class LocalizationMgr; friend bool implImportDialog( Window* pWin, const ::rtl::OUString& rCurPath, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName ); - typedef IDEWindowTable::const_iterator WindowTableIt; - - IDEWindowTable aIDEWindowTable; + WindowTable aWindowTable; sal_uInt16 nCurKey; - IDEBaseWindow* pCurWin; + BaseWindow* pCurWin; ScriptDocument m_aCurDocument; - ::rtl::OUString m_aCurLibName; + rtl::OUString m_aCurLibName; boost::shared_ptr<LocalizationMgr> m_pCurLocalizationMgr; ScrollBar aHScrollBar; ScrollBar aVScrollBar; ScrollBarBox aScrollBarBox; - BasicIDETabBar* pTabBar; + TabBar* pTabBar; // basctl::TabBar bool bTabBarSplitted; bool bCreatingWindow; // layout windows - boost::scoped_ptr<basctl::ModulWindowLayout> pModulLayout; - boost::scoped_ptr<basctl::DialogWindowLayout> pDialogLayout; + boost::scoped_ptr<ModulWindowLayout> pModulLayout; + boost::scoped_ptr<DialogWindowLayout> pDialogLayout; // the active layout window - basctl::Layout* pLayout; + Layout* pLayout; // common object catalog window - basctl::ObjectCatalog aObjectCatalog; + ObjectCatalog aObjectCatalog; bool m_bAppBasicModified; - ::basctl::DocumentEventNotifier - m_aNotifier; + DocumentEventNotifier m_aNotifier; friend class ContainerListenerImpl; ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xLibListener; @@ -126,14 +115,16 @@ class BasicIDEShell : DECL_LINK( TabBarSplitHdl, TabBar * ); #endif + static unsigned nShellCount; + protected: virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize ); virtual void OuterResizePixel( const Point &rPos, const Size &rSize ); virtual Size GetOptimalSizePixel() const; - sal_uInt16 InsertWindowInTable( IDEBaseWindow* pNewWin ); + sal_uInt16 InsertWindowInTable (BaseWindow* pNewWin); virtual sal_uInt16 PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ); - void SetCurWindow( IDEBaseWindow* pNewWin, bool bUpdateTabBar = false, bool bRememberAsCurrent = true ); + void SetCurWindow (BaseWindow* pNewWin, bool bUpdateTabBar = false, bool bRememberAsCurrent = true); void ManageToolbars(); void ArrangeTabBar(); @@ -163,30 +154,28 @@ protected: virtual void onDocumentModeChanged( const ScriptDocument& _rDocument ); public: - TYPEINFO(); - SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH ) - SFX_DECL_VIEWFACTORY(BasicIDEShell); + TYPEINFO(); + SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_VIEWSH ) + SFX_DECL_VIEWFACTORY(Shell); - BasicIDEShell( SfxViewFrame *pFrame, SfxViewShell *pOldSh ); - ~BasicIDEShell(); + Shell( SfxViewFrame *pFrame, SfxViewShell *pOldSh ); + ~Shell(); - IDEBaseWindow* GetCurWindow() const { return pCurWin; } - const ScriptDocument& - GetCurDocument() const { return m_aCurDocument; } - const ::rtl::OUString& GetCurLibName() const { return m_aCurLibName; } + BaseWindow* GetCurWindow() const { return pCurWin; } + ScriptDocument const& GetCurDocument() const { return m_aCurDocument; } + rtl::OUString const& GetCurLibName() const { return m_aCurLibName; } boost::shared_ptr<LocalizationMgr> GetCurLocalizationMgr() const { return m_pCurLocalizationMgr; } ScrollBar& GetHScrollBar() { return aHScrollBar; } ScrollBar& GetVScrollBar() { return aVScrollBar; } ScrollBarBox& GetScrollBarBox() { return aScrollBarBox; } - TabBar* GetTabBar() { return (TabBar*)pTabBar; } - IDEWindowTable& GetIDEWindowTable() { return aIDEWindowTable; } - sal_uInt16 GetIDEWindowId(const IDEBaseWindow* pWin) const; + TabBar& GetTabBar() { return *pTabBar; } + WindowTable& GetWindowTable() { return aWindowTable; } + sal_uInt16 GetWindowId (BaseWindow const* pWin) const; SdrView* GetCurDlgView() const; - ::svl::IUndoManager* - GetUndoManager(); + svl::IUndoManager* GetUndoManager(); virtual com::sun::star::uno::Reference< com::sun::star::view::XRenderable > GetRenderable(); @@ -207,16 +196,17 @@ public: long CallBasicErrorHdl( StarBASIC* pBasic ); long CallBasicBreakHdl( StarBASIC* pBasic ); - IDEBaseWindow* FindWindow( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName = ::rtl::OUString(), const ::rtl::OUString& rName = ::rtl::OUString(), BasicIDEType nType = BASICIDE_TYPE_UNKNOWN, bool bFindSuspended = false ); + BaseWindow* FindWindow( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName = ::rtl::OUString(), const ::rtl::OUString& rName = ::rtl::OUString(), ItemType nType = TYPE_UNKNOWN, bool bFindSuspended = false ); DialogWindow* FindDlgWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rName, bool bCreateIfNotExist = false, bool bFindSuspended = false ); ModulWindow* FindBasWin( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName, bool bCreateIfNotExist = false, bool bFindSuspended = false ); - IDEBaseWindow* FindApplicationWindow(); + BaseWindow* FindApplicationWindow(); bool NextPage( bool bPrev = false ); bool IsAppBasicModified () const { return m_bAppBasicModified; } void SetAppBasicModified (bool bModified = true) { m_bAppBasicModified = bModified; } - // For Dialog Drag&Drop in Dialog Organizer + // For Dialog Drag&Drop in Dialog Organizer: + // (defined in moduldlg.cxx) static void CopyDialogResources( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& io_xISP, const ScriptDocument& rSourceDoc, const ::rtl::OUString& rSourceLibName, const ScriptDocument& rDestDoc, @@ -227,9 +217,15 @@ public: void UpdateObjectCatalog () { aObjectCatalog.UpdateEntries(); } - void RemoveWindow (IDEBaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true); + void RemoveWindow (BaseWindow* pWindow, bool bDestroy, bool bAllowChangeCurWindow = true); }; +} // namespace basctl + +// This typedef helps baside.sdi, +// because I don't know how to use nested names in it. +typedef basctl::Shell basctl_Shell; + #endif // BASCTL_BASIDESH_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/basobj.hxx b/basctl/source/inc/basobj.hxx index 52d8c46e400e..16481f71082c 100644 --- a/basctl/source/inc/basobj.hxx +++ b/basctl/source/inc/basobj.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASOBJ_HXX -#define _BASOBJ_HXX +#ifndef BASCTL_BASOBJ_HXX +#define BASCTL_BASOBJ_HXX #include "scriptdocument.hxx" @@ -30,9 +30,10 @@ class StarBASIC; class String; class SfxUInt16Item; class SfxBindings; +class SfxDispatcher; class Window; -namespace BasicIDE +namespace basctl { void Organize( sal_Int16 tabId ); @@ -53,6 +54,8 @@ namespace BasicIDE SfxBindings* GetBindingsPtr(); + SfxDispatcher* GetDispatcher (); + void InvalidateDebuggerSlots(); // libraries @@ -61,12 +64,6 @@ namespace BasicIDE const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xModLibContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::script::XLibraryContainer >& xDlgLibContainer ); - // new methods for modules - - ::rtl::OUString GetModule( - const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rModName ) - throw( ::com::sun::star::container::NoSuchElementException ); - /** renames a module Will show an error message when renaming fails because the new name is already used. @@ -89,10 +86,6 @@ namespace BasicIDE // new methods for dialogs - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider > GetDialog( - const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName ) - throw( ::com::sun::star::container::NoSuchElementException ); - /** renames a dialog Will show an error message when renaming fails because the new name is already used. @@ -105,8 +98,9 @@ namespace BasicIDE const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rDlgName ); void MarkDocumentModified( const ScriptDocument& rDocument ); -} -#endif // _BASOBJ_HXX +} // namespace basctl + +#endif // BASCTL_BASOBJ_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index ca5b49a9066f..6d24dae1e6b9 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -32,14 +32,20 @@ class SbModule; class SfxItemSet; class SfxRequest; class SvxSearchItem; +class Printer; -namespace basctl +namespace svl { - class Layout; - class ModulWindow; - class DialogWindow; + class IUndoManager; } +namespace basctl +{ + +class Layout; +class ModulWindow; +class DialogWindow; + #define LINE_SEP_CR 0x0D #define LINE_SEP 0x0A @@ -65,14 +71,18 @@ struct BasicStatus nBasicFlags(0) { } }; -class BasicDockingWindow : public DockingWindow +// +// basctl::DockingWindow -- special docking window for the Basic IDE +// Not to be confused with ::DockingWindow from vcl. +// +class DockingWindow : public ::DockingWindow { public: - BasicDockingWindow (Window* pParent); - BasicDockingWindow (basctl::Layout* pParent); + DockingWindow (Window* pParent); + DockingWindow (Layout* pParent); public: void ResizeIfDocking (Point const&, Size const&); - void SetLayoutWindow (basctl::Layout*); + void SetLayoutWindow (Layout*); public: void Show (bool = true); void Hide (); @@ -90,7 +100,7 @@ private: // the position and the size of the docking window Rectangle aDockingRect; // the parent layout window (only when docking) - basctl::Layout* pLayout; + Layout* pLayout; // > 0: shown, <= 0: hidden, ++ by Show() and -- by Hide() int nShowCount; @@ -100,7 +110,11 @@ private: void DockThis (); }; -class BasicIDETabBar : public TabBar +// +// basctl::TabBar +// Not to be confused with ::TabBar from svtools. +// +class TabBar : public ::TabBar { protected: virtual void MouseButtonDown( const MouseEvent& rMEvt ); @@ -110,7 +124,7 @@ protected: virtual void EndRenaming(); public: - BasicIDETabBar( Window* pParent ); + TabBar (Window* pParent); void Sort(); }; @@ -124,18 +138,12 @@ enum BasicWindowStatus BASWIN_INRESCHEDULE = 0x08 }; -class Printer; -class BasicEntryDescriptor; - -namespace svl -{ - class IUndoManager; -} +class EntryDescriptor; // -// IDEBaseWindow -- the base of both ModulWindow and DialogWindow. +// BaseWindow -- the base of both ModulWindow and DialogWindow. // -class IDEBaseWindow : public Window +class BaseWindow : public Window { private: ScrollBar* pShellHScrollBar; @@ -145,19 +153,19 @@ private: int nStatus; ScriptDocument m_aDocument; - ::rtl::OUString m_aLibName; - ::rtl::OUString m_aName; + rtl::OUString m_aLibName; + rtl::OUString m_aName; - friend class basctl::ModulWindow; - friend class basctl::DialogWindow; + friend class ModulWindow; + friend class DialogWindow; protected: virtual void DoScroll( ScrollBar* pCurScrollBar ); public: TYPEINFO(); - IDEBaseWindow( Window* pParent, const ScriptDocument& rDocument, ::rtl::OUString aLibName, ::rtl::OUString aName ); - virtual ~IDEBaseWindow(); + BaseWindow( Window* pParent, const ScriptDocument& rDocument, ::rtl::OUString aLibName, ::rtl::OUString aName ); + virtual ~BaseWindow(); void Init(); virtual void DoInit(); @@ -184,7 +192,7 @@ public: virtual ::rtl::OUString GetTitle(); ::rtl::OUString CreateQualifiedName(); - virtual BasicEntryDescriptor CreateEntryDescriptor() = 0; + virtual EntryDescriptor CreateEntryDescriptor() = 0; virtual bool IsModified(); virtual bool IsPasteAllowed(); @@ -199,8 +207,7 @@ public: void AddStatus(int n) { nStatus |= n; } void ClearStatus(int n) { nStatus &= ~n; } - virtual ::svl::IUndoManager* - GetUndoManager(); + virtual svl::IUndoManager* GetUndoManager (); virtual sal_uInt16 GetSearchOptions(); virtual sal_uInt16 StartSearchAndReplace (SvxSearchItem const&, bool bFromStart = false); @@ -221,75 +228,65 @@ public: virtual void OnNewDocument (); virtual char const* GetHid () const = 0; - virtual BasicIDEType GetType () const = 0; + virtual ItemType GetType () const = 0; // TODO void InsertLibInfo () const; - bool Is (ScriptDocument const&, rtl::OUString const&, rtl::OUString const&, BasicIDEType, bool bFindSuspended); + bool Is (ScriptDocument const&, rtl::OUString const&, rtl::OUString const&, ItemType, bool bFindSuspended); // TODO virtual bool HasActiveEditor () const; }; -class LibInfoKey +class LibInfos { -private: - ScriptDocument m_aDocument; - ::rtl::OUString m_aLibName; - public: - LibInfoKey( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName ); - ~LibInfoKey(); - - bool operator==( const LibInfoKey& rKey ) const; - - const ScriptDocument& - GetDocument() const { return m_aDocument; } - const ::rtl::OUString& GetLibName() const { return m_aLibName; } -}; - -class LibInfoItem -{ -private: - ScriptDocument m_aDocument; - ::rtl::OUString m_aLibName; - ::rtl::OUString m_aCurrentName; - sal_uInt16 m_nCurrentType; - + class Item; public: - LibInfoItem( const ScriptDocument& rDocument, const ::rtl::OUString& rLibName, const ::rtl::OUString& rCurrentName, sal_uInt16 nCurrentType ); - ~LibInfoItem(); - - LibInfoItem( const LibInfoItem& rItem ); - LibInfoItem& operator=( const LibInfoItem& rItem ); - - const ScriptDocument& GetDocument() const { return m_aDocument; } - const ::rtl::OUString& GetLibName() const { return m_aLibName; } - const ::rtl::OUString& GetCurrentName() const { return m_aCurrentName; } - sal_uInt16 GetCurrentType() const { return m_nCurrentType; } -}; + LibInfos (); + ~LibInfos (); +public: + void InsertInfo (ScriptDocument const&, rtl::OUString const& rLibName, rtl::OUString const& rCurrentName, ItemType eCurrentType); + void RemoveInfoFor (ScriptDocument const&); + Item const* GetInfo (ScriptDocument const&, rtl::OUString const& rLibName); -class LibInfos -{ private: - - struct LibInfoKeyHash + class Key { - size_t operator()( const LibInfoKey& rKey ) const + private: + ScriptDocument m_aDocument; + ::rtl::OUString m_aLibName; + + public: + Key (ScriptDocument const&, rtl::OUString const& rLibName); + ~Key (); + public: + bool operator == (Key const&) const; + struct Hash { - size_t nHash = (size_t) rKey.GetDocument().hashCode(); - nHash += (size_t) ::rtl::OUString( rKey.GetLibName() ).hashCode(); - return nHash; - } + size_t operator () (Key const&) const; + }; + public: + const ScriptDocument& GetDocument() const { return m_aDocument; } + const ::rtl::OUString& GetLibName() const { return m_aLibName; } }; - - typedef ::boost::unordered_map< LibInfoKey, LibInfoItem*, LibInfoKeyHash, ::std::equal_to< LibInfoKey > > LibInfoMap; - LibInfoMap m_aLibInfoMap; - public: - LibInfos(); - ~LibInfos(); - - void InsertInfo( LibInfoItem* pItem ); - void RemoveInfoFor( const ScriptDocument& _rDocument ); - - LibInfoItem* GetInfo( const LibInfoKey& rKey ); + class Item + { + private: + ScriptDocument m_aDocument; + ::rtl::OUString m_aLibName; + ::rtl::OUString m_aCurrentName; + ItemType m_eCurrentType; + + public: + Item (ScriptDocument const&, rtl::OUString const& rLibName, rtl::OUString const& rCurrentName, ItemType eCurrentType); + ~Item (); + public: + const ScriptDocument& GetDocument() const { return m_aDocument; } + const ::rtl::OUString& GetLibName() const { return m_aLibName; } + const ::rtl::OUString& GetCurrentName() const { return m_aCurrentName; } + ItemType GetCurrentType() const { return m_eCurrentType; } + }; +private: + typedef boost::unordered_map<Key, Item, Key::Hash> Map; + Map m_aMap; }; void CutLines( ::rtl::OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, bool bEraseTrailingEmptyLines = false ); @@ -305,14 +302,17 @@ bool QueryPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::sc class ModuleInfoHelper { -ModuleInfoHelper(); -ModuleInfoHelper(const ModuleInfoHelper&); -ModuleInfoHelper& operator = (const ModuleInfoHelper&); + // non-constructible class + ModuleInfoHelper (); + ModuleInfoHelper (const ModuleInfoHelper&); + ModuleInfoHelper& operator = (const ModuleInfoHelper&); public: static void getObjectName( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const ::rtl::OUString& rModName, ::rtl::OUString& rObjName ); static sal_Int32 getModuleType( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rLib, const ::rtl::OUString& rModName ); }; -#endif // BASCTL_BASTYPES_HXX +} // namespace basctl + +#endif // BASCTL_BASTYPES_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx index bbb0dca03843..a8e8fc3d7065 100644 --- a/basctl/source/inc/dlged.hxx +++ b/basctl/source/inc/dlged.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_DLGED_HXX -#define _BASCTL_DLGED_HXX +#ifndef BASCTL_DLGED_HXX +#define BASCTL_DLGED_HXX #include <com/sun/star/awt/XControlContainer.hpp> #include <com/sun/star/container/XNameContainer.hpp> @@ -30,6 +30,16 @@ #include <tools/gen.hxx> #include <vcl/timer.hxx> +class ScrollBar; +class Printer; +class KeyEvent; +class MouseEvent; +class Timer; +class Window; + +namespace basctl +{ + #define DLGED_PAGE_WIDTH_MIN 1280 #define DLGED_PAGE_HEIGHT_MIN 1024 @@ -37,31 +47,31 @@ // DlgEdHint //============================================================================ -enum DlgEdHintKind -{ - DLGED_HINT_UNKNOWN, - DLGED_HINT_WINDOWSCROLLED, - DLGED_HINT_LAYERCHANGED, - DLGED_HINT_OBJORDERCHANGED, - DLGED_HINT_SELECTIONCHANGED -}; - class DlgEdObj; class DlgEdHint: public SfxHint { +public: + enum Kind { + UNKNOWN, + WINDOWSCROLLED, + LAYERCHANGED, + OBJORDERCHANGED, + SELECTIONCHANGED, + }; + private: - DlgEdHintKind eHintKind; - DlgEdObj* pDlgEdObj; + Kind eKind; + DlgEdObj* pDlgEdObj; public: TYPEINFO(); - DlgEdHint( DlgEdHintKind eHint ); - DlgEdHint( DlgEdHintKind eHint, DlgEdObj* pObj ); + DlgEdHint (Kind); + DlgEdHint (Kind, DlgEdObj* pObj); virtual ~DlgEdHint(); - DlgEdHintKind GetKind() const { return eHintKind; } - DlgEdObj* GetObject() const { return pDlgEdObj; } + Kind GetKind() const { return eKind; } + DlgEdObj* GetObject() const { return pDlgEdObj; } }; @@ -69,23 +79,23 @@ public: // DlgEditor //============================================================================ -enum DlgEdMode { DLGED_INSERT, DLGED_SELECT, DLGED_TEST, DLGED_READONLY }; - -class ScrollBar; class DlgEdModel; class DlgEdPage; class DlgEdView; class DlgEdForm; class DlgEdFactory; class DlgEdFunc; -class Printer; -class KeyEvent; -class MouseEvent; -class Timer; -class Window; class DlgEditor: public SfxBroadcaster { +public: + enum Mode { + INSERT, + SELECT, + TEST, + READONLY, + }; + private: DECL_LINK(PaintTimeout, void *); DECL_LINK(MarkTimeout, void *); @@ -107,7 +117,7 @@ protected: DlgEdFactory* pObjFac; Window* pWindow; DlgEdFunc* pFunc; - DlgEdMode eMode; + Mode eMode; sal_uInt16 eActObj; bool bFirstDraw; Size aGridSize; @@ -175,11 +185,11 @@ public: void Paint( const Rectangle& rRect ); bool KeyInput( const KeyEvent& rKEvt ); - void SetMode( DlgEdMode eMode ); + void SetMode (Mode eMode); void SetInsertObj( sal_uInt16 eObj ); sal_uInt16 GetInsertObj() const; void CreateDefaultObject(); - DlgEdMode GetMode() const { return eMode; } + Mode GetMode() const { return eMode; } bool IsCreateOK() const { return bCreateOK; } void Cut(); @@ -199,6 +209,8 @@ public: bool isInPaint() const { return mnPaintGuard > 0; } }; -#endif //_BASCTL_DLGED_HXX +} // namespace basctl + +#endif // BASCTL_DLGED_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedclip.hxx b/basctl/source/inc/dlgedclip.hxx index c6e5faffd5da..6c57a7c27fa1 100644 --- a/basctl/source/inc/dlgedclip.hxx +++ b/basctl/source/inc/dlgedclip.hxx @@ -17,12 +17,15 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_DLGEDCLIP_HXX -#define _BASCTL_DLGEDCLIP_HXX +#ifndef BASCTL_DLGEDCLIP_HXX +#define BASCTL_DLGEDCLIP_HXX #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> #include <cppuhelper/implbase2.hxx> +namespace basctl +{ + //============================================================================ // DlgEdTransferableImpl //============================================================================ @@ -51,6 +54,8 @@ public: virtual void SAL_CALL lostOwnership( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& xClipboard, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw(::com::sun::star::uno::RuntimeException); }; -#endif // _BASCTL_DLGEDCLIP_HXX +} // namespace basctl + +#endif // BASCTL_DLGEDCLIP_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgeddef.hxx b/basctl/source/inc/dlgeddef.hxx index 044170e9ed54..9e190cba744a 100644 --- a/basctl/source/inc/dlgeddef.hxx +++ b/basctl/source/inc/dlgeddef.hxx @@ -17,11 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_DLGEDDEF_HXX -#define _BASCTL_DLGEDDEF_HXX +#ifndef BASCTL_DLGEDDEF_HXX +#define BASCTL_DLGEDDEF_HXX #include <sal/types.h> +namespace basctl +{ + const sal_uInt32 DlgInventor = sal_uInt32('D')*0x00000001+ sal_uInt32('L')*0x00000100+ sal_uInt32('G')*0x00010000+ @@ -80,6 +83,8 @@ const sal_uInt32 DlgInventor = sal_uInt32('D')*0x00000001+ #define DLGED_PROP_DECORATION ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Decoration" ) ) -#endif // _BASCTL_DLGEDDEF_HXX +} // namespace basctl + +#endif // BASCTL_DLGEDDEF_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedfac.hxx b/basctl/source/inc/dlgedfac.hxx index 5a766c7cae88..f660ac469fdf 100644 --- a/basctl/source/inc/dlgedfac.hxx +++ b/basctl/source/inc/dlgedfac.hxx @@ -17,13 +17,15 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef _BASCTL_DLGEDFAC_HXX -#define _BASCTL_DLGEDFAC_HXX +#ifndef BASCTL_DLGEDFAC_HXX +#define BASCTL_DLGEDFAC_HXX #include <svx/svdobj.hxx> #include <com/sun/star/frame/XModel.hpp> +namespace basctl +{ + //============================================================================ // DlgEdFactory //============================================================================ @@ -38,6 +40,8 @@ public: DECL_LINK( MakeObject, SdrObjFactory * ); }; -#endif // _BASCTL_DLGEDFAC_HXX +} // namespace basctl + +#endif // BASCTL_DLGEDFAC_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedfunc.hxx b/basctl/source/inc/dlgedfunc.hxx index b7a4f7bf3673..821b57d218fc 100644 --- a/basctl/source/inc/dlgedfunc.hxx +++ b/basctl/source/inc/dlgedfunc.hxx @@ -17,8 +17,11 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_DLGEDFUNC_HXX -#define _BASCTL_DLGEDFUNC_HXX +#ifndef BASCTL_DLGEDFUNC_HXX +#define BASCTL_DLGEDFUNC_HXX + +namespace basctl +{ class DlgEditor; @@ -79,6 +82,8 @@ public: }; -#endif //_BASCTL_DLGEDFUNC_HXX +} // namespace basctl + +#endif // BASCTL_DLGEDFUNC_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedlist.hxx b/basctl/source/inc/dlgedlist.hxx index 1c8d079e1696..bb53f08461ec 100644 --- a/basctl/source/inc/dlgedlist.hxx +++ b/basctl/source/inc/dlgedlist.hxx @@ -17,13 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_DLGEDLIST_HXX -#define _BASCTL_DLGEDLIST_HXX +#ifndef BASCTL_DLGEDLIST_HXX +#define BASCTL_DLGEDLIST_HXX #include <cppuhelper/implbase1.hxx> #include <com/sun/star/beans/XPropertyChangeListener.hpp> #include <com/sun/star/container/XContainerListener.hpp> +namespace basctl +{ + class DlgEdObj; //============================================================================ @@ -73,6 +76,8 @@ public: virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException); }; -#endif // _BASCTL_DLGEDLIST_HXX +} // namespace basctl + +#endif // BASCTL_DLGEDLIST_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedmod.hxx b/basctl/source/inc/dlgedmod.hxx index 1150acbb33f0..0dea946cbec4 100644 --- a/basctl/source/inc/dlgedmod.hxx +++ b/basctl/source/inc/dlgedmod.hxx @@ -17,12 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef _BASCTL_DLGEDMOD_HXX -#define _BASCTL_DLGEDMOD_HXX +#ifndef BASCTL_DLGEDMOD_HXX +#define BASCTL_DLGEDMOD_HXX #include <svx/svdmodel.hxx> +namespace basctl +{ + //============================================================================ // DlgEdModel //============================================================================ @@ -48,6 +50,8 @@ public: virtual Window* GetCurDocViewWin(); }; -#endif +} // namespace basctl + +#endif // BASCTL_DLGEDMOD_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx index 7be6a2eeb188..d6119998f01f 100644 --- a/basctl/source/inc/dlgedobj.hxx +++ b/basctl/source/inc/dlgedobj.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_DLGEDOBJ_HXX -#define _BASCTL_DLGEDOBJ_HXX +#ifndef BASCTL_DLGEDOBJ_HXX +#define BASCTL_DLGEDOBJ_HXX #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/beans/XPropertyChangeListener.hpp> @@ -28,6 +28,9 @@ #include <boost/optional.hpp> +namespace basctl +{ + typedef ::std::multimap< sal_Int16, ::rtl::OUString, ::std::less< sal_Int16 > > IndexToNameMap; @@ -183,6 +186,8 @@ private: void ImplInvalidateDeviceInfo(); }; -#endif // _BASCTL_DLGEDOBJ_HXX +} // namespace basctl + +#endif // BASCTL_DLGEDOBJ_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedpage.hxx b/basctl/source/inc/dlgedpage.hxx index a0770cf280a5..5a87b4248f61 100644 --- a/basctl/source/inc/dlgedpage.hxx +++ b/basctl/source/inc/dlgedpage.hxx @@ -17,11 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_DLGEDPAGE_HXX -#define _BASCTL_DLGEDPAGE_HXX +#ifndef BASCTL_DLGEDPAGE_HXX +#define BASCTL_DLGEDPAGE_HXX #include "svx/svdpage.hxx" +namespace basctl +{ + //============================================================================ // DlgEdPage //============================================================================ @@ -50,6 +53,8 @@ public: virtual SdrObject* SetObjectOrdNum(sal_uLong nOldObjNum, sal_uLong nNewObjNum); }; -#endif //_BASCTL_DLGEDPAGE_HXX +} // namespace basctl + +#endif // BASCTL_DLGEDPAGE_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgedview.hxx b/basctl/source/inc/dlgedview.hxx index 55510ee19255..77c353420714 100644 --- a/basctl/source/inc/dlgedview.hxx +++ b/basctl/source/inc/dlgedview.hxx @@ -18,11 +18,14 @@ */ -#ifndef _BASCTL_DLGEDVIEW_HXX -#define _BASCTL_DLGEDVIEW_HXX +#ifndef BASCTL_DLGEDVIEW_HXX +#define BASCTL_DLGEDVIEW_HXX #include <svx/svdview.hxx> +namespace basctl +{ + class DlgEditor; //============================================================================ @@ -49,6 +52,8 @@ protected: virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uLong nOptions, const SetOfByte* pMVisLay) const; }; -#endif //_BASCTL_DLGEDVIEW_HXX +} // namespace basctl + +#endif // BASCTL_DLGEDVIEW_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/dlgresid.hrc b/basctl/source/inc/dlgresid.hrc index 2d8bc26cb8ee..de0cd8043a5f 100644 --- a/basctl/source/inc/dlgresid.hrc +++ b/basctl/source/inc/dlgresid.hrc @@ -16,8 +16,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_DLGRESID_HRC -#define _BASCTL_DLGRESID_HRC +#ifndef BASCTL_DLGRESID_HRC +#define BASCTL_DLGRESID_HRC #include <svl/solar.hrc> @@ -63,5 +63,5 @@ // ----------------------------------------------------------------------- -#endif // _BASCTL_DLGRESID_HRC +#endif // BASCTL_DLGRESID_HRC diff --git a/basctl/source/inc/iderid.hxx b/basctl/source/inc/iderid.hxx index a463941938eb..1a253301ff8d 100644 --- a/basctl/source/inc/iderid.hxx +++ b/basctl/source/inc/iderid.hxx @@ -17,11 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _IDERID_HXX -#define _IDERID_HXX +#ifndef BASCTL_IDERID_HXX +#define BASCTL_IDERID_HXX #include <tools/resid.hxx> +namespace basctl +{ + class IDEResId: public ResId { public: @@ -30,6 +33,8 @@ public: #define IDE_RESSTR(x) IDEResId(x).toString() -#endif //_IDERID_HXX +} // namespace basctl + +#endif // BASCTL_IDERID_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/localizationmgr.hxx b/basctl/source/inc/localizationmgr.hxx index 052d65efa1f8..612a2b777454 100644 --- a/basctl/source/inc/localizationmgr.hxx +++ b/basctl/source/inc/localizationmgr.hxx @@ -17,14 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _LOCALIZATIONMGR_HXX -#define _LOCALIZATIONMGR_HXX +#ifndef BASCTL_LOCALIZATIONMGR_HXX +#define BASCTL_LOCALIZATIONMGR_HXX #include "scriptdocument.hxx" #include <com/sun/star/resource/XStringResourceManager.hpp> -class BasicIDEShell; +namespace basctl +{ + +class Shell; class DlgEditor; class LocalizationMgr @@ -32,7 +35,7 @@ class LocalizationMgr ::com::sun::star::uno::Reference < ::com::sun::star::resource::XStringResourceManager > m_xStringResourceManager; - BasicIDEShell* m_pIDEShell; + Shell* m_pShell; ScriptDocument m_aDocument; ::rtl::OUString m_aLibName; @@ -66,7 +69,7 @@ class LocalizationMgr void implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode ); public: - LocalizationMgr( BasicIDEShell* pIDEShell, const ScriptDocument& rDocument, ::rtl::OUString aLibName, + LocalizationMgr(Shell*, const ScriptDocument&, ::rtl::OUString aLibName, const ::com::sun::star::uno::Reference < ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager ); ::com::sun::star::uno::Reference @@ -143,6 +146,8 @@ public: XStringResourceManager >& xTargetStringResourceManager ); }; -#endif +} // namespace basctl + +#endif // BASCTL_LOCALIZATIONMGR_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx index 4df98a8f4e72..cb99a9d3bf0b 100644 --- a/basctl/source/inc/managelang.hxx +++ b/basctl/source/inc/managelang.hxx @@ -17,17 +17,21 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_MANAGELANG_HXX -#define _BASCTL_MANAGELANG_HXX +#ifndef BASCTL_MANAGELANG_HXX +#define BASCTL_MANAGELANG_HXX #include <svx/checklbx.hxx> #include <vcl/button.hxx> #include <vcl/dialog.hxx> #include <vcl/fixed.hxx> -class LocalizationMgr; class SvxLanguageBox; +namespace basctl +{ + +class LocalizationMgr; + struct LanguageEntry { ::rtl::OUString m_sLanguage; @@ -106,6 +110,8 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > GetLocales() const; }; -#endif //_BASCTL_MANAGELANG_HXX +} // namespace basctl + +#endif // BASCTL_MANAGELANG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/propbrw.hxx b/basctl/source/inc/propbrw.hxx index 0e7c2fc579cb..ccf2a9ad4768 100644 --- a/basctl/source/inc/propbrw.hxx +++ b/basctl/source/inc/propbrw.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _BASCTL_PROPBRW_HXX -#define _BASCTL_PROPBRW_HXX +#ifndef BASCTL_PROPBRW_HXX +#define BASCTL_PROPBRW_HXX #include <com/sun/star/beans/XPropertySet.hpp> #include <comphelper/stl_types.hxx> @@ -27,6 +27,12 @@ #include <svl/lstner.hxx> #include <svx/svdmark.hxx> +class SfxBindings; +class SdrView; + +namespace basctl +{ + //============================================================================ // PropBrwMgr //============================================================================ @@ -42,9 +48,6 @@ public: // PropBrw //============================================================================ -class SfxBindings; -class SdrView; - class PropBrw : public SfxDockingWindow , public SfxListener, public SfxBroadcaster { private: @@ -91,7 +94,7 @@ public: using Window::Update; // note: changing the Context document to an instance other than the one given in the ctor is not supported // currently - void Update( const SfxViewShell* _pShell ); + void Update( const SfxViewShell* pShell ); SdrView* GetCurView() const { return pView; } private: @@ -100,6 +103,8 @@ private: void ImplReCreateController(); }; -#endif // _BASCTL_PROPBRW_HXX +} // namespace basctl + +#endif // BASCTL_PROPBRW_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/sbxitem.hxx b/basctl/source/inc/sbxitem.hxx index 6de3319c726d..f3645dd3312b 100644 --- a/basctl/source/inc/sbxitem.hxx +++ b/basctl/source/inc/sbxitem.hxx @@ -16,20 +16,23 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _SBXITEM_HXX -#define _SBXITEM_HXX +#ifndef BASCTL_SBXITEM_HXX +#define BASCTL_SBXITEM_HXX #include "scriptdocument.hxx" #include <svl/poolitem.hxx> -enum BasicIDEType +namespace basctl { - BASICIDE_TYPE_UNKNOWN, - BASICIDE_TYPE_SHELL, - BASICIDE_TYPE_LIBRARY, - BASICIDE_TYPE_MODULE, - BASICIDE_TYPE_DIALOG, - BASICIDE_TYPE_METHOD + +enum ItemType +{ + TYPE_UNKNOWN, + TYPE_SHELL, + TYPE_LIBRARY, + TYPE_MODULE, + TYPE_DIALOG, + TYPE_METHOD }; class SbxItem : public SfxPoolItem @@ -38,24 +41,28 @@ class SbxItem : public SfxPoolItem const ::rtl::OUString m_aLibName; const ::rtl::OUString m_aName; const ::rtl::OUString m_aMethodName; - BasicIDEType m_nType; + ItemType m_eType; public: TYPEINFO(); - SbxItem(sal_uInt16 nWhich, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName, const ::rtl::OUString& aName, BasicIDEType nType); - SbxItem(sal_uInt16 nWhich, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName, const ::rtl::OUString& aName, const ::rtl::OUString& aMethodName, BasicIDEType nType); - SbxItem(const SbxItem&); + SbxItem(sal_uInt16 nWhich, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName, const ::rtl::OUString& aName, ItemType); + SbxItem(sal_uInt16 nWhich, const ScriptDocument& rDocument, const ::rtl::OUString& aLibName, const ::rtl::OUString& aName, const ::rtl::OUString& aMethodName, ItemType eType); virtual SfxPoolItem* Clone(SfxItemPool *pPool = 0) const; virtual int operator==(const SfxPoolItem&) const; - const ScriptDocument& GetDocument() const; - const ::rtl::OUString& GetLibName() const; - const ::rtl::OUString& GetName() const; - const ::rtl::OUString& GetMethodName() const; - BasicIDEType GetType() const; + ScriptDocument const& GetDocument () const { return m_aDocument; } + rtl::OUString const& GetLibName () const { return m_aLibName; } + rtl::OUString const& GetName () const { return m_aName; } + rtl::OUString const& GetMethodName () const { return m_aMethodName; } + ItemType GetType () const { return m_eType; } }; -#endif +} // namespace basctl + +// For baside.sdi, because I don't know how to use nested names in it. +using basctl::SbxItem; + +#endif // BASCTL_SBXITEM_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/scriptdocument.hxx b/basctl/source/inc/scriptdocument.hxx index e941222b21e3..1fa08cc69c88 100644 --- a/basctl/source/inc/scriptdocument.hxx +++ b/basctl/source/inc/scriptdocument.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef SCRIPTDOCUMENT_HXX -#define SCRIPTDOCUMENT_HXX +#ifndef BASCTL_SCRIPTDOCUMENT_HXX +#define BASCTL_SCRIPTDOCUMENT_HXX #include <com/sun/star/script/XLibraryContainer.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -28,9 +28,10 @@ #include <boost/shared_ptr.hpp> #include <vector> -class BasicManager; class SfxListener; +class BasicManager; + //........................................................................ namespace basctl { @@ -64,8 +65,6 @@ namespace basctl //==================================================================== //= ScriptDocument //==================================================================== - class ScriptDocument_Impl; - class ScriptDocument; typedef ::std::vector< ScriptDocument > ScriptDocuments; @@ -74,7 +73,8 @@ namespace basctl class ScriptDocument { private: - ::boost::shared_ptr< ScriptDocument_Impl > m_pImpl; + class Impl; + boost::shared_ptr<Impl> m_pImpl; private: /** creates a ScriptDocument instance which operates on the application-wide @@ -507,23 +507,6 @@ namespace basctl } // namespace basctl //........................................................................ -// convenience ... better would be all classes in the project are in -// the same namespace ... -using ::basctl::ScriptDocument; -using ::basctl::ScriptDocuments; -using ::basctl::E_SCRIPTS; -using ::basctl::E_DIALOGS; -using ::basctl::LibraryLocation; -using ::basctl::LIBRARY_LOCATION_UNKNOWN; -using ::basctl::LIBRARY_LOCATION_USER; -using ::basctl::LIBRARY_LOCATION_SHARE; -using ::basctl::LIBRARY_LOCATION_DOCUMENT; -using ::basctl::LibraryType; -using ::basctl::LIBRARY_TYPE_UNKNOWN; -using ::basctl::LIBRARY_TYPE_MODULE; -using ::basctl::LIBRARY_TYPE_DIALOG; -using ::basctl::LIBRARY_TYPE_ALL; - -#endif // SCRIPTDOCUMENT_HXX +#endif // BASCTL_SCRIPTDOCUMENT_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basctl/source/inc/svheader.hxx b/basctl/source/inc/svheader.hxx index 5851faa2a751..1e181185e0a2 100644 --- a/basctl/source/inc/svheader.hxx +++ b/basctl/source/inc/svheader.hxx @@ -16,8 +16,8 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _SVHEADER_HXX -#define _SVHEADER_HXX +#ifndef BASCTL_SVHEADER_HXX +#define BASCTL_SVHEADER_HXX // SV @@ -52,6 +52,6 @@ #define _SBSTDOBJ1_HXX #define _SBXMSTRM_HXX -#endif +#endif // BASCTL_SVHEADER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |