android: Update app icon to new startcenter icon
[LibreOffice.git] / dbaccess / source / ui / inc / directsql.hxx
blobbfe8195fc5ff0186a7bd53d7516f12afdbf12ddc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <sal/config.h>
24 #include <vcl/weld.hxx>
25 #include <deque>
26 #include <string_view>
28 #include <com/sun/star/sdbc/XConnection.hpp>
29 #include <unotools/eventlisteneradapter.hxx>
30 #include <osl/mutex.hxx>
32 #include "sqledit.hxx"
34 struct ImplSVEvent;
36 namespace dbaui
38 // DirectSQLDialog
39 class DirectSQLDialog final
40 : public weld::GenericDialogController
41 , public ::utl::OEventListenerAdapter
43 ::osl::Mutex m_aMutex;
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;
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
59 sal_Int32 m_nStatusCount;
61 css::uno::Reference< css::sdbc::XConnection >
62 m_xConnection;
64 ImplSVEvent* m_pClosingEvent;
66 public:
67 DirectSQLDialog(
68 weld::Window* _pParent,
69 const css::uno::Reference< css::sdbc::XConnection >& _rxConn);
70 virtual ~DirectSQLDialog() override;
72 /// number of history entries
73 sal_Int32 getHistorySize() const;
75 private:
76 void executeCurrent();
77 void switchToHistory(sal_Int32 _nHistoryPos);
79 // OEventListenerAdapter
80 virtual void _disposing( const css::lang::EventObject& _rSource ) override;
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 );
88 /// adds a statement to the statement history
89 void implAddToStatementHistory(const OUString& _rStatement);
91 /// ensures that our history has at most m_nHistoryLimit entries
92 void implEnsureHistoryLimit();
94 /// executes the statement given, adds the status to the status list
95 void implExecuteStatement(const OUString& _rStatement);
97 /// adds a status text to the status list
98 void addStatusText(std::u16string_view _rMessage);
100 /// adds a status text to the output list
101 void addOutputText(std::u16string_view _rMessage);
103 /// displays resultset
104 void display(const css::uno::Reference< css::sdbc::XResultSet >& xRS);
106 #ifdef DBG_UTIL
107 const char* impl_CheckInvariants() const;
108 #endif
111 } // namespace dbaui
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */