[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - cui/source cui/uiconfig include/svx svx/source vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 29 12:31:02 UTC 2018


 cui/source/dialogs/cuigaldlg.cxx         |  204 +++++++++++--------------------
 cui/source/factory/dlgfact.cxx           |    6 
 cui/source/factory/dlgfact.hxx           |    2 
 cui/source/inc/cuigaldlg.hxx             |   67 ++++------
 cui/uiconfig/ui/galleryapplyprogress.ui  |    8 -
 cui/uiconfig/ui/gallerysearchprogress.ui |    8 -
 cui/uiconfig/ui/gallerythemedialog.ui    |   24 +--
 include/svx/svxdlg.hxx                   |    2 
 svx/source/gallery2/galbrws1.cxx         |    2 
 vcl/unx/gtk3/gtk3gtkinst.cxx             |   21 ++-
 10 files changed, 151 insertions(+), 193 deletions(-)

New commits:
commit 6c2962b48e183c0a5008f439104db5e9b5810b5c
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Nov 28 19:56:26 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Nov 29 13:30:37 2018 +0100

    weld GalleryThemeProperties
    
    Change-Id: I88fbb9ab03f0026ffe0c5fe79ab0a386160738a1
    Reviewed-on: https://gerrit.libreoffice.org/64220
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index f2eeb836e15c..e9a12d98582a 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -63,13 +63,13 @@ using namespace ::com::sun::star::ui::dialogs;
 using namespace ::com::sun::star::uno;
 
 
-SearchThread::SearchThread( SearchProgress* pProgress,
-                            TPGalleryThemeProperties* pBrowser,
-                            const INetURLObject& rStartURL ) :
-        Thread      ( "cuiSearchThread" ),
-        mpProgress  ( pProgress ),
-        mpBrowser   ( pBrowser ),
-        maStartURL  ( rStartURL )
+SearchThread::SearchThread(SearchProgress* pProgress,
+                           TPGalleryThemeProperties* pBrowser,
+                           const INetURLObject& rStartURL)
+    : Thread("cuiSearchThread")
+    , mpProgress(pProgress)
+    , mpBrowser(pBrowser)
+    , maStartURL(rStartURL)
 {
 }
 
@@ -101,7 +101,7 @@ void SearchThread::execute()
         ImplSearch( maStartURL, aFormats, mpBrowser->bSearchRecursive );
     }
 
-    Application::PostUserEvent( LINK( mpProgress, SearchProgress, CleanUpHdl ), nullptr, true );
+    Application::PostUserEvent(LINK(mpProgress, SearchProgress, CleanUpHdl));
 }
 
 
@@ -113,7 +113,6 @@ void SearchThread::ImplSearch( const INetURLObject& rStartURL,
         SolarMutexGuard aGuard;
 
         mpProgress->SetDirectory( rStartURL );
-        mpProgress->Flush();
     }
 
     try
@@ -189,68 +188,43 @@ void SearchThread::ImplSearch( const INetURLObject& rStartURL,
     }
 }
 
-
-SearchProgress::SearchProgress( vcl::Window* pParent, const INetURLObject& rStartURL )
-    : ModalDialog(pParent, "GallerySearchProgress", "cui/ui/gallerysearchprogress.ui")
-    , parent_(pParent)
+SearchProgress::SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, const INetURLObject& rStartURL)
+    : GenericDialogController(pParent, "cui/ui/gallerysearchprogress.ui", "GallerySearchProgress")
     , startUrl_(rStartURL)
+    , m_xTabPage(pTabPage)
+    , m_xFtSearchDir(m_xBuilder->weld_label("dir"))
+    , m_xFtSearchType(m_xBuilder->weld_label("file"))
+    , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
 {
-    get(m_pFtSearchDir, "dir");
-    get(m_pFtSearchType, "file");
-    m_pFtSearchType->set_width_request(m_pFtSearchType->get_preferred_size().Width());
-    get(m_pBtnCancel, "cancel");
-    m_pBtnCancel->SetClickHdl( LINK( this, SearchProgress, ClickCancelBtn ) );
+    m_xFtSearchType->set_size_request(m_xFtSearchType->get_preferred_size().Width(), -1);
+    m_xBtnCancel->connect_clicked(LINK(this, SearchProgress, ClickCancelBtn));
 }
 
