1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _DBAUI_SQLMESSAGE_HXX_ 25 #define _DBAUI_SQLMESSAGE_HXX_ 26 27 #ifndef _BUTTON_HXX 28 #include <vcl/button.hxx> 29 #endif 30 #ifndef _FIXED_HXX 31 #include <vcl/fixed.hxx> 32 #endif 33 #ifndef _SV_BTNDLG_HXX 34 #include <vcl/btndlg.hxx> 35 #endif 36 37 #ifndef _DBHELPER_DBEXCEPTION_HXX_ 38 #include <connectivity/dbexception.hxx> 39 #endif 40 41 #include <memory> 42 43 // some forwards 44 namespace com { namespace sun { namespace star { 45 namespace sdb { 46 class SQLContext; 47 } 48 namespace sdbc { 49 class SQLException; 50 } 51 } } } 52 53 //......................................................................... 54 namespace dbaui 55 { 56 //......................................................................... 57 58 //================================================================== 59 // OSQLMessageBox 60 //================================================================== 61 struct SQLMessageBox_Impl; 62 class OSQLMessageBox : public ButtonDialog 63 { 64 FixedImage m_aInfoImage; 65 FixedText m_aTitle; 66 FixedText m_aMessage; 67 ::rtl::OUString m_sHelpURL; 68 69 ::std::auto_ptr< SQLMessageBox_Impl > m_pImpl; 70 71 public: 72 enum MessageType 73 { 74 Info, 75 Error, 76 Warning, 77 Query, 78 79 AUTO 80 }; 81 82 public: 83 /** display an SQLException with auto-recognizing a main and a detailed message 84 85 The first two messages from the exception chain are used as main and detailed message (recognizing the 86 detailed field of an <type scope="com::sun::star::sdb">SQLContext</type>). 87 */ 88 OSQLMessageBox( 89 Window* _pParent, 90 const dbtools::SQLExceptionInfo& _rException, 91 WinBits _nStyle = WB_OK | WB_DEF_OK, 92 const ::rtl::OUString& _rHelpURL = ::rtl::OUString() 93 ); 94 95 /** display a database related error message 96 97 @param rTitle the title to display 98 @param rMessage the detailed message to display 99 @param _eType determines the image to use. AUTO is disallowed in this constructor version 100 */ 101 OSQLMessageBox(Window* pParent, 102 const UniString& rTitle, 103 const UniString& rMessage, 104 WinBits nStyle = WB_OK | WB_DEF_OK, 105 MessageType _eType = Info, 106 const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL ); 107 108 ~OSQLMessageBox(); 109 110 private: 111 void Construct( WinBits nStyle, MessageType eImage ); 112 113 DECL_LINK(ButtonClickHdl, Button* ); 114 115 private: 116 void impl_positionControls(); 117 void impl_initImage( MessageType _eImage ); 118 void impl_createStandardButtons( WinBits _nStyle ); 119 void impl_addDetailsButton(); 120 }; 121 122 //================================================================== 123 // OSQLWarningBox 124 //================================================================== 125 class OSQLWarningBox : public OSQLMessageBox 126 { 127 public: 128 OSQLWarningBox( Window* _pParent, 129 const UniString& _rMessage, 130 WinBits _nStyle = WB_OK | WB_DEF_OK, 131 const ::dbtools::SQLExceptionInfo* _pAdditionalErrorInfo = NULL ); 132 }; 133 134 //......................................................................... 135 } // namespace dbaui 136 //......................................................................... 137 138 #endif // _DBAUI_SQLMESSAGE_HXX_ 139 140