Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef _DBAUI_DBFINDEX_HXX_
21 : : #define _DBAUI_DBFINDEX_HXX_
22 : :
23 : : #include <vcl/dialog.hxx>
24 : : #include <vcl/button.hxx>
25 : : #include <vcl/combobox.hxx>
26 : : #include <vcl/lstbox.hxx>
27 : : #include <vcl/fixed.hxx>
28 : : #include <list>
29 : : #include <comphelper/stl_types.hxx>
30 : :
31 : : //.........................................................................
32 : : namespace dbaui
33 : : {
34 : : //.........................................................................
35 : :
36 : : //=========================================================================
37 : : //= OTableIndex
38 : : //=========================================================================
39 : : /// represents a single dbf index
40 : 0 : class OTableIndex
41 : : {
42 : : private:
43 : : String aIndexFileName;
44 : :
45 : : public:
46 : 0 : OTableIndex() { }
47 : 0 : OTableIndex( const OTableIndex& _rSource) : aIndexFileName(_rSource.aIndexFileName) { }
48 : 0 : OTableIndex( const String& rFileName ) : aIndexFileName( rFileName ) { }
49 : :
50 : : void SetIndexFileName( const String& rFileName ) { aIndexFileName = rFileName; }
51 : 0 : String GetIndexFileName() const { return aIndexFileName; }
52 : : };
53 : :
54 : : //-------------------------------------------------------------------------
55 : : typedef ::std::list< OTableIndex > TableIndexList;
56 : : DECLARE_STL_ITERATORS(TableIndexList);
57 : :
58 : : //=========================================================================
59 : : //= OTableInfo
60 : : //=========================================================================
61 : : class ODbaseIndexDialog;
62 : : /** holds the INF file of a table
63 : : */
64 [ # # ]: 0 : class OTableInfo
65 : : {
66 : : friend class ODbaseIndexDialog;
67 : : private:
68 : : String aTableName;
69 : : TableIndexList aIndexList;
70 : :
71 : : public:
72 : : OTableInfo() { }
73 [ # # ]: 0 : OTableInfo( const String& rName ) : aTableName(rName) { }
74 : :
75 : : void WriteInfFile( const String& rDSN ) const;
76 : : };
77 : :
78 : : //-------------------------------------------------------------------------
79 : : typedef ::std::list< OTableInfo > TableInfoList;
80 : : DECLARE_STL_ITERATORS(TableInfoList);
81 : :
82 : : //////////////////////////////////////////////////////////////////////////
83 : : // IndexDialog
84 : : class ODbaseIndexDialog : public ModalDialog
85 : : {
86 : : protected:
87 : : OKButton aPB_OK;
88 : : CancelButton aPB_CANCEL;
89 : : HelpButton aPB_HELP;
90 : :
91 : : FixedText m_FT_Tables;
92 : : ComboBox aCB_Tables;
93 : :
94 : : FixedLine m_FL_Indexes;
95 : :
96 : : FixedText m_FT_TableIndexes;
97 : : ListBox aLB_TableIndexes;
98 : :
99 : : FixedText m_FT_AllIndexes;
100 : : ListBox aLB_FreeIndexes;
101 : :
102 : : ImageButton aIB_Add;
103 : : ImageButton aIB_Remove;
104 : : ImageButton aIB_AddAll;
105 : : ImageButton aIB_RemoveAll;
106 : :
107 : : DECL_LINK( TableSelectHdl, ComboBox* );
108 : : DECL_LINK( AddClickHdl, PushButton* );
109 : : DECL_LINK( RemoveClickHdl, PushButton* );
110 : : DECL_LINK( AddAllClickHdl, PushButton* );
111 : : DECL_LINK( RemoveAllClickHdl, PushButton* );
112 : : DECL_LINK( OKClickHdl, PushButton* );
113 : : DECL_LINK( OnListEntrySelected, ListBox* );
114 : :
115 : : String m_aDSN;
116 : : TableInfoList m_aTableInfoList;
117 : : TableIndexList m_aFreeIndexList;
118 : : sal_Bool m_bCaseSensitiv;
119 : :
120 : : void Init();
121 : : void SetCtrls();
122 : : sal_Bool GetTable(const String& rName, TableInfoListIterator& _rPosition);
123 : :
124 : : OTableIndex implRemoveIndex(const String& _rName, TableIndexList& _rList, ListBox& _rDisplay, sal_Bool _bMustExist);
125 : : void implInsertIndex(const OTableIndex& _rIndex, TableIndexList& _rList, ListBox& _rDisplay);
126 : :
127 : 0 : OTableIndex RemoveFreeIndex( const String& _rName, sal_Bool _bMustExist ) { return implRemoveIndex(_rName, m_aFreeIndexList, aLB_FreeIndexes, _bMustExist); }
128 : 0 : void InsertFreeIndex( const OTableIndex& _rIndex ) { implInsertIndex(_rIndex, m_aFreeIndexList, aLB_FreeIndexes); }
129 : : OTableIndex RemoveTableIndex( const String& _rTableName, const String& _rIndexName, sal_Bool _bMustExist );
130 : : void InsertTableIndex( const String& _rTableName, const OTableIndex& _rIndex );
131 : :
132 : : void checkButtons();
133 : :
134 : : public:
135 : : ODbaseIndexDialog( Window * pParent, String aDataSrcName );
136 : : virtual ~ODbaseIndexDialog();
137 : : };
138 : :
139 : : //.........................................................................
140 : : } // namespace dbaui
141 : : //.........................................................................
142 : :
143 : : #endif // _DBAUI_DBFINDEX_HXX_
144 : :
145 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|