[Libreoffice-commits] core.git: include/svtools include/vcl sc/source svtools/source vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sat Feb 20 10:29:07 UTC 2021


 include/svtools/toolbarmenu.hxx        |    3 +--
 include/vcl/dockwin.hxx                |   11 +++++++++++
 sc/source/ui/cctrl/checklistmenu.cxx   |   13 +++++--------
 sc/source/ui/inc/checklistmenu.hxx     |    3 +--
 svtools/source/control/toolbarmenu.cxx |   12 +++---------
 vcl/source/control/calendar.cxx        |   13 +++++--------
 vcl/source/window/dockwin.cxx          |   20 ++++++++++++++++++++
 7 files changed, 46 insertions(+), 29 deletions(-)

New commits:
commit 41fe604a2e48c8c921a29bf4240abf8929582e2e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Feb 19 20:54:17 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Feb 20 11:28:21 2021 +0100

    merge together interimdockparent usage
    
    and their uses of VclBuilder can be contained to vcl
    
    Change-Id: I0cbbd3175e4ec857187b7f1716232a3514fe9605
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111251
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx
index a9b0a9f5415c..e68043b34ed5 100644
--- a/include/svtools/toolbarmenu.hxx
+++ b/include/svtools/toolbarmenu.hxx
@@ -82,10 +82,9 @@ public:
     void unsetPopover();
 };
 
-class SVT_DLLPUBLIC InterimToolbarPopup final : public DockingWindow
+class SVT_DLLPUBLIC InterimToolbarPopup final : public InterimDockingWindow
 {
 private:
-    VclPtr<vcl::Window> m_xBox;
     css::uno::Reference<css::frame::XFrame> m_xFrame;
     std::unique_ptr<weld::Builder> m_xBuilder;
     std::unique_ptr<weld::Container> m_xContainer;
diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx
index b52091f0c642..390c96267f0b 100644
--- a/include/vcl/dockwin.hxx
+++ b/include/vcl/dockwin.hxx
@@ -378,6 +378,17 @@ inline void DockingWindow::SetIdleDebugName( const char *pDebugName )
     maLayoutIdle.SetDebugName( pDebugName );
 }
 
+class VCL_DLLPUBLIC InterimDockingWindow : public DockingWindow
+{
+protected:
+    VclPtr<vcl::Window> m_xBox;
+public:
+    InterimDockingWindow(vcl::Window* pParent,
+        const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>(),
+        bool bTearable = false);
+    virtual ~InterimDockingWindow() override;
+    virtual void dispose() override;
+};
 
 #endif // INCLUDED_VCL_DOCKWIN_HXX
 
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 9dd2e5a8c0c9..b2da89bb7717 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -21,7 +21,6 @@
 #include <globstr.hrc>
 #include <scresid.hxx>
 
-#include <vcl/builder.hxx>
 #include <vcl/decoview.hxx>
 #include <vcl/event.hxx>
 #include <vcl/dockwin.hxx>
@@ -568,14 +567,13 @@ ScCheckListMenuControl::~ScCheckListMenuControl()
 ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc, bool bCanHaveSubMenu,
                                              bool bTreeMode, int nWidth, ScCheckListMenuWindow* pParentMenu,
                                              vcl::ILibreOfficeKitNotifier* pNotifier)
-    : DockingWindow(pParent, "InterimDockParent", "vcl/ui/interimdockparent.ui")
+    : InterimDockingWindow(pParent)
     , mxParentMenu(pParentMenu)
-    , mxBox(m_pUIBuilder->get("box"))
 {
     if (pNotifier)
         SetLOKNotifier(pNotifier);
     setDeferredProperties();
-    mxControl.reset(new ScCheckListMenuControl(this, mxBox.get(), pDoc, bCanHaveSubMenu, bTreeMode, nWidth));
+    mxControl.reset(new ScCheckListMenuControl(this, m_xBox.get(), pDoc, bCanHaveSubMenu, bTreeMode, nWidth));
     SetBackground(Application::GetSettings().GetStyleSettings().GetMenuColor());
     set_id("check_list_menu");
 }
@@ -588,7 +586,7 @@ bool ScCheckListMenuWindow::EventNotify(NotifyEvent& rNEvt)
         rMenuControl.queueCloseSubMenu();
         rMenuControl.clearSelectedMenuItem();
     }
-    return DockingWindow::EventNotify(rNEvt);
+    return InterimDockingWindow::EventNotify(rNEvt);
 }
 
 ScCheckListMenuWindow::~ScCheckListMenuWindow()
@@ -599,14 +597,13 @@ ScCheckListMenuWindow::~ScCheckListMenuWindow()
 void ScCheckListMenuWindow::dispose()
 {
     mxControl.reset();
-    mxBox.disposeAndClear();
     mxParentMenu.clear();
-    DockingWindow::dispose();
+    InterimDockingWindow::dispose();
 }
 
 void ScCheckListMenuWindow::GetFocus()
 {
-    DockingWindow::GetFocus();
+    InterimDockingWindow::GetFocus();
     if (!mxControl)
         return;
     mxControl->GrabFocus();
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index 602d6d86109d..a00e1447557c 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -297,7 +297,7 @@ private:
  * This class implements a popup window for field button, for quick access
  * of hide-item list, and possibly more stuff related to field options.
  */
-class ScCheckListMenuWindow : public DockingWindow
+class ScCheckListMenuWindow : public InterimDockingWindow
 {
 public:
     explicit ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* pDoc,
@@ -315,7 +315,6 @@ public:
 
 private:
     VclPtr<ScCheckListMenuWindow> mxParentMenu;
-    VclPtr<vcl::Window> mxBox;
     std::unique_ptr<ScCheckListMenuControl, o3tl::default_delete<ScCheckListMenuControl>> mxControl;
 };
 
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 802321bb12c6..d7336caddb67 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -21,7 +21,6 @@
 #include <comphelper/processfactory.hxx>
 #include <osl/diagnose.h>
 
-#include <vcl/builder.hxx>
 #include <vcl/taskpanelist.hxx>
 #include <vcl/svapp.hxx>
 
@@ -172,11 +171,7 @@ IMPL_LINK_NOARG(ToolbarPopupContainer, FocusHdl, weld::Widget&, void)
 
 InterimToolbarPopup::InterimToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParent,
                                          std::unique_ptr<WeldToolbarPopup> xPopup, bool bTearable)
-    : DockingWindow(pParent,
-                    !bTearable ? OString("InterimDockParent") : OString("InterimTearableParent"),
-                    !bTearable ? OUString("vcl/ui/interimdockparent.ui") : OUString("vcl/ui/interimtearableparent.ui"),
-                    rFrame)
-    , m_xBox(m_pUIBuilder->get("box"))
+    : InterimDockingWindow(pParent, rFrame, bTearable)
     , m_xFrame(rFrame)
     , m_xBuilder(Application::CreateInterimBuilder(m_xBox.get(), "svt/ui/interimparent.ui", false))
     , m_xContainer(m_xBuilder->weld_container("container"))
@@ -192,7 +187,7 @@ InterimToolbarPopup::InterimToolbarPopup(const css::uno::Reference<css::frame::X
 
 void InterimToolbarPopup::GetFocus()
 {
-    DockingWindow::GetFocus();
+    InterimDockingWindow::GetFocus();
     if (!m_xPopup)
         return;
     m_xPopup->GrabFocus();
@@ -216,9 +211,8 @@ void InterimToolbarPopup::dispose()
     m_xPopup.reset();
     m_xContainer.reset();
     m_xBuilder.reset();
-    m_xBox.clear();
     m_xFrame.clear();
-    DockingWindow::dispose();
+    InterimDockingWindow::dispose();
 }
 
 InterimToolbarPopup::~InterimToolbarPopup()
diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx
index 1d714e914e56..e35dc353d442 100644
--- a/vcl/source/control/calendar.cxx
+++ b/vcl/source/control/calendar.cxx
@@ -1546,23 +1546,21 @@ namespace
     };
 }
 
-struct ImplCFieldFloatWin : public DockingWindow
+struct ImplCFieldFloatWin : public InterimDockingWindow
 {
     explicit ImplCFieldFloatWin(vcl::Window* pParent);
     virtual void dispose() override;
     virtual ~ImplCFieldFloatWin() override;
     virtual void GetFocus() override;
 
-    VclPtr<vcl::Window> mxBox;
     std::unique_ptr<ImplCFieldFloat> mxWidget;
 };
 
 ImplCFieldFloatWin::ImplCFieldFloatWin(vcl::Window* pParent)
-    : DockingWindow(pParent, "InterimDockParent", "vcl/ui/interimdockparent.ui")
-    , mxBox(m_pUIBuilder->get("box"))
+    : InterimDockingWindow(pParent)
 {
     setDeferredProperties();
-    mxWidget.reset(new ImplCFieldFloat(mxBox.get()));
+    mxWidget.reset(new ImplCFieldFloat(m_xBox.get()));
 }
 
 ImplCFieldFloatWin::~ImplCFieldFloatWin()
@@ -1573,13 +1571,12 @@ ImplCFieldFloatWin::~ImplCFieldFloatWin()
 void ImplCFieldFloatWin::dispose()
 {
     mxWidget.reset();
-    mxBox.disposeAndClear();
-    DockingWindow::dispose();
+    InterimDockingWindow::dispose();
 }
 
 void ImplCFieldFloatWin::GetFocus()
 {
-    DockingWindow::GetFocus();
+    InterimDockingWindow::GetFocus();
     if (!mxWidget)
         return;
     mxWidget->GrabFocus();
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 42a42889a6c6..b2c45fd6c4da 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -1058,4 +1058,24 @@ IMPL_LINK_NOARG(DockingWindow, ImplHandleLayoutTimerHdl, Timer*, void)
     setPosSizeOnContainee();
 }
 
+InterimDockingWindow::InterimDockingWindow(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame, bool bTearable)
+    : DockingWindow(pParent,
+                    !bTearable ? OString("InterimDockParent") : OString("InterimTearableParent"),
+                    !bTearable ? OUString("vcl/ui/interimdockparent.ui") : OUString("vcl/ui/interimtearableparent.ui"),
+                    rFrame)
+    , m_xBox(m_pUIBuilder->get("box"))
+{
+}
+
+InterimDockingWindow::~InterimDockingWindow()
+{
+    disposeOnce();
+}
+
+void InterimDockingWindow::dispose()
+{
+    m_xBox.clear();
+    DockingWindow::dispose();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list