svx/source/form/formcontroller.cxx | 17 +++++++---------- svx/source/inc/formcontroller.hxx | 4 ++-- 2 files changed, 9 insertions(+), 12 deletions(-)
New commits: commit b7bcb17311ea99d1849f87e329add0eff5f6fc75 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Mar 11 11:21:24 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Mar 11 20:25:14 2021 +0100 refactor getDialogParentWindow to take an XFormController arg Change-Id: I4c42adfa079babf7d3efbd881293102d6cb526ed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112334 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index c1ee3954cdc4..15b318e8f8d6 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -3265,7 +3265,7 @@ void FormController::startFiltering() // create a filter control Reference< XControl > xFilterControl = form::control::FilterControl::createWithFormat( m_xComponentContext, - VCLUnoHelper::GetInterface( getDialogParentWindow() ), + VCLUnoHelper::GetInterface( getDialogParentWindow(this) ), xFormatter, xModel); @@ -3435,7 +3435,6 @@ Sequence< OUString > SAL_CALL FormController::getSupportedModes() return aModes; } - sal_Bool SAL_CALL FormController::supportsMode(const OUString& Mode) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -3445,14 +3444,12 @@ sal_Bool SAL_CALL FormController::supportsMode(const OUString& Mode) return comphelper::findValue(aModes, Mode) != -1; } - -vcl::Window* FormController::getDialogParentWindow() +vcl::Window* FormController::getDialogParentWindow(css::uno::Reference<css::form::runtime::XFormController> xFormController) { - OSL_ENSURE( !impl_isDisposed_nofail(), "FormController: already disposed!" ); vcl::Window* pParentWindow = nullptr; try { - Reference< XControl > xContainerControl( getContainer(), UNO_QUERY_THROW ); + Reference< XControl > xContainerControl( xFormController->getContainer(), UNO_QUERY_THROW ); Reference< XWindowPeer > xContainerPeer( xContainerControl->getPeer(), UNO_SET_THROW ); pParentWindow = VCLUnoHelper::GetWindow( xContainerPeer ); } @@ -3621,7 +3618,7 @@ sal_Bool SAL_CALL FormController::approveRowChange(const RowChangeEvent& _rEvent { Reference< XControl > xControl( locateControl( xInvalidModel ) ); aGuard.clear(); - displayErrorSetFocus( sInvalidityExplanation, xControl, getDialogParentWindow() ); + displayErrorSetFocus( sInvalidityExplanation, xControl, getDialogParentWindow(this) ); return false; } @@ -3667,7 +3664,7 @@ sal_Bool SAL_CALL FormController::approveRowChange(const RowChangeEvent& _rEvent xControl.set( rColInfo.xFirstGridWithInputRequiredColumn, UNO_QUERY ); aGuard.clear(); - displayErrorSetFocus( sMessage, rColInfo.xFirstControlWithInputRequired, getDialogParentWindow() ); + displayErrorSetFocus( sMessage, rColInfo.xFirstControlWithInputRequired, getDialogParentWindow(this) ); return false; } } @@ -3749,7 +3746,7 @@ void SAL_CALL FormController::errorOccured(const SQLErrorEvent& aEvent) else { aGuard.clear(); - displayException(aEvent, getDialogParentWindow()); + displayException(aEvent, getDialogParentWindow(this)); } } @@ -4121,7 +4118,7 @@ bool FormController::ensureInteractionHandler() m_bAttemptedHandlerCreation = true; m_xInteractionHandler = InteractionHandler::createWithParent(m_xComponentContext, - VCLUnoHelper::GetInterface(getDialogParentWindow())); + VCLUnoHelper::GetInterface(getDialogParentWindow(this))); return m_xInteractionHandler.is(); } diff --git a/svx/source/inc/formcontroller.hxx b/svx/source/inc/formcontroller.hxx index 065852fe9c3a..6ed3ffeb2c4c 100644 --- a/svx/source/inc/formcontroller.hxx +++ b/svx/source/inc/formcontroller.hxx @@ -507,8 +507,8 @@ namespace svxform bool isLocked() const {return m_bLocked;} bool determineLockState() const; - vcl::Window* getDialogParentWindow(); - // returns the window which should be used as parent window for dialogs + // returns the window which should be used as parent window for dialogs + static vcl::Window* getDialogParentWindow(css::uno::Reference<css::form::runtime::XFormController> xFormController); css::uno::Reference< css::frame::XDispatchProviderInterceptor> createInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterception>& _xInterception); // create a new interceptor, register it on the given object _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits