summaryrefslogtreecommitdiff
path: root/basctl/source/basicide
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2018-12-29 13:26:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-12-30 08:47:26 +0100
commit99cecd1f12a1d17822b9b29ceb112c0c48945386 (patch)
treee641396959ed4c91789bf1d7baee8ad17bc88a9d /basctl/source/basicide
parent6aaed7c5165ea87c3a263fd9582c97892345120f (diff)
use StartExecuteAsync in basctl
Change-Id: Id24d03631ff60305525835144ad543d5dcb2064f Reviewed-on: https://gerrit.libreoffice.org/65709 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl/source/basicide')
-rw-r--r--basctl/source/basicide/basides1.cxx9
-rw-r--r--basctl/source/basicide/basobj2.cxx2
-rw-r--r--basctl/source/basicide/macrodlg.cxx23
-rw-r--r--basctl/source/basicide/moduldl2.cxx391
4 files changed, 215 insertions, 210 deletions
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index d6611bc764ef..7cc498490af6 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -739,9 +739,12 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
case SID_BASICIDE_MANAGE_LANG:
{
- ScopedVclPtrInstance< ManageLanguageDialog > aDlg(pCurWin, m_pCurLocalizationMgr);
- aDlg->Execute();
- rReq.Done();
+ std::shared_ptr<SfxRequest> pRequest(new SfxRequest(rReq));
+ rReq.Ignore(); // the 'old' request is not relevant any more
+ auto pDlg = VclPtr<ManageLanguageDialog>::Create(pCurWin, m_pCurLocalizationMgr);
+ pDlg->StartExecuteAsync([=](sal_Int32 /*nResult*/){
+ pRequest->Done();
+ });
}
break;
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 708c35dbd7c1..de273c0810cd 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -72,7 +72,7 @@ void Organize( sal_Int16 tabId )
aDesc = pCurWin->CreateEntryDescriptor();
vcl::Window* pParent = Application::GetDefDialogParent();
- ScopedVclPtrInstance<OrganizeDialog>(pParent, tabId, aDesc)->Execute();
+ VclPtr<OrganizeDialog>::Create(pParent, tabId, aDesc)->StartExecuteAsync(nullptr);
}
bool IsValidSbxName( const OUString& rName )
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index f882d7a9542f..fb2500aad587 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -742,20 +742,19 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void)
m_xBasicBox->get_selected(m_xBasicBoxIter.get());
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get());
VclPtrInstance< OrganizeDialog > pDlg( nullptr, 0, aDesc ); //TODO
- sal_uInt16 nRet = pDlg->Execute();
- pDlg.reset();
-
- if ( nRet ) // not only closed
- {
- m_xDialog->response(Macro_Edit);
- return;
- }
+ pDlg->StartExecuteAsync([=](sal_Int32 nRet){
+ if ( nRet ) // not only closed
+ {
+ m_xDialog->response(Macro_Edit);
+ return;
+ }
- Shell* pShell = GetShell();
- if ( pShell && pShell->IsAppBasicModified() )
- bForceStoreBasic = true;
+ Shell* pShell = GetShell();
+ if ( pShell && pShell->IsAppBasicModified() )
+ bForceStoreBasic = true;
- m_xBasicBox->UpdateEntries();
+ m_xBasicBox->UpdateEntries();
+ });
}
}
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index c7cf1527007b..5bbcd1a5dccd 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -831,240 +831,243 @@ void LibPage::InsertLib()
if ( aExtension != aLibExtension && aExtension != aContExtension )
pLibDlg->EnableReference(false);
- if ( !pLibDlg->Execute() )
- return;
-
- bool bChanges = false;
- sal_uLong nNewPos = m_pLibBox->GetEntryCount();
- bool bRemove = false;
- bool bReplace = pLibDlg->IsReplace();
- bool bReference = pLibDlg->IsReference();
- for ( sal_uLong nLib = 0; nLib < pLibDlg->GetLibBox().GetEntryCount(); nLib++ )
- {
- if ( pLibDlg->GetLibBox().IsChecked( nLib ) )
+ pLibDlg->StartExecuteAsync([=](sal_Int32 nResult)
{
- SvTreeListEntry* pEntry = pLibDlg->GetLibBox().GetEntry( nLib );
- DBG_ASSERT( pEntry, "Entry?!" );
- OUString aLibName( SvTabListBox::GetEntryText( pEntry, 0 ) );
- Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
-
- // check, if the library is already existing
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) ) )
+ if (!nResult )
+ return;
+
+ bool bChanges = false;
+ sal_uLong nNewPos = m_pLibBox->GetEntryCount();
+ bool bRemove = false;
+ bool bReplace = pLibDlg->IsReplace();
+ bool bReference = pLibDlg->IsReference();
+ for ( sal_uLong nLib = 0; nLib < pLibDlg->GetLibBox().GetEntryCount(); nLib++ )
{
- if ( bReplace )
+ if ( pLibDlg->GetLibBox().IsChecked( nLib ) )
{
- // check, if the library is the Standard library
- if ( aLibName == "Standard" )
+ SvTreeListEntry* pEntry = pLibDlg->GetLibBox().GetEntry( nLib );
+ DBG_ASSERT( pEntry, "Entry?!" );
+ OUString aLibName( SvTabListBox::GetEntryText( pEntry, 0 ) );
+ Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
+ Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
+
+ // check, if the library is already existing
+ if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) ) )
{
- std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_REPLACESTDLIB)));
- xErrorBox->run();
- continue;
- }
-
- // check, if the library is readonly and not a link
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) && !xModLibContainer->isLibraryLink( aLibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) && !xDlgLibContainer->isLibraryLink( aLibName ) ) )
- {
- OUString aErrStr( IDEResId(RID_STR_REPLACELIB) );
- aErrStr = aErrStr.replaceAll("XX", aLibName) + "\n" + IDEResId(RID_STR_LIBISREADONLY);
- std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
- xErrorBox->run();
- continue;
- }
+ if ( bReplace )
+ {
+ // check, if the library is the Standard library
+ if ( aLibName == "Standard" )
+ {
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, IDEResId(RID_STR_REPLACESTDLIB)));
+ xErrorBox->run();
+ continue;
+ }
- // remove existing libraries
- bRemove = true;
- }
- else
- {
- OUString aErrStr;
- if ( bReference )
- aErrStr = IDEResId(RID_STR_REFNOTPOSSIBLE);
- else
- aErrStr = IDEResId(RID_STR_IMPORTNOTPOSSIBLE);
- aErrStr = aErrStr.replaceAll("XX", aLibName) + "\n" +IDEResId(RID_STR_SBXNAMEALLREADYUSED);
- std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
- xErrorBox->run();
- continue;
- }
- }
+ // check, if the library is readonly and not a link
+ if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && xModLibContainer->isLibraryReadOnly( aLibName ) && !xModLibContainer->isLibraryLink( aLibName ) ) ||
+ ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) && xDlgLibContainer->isLibraryReadOnly( aLibName ) && !xDlgLibContainer->isLibraryLink( aLibName ) ) )
+ {
+ OUString aErrStr( IDEResId(RID_STR_REPLACELIB) );
+ aErrStr = aErrStr.replaceAll("XX", aLibName) + "\n" + IDEResId(RID_STR_LIBISREADONLY);
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
+ xErrorBox->run();
+ continue;
+ }
- // check, if the library is password protected
- bool bOK = false;
- OUString aPassword;
- if ( xModLibContImport.is() && xModLibContImport->hasByName( aLibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) && !bReference )
- {
- bOK = QueryPassword( xModLibContImp, aLibName, aPassword, true, true );
+ // remove existing libraries
+ bRemove = true;
+ }
+ else
+ {
+ OUString aErrStr;
+ if ( bReference )
+ aErrStr = IDEResId(RID_STR_REFNOTPOSSIBLE);
+ else
+ aErrStr = IDEResId(RID_STR_IMPORTNOTPOSSIBLE);
+ aErrStr = aErrStr.replaceAll("XX", aLibName) + "\n" +IDEResId(RID_STR_SBXNAMEALLREADYUSED);
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
+ xErrorBox->run();
+ continue;
+ }
+ }
- if ( !bOK )
+ // check, if the library is password protected
+ bool bOK = false;
+ OUString aPassword;
+ if ( xModLibContImport.is() && xModLibContImport->hasByName( aLibName ) )
{
- OUString aErrStr( IDEResId(RID_STR_NOIMPORT) );
- aErrStr = aErrStr.replaceAll("XX", aLibName);
- std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
- xErrorBox->run();
- continue;
- }
- }
- }
+ Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY );
+ if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) && !bReference )
+ {
+ bOK = QueryPassword( xModLibContImp, aLibName, aPassword, true, true );
- // remove existing libraries
- if ( bRemove )
- {
- // remove listbox entry
- SvTreeListEntry* pEntry_ = m_pLibBox->FindEntry( aLibName );
- if ( pEntry_ )
- m_pLibBox->SvTreeListBox::GetModel()->Remove( pEntry_ );
-
- // remove module library
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
- xModLibContainer->removeLibrary( aLibName );
-
- // remove dialog library
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) )
- xDlgLibContainer->removeLibrary( aLibName );
- }
+ if ( !bOK )
+ {
+ OUString aErrStr( IDEResId(RID_STR_NOIMPORT) );
+ aErrStr = aErrStr.replaceAll("XX", aLibName);
+ std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, aErrStr));
+ xErrorBox->run();
+ continue;
+ }
+ }
+ }
- // copy module library
- if ( xModLibContImport.is() && xModLibContImport->hasByName( aLibName ) && xModLibContainer.is() && !xModLibContainer->hasByName( aLibName ) )
- {
- Reference< container::XNameContainer > xModLib;
- if ( bReference )
- {
- // storage URL
- INetURLObject aModStorageURLObj( aModURLObj );
- if ( aExtension == aContExtension )
+ // remove existing libraries
+ if ( bRemove )
{
- sal_Int32 nCount = aModStorageURLObj.getSegmentCount();
- aModStorageURLObj.insertName( aLibName, false, nCount-1 );
- aModStorageURLObj.setExtension( aLibExtension );
- aModStorageURLObj.setFinalSlash();
+ // remove listbox entry
+ SvTreeListEntry* pEntry_ = m_pLibBox->FindEntry( aLibName );
+ if ( pEntry_ )
+ m_pLibBox->SvTreeListBox::GetModel()->Remove( pEntry_ );
+
+ // remove module library
+ if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
+ xModLibContainer->removeLibrary( aLibName );
+
+ // remove dialog library
+ if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) )
+ xDlgLibContainer->removeLibrary( aLibName );
}
- OUString aModStorageURL( aModStorageURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
- // create library link
- xModLib.set( xModLibContainer->createLibraryLink( aLibName, aModStorageURL, true ), UNO_QUERY);
- }
- else
- {
- // create library
- xModLib = xModLibContainer->createLibrary( aLibName );
- if ( xModLib.is() )
+ // copy module library
+ if ( xModLibContImport.is() && xModLibContImport->hasByName( aLibName ) && xModLibContainer.is() && !xModLibContainer->hasByName( aLibName ) )
{
- // get import library
- Reference< container::XNameContainer > xModLibImport;
- Any aElement = xModLibContImport->getByName( aLibName );
- aElement >>= xModLibImport;
-
- if ( xModLibImport.is() )
+ Reference< container::XNameContainer > xModLib;
+ if ( bReference )
{
- // load library
- if ( !xModLibContImport->isLibraryLoaded( aLibName ) )
- xModLibContImport->loadLibrary( aLibName );
-
- // copy all modules
- Sequence< OUString > aModNames = xModLibImport->getElementNames();
- sal_Int32 nModCount = aModNames.getLength();
- const OUString* pModNames = aModNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
+ // storage URL
+ INetURLObject aModStorageURLObj( aModURLObj );
+ if ( aExtension == aContExtension )
{
- OUString aModName( pModNames[ i ] );
- Any aElement_ = xModLibImport->getByName( aModName );
- xModLib->insertByName( aModName, aElement_ );
+ sal_Int32 nCount = aModStorageURLObj.getSegmentCount();
+ aModStorageURLObj.insertName( aLibName, false, nCount-1 );
+ aModStorageURLObj.setExtension( aLibExtension );
+ aModStorageURLObj.setFinalSlash();
}
+ OUString aModStorageURL( aModStorageURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
- // set password
- if ( bOK )
+ // create library link
+ xModLib.set( xModLibContainer->createLibraryLink( aLibName, aModStorageURL, true ), UNO_QUERY);
+ }
+ else
+ {
+ // create library
+ xModLib = xModLibContainer->createLibrary( aLibName );
+ if ( xModLib.is() )
{
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() )
+ // get import library
+ Reference< container::XNameContainer > xModLibImport;
+ Any aElement = xModLibContImport->getByName( aLibName );
+ aElement >>= xModLibImport;
+
+ if ( xModLibImport.is() )
{
- try
+ // load library
+ if ( !xModLibContImport->isLibraryLoaded( aLibName ) )
+ xModLibContImport->loadLibrary( aLibName );
+
+ // copy all modules
+ Sequence< OUString > aModNames = xModLibImport->getElementNames();
+ sal_Int32 nModCount = aModNames.getLength();
+ const OUString* pModNames = aModNames.getConstArray();
+ for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
{
- xPasswd->changeLibraryPassword( aLibName, OUString(), aPassword );
+ OUString aModName( pModNames[ i ] );
+ Any aElement_ = xModLibImport->getByName( aModName );
+ xModLib->insertByName( aModName, aElement_ );
}
- catch (...)
+
+ // set password
+ if ( bOK )
{
+ Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
+ if ( xPasswd.is() )
+ {
+ try
+ {
+ xPasswd->changeLibraryPassword( aLibName, OUString(), aPassword );
+ }
+ catch (...)
+ {
+ }
+ }
}
}
}
}
}
- }
- }
- // copy dialog library
- if ( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aLibName ) && xDlgLibContainer.is() && !xDlgLibContainer->hasByName( aLibName ) )
- {
- Reference< container::XNameContainer > xDlgLib;
- if ( bReference )
- {
- // storage URL
- INetURLObject aDlgStorageURLObj( aDlgURLObj );
- if ( aExtension == aContExtension )
+ // copy dialog library
+ if ( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aLibName ) && xDlgLibContainer.is() && !xDlgLibContainer->hasByName( aLibName ) )
{
- sal_Int32 nCount = aDlgStorageURLObj.getSegmentCount();
- aDlgStorageURLObj.insertName( aLibName, false, nCount - 1 );
- aDlgStorageURLObj.setExtension( aLibExtension );
- aDlgStorageURLObj.setFinalSlash();
- }
- OUString aDlgStorageURL( aDlgStorageURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
-
- // create library link
- xDlgLib.set( xDlgLibContainer->createLibraryLink( aLibName, aDlgStorageURL, true ), UNO_QUERY);
- }
- else
- {
- // create library
- xDlgLib = xDlgLibContainer->createLibrary( aLibName );
- if ( xDlgLib.is() )
- {
- // get import library
- Reference< container::XNameContainer > xDlgLibImport;
- Any aElement = xDlgLibContImport->getByName( aLibName );
- aElement >>= xDlgLibImport;
+ Reference< container::XNameContainer > xDlgLib;
+ if ( bReference )
+ {
+ // storage URL
+ INetURLObject aDlgStorageURLObj( aDlgURLObj );
+ if ( aExtension == aContExtension )
+ {
+ sal_Int32 nCount = aDlgStorageURLObj.getSegmentCount();
+ aDlgStorageURLObj.insertName( aLibName, false, nCount - 1 );
+ aDlgStorageURLObj.setExtension( aLibExtension );
+ aDlgStorageURLObj.setFinalSlash();
+ }
+ OUString aDlgStorageURL( aDlgStorageURLObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
- if ( xDlgLibImport.is() )
+ // create library link
+ xDlgLib.set( xDlgLibContainer->createLibraryLink( aLibName, aDlgStorageURL, true ), UNO_QUERY);
+ }
+ else
{
- // load library
- if ( !xDlgLibContImport->isLibraryLoaded( aLibName ) )
- xDlgLibContImport->loadLibrary( aLibName );
-
- // copy all dialogs
- Sequence< OUString > aDlgNames = xDlgLibImport->getElementNames();
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const OUString* pDlgNames = aDlgNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
+ // create library
+ xDlgLib = xDlgLibContainer->createLibrary( aLibName );
+ if ( xDlgLib.is() )
{
- OUString aDlgName( pDlgNames[ i ] );
- Any aElement_ = xDlgLibImport->getByName( aDlgName );
- xDlgLib->insertByName( aDlgName, aElement_ );
+ // get import library
+ Reference< container::XNameContainer > xDlgLibImport;
+ Any aElement = xDlgLibContImport->getByName( aLibName );
+ aElement >>= xDlgLibImport;
+
+ if ( xDlgLibImport.is() )
+ {
+ // load library
+ if ( !xDlgLibContImport->isLibraryLoaded( aLibName ) )
+ xDlgLibContImport->loadLibrary( aLibName );
+
+ // copy all dialogs
+ Sequence< OUString > aDlgNames = xDlgLibImport->getElementNames();
+ sal_Int32 nDlgCount = aDlgNames.getLength();
+ const OUString* pDlgNames = aDlgNames.getConstArray();
+ for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
+ {
+ OUString aDlgName( pDlgNames[ i ] );
+ Any aElement_ = xDlgLibImport->getByName( aDlgName );
+ xDlgLib->insertByName( aDlgName, aElement_ );
+ }
+ }
}
}
}
+
+ // insert listbox entry
+ ImpInsertLibEntry( aLibName, m_pLibBox->GetEntryCount() );
+ bChanges = true;
}
}
- // insert listbox entry
- ImpInsertLibEntry( aLibName, m_pLibBox->GetEntryCount() );
- bChanges = true;
- }
- }
+ SvTreeListEntry* pFirstNew = m_pLibBox->GetEntry( nNewPos );
+ if ( pFirstNew )
+ m_pLibBox->SetCurEntry( pFirstNew );
- SvTreeListEntry* pFirstNew = m_pLibBox->GetEntry( nNewPos );
- if ( pFirstNew )
- m_pLibBox->SetCurEntry( pFirstNew );
-
- if ( bChanges )
- MarkDocumentModified( m_aCurDocument );
+ if ( bChanges )
+ MarkDocumentModified( m_aCurDocument );
+ });
}
void LibPage::Export()