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 .
|
|
|
|
*/
|
2020-09-13 12:06:53 +00:00
|
|
|
#pragma once
|
2001-02-05 08:10:26 +00:00
|
|
|
|
2015-09-17 11:30:13 +01:00
|
|
|
#include <memory>
|
2014-02-10 15:28:03 +00:00
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
2019-09-17 09:13:14 +01:00
|
|
|
#include <vcl/weld.hxx>
|
2001-02-05 08:10:26 +00:00
|
|
|
#include "tabletree.hxx"
|
|
|
|
|
|
|
|
namespace dbaui
|
|
|
|
{
|
2006-07-10 14:30:01 +00:00
|
|
|
/** unifies the access to a list of table/query objects
|
|
|
|
*/
|
|
|
|
class TableObjectListFacade
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void updateTableObjectList( bool _bAllowViews ) = 0;
|
2013-09-26 12:17:53 +02:00
|
|
|
virtual OUString getSelectedName( OUString& _out_rAliasName ) const = 0;
|
2006-07-10 14:30:01 +00:00
|
|
|
virtual bool isLeafSelected() const = 0;
|
|
|
|
|
|
|
|
virtual ~TableObjectListFacade();
|
|
|
|
};
|
|
|
|
|
|
|
|
class IAddTableDialogContext
|
|
|
|
{
|
|
|
|
public:
|
2015-08-03 09:14:58 +02:00
|
|
|
virtual css::uno::Reference< css::sdbc::XConnection >
|
2006-07-10 14:30:01 +00:00
|
|
|
getConnection() const = 0;
|
|
|
|
virtual bool allowViews() const = 0;
|
|
|
|
virtual bool allowQueries() const = 0;
|
|
|
|
virtual bool allowAddition() const = 0;
|
2013-09-26 12:17:53 +02:00
|
|
|
virtual void addTableWindow( const OUString& _rQualifiedTableName, const OUString& _rAliasName ) = 0;
|
2019-04-06 19:47:52 +01:00
|
|
|
virtual void onWindowClosing() = 0;
|
2012-03-14 13:27:56 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
~IAddTableDialogContext() {}
|
2006-07-10 14:30:01 +00:00
|
|
|
};
|
|
|
|
|
2019-04-06 19:47:52 +01:00
|
|
|
class OAddTableDlg : public weld::GenericDialogController
|
2001-02-05 08:10:26 +00:00
|
|
|
{
|
2019-04-06 19:47:52 +01:00
|
|
|
IAddTableDialogContext& m_rContext;
|
2015-09-17 11:30:13 +01:00
|
|
|
std::unique_ptr< TableObjectListFacade > m_xCurrentList;
|
2006-07-10 14:30:01 +00:00
|
|
|
|
2019-04-06 19:47:52 +01:00
|
|
|
std::unique_ptr<weld::RadioButton> m_xCaseTables;
|
|
|
|
std::unique_ptr<weld::RadioButton> m_xCaseQueries;
|
2001-02-05 08:10:26 +00:00
|
|
|
|
2020-08-17 17:28:58 +01:00
|
|
|
std::unique_ptr<OTableTreeListBox> m_xTableList;
|
2019-04-06 19:47:52 +01:00
|
|
|
std::unique_ptr<weld::TreeView> m_xQueryList;
|
2001-02-05 08:10:26 +00:00
|
|
|
|
2019-04-06 19:47:52 +01:00
|
|
|
std::unique_ptr<weld::Button> m_xAddButton;
|
|
|
|
std::unique_ptr<weld::Button> m_xCloseButton;
|
|
|
|
|
|
|
|
DECL_LINK( AddClickHdl, weld::Button&, void );
|
|
|
|
DECL_LINK( CloseClickHdl, weld::Button&, void);
|
2019-10-05 18:36:38 +01:00
|
|
|
DECL_LINK( TableListDoubleClickHdl, weld::TreeView&, bool );
|
2019-04-06 19:47:52 +01:00
|
|
|
DECL_LINK( TableListSelectHdl, weld::TreeView&, void );
|
2021-05-20 17:27:49 +01:00
|
|
|
DECL_LINK( OnTypeSelected, weld::Toggleable&, void );
|
2006-07-10 14:30:01 +00:00
|
|
|
|
2001-02-05 08:10:26 +00:00
|
|
|
public:
|
2019-04-06 19:47:52 +01:00
|
|
|
OAddTableDlg(weld::Window* _pParent,
|
|
|
|
IAddTableDialogContext& _rContext);
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~OAddTableDlg() override;
|
2001-02-05 08:10:26 +00:00
|
|
|
|
2006-07-10 14:30:01 +00:00
|
|
|
void Update();
|
2019-04-06 19:47:52 +01:00
|
|
|
void OnClose();
|
2006-07-10 14:30:01 +00:00
|
|
|
|
2013-09-26 12:17:53 +02:00
|
|
|
static OUString getDialogTitleForContext(
|
2017-07-31 12:26:12 +02:00
|
|
|
IAddTableDialogContext const & _rContext );
|
2006-07-10 14:30:01 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool impl_isAddAllowed();
|
|
|
|
|
|
|
|
enum ObjectList
|
|
|
|
{
|
|
|
|
Tables,
|
|
|
|
Queries
|
|
|
|
};
|
|
|
|
void impl_switchTo( ObjectList _eList );
|
2001-02-05 08:10:26 +00:00
|
|
|
};
|
|
|
|
}
|
2010-10-27 12:33:13 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|