summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-03-20 17:17:10 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-03-22 00:27:49 +0100
commita084d003a927440fb56b11a0b7175360a1af41ab (patch)
tree830911bfed2ad1f34730156d506bc9fd5c7c392c /dbaccess/source/ui/inc
parent519293447189f75e842065f7ff211d395d0da4b6 (diff)
weld OSQLMessageBox
Change-Id: Idbdb07bc342a91695d15ea1a87d1863798ca34b0 Reviewed-on: https://gerrit.libreoffice.org/51676 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source/ui/inc')
-rw-r--r--dbaccess/source/ui/inc/UITools.hxx24
-rw-r--r--dbaccess/source/ui/inc/sqlmessage.hxx83
2 files changed, 64 insertions, 43 deletions
diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx
index 114e2ad78527..cd8e5a877b1b 100644
--- a/dbaccess/source/ui/inc/UITools.hxx
+++ b/dbaccess/source/ui/inc/UITools.hxx
@@ -200,16 +200,16 @@ namespace dbaui
SvxCellHorJustify& _eJustify,
bool _bHasFormat);
/** append a name to tablefilter of a datasource
- @param _xConnection the connection is need to get the datasource
- @param _sName the name which should be appended
- @param _rxContext needed to check if datasource is available
- @param _pParent needed when an error must be shown
+ @param xConnection the connection is need to get the datasource
+ @param rName the name which should be appended
+ @param rxContext needed to check if datasource is available
+ @param pParent needed when an error must be shown
@return false when datsource is not available otherwise true
*/
- bool appendToFilter(const css::uno::Reference< css::sdbc::XConnection>& _xConnection,
- const OUString& _sName,
- const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
- vcl::Window* _pParent);
+ bool appendToFilter(const css::uno::Reference< css::sdbc::XConnection>& xConnection,
+ const OUString& rName,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ weld::Window* pParent);
/** notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search _pWindow.
@param _pWindow
@@ -307,21 +307,21 @@ namespace dbaui
*/
/** returns the result of the user action when view the query dialog.
- @param _pParent
+ @param pParent
The parent of the dialog
@param pTitle
A string resource id for the text which will be displayed as title.
@param pText
A string resource id for the text which will be displayed above the buttons.
When the string contains a #1. This will be replaced by the name.
- @param _bAll
+ @param bAll
When set to <TRUE/>, the all button will be appended.
- @param _sName
+ @param rName
The name of the object to ask for.
@return
RET_YES, RET_NO, RET_ALL
*/
- sal_Int32 askForUserAction(vcl::Window* _pParent, const char* pTitle, const char* pText, bool _bAll, const OUString& _sName);
+ sal_Int32 askForUserAction(weld::Window* pParent, const char* pTitle, const char* pText, bool bAll, const OUString& rName);
/** creates a new view from a query or table
@param _sName
diff --git a/dbaccess/source/ui/inc/sqlmessage.hxx b/dbaccess/source/ui/inc/sqlmessage.hxx
index e070185f76f3..0f8bbe49142a 100644
--- a/dbaccess/source/ui/inc/sqlmessage.hxx
+++ b/dbaccess/source/ui/inc/sqlmessage.hxx
@@ -20,13 +20,8 @@
#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
#define INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/btndlg.hxx>
-#include <vcl/msgbox.hxx>
-
#include <connectivity/dbexception.hxx>
-
+#include <vcl/weld.hxx>
#include <memory>
// some forwards
@@ -42,28 +37,51 @@ namespace com { namespace sun { namespace star {
namespace dbaui
{
-// OSQLMessageBox
-struct SQLMessageBox_Impl;
-class OSQLMessageBox : public ButtonDialog
+enum MessageType
{
- VclPtr<FixedImage> m_aInfoImage;
- VclPtr<FixedText> m_aTitle;
- VclPtr<FixedText> m_aMessage;
- OUString m_sHelpURL;
+ Info,
+ Error,
+ Warning,
+ Query,
+ AUTO
+};
+
+enum class MessBoxStyle {
+ NONE = 0x0000,
+ Ok = 0x0001,
+ OkCancel = 0x0002,
+ YesNo = 0x0004,
+ YesNoCancel = 0x0008,
+ RetryCancel = 0x0010,
+ DefaultOk = 0x0020,
+ DefaultCancel = 0x0040,
+ DefaultRetry = 0x0080,
+ DefaultYes = 0x0100,
+ DefaultNo = 0x0200,
+ AbortRetryIgnore = 0x1000,
+ DefaultIgnore = 0x2000,
+};
- std::unique_ptr< SQLMessageBox_Impl > m_pImpl;
+}
-public:
- enum MessageType
- {
- Info,
- Error,
- Warning,
- Query,
+namespace o3tl {
+ template<> struct typed_flags<dbaui::MessBoxStyle> : is_typed_flags<dbaui::MessBoxStyle, 0x3fff> {};
+}
- AUTO
- };
+namespace dbaui
+{
+
+// OSQLMessageBox
+struct SQLMessageBox_Impl;
+class OSQLMessageBox : public weld::DialogController
+{
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
+ std::unique_ptr<weld::Button> m_xMoreButton;
+ std::unique_ptr<SQLMessageBox_Impl> m_pImpl;
+ OUString m_sHelpURL;
+
+ virtual weld::Dialog* getDialog() override { return m_xDialog.get(); }
public:
/** display an SQLException with auto-recognizing a main and a detailed message
@@ -71,7 +89,7 @@ public:
detailed field of an <type scope="css::sdb">SQLContext</type>).
*/
OSQLMessageBox(
- vcl::Window* _pParent,
+ weld::Window* pParent,
const dbtools::SQLExceptionInfo& _rException,
MessBoxStyle _nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk,
const OUString& _rHelpURL = OUString()
@@ -83,23 +101,26 @@ public:
@param rMessage the detailed message to display
@param _eType determines the image to use. AUTO is disallowed in this constructor version
*/
- OSQLMessageBox(vcl::Window* pParent,
+ OSQLMessageBox(weld::Window* pParent,
const OUString& rTitle,
const OUString& rMessage,
MessBoxStyle nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk,
MessageType _eType = Info,
const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = nullptr );
+ void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
+ void add_button(const OUString& rText, int nResponse, const OString& rHelpId = OString()) { m_xDialog->add_button(rText, nResponse, rHelpId); }
+ void set_default_response(int nResponse) { m_xDialog->set_default_response(nResponse); }
+
virtual ~OSQLMessageBox() override;
- virtual void dispose() override;
private:
- void Construct( MessBoxStyle nStyle, MessageType eImage );
+ void Construct(weld::Window* pParent, MessBoxStyle nStyle, MessageType eImage);
- DECL_LINK(ButtonClickHdl, Button*, void );
+ DECL_LINK(ButtonClickHdl, weld::Button&, void);
private:
- void impl_positionControls();
+ void impl_fillMessages();
void impl_createStandardButtons( MessBoxStyle _nStyle );
void impl_addDetailsButton();
};
@@ -108,7 +129,7 @@ private:
class OSQLWarningBox : public OSQLMessageBox
{
public:
- OSQLWarningBox( vcl::Window* _pParent,
+ OSQLWarningBox( weld::Window* pParent,
const OUString& _rMessage,
MessBoxStyle _nStyle = MessBoxStyle::Ok | MessBoxStyle::DefaultOk,
const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = nullptr );
@@ -118,7 +139,7 @@ public:
class OSQLErrorBox : public OSQLMessageBox
{
public:
- OSQLErrorBox( vcl::Window* _pParent,
+ OSQLErrorBox( weld::Window* pParent,
const OUString& _rMessage );
};