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-03-16 15:22:00 +00:00
|
|
|
|
2020-09-13 12:06:53 +00:00
|
|
|
#pragma once
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
2002-07-30 08:45:49 +00:00
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
2001-03-16 15:22:00 +00:00
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
2014-01-02 23:52:37 +01:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2019-09-26 20:54:40 +01:00
|
|
|
#include <vcl/weld.hxx>
|
2001-03-19 05:02:09 +00:00
|
|
|
#include "indexes.hxx"
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
namespace dbaui
|
|
|
|
{
|
2013-08-17 23:43:14 +02:00
|
|
|
// DbaIndexDialog
|
2001-03-16 15:22:00 +00:00
|
|
|
class IndexFieldsControl;
|
|
|
|
class OIndexCollection;
|
2019-09-26 20:54:40 +01:00
|
|
|
class DbaIndexDialog final : public weld::GenericDialogController
|
2001-03-16 15:22:00 +00:00
|
|
|
{
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection > m_xConnection;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2019-09-26 20:54:40 +01:00
|
|
|
std::unique_ptr<OIndexCollection> m_xIndexes;
|
|
|
|
std::unique_ptr<weld::TreeIter> m_xPreviousSelection;
|
2019-10-03 11:46:44 +01:00
|
|
|
bool m_bEditingActive;
|
2015-08-03 09:14:58 +02:00
|
|
|
bool m_bEditAgain;
|
2019-09-26 20:54:40 +01:00
|
|
|
bool m_bNoHandlerCall;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::uno::XComponentContext >
|
|
|
|
m_xContext;
|
2019-09-26 20:54:40 +01:00
|
|
|
|
|
|
|
std::unique_ptr<weld::Toolbar> m_xActions;
|
|
|
|
std::unique_ptr<weld::TreeView> m_xIndexList;
|
|
|
|
std::unique_ptr<weld::Label> m_xIndexDetails;
|
|
|
|
std::unique_ptr<weld::Label> m_xDescriptionLabel;
|
|
|
|
std::unique_ptr<weld::Label> m_xDescription;
|
|
|
|
std::unique_ptr<weld::CheckButton> m_xUnique;
|
|
|
|
std::unique_ptr<weld::Label> m_xFieldsLabel;
|
|
|
|
std::unique_ptr<weld::Button> m_xClose;
|
|
|
|
std::unique_ptr<weld::Container> m_xTable;
|
|
|
|
css::uno::Reference<css::awt::XWindow> m_xTableCtrlParent;
|
|
|
|
VclPtr<IndexFieldsControl> m_xFields;
|
|
|
|
|
2001-03-16 15:22:00 +00:00
|
|
|
public:
|
|
|
|
DbaIndexDialog(
|
2019-09-26 20:54:40 +01:00
|
|
|
weld::Window* _pParent,
|
2015-08-03 09:14:58 +02:00
|
|
|
const css::uno::Sequence< OUString >& _rFieldNames,
|
|
|
|
const css::uno::Reference< css::container::XNameAccess >& _rxIndexes,
|
|
|
|
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
|
2019-09-26 20:54:40 +01:00
|
|
|
const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~DbaIndexDialog() override;
|
2014-06-10 12:32:03 +01:00
|
|
|
|
2019-09-26 20:54:40 +01:00
|
|
|
typedef std::pair<const weld::TreeIter&, OUString> IterString;
|
2017-11-06 11:11:04 +02:00
|
|
|
private:
|
2001-03-16 15:22:00 +00:00
|
|
|
void fillIndexList();
|
|
|
|
void updateToolbox();
|
2019-09-26 20:54:40 +01:00
|
|
|
void updateControls(const weld::TreeIter* pEntry);
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2019-09-26 20:54:40 +01:00
|
|
|
void IndexSelected();
|
|
|
|
|
|
|
|
DECL_LINK( OnIndexSelected, weld::TreeView&, void );
|
2023-04-02 01:18:42 +03:00
|
|
|
DECL_LINK( OnIndexAction, const OUString&, void );
|
2019-10-03 11:46:44 +01:00
|
|
|
DECL_LINK( OnEntryEditing, const weld::TreeIter&, bool );
|
2019-09-26 20:54:40 +01:00
|
|
|
DECL_LINK( OnEntryEdited, const IterString&, bool );
|
2021-05-20 17:27:49 +01:00
|
|
|
DECL_LINK( OnModifiedClick, weld::Toggleable&, void );
|
2016-10-05 07:56:12 +02:00
|
|
|
DECL_LINK( OnModified, IndexFieldsControl&, void );
|
2019-09-26 20:54:40 +01:00
|
|
|
DECL_LINK( OnCloseDialog, weld::Button&, void );
|
2016-10-05 07:56:12 +02:00
|
|
|
|
|
|
|
DECL_LINK( OnEditIndexAgain, void*, void );
|
2001-05-02 10:45:08 +00:00
|
|
|
|
2001-03-16 15:22:00 +00:00
|
|
|
void OnNewIndex();
|
2014-04-17 11:16:55 +02:00
|
|
|
void OnDropIndex(bool _bConfirm = true);
|
2001-03-16 15:22:00 +00:00
|
|
|
void OnRenameIndex();
|
|
|
|
void OnSaveIndex();
|
|
|
|
void OnResetIndex();
|
|
|
|
|
2019-09-26 20:54:40 +01:00
|
|
|
bool implCommit(const weld::TreeIter* pEntry);
|
2014-04-17 11:16:55 +02:00
|
|
|
bool implSaveModified(bool _bPlausibility = true);
|
|
|
|
bool implCommitPreviouslySelected();
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2019-09-26 20:54:40 +01:00
|
|
|
bool implDropIndex(const weld::TreeIter* pEntry, bool _bRemoveFromCollection);
|
2001-03-19 05:02:09 +00:00
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool implCheckPlausibility(const Indexes::const_iterator& _rPos);
|
2001-03-16 15:22:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dbaui
|
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|