sd/source/console/PresenterPaneBase.cxx | 104 ++++++----------------------- sd/source/console/PresenterPaneBase.hxx | 20 ++--- sd/source/console/PresenterPaneFactory.cxx | 11 --- 3 files changed, 35 insertions(+), 100 deletions(-)
New commits: commit 4e4be4a4ecfb9e73a8e90ac3ba907da840818133 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue May 13 23:32:28 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu May 15 06:48:46 2025 +0200 sd: OSL_ASSERT -> assert Change-Id: I931b361dcd560c21020468e6560571006cbee460 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185287 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sd/source/console/PresenterPaneBase.cxx b/sd/source/console/PresenterPaneBase.cxx index 46fab7490b87..6177ee31e1bb 100644 --- a/sd/source/console/PresenterPaneBase.cxx +++ b/sd/source/console/PresenterPaneBase.cxx @@ -88,8 +88,8 @@ void PresenterPaneBase::SetTitle (const OUString& rsTitle) { msTitle = rsTitle; - OSL_ASSERT(mpPresenterController); - OSL_ASSERT(mpPresenterController->GetPaintManager() != nullptr); + assert(mpPresenterController); + assert(mpPresenterController->GetPaintManager()); mpPresenterController->GetPaintManager()->Invalidate(mxBorderWindow); } commit 4f0f8ae6ea2c8ecbb02ad5e2abd7588eb55999b4 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue May 13 23:31:08 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu May 15 06:48:40 2025 +0200 sd: Drop always empty title param Apparently, PresenterPaneBase::SetTitle is the way to set the title. Change-Id: I0e00c25129688e1b793cff77b900aaab117665d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185286 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sd/source/console/PresenterPaneBase.cxx b/sd/source/console/PresenterPaneBase.cxx index 64a207915b78..46fab7490b87 100644 --- a/sd/source/console/PresenterPaneBase.cxx +++ b/sd/source/console/PresenterPaneBase.cxx @@ -108,7 +108,7 @@ const Reference<drawing::framework::XPaneBorderPainter>& void PresenterPaneBase::initialize( const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, const css::uno::Reference<css::awt::XWindow>& rxParentWindow, - const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas, const OUString& rTitle, + const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas, const rtl::Reference<PresenterPaneBorderPainter>& rxBorderPainter, bool bIsWindowVisibleOnCreation) { @@ -125,7 +125,6 @@ void PresenterPaneBase::initialize( mxParentWindow = rxParentWindow; Reference<rendering::XSpriteCanvas> xParentCanvas(rxParentCanvas, UNO_QUERY_THROW); - msTitle = rTitle; mxBorderPainter = rxBorderPainter; CreateWindows(bIsWindowVisibleOnCreation); diff --git a/sd/source/console/PresenterPaneBase.hxx b/sd/source/console/PresenterPaneBase.hxx index b078eea8932e..5354a9228e53 100644 --- a/sd/source/console/PresenterPaneBase.hxx +++ b/sd/source/console/PresenterPaneBase.hxx @@ -70,7 +70,6 @@ public: void initialize(const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, const css::uno::Reference<css::awt::XWindow>& rxParentWindow, const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas, - const OUString& rTitle, const rtl::Reference<PresenterPaneBorderPainter>& rxBorderPainter, bool bIsWindowVisibleOnCreation); diff --git a/sd/source/console/PresenterPaneFactory.cxx b/sd/source/console/PresenterPaneFactory.cxx index 13085076ffb0..97c70b6573dc 100644 --- a/sd/source/console/PresenterPaneFactory.cxx +++ b/sd/source/console/PresenterPaneFactory.cxx @@ -241,7 +241,7 @@ Reference<XResource> PresenterPaneFactory::CreatePane ( xPane.set( new PresenterPane(xContext, mpPresenterController)); } - xPane->initialize(rxPaneId, rxParentPane->getWindow(), rxParentPane->getCanvas(), OUString(), + xPane->initialize(rxPaneId, rxParentPane->getWindow(), rxParentPane->getCanvas(), mpPresenterController->GetPaneBorderPainter(), !bIsSpritePane); // Store pane and canvases and windows in container. commit c0a31260dff1c100025400bf8ecad4723f526b6a Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Tue May 13 23:24:27 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu May 15 06:48:33 2025 +0200 sd: Implement PresenterPaneBase::initialize without XInitialization No longer let PresenterPaneBase implement the XInitialization interface, but instead let PresenterPaneBase::initialize take the specific parameters and pass them in the only caller instead of wrapping them into a Sequence<Any> and then extracting them again in PresenterPaneBase::initialize. Drop the try/catch, assuming this was primarily there for the previous handling of args. Further simplification can be done in upcoming commits. Change-Id: Iacdd51e0d2d2bde454d66a97d4c468628395a1b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185285 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sd/source/console/PresenterPaneBase.cxx b/sd/source/console/PresenterPaneBase.cxx index c9920303c9f5..64a207915b78 100644 --- a/sd/source/console/PresenterPaneBase.cxx +++ b/sd/source/console/PresenterPaneBase.cxx @@ -105,9 +105,12 @@ const Reference<drawing::framework::XPaneBorderPainter>& return mxBorderPainter; } -//----- XInitialization ------------------------------------------------------- - -void SAL_CALL PresenterPaneBase::initialize (const Sequence<Any>& rArguments) +void PresenterPaneBase::initialize( + const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, + const css::uno::Reference<css::awt::XWindow>& rxParentWindow, + const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas, const OUString& rTitle, + const rtl::Reference<PresenterPaneBorderPainter>& rxBorderPainter, + bool bIsWindowVisibleOnCreation) { ThrowIfDisposed(); @@ -118,85 +121,25 @@ void SAL_CALL PresenterPaneBase::initialize (const Sequence<Any>& rArguments) static_cast<XWeak*>(this)); } - if (rArguments.getLength() != 5 && rArguments.getLength() != 6) - { - throw RuntimeException( - u"PresenterSpritePane: invalid number of arguments"_ustr, - static_cast<XWeak*>(this)); - } + mxPaneId = rxPaneId; + mxParentWindow = rxParentWindow; - try - { - // Get the resource id from the first argument. - if ( ! (rArguments[0] >>= mxPaneId)) - { - throw lang::IllegalArgumentException( - u"PresenterPane: invalid pane id"_ustr, - static_cast<XWeak*>(this), - 0); - } - - if ( ! (rArguments[1] >>= mxParentWindow)) - { - throw lang::IllegalArgumentException( - u"PresenterPane: invalid parent window"_ustr, - static_cast<XWeak*>(this), - 1); - } - - Reference<rendering::XSpriteCanvas> xParentCanvas; - if ( ! (rArguments[2] >>= xParentCanvas)) - { - throw lang::IllegalArgumentException( - u"PresenterPane: invalid parent canvas"_ustr, - static_cast<XWeak*>(this), - 2); - } - - if ( ! (rArguments[3] >>= msTitle)) - { - throw lang::IllegalArgumentException( - u"PresenterPane: invalid title"_ustr, - static_cast<XWeak*>(this), - 3); - } - - if ( ! (rArguments[4] >>= mxBorderPainter)) - { - throw lang::IllegalArgumentException( - u"PresenterPane: invalid border painter"_ustr, - static_cast<XWeak*>(this), - 4); - } - - bool bIsWindowVisibleOnCreation (true); - if (rArguments.getLength()>5 && ! (rArguments[5] >>= bIsWindowVisibleOnCreation)) - { - throw lang::IllegalArgumentException( - u"PresenterPane: invalid window visibility flag"_ustr, - static_cast<XWeak*>(this), - 5); - } - - CreateWindows(bIsWindowVisibleOnCreation); - - if (mxBorderWindow.is()) - { - mxBorderWindow->addWindowListener(this); - mxBorderWindow->addPaintListener(this); - } - - CreateCanvases(xParentCanvas); - - // Raise new windows. - ToTop(); - } - catch (Exception&) + Reference<rendering::XSpriteCanvas> xParentCanvas(rxParentCanvas, UNO_QUERY_THROW); + msTitle = rTitle; + mxBorderPainter = rxBorderPainter; + + CreateWindows(bIsWindowVisibleOnCreation); + + if (mxBorderWindow.is()) { - mxContentWindow = nullptr; - mxComponentContext = nullptr; - throw; + mxBorderWindow->addWindowListener(this); + mxBorderWindow->addPaintListener(this); } + + CreateCanvases(xParentCanvas); + + // Raise new windows. + ToTop(); } //----- XResourceId ----------------------------------------------------------- diff --git a/sd/source/console/PresenterPaneBase.hxx b/sd/source/console/PresenterPaneBase.hxx index cd53913f0a6f..b078eea8932e 100644 --- a/sd/source/console/PresenterPaneBase.hxx +++ b/sd/source/console/PresenterPaneBase.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEBASE_HXX #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERPANEBASE_HXX +#include "PresenterPaneBorderPainter.hxx" + #include <PresenterHelper.hxx> #include <cppuhelper/basemutex.hxx> @@ -27,7 +29,6 @@ #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/drawing/framework/XPane.hpp> #include <com/sun/star/drawing/framework/XPaneBorderPainter.hpp> -#include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/rendering/XCanvas.hpp> #include <rtl/ref.hxx> @@ -37,12 +38,9 @@ namespace sdext::presenter { class PresenterController; -typedef ::cppu::WeakComponentImplHelper < - css::drawing::framework::XPane, - css::lang::XInitialization, - css::awt::XWindowListener, - css::awt::XPaintListener -> PresenterPaneBaseInterfaceBase; +typedef ::cppu::WeakComponentImplHelper<css::drawing::framework::XPane, css::awt::XWindowListener, + css::awt::XPaintListener> + PresenterPaneBaseInterfaceBase; /** Base class of the panes used by the presenter screen. Pane objects are stored in the PresenterPaneContainer. Sizes and positions are @@ -69,9 +67,12 @@ public: const OUString& GetTitle() const; const css::uno::Reference<css::drawing::framework::XPaneBorderPainter>& GetPaneBorderPainter() const; - // XInitialization - - virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments) override; + void initialize(const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId, + const css::uno::Reference<css::awt::XWindow>& rxParentWindow, + const css::uno::Reference<css::rendering::XCanvas>& rxParentCanvas, + const OUString& rTitle, + const rtl::Reference<PresenterPaneBorderPainter>& rxBorderPainter, + bool bIsWindowVisibleOnCreation); // XResourceId diff --git a/sd/source/console/PresenterPaneFactory.cxx b/sd/source/console/PresenterPaneFactory.cxx index 22626286637b..13085076ffb0 100644 --- a/sd/source/console/PresenterPaneFactory.cxx +++ b/sd/source/console/PresenterPaneFactory.cxx @@ -241,15 +241,8 @@ Reference<XResource> PresenterPaneFactory::CreatePane ( xPane.set( new PresenterPane(xContext, mpPresenterController)); } - // Supply arguments. - Sequence<Any> aArguments{ Any(rxPaneId), - Any(rxParentPane->getWindow()), - Any(rxParentPane->getCanvas()), - Any(OUString()), - Any(Reference<drawing::framework::XPaneBorderPainter>( - mpPresenterController->GetPaneBorderPainter())), - Any(!bIsSpritePane) }; - xPane->initialize(aArguments); + xPane->initialize(rxPaneId, rxParentPane->getWindow(), rxParentPane->getCanvas(), OUString(), + mpPresenterController->GetPaneBorderPainter(), !bIsSpritePane); // Store pane and canvases and windows in container. ::rtl::Reference<PresenterPaneContainer> pContainer (