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