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 .
|
|
|
|
*/
|
2001-06-19 09:54:55 +00:00
|
|
|
|
2020-09-13 12:06:53 +00:00
|
|
|
#pragma once
|
2001-06-19 09:54:55 +00:00
|
|
|
|
2015-04-22 09:42:28 +02:00
|
|
|
#include <sal/config.h>
|
|
|
|
|
2019-09-15 20:18:38 +01:00
|
|
|
#include <vcl/weld.hxx>
|
2001-06-22 13:17:03 +00:00
|
|
|
#include <deque>
|
2020-12-28 17:56:40 +01:00
|
|
|
#include <string_view>
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
|
|
|
#include <unotools/eventlisteneradapter.hxx>
|
|
|
|
#include <osl/mutex.hxx>
|
|
|
|
|
2020-08-18 12:02:45 +01:00
|
|
|
#include "sqledit.hxx"
|
2012-06-29 11:00:59 +08:00
|
|
|
|
2020-04-26 15:43:25 +01:00
|
|
|
struct ImplSVEvent;
|
|
|
|
|
2001-06-19 09:54:55 +00:00
|
|
|
namespace dbaui
|
|
|
|
{
|
2013-08-17 23:43:14 +02:00
|
|
|
// DirectSQLDialog
|
2017-11-06 11:11:04 +02:00
|
|
|
class DirectSQLDialog final
|
2019-09-15 20:18:38 +01:00
|
|
|
: public weld::GenericDialogController
|
|
|
|
, public ::utl::OEventListenerAdapter
|
2001-06-19 09:54:55 +00:00
|
|
|
{
|
|
|
|
::osl::Mutex m_aMutex;
|
|
|
|
|
2019-09-15 20:18:38 +01:00
|
|
|
std::unique_ptr<weld::Button> m_xExecute;
|
|
|
|
std::unique_ptr<weld::ComboBox> m_xSQLHistory;
|
|
|
|
std::unique_ptr<weld::TextView> m_xStatus;
|
2021-08-16 12:19:01 +02:00
|
|
|
std::unique_ptr<weld::CheckButton> m_xDirectSQL;
|
2019-09-15 20:18:38 +01:00
|
|
|
std::unique_ptr<weld::CheckButton> m_xShowOutput;
|
|
|
|
std::unique_ptr<weld::TextView> m_xOutput;
|
|
|
|
std::unique_ptr<weld::Button> m_xClose;
|
|
|
|
std::unique_ptr<SQLEditView> m_xSQL;
|
|
|
|
std::unique_ptr<weld::CustomWeld> m_xSQLEd;
|
|
|
|
|
2017-02-17 19:06:24 +02:00
|
|
|
typedef std::deque< OUString > StringQueue;
|
2001-06-19 09:54:55 +00:00
|
|
|
StringQueue m_aStatementHistory; // previous statements
|
|
|
|
StringQueue m_aNormalizedHistory; // previous statements, normalized to be used in the list box
|
|
|
|
|
|
|
|
sal_Int32 m_nStatusCount;
|
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection >
|
2001-06-19 09:54:55 +00:00
|
|
|
m_xConnection;
|
|
|
|
|
2019-09-15 20:18:38 +01:00
|
|
|
ImplSVEvent* m_pClosingEvent;
|
|
|
|
|
2001-06-19 09:54:55 +00:00
|
|
|
public:
|
|
|
|
DirectSQLDialog(
|
2019-09-15 20:18:38 +01:00
|
|
|
weld::Window* _pParent,
|
2015-08-03 09:14:58 +02:00
|
|
|
const css::uno::Reference< css::sdbc::XConnection >& _rxConn);
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~DirectSQLDialog() override;
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
/// number of history entries
|
|
|
|
sal_Int32 getHistorySize() const;
|
|
|
|
|
2017-11-06 11:11:04 +02:00
|
|
|
private:
|
2001-06-19 09:54:55 +00:00
|
|
|
void executeCurrent();
|
2016-03-17 15:21:54 +02:00
|
|
|
void switchToHistory(sal_Int32 _nHistoryPos);
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
// OEventListenerAdapter
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void _disposing( const css::lang::EventObject& _rSource ) override;
|
2001-06-19 09:54:55 +00:00
|
|
|
|
2019-09-15 20:18:38 +01:00
|
|
|
DECL_LINK( OnExecute, weld::Button&, void );
|
2016-10-05 07:56:12 +02:00
|
|
|
DECL_LINK( OnClose, void*, void );
|
2019-09-15 20:18:38 +01:00
|
|
|
DECL_LINK( OnCloseClick, weld::Button&, void );
|
|
|
|
DECL_LINK( OnListEntrySelected, weld::ComboBox&, void );
|
|
|
|
DECL_LINK( OnStatementModified, LinkParamNone*, void );
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
/// adds a statement to the statement history
|
2013-09-26 12:17:53 +02:00
|
|
|
void implAddToStatementHistory(const OUString& _rStatement);
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
/// ensures that our history has at most m_nHistoryLimit entries
|
|
|
|
void implEnsureHistoryLimit();
|
|
|
|
|
|
|
|
/// executes the statement given, adds the status to the status list
|
2013-09-26 12:17:53 +02:00
|
|
|
void implExecuteStatement(const OUString& _rStatement);
|
2001-06-19 09:54:55 +00:00
|
|
|
|
|
|
|
/// adds a status text to the status list
|
2020-12-28 17:56:40 +01:00
|
|
|
void addStatusText(std::u16string_view _rMessage);
|
2001-06-19 09:54:55 +00:00
|
|
|
|
2012-06-29 11:00:59 +08:00
|
|
|
/// adds a status text to the output list
|
2020-12-28 17:56:40 +01:00
|
|
|
void addOutputText(std::u16string_view _rMessage);
|
2012-06-29 11:00:59 +08:00
|
|
|
|
2017-09-23 13:26:58 +02:00
|
|
|
/// displays resultset
|
2017-09-24 13:18:39 +02:00
|
|
|
void display(const css::uno::Reference< css::sdbc::XResultSet >& xRS);
|
2017-09-23 13:26:58 +02:00
|
|
|
|
2001-06-19 09:54:55 +00:00
|
|
|
#ifdef DBG_UTIL
|
2019-12-18 14:25:59 +02:00
|
|
|
const char* impl_CheckInvariants() const;
|
2001-06-19 09:54:55 +00:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dbaui
|
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|