LibreOffice Module dbaccess (master) 1
sqlmessage.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
23#include <vcl/weld.hxx>
24#include <memory>
25
26// some forwards
27namespace com::sun::star {
28 namespace sdb {
29 class SQLContext;
30 }
31 namespace sdbc {
32 class SQLException;
33 }
34}
35
36namespace dbaui
37{
38
40{
45 AUTO
46};
47
48enum class MessBoxStyle {
49 NONE = 0x0000,
50 Ok = 0x0001,
51 OkCancel = 0x0002,
52 YesNo = 0x0004,
53 YesNoCancel = 0x0008,
54 RetryCancel = 0x0010,
55 DefaultOk = 0x0020,
56 DefaultCancel = 0x0040,
57 DefaultRetry = 0x0080,
58 DefaultYes = 0x0100,
59 DefaultNo = 0x0200,
60};
61
62}
63
64namespace o3tl {
65 template<> struct typed_flags<dbaui::MessBoxStyle> : is_typed_flags<dbaui::MessBoxStyle, 0x03ff> {};
66}
67
68
69namespace dbaui
70{
71
72// OSQLMessageBox
73struct SQLMessageBox_Impl;
75{
76 std::unique_ptr<weld::MessageDialog> m_xDialog;
77 std::unique_ptr<weld::Button> m_xMoreButton;
78 std::unique_ptr<SQLMessageBox_Impl> m_pImpl;
79 OUString m_sHelpURL;
80
81 virtual weld::Dialog* getDialog() override { return m_xDialog.get(); }
82public:
89 weld::Window* pParent,
90 const dbtools::SQLExceptionInfo& _rException,
92 OUString _sHelpURL = OUString()
93 );
94
102 const OUString& rTitle,
103 const OUString& rMessage,
105 MessageType _eType = Info,
106 const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = nullptr );
107
108 void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); }
109 void add_button(const OUString& rText, int nResponse, const OUString& rHelpId = {}) { m_xDialog->add_button(rText, nResponse, rHelpId); }
110 void set_default_response(int nResponse) { m_xDialog->set_default_response(nResponse); }
111
112 virtual ~OSQLMessageBox() override;
113
114private:
115 void Construct(weld::Window* pParent, MessBoxStyle nStyle, MessageType eImage);
116
117 DECL_LINK(ButtonClickHdl, weld::Button&, void);
118
119private:
120 void impl_fillMessages();
123};
124
125// OSQLWarningBox
127{
128public:
130 const OUString& _rMessage,
132 const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = nullptr );
133};
134
135// OSQLErrorBox
137{
138public:
139 OSQLErrorBox( weld::Window* pParent,
140 const OUString& _rMessage );
141};
142
143} // namespace dbaui
144
145/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OSQLErrorBox(weld::Window *pParent, const OUString &_rMessage)
Definition: sqlmessage.cxx:597
virtual weld::Dialog * getDialog() override
Definition: sqlmessage.hxx:81
std::unique_ptr< SQLMessageBox_Impl > m_pImpl
Definition: sqlmessage.hxx:78
void Construct(weld::Window *pParent, MessBoxStyle nStyle, MessageType eImage)
Definition: sqlmessage.cxx:515
std::unique_ptr< weld::Button > m_xMoreButton
Definition: sqlmessage.hxx:77
OSQLMessageBox(weld::Window *pParent, const dbtools::SQLExceptionInfo &_rException, MessBoxStyle _nStyle=MessBoxStyle::Ok|MessBoxStyle::DefaultOk, OUString _sHelpURL=OUString())
display an SQLException with auto-recognizing a main and a detailed message
Definition: sqlmessage.cxx:559
virtual ~OSQLMessageBox() override
Definition: sqlmessage.cxx:579
void set_default_response(int nResponse)
Definition: sqlmessage.hxx:110
std::unique_ptr< weld::MessageDialog > m_xDialog
Definition: sqlmessage.hxx:76
void add_button(const OUString &rText, int nResponse, const OUString &rHelpId={})
Definition: sqlmessage.hxx:109
DECL_LINK(ButtonClickHdl, weld::Button &, void)
void impl_createStandardButtons(MessBoxStyle _nStyle)
Definition: sqlmessage.cxx:445
void set_title(const OUString &rTitle)
Definition: sqlmessage.hxx:108
OSQLWarningBox(weld::Window *pParent, const OUString &_rMessage, MessBoxStyle _nStyle=MessBoxStyle::Ok|MessBoxStyle::DefaultOk, const ::dbtools::SQLExceptionInfo *_pAdditionalErrorInfo=nullptr)
Definition: sqlmessage.cxx:590
MessBoxStyle
NONE
MessBoxStyle
Definition: sqlmessage.hxx:48
@ Warning
Definition: sqlmessage.hxx:43