[Libreoffice-commits] core.git: include/svx svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 12 09:05:44 UTC 2021
include/svx/fmtools.hxx | 10 +++++-----
svx/source/fmcomp/gridcell.cxx | 2 +-
svx/source/form/filtnav.cxx | 5 +++--
svx/source/form/fmtools.cxx | 25 ++++++++-----------------
svx/source/form/fmvwimp.cxx | 2 +-
svx/source/form/formcontroller.cxx | 19 +++++++++----------
svx/source/inc/formcontroller.hxx | 3 ++-
7 files changed, 29 insertions(+), 37 deletions(-)
New commits:
commit 4d807017749855281f1268ac477b780befbcad9e
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Mar 11 11:34:03 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Mar 12 10:04:52 2021 +0100
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 at redhat.com>
diff --git a/include/svx/fmtools.hxx b/include/svx/fmtools.hxx
index 97d6fcff0d05..5ed09267aac7 100644
--- a/include/svx/fmtools.hxx
+++ b/include/svx/fmtools.hxx
@@ -33,6 +33,7 @@
#include <o3tl/sorted_vector.hxx>
#include <set>
+namespace com::sun::star::awt { class XWindow; }
namespace com::sun::star::beans { class XPropertySet; }
namespace com::sun::star::container { class XIndexAccess; }
namespace com::sun::star::container { class XNameAccess; }
@@ -42,17 +43,16 @@ namespace com::sun::star::sdbc { class SQLException; }
namespace com::sun::star::sdbc { class XRowSet; }
namespace com::sun::star::sdb { class SQLContext; }
namespace com::sun::star::sdb { struct SQLErrorEvent; }
-namespace vcl { class Window; }
// common types
// displaying a database exception for the user
// display info about a simple css::sdbc::SQLException
-void displayException(const css::sdbc::SQLException&, vcl::Window* _pParent);
-SVXCORE_DLLPUBLIC void displayException(const css::sdb::SQLContext&, vcl::Window* _pParent);
-void displayException(const css::sdb::SQLErrorEvent&, vcl::Window* _pParent);
-void displayException(const css::uno::Any&, vcl::Window* _pParent);
+void displayException(const css::sdbc::SQLException&, const css::uno::Reference<css::awt::XWindow>& rParent);
+SVXCORE_DLLPUBLIC void displayException(const css::sdb::SQLContext&, const css::uno::Reference<css::awt::XWindow>& rParent);
+void displayException(const css::sdb::SQLErrorEvent&, const css::uno::Reference<css::awt::XWindow>& rParent);
+void displayException(const css::uno::Any&, const css::uno::Reference<css::awt::XWindow>& rParent);
sal_Int32 getElementPos(const css::uno::Reference< css::container::XIndexAccess>& xCont, const css::uno::Reference< css::uno::XInterface>& xElement);
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index ccb3b4469b3c..bf29a63a6670 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2872,7 +2872,7 @@ bool DbFilterField::commitControl()
SQLException aError;
aError.Message = aErrorMsg;
- displayException(aError, m_pWindow->GetParent());
+ displayException(aError, VCLUnoHelper::GetInterface(m_pWindow->GetParent()));
// TODO: transport the title
return false;
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();
}
diff --git a/svx/source/inc/formcontroller.hxx b/svx/source/inc/formcontroller.hxx
index c25dd5d808ac..230b0e0f50c7 100644
--- a/svx/source/inc/formcontroller.hxx
+++ b/svx/source/inc/formcontroller.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/awt/XMouseListener.hpp>
#include <com/sun/star/awt/XTabController.hpp>
#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/form/DatabaseParameterEvent.hpp>
#include <com/sun/star/form/validation/XFormComponentValidityListener.hpp>
@@ -198,7 +199,7 @@ namespace svxform
FormController( const css::uno::Reference< css::uno::XComponentContext > & _rxORB );
// returns the window which should be used as parent window for dialogs
- static vcl::Window* getDialogParentWindow(css::uno::Reference<css::form::runtime::XFormController> xFormController);
+ static css::uno::Reference<css::awt::XWindow> getDialogParentWindow(css::uno::Reference<css::form::runtime::XFormController> xFormController);
private:
virtual ~FormController() override;
More information about the Libreoffice-commits
mailing list