diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-02-22 11:33:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-02-22 15:14:04 +0100 |
commit | 20997b4598f559d3274916dc1c343c69e8feeceb (patch) | |
tree | 583b1aa9cba9380306d531fdb53400e3edf1dd28 | |
parent | 40f81f1f9eb4266a897c6c5185544908d91c714e (diff) |
factor out as a ResizableDockingWindow
Change-Id: I557ccf866cc879b3cc22fcdbca882f4413cb57d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111334
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 4 | ||||
-rw-r--r-- | basctl/source/basicide/bastypes.cxx | 30 | ||||
-rw-r--r-- | basctl/source/inc/bastypes.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/dockwin.hxx | 3 | ||||
-rw-r--r-- | include/vcl/dockwin.hxx | 12 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/dockwin.cxx | 33 | ||||
-rw-r--r-- | vcl/source/window/dockwin.cxx | 24 | ||||
-rw-r--r-- | vcl/uiconfig/ui/dockingwindow.ui | 21 |
10 files changed, 84 insertions, 61 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index b5d65507fb50..a420949e4584 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1704,7 +1704,7 @@ void WatchWindow::Resize() if ( aBoxSz.Height() < 4 ) aBoxSz.setHeight( 0 ); - m_xVclContentArea->SetPosSizePixel(Point(DWBORDER, DWBORDER), aBoxSz); + m_xBox->SetPosSizePixel(Point(DWBORDER, DWBORDER), aBoxSz); Invalidate(); } @@ -1863,7 +1863,7 @@ void StackWindow::Resize() if ( aBoxSz.Height() < 4 ) aBoxSz.setHeight( 0 ); - m_xVclContentArea->SetPosSizePixel(Point(DWBORDER, DWBORDER), aBoxSz); + m_xBox->SetPosSizePixel(Point(DWBORDER, DWBORDER), aBoxSz); Invalidate(); } diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx index a9a927a27878..cc58ffa6c846 100644 --- a/basctl/source/basicide/bastypes.cxx +++ b/basctl/source/basicide/bastypes.cxx @@ -42,7 +42,6 @@ #include <svl/srchdefs.hxx> #include <vcl/commandevent.hxx> #include <vcl/event.hxx> -#include <vcl/layout.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <tools/stream.hxx> @@ -260,21 +259,19 @@ WinBits const DockingWindow::StyleBits = WB_BORDER | WB_3DLOOK | WB_CLIPCHILDREN | WB_MOVEABLE | WB_SIZEABLE | WB_ROLLABLE | WB_DOCKABLE; -DockingWindow::DockingWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID) : - ::DockingWindow(pParent, "DockingWindow", "vcl/ui/dockingwindow.ui"), - pLayout(nullptr), - nShowCount(0) +DockingWindow::DockingWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID) + : ResizableDockingWindow(pParent) + , pLayout(nullptr) + , nShowCount(0) { - m_xVclContentArea = VclPtr<VclVBox>::Create(this); - m_xVclContentArea->Show(); - m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, rUIXMLDescription, true)); + m_xBuilder.reset(Application::CreateInterimBuilder(m_xBox.get(), rUIXMLDescription, true)); m_xContainer = m_xBuilder->weld_container(rID); } -DockingWindow::DockingWindow (Layout* pParent) : - ::DockingWindow(pParent, StyleBits), - pLayout(pParent), - nShowCount(0) +DockingWindow::DockingWindow (Layout* pParent) + : ResizableDockingWindow(pParent, StyleBits) + , pLayout(pParent) + , nShowCount(0) { } DockingWindow::~DockingWindow() @@ -286,9 +283,8 @@ void DockingWindow::dispose() { m_xContainer.reset(); m_xBuilder.reset(); - m_xVclContentArea.disposeAndClear(); pLayout.clear(); - ::DockingWindow::dispose(); + ResizableDockingWindow::dispose(); } // Sets the position and the size of the docking window. This property is saved @@ -327,12 +323,12 @@ void DockingWindow::Show (bool bShow) // = true if (bShow) { if (++nShowCount == 1) - ::DockingWindow::Show(); + ResizableDockingWindow::Show(); } else { if (--nShowCount == 0) - ::DockingWindow::Hide(); + ResizableDockingWindow::Hide(); } } @@ -361,7 +357,7 @@ bool DockingWindow::Docking( const Point& rPos, tools::Rectangle& rRect ) void DockingWindow::EndDocking( const tools::Rectangle& rRect, bool bFloatMode ) { if ( bFloatMode ) - ::DockingWindow::EndDocking( rRect, bFloatMode ); + ResizableDockingWindow::EndDocking( rRect, bFloatMode ); else { SetFloatingMode(false); diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx index fecebced52ee..e6e306a73b5a 100644 --- a/basctl/source/inc/bastypes.hxx +++ b/basctl/source/inc/bastypes.hxx @@ -78,7 +78,7 @@ struct BasicStatus // basctl::DockingWindow -- special docking window for the Basic IDE // Not to be confused with ::DockingWindow from vcl. -class DockingWindow : public ::DockingWindow +class DockingWindow : public ResizableDockingWindow { public: DockingWindow(vcl::Window* pParent, const OUString& rUIXMLDescription, const OString& rID); @@ -102,7 +102,6 @@ protected: protected: std::unique_ptr<weld::Builder> m_xBuilder; - VclPtr<vcl::Window> m_xVclContentArea; std::unique_ptr<weld::Container> m_xContainer; private: diff --git a/include/sfx2/dockwin.hxx b/include/sfx2/dockwin.hxx index 217c9f962efb..a7c87c408958 100644 --- a/include/sfx2/dockwin.hxx +++ b/include/sfx2/dockwin.hxx @@ -37,11 +37,10 @@ enum class SplitWindowItemFlags; void SfxDockingWindowFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName ); bool IsDockingWindowVisible( const css::uno::Reference< css::frame::XFrame >& rFrame, const OUString& rDockingWindowName ); -class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow +class SFX2_DLLPUBLIC SfxDockingWindow : public ResizableDockingWindow { protected: std::unique_ptr<weld::Builder> m_xBuilder; - VclPtr<vcl::Window> m_xVclContentArea; std::unique_ptr<weld::Container> m_xContainer; private: diff --git a/include/vcl/dockwin.hxx b/include/vcl/dockwin.hxx index f02866f0a9e5..5de80d36432e 100644 --- a/include/vcl/dockwin.hxx +++ b/include/vcl/dockwin.hxx @@ -390,6 +390,18 @@ public: virtual void dispose() override; }; +class VCL_DLLPUBLIC ResizableDockingWindow : public DockingWindow +{ +protected: + VclPtr<vcl::Window> m_xBox; +public: + ResizableDockingWindow(vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>()); + ResizableDockingWindow(vcl::Window* pParent, WinBits nStyle); + virtual ~ResizableDockingWindow() override; + virtual void dispose() override; +}; + #endif // INCLUDED_VCL_DOCKWIN_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 8d936e0dc28b..935b49c05374 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -77,7 +77,6 @@ #include <vcl/commandevent.hxx> #include <vcl/event.hxx> #include <vcl/i18nhelp.hxx> -#include <vcl/layout.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/unohelp.hxx> @@ -2219,7 +2218,7 @@ void SfxHelpWindow_Impl::GetFocus() if (pTextWin) pTextWin->GrabFocus(); else - DockingWindow::GetFocus(); + ResizableDockingWindow::GetFocus(); } void SfxHelpWindow_Impl::MakeLayout() @@ -2422,7 +2421,7 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl( const css::uno::Reference < css::frame::XFrame2 >& rFrame, vcl::Window* pParent ) : - DockingWindow(pParent, "DockingWindow", "vcl/ui/dockingwindow.ui"), + ResizableDockingWindow(pParent), xFrame ( rFrame ), pTextWin ( nullptr ), @@ -2441,9 +2440,7 @@ SfxHelpWindow_Impl::SfxHelpWindow_Impl( SetHelpId( HID_HELP_WINDOW ); - m_xVclContentArea = VclPtr<VclVBox>::Create(this); - m_xVclContentArea->Show(); - m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, "sfx/ui/helpwindow.ui", false)); + m_xBuilder.reset(Application::CreateInterimBuilder(m_xBox.get(), "sfx/ui/helpwindow.ui", false)); m_xContainer = m_xBuilder->weld_paned("HelpWindow"); m_xContainer->connect_size_allocate(LINK(this, SfxHelpWindow_Impl, ResizeHdl)); m_xHelpPaneWindow = m_xBuilder->weld_container("helppanewindow"); @@ -2483,9 +2480,8 @@ void SfxHelpWindow_Impl::dispose() m_xHelpPaneWindow.reset(); m_xContainer.reset(); m_xBuilder.reset(); - m_xVclContentArea.disposeAndClear(); - DockingWindow::dispose(); + ResizableDockingWindow::dispose(); } bool SfxHelpWindow_Impl::PreNotify( NotifyEvent& rNEvt ) diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index c7458b248e3c..5bf2c9c8aa63 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -410,13 +410,12 @@ public: class HelpInterceptor_Impl; class HelpListener_Impl; -class SfxHelpWindow_Impl : public DockingWindow +class SfxHelpWindow_Impl : public ResizableDockingWindow { private: friend class SfxHelpIndexWindow_Impl; std::unique_ptr<weld::Builder> m_xBuilder; - VclPtr<vcl::Window> m_xVclContentArea; std::unique_ptr<weld::Paned> m_xContainer; std::unique_ptr<weld::Container> m_xHelpPaneWindow; std::unique_ptr<weld::Container> m_xHelpTextWindow; diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 00d83db274d1..c7596a43bc75 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -20,7 +20,6 @@ #include <svl/eitem.hxx> #include <svl/solar.hrc> #include <vcl/event.hxx> -#include <vcl/layout.hxx> #include <vcl/settings.hxx> #include <vcl/svapp.hxx> @@ -435,7 +434,7 @@ SfxDockingWindow_Impl::SfxDockingWindow_Impl(SfxDockingWindow* pBase) */ void SfxDockingWindow::Resize() { - DockingWindow::Resize(); + ResizableDockingWindow::Resize(); Invalidate(); if ( !pImpl || !pImpl->bConstructed || !pMgr ) return; @@ -730,7 +729,7 @@ void SfxDockingWindow::EndDocking( const tools::Rectangle& rRect, bool bFloatMod } else { - DockingWindow::EndDocking(rRect, bFloatMode); + ResizableDockingWindow::EndDocking(rRect, bFloatMode); } SetAlignment( IsFloatingMode() ? SfxChildAlignment::NOALIGNMENT : pImpl->GetDockAlignment() ); @@ -754,10 +753,10 @@ void SfxDockingWindow::Resizing( Size& /*rSize*/ ) required because the docking is implemented in Sfx through SfxChildWindows. */ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, - vcl::Window* pParent, WinBits nWinBits) : - DockingWindow (pParent, nWinBits), - pBindings(pBindinx), - pMgr(pCW) + vcl::Window* pParent, WinBits nWinBits) + : ResizableDockingWindow(pParent, nWinBits) + , pBindings(pBindinx) + , pMgr(pCW) { pImpl.reset(new SfxDockingWindow_Impl(this)); } @@ -767,13 +766,11 @@ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, */ SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription) - : DockingWindow(pParent, "DockingWindow", "vcl/ui/dockingwindow.ui") + : ResizableDockingWindow(pParent) , pBindings(pBindinx) , pMgr(pCW) { - m_xVclContentArea = VclPtr<VclVBox>::Create(this); - m_xVclContentArea->Show(); - m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, rUIXMLDescription, true)); + m_xBuilder.reset(Application::CreateInterimBuilder(m_xBox, rUIXMLDescription, true)); m_xContainer = m_xBuilder->weld_container(rID); pImpl.reset(new SfxDockingWindow_Impl(this)); @@ -1043,8 +1040,7 @@ void SfxDockingWindow::dispose() pImpl.reset(); m_xContainer.reset(); m_xBuilder.reset(); - m_xVclContentArea.disposeAndClear(); - DockingWindow::dispose(); + ResizableDockingWindow::dispose(); } void SfxDockingWindow::ReleaseChildWindow_Impl() @@ -1437,7 +1433,7 @@ void SfxDockingWindow::Paint(vcl::RenderContext&, const tools::Rectangle& /*rRec void SfxDockingWindow::SetMinOutputSizePixel( const Size& rSize ) { pImpl->aMinSize = rSize; - DockingWindow::SetMinOutputSizePixel( rSize ); + ResizableDockingWindow::SetMinOutputSizePixel( rSize ); } /** Set the minimum size which is returned.*/ @@ -1449,7 +1445,7 @@ const Size& SfxDockingWindow::GetMinOutputSizePixel() const bool SfxDockingWindow::EventNotify( NotifyEvent& rEvt ) { if ( !pImpl ) - return DockingWindow::EventNotify( rEvt ); + return ResizableDockingWindow::EventNotify( rEvt ); if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) { @@ -1464,7 +1460,7 @@ bool SfxDockingWindow::EventNotify( NotifyEvent& rEvt ) // In VCL EventNotify goes first to the window itself, also call the // base class, otherwise the parent learns nothing // if ( rEvt.GetWindow() == this ) PB: #i74693# not necessary any longer - DockingWindow::EventNotify( rEvt ); + ResizableDockingWindow::EventNotify( rEvt ); return true; } else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT ) @@ -1482,10 +1478,9 @@ bool SfxDockingWindow::EventNotify( NotifyEvent& rEvt ) pBindings->SetActiveFrame( nullptr ); } - return DockingWindow::EventNotify( rEvt ); + return ResizableDockingWindow::EventNotify( rEvt ); } - void SfxDockingWindow::SetItemSize_Impl( const Size& rSize ) { pImpl->aSplitSize = rSize; @@ -1529,7 +1524,7 @@ void SfxDockingWindow::StateChanged( StateChangedType nStateChange ) if ( nStateChange == StateChangedType::InitShow ) Initialize_Impl(); - DockingWindow::StateChanged( nStateChange ); + ResizableDockingWindow::StateChanged( nStateChange ); } void SfxDockingWindow::Move() diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index bd3eac3545ef..8689e914bfd1 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -22,8 +22,8 @@ #include <vcl/accel.hxx> #include <vcl/event.hxx> #include <vcl/floatwin.hxx> -#include <vcl/dockwin.hxx> #include <vcl/layout.hxx> +#include <vcl/dockwin.hxx> #include <vcl/svapp.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> @@ -1078,4 +1078,26 @@ void DropdownDockingWindow::dispose() DockingWindow::dispose(); } +ResizableDockingWindow::ResizableDockingWindow(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rFrame) + : DockingWindow(pParent, "DockingWindow", "vcl/ui/dockingwindow.ui", rFrame) + , m_xBox(m_pUIBuilder->get("box")) +{ +} + +ResizableDockingWindow::ResizableDockingWindow(vcl::Window* pParent, WinBits nStyle) + : DockingWindow(pParent, nStyle) +{ +} + +ResizableDockingWindow::~ResizableDockingWindow() +{ + disposeOnce(); +} + +void ResizableDockingWindow::dispose() +{ + m_xBox.clear(); + DockingWindow::dispose(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/uiconfig/ui/dockingwindow.ui b/vcl/uiconfig/ui/dockingwindow.ui index e98da3fd004c..270946f7eae7 100644 --- a/vcl/uiconfig/ui/dockingwindow.ui +++ b/vcl/uiconfig/ui/dockingwindow.ui @@ -1,18 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> +<!-- Generated with glade 3.38.2 --> <interface domain="vcl"> <requires lib="gtk+" version="3.20"/> <object class="GtkWindow" id="DockingWindow"> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="border_width">6</property> - <property name="type_hint">dock</property> + <property name="border-width">6</property> + <property name="type-hint">dock</property> <child> - <placeholder/> - </child> - <child> - <placeholder/> + <object class="GtkBox" id="box"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <placeholder/> + </child> + </object> </child> </object> </interface> |