1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dbfindex.hxx,v $
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>
37 #ifndef _BUTTON_HXX //autogen
38 #include <vcl/button.hxx>
40 #ifndef _COMBOBOX_HXX //autogen
41 #include <vcl/combobox.hxx>
43 #ifndef _LSTBOX_HXX //autogen
44 #include <vcl/lstbox.hxx>
47 #include <vcl/fixed.hxx>
49 #ifndef __SGI_STL_LIST
52 #ifndef _COMPHELPER_STLTYPES_HXX_
53 #include <comphelper/stl_types.hxx>
56 //.........................................................................
59 //.........................................................................
61 //=========================================================================
63 //=========================================================================
64 /// represents a single dbf index
68 String aIndexFileName
;
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 //=========================================================================
85 //=========================================================================
86 class ODbaseIndexDialog
;
87 /** holds the INF file of a table
91 friend class ODbaseIndexDialog
;
94 TableIndexList aIndexList
;
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 //////////////////////////////////////////////////////////////////////////
109 class ODbaseIndexDialog
: public ModalDialog
113 CancelButton aPB_CANCEL
;
116 FixedText m_FT_Tables
;
119 FixedLine m_FL_Indexes
;
121 FixedText m_FT_TableIndexes
;
122 ListBox aLB_TableIndexes
;
124 FixedText m_FT_AllIndexes
;
125 ListBox aLB_FreeIndexes
;
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
* );
141 TableInfoList m_aTableInfoList
;
142 TableIndexList m_aFreeIndexList
;
143 BOOL m_bCaseSensitiv
;
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
);
160 ODbaseIndexDialog( Window
* pParent
, String aDataSrcName
);
161 virtual ~ODbaseIndexDialog();
164 //.........................................................................
166 //.........................................................................
168 #endif // _DBAUI_DBFINDEX_HXX_