Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / dlg / dbfindex.hxx
blob938339314ecca73a124de30a80f6588578992b9f
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 <utility>
23 #include <vcl/weld.hxx>
24 #include <deque>
26 namespace dbaui
29 // OTableIndex
30 /// represents a single dbf index
31 class OTableIndex
33 private:
34 OUString aIndexFileName;
36 public:
37 OTableIndex() { }
38 explicit OTableIndex( OUString aFileName ) : aIndexFileName(std::move( aFileName )) { }
40 const OUString& GetIndexFileName() const { return aIndexFileName; }
43 typedef std::deque< OTableIndex > TableIndexList;
45 // OTableInfo
46 class ODbaseIndexDialog;
47 /** holds the INF file of a table
49 class OTableInfo
51 friend class ODbaseIndexDialog;
52 private:
53 OUString aTableName;
54 TableIndexList aIndexList;
56 public:
57 explicit OTableInfo( OUString aName ) : aTableName(std::move(aName)) { }
59 void WriteInfFile( const OUString& rDSN ) const;
62 typedef std::deque< OTableInfo > TableInfoList;
64 // IndexDialog
65 class ODbaseIndexDialog : public weld::GenericDialogController
67 OUString m_aDSN;
68 TableInfoList m_aTableInfoList;
69 TableIndexList m_aFreeIndexList;
71 std::unique_ptr<weld::Button> m_xPB_OK;
72 std::unique_ptr<weld::ComboBox> m_xCB_Tables;
73 std::unique_ptr<weld::Widget> m_xIndexes;
74 std::unique_ptr<weld::TreeView> m_xLB_TableIndexes;
75 std::unique_ptr<weld::TreeView> m_xLB_FreeIndexes;
77 std::unique_ptr<weld::Button> m_xAdd;
78 std::unique_ptr<weld::Button> m_xRemove;
79 std::unique_ptr<weld::Button> m_xAddAll;
80 std::unique_ptr<weld::Button> m_xRemoveAll;
82 DECL_LINK( TableSelectHdl, weld::ComboBox&, void );
83 DECL_LINK( AddClickHdl, weld::Button&, void );
84 DECL_LINK( RemoveClickHdl, weld::Button&, void );
85 DECL_LINK( AddAllClickHdl, weld::Button&, void );
86 DECL_LINK( RemoveAllClickHdl, weld::Button&, void );
87 DECL_LINK( OKClickHdl, weld::Button&, void );
88 DECL_LINK( OnListEntrySelected, weld::TreeView&, void );
90 protected:
91 void Init();
92 void SetCtrls();
94 static OTableIndex implRemoveIndex(const OUString& _rName, TableIndexList& _rList, weld::TreeView& _rDisplay, bool _bMustExist);
95 static void implInsertIndex(const OTableIndex& _rIndex, TableIndexList& _rList, weld::TreeView& _rDisplay);
97 OTableIndex RemoveFreeIndex( const OUString& _rName, bool _bMustExist ) { return implRemoveIndex(_rName, m_aFreeIndexList, *m_xLB_FreeIndexes, _bMustExist); }
98 void InsertFreeIndex( const OTableIndex& _rIndex ) { implInsertIndex(_rIndex, m_aFreeIndexList, *m_xLB_FreeIndexes); }
99 OTableIndex RemoveTableIndex( std::u16string_view _rTableName, const OUString& _rIndexName );
100 void InsertTableIndex( std::u16string_view _rTableName, const OTableIndex& _rIndex );
102 void checkButtons();
104 public:
105 ODbaseIndexDialog(weld::Window * pParent, OUString aDataSrcName);
106 virtual ~ODbaseIndexDialog() override;
109 } // namespace dbaui
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */