merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / inc / sqlmessage.hxx
blob1ab3f7c484d8d24881b324e1ae453dabbba9d003
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sqlmessage.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBAUI_SQLMESSAGE_HXX_
32 #define _DBAUI_SQLMESSAGE_HXX_
34 #ifndef _BUTTON_HXX
35 #include <vcl/button.hxx>
36 #endif
37 #ifndef _FIXED_HXX
38 #include <vcl/fixed.hxx>
39 #endif
40 #ifndef _SV_BTNDLG_HXX
41 #include <vcl/btndlg.hxx>
42 #endif
44 #ifndef _DBHELPER_DBEXCEPTION_HXX_
45 #include <connectivity/dbexception.hxx>
46 #endif
48 #include <memory>
50 // some forwards
51 namespace com { namespace sun { namespace star {
52 namespace sdb {
53 class SQLContext;
55 namespace sdbc {
56 class SQLException;
58 } } }
60 //.........................................................................
61 namespace dbaui
63 //.........................................................................
65 //==================================================================
66 // OSQLMessageBox
67 //==================================================================
68 struct SQLMessageBox_Impl;
69 class OSQLMessageBox : public ButtonDialog
71 FixedImage m_aInfoImage;
72 FixedText m_aTitle;
73 FixedText m_aMessage;
74 ::rtl::OUString m_sHelpURL;
76 ::std::auto_ptr< SQLMessageBox_Impl > m_pImpl;
78 public:
79 enum MessageType
81 Info,
82 Error,
83 Warning,
84 Query,
86 AUTO
89 public:
90 /** display an SQLException with auto-recognizing a main and a detailed message
92 The first two messages from the exception chain are used as main and detailed message (recognizing the
93 detailed field of an <type scope="com::sun::star::sdb">SQLContext</type>).
95 OSQLMessageBox(
96 Window* _pParent,
97 const dbtools::SQLExceptionInfo& _rException,
98 WinBits _nStyle = WB_OK | WB_DEF_OK,
99 const ::rtl::OUString& _rHelpURL = ::rtl::OUString()
102 /** display a database related error message
104 @param rTitle the title to display
105 @param rMessage the detailed message to display
106 @param _eType determines the image to use. AUTO is disallowed in this constructor version
108 OSQLMessageBox(Window* pParent,
109 const UniString& rTitle,
110 const UniString& rMessage,
111 WinBits nStyle = WB_OK | WB_DEF_OK,
112 MessageType _eType = Info,
113 const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL );
115 ~OSQLMessageBox();
117 private:
118 void Construct( WinBits nStyle, MessageType eImage );
120 DECL_LINK(ButtonClickHdl, Button* );
122 private:
123 void impl_positionControls();
124 void impl_initImage( MessageType _eImage );
125 void impl_createStandardButtons( WinBits _nStyle );
126 void impl_addDetailsButton();
129 //==================================================================
130 // OSQLWarningBox
131 //==================================================================
132 class OSQLWarningBox : public OSQLMessageBox
134 public:
135 OSQLWarningBox( Window* _pParent,
136 const UniString& _rMessage,
137 WinBits _nStyle = WB_OK | WB_DEF_OK,
138 const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL );
141 //.........................................................................
142 } // namespace dbaui
143 //.........................................................................
145 #endif // _DBAUI_SQLMESSAGE_HXX_