Files
libreoffice/dbaccess/source/ui/inc/directsql.hxx

128 lines
4.1 KiB
C++
Raw Normal View History

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 .
*/
#ifndef _DBACCESS_UI_DIRECTSQL_HXX_
#define _DBACCESS_UI_DIRECTSQL_HXX_
#include <vcl/dialog.hxx>
CWS-TOOLING: integrate CWS sqlsyntaxhighlighting 2008-11-20 17:23:29 +0100 mod r264074 : new colors by UX 2008-11-17 17:37:19 +0100 mod r263732 : revert manual fix for icu 2008-11-17 15:03:39 +0100 mod r263725 : manual fix for icu 2008-11-17 11:26:39 +0100 mod r263709 : manual fix for icu 2008-11-16 18:19:16 +0100 mod r263702 : `fix 2008-11-12 22:11:50 +0100 mod r263619 : CWS-TOOLING: rebase CWS sqlsyntaxhighlighting to trunk@263288 (milestone: DEV300:m35) 2008-11-12 11:04:33 +0100 mod r263578 : minor cleanup 2008-11-12 11:03:02 +0100 mod r263577 : seperate MulitLineEditSyntaxHighlighter into new file 2008-11-06 15:13:27 +0100 fs r263391 : merged from trunk 2008-11-06 15:09:20 +0100 fs r263390 : merged from trunk 2008-11-06 15:07:06 +0100 fs r263388 : reverted the change c262599. This seems to be a merge from trunk, but without properly setting svn:mergeinfo, thus it results in conflicts when doing a real 'svn merge'. 2008-11-06 15:03:19 +0100 fs r263387 : merged rev. 262769 2008-11-03 17:58:19 +0100 mod r263297 : little fixes 2008-11-03 17:56:49 +0100 mod r263296 : little fixes 2008-11-03 17:12:41 +0100 mod r263295 : new entry SQL comment for Tools-Appearance 2008-11-03 17:12:13 +0100 mod r263294 : different tokenizer based on language 2008-11-03 17:11:40 +0100 mod r263293 : new entry for Tools-Appearance: SQL Comment 2008-11-03 17:11:14 +0100 mod r263292 : get notification about color changes for sql view 2008-10-29 00:01:40 +0100 mod r262768 : string listbox 2008-10-28 23:57:45 +0100 mod r262767 : string listbox 2008-10-22 18:38:07 +0200 mod r262614 : source alignment fix 2008-10-22 18:37:23 +0200 mod r262613 : '' as string as well 2008-10-22 18:36:45 +0200 mod r262612 : get syntax highlighting in tools-sql... 2008-10-22 14:11:12 +0200 mod r262605 : formatting fix 2008-10-22 13:30:42 +0200 mod r262599 : additional entries for Tools-Options-Appearance 2008-10-19 22:53:50 +0200 mod r262302 : migration from cvs to svn 2008-10-19 22:37:45 +0200 mod r262301 : migration from cvs to svn 2008-10-19 22:36:04 +0200 mod r262300 : migration from cvs to svn
2008-11-28 11:39:37 +00:00
#include <svtools/editsyntaxhighlighter.hxx>
#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>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <unotools/eventlisteneradapter.hxx>
#include "moduledbu.hxx"
#include <osl/mutex.hxx>
#include <svtools/editbrowsebox.hxx>
namespace dbaui
{
// DirectSQLDialog
class DirectSQLDialog
:public ModalDialog
,public ::utl::OEventListenerAdapter
{
protected:
OModuleClient m_aModuleClient;
::osl::Mutex m_aMutex;
MultiLineEditSyntaxHighlight* m_pSQL;
PushButton* m_pExecute;
ListBox* m_pSQLHistory;
VclMultiLineEdit* m_pStatus;
CheckBox* m_pShowOutput;
VclMultiLineEdit* m_pOutput;
HelpButton* m_pHelp;
PushButton* m_pClose;
typedef ::std::deque< OUString > StringQueue;
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
void implAddToStatementHistory(const OUString& _rStatement);
/// ensures that our history has at most m_nHistoryLimit entries
void implEnsureHistoryLimit();
/// executes the statement given, adds the status to the status list
void implExecuteStatement(const OUString& _rStatement);
/// adds a status text to the status list
void addStatusText(const OUString& _rMessage);
/// adds a status text to the output list
void addOutputText(const OUString& _rMessage);
#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) \
SAL_WARN("dbaccess.ui", methodname << ": " << pError); \
}
#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: */