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