diff options
Diffstat (limited to 'dbaccess/source/ui/inc/sqlmessage.hxx')
-rw-r--r-- | dbaccess/source/ui/inc/sqlmessage.hxx | 83 |
1 files changed, 52 insertions, 31 deletions
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 ); }; |