1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include <vcl/weld.hxx>
30 /// represents a single dbf index
34 OUString aIndexFileName
;
38 explicit OTableIndex( OUString aFileName
) : aIndexFileName(std::move( aFileName
)) { }
40 const OUString
& GetIndexFileName() const { return aIndexFileName
; }
43 typedef std::deque
< OTableIndex
> TableIndexList
;
46 class ODbaseIndexDialog
;
47 /** holds the INF file of a table
51 friend class ODbaseIndexDialog
;
54 TableIndexList aIndexList
;
57 explicit OTableInfo( OUString aName
) : aTableName(std::move(aName
)) { }
59 void WriteInfFile( const OUString
& rDSN
) const;
62 typedef std::deque
< OTableInfo
> TableInfoList
;
65 class ODbaseIndexDialog
: public weld::GenericDialogController
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 );
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
);
105 ODbaseIndexDialog(weld::Window
* pParent
, OUString aDataSrcName
);
106 virtual ~ODbaseIndexDialog() override
;
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */