summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-03-15 14:54:14 +0000
committerOliver Bolte <obo@openoffice.org>2007-03-15 14:54:14 +0000
commit14fe6cb6f6b65fa9298cfb43047f6ee57c684d88 (patch)
tree645af274b738d3d2c0f4898ba67d5324c849ed88 /basctl
parenta206ce7544dacdf80782291b85f562a3dfda44bd (diff)
INTEGRATION: CWS basmgr02 (1.39.10); FILE MERGED
2007/02/21 09:37:41 fs 1.39.10.3: #i73331# encapsulate (nearly) all usages of SfxObjectShell in the ScriptDocument class 2007/01/30 15:00:44 fs 1.39.10.2: RESYNC: (1.39-1.40); FILE MERGED 2007/01/10 14:05:10 fs 1.39.10.1: #i73329# SFXAPP::SaveBasicAndDialogContainer instead of two single methods
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/basidesh.cxx307
1 files changed, 147 insertions, 160 deletions
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index e20e8a8f388d..0a4fd06a6a1f 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: basidesh.cxx,v $
*
- * $Revision: 1.40 $
+ * $Revision: 1.41 $
*
- * last change: $Author: vg $ $Date: 2007-01-16 16:29:49 $
+ * last change: $Author: obo $ $Date: 2007-03-15 15:54:14 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -63,6 +63,7 @@
#ifndef _SFXHINT_HXX //autogen
#include <svtools/hint.hxx>
#endif
+#include <tools/diagnose_ex.h>
#include <basidesh.hrc>
#include <basidesh.hxx>
#include <basdoc.hxx>
@@ -101,7 +102,7 @@
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
-using namespace ::rtl;
+using ::rtl::OUString;
TYPEINIT1( BasicIDEShell, SfxViewShell );
@@ -135,6 +136,7 @@ sal_Int32 getBasicIDEShellCount( void )
BasicIDEShell::BasicIDEShell( SfxViewFrame *pFrame_, Window * ):
SfxViewShell( pFrame_, IDE_VIEWSHELL_FLAGS ),
+ m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ),
aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ),
aScrollBarBox( &GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE ) ),
@@ -147,6 +149,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFrame *pFrame_, Window * ):
BasicIDEShell::BasicIDEShell( SfxViewFrame *pFrame_, const BasicIDEShell& ):
SfxViewShell( pFrame_, IDE_VIEWSHELL_FLAGS ),
+ m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ),
aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ),
aScrollBarBox( &GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE ) ),
@@ -159,6 +162,7 @@ BasicIDEShell::BasicIDEShell( SfxViewFrame *pFrame_, const BasicIDEShell& ):
BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) :
SfxViewShell( pFrame_, IDE_VIEWSHELL_FLAGS ),
+ m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ),
aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ),
aScrollBarBox( &GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE ) ),
@@ -198,15 +202,12 @@ void BasicIDEShell::Init()
GetViewFrame()->GetWindow().SetBackground();
pCurWin = 0;
- m_pCurShell = 0;
+ m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
pObjectCatalog = 0;
bCreatingWindow = FALSE;
m_pCurLocalizationMgr = NULL;
- // MT 08/00: BasicToolBar not longer in other ViewShells.
-// SFX_APP()->GetAppDispatcher().Push(*this);
-
pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() );
pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) );
bTabBarSplitted = FALSE;
@@ -215,7 +216,7 @@ void BasicIDEShell::Init()
InitScrollBars();
InitTabBar();
- SetCurLib( 0, String::CreateFromAscii( "Standard" ), false, false );
+ SetCurLib( ScriptDocument::getApplicationScriptDocument(), String::CreateFromAscii( "Standard" ), false, false );
if ( IDE_DLL() && IDE_DLL()->pShell == NULL )
IDE_DLL()->pShell = this;
@@ -281,8 +282,7 @@ void BasicIDEShell::StoreAllWindowData( BOOL bPersistent )
if ( bPersistent )
{
- SFX_APP()->SaveBasicContainer();
- SFX_APP()->SaveDialogContainer();
+ SFX_APP()->SaveBasicAndDialogContainer();
SetAppBasicModified( FALSE );
SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
@@ -323,8 +323,8 @@ USHORT __EXPORT BasicIDEShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
if ( /* !pWin->IsSuspended() && */ !pWin->CanClose() )
{
- if ( m_aCurLibName.Len() && ( pWin->GetShell() != m_pCurShell || pWin->GetLibName() != m_aCurLibName ) )
- SetCurLib( 0, String(), false );
+ if ( m_aCurLibName.Len() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) )
+ SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false );
SetCurWindow( pWin, TRUE );
bCanClose = FALSE;
}
@@ -520,54 +520,57 @@ void __EXPORT BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
{
bool bSetCurWindow = false;
bool bSetCurLib = false;
- SfxObjectShell* pShell = (SfxObjectShell*)&rBC;
- Sequence< ::rtl::OUString > aLibNames = BasicIDE::GetLibraryNames( pShell );
- sal_Int32 nLibCount = aLibNames.getLength();
- const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; ++i )
+ ScriptDocument aDocument( dynamic_cast< SfxObjectShell& >( rBC ) );
+ if ( aDocument.isValid() )
{
- String aLibName = pLibNames[ i ];
- if ( !aLibName.Len() )
- continue;
+ Sequence< ::rtl::OUString > aLibNames = aDocument.getLibraryNames();;
+ sal_Int32 nLibCount = aLibNames.getLength();
+ const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
- // remove all windows which belong to this library
- for ( ULONG nWin = aIDEWindowTable.Count(); nWin; )
+ for ( sal_Int32 i = 0 ; i < nLibCount ; ++i )
{
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( --nWin );
- if ( pWin->GetShell() == pShell && pWin->GetLibName() == aLibName )
+ String aLibName = pLibNames[ i ];
+ if ( !aLibName.Len() )
+ continue;
+
+ // remove all windows which belong to this library
+ for ( ULONG nWin = aIDEWindowTable.Count(); nWin; )
{
- if ( pWin->GetStatus() & (BASWIN_RUNNINGBASIC|BASWIN_INRESCHEDULE) )
- {
- pWin->AddStatus( BASWIN_TOBEKILLED );
- pWin->Hide();
- StarBASIC::Stop();
- // there's no notify
- pWin->BasicStopped();
- }
- else
+ IDEBaseWindow* pWin = aIDEWindowTable.GetObject( --nWin );
+ if ( pWin->IsDocument( aDocument ) && pWin->GetLibName() == aLibName )
{
- pWin->StoreData();
- if ( pWin == pCurWin )
- bSetCurWindow = true;
- RemoveWindow( pWin, TRUE, FALSE );
+ if ( pWin->GetStatus() & (BASWIN_RUNNINGBASIC|BASWIN_INRESCHEDULE) )
+ {
+ pWin->AddStatus( BASWIN_TOBEKILLED );
+ pWin->Hide();
+ StarBASIC::Stop();
+ // there's no notify
+ pWin->BasicStopped();
+ }
+ else
+ {
+ pWin->StoreData();
+ if ( pWin == pCurWin )
+ bSetCurWindow = true;
+ RemoveWindow( pWin, TRUE, FALSE );
+ }
}
}
- }
- // remove lib info
- BasicIDEData* pData = IDE_DLL()->GetExtraData();
- if ( pData )
- pData->GetLibInfos().RemoveInfo( LibInfoKey( pShell, aLibName ) );
+ // remove lib info
+ BasicIDEData* pData = IDE_DLL()->GetExtraData();
+ if ( pData )
+ pData->GetLibInfos().RemoveInfo( LibInfoKey( aDocument, aLibName ) );
- if ( pShell == m_pCurShell && aLibName == m_aCurLibName )
- bSetCurLib = true;
- }
+ if ( aDocument == m_aCurDocument && aLibName == m_aCurLibName )
+ bSetCurLib = true;
+ }
- if ( bSetCurLib )
- SetCurLib( 0, String::CreateFromAscii( "Standard" ), true, false );
- else if ( bSetCurWindow )
- SetCurWindow( FindWindow(), TRUE );
+ if ( bSetCurLib )
+ SetCurLib( ScriptDocument::getApplicationScriptDocument(), String::CreateFromAscii( "Standard" ), true, false );
+ else if ( bSetCurWindow )
+ SetCurWindow( FindApplicationWindow(), TRUE );
+ }
EndListening( rBC, TRUE );
}
@@ -600,12 +603,12 @@ void __EXPORT BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
// ReadOnly toggled...
if ( rBC.IsA( TYPE( SfxObjectShell ) ) )
{
- SfxObjectShell* pShell = (SfxObjectShell*)&rBC;
+ ScriptDocument aDocument( dynamic_cast< SfxObjectShell& >( rBC ) );
for ( ULONG nWin = aIDEWindowTable.Count(); nWin; )
{
IDEBaseWindow* pWin = aIDEWindowTable.GetObject( --nWin );
- if ( pWin->GetShell() == pShell )
- pWin->SetReadOnly( pShell->IsReadOnly() );
+ if ( pWin->IsDocument( aDocument ) )
+ pWin->SetReadOnly( aDocument.isReadOnly() );
}
}
}
@@ -706,18 +709,18 @@ void BasicIDEShell::CheckWindows()
}
}
if ( bSetCurWindow )
- SetCurWindow( FindWindow(), TRUE );
+ SetCurWindow( FindApplicationWindow(), TRUE );
}
-void BasicIDEShell::RemoveWindows( SfxObjectShell* pShell, const String& rLibName, BOOL bDestroy )
+void BasicIDEShell::RemoveWindows( const ScriptDocument& rDocument, const String& rLibName, BOOL bDestroy )
{
BOOL bChangeCurWindow = pCurWin ? FALSE : TRUE;
for ( ULONG nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
{
IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
- if ( pWin->GetShell() == pShell && pWin->GetLibName() == rLibName )
+ if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName )
{
if ( pWin == pCurWin )
bChangeCurWindow = TRUE;
@@ -727,7 +730,7 @@ void BasicIDEShell::RemoveWindows( SfxObjectShell* pShell, const String& rLibNam
}
}
if ( bChangeCurWindow )
- SetCurWindow( FindWindow(), TRUE );
+ SetCurWindow( FindApplicationWindow(), TRUE );
}
@@ -741,7 +744,7 @@ void BasicIDEShell::UpdateWindows()
for ( ULONG nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
{
IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
- if ( pWin->GetShell() != m_pCurShell || pWin->GetLibName() != m_aCurLibName )
+ if ( !pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName )
{
if ( pWin == pCurWin )
bChangeCurWindow = TRUE;
@@ -765,131 +768,117 @@ void BasicIDEShell::UpdateWindows()
IDEBaseWindow* pNextActiveWindow = 0;
// Alle anzuzeigenden Fenster anzeigen
- BasicManager* pBasicMgr = SFX_APP()->GetBasicManager();
- SfxObjectShell* pDocShell = 0;
- while ( pBasicMgr )
+ ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( true ) );
+ for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
+ doc != aDocuments.end();
+ ++doc
+ )
{
- // Nur, wenn es ein dazugehoeriges Fenster gibt, damit nicht die
- // Gecachten Docs, die nicht sichtbar sind ( Remot-Dokumente )
- if ( !pDocShell || ( ( pBasicMgr != SFX_APP()->GetBasicManager() )
- && ( SfxViewFrame::GetFirst( pDocShell ) ) ) )
- {
- StartListening( *pBasicMgr, TRUE /* Nur einmal anmelden */ );
- if ( pDocShell )
- StartListening( *pDocShell, TRUE );
+ StartListening( *doc->getBasicManager(), TRUE /* Nur einmal anmelden */ );
+ if ( !doc->isApplication() )
+ doc->LEGACY_startDocumentListening( *this );
- // libraries
- Sequence< ::rtl::OUString > aLibNames = BasicIDE::GetLibraryNames( pDocShell );
- sal_Int32 nLibCount = aLibNames.getLength();
- const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
+ // libraries
+ Sequence< ::rtl::OUString > aLibNames( doc->getLibraryNames() );
+ sal_Int32 nLibCount = aLibNames.getLength();
+ const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- String aLibName = pLibNames[ i ];
- ::rtl::OUString aOULibName( aLibName );
+ for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
+ {
+ String aLibName = pLibNames[ i ];
- if ( !m_aCurLibName.Len() || ( pDocShell == m_pCurShell && aLibName == m_aCurLibName ) )
+ if ( !m_aCurLibName.Len() || ( *doc == m_aCurDocument && aLibName == m_aCurLibName ) )
+ {
+ // check, if library is password protected and not verified
+ BOOL bProtected = FALSE;
+ Reference< script::XLibraryContainer > xModLibContainer( doc->getLibraryContainer( E_SCRIPTS ) );
+ if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
{
- // check, if library is password protected and not verified
- BOOL bProtected = FALSE;
- Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pDocShell ), UNO_QUERY );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
+ Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
+ if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
{
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- bProtected = TRUE;
- }
+ bProtected = TRUE;
}
+ }
+
+ if ( !bProtected )
+ {
+ LibInfoItem* pLibInfoItem = 0;
+ BasicIDEData* pData = IDE_DLL()->GetExtraData();
+ if ( pData )
+ pLibInfoItem = pData->GetLibInfos().GetInfo( LibInfoKey( *doc, aLibName ) );
- if ( !bProtected )
+ // modules
+ if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
{
- LibInfoItem* pLibInfoItem = 0;
- BasicIDEData* pData = IDE_DLL()->GetExtraData();
- if ( pData )
- pLibInfoItem = pData->GetLibInfos().GetInfo( LibInfoKey( pDocShell, aLibName ) );
+ StarBASIC* pLib = doc->getBasicManager()->GetLib( aLibName );
+ if ( pLib )
+ ImplStartListening( pLib );
- // modules
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
+ try
{
- StarBASIC* pLib = pBasicMgr->GetLib( aLibName );
- if ( pLib )
- ImplStartListening( pLib );
+ Sequence< ::rtl::OUString > aModNames( doc->getObjectNames( E_SCRIPTS, aLibName ) );
+ sal_Int32 nModCount = aModNames.getLength();
+ const ::rtl::OUString* pModNames = aModNames.getConstArray();
- try
+ for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
{
- Sequence< ::rtl::OUString > aModNames = BasicIDE::GetModuleNames( pDocShell, aLibName );
- sal_Int32 nModCount = aModNames.getLength();
- const ::rtl::OUString* pModNames = aModNames.getConstArray();
-
- for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
+ String aModName = pModNames[ j ];
+ 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 )
{
- String aModName = pModNames[ j ];
- ModulWindow* pWin = FindBasWin( pDocShell, aLibName, aModName, FALSE );
- if ( !pWin )
- pWin = CreateBasWin( pDocShell, aLibName, aModName );
- if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aModName &&
- pLibInfoItem->GetCurrentType() == BASICIDE_TYPE_MODULE )
- {
- pNextActiveWindow = (IDEBaseWindow*)pWin;
- }
+ pNextActiveWindow = (IDEBaseWindow*)pWin;
}
}
- catch ( container::NoSuchElementException& e )
- {
- ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US );
- DBG_ERROR( aBStr.GetBuffer() );
- }
}
+ catch ( container::NoSuchElementException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
- // dialogs
- Reference< script::XLibraryContainer > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pDocShell ), UNO_QUERY );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
+ // dialogs
+ Reference< script::XLibraryContainer > xDlgLibContainer( doc->getLibraryContainer( E_DIALOGS ) );
+ if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) )
+ {
+ try
{
- try
- {
- Sequence< ::rtl::OUString > aDlgNames = BasicIDE::GetDialogNames( pDocShell, aLibName );
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
+ Sequence< ::rtl::OUString > aDlgNames = doc->getObjectNames( E_DIALOGS, aLibName );
+ sal_Int32 nDlgCount = aDlgNames.getLength();
+ const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
- for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ )
+ for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ )
+ {
+ String aDlgName = pDlgNames[ j ];
+ // this find only looks for non-suspended windows;
+ // suspended windows are handled in CreateDlgWin
+ 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 )
{
- String aDlgName = pDlgNames[ j ];
- // this find only looks for non-suspended windows;
- // suspended windows are handled in CreateDlgWin
- DialogWindow* pWin = FindDlgWin( pDocShell, aLibName, aDlgName, FALSE );
- if ( !pWin )
- pWin = CreateDlgWin( pDocShell, aLibName, aDlgName );
- if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aDlgName &&
- pLibInfoItem->GetCurrentType() == BASICIDE_TYPE_DIALOG )
- {
- pNextActiveWindow = (IDEBaseWindow*)pWin;
- }
+ pNextActiveWindow = (IDEBaseWindow*)pWin;
}
}
- catch ( container::NoSuchElementException& e )
- {
- ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US );
- DBG_ERROR( aBStr.GetBuffer() );
- }
+ }
+ catch ( container::NoSuchElementException& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
}
}
}
}
}
-
- if ( pDocShell )
- pDocShell = SfxObjectShell::GetNext( *pDocShell );
- else
- pDocShell = SfxObjectShell::GetFirst();
-
- pBasicMgr = ( pDocShell ? pDocShell->GetBasicManager() : 0 );
}
if ( bChangeCurWindow )
{
if ( !pNextActiveWindow )
- pNextActiveWindow = FindWindow();
+ pNextActiveWindow = FindApplicationWindow();
SetCurWindow( pNextActiveWindow, TRUE );
}
}
@@ -903,7 +892,7 @@ void BasicIDEShell::RemoveWindow( IDEBaseWindow* pWindow_, BOOL bDestroy, BOOL b
if ( pWindow_ == pCurWin )
{
if ( bAllowChangeCurWindow )
- SetCurWindow( FindWindow(), TRUE );
+ SetCurWindow( FindApplicationWindow(), TRUE );
else
SetCurWindow( NULL, FALSE );
}
@@ -1003,18 +992,18 @@ void BasicIDEShell::EnableScrollbars( BOOL bEnable )
}
}
-void BasicIDEShell::SetCurLib( SfxObjectShell* pShell, String aLibName, bool bUpdateWindows, bool bCheck )
+void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName, bool bUpdateWindows, bool bCheck )
{
- if ( !bCheck || ( pShell != m_pCurShell || aLibName != m_aCurLibName ) )
+ if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
{
- m_pCurShell = pShell;
+ m_aCurDocument = rDocument;
m_aCurLibName = aLibName;
if ( bUpdateWindows )
UpdateWindows();
SetMDITitle();
- SetCurLibForLocalization( pShell, aLibName );
+ SetCurLibForLocalization( rDocument, aLibName );
SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
if ( pBindings )
@@ -1026,20 +1015,18 @@ void BasicIDEShell::SetCurLib( SfxObjectShell* pShell, String aLibName, bool bUp
}
}
-void BasicIDEShell::SetCurLibForLocalization( SfxObjectShell* pShell, String aLibName )
+void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, String aLibName )
{
// Create LocalizationMgr
delete m_pCurLocalizationMgr;
Reference< resource::XStringResourceManager > xStringResourceManager;
if( aLibName.Len() )
{
- Reference< container::XNameContainer > xDialogLib =
- BasicIDE::GetDialogLibrary( pShell, aLibName, TRUE );
-
+ Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, TRUE ) );
xStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
}
m_pCurLocalizationMgr = new LocalizationMgr
- ( this, pShell, aLibName, xStringResourceManager );
+ ( this, rDocument, aLibName, xStringResourceManager );
m_pCurLocalizationMgr->handleTranslationbar();
}