-
 SearchProgress::~SearchProgress()
 {
-    disposeOnce();
-}
-
-
-void SearchProgress::dispose()
-{
-    m_pFtSearchDir.clear();
-    m_pFtSearchType.clear();
-    m_pBtnCancel.clear();
-    parent_.clear();
-    ModalDialog::dispose();
 }
 
-
-IMPL_LINK_NOARG(SearchProgress, ClickCancelBtn, Button*, void)
+IMPL_LINK_NOARG(SearchProgress, ClickCancelBtn, weld::Button&, void)
 {
-    if (maSearchThread.is())
-        maSearchThread->terminate();
+    if (m_aSearchThread.is())
+        m_aSearchThread->terminate();
 }
 
-
 IMPL_LINK_NOARG(SearchProgress, CleanUpHdl, void*, void)
 {
-    if (maSearchThread.is())
-        maSearchThread->join();
+    if (m_aSearchThread.is())
+        m_aSearchThread->join();
 
-    EndDialog( RET_OK );
+    m_xDialog->response(RET_OK);
 
-    disposeOnce();
+    m_xDialog.reset();
 }
 
-short SearchProgress::Execute()
+void SearchProgress::LaunchThread()
 {
-    OSL_FAIL( "SearchProgress cannot be executed via Dialog::Execute!\n"
-               "It creates a thread that will call back to VCL apartment => deadlock!\n"
-               "Use Dialog::StartExecuteModal to execute the dialog!" );
-    return RET_CANCEL;
-}
-
-bool SearchProgress::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
-{
-    assert(!maSearchThread.is());
-    maSearchThread = new SearchThread(
-        this, static_cast< TPGalleryThemeProperties * >(parent_.get()), startUrl_);
-    maSearchThread->launch();
-    return ModalDialog::StartExecuteAsync(rCtx);
+    assert(!m_aSearchThread.is());
+    m_aSearchThread = new SearchThread(this, m_xTabPage, startUrl_);
+    m_aSearchThread->launch();
 }
 
 TakeThread::TakeThread(
@@ -304,7 +278,6 @@ void TakeThread::execute()
 
             mpProgress->SetFile( aURL );
             pStatusProgress->Update( i, nEntries - 1 );
-            mpProgress->Flush();
             pThm->InsertURL( aURL );
         }
     }
@@ -320,34 +293,22 @@ void TakeThread::execute()
 }
 
 
-TakeProgress::TakeProgress(vcl::Window* pWindow)
-    : ModalDialog(pWindow, "GalleryApplyProgress",
-        "cui/ui/galleryapplyprogress.ui")
-    , window_(pWindow)
+TakeProgress::TakeProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage)
+    : GenericDialogController(pParent, "cui/ui/galleryapplyprogress.ui",
+                              "GalleryApplyProgress")
+    , m_pParent(pParent)
+    , m_xTabPage(pTabPage)
+    , m_xFtTakeFile(m_xBuilder->weld_label("file"))
+    , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
 {
-    get(m_pFtTakeFile, "file");
-    get(m_pBtnCancel, "cancel");
-
-    m_pBtnCancel->SetClickHdl( LINK( this, TakeProgress, ClickCancelBtn ) );
+    m_xBtnCancel->connect_clicked(LINK(this, TakeProgress, ClickCancelBtn));
 }
 
-
 TakeProgress::~TakeProgress()
 {
-    disposeOnce();
-}
-
-
-void TakeProgress::dispose()
-{
-    m_pFtTakeFile.clear();
-    m_pBtnCancel.clear();
-    window_.clear();
-    ModalDialog::dispose();
 }
 
-
-IMPL_LINK_NOARG(TakeProgress, ClickCancelBtn, Button*, void)
+IMPL_LINK_NOARG(TakeProgress, ClickCancelBtn, weld::Button&, void)
 {
     if (maTakeThread.is())
         maTakeThread->terminate();
@@ -359,14 +320,14 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl, void*, void)
     if (maTakeThread.is())
         maTakeThread->join();
 
