xref: /aoo42x/main/dbaccess/source/ui/dlg/directsql.cxx (revision cdf0e10c)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifndef _DBACCESS_UI_DIRECTSQL_HXX_
32*cdf0e10cSrcweir #include "directsql.hxx"
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #ifndef _DBACCESS_UI_DIRECTSQL_HRC_
35*cdf0e10cSrcweir #include "directsql.hrc"
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #ifndef _DBU_DLG_HRC_
38*cdf0e10cSrcweir #include "dbu_dlg.hrc"
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX
41*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
44*cdf0e10cSrcweir #include <comphelper/types.hxx>
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir #ifndef _SV_MSGBOX_HXX
47*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
48*cdf0e10cSrcweir #endif
49*cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX
50*cdf0e10cSrcweir #include <vcl/svapp.hxx>
51*cdf0e10cSrcweir #endif
52*cdf0e10cSrcweir #ifndef _VOS_MUTEX_HXX_
53*cdf0e10cSrcweir #include <vos/mutex.hxx>
54*cdf0e10cSrcweir #endif
55*cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H
56*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
57*cdf0e10cSrcweir #endif
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir //........................................................................
60*cdf0e10cSrcweir namespace dbaui
61*cdf0e10cSrcweir {
62*cdf0e10cSrcweir //........................................................................
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
65*cdf0e10cSrcweir 	using namespace ::com::sun::star::sdbc;
66*cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 	//====================================================================
69*cdf0e10cSrcweir 	//= LargeEntryListBox
70*cdf0e10cSrcweir 	//====================================================================
71*cdf0e10cSrcweir 	class LargeEntryListBox : public ListBox
72*cdf0e10cSrcweir 	{
73*cdf0e10cSrcweir 	public:
74*cdf0e10cSrcweir 		LargeEntryListBox( Window* _pParent, const ResId& _rId );
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	protected:
77*cdf0e10cSrcweir 		virtual void	UserDraw( const UserDrawEvent& rUDEvt );
78*cdf0e10cSrcweir 	};
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir 	//--------------------------------------------------------------------
81*cdf0e10cSrcweir 	LargeEntryListBox::LargeEntryListBox( Window* _pParent, const ResId& _rId )
82*cdf0e10cSrcweir 		:ListBox(_pParent, _rId )
83*cdf0e10cSrcweir 	{
84*cdf0e10cSrcweir 		EnableUserDraw(sal_True);
85*cdf0e10cSrcweir 	}
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 	//--------------------------------------------------------------------
88*cdf0e10cSrcweir 	void LargeEntryListBox::UserDraw( const UserDrawEvent& _rUDEvt )
89*cdf0e10cSrcweir 	{
90*cdf0e10cSrcweir 		if (LISTBOX_ENTRY_NOTFOUND == _rUDEvt.GetItemId())
91*cdf0e10cSrcweir 			ListBox::UserDraw( _rUDEvt );
92*cdf0e10cSrcweir 		else
93*cdf0e10cSrcweir 			_rUDEvt.GetDevice()->DrawText( _rUDEvt.GetRect(), GetEntry( _rUDEvt.GetItemId() ), TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER | TEXT_DRAW_ENDELLIPSIS);
94*cdf0e10cSrcweir 	}
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	//====================================================================
97*cdf0e10cSrcweir 	//= DirectSQLDialog
98*cdf0e10cSrcweir 	//====================================================================
99*cdf0e10cSrcweir DBG_NAME(DirectSQLDialog)
100*cdf0e10cSrcweir //--------------------------------------------------------------------
101*cdf0e10cSrcweir 	DirectSQLDialog::DirectSQLDialog( Window* _pParent, const Reference< XConnection >& _rxConn )
102*cdf0e10cSrcweir 		:ModalDialog(_pParent, ModuleRes(DLG_DIRECTSQL))
103*cdf0e10cSrcweir 		,m_aFrame				(this, ModuleRes(FL_SQL))
104*cdf0e10cSrcweir 		,m_aSQLLabel			(this, ModuleRes(FT_SQL))
105*cdf0e10cSrcweir 		,m_aSQL					(this, ModuleRes(ME_SQL))
106*cdf0e10cSrcweir 		,m_aExecute				(this, ModuleRes(PB_EXECUTE))
107*cdf0e10cSrcweir 		,m_aHistoryLabel		(this, ModuleRes(FT_HISTORY))
108*cdf0e10cSrcweir 		,m_pSQLHistory(new LargeEntryListBox(this, ModuleRes(LB_HISTORY)))
109*cdf0e10cSrcweir 		,m_aStatusFrame			(this, ModuleRes(FL_STATUS))
110*cdf0e10cSrcweir 		,m_aStatus				(this, ModuleRes(ME_STATUS))
111*cdf0e10cSrcweir 		,m_aButtonSeparator		(this, ModuleRes(FL_BUTTONS))
112*cdf0e10cSrcweir 		,m_aHelp				(this, ModuleRes(PB_HELP))
113*cdf0e10cSrcweir 		,m_aClose				(this, ModuleRes(PB_CLOSE))
114*cdf0e10cSrcweir 		,m_nHistoryLimit(20)
115*cdf0e10cSrcweir 		,m_nStatusCount(1)
116*cdf0e10cSrcweir 		,m_xConnection(_rxConn)
117*cdf0e10cSrcweir 	{
118*cdf0e10cSrcweir         DBG_CTOR(DirectSQLDialog,NULL);
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 		FreeResource();
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 		m_aSQL.GrabFocus();
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 		m_aExecute.SetClickHdl(LINK(this, DirectSQLDialog, OnExecute));
125*cdf0e10cSrcweir 		m_aClose.SetClickHdl(LINK(this, DirectSQLDialog, OnClose));
126*cdf0e10cSrcweir 		m_pSQLHistory->SetSelectHdl(LINK(this, DirectSQLDialog, OnListEntrySelected));
127*cdf0e10cSrcweir 		m_pSQLHistory->SetDropDownLineCount(10);
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 		// add a dispose listener to the connection
130*cdf0e10cSrcweir 		Reference< XComponent > xConnComp(m_xConnection, UNO_QUERY);
131*cdf0e10cSrcweir 		OSL_ENSURE(xConnComp.is(), "DirectSQLDialog::DirectSQLDialog: invalid connection!");
132*cdf0e10cSrcweir 		if (xConnComp.is())
133*cdf0e10cSrcweir 			startComponentListening(xConnComp);
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 		m_aSQL.SetModifyHdl(LINK(this, DirectSQLDialog, OnStatementModified));
136*cdf0e10cSrcweir 		OnStatementModified(&m_aSQL);
137*cdf0e10cSrcweir 	}
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 	//--------------------------------------------------------------------
140*cdf0e10cSrcweir 	DirectSQLDialog::~DirectSQLDialog()
141*cdf0e10cSrcweir 	{
142*cdf0e10cSrcweir 		{
143*cdf0e10cSrcweir 			::osl::MutexGuard aGuard(m_aMutex);
144*cdf0e10cSrcweir 			stopAllComponentListening();
145*cdf0e10cSrcweir 		}
146*cdf0e10cSrcweir 		delete m_pSQLHistory;
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir         DBG_DTOR(DirectSQLDialog,NULL);
149*cdf0e10cSrcweir     }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	//--------------------------------------------------------------------
152*cdf0e10cSrcweir 	void DirectSQLDialog::_disposing( const EventObject& _rSource )
153*cdf0e10cSrcweir 	{
154*cdf0e10cSrcweir 		::vos::OGuard aSolarGuard(Application::GetSolarMutex());
155*cdf0e10cSrcweir 		::osl::MutexGuard aGuard(m_aMutex);
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 		OSL_ENSURE(Reference< XConnection >(_rSource.Source, UNO_QUERY).get() == m_xConnection.get(),
158*cdf0e10cSrcweir 			"DirectSQLDialog::_disposing: where does this come from?");
159*cdf0e10cSrcweir         (void)_rSource;
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 		{
162*cdf0e10cSrcweir 			String sMessage(ModuleRes(STR_DIRECTSQL_CONNECTIONLOST));
163*cdf0e10cSrcweir 			ErrorBox aError(this, WB_OK, sMessage);
164*cdf0e10cSrcweir 			aError.Execute();
165*cdf0e10cSrcweir 		}
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 		PostUserEvent(LINK(this, DirectSQLDialog, OnClose));
168*cdf0e10cSrcweir 	}
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 	//--------------------------------------------------------------------
171*cdf0e10cSrcweir 	sal_Int32 DirectSQLDialog::getHistorySize() const
172*cdf0e10cSrcweir 	{
173*cdf0e10cSrcweir 		CHECK_INVARIANTS("DirectSQLDialog::getHistorySize");
174*cdf0e10cSrcweir 		return m_aStatementHistory.size();
175*cdf0e10cSrcweir 	}
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir 	//--------------------------------------------------------------------
178*cdf0e10cSrcweir 	void DirectSQLDialog::implEnsureHistoryLimit()
179*cdf0e10cSrcweir 	{
180*cdf0e10cSrcweir 		CHECK_INVARIANTS("DirectSQLDialog::implEnsureHistoryLimit");
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 		if (getHistorySize() <= m_nHistoryLimit)
183*cdf0e10cSrcweir 			// nothing to do
184*cdf0e10cSrcweir 			return;
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 		sal_Int32 nRemoveEntries = getHistorySize() - m_nHistoryLimit;
187*cdf0e10cSrcweir 		while (nRemoveEntries--)
188*cdf0e10cSrcweir 		{
189*cdf0e10cSrcweir 			m_aStatementHistory.pop_front();
190*cdf0e10cSrcweir 			m_aNormalizedHistory.pop_front();
191*cdf0e10cSrcweir 			m_pSQLHistory->RemoveEntry((sal_uInt16)0);
192*cdf0e10cSrcweir 		}
193*cdf0e10cSrcweir 	}
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 	//--------------------------------------------------------------------
196*cdf0e10cSrcweir 	void DirectSQLDialog::implAddToStatementHistory(const String& _rStatement)
197*cdf0e10cSrcweir 	{
198*cdf0e10cSrcweir 		CHECK_INVARIANTS("DirectSQLDialog::implAddToStatementHistory");
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 		// add the statement to the history
201*cdf0e10cSrcweir 		m_aStatementHistory.push_back(_rStatement);
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 		// normalize the statement, and remember the normalized form, too
204*cdf0e10cSrcweir 		String sNormalized(_rStatement);
205*cdf0e10cSrcweir 		sNormalized.SearchAndReplaceAll((sal_Unicode)'\n', ' ');
206*cdf0e10cSrcweir 		m_aNormalizedHistory.push_back(sNormalized);
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 		// add the normalized version to the list box
209*cdf0e10cSrcweir 		m_pSQLHistory->InsertEntry(sNormalized);
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 		// ensure that we don't exceed the history limit
212*cdf0e10cSrcweir 		implEnsureHistoryLimit();
213*cdf0e10cSrcweir 	}
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir #ifdef DBG_UTIL
216*cdf0e10cSrcweir 	//--------------------------------------------------------------------
217*cdf0e10cSrcweir 	const sal_Char* DirectSQLDialog::impl_CheckInvariants() const
218*cdf0e10cSrcweir 	{
219*cdf0e10cSrcweir 		if (m_aStatementHistory.size() != m_aNormalizedHistory.size())
220*cdf0e10cSrcweir 			return "statement history is inconsistent!";
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 		if (!m_pSQLHistory)
223*cdf0e10cSrcweir 			return "invalid listbox!";
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 		if (m_aStatementHistory.size() != m_pSQLHistory->GetEntryCount())
226*cdf0e10cSrcweir 			return "invalid listbox entry count!";
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 		if (!m_xConnection.is())
229*cdf0e10cSrcweir 			return "have no connection!";
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 		return NULL;
232*cdf0e10cSrcweir 	}
233*cdf0e10cSrcweir #endif
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir 	//--------------------------------------------------------------------
236*cdf0e10cSrcweir 	void DirectSQLDialog::implExecuteStatement(const String& _rStatement)
237*cdf0e10cSrcweir 	{
238*cdf0e10cSrcweir 		CHECK_INVARIANTS("DirectSQLDialog::implExecuteStatement");
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 		::osl::MutexGuard aGuard(m_aMutex);
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 		String sStatus;
243*cdf0e10cSrcweir 		try
244*cdf0e10cSrcweir 		{
245*cdf0e10cSrcweir 			// create a statement
246*cdf0e10cSrcweir 			Reference< XStatement > xStatement = m_xConnection->createStatement();
247*cdf0e10cSrcweir 			OSL_ENSURE(xStatement.is(), "DirectSQLDialog::implExecuteStatement: no statement returned by the connection!");
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 			// execute it
250*cdf0e10cSrcweir 			if (xStatement.is())
251*cdf0e10cSrcweir 				xStatement->execute(_rStatement);
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 			// successfull
254*cdf0e10cSrcweir 			sStatus = String(ModuleRes(STR_COMMAND_EXECUTED_SUCCESSFULLY));
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir 			// dispose the statement
257*cdf0e10cSrcweir 			::comphelper::disposeComponent(xStatement);
258*cdf0e10cSrcweir 		}
259*cdf0e10cSrcweir 		catch(const SQLException& e)
260*cdf0e10cSrcweir 		{
261*cdf0e10cSrcweir 			sStatus = e.Message;
262*cdf0e10cSrcweir 		}
263*cdf0e10cSrcweir         catch( const Exception& )
264*cdf0e10cSrcweir         {
265*cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
266*cdf0e10cSrcweir         }
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir 		// add the status text
269*cdf0e10cSrcweir 		addStatusText(sStatus);
270*cdf0e10cSrcweir 	}
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir 	//--------------------------------------------------------------------
273*cdf0e10cSrcweir 	void DirectSQLDialog::addStatusText(const String& _rMessage)
274*cdf0e10cSrcweir 	{
275*cdf0e10cSrcweir 		String sAppendMessage = String::CreateFromInt32(m_nStatusCount++);
276*cdf0e10cSrcweir 		sAppendMessage += String::CreateFromAscii(": ");
277*cdf0e10cSrcweir 		sAppendMessage += _rMessage;
278*cdf0e10cSrcweir 		sAppendMessage += String::CreateFromAscii("\n\n");
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 		String sCompleteMessage = m_aStatus.GetText();
281*cdf0e10cSrcweir 		sCompleteMessage += sAppendMessage;
282*cdf0e10cSrcweir 		m_aStatus.SetText(sCompleteMessage);
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 		m_aStatus.SetSelection(Selection(sCompleteMessage.Len(), sCompleteMessage.Len()));
285*cdf0e10cSrcweir 	}
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir 	//--------------------------------------------------------------------
288*cdf0e10cSrcweir 	void DirectSQLDialog::executeCurrent()
289*cdf0e10cSrcweir 	{
290*cdf0e10cSrcweir 		CHECK_INVARIANTS("DirectSQLDialog::executeCurrent");
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 		String sStatement = m_aSQL.GetText();
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 		// execute
295*cdf0e10cSrcweir 		implExecuteStatement(sStatement);
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 		// add the statement to the history
298*cdf0e10cSrcweir 		implAddToStatementHistory(sStatement);
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 		m_aSQL.SetSelection(Selection());
301*cdf0e10cSrcweir 		m_aSQL.GrabFocus();
302*cdf0e10cSrcweir 	}
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir 	//--------------------------------------------------------------------
305*cdf0e10cSrcweir 	void DirectSQLDialog::switchToHistory(sal_Int32 _nHistoryPos, sal_Bool _bUpdateListBox)
306*cdf0e10cSrcweir 	{
307*cdf0e10cSrcweir 		CHECK_INVARIANTS("DirectSQLDialog::switchToHistory");
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 		if ((_nHistoryPos >= 0) && (_nHistoryPos < getHistorySize()))
310*cdf0e10cSrcweir 		{
311*cdf0e10cSrcweir 			// set the text in the statement editor
312*cdf0e10cSrcweir 			String sStatement = m_aStatementHistory[_nHistoryPos];
313*cdf0e10cSrcweir 			m_aSQL.SetText(sStatement);
314*cdf0e10cSrcweir 			OnStatementModified(&m_aSQL);
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir 			if (_bUpdateListBox)
317*cdf0e10cSrcweir 			{
318*cdf0e10cSrcweir 				// selecte the normalized statement in the list box
319*cdf0e10cSrcweir 				m_pSQLHistory->SelectEntryPos((sal_uInt16)_nHistoryPos);
320*cdf0e10cSrcweir 				OSL_ENSURE(m_pSQLHistory->GetSelectEntry() == m_aNormalizedHistory[_nHistoryPos],
321*cdf0e10cSrcweir 					"DirectSQLDialog::switchToHistory: inconsistent listbox entries!");
322*cdf0e10cSrcweir 			}
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 			m_aSQL.GrabFocus();
325*cdf0e10cSrcweir 			m_aSQL.SetSelection(Selection(sStatement.Len(), sStatement.Len()));
326*cdf0e10cSrcweir 		}
327*cdf0e10cSrcweir 		else
328*cdf0e10cSrcweir 			OSL_ENSURE(sal_False, "DirectSQLDialog::switchToHistory: invalid position!");
329*cdf0e10cSrcweir 	}
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir 	//--------------------------------------------------------------------
332*cdf0e10cSrcweir 	IMPL_LINK( DirectSQLDialog, OnStatementModified, void*, /*NOTINTERESTEDIN*/ )
333*cdf0e10cSrcweir 	{
334*cdf0e10cSrcweir 		m_aExecute.Enable(0 != m_aSQL.GetText().Len());
335*cdf0e10cSrcweir 		return 0L;
336*cdf0e10cSrcweir 	}
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 	//--------------------------------------------------------------------
339*cdf0e10cSrcweir 	IMPL_LINK( DirectSQLDialog, OnClose, void*, /*NOTINTERESTEDIN*/ )
340*cdf0e10cSrcweir 	{
341*cdf0e10cSrcweir 		EndDialog( RET_OK );
342*cdf0e10cSrcweir 		return 0L;
343*cdf0e10cSrcweir 	}
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir 	//--------------------------------------------------------------------
346*cdf0e10cSrcweir 	IMPL_LINK( DirectSQLDialog, OnExecute, void*, /*NOTINTERESTEDIN*/ )
347*cdf0e10cSrcweir 	{
348*cdf0e10cSrcweir 		executeCurrent();
349*cdf0e10cSrcweir 		return 0L;
350*cdf0e10cSrcweir 	}
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 	//--------------------------------------------------------------------
353*cdf0e10cSrcweir 	IMPL_LINK( DirectSQLDialog, OnListEntrySelected, void*, /*NOTINTERESTEDIN*/ )
354*cdf0e10cSrcweir 	{
355*cdf0e10cSrcweir 		if (!m_pSQLHistory->IsTravelSelect())
356*cdf0e10cSrcweir 		{
357*cdf0e10cSrcweir 			const sal_uInt16 nSelected = m_pSQLHistory->GetSelectEntryPos();
358*cdf0e10cSrcweir 			if (LISTBOX_ENTRY_NOTFOUND != nSelected)
359*cdf0e10cSrcweir 				switchToHistory(nSelected, sal_False);
360*cdf0e10cSrcweir 		}
361*cdf0e10cSrcweir 		return 0L;
362*cdf0e10cSrcweir 	}
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir //........................................................................
365*cdf0e10cSrcweir }	// namespace dbaui
366*cdf0e10cSrcweir //........................................................................
367*cdf0e10cSrcweir 
368