2010-10-27 12:33:13 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
#ifndef _DBACCESS_UI_DIRECTSQL_HXX_
|
|
|
|
#define _DBACCESS_UI_DIRECTSQL_HXX_
|
|
|
|
|
|
|
|
#include <vcl/dialog.hxx>
|
2008-11-28 11:39:37 +00:00
|
|
|
#include <svtools/editsyntaxhighlighter.hxx>
|
2001-06-19 09:54:55 +00:00
|
|
|
#include <vcl/fixed.hxx>
|
|
|
|
#include <vcl/lstbox.hxx>
|
|
|
|
#include <vcl/button.hxx>
|
|
|
|
#include <comphelper/stl_types.hxx>
|
2001-06-22 13:17:03 +00:00
|
|
|
#include <deque>
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
|
|
|
#include <unotools/eventlisteneradapter.hxx>
|
2007-07-06 07:28:58 +00:00
|
|
|
#include "moduledbu.hxx"
|
2001-06-19 09:54:55 +00:00
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
|
2012-06-29 11:00:59 +08:00
|
|
|
#include <svtools/editbrowsebox.hxx>
|
|
|
|
|
2001-06-19 09:54:55 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
|
2013-08-17 23:43:14 +02:00
|
|
|
// DirectSQLDialog
|
2001-06-19 09:54:55 +00:00
|
|
|
class DirectSQLDialog
|
|
|
|
:public ModalDialog
|
|
|
|
,public ::utl::OEventListenerAdapter
|
|
|
|
{
|
|
|
|
protected:
|
2007-07-06 07:28:58 +00:00
|
|
|
OModuleClient m_aModuleClient;
|
2001-06-19 09:54:55 +00:00
|
|
|
::osl::Mutex m_aMutex;
|
|
|
|
|
2013-07-29 19:54:43 +02:00
|
|
|
MultiLineEditSyntaxHighlight* m_pSQL;
|
2013-07-30 14:24:32 +01:00
|
|
|
PushButton* m_pExecute;
|
|
|
|
ListBox* m_pSQLHistory;
|
|
|
|
VclMultiLineEdit* m_pStatus;
|
|
|
|
CheckBox* m_pShowOutput;
|
|
|
|
VclMultiLineEdit* m_pOutput;
|
|
|
|
HelpButton* m_pHelp;
|
|
|
|
PushButton* m_pClose;
|
2001-06-19 09:54:55 +00:00
|
|
|
|
2013-09-26 12:17:53 +02:00
|
|
|
typedef ::std::deque< OUString > StringQueue;
|
2001-06-19 09:54:55 +00:00
|
|
|
StringQueue m_aStatementHistory; // previous statements
|
|
|
|
StringQueue m_aNormalizedHistory; // previous statements, normalized to be used in the list box
|
|
|
|
|
|
|
|
sal_Int32 m_nHistoryLimit;
|
|
|
|
sal_Int32 m_nStatusCount;
|
|
|
|
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
|
|
|
|
m_xConnection;
|
|
|
|
|
|
|
|
public:
|
|
|
|
DirectSQLDialog(
|
|
|
|
Window* _pParent,
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn);
|
|
|
|
~DirectSQLDialog();
|
|
|
|
|
|
|
|
/// number of history entries
|
|
|
|
sal_Int32 getHistorySize() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void executeCurrent();
|
|
|
|
void switchToHistory(sal_Int32 _nHistoryPos, sal_Bool _bUpdateListBox = sal_True);
|
|
|
|
|
|
|
|
// OEventListenerAdapter
|
|
|
|
virtual void _disposing( const ::com::sun::star::lang::EventObject& _rSource );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
DECL_LINK( OnExecute, void* );
|
|
|
|
DECL_LINK( OnClose, void* );
|
|
|
|
DECL_LINK( OnListEntrySelected, void* );
|
|
|
|
DECL_LINK( OnStatementModified, void* );
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// adds a statement to the statement history
|
2013-09-26 12:17:53 +02:00
|
|
|
void implAddToStatementHistory(const OUString& _rStatement);
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
/// ensures that our history has at most m_nHistoryLimit entries
|
|
|
|
void implEnsureHistoryLimit();
|
|
|
|
|
|
|
|
/// executes the statement given, adds the status to the status list
|
2013-09-26 12:17:53 +02:00
|
|
|
void implExecuteStatement(const OUString& _rStatement);
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
/// adds a status text to the status list
|
2013-09-26 12:17:53 +02:00
|
|
|
void addStatusText(const OUString& _rMessage);
|
2001-06-19 09:54:55 +00:00
|
|
|
|
2012-06-29 11:00:59 +08:00
|
|
|
/// adds a status text to the output list
|
2013-09-26 12:17:53 +02:00
|
|
|
void addOutputText(const OUString& _rMessage);
|
2012-06-29 11:00:59 +08:00
|
|
|
|
2001-06-19 09:54:55 +00:00
|
|
|
#ifdef DBG_UTIL
|
|
|
|
const sal_Char* impl_CheckInvariants() const;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef DBG_UTIL
|
|
|
|
#define CHECK_INVARIANTS(methodname) \
|
|
|
|
{ \
|
|
|
|
const sal_Char* pError = impl_CheckInvariants(); \
|
|
|
|
if (pError) \
|
2013-03-30 04:57:16 +01:00
|
|
|
SAL_WARN("dbaccess.ui", methodname << ": " << pError); \
|
2001-06-19 09:54:55 +00:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define CHECK_INVARIANTS(methodname)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} // namespace dbaui
|
|
|
|
|
|
|
|
#endif // _DBACCESS_UI_DIRECTSQL_HXX_
|
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|