merge the formfield patch from ooo-build
[ooovba.git] / dbaccess / source / ui / dlg / dbfindex.hxx
blobc3eb7559cba531e130a6e334960e6f855a292862
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dbfindex.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBAUI_DBFINDEX_HXX_
32 #define _DBAUI_DBFINDEX_HXX_
34 #ifndef _DIALOG_HXX //autogen
35 #include <vcl/dialog.hxx>
36 #endif
37 #ifndef _BUTTON_HXX //autogen
38 #include <vcl/button.hxx>
39 #endif
40 #ifndef _COMBOBOX_HXX //autogen
41 #include <vcl/combobox.hxx>
42 #endif
43 #ifndef _LSTBOX_HXX //autogen
44 #include <vcl/lstbox.hxx>
45 #endif
46 #ifndef _SV_FIXED_HXX
47 #include <vcl/fixed.hxx>
48 #endif
49 #ifndef __SGI_STL_LIST
50 #include <list>
51 #endif
52 #ifndef _COMPHELPER_STLTYPES_HXX_
53 #include <comphelper/stl_types.hxx>
54 #endif
56 //.........................................................................
57 namespace dbaui
59 //.........................................................................
61 //=========================================================================
62 //= OTableIndex
63 //=========================================================================
64 /// represents a single dbf index
65 class OTableIndex
67 private:
68 String aIndexFileName;
70 public:
71 OTableIndex() { }
72 OTableIndex( const OTableIndex& _rSource) : aIndexFileName(_rSource.aIndexFileName) { }
73 OTableIndex( const String& rFileName ) : aIndexFileName( rFileName ) { }
75 void SetIndexFileName( const String& rFileName ) { aIndexFileName = rFileName; }
76 String GetIndexFileName() const { return aIndexFileName; }
79 //-------------------------------------------------------------------------
80 typedef ::std::list< OTableIndex > TableIndexList;
81 DECLARE_STL_ITERATORS(TableIndexList);
83 //=========================================================================
84 //= OTableInfo
85 //=========================================================================
86 class ODbaseIndexDialog;
87 /** holds the INF file of a table
89 class OTableInfo
91 friend class ODbaseIndexDialog;
92 private:
93 String aTableName;
94 TableIndexList aIndexList;
96 public:
97 OTableInfo() { }
98 OTableInfo( const String& rName ) : aTableName(rName) { }
100 void WriteInfFile( const String& rDSN ) const;
103 //-------------------------------------------------------------------------
104 typedef ::std::list< OTableInfo > TableInfoList;
105 DECLARE_STL_ITERATORS(TableInfoList);
107 //////////////////////////////////////////////////////////////////////////
108 // IndexDialog
109 class ODbaseIndexDialog : public ModalDialog
111 protected:
112 OKButton aPB_OK;
113 CancelButton aPB_CANCEL;
114 HelpButton aPB_HELP;
116 FixedText m_FT_Tables;
117 ComboBox aCB_Tables;
119 FixedLine m_FL_Indexes;
121 FixedText m_FT_TableIndexes;
122 ListBox aLB_TableIndexes;
124 FixedText m_FT_AllIndexes;
125 ListBox aLB_FreeIndexes;
127 ImageButton aIB_Add;
128 ImageButton aIB_Remove;
129 ImageButton aIB_AddAll;
130 ImageButton aIB_RemoveAll;
132 DECL_LINK( TableSelectHdl, ComboBox* );
133 DECL_LINK( AddClickHdl, PushButton* );
134 DECL_LINK( RemoveClickHdl, PushButton* );
135 DECL_LINK( AddAllClickHdl, PushButton* );
136 DECL_LINK( RemoveAllClickHdl, PushButton* );
137 DECL_LINK( OKClickHdl, PushButton* );
138 DECL_LINK( OnListEntrySelected, ListBox* );
140 String m_aDSN;
141 TableInfoList m_aTableInfoList;
142 TableIndexList m_aFreeIndexList;
143 BOOL m_bCaseSensitiv;
145 void Init();
146 void SetCtrls();
147 sal_Bool GetTable(const String& rName, TableInfoListIterator& _rPosition);
149 OTableIndex implRemoveIndex(const String& _rName, TableIndexList& _rList, ListBox& _rDisplay, sal_Bool _bMustExist);
150 void implInsertIndex(const OTableIndex& _rIndex, TableIndexList& _rList, ListBox& _rDisplay);
152 OTableIndex RemoveFreeIndex( const String& _rName, sal_Bool _bMustExist ) { return implRemoveIndex(_rName, m_aFreeIndexList, aLB_FreeIndexes, _bMustExist); }
153 void InsertFreeIndex( const OTableIndex& _rIndex ) { implInsertIndex(_rIndex, m_aFreeIndexList, aLB_FreeIndexes); }
154 OTableIndex RemoveTableIndex( const String& _rTableName, const String& _rIndexName, sal_Bool _bMustExist );
155 void InsertTableIndex( const String& _rTableName, const OTableIndex& _rIndex );
157 void checkButtons();
159 public:
160 ODbaseIndexDialog( Window * pParent, String aDataSrcName );
161 virtual ~ODbaseIndexDialog();
164 //.........................................................................
165 } // namespace dbaui
166 //.........................................................................
168 #endif // _DBAUI_DBFINDEX_HXX_