Kaydet (Commit) 49751c87 authored tarafından Kurt Zenker's avatar Kurt Zenker

INTEGRATION: CWS tbe11 (1.26.14); FILE MERGED

2004/07/15 17:49:52 tbe 1.26.14.3: #i31315# Rework Basic IDE Macro Chooser and Macro Organizer
2004/07/09 15:54:53 tbe 1.26.14.2: #i31315# Rework Basic IDE Macro Chooser and Macro Organizer
2004/06/21 11:26:45 tbe 1.26.14.1: #99468# Basic IDE cannot handle libraries, which contain dialogs only
üst 33da8a59
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: basobj2.cxx,v $ * $RCSfile: basobj2.cxx,v $
* *
* $Revision: 1.26 $ * $Revision: 1.27 $
* *
* last change: $Author: rt $ $Date: 2004-05-19 08:01:37 $ * last change: $Author: kz $ $Date: 2004-07-23 12:03:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -138,14 +138,18 @@ SfxMacro* BasicIDE::CreateMacro() ...@@ -138,14 +138,18 @@ SfxMacro* BasicIDE::CreateMacro()
void BasicIDE::Organize( INT16 tabId ) void BasicIDE::Organize( INT16 tabId )
{ {
BasicIDEDLL::Init(); BasicIDEDLL::Init();
Window* pParent = Application::GetDefDialogParent();
OrganizeDialog* pDlg = new OrganizeDialog( pParent, tabId ); BasicEntryDescriptor aDesc;
if ( IDE_DLL()->GetShell() ) BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
if ( pIDEShell )
{ {
IDEBaseWindow* pWin = IDE_DLL()->GetShell()->GetCurWindow(); IDEBaseWindow* pCurWin = pIDEShell->GetCurWindow();
if ( pWin ) if ( pCurWin )
pDlg->SetCurrentModule( pWin->CreateSbxDescription() ); aDesc = pCurWin->CreateEntryDescriptor();
} }
Window* pParent = Application::GetDefDialogParent();
OrganizeDialog* pDlg = new OrganizeDialog( pParent, tabId, aDesc );
pDlg->Execute(); pDlg->Execute();
delete pDlg; delete pDlg;
} }
...@@ -250,6 +254,33 @@ Sequence< ::rtl::OUString > BasicIDE::GetMergedLibraryNames( const Reference< sc ...@@ -250,6 +254,33 @@ Sequence< ::rtl::OUString > BasicIDE::GetMergedLibraryNames( const Reference< sc
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
BOOL BasicIDE::HasShell( SfxObjectShell* pShell )
{
BOOL bHasShell = FALSE;
if ( pShell )
{
SfxObjectShell* pDocShell = SfxObjectShell::GetFirst();
while ( pDocShell )
{
if ( pDocShell == pShell )
{
bHasShell = TRUE;
break;
}
pDocShell = SfxObjectShell::GetNext( *pDocShell );
}
}
else
{
bHasShell = TRUE;
}
return bHasShell;
}
//----------------------------------------------------------------------------
Reference< script::XLibraryContainer > BasicIDE::GetModuleLibraryContainer( SfxObjectShell* pShell ) Reference< script::XLibraryContainer > BasicIDE::GetModuleLibraryContainer( SfxObjectShell* pShell )
{ {
// get library container // get library container
...@@ -378,23 +409,26 @@ BOOL BasicIDE::HasModule( SfxObjectShell* pShell, const String& rLibName, const ...@@ -378,23 +409,26 @@ BOOL BasicIDE::HasModule( SfxObjectShell* pShell, const String& rLibName, const
{ {
BOOL bHasModule = FALSE; BOOL bHasModule = FALSE;
Reference< container::XNameContainer > xLib; // get library container
try Reference< script::XLibraryContainer > xLibContainer = GetModuleLibraryContainer( pShell );
// check if library container has module library
::rtl::OUString aOULibName( rLibName );
if ( xLibContainer.is() && xLibContainer->hasByName( aOULibName ) )
{ {
// load library
if ( !xLibContainer->isLibraryLoaded( aOULibName ) )
xLibContainer->loadLibrary( aOULibName );
// get library // get library
xLib = GetModuleLibrary( pShell, rLibName, TRUE ); Reference< container::XNameContainer > xLib;
Any aElement = xLibContainer->getByName( aOULibName );
aElement >>= xLib;
// check if library has module // check if library has module
::rtl::OUString aOUModName( rModName ); ::rtl::OUString aOUModName( rModName );
if( xLib.is() && xLib->hasByName( aOUModName ) ) if ( xLib.is() && xLib->hasByName( aOUModName ) )
{
bHasModule = TRUE; bHasModule = TRUE;
}
}
catch ( container::NoSuchElementException& e )
{
ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US );
DBG_ERROR( aBStr.GetBuffer() );
} }
return bHasModule; return bHasModule;
...@@ -532,7 +566,7 @@ void BasicIDE::RenameModule( SfxObjectShell* pShell, const String& rLibName, con ...@@ -532,7 +566,7 @@ void BasicIDE::RenameModule( SfxObjectShell* pShell, const String& rLibName, con
// set new module in module window // set new module in module window
ModulWindow* pModWin = (ModulWindow*)pWin; ModulWindow* pModWin = (ModulWindow*)pWin;
pModWin->SetSbModule( (SbModule*)pWin->GetBasic()->FindModule( rNewName ) ); pModWin->SetSbModule( (SbModule*)pModWin->GetBasic()->FindModule( rNewName ) );
// update tabwriter // update tabwriter
USHORT nId = (USHORT)(pIDEShell->GetIDEWindowTable()).GetKey( pWin ); USHORT nId = (USHORT)(pIDEShell->GetIDEWindowTable()).GetKey( pWin );
...@@ -576,7 +610,11 @@ void BasicIDE::InsertModule( SfxObjectShell* pShell, const String& rLibName, con ...@@ -576,7 +610,11 @@ void BasicIDE::InsertModule( SfxObjectShell* pShell, const String& rLibName, con
throw(ElementExistException, NoSuchElementException) throw(ElementExistException, NoSuchElementException)
{ {
// get library // get library
Reference< container::XNameContainer > xLib = GetModuleLibrary( pShell, rLibName, TRUE ); Reference< container::XNameContainer > xLib;
if ( BasicIDE::HasModuleLibrary( pShell, rLibName ) )
xLib = GetModuleLibrary( pShell, rLibName, TRUE );
else
xLib = BasicIDE::CreateModuleLibrary( pShell, rLibName );
// insert module into library // insert module into library
::rtl::OUString aOUModName( rModName ); ::rtl::OUString aOUModName( rModName );
...@@ -624,9 +662,6 @@ void BasicIDE::UpdateModule( SfxObjectShell* pShell, const String& rLibName, con ...@@ -624,9 +662,6 @@ void BasicIDE::UpdateModule( SfxObjectShell* pShell, const String& rLibName, con
{ {
BasicIDEDLL::Init(); BasicIDEDLL::Init();
if ( rMacroDesc.getLength() )
IDE_DLL()->GetExtraData()->GetLastMacro() = String( rMacroDesc );
IDE_DLL()->GetExtraData()->ChoosingMacro() = TRUE; IDE_DLL()->GetExtraData()->ChoosingMacro() = TRUE;
SFX_APP()->EnterBasicCall(); SFX_APP()->EnterBasicCall();
...@@ -638,7 +673,6 @@ void BasicIDE::UpdateModule( SfxObjectShell* pShell, const String& rLibName, con ...@@ -638,7 +673,6 @@ void BasicIDE::UpdateModule( SfxObjectShell* pShell, const String& rLibName, con
if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() ) if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() )
pChooser->SetMode( MACROCHOOSER_CHOOSEONLY ); pChooser->SetMode( MACROCHOOSER_CHOOSEONLY );
if ( !bChooseOnly && !bExecute ) if ( !bChooseOnly && !bExecute )
// Hack! // Hack!
pChooser->SetMode( MACROCHOOSER_RECORDING ); pChooser->SetMode( MACROCHOOSER_RECORDING );
...@@ -757,3 +791,26 @@ Sequence< ::rtl::OUString > BasicIDE::GetMethodNames( SfxObjectShell* pShell, co ...@@ -757,3 +791,26 @@ Sequence< ::rtl::OUString > BasicIDE::GetMethodNames( SfxObjectShell* pShell, co
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
BOOL BasicIDE::HasMethod( SfxObjectShell* pShell, const String& rLibName, const String& rModName, const String& rMethName )
{
BOOL bHasMethod = FALSE;
if ( HasModule( pShell, rLibName, rModName ) )
{
::rtl::OUString aOUSource = GetModule( pShell, rLibName, rModName );
SbModuleRef xModule = new SbModule( rModName );
xModule->SetSource32( aOUSource );
SbxArray* pMethods = xModule->GetMethods();
if ( pMethods )
{
SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD );
if ( pMethod )
bHasMethod = TRUE;
}
}
return bHasMethod;
}
//----------------------------------------------------------------------------
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment