1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_DIRECTSQL_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_DIRECTSQL_HXX
23 #include <sal/config.h>
25 #include <sal/log.hxx>
26 #include <vcl/dialog.hxx>
27 #include <svtools/editsyntaxhighlighter.hxx>
28 #include <vcl/fixed.hxx>
29 #include <vcl/lstbox.hxx>
30 #include <vcl/button.hxx>
33 #include <com/sun/star/sdbc/XConnection.hpp>
34 #include <unotools/eventlisteneradapter.hxx>
35 #include "moduledbu.hxx"
36 #include <osl/mutex.hxx>
38 #include <svtools/editbrowsebox.hxx>
46 ,public ::utl::OEventListenerAdapter
49 OModuleClient m_aModuleClient
;
50 ::osl::Mutex m_aMutex
;
52 VclPtr
<MultiLineEditSyntaxHighlight
> m_pSQL
;
53 VclPtr
<PushButton
> m_pExecute
;
54 VclPtr
<ListBox
> m_pSQLHistory
;
55 VclPtr
<VclMultiLineEdit
> m_pStatus
;
56 VclPtr
<CheckBox
> m_pShowOutput
;
57 VclPtr
<VclMultiLineEdit
> m_pOutput
;
58 VclPtr
<PushButton
> m_pClose
;
60 typedef ::std::deque
< OUString
> StringQueue
;
61 StringQueue m_aStatementHistory
; // previous statements
62 StringQueue m_aNormalizedHistory
; // previous statements, normalized to be used in the list box
64 sal_Int32 m_nHistoryLimit
;
65 sal_Int32 m_nStatusCount
;
67 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>
72 vcl::Window
* _pParent
,
73 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConn
);
74 virtual ~DirectSQLDialog();
75 virtual void dispose() SAL_OVERRIDE
;
77 /// number of history entries
78 sal_Int32
getHistorySize() const;
81 void executeCurrent();
82 void switchToHistory(sal_Int32 _nHistoryPos
, bool _bUpdateListBox
= true);
84 // OEventListenerAdapter
85 virtual void _disposing( const ::com::sun::star::lang::EventObject
& _rSource
) SAL_OVERRIDE
;
88 DECL_LINK( OnExecute
, void* );
89 DECL_LINK( OnClose
, void* );
90 DECL_LINK( OnListEntrySelected
, void* );
91 DECL_LINK( OnStatementModified
, void* );
94 /// adds a statement to the statement history
95 void implAddToStatementHistory(const OUString
& _rStatement
);
97 /// ensures that our history has at most m_nHistoryLimit entries
98 void implEnsureHistoryLimit();
100 /// executes the statement given, adds the status to the status list
101 void implExecuteStatement(const OUString
& _rStatement
);
103 /// adds a status text to the status list
104 void addStatusText(const OUString
& _rMessage
);
106 /// adds a status text to the output list
107 void addOutputText(const OUString
& _rMessage
);
110 const sal_Char
* impl_CheckInvariants() const;
115 #define CHECK_INVARIANTS(methodname) \
117 const sal_Char* pError = impl_CheckInvariants(); \
119 SAL_WARN("dbaccess.ui", methodname ": " << pError); \
122 #define CHECK_INVARIANTS(methodname)
127 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DIRECTSQL_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */