Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / inc / indexdialog.hxx
blobb3ba37936e798416b1d5183ea42266ade3314330
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 <com/sun/star/container/XNameAccess.hpp>
23 #include <com/sun/star/sdbc/XConnection.hpp>
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <vcl/weld.hxx>
27 #include "indexes.hxx"
29 namespace dbaui
31 // DbaIndexDialog
32 class IndexFieldsControl;
33 class OIndexCollection;
34 class DbaIndexDialog final : public weld::GenericDialogController
36 css::uno::Reference< css::sdbc::XConnection > m_xConnection;
38 std::unique_ptr<OIndexCollection> m_xIndexes;
39 std::unique_ptr<weld::TreeIter> m_xPreviousSelection;
40 bool m_bEditingActive;
41 bool m_bEditAgain;
42 bool m_bNoHandlerCall;
44 css::uno::Reference< css::uno::XComponentContext >
45 m_xContext;
47 std::unique_ptr<weld::Toolbar> m_xActions;
48 std::unique_ptr<weld::TreeView> m_xIndexList;
49 std::unique_ptr<weld::Label> m_xIndexDetails;
50 std::unique_ptr<weld::Label> m_xDescriptionLabel;
51 std::unique_ptr<weld::Label> m_xDescription;
52 std::unique_ptr<weld::CheckButton> m_xUnique;
53 std::unique_ptr<weld::Label> m_xFieldsLabel;
54 std::unique_ptr<weld::Button> m_xClose;
55 std::unique_ptr<weld::Container> m_xTable;
56 css::uno::Reference<css::awt::XWindow> m_xTableCtrlParent;
57 VclPtr<IndexFieldsControl> m_xFields;
59 public:
60 DbaIndexDialog(
61 weld::Window* _pParent,
62 const css::uno::Sequence< OUString >& _rFieldNames,
63 const css::uno::Reference< css::container::XNameAccess >& _rxIndexes,
64 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
65 const css::uno::Reference< css::uno::XComponentContext >& _rxContext);
66 virtual ~DbaIndexDialog() override;
68 typedef std::pair<const weld::TreeIter&, OUString> IterString;
69 private:
70 void fillIndexList();
71 void updateToolbox();
72 void updateControls(const weld::TreeIter* pEntry);
74 void IndexSelected();
76 DECL_LINK( OnIndexSelected, weld::TreeView&, void );
77 DECL_LINK( OnIndexAction, const OUString&, void );
78 DECL_LINK( OnEntryEditing, const weld::TreeIter&, bool );
79 DECL_LINK( OnEntryEdited, const IterString&, bool );
80 DECL_LINK( OnModifiedClick, weld::Toggleable&, void );
81 DECL_LINK( OnModified, IndexFieldsControl&, void );
82 DECL_LINK( OnCloseDialog, weld::Button&, void );
84 DECL_LINK( OnEditIndexAgain, void*, void );
86 void OnNewIndex();
87 void OnDropIndex(bool _bConfirm = true);
88 void OnRenameIndex();
89 void OnSaveIndex();
90 void OnResetIndex();
92 bool implCommit(const weld::TreeIter* pEntry);
93 bool implSaveModified(bool _bPlausibility = true);
94 bool implCommitPreviouslySelected();
96 bool implDropIndex(const weld::TreeIter* pEntry, bool _bRemoveFromCollection);
98 bool implCheckPlausibility(const Indexes::const_iterator& _rPos);
101 } // namespace dbaui
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */