Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / dbaccess / source / ui / dlg / dbfindex.hxx
blob2e4957003e25b332d335043ec7b05cdddba97d6b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _DBAUI_DBFINDEX_HXX_
30 #define _DBAUI_DBFINDEX_HXX_
32 #include <vcl/dialog.hxx>
33 #include <vcl/button.hxx>
34 #include <vcl/combobox.hxx>
35 #include <vcl/lstbox.hxx>
36 #include <vcl/fixed.hxx>
37 #include <list>
38 #include <comphelper/stl_types.hxx>
40 //.........................................................................
41 namespace dbaui
43 //.........................................................................
45 //=========================================================================
46 //= OTableIndex
47 //=========================================================================
48 /// represents a single dbf index
49 class OTableIndex
51 private:
52 String aIndexFileName;
54 public:
55 OTableIndex() { }
56 OTableIndex( const OTableIndex& _rSource) : aIndexFileName(_rSource.aIndexFileName) { }
57 OTableIndex( const String& rFileName ) : aIndexFileName( rFileName ) { }
59 void SetIndexFileName( const String& rFileName ) { aIndexFileName = rFileName; }
60 String GetIndexFileName() const { return aIndexFileName; }
63 //-------------------------------------------------------------------------
64 typedef ::std::list< OTableIndex > TableIndexList;
65 DECLARE_STL_ITERATORS(TableIndexList);
67 //=========================================================================
68 //= OTableInfo
69 //=========================================================================
70 class ODbaseIndexDialog;
71 /** holds the INF file of a table
73 class OTableInfo
75 friend class ODbaseIndexDialog;
76 private:
77 String aTableName;
78 TableIndexList aIndexList;
80 public:
81 OTableInfo() { }
82 OTableInfo( const String& rName ) : aTableName(rName) { }
84 void WriteInfFile( const String& rDSN ) const;
87 //-------------------------------------------------------------------------
88 typedef ::std::list< OTableInfo > TableInfoList;
89 DECLARE_STL_ITERATORS(TableInfoList);
91 //////////////////////////////////////////////////////////////////////////
92 // IndexDialog
93 class ODbaseIndexDialog : public ModalDialog
95 protected:
96 OKButton aPB_OK;
97 CancelButton aPB_CANCEL;
98 HelpButton aPB_HELP;
100 FixedText m_FT_Tables;
101 ComboBox aCB_Tables;
103 FixedLine m_FL_Indexes;
105 FixedText m_FT_TableIndexes;
106 ListBox aLB_TableIndexes;
108 FixedText m_FT_AllIndexes;
109 ListBox aLB_FreeIndexes;
111 ImageButton aIB_Add;
112 ImageButton aIB_Remove;
113 ImageButton aIB_AddAll;
114 ImageButton aIB_RemoveAll;
116 DECL_LINK( TableSelectHdl, ComboBox* );
117 DECL_LINK( AddClickHdl, PushButton* );
118 DECL_LINK( RemoveClickHdl, PushButton* );
119 DECL_LINK( AddAllClickHdl, PushButton* );
120 DECL_LINK( RemoveAllClickHdl, PushButton* );
121 DECL_LINK( OKClickHdl, PushButton* );
122 DECL_LINK( OnListEntrySelected, ListBox* );
124 String m_aDSN;
125 TableInfoList m_aTableInfoList;
126 TableIndexList m_aFreeIndexList;
127 sal_Bool m_bCaseSensitiv;
129 void Init();
130 void SetCtrls();
131 sal_Bool GetTable(const String& rName, TableInfoListIterator& _rPosition);
133 OTableIndex implRemoveIndex(const String& _rName, TableIndexList& _rList, ListBox& _rDisplay, sal_Bool _bMustExist);
134 void implInsertIndex(const OTableIndex& _rIndex, TableIndexList& _rList, ListBox& _rDisplay);
136 OTableIndex RemoveFreeIndex( const String& _rName, sal_Bool _bMustExist ) { return implRemoveIndex(_rName, m_aFreeIndexList, aLB_FreeIndexes, _bMustExist); }
137 void InsertFreeIndex( const OTableIndex& _rIndex ) { implInsertIndex(_rIndex, m_aFreeIndexList, aLB_FreeIndexes); }
138 OTableIndex RemoveTableIndex( const String& _rTableName, const String& _rIndexName, sal_Bool _bMustExist );
139 void InsertTableIndex( const String& _rTableName, const OTableIndex& _rIndex );
141 void checkButtons();
143 public:
144 ODbaseIndexDialog( Window * pParent, String aDataSrcName );
145 virtual ~ODbaseIndexDialog();
148 //.........................................................................
149 } // namespace dbaui
150 //.........................................................................
152 #endif // _DBAUI_DBFINDEX_HXX_
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */