offapi/UnoApi_offapi.mk | 1 sd/IwyuFilter_sd.yaml | 2 sd/source/console/PresenterAccessibility.cxx | 8 +- sd/source/console/PresenterAccessibility.hxx | 8 +- sd/source/console/PresenterController.cxx | 4 - sd/source/console/PresenterController.hxx | 4 - sd/source/console/PresenterHelpView.cxx | 2 sd/source/console/PresenterHelpView.hxx | 2 sd/source/console/PresenterNotesView.cxx | 4 - sd/source/console/PresenterPane.cxx | 21 +++++-- sd/source/console/PresenterPane.hxx | 6 +- sd/source/console/PresenterPaneBase.cxx | 37 ++++++------ sd/source/console/PresenterPaneBase.hxx | 15 +---- sd/source/console/PresenterPaneBorderPainter.hxx | 2 sd/source/console/PresenterPaneFactory.cxx | 6 +- sd/source/console/PresenterPaneFactory.hxx | 4 - sd/source/console/PresenterSlidePreview.cxx | 2 sd/source/console/PresenterSlidePreview.hxx | 4 - sd/source/console/PresenterSlideShowView.cxx | 4 - sd/source/console/PresenterSlideShowView.hxx | 4 - sd/source/console/PresenterSlideSorter.cxx | 2 sd/source/console/PresenterSlideSorter.hxx | 2 sd/source/console/PresenterSpritePane.cxx | 23 +++++-- sd/source/console/PresenterSpritePane.hxx | 8 +- sd/source/console/PresenterToolBar.cxx | 4 - sd/source/console/PresenterToolBar.hxx | 2 sd/source/console/PresenterViewFactory.cxx | 18 ++---- sd/source/console/PresenterViewFactory.hxx | 8 +- sd/source/console/PresenterWindowManager.cxx | 2 sd/source/console/PresenterWindowManager.hxx | 4 - sd/source/ui/framework/configuration/Configuration.cxx | 3 + sd/source/ui/framework/factories/BasicPaneFactory.cxx | 8 +- sd/source/ui/framework/factories/BasicToolBarFactory.cxx | 2 sd/source/ui/framework/factories/BasicViewFactory.cxx | 8 +- sd/source/ui/framework/factories/ChildWindowPane.cxx | 13 ++-- sd/source/ui/framework/factories/ChildWindowPane.hxx | 5 - sd/source/ui/framework/factories/FullScreenPane.cxx | 15 +++-- sd/source/ui/framework/factories/FullScreenPane.hxx | 2 sd/source/ui/framework/factories/Pane.cxx | 42 +++++++------- sd/source/ui/framework/factories/ViewShellWrapper.cxx | 4 - sd/source/ui/inc/framework/AbstractPane.hxx | 24 ++++++-- sd/source/ui/inc/framework/Pane.hxx | 32 ++-------- sd/source/ui/inc/framework/factories/BasicViewFactory.hxx | 9 +-- sd/source/ui/view/ViewTabBar.cxx | 4 - sd/workben/custompanel/ctp_panel.cxx | 6 +- 45 files changed, 200 insertions(+), 190 deletions(-)
New commits: commit 3912b30e9897ae316e7efaade5c4af457155c85d Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Jun 24 08:47:37 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jun 24 12:51:57 2025 +0200 [API CHANGE] remove css::drawing::framework::XPane internal to sd, no need for it to use UNO Change-Id: I4cf96de4853fdb4095be4c3d1d534fede41cc07f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186869 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 4ca798637e0c..2aa818b87dcf 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2374,7 +2374,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/drawing,\ )) $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/drawing/framework,\ AnchorBindingMode \ - XPane \ XResource \ XResourceId \ XView \ diff --git a/sd/IwyuFilter_sd.yaml b/sd/IwyuFilter_sd.yaml index 166d467e5abc..eed4179b8ba0 100644 --- a/sd/IwyuFilter_sd.yaml +++ b/sd/IwyuFilter_sd.yaml @@ -217,7 +217,7 @@ excludelist: - com/sun/star/lang/XInitialization.hpp sd/source/ui/inc/framework/Pane.hxx: # base class has to be a complete type - - com/sun/star/drawing/framework/XPane.hpp + - com/sun/star/drawing/framework/AbstractPane.hpp - com/sun/star/lang/XUnoTunnel.hpp sd/source/ui/inc/framework/PresentationModule.hxx: # Needed for css shortcut diff --git a/sd/source/console/PresenterAccessibility.cxx b/sd/source/console/PresenterAccessibility.cxx index 3cacfe90eb0a..a30e3192bd9a 100644 --- a/sd/source/console/PresenterAccessibility.cxx +++ b/sd/source/console/PresenterAccessibility.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/accessibility/XAccessibleContext.hpp> #include <com/sun/star/accessibility/XAccessibleText.hpp> #include <com/sun/star/awt/XWindow2.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/drawing/framework/XView.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <cppuhelper/compbase.hxx> @@ -87,7 +87,7 @@ public: PresenterAccessible::PresenterAccessible( const rtl::Reference<PresenterController>& xPresenterController, - const Reference<drawing::framework::XPane>& rxMainPane) + const rtl::Reference<sd::framework::AbstractPane>& rxMainPane) : ImplInheritanceHelper(AccessibleRole::PANEL, SdResId(STR_A11Y_PRESENTER_CONSOLE)) , mpPresenterController(xPresenterController) , mxMainPane(rxMainPane) @@ -117,7 +117,7 @@ PresenterPaneContainer::SharedPaneDescriptor PresenterAccessible::GetPreviewPane return pPreviewPane; pPreviewPane = pContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL); - Reference<drawing::framework::XPane> xPreviewPane; + rtl::Reference<sd::framework::AbstractPane> xPreviewPane; if (pPreviewPane) xPreviewPane = pPreviewPane->mxPane.get(); if ( ! xPreviewPane.is()) @@ -265,7 +265,7 @@ void SAL_CALL PresenterAccessible::disposing() rtl::Reference<PresenterAccessible> PresenterAccessible::Create(const rtl::Reference<PresenterController>& xPresenterController, - const css::uno::Reference<css::drawing::framework::XPane>& rxMainPane) + const rtl::Reference<sd::framework::AbstractPane>& rxMainPane) { rtl::Reference<PresenterAccessible> pPresenterAcc = new PresenterAccessible(xPresenterController, rxMainPane); diff --git a/sd/source/console/PresenterAccessibility.hxx b/sd/source/console/PresenterAccessibility.hxx index 591a1c3a5bd1..6b210adf1230 100644 --- a/sd/source/console/PresenterAccessibility.hxx +++ b/sd/source/console/PresenterAccessibility.hxx @@ -25,7 +25,7 @@ #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/awt/XFocusListener.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/basemutex.hxx> #include <rtl/ref.hxx> @@ -41,12 +41,12 @@ class PresenterAccessible : public cppu::ImplInheritanceHelper<AccessibleObject, css::awt::XFocusListener> { PresenterAccessible(const rtl::Reference<PresenterController>& xPresenterController, - const css::uno::Reference<css::drawing::framework::XPane>& rxMainPane); + const rtl::Reference<sd::framework::AbstractPane>& rxMainPane); public: static rtl::Reference<PresenterAccessible> Create(const rtl::Reference<PresenterController>& xPresenterController, - const css::uno::Reference<css::drawing::framework::XPane>& rxMainPane); + const rtl::Reference<sd::framework::AbstractPane>& rxMainPane); virtual ~PresenterAccessible() override; @@ -68,7 +68,7 @@ public: private: ::rtl::Reference<PresenterController> mpPresenterController; - css::uno::Reference<css::drawing::framework::XPane> mxMainPane; + rtl::Reference<sd::framework::AbstractPane> mxMainPane; css::uno::Reference<css::awt::XWindow> mxMainWindow; css::uno::Reference<css::awt::XWindow> mxPreviewContentWindow; css::uno::Reference<css::awt::XWindow> mxPreviewBorderWindow; diff --git a/sd/source/console/PresenterController.cxx b/sd/source/console/PresenterController.cxx index c31efde050c5..d7eeb71f9904 100644 --- a/sd/source/console/PresenterController.cxx +++ b/sd/source/console/PresenterController.cxx @@ -680,7 +680,7 @@ void PresenterController::notifyConfigurationChange ( { // A pane bound to the main pane has been created and is // stored in the pane container. - Reference<XPane> xPane (rEvent.ResourceObject,UNO_QUERY); + rtl::Reference<sd::framework::AbstractPane> xPane = dynamic_cast<sd::framework::AbstractPane*>(rEvent.ResourceObject.get()); if (xPane.is()) { mpPaneContainer->FindPaneId(xPane->getResourceId()); @@ -1049,7 +1049,7 @@ void PresenterController::InitializeMainPane (const rtl::Reference<sd::framework UpdateCurrentSlide(0); } -void PresenterController::LoadTheme (const Reference<XPane>& rxPane) +void PresenterController::LoadTheme (const rtl::Reference<sd::framework::AbstractPane>& rxPane) { // Create (load) the current theme. if (rxPane.is()) diff --git a/sd/source/console/PresenterController.hxx b/sd/source/console/PresenterController.hxx index 54bda3338e2a..4d05ccbe82bf 100644 --- a/sd/source/console/PresenterController.hxx +++ b/sd/source/console/PresenterController.hxx @@ -33,7 +33,7 @@ #include <com/sun/star/presentation/XSlideShowController.hpp> #include <com/sun/star/frame/XFrameActionListener.hpp> #include <framework/ConfigurationChangeListener.hxx> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <rtl/ref.hxx> @@ -197,7 +197,7 @@ private: void GetSlides (const sal_Int32 nOffset); void UpdateViews(); void InitializeMainPane (const rtl::Reference<sd::framework::Pane>& rxPane); - void LoadTheme (const css::uno::Reference<css::drawing::framework::XPane>& rxPane); + void LoadTheme (const rtl::Reference<sd::framework::AbstractPane>& rxPane); void UpdatePendingSlideNumber (const sal_Int32 nPendingSlideNumber); /** This method is called when the user pressed one of the numerical diff --git a/sd/source/console/PresenterHelpView.cxx b/sd/source/console/PresenterHelpView.cxx index fb8d54c6f6b1..cf9fa4655752 100644 --- a/sd/source/console/PresenterHelpView.cxx +++ b/sd/source/console/PresenterHelpView.cxx @@ -135,7 +135,7 @@ PresenterHelpView::PresenterHelpView ( // Get the content window via the pane anchor. rtl::Reference<sd::framework::ConfigurationController> xCC ( rxController->getConfigurationController()); - mxPane.set(xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW); + mxPane = dynamic_cast<sd::framework::AbstractPane*>(xCC->getResource(rxViewId->getAnchor()).get()); mxWindow = mxPane->getWindow(); ProvideCanvas(); diff --git a/sd/source/console/PresenterHelpView.hxx b/sd/source/console/PresenterHelpView.hxx index e342e2c9945e..2829771f83eb 100644 --- a/sd/source/console/PresenterHelpView.hxx +++ b/sd/source/console/PresenterHelpView.hxx @@ -86,7 +86,7 @@ private: css::uno::Reference<css::uno::XComponentContext> mxComponentContext; css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; - css::uno::Reference<css::drawing::framework::XPane> mxPane; + rtl::Reference<sd::framework::AbstractPane> mxPane; css::uno::Reference<css::awt::XWindow> mxWindow; css::uno::Reference<css::rendering::XCanvas> mxCanvas; ::rtl::Reference<PresenterController> mpPresenterController; diff --git a/sd/source/console/PresenterNotesView.cxx b/sd/source/console/PresenterNotesView.cxx index 05c403202041..825cd765cb0b 100644 --- a/sd/source/console/PresenterNotesView.cxx +++ b/sd/source/console/PresenterNotesView.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/awt/Key.hpp> #include <com/sun/star/awt/KeyModifier.hpp> #include <com/sun/star/awt/PosSize.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/presentation/XPresentationPage.hpp> #include <com/sun/star/rendering/CompositeOperation.hpp> @@ -65,7 +65,7 @@ PresenterNotesView::PresenterNotesView ( try { rtl::Reference<sd::framework::ConfigurationController> xCC (rxController->getConfigurationController()); - Reference<XPane> xPane (xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW); + rtl::Reference<sd::framework::AbstractPane> xPane = dynamic_cast<sd::framework::AbstractPane*>(xCC->getResource(rxViewId->getAnchor()).get()); mxParentWindow = xPane->getWindow(); mxCanvas = xPane->getCanvas(); diff --git a/sd/source/console/PresenterPane.cxx b/sd/source/console/PresenterPane.cxx index d6dcba43eb8c..39d12d2f1acd 100644 --- a/sd/source/console/PresenterPane.cxx +++ b/sd/source/console/PresenterPane.cxx @@ -41,17 +41,23 @@ PresenterPane::~PresenterPane() { } -//----- XPane ----------------------------------------------------------------- +//----- AbstractPane ----------------------------------------------------------------- -Reference<awt::XWindow> SAL_CALL PresenterPane::getWindow() +Reference<awt::XWindow> PresenterPane::getWindow() { - ThrowIfDisposed(); + { + std::unique_lock l(m_aMutex); + throwIfDisposed(l); + } return mxContentWindow; } -Reference<rendering::XCanvas> SAL_CALL PresenterPane::getCanvas() +Reference<rendering::XCanvas> PresenterPane::getCanvas() { - ThrowIfDisposed(); + { + std::unique_lock l(m_aMutex); + throwIfDisposed(l); + } return mxContentCanvas; } @@ -110,7 +116,10 @@ void SAL_CALL PresenterPane::windowHidden (const lang::EventObject& rEvent) void SAL_CALL PresenterPane::windowPaint (const awt::PaintEvent& rEvent) { - ThrowIfDisposed(); + { + std::unique_lock l(m_aMutex); + throwIfDisposed(l); + } PaintBorder(rEvent.UpdateRect); } diff --git a/sd/source/console/PresenterPane.hxx b/sd/source/console/PresenterPane.hxx index 2a057229f802..9665f75e5123 100644 --- a/sd/source/console/PresenterPane.hxx +++ b/sd/source/console/PresenterPane.hxx @@ -40,11 +40,11 @@ public: const ::rtl::Reference<PresenterController>& rpPresenterController); virtual ~PresenterPane() override; - // XPane + // AbstractPane - css::uno::Reference<css::awt::XWindow> SAL_CALL getWindow() override; + css::uno::Reference<css::awt::XWindow> getWindow() override; - css::uno::Reference<css::rendering::XCanvas> SAL_CALL getCanvas() override; + css::uno::Reference<css::rendering::XCanvas> getCanvas() override; // XWindowListener diff --git a/sd/source/console/PresenterPaneBase.cxx b/sd/source/console/PresenterPaneBase.cxx index 545e38b2df3b..83c5a1d7f407 100644 --- a/sd/source/console/PresenterPaneBase.cxx +++ b/sd/source/console/PresenterPaneBase.cxx @@ -35,8 +35,7 @@ namespace sdext::presenter { PresenterPaneBase::PresenterPaneBase ( const Reference<XComponentContext>& rxContext, ::rtl::Reference<PresenterController> xPresenterController) - : PresenterPaneBaseInterfaceBase(m_aMutex), - mpPresenterController(std::move(xPresenterController)), + : mpPresenterController(std::move(xPresenterController)), mxComponentContext(rxContext) { } @@ -45,7 +44,7 @@ PresenterPaneBase::~PresenterPaneBase() { } -void PresenterPaneBase::disposing() +void PresenterPaneBase::disposing(std::unique_lock<std::mutex>&) { if (mxBorderWindow.is()) { @@ -107,7 +106,10 @@ void PresenterPaneBase::initialize( const rtl::Reference<PresenterPaneBorderPainter>& rxBorderPainter, bool bIsWindowVisibleOnCreation) { - ThrowIfDisposed(); + { + std::unique_lock l(m_aMutex); + throwIfDisposed(l); + } if ( ! mxComponentContext.is()) { @@ -140,7 +142,10 @@ void PresenterPaneBase::initialize( Reference<XResourceId> SAL_CALL PresenterPaneBase::getResourceId() { - ThrowIfDisposed(); + { + std::unique_lock l(m_aMutex); + throwIfDisposed(l); + } return mxPaneId; } @@ -153,22 +158,26 @@ sal_Bool SAL_CALL PresenterPaneBase::isAnchorOnly() void SAL_CALL PresenterPaneBase::windowResized (const awt::WindowEvent&) { - ThrowIfDisposed(); + std::unique_lock l(m_aMutex); + throwIfDisposed(l); } void SAL_CALL PresenterPaneBase::windowMoved (const awt::WindowEvent&) { - ThrowIfDisposed(); + std::unique_lock l(m_aMutex); + throwIfDisposed(l); } void SAL_CALL PresenterPaneBase::windowShown (const lang::EventObject&) { - ThrowIfDisposed(); + std::unique_lock l(m_aMutex); + throwIfDisposed(l); } void SAL_CALL PresenterPaneBase::windowHidden (const lang::EventObject&) { - ThrowIfDisposed(); + std::unique_lock l(m_aMutex); + throwIfDisposed(l); } //----- lang::XEventListener -------------------------------------------------- @@ -245,16 +254,6 @@ void PresenterPaneBase::LayoutContextWindow() awt::PosSize::POSSIZE); } -void PresenterPaneBase::ThrowIfDisposed() -{ - if (rBHelper.bDisposed || rBHelper.bInDispose) - { - throw lang::DisposedException ( - u"PresenterPane object has already been disposed"_ustr, - static_cast<uno::XWeak*>(this)); - } -} - } // end of namespace ::sdext::presenter /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/console/PresenterPaneBase.hxx b/sd/source/console/PresenterPaneBase.hxx index fdb2bb1a4fba..ec5baffa8e1b 100644 --- a/sd/source/console/PresenterPaneBase.hxx +++ b/sd/source/console/PresenterPaneBase.hxx @@ -24,10 +24,9 @@ #include <PresenterHelper.hxx> -#include <cppuhelper/basemutex.hxx> #include <cppuhelper/compbase.hxx> #include <com/sun/star/awt/XWindowListener.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/rendering/XCanvas.hpp> #include <rtl/ref.hxx> @@ -37,7 +36,7 @@ namespace sdext::presenter { class PresenterController; -typedef ::cppu::WeakComponentImplHelper<css::drawing::framework::XPane, css::awt::XWindowListener, +typedef ::cppu::ImplInheritanceHelper<sd::framework::AbstractPane, css::awt::XWindowListener, css::awt::XPaintListener> PresenterPaneBaseInterfaceBase; @@ -48,8 +47,7 @@ typedef ::cppu::WeakComponentImplHelper<css::drawing::framework::XPane, css::awt panes are painted by the PresenterPaneBorderPainter. */ class PresenterPaneBase - : protected ::cppu::BaseMutex, - public PresenterPaneBaseInterfaceBase + : public PresenterPaneBaseInterfaceBase { public: PresenterPaneBase ( @@ -59,7 +57,7 @@ public: PresenterPaneBase(const PresenterPaneBase&) = delete; PresenterPaneBase& operator=(const PresenterPaneBase&) = delete; - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; const css::uno::Reference<css::awt::XWindow>& GetBorderWindow() const; void SetTitle (const OUString& rsTitle); @@ -111,11 +109,6 @@ protected: void PaintBorder (const css::awt::Rectangle& rUpdateRectangle); void ToTop(); void LayoutContextWindow(); - - /** @throws css::lang::DisposedException when the object has already been - disposed. - */ - void ThrowIfDisposed(); }; } // end of namespace ::sd::presenter diff --git a/sd/source/console/PresenterPaneBorderPainter.hxx b/sd/source/console/PresenterPaneBorderPainter.hxx index a32737403462..81c8c0d162cb 100644 --- a/sd/source/console/PresenterPaneBorderPainter.hxx +++ b/sd/source/console/PresenterPaneBorderPainter.hxx @@ -114,7 +114,7 @@ public: class Renderer; - // XPaneBorderPainter + // AbstractPaneBorderPainter css::awt::Rectangle addBorder ( const OUString& rsPaneBorderStyleName, diff --git a/sd/source/console/PresenterPaneFactory.cxx b/sd/source/console/PresenterPaneFactory.cxx index 81a263e43f7e..4561ebd9579a 100644 --- a/sd/source/console/PresenterPaneFactory.cxx +++ b/sd/source/console/PresenterPaneFactory.cxx @@ -107,7 +107,7 @@ void PresenterPaneFactory::disposing(std::unique_lock<std::mutex>&) } } -//----- XPaneFactory ---------------------------------------------------------- +//----- AbstractPaneFactory ---------------------------------------------------------- Reference<XResource> PresenterPaneFactory::createResource ( const Reference<XResourceId>& rxPaneId) @@ -204,7 +204,7 @@ Reference<XResource> PresenterPaneFactory::CreatePane ( if ( ! xContext.is()) return nullptr; - Reference<XPane> xParentPane (xCC->getResource(rxPaneId->getAnchor()), UNO_QUERY); + rtl::Reference<sd::framework::AbstractPane> xParentPane = dynamic_cast<sd::framework::AbstractPane*>(xCC->getResource(rxPaneId->getAnchor()).get()); if ( ! xParentPane.is()) return nullptr; @@ -225,7 +225,7 @@ Reference<XResource> PresenterPaneFactory::CreatePane ( Reference<XResource> PresenterPaneFactory::CreatePane ( const Reference<XResourceId>& rxPaneId, - const Reference<drawing::framework::XPane>& rxParentPane, + const rtl::Reference<sd::framework::AbstractPane>& rxParentPane, const bool bIsSpritePane) { Reference<XComponentContext> xContext (mxComponentContextWeak); diff --git a/sd/source/console/PresenterPaneFactory.hxx b/sd/source/console/PresenterPaneFactory.hxx index 1ca88dd22990..b837c2c01427 100644 --- a/sd/source/console/PresenterPaneFactory.hxx +++ b/sd/source/console/PresenterPaneFactory.hxx @@ -21,7 +21,7 @@ #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEFACTORY_HXX #include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <framework/ResourceFactory.hxx> #include <com/sun/star/uno/XComponentContext.hpp> #include <rtl/ref.hxx> @@ -98,7 +98,7 @@ private: const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId); css::uno::Reference<css::drawing::framework::XResource> CreatePane ( const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, - const css::uno::Reference<css::drawing::framework::XPane>& rxParentPane, + const rtl::Reference<sd::framework::AbstractPane>& rxParentPane, const bool bIsSpritePane); }; diff --git a/sd/source/console/PresenterSlidePreview.cxx b/sd/source/console/PresenterSlidePreview.cxx index 4f8973135f04..df1e285c0f97 100644 --- a/sd/source/console/PresenterSlidePreview.cxx +++ b/sd/source/console/PresenterSlidePreview.cxx @@ -43,7 +43,7 @@ namespace sdext::presenter { PresenterSlidePreview::PresenterSlidePreview ( const Reference<XComponentContext>& rxContext, const Reference<XResourceId>& rxViewId, - const Reference<XPane>& rxAnchorPane, + const rtl::Reference<sd::framework::AbstractPane>& rxAnchorPane, const ::rtl::Reference<PresenterController>& rpPresenterController) : PresenterSlidePreviewInterfaceBase(m_aMutex), mpPresenterController(rpPresenterController), diff --git a/sd/source/console/PresenterSlidePreview.hxx b/sd/source/console/PresenterSlidePreview.hxx index 959d9faa285e..6d6221c65d07 100644 --- a/sd/source/console/PresenterSlidePreview.hxx +++ b/sd/source/console/PresenterSlidePreview.hxx @@ -27,7 +27,7 @@ #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawView.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/drawing/framework/XView.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/basemutex.hxx> @@ -57,7 +57,7 @@ public: PresenterSlidePreview ( const css::uno::Reference<css::uno::XComponentContext>& rxContext, const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, - const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane, + const rtl::Reference<sd::framework::AbstractPane>& rxAnchorPane, const ::rtl::Reference<PresenterController>& rpPresenterController); virtual ~PresenterSlidePreview() override; PresenterSlidePreview(const PresenterSlidePreview&) = delete; diff --git a/sd/source/console/PresenterSlideShowView.cxx b/sd/source/console/PresenterSlideShowView.cxx index fe6089203988..82e01f8a0270 100644 --- a/sd/source/console/PresenterSlideShowView.cxx +++ b/sd/source/console/PresenterSlideShowView.cxx @@ -112,9 +112,9 @@ void PresenterSlideShowView::LateInit() if (xCC.is()) { - mxTopPane.set(xCC->getResource(mxViewId->getAnchor()->getAnchor()), UNO_QUERY); + mxTopPane = dynamic_cast<sd::framework::AbstractPane*>(xCC->getResource(mxViewId->getAnchor()->getAnchor()).get()); - Reference<XPane> xPane (xCC->getResource(mxViewId->getAnchor()), UNO_QUERY_THROW); + rtl::Reference<sd::framework::AbstractPane> xPane = dynamic_cast<sd::framework::AbstractPane*>(xCC->getResource(mxViewId->getAnchor()).get()); mxWindow = xPane->getWindow(); mxCanvas = xPane->getCanvas(); diff --git a/sd/source/console/PresenterSlideShowView.hxx b/sd/source/console/PresenterSlideShowView.hxx index 7551243812c0..632bb243630c 100644 --- a/sd/source/console/PresenterSlideShowView.hxx +++ b/sd/source/console/PresenterSlideShowView.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/awt/XPointer.hpp> #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/drawing/XDrawView.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/drawing/framework/XResourceId.hpp> #include <com/sun/star/drawing/framework/XView.hpp> #include <com/sun/star/frame/XController.hpp> @@ -184,7 +184,7 @@ private: css::uno::Reference<css::awt::XPointer> mxPointer; css::uno::Reference<css::awt::XWindow> mxWindow; css::uno::Reference<css::awt::XWindow> mxViewWindow; - css::uno::Reference<css::drawing::framework::XPane> mxTopPane; + rtl::Reference<sd::framework::AbstractPane> mxTopPane; css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon1; css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon2; bool mbIsViewAdded; diff --git a/sd/source/console/PresenterSlideSorter.cxx b/sd/source/console/PresenterSlideSorter.cxx index 9e2b28dd6601..7cd70cc9a2fe 100644 --- a/sd/source/console/PresenterSlideSorter.cxx +++ b/sd/source/console/PresenterSlideSorter.cxx @@ -259,7 +259,7 @@ PresenterSlideSorter::PresenterSlideSorter ( Reference<lang::XMultiComponentFactory> xFactory ( mxComponentContext->getServiceManager(), UNO_SET_THROW); - mxPane.set(xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW); + mxPane = dynamic_cast<sd::framework::AbstractPane*>(xCC->getResource(rxViewId->getAnchor()).get()); mxWindow = mxPane->getWindow(); // Add window listener. diff --git a/sd/source/console/PresenterSlideSorter.hxx b/sd/source/console/PresenterSlideSorter.hxx index 9fe404d819bf..cb2fa7ce507a 100644 --- a/sd/source/console/PresenterSlideSorter.hxx +++ b/sd/source/console/PresenterSlideSorter.hxx @@ -132,7 +132,7 @@ public: private: css::uno::Reference<css::uno::XComponentContext> mxComponentContext; css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; - css::uno::Reference<css::drawing::framework::XPane> mxPane; + rtl::Reference<sd::framework::AbstractPane> mxPane; css::uno::Reference<css::rendering::XCanvas> mxCanvas; css::uno::Reference<css::awt::XWindow> mxWindow; ::rtl::Reference<PresenterController> mpPresenterController; diff --git a/sd/source/console/PresenterSpritePane.cxx b/sd/source/console/PresenterSpritePane.cxx index 4b97b85208af..58b546a74a05 100644 --- a/sd/source/console/PresenterSpritePane.cxx +++ b/sd/source/console/PresenterSpritePane.cxx @@ -40,24 +40,30 @@ PresenterSpritePane::~PresenterSpritePane() { } -void PresenterSpritePane::disposing() +void PresenterSpritePane::disposing(std::unique_lock<std::mutex>& l) { mpSprite->SetFactory(nullptr); mxParentCanvas = nullptr; - PresenterPaneBase::disposing(); + PresenterPaneBase::disposing(l); } -//----- XPane ----------------------------------------------------------------- +//----- AbstractPane ----------------------------------------------------------------- -Reference<awt::XWindow> SAL_CALL PresenterSpritePane::getWindow() +Reference<awt::XWindow> PresenterSpritePane::getWindow() { - ThrowIfDisposed(); + { + std::unique_lock l(m_aMutex); + throwIfDisposed(l); + } return mxContentWindow; } -Reference<rendering::XCanvas> SAL_CALL PresenterSpritePane::getCanvas() +Reference<rendering::XCanvas> PresenterSpritePane::getCanvas() { - ThrowIfDisposed(); + { + std::unique_lock l(m_aMutex); + throwIfDisposed(l); + } if ( ! mxContentCanvas.is()) UpdateCanvases(); @@ -113,7 +119,8 @@ void SAL_CALL PresenterSpritePane::windowHidden (const lang::EventObject& rEvent void SAL_CALL PresenterSpritePane::windowPaint (const awt::PaintEvent&) { - ThrowIfDisposed(); + std::unique_lock l(m_aMutex); + throwIfDisposed(l); /* Reference<rendering::XSpriteCanvas> xSpriteCanvas (mxParentCanvas, UNO_QUERY); diff --git a/sd/source/console/PresenterSpritePane.hxx b/sd/source/console/PresenterSpritePane.hxx index 1c2c923b942a..4891b05e715a 100644 --- a/sd/source/console/PresenterSpritePane.hxx +++ b/sd/source/console/PresenterSpritePane.hxx @@ -41,15 +41,15 @@ public: const ::rtl::Reference<PresenterController>& rpPresenterController); virtual ~PresenterSpritePane() override; - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; using PresenterPaneBase::disposing; - // XPane + // AbstractPane - virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getWindow() override; + virtual css::uno::Reference<css::awt::XWindow> getWindow() override; - virtual css::uno::Reference<css::rendering::XCanvas> SAL_CALL getCanvas() override; + virtual css::uno::Reference<css::rendering::XCanvas> getCanvas() override; // XWindowListener diff --git a/sd/source/console/PresenterToolBar.cxx b/sd/source/console/PresenterToolBar.cxx index 1e08d1ae9299..a0a2d218ded6 100644 --- a/sd/source/console/PresenterToolBar.cxx +++ b/sd/source/console/PresenterToolBar.cxx @@ -32,7 +32,7 @@ #include <cppuhelper/compbase.hxx> #include <com/sun/star/awt/XWindowPeer.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/geometry/AffineMatrix2D.hpp> #include <com/sun/star/rendering/CompositeOperation.hpp> #include <com/sun/star/rendering/RenderState.hpp> @@ -933,7 +933,7 @@ PresenterToolBarView::PresenterToolBarView ( try { rtl::Reference<sd::framework::ConfigurationController> xCC(rxController->getConfigurationController()); - mxPane.set(xCC->getResource(rxViewId->getAnchor()), UNO_QUERY_THROW); + mxPane = dynamic_cast<sd::framework::AbstractPane*>(xCC->getResource(rxViewId->getAnchor()).get()); mxWindow = mxPane->getWindow(); mxCanvas = mxPane->getCanvas(); diff --git a/sd/source/console/PresenterToolBar.hxx b/sd/source/console/PresenterToolBar.hxx index eef4b52d52a9..fb415f324a7b 100644 --- a/sd/source/console/PresenterToolBar.hxx +++ b/sd/source/console/PresenterToolBar.hxx @@ -229,7 +229,7 @@ public: private: // css::uno::Reference<css::uno::XComponentContext> mxComponentContext; - css::uno::Reference<css::drawing::framework::XPane> mxPane; + rtl::Reference<sd::framework::AbstractPane> mxPane; css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; css::uno::Reference<css::awt::XWindow> mxWindow; css::uno::Reference<css::rendering::XCanvas> mxCanvas; diff --git a/sd/source/console/PresenterViewFactory.cxx b/sd/source/console/PresenterViewFactory.cxx index c82f1661e65a..a27fd674d9fc 100644 --- a/sd/source/console/PresenterViewFactory.cxx +++ b/sd/source/console/PresenterViewFactory.cxx @@ -47,7 +47,7 @@ public: NextSlidePreview ( const css::uno::Reference<css::uno::XComponentContext>& rxContext, const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, - const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane, + const rtl::Reference<sd::framework::AbstractPane>& rxAnchorPane, const ::rtl::Reference<PresenterController>& rpPresenterController) : PresenterSlidePreview(rxContext, rxViewId, rxAnchorPane, rpPresenterController) { @@ -185,9 +185,8 @@ Reference<XResource> PresenterViewFactory::createResource ( if (rxViewId.is()) { - Reference<XPane> xAnchorPane ( - mxConfigurationController->getResource(rxViewId->getAnchor()), - UNO_QUERY_THROW); + rtl::Reference<sd::framework::AbstractPane> xAnchorPane = dynamic_cast<sd::framework::AbstractPane*>( + mxConfigurationController->getResource(rxViewId->getAnchor()).get()); xView = GetViewFromCache(rxViewId, xAnchorPane); if (xView == nullptr) xView = CreateView(rxViewId, xAnchorPane); @@ -244,9 +243,8 @@ void PresenterViewFactory::releaseResource (const Reference<XResource>& rxView) Reference<XResourceId> xViewId (rxView->getResourceId()); if (xViewId.is()) { - Reference<XPane> xAnchorPane ( - mxConfigurationController->getResource(xViewId->getAnchor()), - UNO_QUERY_THROW); + rtl::Reference<sd::framework::AbstractPane> xAnchorPane = dynamic_cast<sd::framework::AbstractPane*>( + mxConfigurationController->getResource(xViewId->getAnchor()).get()); (*mpResourceCache)[xViewId->getResourceURL()] = ViewResourceDescriptor(Reference<XView>(rxView, UNO_QUERY), xAnchorPane); pView->DeactivatePresenterView(); @@ -257,7 +255,7 @@ void PresenterViewFactory::releaseResource (const Reference<XResource>& rxView) Reference<XResource> PresenterViewFactory::GetViewFromCache( const Reference<XResourceId>& rxViewId, - const Reference<XPane>& rxAnchorPane) const + const rtl::Reference<sd::framework::AbstractPane>& rxAnchorPane) const { if (mpResourceCache == nullptr) return nullptr; @@ -293,7 +291,7 @@ Reference<XResource> PresenterViewFactory::GetViewFromCache( Reference<XResource> PresenterViewFactory::CreateView( const Reference<XResourceId>& rxViewId, - const Reference<XPane>& rxAnchorPane) + const rtl::Reference<sd::framework::AbstractPane>& rxAnchorPane) { Reference<XView> xView; @@ -367,7 +365,7 @@ Reference<XView> PresenterViewFactory::CreateSlideShowView( Reference<XView> PresenterViewFactory::CreateSlidePreviewView( const Reference<XResourceId>& rxViewId, - const Reference<XPane>& rxAnchorPane) const + const rtl::Reference<sd::framework::AbstractPane>& rxAnchorPane) const { Reference<XView> xView; diff --git a/sd/source/console/PresenterViewFactory.hxx b/sd/source/console/PresenterViewFactory.hxx index 03c03e4f9993..2a31442b2183 100644 --- a/sd/source/console/PresenterViewFactory.hxx +++ b/sd/source/console/PresenterViewFactory.hxx @@ -109,7 +109,7 @@ private: unotools::WeakReference<::sd::DrawController> mxControllerWeak; ::rtl::Reference<PresenterController> mpPresenterController; typedef ::std::pair<css::uno::Reference<css::drawing::framework::XView>, - css::uno::Reference<css::drawing::framework::XPane> > ViewResourceDescriptor; + rtl::Reference<sd::framework::AbstractPane> > ViewResourceDescriptor; typedef ::std::map<OUString, ViewResourceDescriptor> ResourceContainer; std::unique_ptr<ResourceContainer> mpResourceCache; @@ -125,7 +125,7 @@ private: css::uno::Reference<css::drawing::framework::XView> CreateSlidePreviewView( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, - const css::uno::Reference<css::drawing::framework::XPane>& rxPane) const; + const rtl::Reference<sd::framework::AbstractPane>& rxPane) const; css::uno::Reference<css::drawing::framework::XView> CreateToolBarView( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId) const; @@ -141,10 +141,10 @@ private: css::uno::Reference<css::drawing::framework::XResource> GetViewFromCache ( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, - const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane) const; + const rtl::Reference<sd::framework::AbstractPane>& rxAnchorPane) const; css::uno::Reference<css::drawing::framework::XResource> CreateView( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, - const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane); + const rtl::Reference<sd::framework::AbstractPane>& rxAnchorPane); }; } diff --git a/sd/source/console/PresenterWindowManager.cxx b/sd/source/console/PresenterWindowManager.cxx index 721fe7b6ed9d..c55381c9671a 100644 --- a/sd/source/console/PresenterWindowManager.cxx +++ b/sd/source/console/PresenterWindowManager.cxx @@ -93,7 +93,7 @@ void SAL_CALL PresenterWindowManager::disposing() } void PresenterWindowManager::SetParentPane ( - const Reference<drawing::framework::XPane>& rxPane) + const rtl::Reference<sd::framework::AbstractPane>& rxPane) { if (mxParentWindow.is()) { diff --git a/sd/source/console/PresenterWindowManager.hxx b/sd/source/console/PresenterWindowManager.hxx index 3d227f8afe48..673e86ddb8f1 100644 --- a/sd/source/console/PresenterWindowManager.hxx +++ b/sd/source/console/PresenterWindowManager.hxx @@ -28,7 +28,7 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/document/XEventListener.hpp> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/rendering/XBitmap.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/basemutex.hxx> @@ -68,7 +68,7 @@ public: void SAL_CALL disposing() override; - void SetParentPane (const css::uno::Reference<css::drawing::framework::XPane>& rxPane); + void SetParentPane (const rtl::Reference<sd::framework::AbstractPane>& rxPane); void SetTheme (const std::shared_ptr<PresenterTheme>& rpTheme); void NotifyViewCreation (const css::uno::Reference<css::drawing::framework::XView>& rxView); void SetPanePosSizeAbsolute ( diff --git a/sd/source/ui/framework/configuration/Configuration.cxx b/sd/source/ui/framework/configuration/Configuration.cxx index e833649dd39b..3b08c9689119 100644 --- a/sd/source/ui/framework/configuration/Configuration.cxx +++ b/sd/source/ui/framework/configuration/Configuration.cxx @@ -21,6 +21,7 @@ #include <framework/ConfigurationChangeEvent.hxx> #include <framework/FrameworkHelper.hxx> #include <framework/ConfigurationController.hxx> +#include <framework/AbstractPane.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/supportsservice.hxx> @@ -280,6 +281,8 @@ ConfigurationChangeListener::~ConfigurationChangeListener() {} ConfigurationChangeRequest::~ConfigurationChangeRequest() {} +AbstractPane::~AbstractPane() {} + } // end of namespace sd::framework diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 9dd7cf160901..f506d04bfdb8 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -57,7 +57,7 @@ namespace { namespace sd::framework { -/** Store URL, XPane reference and (local) PaneId for every pane factory +/** Store URL, AbstractPane reference and (local) PaneId for every pane factory that is registered at the PaneController. */ class BasicPaneFactory::PaneDescriptor @@ -171,7 +171,7 @@ void BasicPaneFactory::disposing(std::unique_lock<std::mutex>&) } } -//===== XPaneFactory ========================================================== +//===== AbstractPaneFactory ========================================================== Reference<XResource> BasicPaneFactory::createResource ( const Reference<XResourceId>& rxPaneId) @@ -244,7 +244,7 @@ void BasicPaneFactory::releaseResource ( { ThrowIfDisposed(); - // Based on the given XPane reference look up the corresponding factory + // Based on the given AbstractPane reference look up the corresponding factory // descriptor. PaneContainer::iterator iDescriptor ( ::std::find_if( @@ -254,7 +254,7 @@ void BasicPaneFactory::releaseResource ( if (iDescriptor == maPaneContainer.end()) { - // The given XPane reference is either empty or the pane was not + // The given AbstractPane reference is either empty or the pane was not // created by any of the factories managed by the called // BasicPaneFactory object. throw lang::IllegalArgumentException(u"BasicPaneFactory::releasePane() called for pane that was not created by same factory."_ustr, diff --git a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx index eb0ad8fb33b5..89222cb1fa55 100644 --- a/sd/source/ui/framework/factories/BasicToolBarFactory.cxx +++ b/sd/source/ui/framework/factories/BasicToolBarFactory.cxx @@ -100,7 +100,7 @@ void SAL_CALL BasicToolBarFactory::disposing ( mxConfigurationController = nullptr; } -//===== XPaneFactory ========================================================== +//===== AbstractPaneFactory ========================================================== Reference<XResource> BasicToolBarFactory::createResource ( const Reference<XResourceId>& rxToolBarId) diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 786f323a7a10..3e665ce4b232 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -139,9 +139,9 @@ Reference<XResource> BasicViewFactory::createResource ( rxViewId->isBoundToURL(FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT)); // Get the pane for the anchor URL. - Reference<XPane> xPane; + rtl::Reference<AbstractPane> xPane; if (mxConfigurationController.is()) - xPane.set(mxConfigurationController->getResource(rxViewId->getAnchor()), UNO_QUERY); + xPane = dynamic_cast<AbstractPane*>(mxConfigurationController->getResource(rxViewId->getAnchor()).get()); // For main views use the frame view of the last main view. ::sd::FrameView* pFrameView = nullptr; @@ -232,7 +232,7 @@ void BasicViewFactory::releaseResource (const Reference<XResource>& rxView) std::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::CreateView ( const Reference<XResourceId>& rxViewId, vcl::Window& rWindow, - const Reference<XPane>& rxPane, + const rtl::Reference<AbstractPane>& rxPane, FrameView* pFrameView, const bool bIsCenterPane) { @@ -414,7 +414,7 @@ bool BasicViewFactory::IsCacheable (const std::shared_ptr<ViewDescriptor>& rpDes std::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::GetViewFromCache ( const Reference<XResourceId>& rxViewId, - const Reference<XPane>& rxPane) + const rtl::Reference<AbstractPane>& rxPane) { std::shared_ptr<ViewDescriptor> pDescriptor; diff --git a/sd/source/ui/framework/factories/ChildWindowPane.cxx b/sd/source/ui/framework/factories/ChildWindowPane.cxx index 791dcdeb2000..ab4fb062add3 100644 --- a/sd/source/ui/framework/factories/ChildWindowPane.cxx +++ b/sd/source/ui/framework/factories/ChildWindowPane.cxx @@ -102,10 +102,8 @@ void ChildWindowPane::Hide() mxWindow = nullptr; } -void SAL_CALL ChildWindowPane::disposing() +void ChildWindowPane::disposing(std::unique_lock<std::mutex>& l) { - ::osl::MutexGuard aGuard (m_aMutex); - mrViewShellBase.GetViewShellManager()->DeactivateShell(mpShell.get()); mpShell.reset(); @@ -114,7 +112,7 @@ void SAL_CALL ChildWindowPane::disposing() mxWindow->removeEventListener(this); } - Pane::disposing(); + Pane::disposing(l); } vcl::Window* ChildWindowPane::GetWindow() @@ -180,7 +178,7 @@ vcl::Window* ChildWindowPane::GetWindow() return mpWindow; } -Reference<awt::XWindow> SAL_CALL ChildWindowPane::getWindow() +Reference<awt::XWindow> ChildWindowPane::getWindow() { if (mpWindow == nullptr || ! mxWindow.is()) GetWindow(); @@ -191,7 +189,10 @@ Reference<awt::XWindow> SAL_CALL ChildWindowPane::getWindow() void SAL_CALL ChildWindowPane::disposing (const lang::EventObject& rEvent) { - ThrowIfDisposed(); + { + std::unique_lock l(m_aMutex); + throwIfDisposed(l); + } if (rEvent.Source == mxWindow) { diff --git a/sd/source/ui/framework/factories/ChildWindowPane.hxx b/sd/source/ui/framework/factories/ChildWindowPane.hxx index 184d17d1a65e..70582e12e1d4 100644 --- a/sd/source/ui/framework/factories/ChildWindowPane.hxx +++ b/sd/source/ui/framework/factories/ChildWindowPane.hxx @@ -57,7 +57,7 @@ public: */ void Hide(); - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; /** This returns the content window when the child window is already visible. Otherwise <NULL/> is returned. In that case a later call @@ -71,8 +71,7 @@ public: /** The local getWindow() first calls GetWindow() to provide a valid window pointer before forwarding the call to the base class. */ - virtual css::uno::Reference<css::awt::XWindow> - SAL_CALL getWindow() override; + virtual css::uno::Reference<css::awt::XWindow> getWindow() override; // XEventListener diff --git a/sd/source/ui/framework/factories/FullScreenPane.cxx b/sd/source/ui/framework/factories/FullScreenPane.cxx index 56658a221322..6c90b827ec08 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.cxx +++ b/sd/source/ui/framework/factories/FullScreenPane.cxx @@ -24,6 +24,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <strings.hrc> @@ -104,7 +105,7 @@ FullScreenPane::~FullScreenPane() noexcept { } -void SAL_CALL FullScreenPane::disposing() +void FullScreenPane::disposing(std::unique_lock<std::mutex>& l) { mpWindow.disposeAndClear(); @@ -115,12 +116,15 @@ void SAL_CALL FullScreenPane::disposing() mpWorkWindow.disposeAndClear(); } - FrameWindowPane::disposing(); + FrameWindowPane::disposing(l); } bool FullScreenPane::isVisible() { - ThrowIfDisposed(); + { + std::unique_lock aGuard (m_aMutex); + throwIfDisposed(aGuard); + } if (mpWindow != nullptr) return mpWindow->IsReallyVisible(); @@ -130,7 +134,10 @@ bool FullScreenPane::isVisible() void FullScreenPane::setVisible (const bool bIsVisible) { - ThrowIfDisposed(); + { + std::unique_lock aGuard (m_aMutex); + throwIfDisposed(aGuard); + } if (mpWindow != nullptr) mpWindow->Show(bIsVisible); diff --git a/sd/source/ui/framework/factories/FullScreenPane.hxx b/sd/source/ui/framework/factories/FullScreenPane.hxx index 955a43b9c1e1..780272412bfc 100644 --- a/sd/source/ui/framework/factories/FullScreenPane.hxx +++ b/sd/source/ui/framework/factories/FullScreenPane.hxx @@ -57,7 +57,7 @@ public: const DrawDocShell* pDrawDocShell); virtual ~FullScreenPane() noexcept override; - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; virtual bool isVisible() override; diff --git a/sd/source/ui/framework/factories/Pane.cxx b/sd/source/ui/framework/factories/Pane.cxx index 417e4e8c7e25..85c91e01adfc 100644 --- a/sd/source/ui/framework/factories/Pane.cxx +++ b/sd/source/ui/framework/factories/Pane.cxx @@ -37,8 +37,7 @@ Pane::Pane ( const Reference<XResourceId>& rxPaneId, vcl::Window* pWindow) noexcept - : PaneInterfaceBase(m_aMutex), - mxPaneId(rxPaneId), + : mxPaneId(rxPaneId), mpWindow(pWindow), mxWindow(VCLUnoHelper::GetInterface(pWindow)) { @@ -48,7 +47,7 @@ Pane::~Pane() { } -void Pane::disposing() +void Pane::disposing(std::unique_lock<std::mutex>&) { mxWindow = nullptr; mpWindow = nullptr; @@ -62,19 +61,20 @@ vcl::Window* Pane::GetWindow() return nullptr; } -//----- XPane ----------------------------------------------------------------- +//----- AbstractPane ----------------------------------------------------------------- -Reference<awt::XWindow> SAL_CALL Pane::getWindow() +Reference<awt::XWindow> Pane::getWindow() { - ThrowIfDisposed(); + std::unique_lock aGuard (m_aMutex); + throwIfDisposed(aGuard); return mxWindow; } -Reference<rendering::XCanvas> SAL_CALL Pane::getCanvas() +Reference<rendering::XCanvas> Pane::getCanvas() { - ::osl::MutexGuard aGuard (m_aMutex); - ThrowIfDisposed(); + std::unique_lock aGuard (m_aMutex); + throwIfDisposed(aGuard); if ( ! mxCanvas.is()) mxCanvas = CreateCanvas(); @@ -84,7 +84,10 @@ Reference<rendering::XCanvas> SAL_CALL Pane::getCanvas() bool Pane::isVisible() { - ThrowIfDisposed(); + { + std::unique_lock aGuard (m_aMutex); + throwIfDisposed(aGuard); + } const vcl::Window* pWindow = GetWindow(); if (pWindow != nullptr) @@ -95,7 +98,10 @@ bool Pane::isVisible() void Pane::setVisible (bool bIsVisible) { - ThrowIfDisposed(); + { + std::unique_lock aGuard (m_aMutex); + throwIfDisposed(aGuard); + } vcl::Window* pWindow = GetWindow(); if (pWindow != nullptr) @@ -106,7 +112,10 @@ void Pane::setVisible (bool bIsVisible) Reference<XResourceId> SAL_CALL Pane::getResourceId() { - ThrowIfDisposed(); + { + std::unique_lock aGuard (m_aMutex); + throwIfDisposed(aGuard); + } return mxPaneId; } @@ -131,15 +140,6 @@ Reference<rendering::XCanvas> Pane::CreateCanvas() return xCanvas; } -void Pane::ThrowIfDisposed() const -{ - if (rBHelper.bDisposed || rBHelper.bInDispose) - { - throw lang::DisposedException (u"Pane object has already been disposed"_ustr, - const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this))); - } -} - ResourceFactory::~ResourceFactory() {} } // end of namespace sd::framework diff --git a/sd/source/ui/framework/factories/ViewShellWrapper.cxx b/sd/source/ui/framework/factories/ViewShellWrapper.cxx index 7e3939a131ed..f47463736e51 100644 --- a/sd/source/ui/framework/factories/ViewShellWrapper.cxx +++ b/sd/source/ui/framework/factories/ViewShellWrapper.cxx @@ -28,7 +28,7 @@ #include <model/SlsPageEnumerationProvider.hxx> #include <model/SlsPageDescriptor.hxx> -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <framework/AbstractPane.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <toolkit/helper/vclunohelper.hxx> @@ -176,7 +176,7 @@ bool ViewShellWrapper::relocateToAnchor ( { bool bResult (false); - Reference<XPane> xPane (xResource, UNO_QUERY); + rtl::Reference<AbstractPane> xPane (dynamic_cast<AbstractPane*>(xResource.get())); if (xPane.is()) { // Detach from the window of the old pane. diff --git a/offapi/com/sun/star/drawing/framework/XPane.idl b/sd/source/ui/inc/framework/AbstractPane.hxx similarity index 73% rename from offapi/com/sun/star/drawing/framework/XPane.idl rename to sd/source/ui/inc/framework/AbstractPane.hxx index 48c90101e2ab..cbf9fe83ac06 100644 --- a/offapi/com/sun/star/drawing/framework/XPane.idl +++ b/sd/source/ui/inc/framework/AbstractPane.hxx @@ -17,7 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -module com { module sun { module star { module drawing { module framework { +#pragma once + +#include <com/sun/star/drawing/framework/XResource.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/rendering/XCanvas.hpp> +#include <comphelper/compbase.hxx> +#include <sddllapi.h> + +namespace sd::framework +{ +typedef comphelper::WeakComponentImplHelper<css::drawing::framework::XResource> + AbstractPaneInterfaceBase; /** A pane is an abstraction of a window and is one of the resources managed by the drawing framework. @@ -25,14 +36,15 @@ module com { module sun { module star { module drawing { module framework { parts like title, menu, close button.</p> <p>The URL prefix of panes is <code>private:resource/floater</code></p> */ -interface XPane +class SD_DLLPUBLIC AbstractPane : public AbstractPaneInterfaceBase { - interface XResource; +public: + virtual ~AbstractPane() override; /** Return the com::sun::star::awt::XWindow of the pane that is used to display a view. */ - ::com::sun::star::awt::XWindow getWindow (); + virtual css::uno::Reference<css::awt::XWindow> getWindow() = 0; /** Return the com::sun::star::awt::XCanvas of the pane. The com::sun::star::rendering::XCanvas object is expected to @@ -42,9 +54,9 @@ interface XPane When the com::sun::star::rendering::XCanvas interface is not supported then an empty reference is returned. */ - ::com::sun::star::rendering::XCanvas getCanvas (); + virtual css::uno::Reference<css::rendering::XCanvas> getCanvas() = 0; }; -}; }; }; }; }; // ::com::sun::star::drawing::framework +} // end of namespace sd::framework /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/framework/Pane.hxx b/sd/source/ui/inc/framework/Pane.hxx index a55d9b1d89cd..8188925496b4 100644 --- a/sd/source/ui/inc/framework/Pane.hxx +++ b/sd/source/ui/inc/framework/Pane.hxx @@ -20,23 +20,17 @@ #pragma once #include <sddllapi.h> -#include <com/sun/star/drawing/framework/XPane.hpp> -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase.hxx> +#include <framework/AbstractPane.hxx> #include <vcl/vclptr.hxx> #include <vcl/window.hxx> namespace sd::framework { -typedef ::cppu::WeakComponentImplHelper < - css::drawing::framework::XPane - > PaneInterfaceBase; - /** A pane is a wrapper for a window and possibly for a tab bar (for view switching). Panes are unique resources. This class has two responsibilities: - 1. It implements the XPane interface. This is the most important + 1. It implements the AbstractPane interface. This is the most important interface of this class for API based views (of which there not that many yet) because it gives access to the XWindow. 2. It gives access to the underlying VCL Window. @@ -45,8 +39,7 @@ typedef ::cppu::WeakComponentImplHelper < on direct access on the Window class. */ class SD_DLLPUBLIC Pane - : protected cppu::BaseMutex, - public PaneInterfaceBase + : public sd::framework::AbstractPane { public: /** Create a new Pane object that wraps the given window. @@ -64,24 +57,22 @@ public: noexcept; virtual ~Pane() override; - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; /** This method is typically used to obtain - a Window pointer from an XPane object. + a Window pointer from an AbstractPane object. */ virtual vcl::Window* GetWindow(); - //----- XPane ------------------------------------------------------------- + //----- AbstractPane ------------------------------------------------------------- /** For a UNO API based implementation of a view this may the most important method of this class because the view is only interested in the window of the pane. */ - virtual css::uno::Reference<css::awt::XWindow> - SAL_CALL getWindow() override; + virtual css::uno::Reference<css::awt::XWindow> getWindow() override; - virtual css::uno::Reference<css::rendering::XCanvas> - SAL_CALL getCanvas() override; + virtual css::uno::Reference<css::rendering::XCanvas> getCanvas() override; /** Return whether all windows that are used to implement the pane are visible. @@ -122,13 +113,6 @@ protected: virtual css::uno::Reference<css::rendering::XCanvas> CreateCanvas(); - /** Throw DisposedException when the object has already been disposed or - is currently being disposed. Otherwise this method returns - normally. - - @throws css::lang::DisposedException - */ - void ThrowIfDisposed() const; }; } // end of namespace sd::framework diff --git a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx index d2d45579676f..a57c498f0ea6 100644 --- a/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx +++ b/sd/source/ui/inc/framework/factories/BasicViewFactory.hxx @@ -24,8 +24,6 @@ #include <vcl/vclptr.hxx> #include <memory> -namespace com::sun::star::drawing::framework { class XPane; } - namespace sd { class DrawController; class ViewShell; @@ -37,6 +35,7 @@ namespace vcl { class Window; } namespace sd::framework { class ConfigurationController; +class AbstractPane; /** Factory for the frequently used standard views of the drawing framework: private:resource/view/ @@ -80,12 +79,12 @@ private: ScopedVclPtr<vcl::Window> mpWindow; std::shared_ptr<ViewCache> mpViewCache; - css::uno::Reference<css::drawing::framework::XPane> mxLocalPane; + rtl::Reference<framework::AbstractPane> mxLocalPane; std::shared_ptr<ViewDescriptor> CreateView ( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, vcl::Window& rWindow, - const css::uno::Reference<css::drawing::framework::XPane>& rxPane, + const rtl::Reference<framework::AbstractPane>& rxPane, FrameView* pFrameView, const bool bIsCenterView); @@ -106,7 +105,7 @@ private: std::shared_ptr<ViewDescriptor> GetViewFromCache ( const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, - const css::uno::Reference<css::drawing::framework::XPane>& rxPane); + const rtl::Reference<AbstractPane>& rxPane); }; } // end of namespace sd::framework diff --git a/sd/source/ui/view/ViewTabBar.cxx b/sd/source/ui/view/ViewTabBar.cxx index e5893e0dfd2f..0f5859ed469d 100644 --- a/sd/source/ui/view/ViewTabBar.cxx +++ b/sd/source/ui/view/ViewTabBar.cxx @@ -161,13 +161,13 @@ vcl::Window* ViewTabBar::GetAnchorWindow( // The rest is (at the moment) just for the emergency case. if (pWindow == nullptr) { - Reference<XPane> xPane; + rtl::Reference<framework::AbstractPane> xPane; try { rtl::Reference<framework::ConfigurationController> xCC ( rxController->getConfigurationController()); if (xCC.is()) - xPane.set(xCC->getResource(rxViewTabBarId->getAnchor()), UNO_QUERY); + xPane = dynamic_cast<framework::AbstractPane*>(xCC->getResource(rxViewTabBarId->getAnchor()).get()); } catch (const RuntimeException&) { diff --git a/sd/workben/custompanel/ctp_panel.cxx b/sd/workben/custompanel/ctp_panel.cxx index 3a78c5d8bd10..9e3404754cd1 100644 --- a/sd/workben/custompanel/ctp_panel.cxx +++ b/sd/workben/custompanel/ctp_panel.cxx @@ -19,7 +19,7 @@ #include "ctp_panel.hxx" -#include <com/sun/star/drawing/framework/XPane.hpp> +#include <com/sun/star/drawing/framework/AbstractPane.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> #include <com/sun/star/awt/WindowClass.hpp> @@ -42,7 +42,7 @@ namespace sd::colortoolpanel using ::com::sun::star::uno::Type; using ::com::sun::star::drawing::framework::XResourceId; using ::com::sun::star::uno::XComponentContext; - using ::com::sun::star::drawing::framework::XPane; + using ::com::sun::star::drawing::framework::AbstractPane; using ::com::sun::star::awt::XWindow; using ::com::sun::star::lang::DisposedException; using ::com::sun::star::awt::XWindowPeer; @@ -107,7 +107,7 @@ namespace sd::colortoolpanel try { Reference< XResource > xAnchor( i_rConfigController->getResource( m_xResourceId->getAnchor() ), UNO_SET_THROW ); - Reference< XPane > xAnchorPane( xAnchor, UNO_QUERY_THROW ); + Reference< AbstractPane > xAnchorPane( xAnchor, UNO_QUERY_THROW ); xParentWindow.set( xAnchorPane->getWindow(), UNO_SET_THROW ); xParentPeer.set( xParentWindow, UNO_QUERY_THROW ); }