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 css::uno::Reference
< css::sdbc::XConnection
>
72 vcl::Window
* _pParent
,
73 const css::uno::Reference
< css::sdbc::XConnection
>& _rxConn
);
74 virtual ~DirectSQLDialog();
75 virtual void dispose() override
;
77 /// number of history entries
78 sal_Int32
getHistorySize() const;
81 void executeCurrent();
82 void switchToHistory(sal_Int32 _nHistoryPos
);
84 // OEventListenerAdapter
85 virtual void _disposing( const css::lang::EventObject
& _rSource
) override
;
88 DECL_LINK_TYPED( OnExecute
, Button
*, void );
89 DECL_LINK_TYPED( OnClose
, void*, void );
90 DECL_LINK_TYPED( OnCloseClick
, Button
*, void );
91 DECL_LINK_TYPED( OnListEntrySelected
, ListBox
&, void );
92 DECL_LINK_TYPED( OnStatementModified
, Edit
&, void );
95 /// adds a statement to the statement history
96 void implAddToStatementHistory(const OUString
& _rStatement
);
98 /// ensures that our history has at most m_nHistoryLimit entries
99 void implEnsureHistoryLimit();
101 /// executes the statement given, adds the status to the status list
102 void implExecuteStatement(const OUString
& _rStatement
);
104 /// adds a status text to the status list
105 void addStatusText(const OUString
& _rMessage
);
107 /// adds a status text to the output list
108 void addOutputText(const OUString
& _rMessage
);
111 const sal_Char
* impl_CheckInvariants() const;
116 #define CHECK_INVARIANTS(methodname) \
118 const sal_Char* pError = impl_CheckInvariants(); \
120 SAL_WARN("dbaccess.ui", methodname ": " << pError); \
123 #define CHECK_INVARIANTS(methodname)
128 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_DIRECTSQL_HXX
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */