[Libreoffice-commits] core.git: basctl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Dec 30 07:47:47 UTC 2018


 basctl/source/basicide/basides1.cxx |    9 
 basctl/source/basicide/basobj2.cxx  |    2 
 basctl/source/basicide/macrodlg.cxx |   23 +-
 basctl/source/basicide/moduldl2.cxx |  391 ++++++++++++++++++------------------
 basctl/source/dlged/managelang.cxx  |   28 +-
 5 files changed, 230 insertions(+), 223 deletions(-)

New commits:
commit 99cecd1f12a1d17822b9b29ceb112c0c48945386
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Dec 29 13:26:25 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Dec 30 08:47:26 2018 +0100

    use StartExecuteAsync in basctl
    
    Change-Id: Id24d03631ff60305525835144ad543d5dcb2064f
    Reviewed-on: https://gerrit.libreoffice.org/65709
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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()
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 2339b5573e2c..94481c672664 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -145,19 +145,21 @@ void ManageLanguageDialog::ClearLanguageBox()
 
 IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl, Button*, void)
 {
-    ScopedVclPtrInstance< SetDefaultLanguageDialog > aDlg( this, m_xLocalizationMgr );
-    if ( aDlg->Execute() == RET_OK )
-    {
-        // add new locales
-        Sequence< Locale > aLocaleSeq = aDlg->GetLocales();
-        m_xLocalizationMgr->handleAddLocales( aLocaleSeq );
-        // update listbox
-        ClearLanguageBox();
-        FillLanguageBox();
-
-        if (SfxBindings* pBindings = GetBindingsPtr())
-            pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
-    }
+    VclPtr< SetDefaultLanguageDialog > pDlg = VclPtr<SetDefaultLanguageDialog>::Create(this, m_xLocalizationMgr);
+    pDlg->StartExecuteAsync([pDlg,this](sal_Int32 nResult)
+        {
+            if (!nResult )
+                return;
+            // add new locales
+            Sequence< Locale > aLocaleSeq = pDlg->GetLocales();
+            m_xLocalizationMgr->handleAddLocales( aLocaleSeq );
+            // update listbox
+            ClearLanguageBox();
+            FillLanguageBox();
+
+            if (SfxBindings* pBindings = GetBindingsPtr())
+                pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
+        });
 }
 
 IMPL_LINK_NOARG(ManageLanguageDialog, DeleteHdl, Button*, void)


More information about the Libreoffice-commits mailing list