LibreOffice Module dbaccess (master) 1
directsql.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <sal/config.h>
23
24#include <vcl/weld.hxx>
25#include <deque>
26#include <string_view>
27
28#include <com/sun/star/sdbc/XConnection.hpp>
30#include <osl/mutex.hxx>
31
32#include "sqledit.hxx"
33
34struct ImplSVEvent;
35
36namespace dbaui
37{
38 // DirectSQLDialog
39 class DirectSQLDialog final
42 {
43 ::osl::Mutex m_aMutex;
44
45 std::unique_ptr<weld::Button> m_xExecute;
46 std::unique_ptr<weld::ComboBox> m_xSQLHistory;
47 std::unique_ptr<weld::TextView> m_xStatus;
48 std::unique_ptr<weld::CheckButton> m_xDirectSQL;
49 std::unique_ptr<weld::CheckButton> m_xShowOutput;
50 std::unique_ptr<weld::TextView> m_xOutput;
51 std::unique_ptr<weld::Button> m_xClose;
52 std::unique_ptr<SQLEditView> m_xSQL;
53 std::unique_ptr<weld::CustomWeld> m_xSQLEd;
54
55 typedef std::deque< OUString > StringQueue;
56 StringQueue m_aStatementHistory; // previous statements
57 StringQueue m_aNormalizedHistory; // previous statements, normalized to be used in the list box
58
59 sal_Int32 m_nStatusCount;
60
61 css::uno::Reference< css::sdbc::XConnection >
63
65
66 public:
68 weld::Window* _pParent,
69 const css::uno::Reference< css::sdbc::XConnection >& _rxConn);
70 virtual ~DirectSQLDialog() override;
71
73 sal_Int32 getHistorySize() const;
74
75 private:
76 void executeCurrent();
77 void switchToHistory(sal_Int32 _nHistoryPos);
78
79 // OEventListenerAdapter
80 virtual void _disposing( const css::lang::EventObject& _rSource ) override;
81
82 DECL_LINK( OnExecute, weld::Button&, void );
83 DECL_LINK( OnClose, void*, void );
84 DECL_LINK( OnCloseClick, weld::Button&, void );
85 DECL_LINK( OnListEntrySelected, weld::ComboBox&, void );
86 DECL_LINK( OnStatementModified, LinkParamNone*, void );
87
89 void implAddToStatementHistory(const OUString& _rStatement);
90
93
95 void implExecuteStatement(const OUString& _rStatement);
96
98 void addStatusText(std::u16string_view _rMessage);
99
101 void addOutputText(std::u16string_view _rMessage);
102
104 void display(const css::uno::Reference< css::sdbc::XResultSet >& xRS);
105
106#ifdef DBG_UTIL
107 const char* impl_CheckInvariants() const;
108#endif
109 };
110
111} // namespace dbaui
112
113/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::TextView > m_xStatus
Definition: directsql.hxx:47
virtual void _disposing(const css::lang::EventObject &_rSource) override
Definition: directsql.cxx:91
void addStatusText(std::u16string_view _rMessage)
adds a status text to the status list
Definition: directsql.cxx:348
void implAddToStatementHistory(const OUString &_rStatement)
adds a statement to the statement history
Definition: directsql.cxx:147
StringQueue m_aStatementHistory
Definition: directsql.hxx:56
ImplSVEvent * m_pClosingEvent
Definition: directsql.hxx:64
StringQueue m_aNormalizedHistory
Definition: directsql.hxx:57
std::unique_ptr< weld::Button > m_xClose
Definition: directsql.hxx:51
const char * impl_CheckInvariants() const
Definition: directsql.cxx:172
void implEnsureHistoryLimit()
ensures that our history has at most m_nHistoryLimit entries
Definition: directsql.cxx:124
::osl::Mutex m_aMutex
Definition: directsql.hxx:43
std::unique_ptr< weld::CheckButton > m_xDirectSQL
Definition: directsql.hxx:48
DECL_LINK(OnExecute, weld::Button &, void)
std::unique_ptr< SQLEditView > m_xSQL
Definition: directsql.hxx:52
std::unique_ptr< weld::Button > m_xExecute
Definition: directsql.hxx:45
void display(const css::uno::Reference< css::sdbc::XResultSet > &xRS)
displays resultset
Definition: directsql.cxx:306
css::uno::Reference< css::sdbc::XConnection > m_xConnection
Definition: directsql.hxx:62
std::unique_ptr< weld::CustomWeld > m_xSQLEd
Definition: directsql.hxx:53
void addOutputText(std::u16string_view _rMessage)
adds a status text to the output list
Definition: directsql.cxx:358
void switchToHistory(sal_Int32 _nHistoryPos)
Definition: directsql.cxx:387
std::deque< OUString > StringQueue
Definition: directsql.hxx:55
void implExecuteStatement(const OUString &_rStatement)
executes the statement given, adds the status to the status list
Definition: directsql.cxx:190
std::unique_ptr< weld::TextView > m_xOutput
Definition: directsql.hxx:50
DECL_LINK(OnStatementModified, LinkParamNone *, void)
virtual ~DirectSQLDialog() override
Definition: directsql.cxx:83
std::unique_ptr< weld::CheckButton > m_xShowOutput
Definition: directsql.hxx:49
DECL_LINK(OnListEntrySelected, weld::ComboBox &, void)
DECL_LINK(OnClose, void *, void)
DECL_LINK(OnCloseClick, weld::Button &, void)
DirectSQLDialog(weld::Window *_pParent, const css::uno::Reference< css::sdbc::XConnection > &_rxConn)
Definition: directsql.cxx:45
sal_Int32 m_nStatusCount
Definition: directsql.hxx:59
std::unique_ptr< weld::ComboBox > m_xSQLHistory
Definition: directsql.hxx:46
sal_Int32 getHistorySize() const
number of history entries
Definition: directsql.cxx:112