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 : FixedImage m_aInfoImage;
49 : FixedText m_aTitle;
50 : FixedText m_aMessage;
51 : OUString m_sHelpURL;
52 :
53 : ::std::auto_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 : 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(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 :
94 : private:
95 : void Construct( WinBits nStyle, MessageType eImage );
96 :
97 : DECL_LINK(ButtonClickHdl, Button* );
98 :
99 : private:
100 : void impl_positionControls();
101 : void impl_initImage( MessageType _eImage );
102 : void impl_createStandardButtons( WinBits _nStyle );
103 : void impl_addDetailsButton();
104 : };
105 :
106 : // OSQLWarningBox
107 0 : class OSQLWarningBox : public OSQLMessageBox
108 : {
109 : public:
110 : OSQLWarningBox( Window* _pParent,
111 : const OUString& _rMessage,
112 : WinBits _nStyle = WB_OK | WB_DEF_OK,
113 : const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL );
114 : };
115 :
116 : // OSQLErrorBox
117 0 : class OSQLErrorBox : public OSQLMessageBox
118 : {
119 : public:
120 : OSQLErrorBox( Window* _pParent,
121 : const OUString& _rMessage,
122 : WinBits _nStyle = WB_OK | WB_DEF_OK,
123 : const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL );
124 : };
125 :
126 : } // namespace dbaui
127 :
128 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_SQLMESSAGE_HXX
129 :
130 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|