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