Line data Source code
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 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
22 :
23 : #include <vcl/button.hxx>
24 : #include <vcl/fixed.hxx>
25 : #include <vcl/btndlg.hxx>
26 :
27 : #include <connectivity/dbexception.hxx>
28 :
29 : #include <memory>
30 :
31 : // some forwards
32 : namespace com { namespace sun { namespace star {
33 : namespace sdb {
34 : class SQLContext;
35 : }
36 : namespace sdbc {
37 : class SQLException;
38 : }
39 : } } }
40 :
41 : namespace dbaui
42 : {
43 :
44 : // OSQLMessageBox
45 : struct SQLMessageBox_Impl;
46 : class OSQLMessageBox : public ButtonDialog
47 : {
48 : VclPtr<FixedImage> m_aInfoImage;
49 : VclPtr<FixedText> m_aTitle;
50 : VclPtr<FixedText> m_aMessage;
51 : OUString m_sHelpURL;
52 :
53 : ::std::unique_ptr< SQLMessageBox_Impl > m_pImpl;
54 :
55 : public:
56 : enum MessageType
57 : {
58 : Info,
59 : Error,
60 : Warning,
61 : Query,
62 :
63 : AUTO
64 : };
65 :
66 : public:
67 : /** display an SQLException with auto-recognizing a main and a detailed message
68 :
69 : The first two messages from the exception chain are used as main and detailed message (recognizing the
70 : detailed field of an <type scope="com::sun::star::sdb">SQLContext</type>).
71 : */
72 : OSQLMessageBox(
73 : vcl::Window* _pParent,
74 : const dbtools::SQLExceptionInfo& _rException,
75 : WinBits _nStyle = WB_OK | WB_DEF_OK,
76 : const OUString& _rHelpURL = OUString()
77 : );
78 :
79 : /** display a database related error message
80 :
81 : @param rTitle the title to display
82 : @param rMessage the detailed message to display
83 : @param _eType determines the image to use. AUTO is disallowed in this constructor version
84 : */
85 : OSQLMessageBox(vcl::Window* pParent,
86 : const OUString& rTitle,
87 : const OUString& rMessage,
88 : WinBits nStyle = WB_OK | WB_DEF_OK,
89 : MessageType _eType = Info,
90 : const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL );
91 :
92 : virtual ~OSQLMessageBox();
93 : virtual void dispose() SAL_OVERRIDE;
94 :
95 : private:
96 : void Construct( WinBits nStyle, MessageType eImage );
97 :
98 : DECL_LINK(ButtonClickHdl, Button* );
99 :
100 : private:
101 : void impl_positionControls();
102 : void impl_initImage( MessageType _eImage );
103 : void impl_createStandardButtons( WinBits _nStyle );
104 : void impl_addDetailsButton();
105 : };
106 :
107 : // OSQLWarningBox
108 0 : class OSQLWarningBox : public OSQLMessageBox
109 : {
110 : public:
111 : OSQLWarningBox( vcl::Window* _pParent,
112 : const OUString& _rMessage,
113 : WinBits _nStyle = WB_OK | WB_DEF_OK,
114 : const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL );
115 : };
116 :
117 : // OSQLErrorBox
118 0 : class OSQLErrorBox : public OSQLMessageBox
119 : {
120 : public:
121 : OSQLErrorBox( vcl::Window* _pParent,
122 : const OUString& _rMessage,
123 : WinBits _nStyle = WB_OK | WB_DEF_OK,
124 : const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL );
125 : };
126 :
127 : } // namespace dbaui
128 :
129 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
130 :
131 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|