-    TPGalleryThemeProperties*   pBrowser = static_cast<TPGalleryThemeProperties*>( GetParent() );
-    std::vector<bool, std::allocator<bool> > aRemoveEntries( pBrowser->aFoundList.size(), false );
+    std::vector<bool, std::allocator<bool> > aRemoveEntries(m_xTabPage->aFoundList.size(), false);
     std::vector< OUString >   aRemainingVector;
     sal_uInt32                  i, nCount;
 
-    GetParent()->EnterWait();
-    pBrowser->m_xLbxFound->select(-1);
-    pBrowser->m_xLbxFound->freeze();
+    std::unique_ptr<weld::WaitObject> xWait(new weld::WaitObject(m_pParent));
+
+    m_xTabPage->m_xLbxFound->select(-1);
+    m_xTabPage->m_xLbxFound->freeze();
 
     // mark all taken positions in aRemoveEntries
     for( i = 0, nCount = maTakenList.size(); i < nCount; ++i )
@@ -376,50 +337,41 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl, void*, void)
     // refill found list
     for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i )
         if( !aRemoveEntries[ i ] )
-            aRemainingVector.push_back( pBrowser->aFoundList[i] );
+            aRemainingVector.push_back( m_xTabPage->aFoundList[i] );
 
-    pBrowser->aFoundList.clear();
+    m_xTabPage->aFoundList.clear();
 
     for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
-        pBrowser->aFoundList.push_back( aRemainingVector[ i ] );
+        m_xTabPage->aFoundList.push_back( aRemainingVector[ i ] );
 
     aRemainingVector.clear();
 
     // refill list box
     for( i = 0, nCount = aRemoveEntries.size(); i < nCount; ++i )
         if( !aRemoveEntries[ i ] )
-            aRemainingVector.push_back(pBrowser->m_xLbxFound->get_text(i));
+            aRemainingVector.push_back(m_xTabPage->m_xLbxFound->get_text(i));
 
-    pBrowser->m_xLbxFound->clear();
+    m_xTabPage->m_xLbxFound->clear();
 
     for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
-        pBrowser->m_xLbxFound->append_text(aRemainingVector[i]);
+        m_xTabPage->m_xLbxFound->append_text(aRemainingVector[i]);
 
     aRemainingVector.clear();
 
-    pBrowser->m_xLbxFound->thaw();
-    pBrowser->SelectFoundHdl( *pBrowser->m_xLbxFound );
-    GetParent()->LeaveWait();
+    m_xTabPage->m_xLbxFound->thaw();
+    m_xTabPage->SelectFoundHdl( *m_xTabPage->m_xLbxFound );
 
-    EndDialog( RET_OK );
-    disposeOnce();
-}
+    xWait.reset();
 
-short TakeProgress::Execute()
-{
-    OSL_FAIL( "TakeProgress cannot be executed via Dialog::Execute!\n"
-               "It creates a thread that will call back to VCL apartment => deadlock!\n"
-               "Use Dialog::StartExecuteModal to execute the dialog!" );
-    return RET_CANCEL;
+    m_xDialog->response(RET_OK);
+    m_xDialog.reset();
 }
 
-bool TakeProgress::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx)
+void TakeProgress::LaunchThread()
 {
     assert(!maTakeThread.is());
-    maTakeThread = new TakeThread(
-        this, static_cast< TPGalleryThemeProperties * >(window_.get()), maTakenList);
+    maTakeThread = new TakeThread(this, m_xTabPage, maTakenList);
     maTakeThread->launch();
-    return ModalDialog::StartExecuteAsync(rCtx);
 }
 
 ActualizeProgress::ActualizeProgress(vcl::Window* pWindow, GalleryTheme* pThm)
@@ -555,30 +507,28 @@ IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl, weld::Button&, void)
         m_xDialog->response(RET_OK);
 }
 
-GalleryThemeProperties::GalleryThemeProperties(vcl::Window* pParent,
+GalleryThemeProperties::GalleryThemeProperties(weld::Window* pParent,
     ExchangeData* _pData, SfxItemSet const * pItemSet)
-    : SfxTabDialog( pParent, "GalleryThemeDialog",
-        "cui/ui/gallerythemedialog.ui", pItemSet)
+    : SfxTabDialogController(pParent, "cui/ui/gallerythemedialog.ui",
+                             "GalleryThemeDialog", pItemSet)
     , pData(_pData)
-    , m_nGeneralPageId(0)
 {
-    m_nGeneralPageId = AddTabPage("general", TPGalleryThemeGeneral::Create, nullptr);
-    sal_uInt16 nFilesPageId = AddTabPage("files", TPGalleryThemeProperties::Create, nullptr);
-
-    if( pData->pTheme->IsReadOnly() )
-        RemoveTabPage(nFilesPageId);
+    AddTabPage("general", TPGalleryThemeGeneral::Create, nullptr);
+    AddTabPage("files", TPGalleryThemeProperties::Create, nullptr);
+    if (pData->pTheme->IsReadOnly())
+        RemoveTabPage("files");
 
-    OUString aText = GetText().replaceFirst( "%1",  pData->pTheme->GetName() );
+    OUString aText = m_xDialog->get_title().replaceFirst( "%1",  pData->pTheme->GetName() );
 
-    if( pData->pTheme->IsReadOnly() )
+    if (pData->pTheme->IsReadOnly())
         aText +=  " " + CuiResId( RID_SVXSTR_GALLERY_READONLY );
 
-    SetText( aText );
+    m_xDialog->set_title(aText);
 }
 
-void GalleryThemeProperties::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
+void GalleryThemeProperties::PageCreated(const OString& rId, SfxTabPage &rPage)
 {
-    if (nId == m_nGeneralPageId)
+    if (rId == "general")
         static_cast<TPGalleryThemeGeneral&>( rPage ).SetXChgData( pData );
     else
         static_cast<TPGalleryThemeProperties&>( rPage ).SetXChgData( pData );
@@ -872,7 +822,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFileTypeHdl, weld::ComboBox&, vo
     {
         aLastFilterName = aText;
 
-        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/queryupdategalleryfilelistdialog.ui"));
+        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDialogFrameWeld(), "cui/ui/queryupdategalleryfilelistdialog.ui"));
         std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryUpdateFileListDialog"));
         if (xQuery->run() == RET_YES)
             SearchFiles();
@@ -881,16 +831,16 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFileTypeHdl, weld::ComboBox&, vo
 
 void TPGalleryThemeProperties::SearchFiles()
 {
-    VclPtrInstance<SearchProgress> pProgress( this, aURL );
+    std::shared_ptr<SearchProgress> xProgress(new SearchProgress(GetDialogFrameWeld(), this, aURL));
 
     aFoundList.clear();
     m_xLbxFound->clear();
 
-    pProgress->SetFileType( m_xCbbFileType->get_active_text() );
-    pProgress->SetDirectory( INetURLObject() );
-    pProgress->Update();
+    xProgress->SetFileType( m_xCbbFileType->get_active_text() );
+    xProgress->SetDirectory( INetURLObject() );
 
-    pProgress->StartExecuteAsync([=](sal_Int32 nResult){
+    xProgress->LaunchThread();
+    weld::DialogController::runAsync(xProgress, [=](sal_Int32 nResult) {
         EndSearchProgressHdl(nResult);
     });
 }
@@ -934,13 +884,13 @@ void TPGalleryThemeProperties::TakeFiles()
 {
     if (m_xLbxFound->count_selected_rows() || (bTakeAll && bEntriesFound))
     {
-        VclPtrInstance<TakeProgress> pTakeProgress( this );
-        pTakeProgress->Update();
-
-        pTakeProgress->StartExecuteAsync([=](sal_Int32 /*nResult*/){
+        std::shared_ptr<TakeProgress> xTakeProgress(new TakeProgress(GetDialogFrameWeld(), this));
+        xTakeProgress->LaunchThread();
+        weld::DialogController::runAsync(xTakeProgress, [=](sal_Int32 /*nResult*/) {
             /* no postprocessing needed, pTakeProgress
                will be disposed in TakeProgress::CleanupHdl */
         });
+
     }
 }
 
@@ -999,7 +949,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickTakeHdl, weld::Button&, void)
 
         if (!m_xLbxFound->count_selected_rows() || !bEntriesFound)
         {
-            SvxOpenGraphicDialog aDlg("Gallery", GetFrameWeld());
+            SvxOpenGraphicDialog aDlg("Gallery", GetDialogFrameWeld());
             aDlg.EnableLink(false);
             aDlg.AsLink(false);
 
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index f2f09863a5c4..d1fa040adece 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -1118,12 +1118,12 @@ VclPtr<AbstractGalleryIdDialog> AbstractDialogFactory_Impl::CreateGalleryIdDialo
    return VclPtr<AbstractGalleryIdDialog_Impl>::Create(o3tl::make_unique<GalleryIdDialog>(pParent, pThm));
 }
 
-VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog(vcl::Window* pParent,
+VclPtr<VclAbstractDialog> AbstractDialogFactory_Impl::CreateGalleryThemePropertiesDialog(weld::Window* pParent,
                                             ExchangeData* pData,
                                             SfxItemSet* pItemSet)
 {
-    VclPtrInstance<GalleryThemeProperties> pDlg(pParent, pData, pItemSet);
-    return VclPtr<CuiVclAbstractDialog_Impl>::Create( pDlg );
+    return VclPtr<CuiAbstractTabController_Impl>::Create(o3tl::make_unique<GalleryThemeProperties>(
+                                                         pParent, pData, pItemSet));
 }
 
 VclPtr<AbstractURLDlg> AbstractDialogFactory_Impl::CreateURLDialog( vcl::Window* pParent,
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 0b1436f3c4d7..e672ea16ef5b 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -741,7 +741,7 @@ public:
     virtual VclPtr<AbstractTitleDialog> CreateTitleDialog(weld::Window* pParent, const OUString& rOldText) override;
     virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent,
                                             GalleryTheme* pThm) override;
-    virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(vcl::Window* pParent,
+    virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Window* pParent,
                                             ExchangeData* pData,
                                             SfxItemSet* pItemSet) override;
     virtual VclPtr<AbstractURLDlg> CreateURLDialog( vcl::Window* pParent,
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index a6085e86e07b..cc959a38d2c8 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -59,7 +59,7 @@ class SearchThread: public salhelper::Thread
 {
 private:
 
-    VclPtr<SearchProgress>             mpProgress;
+    SearchProgress* mpProgress;
     VclPtr<TPGalleryThemeProperties>   mpBrowser;
     INetURLObject               maStartURL;
 
@@ -72,42 +72,39 @@ private:
 
 public:
 
-                                SearchThread( SearchProgress* pProgress,
-                                              TPGalleryThemeProperties* pBrowser,
-                                              const INetURLObject& rStartURL );
+                                SearchThread(SearchProgress* pProgress,
+                                             TPGalleryThemeProperties* pBrowser,
+                                             const INetURLObject& rStartURL);
 };
 
-class SearchProgress : public ModalDialog
+class SearchProgress : public weld::GenericDialogController
 {
 private:
-    VclPtr<FixedText>          m_pFtSearchDir;
-    VclPtr<FixedText>          m_pFtSearchType;
-    VclPtr<CancelButton>       m_pBtnCancel;
-    VclPtr<vcl::Window>        parent_;
     INetURLObject startUrl_;
-    rtl::Reference< SearchThread > maSearchThread;
+    VclPtr<TPGalleryThemeProperties> m_xTabPage;
+    rtl::Reference< SearchThread > m_aSearchThread;
+    std::unique_ptr<weld::Label> m_xFtSearchDir;
+    std::unique_ptr<weld::Label> m_xFtSearchType;
+    std::unique_ptr<weld::Button> m_xBtnCancel;
 
-                        DECL_LINK( ClickCancelBtn, Button*, void );
+    DECL_LINK(ClickCancelBtn, weld::Button&, void);
 
 public:
-                        SearchProgress( vcl::Window* pParent, const INetURLObject& rStartURL );
-    virtual             ~SearchProgress() override;
-    virtual void        dispose() override;
+    SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, const INetURLObject& rStartURL);
+    void LaunchThread();
+    virtual ~SearchProgress() override;
 
-                        DECL_LINK( CleanUpHdl, void*, void );
+    DECL_LINK( CleanUpHdl, void*, void );
 
-    virtual short       Execute() override;
-    using ModalDialog::StartExecuteAsync;
-    virtual bool        StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
-    void                SetFileType( const OUString& rType ) { m_pFtSearchType->SetText( rType ); }
-    void                SetDirectory( const INetURLObject& rURL ) { m_pFtSearchDir->SetText( GetReducedString( rURL, 30 ) ); }
+    void                SetFileType( const OUString& rType ) { m_xFtSearchType->set_label(rType); }
+    void                SetDirectory( const INetURLObject& rURL ) { m_xFtSearchDir->set_label(GetReducedString(rURL, 30)); }
 };
 
 class TakeThread: public salhelper::Thread
 {
 private:
 
-    VclPtr<TakeProgress>               mpProgress;
+    TakeProgress* mpProgress;
     VclPtr<TPGalleryThemeProperties>   mpBrowser;
     TokenList_impl&             mrTakenList;
 
@@ -123,29 +120,27 @@ public:
                                 );
 };
 
-class TakeProgress : public ModalDialog
+class TakeProgress : public weld::GenericDialogController
 {
 private:
-    VclPtr<FixedText>          m_pFtTakeFile;
-    VclPtr<CancelButton>       m_pBtnCancel;
-    VclPtr<vcl::Window>        window_;
+    weld::Window* m_pParent;
+    VclPtr<TPGalleryThemeProperties> m_xTabPage;
     rtl::Reference< TakeThread > maTakeThread;
     TokenList_impl      maTakenList;
+    std::unique_ptr<weld::Label> m_xFtTakeFile;
+    std::unique_ptr<weld::Button> m_xBtnCancel;
 
-    DECL_LINK( ClickCancelBtn, Button*, void );
+    DECL_LINK(ClickCancelBtn, weld::Button&, void);
 
 public:
 
-    TakeProgress( vcl::Window* pWindow );
+    TakeProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage);
+    void LaunchThread();
     virtual ~TakeProgress() override;
-    virtual void dispose() override;
 
     DECL_LINK( CleanUpHdl, void*, void );
 
-    void                SetFile( const INetURLObject& rURL ) { m_pFtTakeFile->SetText( GetReducedString( rURL, 30 ) ); }
-    virtual short       Execute() override;
-    using ModalDialog::StartExecuteAsync;
-    virtual bool        StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) override;
+    void                SetFile( const INetURLObject& rURL ) { m_xFtTakeFile->set_label(GetReducedString(rURL, 30)); }
 };
 
 class ActualizeProgress : public ModalDialog
@@ -193,16 +188,14 @@ public:
     sal_uInt32 GetId() const { return m_xLbResName->get_active(); }
 };
 
-class GalleryThemeProperties : public SfxTabDialog
+class GalleryThemeProperties : public SfxTabDialogController
 {
     ExchangeData*   pData;
 
-    sal_uInt16 m_nGeneralPageId;
-
-    virtual void PageCreated(sal_uInt16 nId, SfxTabPage &rPage) override;
+    virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override;
 
 public:
-    GalleryThemeProperties(vcl::Window* pParent, ExchangeData* pData, SfxItemSet const * pItemSet);
+    GalleryThemeProperties(weld::Window* pParent, ExchangeData* pData, SfxItemSet const * pItemSet);
 };
 
 class TPGalleryThemeGeneral : public SfxTabPage
diff --git a/cui/uiconfig/ui/galleryapplyprogress.ui b/cui/uiconfig/ui/galleryapplyprogress.ui
index 1d06c779a043..df93be3b2f57 100644
--- a/cui/uiconfig/ui/galleryapplyprogress.ui
+++ b/cui/uiconfig/ui/galleryapplyprogress.ui
@@ -1,12 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="GalleryApplyProgress">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="galleryapplyprogress|GalleryApplyProgress">Apply</property>
+    <property name="modal">True</property>
     <property name="type_hint">normal</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -80,8 +84,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
           </object>
diff --git a/cui/uiconfig/ui/gallerysearchprogress.ui b/cui/uiconfig/ui/gallerysearchprogress.ui
index 9acdafcdc4f8..37ea5ba0bc60 100644
--- a/cui/uiconfig/ui/gallerysearchprogress.ui
+++ b/cui/uiconfig/ui/gallerysearchprogress.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="GallerySearchProgress">
@@ -7,7 +7,11 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="gallerysearchprogress|GallerySearchProgress">Find</property>
     <property name="resizable">False</property>
+    <property name="modal">True</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -62,11 +66,11 @@
                       <object class="GtkLabel" id="file">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="ellipsize">end</property>
                         <property name="width_chars">40</property>
                         <property name="single_line_mode">True</property>
                         <property name="max_width_chars">40</property>
+                        <property name="xalign">0</property>
                       </object>
                     </child>
                   </object>
diff --git a/cui/uiconfig/ui/gallerythemedialog.ui b/cui/uiconfig/ui/gallerythemedialog.ui
index 35e86c9a6ee5..993300859180 100644
--- a/cui/uiconfig/ui/gallerythemedialog.ui
+++ b/cui/uiconfig/ui/gallerythemedialog.ui
@@ -21,12 +21,10 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="ok">
-                <property name="label">gtk-ok</property>
+              <object class="GtkButton" id="reset">
+                <property name="label">gtk-revert-to-saved</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
               </object>
@@ -37,10 +35,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="cancel">
-                <property name="label">gtk-cancel</property>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
               </object>
@@ -51,8 +51,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="help">
-                <property name="label">gtk-help</property>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -62,12 +62,11 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">2</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="reset">
-                <property name="label">gtk-revert-to-saved</property>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -77,6 +76,7 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">3</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -195,10 +195,10 @@
       </object>
     </child>
     <action-widgets>
+      <action-widget response="101">reset</action-widget>
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
-      <action-widget response="0">reset</action-widget>
     </action-widgets>
   </object>
 </interface>
diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx
index 5ff7187537d7..d81be92eb1b7 100644
--- a/include/svx/svxdlg.hxx
+++ b/include/svx/svxdlg.hxx
@@ -359,7 +359,7 @@ public:
                                              const OUString& rOldText) = 0;
     virtual VclPtr<AbstractGalleryIdDialog> CreateGalleryIdDialog(weld::Window* pParent,
                                             GalleryTheme* pThm) = 0;
-    virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(vcl::Window* pParent,
+    virtual VclPtr<VclAbstractDialog> CreateGalleryThemePropertiesDialog(weld::Window* pParent,
                                             ExchangeData* pData,
                                             SfxItemSet* pItemSet ) = 0;
     virtual VclPtr<AbstractURLDlg> CreateURLDialog( vcl::Window* pParent,
diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index e5349d31e02a..8da52c30d499 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -264,7 +264,7 @@ void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, b
     ImplFillExchangeData( pTheme, *mpExchangeData );
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-    mpThemePropertiesDialog = pFact->CreateGalleryThemePropertiesDialog(this, mpExchangeData.get(), mpThemePropsDlgItemSet.get());
+    mpThemePropertiesDialog = pFact->CreateGalleryThemePropertiesDialog(GetFrameWeld(), mpExchangeData.get(), mpThemePropsDlgItemSet.get());
 
     if ( bCreateNew )
     {
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 286206f7c4a5..e04c6e66a829 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4637,13 +4637,22 @@ public:
     {
         assert(gtk_tree_view_get_model(m_pTreeView) && "don't request selection when frozen");
         int nRet = -1;
-        GtkTreeIter iter;
-        GtkTreeModel* pModel;
-        if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(m_pTreeView), &pModel, &iter))
+        GtkTreeSelection *selection = gtk_tree_view_get_selection(m_pTreeView);
+        if (gtk_tree_selection_get_mode(selection) != GTK_SELECTION_MULTIPLE)
         {
-            GtkTreePath* path = gtk_tree_model_get_path(pModel, &iter);
-            nRet = gtk_tree_path_get_indices(path)[0];
-            gtk_tree_path_free(path);
+            GtkTreeIter iter;
+            GtkTreeModel* pModel;
+            if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(m_pTreeView), &pModel, &iter))
+            {
+                GtkTreePath* path = gtk_tree_model_get_path(pModel, &iter);
+                nRet = gtk_tree_path_get_indices(path)[0];
+                gtk_tree_path_free(path);
+            }
+        }
+        else
+        {
+            auto vec = get_selected_rows();
+            return vec.empty() ? -1 : vec[0];
         }
         return nRet;
     }


More information about the Libreoffice-commits mailing list