[Libreoffice-commits] core.git: include/sfx2 include/vcl sfx2/source sw/inc sw/source sw/uiconfig vcl/inc vcl/qt5 vcl/source vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 2 15:52:11 UTC 2018


 include/sfx2/basedlgs.hxx                    |   43 +----
 include/sfx2/childwin.hxx                    |    8 -
 include/vcl/dialog.hxx                       |    7 
 include/vcl/weld.hxx                         |    6 
 sfx2/source/appl/childwin.cxx                |   73 ++-------
 sfx2/source/appl/workwin.cxx                 |   85 +----------
 sfx2/source/dialog/basedlgs.cxx              |  126 ----------------
 sfx2/source/inc/workwin.hxx                  |   11 -
 sw/inc/swabstdlg.hxx                         |    4 
 sw/inc/viewsh.hxx                            |   14 -
 sw/source/core/view/viewsh.cxx               |   30 +--
 sw/source/ui/dialog/swdlgfact.cxx            |   19 +-
 sw/source/ui/dialog/swdlgfact.hxx            |   17 --
 sw/source/ui/dialog/wordcountdialog.cxx      |  114 +++++++++------
 sw/source/uibase/dialog/wordcountwrapper.cxx |   10 -
 sw/source/uibase/inc/wordcountdialog.hxx     |   41 +++--
 sw/source/uibase/uiview/viewport.cxx         |    4 
 sw/uiconfig/swriter/ui/wordcount.ui          |    8 -
 vcl/inc/qt5/Qt5Frame.hxx                     |    1 
 vcl/inc/salframe.hxx                         |    5 
 vcl/inc/unx/gtk/gtkframe.hxx                 |    1 
 vcl/inc/window.h                             |    4 
 vcl/qt5/Qt5Frame.cxx                         |    2 
 vcl/source/app/salvtables.cxx                |   43 -----
 vcl/source/window/builder.cxx                |   14 -
 vcl/source/window/dialog.cxx                 |  203 +++++++++++----------------
 vcl/source/window/syswin.cxx                 |    4 
 vcl/unx/gtk3/gtk3gtkframe.cxx                |    7 
 vcl/unx/gtk3/gtk3gtkinst.cxx                 |  101 -------------
 29 files changed, 285 insertions(+), 720 deletions(-)

New commits:
commit 4b0db40ab4a05a0940096654e8d60ed04f0cd2e6
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Nov 2 15:38:46 2018 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Nov 2 16:51:29 2018 +0100

    Revert "weld SwWordCountFloatDlg"
    
    This reverts commit 26c375671aa362b2f59d84645784938677ae1719.
    Conflicts:
            vcl/qt5/Qt5Frame.cxx
    
    It caused null pointer dereference during UITest_writer_tests, as seen at
    <https://ci.libreoffice.org//job/lo_ubsan/1090/>:
    
    > /sfx2/source/appl/childwin.cxx:654:18: runtime error: member call on null pointer of type 'vcl::Window'
    >     #0 0x2b97d4160fa3 in SfxChildWindow::SetWorkWindow_Impl(SfxWorkWindow*) /sfx2/source/appl/childwin.cxx:654:18
    >     #1 0x2b97d462ab86 in SfxWorkWindow::CreateChildWin_Impl(SfxChildWin_Impl*, bool) /sfx2/source/appl/workwin.cxx:1350:9
    >     #2 0x2b97d463e6bb in SfxWorkWindow::ToggleChildWindow_Impl(unsigned short, bool) /sfx2/source/appl/workwin.cxx:1837:21
    >     #3 0x2b97d6eae94d in SfxViewFrame::ToggleChildWindow(unsigned short) /sfx2/source/view/viewfrm.cxx:3080:9
    >     #4 0x2b987664316d in SwView::UpdateWordCount(SfxShell*, unsigned short) /sw/source/uibase/uiview/view1.cxx:212:9
    >     #5 0x2b9876126a5d in SwTextShell::Execute(SfxRequest&) /sw/source/uibase/shells/textsh1.cxx:1369:9
    >     #6 0x2b98760a2391 in SfxStubSwTextShellExecute(SfxShell*, SfxRequest&) /workdir/SdiTarget/sw/sdi/swslots.hxx:2974:1
    >     #7 0x2b97d49050f6 in SfxShell::CallExec(void (*)(SfxShell*, SfxRequest&), SfxRequest&) /include/sfx2/shell.hxx:207:35
    >     #8 0x2b97d48c27d0 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:353:13
    >     #9 0x2b97d48de12d in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:854:9
    >     #10 0x2b97d482ea34 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) /sfx2/source/control/bindings.cxx:1063:9
    >     #11 0x2b97d4e5cead in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:754:29
    >     #12 0x2b97d4e60b5e in SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:239:9
    >     #13 0x2b97c6c10b19 in comphelper::dispatchCommand(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /comphelper/source/misc/dispatchcommand.cxx:60:9
    >     #14 0x2b980472020c in UITest::executeCommand(rtl::OUString const&) /vcl/source/uitest/uitest.cxx:22:12
    [...]
    
    Change-Id: I276684a5617bfec3803b195af59c51735bfa470a

diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx
index 703998b3644a..79092bb744c5 100644
--- a/include/sfx2/basedlgs.hxx
+++ b/include/sfx2/basedlgs.hxx
@@ -107,41 +107,6 @@ public:
     DECL_LINK(TimerHdl, Timer *, void);
 };
 
-class SFX2_DLLPUBLIC SfxDialogController : public weld::GenericDialogController
-{
-private:
-    DECL_DLLPRIVATE_LINK(InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*);
-public:
-    SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OString& rDialogId);
-};
-
-class SfxModelessDialog_Impl;
-class SFX2_DLLPUBLIC SfxModelessDialogController : public SfxDialogController
-{
-    SfxBindings* m_pBindings;
-    std::unique_ptr<SfxModelessDialog_Impl> m_xImpl;
-
-    SfxModelessDialogController(SfxModelessDialogController&) = delete;
-    void operator =(SfxModelessDialogController&) = delete;
-
-    void Init(SfxBindings *pBindinx, SfxChildWindow *pCW);
-
-    DECL_DLLPRIVATE_LINK(FocusInHdl, weld::Widget&, void);
-    DECL_DLLPRIVATE_LINK(FocusOutHdl, weld::Widget&, void);
-protected:
-    SfxModelessDialogController(SfxBindings*, SfxChildWindow* pChildWin,
-        weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID);
-    virtual ~SfxModelessDialogController() override;
-
-public:
-    virtual void            FillInfo(SfxChildWinInfo&) const;
-    void                    Initialize (SfxChildWinInfo const * pInfo);
-    void                    Close();
-    void                    DeInit();
-    void                    EndDialog();
-    SfxBindings&            GetBindings() { return *m_pBindings; }
-};
-
 // class SfxFloatingWindow --------------------------------------------------
 class SfxFloatingWindow_Impl;
 class SFX2_DLLPUBLIC SfxFloatingWindow: public FloatingWindow
@@ -223,6 +188,14 @@ private:
     std::unique_ptr<SingleTabDlgImpl>   pImpl;
 };
 
+class SFX2_DLLPUBLIC SfxDialogController : public weld::GenericDialogController
+{
+private:
+    DECL_DLLPRIVATE_LINK(InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*);
+public:
+    SfxDialogController(weld::Widget* pParent, const OUString& rUIFile, const OString& rDialogId);
+};
+
 class SFX2_DLLPUBLIC SfxSingleTabDialogController : public SfxDialogController
 {
 private:
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx
index 9a12bf896071..8c46889e533f 100644
--- a/include/sfx2/childwin.hxx
+++ b/include/sfx2/childwin.hxx
@@ -143,10 +143,9 @@ public:
 
 class SFX2_DLLPUBLIC SfxChildWindow
 {
-    VclPtr<vcl::Window>        pParent;         // parent window ( Topwindow )
-    sal_uInt16 const           nType;           // ChildWindow-Id
+    VclPtr<vcl::Window>        pParent;        // parent window ( Topwindow )
+    sal_uInt16 const           nType;          // ChildWindow-Id
     VclPtr<vcl::Window>        pWindow;         // actual contents
-    std::shared_ptr<SfxModelessDialogController> xController;     // actual contents
     SfxChildAlignment          eChildAlignment; // Current css::drawing::Alignment
     std::unique_ptr< SfxChildWindow_Impl>       pImpl;            // Implementation data
     std::unique_ptr<SfxChildWindowContext>      pContext;        // With context-sensitive ChildWindows:
@@ -162,9 +161,6 @@ public:
     void                Destroy();
     vcl::Window*        GetWindow() const
                         { return pWindow; }
-    void                SetController(std::shared_ptr<SfxModelessDialogController> controller) { xController = controller; }
-    void                ClearController() { xController.reset(); }
-    std::shared_ptr<SfxModelessDialogController>& GetController() { return xController; }
     vcl::Window*        GetParent() const
                         { return pParent; }
     SfxChildAlignment   GetAlignment() const
diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx
index b6d7bbdb110e..c5a3997566ff 100644
--- a/include/vcl/dialog.hxx
+++ b/include/vcl/dialog.hxx
@@ -139,7 +139,7 @@ public:
     virtual FactoryFunction GetUITestFactory() const override;
 
 private:
-    bool            ImplStartExecute();
+    bool            ImplStartExecuteModal();
     static void     ImplEndExecuteModal();
     void            ImplSetModalInputMode(bool bModal);
 public:
@@ -174,9 +174,6 @@ public:
     void            GrabFocusToFirstControl();
     virtual void    Resize() override;
 
-    void            Activate() override;
-
-
     void            SetInstallLOKNotifierHdl(const Link<void*, vcl::ILibreOfficeKitNotifier*>& rLink);
 
     void            add_button(PushButton* pButton, int nResponse, bool bTransferOwnership);
@@ -191,6 +188,8 @@ class VCL_DLLPUBLIC ModelessDialog : public Dialog
 
 public:
     explicit        ModelessDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription, Dialog::InitFlag eFlag = Dialog::InitFlag::Default );
+
+    void            Activate() override;
 };
 
 class VCL_DLLPUBLIC ModalDialog : public Dialog
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index fdb0cba3379e..7fcd7b884a52 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -196,14 +196,8 @@ public:
     virtual void set_busy_cursor(bool bBusy) = 0;
     virtual void window_move(int x, int y) = 0;
     virtual void set_modal(bool bModal) = 0;
-    virtual bool get_modal() const = 0;
     virtual bool get_extents_relative_to(Window& rRelative, int& x, int& y, int& width, int& height)
         = 0;
-    virtual bool get_resizable() const = 0;
-    virtual Size get_size() const = 0;
-    virtual Point get_position() const = 0;
-    virtual void set_window_state(const OString& rStr) = 0;
-    virtual OString get_window_state(WindowStateMask nMask) const = 0;
 
     virtual css::uno::Reference<css::awt::XWindow> GetXWindow() = 0;
 
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index e2bbc3ee9e7f..aa8018eb0ed4 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -194,10 +194,7 @@ SfxChildWindow::~SfxChildWindow()
 {
     pContext.reset();
     ClearWorkwin();
-    if (xController)
-        xController->DeInit();
-    else
-        pWindow.disposeAndClear();
+    pWindow.disposeAndClear();
 }
 
 
@@ -273,7 +270,7 @@ SfxChildWindow* SfxChildWindow::CreateChildWindow( sal_uInt16 nId,
 
     DBG_ASSERT(pFact && (pChild || !rInfo.bVisible), "ChildWindow-Typ not registered!");
 
-    if (pChild && (!pChild->pWindow && !pChild->xController))
+    if ( pChild && !pChild->pWindow )
     {
         DELETEZ(pChild);
         SAL_INFO("sfx.appl", "ChildWindow has no Window!");
@@ -322,38 +319,26 @@ void SfxChildWindow::SetAlignment(SfxChildAlignment eAlign)
 
 SfxChildWinInfo SfxChildWindow::GetInfo() const
 {
+
     SfxChildWinInfo aInfo(pImpl->pFact->aInfo);
-    if (xController)
+    aInfo.aPos  = pWindow->GetPosPixel();
+    aInfo.aSize = pWindow->GetSizePixel();
+    if ( pWindow->IsSystemWindow() )
     {
-        weld::Dialog* pDialog = xController->getDialog();
-        aInfo.aPos  = pDialog->get_position();
-        aInfo.aSize = pDialog->get_size();
         WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
-        if (pDialog->get_resizable())
-            nMask |= (WindowStateMask::Width | WindowStateMask::Height);
-        aInfo.aWinState = pDialog->get_window_state(nMask);
+        if ( pWindow->GetStyle() & WB_SIZEABLE )
+            nMask |= ( WindowStateMask::Width | WindowStateMask::Height );
+        aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask );
     }
-    else if (pWindow)
+    else if (DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow.get()))
     {
-        aInfo.aPos  = pWindow->GetPosPixel();
-        aInfo.aSize = pWindow->GetSizePixel();
-        if ( pWindow->IsSystemWindow() )
+        if (pDockingWindow->GetFloatingWindow())
+            aInfo.aWinState = pDockingWindow->GetFloatingWindow()->GetWindowState();
+        else if (SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(pDockingWindow))
         {
-            WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
-            if ( pWindow->GetStyle() & WB_SIZEABLE )
-                nMask |= ( WindowStateMask::Width | WindowStateMask::Height );
-            aInfo.aWinState = static_cast<SystemWindow*>(pWindow.get())->GetWindowState( nMask );
-        }
-        else if (DockingWindow* pDockingWindow = dynamic_cast<DockingWindow*>(pWindow.get()))
-        {
-            if (pDockingWindow->GetFloatingWindow())
-                aInfo.aWinState = pDockingWindow->GetFloatingWindow()->GetWindowState();
-            else if (SfxDockingWindow* pSfxDockingWindow = dynamic_cast<SfxDockingWindow*>(pDockingWindow))
-            {
-                SfxChildWinInfo aTmpInfo;
-                pSfxDockingWindow->FillInfo( aTmpInfo );
-                aInfo.aExtraString = aTmpInfo.aExtraString;
-            }
+            SfxChildWinInfo aTmpInfo;
+            pSfxDockingWindow->FillInfo( aTmpInfo );
+            aInfo.aExtraString = aTmpInfo.aExtraString;
         }
     }
 
@@ -623,24 +608,12 @@ void SfxChildWindow::SetVisible_Impl( bool bVis )
 
 void SfxChildWindow::Hide()
 {
-    if (xController)
-        xController->EndDialog();
-    else
-        pWindow->Hide();
+    pWindow->Hide();
 }
 
 void SfxChildWindow::Show( ShowFlags nFlags )
 {
-    if (xController)
-    {
-        if (!xController->getDialog()->get_visible())
-        {
-            weld::DialogController::runAsync(xController,
-                [=](sal_Int32 /*nResult*/){ xController->Close(); });
-        }
-    }
-    else
-        pWindow->Show(true, nFlags);
+    pWindow->Show(true, nFlags);
 }
 
 vcl::Window* SfxChildWindow::GetContextWindow( SfxModule const *pModule ) const
@@ -673,15 +646,7 @@ bool SfxChildWindow::QueryClose()
     }
 
     if ( bAllow )
-    {
-        if (GetController())
-        {
-            weld::Dialog* pDialog = GetController()->getDialog();
-            bAllow = !pDialog->get_visible() || !pDialog->get_modal();
-        }
-        else if (GetWindow())
-            bAllow = !GetWindow()->IsInModalMode();
-    }
+        bAllow = !GetWindow()->IsInModalMode();
 
     return bAllow;
 }
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 69e29d2e6d83..363b3005d1f9 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -864,6 +864,7 @@ bool SfxWorkWindow::PrepareClose_Impl()
     return true;
 }
 
+
 SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( vcl::Window& rWindow,
                     SfxChildAlignment eAlign )
 {
@@ -884,19 +885,6 @@ SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl( vcl::Window& rWindow,
     return aChildren.back();
 }
 
-SfxChild_Impl* SfxWorkWindow::RegisterChild_Impl(std::shared_ptr<SfxModelessDialogController>& rController,
-                    SfxChildAlignment eAlign )
-{
-    DBG_ASSERT( aChildren.size() < 255, "too many children" );
-    DBG_ASSERT( SfxChildAlignValid(eAlign), "invalid align" );
-
-    SfxChild_Impl *pChild = new SfxChild_Impl(rController, eAlign);
-
-    aChildren.push_back(pChild);
-    bSorted = false;
-    nChildren++;
-    return aChildren.back();
-}
 
 void SfxWorkWindow::ReleaseChild_Impl( vcl::Window& rWindow )
 {
@@ -922,29 +910,6 @@ void SfxWorkWindow::ReleaseChild_Impl( vcl::Window& rWindow )
     }
 }
 
-void SfxWorkWindow::ReleaseChild_Impl(SfxModelessDialogController& rController)
-{
-
-    SfxChild_Impl *pChild = nullptr;
-    decltype(aChildren)::size_type nPos;
-    for ( nPos = 0; nPos < aChildren.size(); ++nPos )
-    {
-        pChild = aChildren[nPos];
-        if (pChild && pChild->xController.get() == &rController)
-            break;
-    }
-
-    if ( nPos < aChildren.size() )
-    {
-        bSorted = false;
-        nChildren--;
-        aChildren.erase(aChildren.begin() + nPos);
-        delete pChild;
-    }
-    else {
-        OSL_FAIL( "releasing unregistered child" );
-    }
-}
 
 SfxChild_Impl* SfxWorkWindow::FindChild_Impl( const vcl::Window& rWindow ) const
 {
@@ -968,10 +933,8 @@ void SfxWorkWindow::ShowChildren_Impl()
 
     for (SfxChild_Impl* pCli : aChildren)
     {
-        if (!pCli)
-            continue;
         SfxChildWin_Impl* pCW = nullptr;
-        if (pCli->pWin || pCli->xController)
+        if ( pCli && pCli->pWin )
         {
             // We have to find the SfxChildWin_Impl to retrieve the
             // SFX_CHILDWIN flags that can influence visibility.
@@ -998,27 +961,12 @@ void SfxWorkWindow::ShowChildren_Impl()
             if ( SfxChildVisibility::VISIBLE == (pCli->nVisible & SfxChildVisibility::VISIBLE) && bVisible )
             {
                 ShowFlags nFlags = pCli->bSetFocus ? ShowFlags::NONE : ShowFlags::NoFocusChange | ShowFlags::NoActivate;
-                if (pCli->xController)
-                {
-                    if (!pCli->xController->getDialog()->get_visible())
-                    {
-                        weld::DialogController::runAsync(pCli->xController,
-                            [=](sal_Int32 /*nResult*/){ pCli->xController->Close(); });
-                    }
-                }
-                else
-                    pCli->pWin->Show(true, nFlags);
+                pCli->pWin->Show(true, nFlags);
                 pCli->bSetFocus = false;
             }
             else
             {
-                if (pCli->xController)
-                {
-                    if (pCli->xController->getDialog()->get_visible())
-                        pCli->xController->response(RET_CLOSE);
-                }
-                else
-                    pCli->pWin->Hide();
+                pCli->pWin->Hide();
             }
         }
     }
@@ -1030,15 +978,12 @@ void SfxWorkWindow::HideChildren_Impl()
     for ( sal_uInt16 nPos = aChildren.size(); nPos > 0; --nPos )
     {
         SfxChild_Impl *pChild = aChildren[nPos-1];
-        if (!pChild)
-            continue;
-        if (pChild->xController)
-            pChild->xController->response(RET_CLOSE);
-        else if (pChild->pWin)
+        if (pChild && pChild->pWin)
             pChild->pWin->Hide();
     }
 }
 
+
 void SfxWorkWindow::ResetObjectBars_Impl()
 {
     for ( auto & n: aObjBarList )
@@ -1379,10 +1324,7 @@ void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl *pCW, bool bSetFocus )
         {
             // The window is not docked or docked outside of one split windows
             // and must therefore be registered explicitly as a Child
-            if (pChildWin->GetController())
-                pCW->pCli = RegisterChild_Impl(pChildWin->GetController(), pChildWin->GetAlignment());
-            else
-                pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment());
+            pCW->pCli = RegisterChild_Impl(*(pChildWin->GetWindow()), pChildWin->GetAlignment());
             pCW->pCli->nVisible = SfxChildVisibility::VISIBLE;
             if ( pChildWin->GetAlignment() != SfxChildAlignment::NOALIGNMENT && bIsFullScreen )
                 pCW->pCli->nVisible ^= SfxChildVisibility::ACTIVE;
@@ -1421,10 +1363,7 @@ void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl *pCW )
         // Child window is a direct child window and must therefore unregister
         // itself from the  WorkWindow
         pCW->pCli = nullptr;
-        if (pChildWin->GetController())
-            ReleaseChild_Impl(*pChildWin->GetController());
-        else
-            ReleaseChild_Impl(*pChildWin->GetWindow());
+        ReleaseChild_Impl(*pChildWin->GetWindow());
     }
     else
     {
@@ -2443,12 +2382,8 @@ void SfxWorkWindow::DataChanged_Impl()
     for (n=0; n<nCount; n++)
     {
         SfxChildWin_Impl*pCW = aChildWins[n].get();
-        if (pCW && pCW->pWin)
-        {
-            // TODO does this really have any meaning ?
-            if (pCW->pWin->GetWindow())
-                pCW->pWin->GetWindow()->UpdateSettings(Application::GetSettings());
-        }
+        if ( pCW && pCW->pWin )
+            pCW->pWin->GetWindow()->UpdateSettings( Application::GetSettings() );
     }
 
     ArrangeChildren_Impl();
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 8fcb0cb1137f..f4a07696af43 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -56,7 +56,6 @@ public:
     OString aWinState;
     SfxChildWindow* pMgr;
     bool            bConstructed;
-    bool            bClosing;
     void            Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
 
     Idle            aMoveIdle;
@@ -285,7 +284,6 @@ void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
     pImpl.reset(new SfxModelessDialog_Impl);
     pImpl->pMgr = pCW;
     pImpl->bConstructed = false;
-    pImpl->bClosing = false;
     if ( pBindinx )
         pImpl->StartListening( *pBindinx );
     pImpl->aMoveIdle.SetPriority(TaskPriority::RESIZE);
@@ -384,129 +382,6 @@ void SfxModelessDialog::FillInfo(SfxChildWinInfo& rInfo) const
         rInfo.nFlags |= SfxChildWindowFlags::ZOOMIN;
 }
 
-void SfxModelessDialogController::Initialize(SfxChildWinInfo const *pInfo)
-
-/*  [Description]
-
-    Initialization of the class SfxModelessDialog via a SfxChildWinInfo.
-    The initialization is done only in a 2nd step after the constructor, this
-    constructor should be called from the derived class or from the
-    SfxChildWindows.
-*/
-
-{
-    if (!pInfo)
-        return;
-    m_xImpl->aWinState = pInfo->aWinState;
-    if (m_xImpl->aWinState.isEmpty())
-        return;
-    m_xDialog->set_window_state(m_xImpl->aWinState);
-}
-
-SfxModelessDialogController::SfxModelessDialogController(SfxBindings* pBindinx,
-    SfxChildWindow *pCW, weld::Window *pParent, const OUString& rUIXMLDescription,
-    const OString& rID)
-    : SfxDialogController(pParent, rUIXMLDescription, rID)
-{
-    Init(pBindinx, pCW);
-    m_xDialog->connect_focus_in(LINK(this, SfxModelessDialogController, FocusInHdl));
-    m_xDialog->connect_focus_out(LINK(this, SfxModelessDialogController, FocusOutHdl));
-}
-
-void SfxModelessDialogController::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
-{
-    m_pBindings = pBindinx;
-    m_xImpl.reset(new SfxModelessDialog_Impl);
-    m_xImpl->pMgr = pCW;
-    m_xImpl->bConstructed = true;
-    m_xImpl->bClosing = false;
-    if (pBindinx)
-        m_xImpl->StartListening( *pBindinx );
-}
-
-void SfxModelessDialogController::DeInit()
-{
-    if (m_xImpl->pMgr)
-    {
-        WindowStateMask nMask = WindowStateMask::Pos | WindowStateMask::State;
-        if (m_xDialog->get_resizable())
-            nMask |= ( WindowStateMask::Width | WindowStateMask::Height );
-        m_xImpl->aWinState = m_xDialog->get_window_state(nMask);
-        GetBindings().GetWorkWindow_Impl()->ConfigChild_Impl( SfxChildIdentifier::DOCKINGWINDOW, SfxDockingConfig::ALIGNDOCKINGWINDOW, m_xImpl->pMgr->GetType() );
-    }
-
-    m_xImpl->pMgr = nullptr;
-}
-
-/*  [Description]
-
-    If a ModelessDialog is enabled its ViewFrame will be activated.
-    This is necessary by PluginInFrames.
-*/
-IMPL_LINK_NOARG(SfxModelessDialogController, FocusInHdl, weld::Widget&, void)
-{
-    if (!m_xImpl)
-        return;
-    m_pBindings->SetActiveFrame(m_xImpl->pMgr->GetFrame());
-    m_xImpl->pMgr->Activate_Impl();
-}
-
-IMPL_LINK_NOARG(SfxModelessDialogController, FocusOutHdl, weld::Widget&, void)
-{
-    if (!m_xImpl)
-        return;
-    m_pBindings->SetActiveFrame(css::uno::Reference< css::frame::XFrame>());
-}
-
-SfxModelessDialogController::~SfxModelessDialogController()
-{
-    if (!m_xImpl->pMgr)
-        return;
-    auto xFrame = m_xImpl->pMgr->GetFrame();
-    if (!xFrame)
-        return;
-    if (xFrame == m_pBindings->GetActiveFrame())
-        m_pBindings->SetActiveFrame(nullptr);
-}
-
-void SfxModelessDialogController::EndDialog()
-{
-    if (!m_xDialog->get_visible())
-        return;
-    m_xImpl->bClosing = true;
-    response(RET_CLOSE);
-    m_xImpl->bClosing = false;
-}
-
-/*  [Description]
-
-    The window is closed when the ChildWindow is destroyed by running the
-    ChildWindow-slots.
-*/
-void SfxModelessDialogController::Close()
-{
-    if (m_xImpl->bClosing)
-        return;
-    // Execute with Parameters, since Toggle is ignored by some ChildWindows.
-    SfxBoolItem aValue(m_xImpl->pMgr->GetType(), false);
-    m_pBindings->GetDispatcher_Impl()->ExecuteList(
-        m_xImpl->pMgr->GetType(),
-        SfxCallMode::RECORD|SfxCallMode::SYNCHRON, { &aValue } );
-}
-
-/*  [Description]
-
-    Fills a SfxChildWinInfo with specific data from SfxModelessDialog,
-    so that it can be written in the INI file. It is assumed that rinfo
-    receives all other possible relevant data in the ChildWindow class.
-    ModelessDialogs have no specific information, so that the base
-    implementation does nothing and therefore must not be called.
-*/
-void SfxModelessDialogController::FillInfo(SfxChildWinInfo& rInfo) const
-{
-    rInfo.aSize = m_xDialog->get_size();
-}
-
 bool SfxFloatingWindow::EventNotify( NotifyEvent& rEvt )
 
 /*  [Description]
@@ -881,6 +756,7 @@ void SfxSingleTabDialogController::SetTabPage(SfxTabPage* pTabPage)
         aUserItem >>= sUserData;
         m_xSfxPage->SetUserData(sUserData);
         m_xSfxPage->Reset(GetInputItemSet());
+//TODO        m_xSfxPage->Show();
 
         m_xHelpBtn->show(Help::IsContextHelpEnabled());
 
diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx
index 38c41653dfdb..7b37d065afa4 100644
--- a/sfx2/source/inc/workwin.hxx
+++ b/sfx2/source/inc/workwin.hxx
@@ -84,7 +84,6 @@ namespace o3tl
 struct SfxChild_Impl
 {
     VclPtr<vcl::Window>             pWin;
-    std::shared_ptr<SfxModelessDialogController> xController;
     Size                            aSize;
     SfxChildAlignment               eAlign;
     SfxChildVisibility              nVisible;
@@ -98,14 +97,6 @@ struct SfxChild_Impl
     {
         nVisible = bIsVisible ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE;
     }
-
-    SfxChild_Impl(std::shared_ptr<SfxModelessDialogController>& rChild,
-                  SfxChildAlignment eAlignment):
-        pWin(nullptr), xController(rChild), eAlign(eAlignment), bResize(false),
-        bSetFocus( false )
-    {
-        nVisible = xController->getDialog()->get_visible() ? SfxChildVisibility::VISIBLE : SfxChildVisibility::NOT_VISIBLE;
-    }
 };
 
 struct SfxChildWin_Impl
@@ -248,9 +239,7 @@ public:
     // Methods for all Child windows
     void                    DataChanged_Impl();
     void                    ReleaseChild_Impl( vcl::Window& rWindow );
-    void                    ReleaseChild_Impl(SfxModelessDialogController&);
     SfxChild_Impl*          RegisterChild_Impl( vcl::Window& rWindow, SfxChildAlignment eAlign );
-    SfxChild_Impl*          RegisterChild_Impl(std::shared_ptr<SfxModelessDialogController>& rController, SfxChildAlignment eAlign);
     void                    ShowChildren_Impl();
     void                    HideChildren_Impl();
     bool                    PrepareClose_Impl();
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 99d55a84dfb5..642218f530d8 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -200,7 +200,7 @@ protected:
 public:
     virtual void        UpdateCounts() = 0;
     virtual void        SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat) = 0;
-    virtual std::shared_ptr<SfxModelessDialogController> GetController() = 0;
+    virtual vcl::Window *    GetWindow() = 0; //this method is added for return a Window type pointer
 };
 
 class AbstractSwInsertAbstractDlg : public VclAbstractDialog
@@ -364,7 +364,7 @@ public:
     virtual VclPtr<SfxAbstractDialog> CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) = 0;
 
     virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings,
-        SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) = 0;
+        SfxChildWindow* pChild, vcl::Window *pParent, SfxChildWinInfo* pInfo) = 0;
 
     virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() = 0;
     virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) = 0;
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index fe904ffcd36e..db92346bc587 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -170,7 +170,7 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell>
 protected:
     static ShellResource*      mpShellRes;      ///< Resources for the Shell.
     static vcl::DeleteOnDeinit< VclPtr<vcl::Window> > mpCareWindow;    ///< Avoid this window.
-    static vcl::DeleteOnDeinit< std::shared_ptr<weld::Window> > mpCareDialog;    ///< Avoid this window.
+    static vcl::DeleteOnDeinit< std::shared_ptr<weld::Dialog> > mpCareDialog;    ///< Avoid this window.
 
     SwRect                  maVisArea;       ///< The modern version of VisArea.
     rtl::Reference<SwDoc>   mxDoc;          ///< The document; never 0.
@@ -432,12 +432,12 @@ public:
     static ShellResource* GetShellRes();
 
     static void           SetCareWin( vcl::Window* pNew );
-    static vcl::Window*   GetCareWin()
-                          { return (*mpCareWindow.get()) ? mpCareWindow.get()->get() : nullptr; }
-    static weld::Window*   CareChildWin(SwViewShell const & rVSh);
-    static void           SetCareDialog(const std::shared_ptr<weld::Window>& rNew);
-    static weld::Window*  GetCareDialog(SwViewShell const & rVSh)
-                          { return (*mpCareDialog.get()) ? mpCareDialog.get()->get() : CareChildWin(rVSh); }
+    static vcl::Window*   GetCareWin(SwViewShell const & rVSh)
+                          { return (*mpCareWindow.get()) ? mpCareWindow.get()->get() : CareChildWin(rVSh); }
+    static vcl::Window*   CareChildWin(SwViewShell const & rVSh);
+    static void           SetCareDialog(const std::shared_ptr<weld::Dialog>& rNew);
+    static weld::Dialog*  GetCareDialog()
+                          { return (*mpCareDialog.get()) ? mpCareDialog.get()->get() : nullptr; }
 
     SfxViewShell   *GetSfxViewShell() const { return mpSfxViewShell; }
     void           SetSfxViewShell(SfxViewShell *pNew) { mpSfxViewShell = pNew; }
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 4f38a4d4041e..23ef8f436318 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -93,7 +93,7 @@
 bool SwViewShell::mbLstAct = false;
 ShellResource *SwViewShell::mpShellRes = nullptr;
 vcl::DeleteOnDeinit< VclPtr<vcl::Window> > SwViewShell::mpCareWindow(new VclPtr<vcl::Window>);
-vcl::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::mpCareDialog(new std::shared_ptr<weld::Window>);
+vcl::DeleteOnDeinit<std::shared_ptr<weld::Dialog>> SwViewShell::mpCareDialog(new std::shared_ptr<weld::Dialog>);
 
 static bool bInSizeNotify = false;
 
@@ -581,7 +581,7 @@ const SwRect& SwViewShell::VisArea() const
 
 void SwViewShell::MakeVisible( const SwRect &rRect )
 {
-    if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin() || GetCareDialog(*this) )
+    if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin(*this) || GetCareDialog() )
     {
         if ( !IsViewLocked() )
         {
@@ -609,23 +609,19 @@ void SwViewShell::MakeVisible( const SwRect &rRect )
     }
 }
 
-weld::Window* SwViewShell::CareChildWin(SwViewShell const & rVSh)
+vcl::Window* SwViewShell::CareChildWin(SwViewShell const & rVSh)
 {
-    if (!rVSh.mpSfxViewShell)
-        return nullptr;
+    if(rVSh.mpSfxViewShell)
+    {
 #if HAVE_FEATURE_DESKTOP
-    const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
-    SfxViewFrame* pVFrame = rVSh.mpSfxViewShell->GetViewFrame();
-    SfxChildWindow* pChWin = pVFrame->GetChildWindow( nId );
-    if (!pChWin)
-        return nullptr;
-    weld::DialogController* pController = pChWin->GetController().get();
-    if (!pController)
-        return nullptr;
-    weld::Window* pWin = pController->getDialog();
-    if (pWin && pWin->get_visible())
-        return pWin;
+        const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
+        SfxViewFrame* pVFrame = rVSh.mpSfxViewShell->GetViewFrame();
+        const SfxChildWindow* pChWin = pVFrame->GetChildWindow( nId );
+        vcl::Window *pWin = pChWin ? pChWin->GetWindow() : nullptr;
+        if ( pWin && pWin->IsVisible() )
+            return pWin;
 #endif
+    }
     return nullptr;
 }
 
@@ -2507,7 +2503,7 @@ void SwViewShell::SetCareWin( vcl::Window* pNew )
     (*mpCareWindow.get()) = pNew;
 }
 
-void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew)
+void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Dialog>& rNew)
 {
     (*mpCareDialog.get()) = rNew;
 }
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index b634d18970d2..c30b671d3b29 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -87,11 +87,7 @@ using namespace ::com::sun::star;
 using namespace css::frame;
 using namespace css::uno;
 
-short AbstractSwWordCountFloatDlg_Impl::Execute()
-{
-    return m_xDlg->run();
-}
-
+IMPL_ABSTDLG_BASE(AbstractSwWordCountFloatDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl);
 IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl);
 
@@ -699,19 +695,19 @@ vcl::Window* AbstractAuthMarkFloatDlg_Impl::GetWindow()
     return static_cast<vcl::Window*>(pDlg);
 }
 
-std::shared_ptr<SfxModelessDialogController> AbstractSwWordCountFloatDlg_Impl::GetController()
+vcl::Window* AbstractSwWordCountFloatDlg_Impl::GetWindow()
 {
-    return m_xDlg;
+    return static_cast<vcl::Window*>(pDlg);
 }
 
 void AbstractSwWordCountFloatDlg_Impl::UpdateCounts()
 {
-    m_xDlg->UpdateCounts();
+    pDlg->UpdateCounts();
 }
 
 void AbstractSwWordCountFloatDlg_Impl::SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat)
 {
-    m_xDlg->SetCounts(rCurrCnt, rDocStat);
+    pDlg->SetCounts(rCurrCnt, rDocStat);
 }
 
 AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl()
@@ -1113,10 +1109,11 @@ VclPtr<AbstractMarkFloatDlg> SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDl
 VclPtr<AbstractSwWordCountFloatDlg> SwAbstractDialogFactory_Impl::CreateSwWordCountDialog(
                                                                               SfxBindings* pBindings,
                                                                               SfxChildWindow* pChild,
-                                                                              weld::Window *pParent,
+                                                                              vcl::Window *pParent,
                                                                               SfxChildWinInfo* pInfo)
 {
-    return VclPtr<AbstractSwWordCountFloatDlg_Impl>::Create(o3tl::make_unique<SwWordCountFloatDlg>(pBindings, pChild, pParent, pInfo));
+    VclPtr<SwWordCountFloatDlg> pDlg = VclPtr<SwWordCountFloatDlg>::Create( pBindings, pChild, pParent, pInfo );
+    return VclPtr<AbstractSwWordCountFloatDlg_Impl>::Create( pDlg );
 }
 
 VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg(
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 14b802ef7e2d..103b04b35a02 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -74,17 +74,10 @@ bool Class::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) \
 class SwWordCountFloatDlg;
 class AbstractSwWordCountFloatDlg_Impl : public AbstractSwWordCountFloatDlg
 {
-protected:
-    std::shared_ptr<SwWordCountFloatDlg> m_xDlg;
-public:
-    explicit AbstractSwWordCountFloatDlg_Impl(std::unique_ptr<SwWordCountFloatDlg> p)
-        : m_xDlg(std::move(p))
-    {
-    }
-    virtual short Execute() override;
-    virtual void  UpdateCounts() override;
-    virtual void  SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat) override;
-    virtual std::shared_ptr<SfxModelessDialogController> GetController() override;
+    DECL_ABSTDLG_BASE(AbstractSwWordCountFloatDlg_Impl,SwWordCountFloatDlg)
+    virtual void                UpdateCounts() override;
+    virtual void                SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat) override;
+    virtual vcl::Window *            GetWindow() override; //this method is added for return a Window type pointer
 };
 
 class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg
@@ -603,7 +596,7 @@ public:
     virtual VclPtr<SfxAbstractDialog> CreateSwDropCapsDialog(weld::Window* pParent, const SfxItemSet& rSet) override;
     virtual VclPtr<SfxAbstractDialog> CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) override;
     virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings,
-        SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) override;
+        SfxChildWindow* pChild, vcl::Window *pParent, SfxChildWinInfo* pInfo) override;
     virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() override;
     virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) override;
     virtual VclPtr<AbstractSwAsciiFilterDlg>  CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh,
diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx
index b24767823963..cc350e6fb9c8 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -31,92 +31,126 @@
 #include <unotools/localedatawrapper.hxx>
 #include <vcl/settings.hxx>
 
+IMPL_STATIC_LINK_NOARG(SwWordCountFloatDlg, CloseHdl, Button*, void)
+{
+    SfxViewFrame* pVFrame = ::GetActiveView()->GetViewFrame();
+    if (pVFrame != nullptr)
+    {
+        pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
+    }
+}
+
 SwWordCountFloatDlg::~SwWordCountFloatDlg()
 {
+    disposeOnce();
+}
+
+void SwWordCountFloatDlg::dispose()
+{
     SwViewShell::SetCareWin( nullptr );
+    m_pCurrentWordFT.clear();
+    m_pCurrentCharacterFT.clear();
+    m_pCurrentCharacterExcludingSpacesFT.clear();
+    m_pCurrentCjkcharsFT.clear();
+    m_pCurrentStandardizedPagesFT.clear();
+    m_pDocWordFT.clear();
+    m_pDocCharacterFT.clear();
+    m_pDocCharacterExcludingSpacesFT.clear();
+    m_pDocCjkcharsFT.clear();
+    m_pDocStandardizedPagesFT.clear();
+    m_pCjkcharsLabelFT.clear();
+    m_pStandardizedPagesLabelFT.clear();
+    m_pClosePB.clear();
+    SfxModelessDialog::dispose();
 }
 
 namespace
 {
-    void setValue(weld::Label& rWidget, sal_uLong nValue, const LocaleDataWrapper& rLocaleData)
+    void setValue(FixedText *pWidget, sal_uLong nValue, const LocaleDataWrapper& rLocaleData)
     {
-        rWidget.set_label(rLocaleData.getNum(nValue, 0));
+        pWidget->SetText(rLocaleData.getNum(nValue, 0));
     }
 
-    void setDoubleValue(weld::Label& rWidget, double fValue)
+    void setDoubleValue(FixedText *pWidget, double fValue)
     {
         OUString sValue(OUString::number(::rtl::math::round(fValue, 1)));
-        rWidget.set_label(sValue);
+        pWidget->SetText(sValue);
     }
 }
 
 void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
 {
-    const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper();
-    setValue(*m_xCurrentWordFT, rCurrent.nWord, rLocaleData);
-    setValue(*m_xCurrentCharacterFT, rCurrent.nChar, rLocaleData);
-    setValue(*m_xCurrentCharacterExcludingSpacesFT, rCurrent.nCharExcludingSpaces, rLocaleData);
-    setValue(*m_xCurrentCjkcharsFT, rCurrent.nAsianWord, rLocaleData);
-    setValue(*m_xDocWordFT, rDoc.nWord, rLocaleData);
-    setValue(*m_xDocCharacterFT, rDoc.nChar, rLocaleData);
-    setValue(*m_xDocCharacterExcludingSpacesFT, rDoc.nCharExcludingSpaces, rLocaleData);
-    setValue(*m_xDocCjkcharsFT, rDoc.nAsianWord, rLocaleData);
-
-    if (m_xStandardizedPagesLabelFT->get_visible())
+    const LocaleDataWrapper& rLocaleData = GetSettings().GetUILocaleDataWrapper();
+    setValue(m_pCurrentWordFT, rCurrent.nWord, rLocaleData);
+    setValue(m_pCurrentCharacterFT, rCurrent.nChar, rLocaleData);
+    setValue(m_pCurrentCharacterExcludingSpacesFT, rCurrent.nCharExcludingSpaces, rLocaleData);
+    setValue(m_pCurrentCjkcharsFT, rCurrent.nAsianWord, rLocaleData);
+    setValue(m_pDocWordFT, rDoc.nWord, rLocaleData);
+    setValue(m_pDocCharacterFT, rDoc.nChar, rLocaleData);
+    setValue(m_pDocCharacterExcludingSpacesFT, rDoc.nCharExcludingSpaces, rLocaleData);
+    setValue(m_pDocCjkcharsFT, rDoc.nAsianWord, rLocaleData);
+
+    if (m_pStandardizedPagesLabelFT->IsVisible())
     {
         sal_Int64 nCharsPerStandardizedPage = officecfg::Office::Writer::WordCount::StandardizedPageSize::get();
-        setDoubleValue(*m_xCurrentStandardizedPagesFT,
+        setDoubleValue(m_pCurrentStandardizedPagesFT,
             static_cast<double>(rCurrent.nChar) / nCharsPerStandardizedPage);
-        setDoubleValue(*m_xDocStandardizedPagesFT,
+        setDoubleValue(m_pDocStandardizedPagesFT,
             static_cast<double>(rDoc.nChar) / nCharsPerStandardizedPage);
     }
 
     bool bShowCJK = (SvtCJKOptions().IsAnyEnabled() || rDoc.nAsianWord);
-    bool bToggleCJK = m_xCurrentCjkcharsFT->get_visible() != bShowCJK;
+    bool bToggleCJK = m_pCurrentCjkcharsFT->IsVisible() != bShowCJK;
     if (bToggleCJK)
     {
         showCJK(bShowCJK);
-        m_xDialog->resize_to_request(); //force resize of dialog
+        setOptimalLayoutSize(); //force resize of dialog
     }
 }
 
 void SwWordCountFloatDlg::showCJK(bool bShowCJK)
 {
-    m_xCurrentCjkcharsFT->show(bShowCJK);
-    m_xDocCjkcharsFT->show(bShowCJK);
-    m_xCjkcharsLabelFT->show(bShowCJK);
+    m_pCurrentCjkcharsFT->Show(bShowCJK);
+    m_pDocCjkcharsFT->Show(bShowCJK);
+    m_pCjkcharsLabelFT->Show(bShowCJK);
 }
 
 void SwWordCountFloatDlg::showStandardizedPages(bool bShowStandardizedPages)
 {
-    m_xCurrentStandardizedPagesFT->show(bShowStandardizedPages);
-    m_xDocStandardizedPagesFT->show(bShowStandardizedPages);
-    m_xStandardizedPagesLabelFT->show(bShowStandardizedPages);
+    m_pCurrentStandardizedPagesFT->Show(bShowStandardizedPages);
+    m_pDocStandardizedPagesFT->Show(bShowStandardizedPages);
+    m_pStandardizedPagesLabelFT->Show(bShowStandardizedPages);
 }
 
 SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* _pBindings,
                                          SfxChildWindow* pChild,
-                                         weld::Window *pParent,
+                                         vcl::Window *pParent,
                                          SfxChildWinInfo const * pInfo)
-    : SfxModelessDialogController(_pBindings, pChild, pParent, "modules/swriter/ui/wordcount.ui", "WordCountDialog")
-    , m_xCurrentWordFT(m_xBuilder->weld_label("selectwords"))
-    , m_xCurrentCharacterFT(m_xBuilder->weld_label("selectchars"))
-    , m_xCurrentCharacterExcludingSpacesFT(m_xBuilder->weld_label("selectcharsnospaces"))
-    , m_xCurrentCjkcharsFT(m_xBuilder->weld_label("selectcjkchars"))
-    , m_xCurrentStandardizedPagesFT(m_xBuilder->weld_label("selectstandardizedpages"))
-    , m_xDocWordFT(m_xBuilder->weld_label("docwords"))
-    , m_xDocCharacterFT(m_xBuilder->weld_label("docchars"))
-    , m_xDocCharacterExcludingSpacesFT(m_xBuilder->weld_label("doccharsnospaces"))
-    , m_xDocCjkcharsFT(m_xBuilder->weld_label("doccjkchars"))
-    , m_xDocStandardizedPagesFT(m_xBuilder->weld_label("docstandardizedpages"))
-    , m_xCjkcharsLabelFT(m_xBuilder->weld_label("cjkcharsft"))
-    , m_xStandardizedPagesLabelFT(m_xBuilder->weld_label("standardizedpages"))
-    , m_xClosePB(m_xBuilder->weld_button("close"))
+    : SfxModelessDialog(_pBindings, pChild, pParent, "WordCountDialog", "modules/swriter/ui/wordcount.ui")
 {
+    get(m_pCurrentWordFT, "selectwords");
+    get(m_pCurrentCharacterFT, "selectchars");
+    get(m_pCurrentCharacterExcludingSpacesFT, "selectcharsnospaces");
+    get(m_pCurrentCjkcharsFT, "selectcjkchars");
+    get(m_pCurrentStandardizedPagesFT, "selectstandardizedpages");
+
+    get(m_pDocWordFT, "docwords");
+    get(m_pDocCharacterFT, "docchars");
+    get(m_pDocCharacterExcludingSpacesFT, "doccharsnospaces");
+    get(m_pDocCjkcharsFT, "doccjkchars");
+    get(m_pDocStandardizedPagesFT, "docstandardizedpages");
+
+    get(m_pCjkcharsLabelFT, "cjkcharsft");
+    get(m_pStandardizedPagesLabelFT, "standardizedpages");
+
+    get(m_pClosePB, "close");
+
     showCJK(SvtCJKOptions().IsAnyEnabled());
     showStandardizedPages(officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::get());
 
     Initialize(pInfo);
+
+    m_pClosePB->SetClickHdl(LINK(this, SwWordCountFloatDlg, CloseHdl));
 }
 
 void SwWordCountFloatDlg::UpdateCounts()
diff --git a/sw/source/uibase/dialog/wordcountwrapper.cxx b/sw/source/uibase/dialog/wordcountwrapper.cxx
index 2a205fb3bf12..090410509a0d 100644
--- a/sw/source/uibase/dialog/wordcountwrapper.cxx
+++ b/sw/source/uibase/dialog/wordcountwrapper.cxx
@@ -14,15 +14,15 @@
 
 SFX_IMPL_CHILDWINDOW_WITHID(SwWordCountWrapper, FN_WORDCOUNT_DIALOG)
 
-SwWordCountWrapper::SwWordCountWrapper(vcl::Window *pParentWindow,
+SwWordCountWrapper::SwWordCountWrapper(   vcl::Window *pParentWindow,
                             sal_uInt16 nId,
                             SfxBindings* pBindings,
-                            SfxChildWinInfo* pInfo )
-    : SfxChildWindow(pParentWindow, nId)
+                            SfxChildWinInfo* pInfo ) :
+        SfxChildWindow(pParentWindow, nId)
 {
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-    xAbstDlg.reset(pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow->GetFrameWeld(), pInfo));
-    SetController(xAbstDlg->GetController());
+    xAbstDlg.reset(pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow, pInfo));
+    SetWindow(xAbstDlg->GetWindow());
 }
 
 SwWordCountWrapper::~SwWordCountWrapper()
diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx
index e63ef3c07c6b..ea95266a5cac 100644
--- a/sw/source/uibase/inc/wordcountdialog.hxx
+++ b/sw/source/uibase/inc/wordcountdialog.hxx
@@ -25,32 +25,37 @@ struct SwDocStat;
 #include <sfx2/childwin.hxx>
 #include <swabstdlg.hxx>
 
-class SwWordCountFloatDlg : public SfxModelessDialogController
+class SwWordCountFloatDlg : public SfxModelessDialog
 {
     void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc);
     void showCJK(bool bShowCJK);
     void showStandardizedPages(bool bShowStandardizedPages);
 
-    std::unique_ptr<weld::Label> m_xCurrentWordFT;
-    std::unique_ptr<weld::Label> m_xCurrentCharacterFT;
-    std::unique_ptr<weld::Label> m_xCurrentCharacterExcludingSpacesFT;
-    std::unique_ptr<weld::Label> m_xCurrentCjkcharsFT;
-    std::unique_ptr<weld::Label> m_xCurrentStandardizedPagesFT;
-    std::unique_ptr<weld::Label> m_xDocWordFT;
-    std::unique_ptr<weld::Label> m_xDocCharacterFT;
-    std::unique_ptr<weld::Label> m_xDocCharacterExcludingSpacesFT;
-    std::unique_ptr<weld::Label> m_xDocCjkcharsFT;
-    std::unique_ptr<weld::Label> m_xDocStandardizedPagesFT;
-    std::unique_ptr<weld::Label> m_xCjkcharsLabelFT;
-    std::unique_ptr<weld::Label> m_xStandardizedPagesLabelFT;
-    std::unique_ptr<weld::Button> m_xClosePB;
+    VclPtr<FixedText> m_pCurrentWordFT;
+    VclPtr<FixedText> m_pCurrentCharacterFT;
+    VclPtr<FixedText> m_pCurrentCharacterExcludingSpacesFT;
+    VclPtr<FixedText> m_pCurrentCjkcharsFT;
+    VclPtr<FixedText> m_pCurrentStandardizedPagesFT;
 
+    VclPtr<FixedText> m_pDocWordFT;
+    VclPtr<FixedText> m_pDocCharacterFT;
+    VclPtr<FixedText> m_pDocCharacterExcludingSpacesFT;
+    VclPtr<FixedText> m_pDocCjkcharsFT;
+    VclPtr<FixedText> m_pDocStandardizedPagesFT;
+
+    VclPtr<FixedText> m_pCjkcharsLabelFT;
+    VclPtr<FixedText> m_pStandardizedPagesLabelFT;
+
+    VclPtr<CloseButton> m_pClosePB;
+
+    DECL_STATIC_LINK( SwWordCountFloatDlg, CloseHdl, Button*, void );
 public:
-    SwWordCountFloatDlg(SfxBindings* pBindings,
-                        SfxChildWindow* pChild,
-                        weld::Window *pParent,
-                        SfxChildWinInfo const * pInfo);
+    SwWordCountFloatDlg(     SfxBindings* pBindings,
+                             SfxChildWindow* pChild,
+                             vcl::Window *pParent,
+                             SfxChildWinInfo const * pInfo);
     virtual ~SwWordCountFloatDlg() override;
+    virtual void dispose() override;
     void    UpdateCounts();
 
     void    SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat);
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 331309ef025a..e52c3c778940 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -403,8 +403,8 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt
     tools::Rectangle aOldVisArea( m_aVisArea );
     long nDiffY = 0;
 
-    vcl::Window* pCareWn = SwViewShell::GetCareWin();
-    weld::Window* pCareDialog = SwViewShell::GetCareDialog(GetWrtShell());
+    vcl::Window* pCareWn = SwViewShell::GetCareWin(GetWrtShell());
+    weld::Dialog* pCareDialog = SwViewShell::GetCareDialog();
     if (pCareWn || pCareDialog)
     {
         int x, y, width, height;
diff --git a/sw/uiconfig/swriter/ui/wordcount.ui b/sw/uiconfig/swriter/ui/wordcount.ui
index 6da9a2c96b8e..86595e5125cf 100644
--- a/sw/uiconfig/swriter/ui/wordcount.ui
+++ b/sw/uiconfig/swriter/ui/wordcount.ui
@@ -1,18 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.20.2 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="WordCountDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="wordcount|WordCountDialog">Word Count</property>
-    <property name="default_width">0</property>
-    <property name="default_height">0</property>
     <property name="destroy_with_parent">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>
@@ -324,7 +319,6 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-7">close</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
   </object>
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 766044a7b6d5..5b049fabc4e5 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -147,7 +147,6 @@ public:
     virtual void GetWorkArea(tools::Rectangle& rRect) override;
     virtual SalFrame* GetParent() const override;
     virtual void SetModal(bool bModal) override;
-    virtual bool GetModal() const override;
     virtual void SetWindowState(const SalFrameState* pState) override;
     virtual bool GetWindowState(SalFrameState* pState) override;
     virtual void ShowFullScreen(bool bFullScreen, sal_Int32 nDisplay) override;
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index b27b46d828c8..e2662d415fc2 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -240,11 +240,6 @@ public:
     {
     }
 
-    virtual bool            GetModal() const
-    {
-        return false;
-    }
-
     // return true to indicate tooltips are shown natively, false otherwise
     virtual bool            ShowTooltip(const OUString& /*rHelpText*/, const tools::Rectangle& /*rHelpArea*/)
     {
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index a77c7c61686b..7b2e78a5414e 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -537,7 +537,6 @@ public:
 #if GTK_CHECK_VERSION(3,0,0)
     virtual void                PositionByToolkit(const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) override;
     virtual void                SetModal(bool bModal) override;
-    virtual bool                GetModal() const override;
     void                        HideTooltip();
     virtual bool                ShowTooltip(const OUString& rHelpText, const tools::Rectangle& rHelpArea) override;
     virtual void*               ShowPopover(const OUString& rHelpText, vcl::Window* pParent, const tools::Rectangle& rHelpArea, QuickHelpFlags nFlags) override;
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 452a88e6f9f5..21448efd9496 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -40,7 +40,6 @@ class VirtualDevice;
 class PhysicalFontCollection;
 class ImplFontCache;
 class VCLXWindow;
-class WindowStateData;
 class SalFrame;
 class SalObject;
 enum class MouseEventModifiers;
@@ -415,9 +414,6 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
                            sal_uInt16 nCode, MouseEventModifiers nMode );
 void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight );
 
-VCL_DLLPUBLIC void ImplWindowStateFromStr(WindowStateData& rData, const OString& rStr);
-VCL_DLLPUBLIC OString ImplWindowStateToStr(const WindowStateData& rData);
-
 #endif // INCLUDED_VCL_INC_WINDOW_H
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index b5680b654771..2628b0583b90 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -474,8 +474,6 @@ void Qt5Frame::SetModal(bool bModal)
     }
 }
 
-bool Qt5Frame::GetModal() const { return isWindow() && windowHandle()->isModal(); }
-
 void Qt5Frame::SetWindowState(const SalFrameState* pState)
 {
     if (!isWindow() || !pState || isChild(true, false))
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index d3bbd9385470..485b404ac200 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -730,15 +730,11 @@ public:
     virtual void set_modal(bool bModal) override
     {
         if (::Dialog* pDialog = dynamic_cast<::Dialog*>(m_xWindow.get()))
-            return pDialog->SetModalInputMode(bModal);
-        return m_xWindow->ImplGetFrame()->SetModal(bModal);
-    }
-
-    virtual bool get_modal() const override
-    {
-        if (const ::Dialog* pDialog = dynamic_cast<const ::Dialog*>(m_xWindow.get()))
-            return pDialog->IsModalInputMode();
-        return m_xWindow->ImplGetFrame()->GetModal();
+        {
+            pDialog->SetModalInputMode(bModal);
+            return;
+        }
+        m_xWindow->ImplGetFrame()->SetModal(bModal);
     }
 
     virtual void window_move(int x, int y) override
@@ -761,35 +757,6 @@ public:
         return true;
     }
 
-    virtual Size get_size() const override
-    {
-        return m_xWindow->GetSizePixel();
-    }
-
-    virtual Point get_position() const override
-    {
-        return m_xWindow->GetPosPixel();
-    }
-
-    virtual bool get_resizable() const override
-    {
-        return m_xWindow->GetStyle() & WB_SIZEABLE;
-    }
-
-    virtual void set_window_state(const OString& rStr) override
-    {
-        SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(m_xWindow.get());
-        assert(pSysWin);
-        pSysWin->SetWindowState(rStr);
-    }
-
-    virtual OString get_window_state(WindowStateMask nMask) const override
-    {
-        SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(m_xWindow.get());
-        assert(pSysWin);
-        return pSysWin->GetWindowState(nMask);
-    }
-
     virtual SystemEnvData get_system_data() const override
     {
         return *m_xWindow->GetSystemData();
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 480c2f7b6c47..85ed792d5f39 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -831,18 +831,6 @@ namespace
         return bResizable;
     }
 
-    bool extractModal(VclBuilder::stringmap &rMap)
-    {
-        bool bModal = false;
-        VclBuilder::stringmap::iterator aFind = rMap.find(OString("modal"));
-        if (aFind != rMap.end())
-        {
-            bModal = toBool(aFind->second);
-            rMap.erase(aFind);
-        }
-        return bModal;
-    }
-
     bool extractDecorated(VclBuilder::stringmap &rMap)
     {
         bool bDecorated = true;
@@ -1533,8 +1521,6 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
         if (extractResizable(rMap))
             nBits |= WB_SIZEABLE;
         xWindow = VclPtr<Dialog>::Create(pParent, nBits, !pParent ? Dialog::InitFlag::NoParent : Dialog::InitFlag::Default);
-        if (!m_bLegacy && !extractModal(rMap))
-            xWindow->SetType(WindowType::MODELESSDIALOG);
     }
     else if (name == "GtkMessageDialog")
     {
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 11a92bb9a8f4..53ebce93689b 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -819,7 +819,7 @@ bool Dialog::Close()
         return bRet;
     }
 
-    if (IsInExecute() || mpDialogImpl->maEndCtx.isSet())
+    if ( IsInExecute() )
     {
         EndDialog();
         mbInClose = false;
@@ -832,11 +832,11 @@ bool Dialog::Close()
     }
 }
 
-bool Dialog::ImplStartExecute()
+bool Dialog::ImplStartExecuteModal()
 {
     setDeferredProperties();
 
-    if (IsInExecute() || mpDialogImpl->maEndCtx.isSet())
+    if ( mbInExecute || mpDialogImpl->maEndCtx.isSet() )
     {
 #ifdef DBG_UTIL
         SAL_WARN( "vcl", "Dialog::StartExecuteModal() is called in Dialog::StartExecuteModal(): "
@@ -854,74 +854,68 @@ bool Dialog::ImplStartExecute()
             SetLOKNotifier(pViewShell);
     }
 
-    const bool bModal = GetType() != WindowType::MODELESSDIALOG;
-
-    if (bModal)
+    switch ( Application::GetDialogCancelMode() )
     {
-        switch ( Application::GetDialogCancelMode() )
+    case Application::DialogCancelMode::Off:
+        break;
+    case Application::DialogCancelMode::Silent:
+        if (GetLOKNotifier())
         {
-        case Application::DialogCancelMode::Off:
-            break;
-        case Application::DialogCancelMode::Silent:
-            if (bModal && GetLOKNotifier())
-            {
-                // check if there's already some dialog being ::Execute()d
-                const bool bDialogExecuting = std::any_of(pSVData->maWinData.mpExecuteDialogs.begin(),
-                                                          pSVData->maWinData.mpExecuteDialogs.end(),
-                                                          [](const Dialog* pDialog) {
-                                                              return pDialog->IsInSyncExecute();
-                                                          });
-                if (!(bDialogExecuting && IsInSyncExecute()))
-                    break;
-                else
-                    SAL_WARN("lok.dialog", "Dialog \"" << ImplGetDialogText(this) << "\" is being synchronously executed over an existing synchronously executing dialog.");
-            }
-
-            SAL_INFO(
-                "vcl",
-                "Dialog \"" << ImplGetDialogText(this)
-                    << "\"cancelled in silent mode");
-            return false;
-        default: // default cannot happen
-        case Application::DialogCancelMode::Fatal:
-            std::abort();
+            // check if there's already some dialog being ::Execute()d
+            const bool bDialogExecuting = std::any_of(pSVData->maWinData.mpExecuteDialogs.begin(),
+                                                      pSVData->maWinData.mpExecuteDialogs.end(),
+                                                      [](const Dialog* pDialog) {
+                                                          return pDialog->IsInSyncExecute();
+                                                      });
+            if (!(bDialogExecuting && IsInSyncExecute()))
+                break;
+            else
+                SAL_WARN("lok.dialog", "Dialog \"" << ImplGetDialogText(this) << "\" is being synchronously executed over an existing synchronously executing dialog.");
         }
 
+        SAL_INFO(
+            "vcl",
+            "Dialog \"" << ImplGetDialogText(this)
+                << "\"cancelled in silent mode");
+        return false;
+    default: // default cannot happen
+    case Application::DialogCancelMode::Fatal:
+        std::abort();
+    }
+
 #ifdef DBG_UTIL
-        vcl::Window* pParent = GetParent();
-        if ( pParent )
-        {
-            pParent = pParent->ImplGetFirstOverlapWindow();
-            SAL_WARN_IF( !pParent->IsReallyVisible(), "vcl",
-                        "Dialog::StartExecuteModal() - Parent not visible" );
-            SAL_WARN_IF( !pParent->IsInputEnabled(), "vcl",
-                        "Dialog::StartExecuteModal() - Parent input disabled, use another parent to ensure modality!" );
-            SAL_WARN_IF(  pParent->IsInModalMode(), "vcl",
-                        "Dialog::StartExecuteModal() - Parent already modally disabled, use another parent to ensure modality!" );
+    vcl::Window* pParent = GetParent();
+    if ( pParent )
+    {
+        pParent = pParent->ImplGetFirstOverlapWindow();
+        SAL_WARN_IF( !pParent->IsReallyVisible(), "vcl",
+                    "Dialog::StartExecuteModal() - Parent not visible" );
+        SAL_WARN_IF( !pParent->IsInputEnabled(), "vcl",
+                    "Dialog::StartExecuteModal() - Parent input disabled, use another parent to ensure modality!" );
+        SAL_WARN_IF(  pParent->IsInModalMode(), "vcl",
+                    "Dialog::StartExecuteModal() - Parent already modally disabled, use another parent to ensure modality!" );
 
-        }
+    }
 #endif
 
-        // link all dialogs which are being executed
-        pSVData->maWinData.mpExecuteDialogs.push_back(this);
+    // link all dialogs which are being executed
+    pSVData->maWinData.mpExecuteDialogs.push_back(this);
 
-        // stop capturing, in order to have control over the dialog
-        if ( pSVData->maWinData.mpTrackWin )
-            pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel );
-        if ( pSVData->maWinData.mpCaptureWin )
-            pSVData->maWinData.mpCaptureWin->ReleaseMouse();
-        EnableInput();
+    // stop capturing, in order to have control over the dialog
+    if ( pSVData->maWinData.mpTrackWin )
+        pSVData->maWinData.mpTrackWin->EndTracking( TrackingEventFlags::Cancel );
+    if ( pSVData->maWinData.mpCaptureWin )
+        pSVData->maWinData.mpCaptureWin->ReleaseMouse();
+    EnableInput();
 
-        if ( GetParent() )
-        {
-            NotifyEvent aNEvt( MouseNotifyEvent::EXECUTEDIALOG, this );
-            GetParent()->CompatNotify( aNEvt );
-        }
+    if ( GetParent() )
+    {
+        NotifyEvent aNEvt( MouseNotifyEvent::EXECUTEDIALOG, this );
+        GetParent()->CompatNotify( aNEvt );
     }
-
     mbInExecute = true;
     // no real modality in LibreOfficeKit
-    if (!bKitActive && bModal)
+    if (!bKitActive)
         SetModalInputMode(true);
 
     // FIXME: no layouting, workaround some clipping issues
@@ -933,17 +927,13 @@ bool Dialog::ImplStartExecute()
     ShowFlags showFlags = bForceFocusAndToFront ? ShowFlags::ForegroundTask : ShowFlags::NONE;
     Show(true, showFlags);
 
-    if (bModal)
-        pSVData->maAppData.mnModalMode++;
+    pSVData->maAppData.mnModalMode++;
 
     css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_QUERY_THROW);
     css::document::DocumentEvent aObject;
     aObject.EventName = "DialogExecute";
     xEventBroadcaster->documentEventOccured(aObject);
-    if (bModal)
-        UITestLogger::getInstance().log("ModalDialogExecuted Id:" + get_id());
-    else
-        UITestLogger::getInstance().log("ModelessDialogExecuted Id:" + get_id());
+    UITestLogger::getInstance().log("ModalDialogExecuted Id:" + get_id());
 
     if (bKitActive)
     {
@@ -1025,7 +1015,7 @@ short Dialog::Execute()
             mbInSyncExecute = false;
         });
 
-    if ( !ImplStartExecute() )
+    if ( !ImplStartExecuteModal() )
         return 0;
 
     // Yield util EndDialog is called or dialog gets destroyed
@@ -1064,8 +1054,7 @@ short Dialog::Execute()
 // virtual
 bool Dialog::StartExecuteAsync( VclAbstractDialog::AsyncContext &rCtx )
 {
-    const bool bModal = GetType() != WindowType::MODELESSDIALOG;
-    if (!ImplStartExecute())
+    if ( !ImplStartExecuteModal() )
     {
         rCtx.mxOwner.disposeAndClear();
         rCtx.mxOwnerDialog.reset();
@@ -1073,7 +1062,7 @@ bool Dialog::StartExecuteAsync( VclAbstractDialog::AsyncContext &rCtx )
     }
 
     mpDialogImpl->maEndCtx = rCtx;
-    mpDialogImpl->mbStartedModal = bModal;
+    mpDialogImpl->mbStartedModal = true;
 
     return true;
 }
@@ -1092,60 +1081,47 @@ void Dialog::EndDialog( long nResult )
     if ( !mbInExecute )
         return;
 
-    const bool bModal = GetType() != WindowType::MODELESSDIALOG;
+    SetModalInputMode(false);
 
-    if (bModal)
-    {
-        SetModalInputMode(false);
+    RemoveFromDlgList();
 
-        RemoveFromDlgList();
+    // set focus to previous modal dialogue if it is modal for
+    // the same frame parent (or NULL)
+    ImplSVData* pSVData = ImplGetSVData();
+    if (!pSVData->maWinData.mpExecuteDialogs.empty())
+    {
+        VclPtr<Dialog> pPrevious = pSVData->maWinData.mpExecuteDialogs.back();
 
-        // set focus to previous modal dialogue if it is modal for
-        // the same frame parent (or NULL)
-        ImplSVData* pSVData = ImplGetSVData();
-        if (!pSVData->maWinData.mpExecuteDialogs.empty())
+        vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
+        vcl::Window* pPrevFrameParent = pPrevious->ImplGetFrameWindow()? pPrevious->ImplGetFrameWindow()->ImplGetParent(): nullptr;
+        if( ( !pFrameParent && !pPrevFrameParent ) ||
+            ( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
+            )
         {
-            VclPtr<Dialog> pPrevious = pSVData->maWinData.mpExecuteDialogs.back();
-
-            vcl::Window* pFrameParent = ImplGetFrameWindow()->ImplGetParent();
-            vcl::Window* pPrevFrameParent = pPrevious->ImplGetFrameWindow()? pPrevious->ImplGetFrameWindow()->ImplGetParent(): nullptr;
-            if( ( !pFrameParent && !pPrevFrameParent ) ||
-                ( pFrameParent && pPrevFrameParent && pFrameParent->ImplGetFrame() == pPrevFrameParent->ImplGetFrame() )
-                )
-            {
-                pPrevious->GrabFocus();
-            }
+            pPrevious->GrabFocus();
         }
     }
 
     Hide();
-
-    if (bModal)
+    if ( GetParent() )
     {
-        if ( GetParent() )
-        {
-            NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
-            GetParent()->CompatNotify( aNEvt );
-        }
+        NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
+        GetParent()->CompatNotify( aNEvt );
     }
 
     mpDialogImpl->mnResult = nResult;
 
     if ( mpDialogImpl->mbStartedModal )
-        ImplEndExecuteModal();
-
-    if (mpDialogImpl->maEndCtx.isSet())
-    {
-        mpDialogImpl->maEndCtx.maEndDialogFn(nResult);
-        mpDialogImpl->maEndCtx.maEndDialogFn = nullptr;
-    }
-
-    if ( mpDialogImpl->mbStartedModal )
     {
+        ImplEndExecuteModal();
+        if (mpDialogImpl->maEndCtx.isSet())
+        {
+            mpDialogImpl->maEndCtx.maEndDialogFn(nResult);
+            mpDialogImpl->maEndCtx.maEndDialogFn = nullptr;
+        }
         mpDialogImpl->mbStartedModal = false;
         mpDialogImpl->mnResult = -1;
     }
-
     mbInExecute = false;
 
     // Destroy ourselves (if we have a context with VclPtr owner)
@@ -1498,18 +1474,15 @@ ModalDialog::ModalDialog( vcl::Window* pParent, const OUString& rID, const OUStr
 {
 }
 
-void Dialog::Activate()
+void ModelessDialog::Activate()
 {
-    if (GetType() == WindowType::MODELESSDIALOG)
-    {
-        css::uno::Reference< css::uno::XComponentContext > xContext(
-                comphelper::getProcessComponentContext() );
-        css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_QUERY_THROW);
-        css::document::DocumentEvent aObject;
-        aObject.EventName = "ModelessDialogVisible";
-        xEventBroadcaster->documentEventOccured(aObject);
-    }
-    SystemWindow::Activate();
+    css::uno::Reference< css::uno::XComponentContext > xContext(
+            comphelper::getProcessComponentContext() );
+    css::uno::Reference<css::frame::XGlobalEventBroadcaster> xEventBroadcaster(css::frame::theGlobalEventBroadcaster::get(xContext), css::uno::UNO_QUERY_THROW);
+    css::document::DocumentEvent aObject;
+    aObject.EventName = "ModelessDialogVisible";
+    xEventBroadcaster->documentEventOccured(aObject);
+    Dialog::Activate();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 72f2eb5bf46d..734e1d0b946f 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -431,7 +431,7 @@ const Size& SystemWindow::GetMaxOutputSizePixel() const
     return mpImplData->maMaxOutSize;
 }
 
-void ImplWindowStateFromStr(WindowStateData& rData,
+static void ImplWindowStateFromStr(WindowStateData& rData,
     const OString& rStr)
 {
     WindowStateMask nValidMask = WindowStateMask::NONE;
@@ -545,7 +545,7 @@ void ImplWindowStateFromStr(WindowStateData& rData,
     rData.SetMask( nValidMask );
 }
 
-OString ImplWindowStateToStr(const WindowStateData& rData)
+static OString ImplWindowStateToStr(const WindowStateData& rData)
 {
     const WindowStateMask nValidMask = rData.GetMask();
     if ( nValidMask == WindowStateMask::NONE )
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index bb1cbf48b569..048f15c19207 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2467,13 +2467,6 @@ void GtkSalFrame::SetModal(bool bModal)
     gtk_window_set_modal(GTK_WINDOW(m_pWindow), bModal);
 }
 
-bool GtkSalFrame::GetModal() const
-{
-    if (!m_pWindow)
-        return false;
-    return gtk_window_get_modal(GTK_WINDOW(m_pWindow));
-}
-
 gboolean GtkSalFrame::signalTooltipQuery(GtkWidget*, gint /*x*/, gint /*y*/,
                                      gboolean /*keyboard_mode*/, GtkTooltip *tooltip,
                                      gpointer frame)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 2d624e2d6197..09594386fa1d 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -36,9 +36,7 @@
 #include <vcl/ImageTree.hxx>
 #include <vcl/quickselectionengine.hxx>
 #include <vcl/mnemonic.hxx>
-#include <vcl/syswin.hxx>
 #include <vcl/weld.hxx>
-#include <window.h>
 
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
@@ -2059,11 +2057,6 @@ public:
         gtk_window_set_modal(m_pWindow, bModal);
     }
 
-    virtual bool get_modal() const override
-    {
-        return gtk_window_get_modal(m_pWindow);
-    }
-
     virtual void resize_to_request() override
     {
         gtk_window_resize(m_pWindow, 1, 1);
@@ -2090,87 +2083,6 @@ public:
         return SystemEnvData();
     }
 
-    virtual Size get_size() const override
-    {
-        int current_width, current_height;
-        gtk_window_get_size(m_pWindow, &current_width, &current_height);
-        return Size(current_width, current_height);
-    }
-
-    virtual Point get_position() const override
-    {
-        int current_x, current_y;
-        gtk_window_get_position(m_pWindow, &current_x, &current_y);
-        return Point(current_x, current_y);
-    }
-
-    virtual bool get_resizable() const override
-    {
-        return gtk_window_get_resizable(m_pWindow);
-    }
-
-    virtual void set_window_state(const OString& rStr) override
-    {
-        WindowStateData aData;
-        ImplWindowStateFromStr( aData, rStr );
-
-        auto nMask = aData.GetMask();
-        auto nState = aData.GetState() & WindowStateState::SystemMask;
-
-        if (nMask & WindowStateMask::Width && nMask & WindowStateMask::Height)
-        {
-            gtk_window_set_default_size(m_pWindow, aData.GetWidth(), aData.GetHeight());
-        }
-        if (nMask & WindowStateMask::State)
-        {
-            if (nState & WindowStateState::Maximized)
-                gtk_window_maximize(m_pWindow);
-            else
-                gtk_window_unmaximize(m_pWindow);
-        }
-    }
-
-    virtual OString get_window_state(WindowStateMask nMask) const override
-    {
-        bool bPositioningAllowed = true;
-#if defined(GDK_WINDOWING_WAYLAND)
-        // drop x/y when under wayland
-        GdkDisplay *pDisplay = gtk_widget_get_display(m_pWidget);
-        bPositioningAllowed = !GDK_IS_WAYLAND_DISPLAY(pDisplay);
-#endif
-
-        WindowStateData aData;
-        WindowStateMask nAvailable = WindowStateMask::State |
-                                     WindowStateMask::Width | WindowStateMask::Height;
-        if (bPositioningAllowed)
-            nAvailable |= WindowStateMask::X | WindowStateMask::Y;
-        aData.SetMask(nMask & nAvailable);
-
-        if (nMask & WindowStateMask::State)
-        {
-            WindowStateState nState = WindowStateState::Normal;
-            if (gtk_window_is_maximized(m_pWindow))
-                nState |= WindowStateState::Maximized;
-            aData.SetState(nState);
-        }
-
-        if (bPositioningAllowed && (nMask & (WindowStateMask::X | WindowStateMask::Y)))
-        {
-            auto aPos = get_position();
-            aData.SetX(aPos.X());
-            aData.SetY(aPos.Y());
-        }
-
-        if (nMask & (WindowStateMask::Width | WindowStateMask::Height))
-        {
-            auto aSize = get_size();
-            aData.SetWidth(aSize.Width());
-            aData.SetHeight(aSize.Height());
-        }
-
-        return ImplWindowStateToStr(aData);
-    }
-
     virtual ~GtkInstanceWindow() override
     {
         if (m_xWindow.is())
@@ -2320,7 +2232,11 @@ public:
         m_xDialogController = rDialogController;
         m_aFunc = func;
 
-        show();
+        if (!gtk_widget_get_visible(m_pWidget))
+        {
+            sort_native_button_order(GTK_BOX(gtk_dialog_get_action_area(m_pDialog)));
+            gtk_widget_show(m_pWidget);
+        }
 
         m_nResponseSignalId = g_signal_connect(m_pDialog, "response", G_CALLBACK(signalAsyncResponse), this);
 
@@ -2359,11 +2275,8 @@ public:
 
     virtual void show() override
     {
-        if (!gtk_widget_get_visible(m_pWidget))
-        {
-            sort_native_button_order(GTK_BOX(gtk_dialog_get_action_area(m_pDialog)));
-            gtk_widget_show(m_pWidget);
-        }
+        sort_native_button_order(GTK_BOX(gtk_dialog_get_action_area(m_pDialog)));
+        gtk_widget_show(m_pWidget);
     }
 
     static int VclToGtk(int nResponse)


More information about the Libreoffice-commits mailing list