summaryrefslogtreecommitdiff
path: root/svx/source/form
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-11 11:34:03 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-12 10:04:52 +0100
commit4d807017749855281f1268ac477b780befbcad9e (patch)
tree8bd88be3e914182430c9eec3f09532cbea20f25c /svx/source/form
parent32b7c32aa84dc51d3acd75bde5db7655868e5ad9 (diff)
transport error dialog parent as awt::XWindow earlier
Change-Id: Idfc6ffdb31d28316886800eed12ac46c1dbcc191 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112336 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/form')
-rw-r--r--svx/source/form/filtnav.cxx5
-rw-r--r--svx/source/form/fmtools.cxx25
-rw-r--r--svx/source/form/fmvwimp.cxx2
-rw-r--r--svx/source/form/formcontroller.cxx19
4 files changed, 21 insertions, 30 deletions
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 2e5ba4b0db38..98f829767261 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -43,10 +43,11 @@
#include <svx/fmshell.hxx>
#include <svx/fmtools.hxx>
#include <svx/svxids.hrc>
-#include <vcl/settings.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/commandevent.hxx>
#include <vcl/event.hxx>
+#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <bitmaps.hlst>
@@ -1154,7 +1155,7 @@ IMPL_LINK(FmFilterNavigator, EditedEntryHdl, const IterString&, rIterString, boo
SQLContext aError;
aError.Message = SvxResId(RID_STR_SYNTAXERROR);
aError.Details = aErrorMsg;
- displayException(aError, m_xTopLevel);
+ displayException(aError, VCLUnoHelper::GetInterface(m_xTopLevel));
return false;
}
diff --git a/svx/source/form/fmtools.cxx b/svx/source/form/fmtools.cxx
index 99e82fca3a33..e9f641309d0b 100644
--- a/svx/source/form/fmtools.cxx
+++ b/svx/source/form/fmtools.cxx
@@ -83,8 +83,7 @@ namespace
}
}
-
-void displayException(const Any& _rExcept, vcl::Window* _pParent)
+void displayException(const Any& _rExcept, const css::uno::Reference<css::awt::XWindow>& rParent)
{
// check whether we need to display it
if ( !lcl_shouldDisplayError( _rExcept ) )
@@ -92,11 +91,7 @@ void displayException(const Any& _rExcept, vcl::Window* _pParent)
try
{
- // the parent window
- vcl::Window* pParentWindow = _pParent ? _pParent : Application::GetDefDialogParent();
- Reference< XWindow > xParentWindow = VCLUnoHelper::GetInterface(pParentWindow);
-
- Reference< XExecutableDialog > xErrorDialog = ErrorMessageDialog::create(::comphelper::getProcessComponentContext(), "", xParentWindow, _rExcept);
+ Reference< XExecutableDialog > xErrorDialog = ErrorMessageDialog::create(::comphelper::getProcessComponentContext(), "", rParent, _rExcept);
xErrorDialog->execute();
}
catch(const Exception&)
@@ -105,25 +100,21 @@ void displayException(const Any& _rExcept, vcl::Window* _pParent)
}
}
-
-void displayException(const css::sdbc::SQLException& _rExcept, vcl::Window* _pParent)
+void displayException(const css::sdbc::SQLException& _rExcept, const css::uno::Reference<css::awt::XWindow>& rParent)
{
- displayException(makeAny(_rExcept), _pParent);
+ displayException(makeAny(_rExcept), rParent);
}
-
-void displayException(const css::sdb::SQLContext& _rExcept, vcl::Window* _pParent)
+void displayException(const css::sdb::SQLContext& _rExcept, const css::uno::Reference<css::awt::XWindow>& rParent)
{
- displayException(makeAny(_rExcept), _pParent);
+ displayException(makeAny(_rExcept), rParent);
}
-
-void displayException(const css::sdb::SQLErrorEvent& _rEvent, vcl::Window* _pParent)
+void displayException(const css::sdb::SQLErrorEvent& _rEvent, const css::uno::Reference<css::awt::XWindow>& rParent)
{
- displayException(_rEvent.Reason, _pParent);
+ displayException(_rEvent.Reason, rParent);
}
-
sal_Int32 getElementPos(const Reference< css::container::XIndexAccess>& xCont, const Reference< XInterface >& xElement)
{
sal_Int32 nIndex = -1;
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 8a52fbefb118..ef570569348f 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -577,7 +577,7 @@ void FmXFormView::displayAsyncErrorMessage( const SQLErrorEvent& _rEvent )
IMPL_LINK_NOARG(FmXFormView, OnDelayedErrorMessage, void*, void)
{
m_nErrorMessageEvent = nullptr;
- displayException(m_aAsyncError, VCLUnoHelper::GetWindow(GetParentWindow()));
+ displayException(m_aAsyncError, GetParentWindow());
}
void FmXFormView::onFirstViewActivation( const FmFormModel* _pDocModel )
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index 15b318e8f8d6..28f8e7eeaf23 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -82,7 +82,6 @@
#include <unotools/localedatawrapper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
-#include <vcl/window.hxx>
#include <o3tl/safeint.hxx>
#include <osl/mutex.hxx>
#include <sal/log.hxx>
@@ -3265,7 +3264,7 @@ void FormController::startFiltering()
// create a filter control
Reference< XControl > xFilterControl = form::control::FilterControl::createWithFormat(
m_xComponentContext,
- VCLUnoHelper::GetInterface( getDialogParentWindow(this) ),
+ getDialogParentWindow(this),
xFormatter,
xModel);
@@ -3444,20 +3443,19 @@ sal_Bool SAL_CALL FormController::supportsMode(const OUString& Mode)
return comphelper::findValue(aModes, Mode) != -1;
}
-vcl::Window* FormController::getDialogParentWindow(css::uno::Reference<css::form::runtime::XFormController> xFormController)
+css::uno::Reference<css::awt::XWindow> FormController::getDialogParentWindow(css::uno::Reference<css::form::runtime::XFormController> xFormController)
{
- vcl::Window* pParentWindow = nullptr;
try
{
Reference< XControl > xContainerControl( xFormController->getContainer(), UNO_QUERY_THROW );
- Reference< XWindowPeer > xContainerPeer( xContainerControl->getPeer(), UNO_SET_THROW );
- pParentWindow = VCLUnoHelper::GetWindow( xContainerPeer );
+ Reference<XWindow> xContainerWindow(xContainerControl->getPeer(), UNO_QUERY_THROW);
+ return xContainerWindow;
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("svx");
}
- return pParentWindow;
+ return nullptr;
}
bool FormController::checkFormComponentValidity( OUString& /* [out] */ _rFirstInvalidityExplanation, Reference< XControlModel >& /* [out] */ _rxFirstInvalidModel )
@@ -3529,12 +3527,13 @@ Reference< XControl > FormController::locateControl( const Reference< XControlMo
namespace
{
- void displayErrorSetFocus( const OUString& _rMessage, const Reference< XControl >& _rxFocusControl, vcl::Window* _pDialogParent )
+ void displayErrorSetFocus(const OUString& _rMessage, const Reference<XControl>& _rxFocusControl,
+ const css::uno::Reference<css::awt::XWindow>& rDialogParent)
{
SQLContext aError;
aError.Message = SvxResId(RID_STR_WRITEERROR);
aError.Details = _rMessage;
- displayException( aError, _pDialogParent );
+ displayException(aError, rDialogParent);
if ( _rxFocusControl.is() )
{
@@ -4118,7 +4117,7 @@ bool FormController::ensureInteractionHandler()
m_bAttemptedHandlerCreation = true;
m_xInteractionHandler = InteractionHandler::createWithParent(m_xComponentContext,
- VCLUnoHelper::GetInterface(getDialogParentWindow(this)));
+ getDialogParentWindow(this));
return m_xInteractionHandler.is();
}