1*2e2212a7SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2e2212a7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2e2212a7SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2e2212a7SAndrew Rist * distributed with this work for additional information 6*2e2212a7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2e2212a7SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2e2212a7SAndrew Rist * "License"); you may not use this file except in compliance 9*2e2212a7SAndrew Rist * with the License. You may obtain a copy of the License at 10*2e2212a7SAndrew Rist * 11*2e2212a7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2e2212a7SAndrew Rist * 13*2e2212a7SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2e2212a7SAndrew Rist * software distributed under the License is distributed on an 15*2e2212a7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2e2212a7SAndrew Rist * KIND, either express or implied. See the License for the 17*2e2212a7SAndrew Rist * specific language governing permissions and limitations 18*2e2212a7SAndrew Rist * under the License. 19*2e2212a7SAndrew Rist * 20*2e2212a7SAndrew Rist *************************************************************/ 21*2e2212a7SAndrew Rist 22*2e2212a7SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _DBAUI_DBFINDEX_HXX_ 25cdf0e10cSrcweir #define _DBAUI_DBFINDEX_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifndef _DIALOG_HXX //autogen 28cdf0e10cSrcweir #include <vcl/dialog.hxx> 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir #ifndef _BUTTON_HXX //autogen 31cdf0e10cSrcweir #include <vcl/button.hxx> 32cdf0e10cSrcweir #endif 33cdf0e10cSrcweir #ifndef _COMBOBOX_HXX //autogen 34cdf0e10cSrcweir #include <vcl/combobox.hxx> 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir #ifndef _LSTBOX_HXX //autogen 37cdf0e10cSrcweir #include <vcl/lstbox.hxx> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #ifndef _SV_FIXED_HXX 40cdf0e10cSrcweir #include <vcl/fixed.hxx> 41cdf0e10cSrcweir #endif 42cdf0e10cSrcweir #ifndef __SGI_STL_LIST 43cdf0e10cSrcweir #include <list> 44cdf0e10cSrcweir #endif 45cdf0e10cSrcweir #ifndef _COMPHELPER_STLTYPES_HXX_ 46cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 47cdf0e10cSrcweir #endif 48cdf0e10cSrcweir 49cdf0e10cSrcweir //......................................................................... 50cdf0e10cSrcweir namespace dbaui 51cdf0e10cSrcweir { 52cdf0e10cSrcweir //......................................................................... 53cdf0e10cSrcweir 54cdf0e10cSrcweir //========================================================================= 55cdf0e10cSrcweir //= OTableIndex 56cdf0e10cSrcweir //========================================================================= 57cdf0e10cSrcweir /// represents a single dbf index 58cdf0e10cSrcweir class OTableIndex 59cdf0e10cSrcweir { 60cdf0e10cSrcweir private: 61cdf0e10cSrcweir String aIndexFileName; 62cdf0e10cSrcweir 63cdf0e10cSrcweir public: OTableIndex()64cdf0e10cSrcweir OTableIndex() { } OTableIndex(const OTableIndex & _rSource)65cdf0e10cSrcweir OTableIndex( const OTableIndex& _rSource) : aIndexFileName(_rSource.aIndexFileName) { } OTableIndex(const String & rFileName)66cdf0e10cSrcweir OTableIndex( const String& rFileName ) : aIndexFileName( rFileName ) { } 67cdf0e10cSrcweir SetIndexFileName(const String & rFileName)68cdf0e10cSrcweir void SetIndexFileName( const String& rFileName ) { aIndexFileName = rFileName; } GetIndexFileName() const69cdf0e10cSrcweir String GetIndexFileName() const { return aIndexFileName; } 70cdf0e10cSrcweir }; 71cdf0e10cSrcweir 72cdf0e10cSrcweir //------------------------------------------------------------------------- 73cdf0e10cSrcweir typedef ::std::list< OTableIndex > TableIndexList; 74cdf0e10cSrcweir DECLARE_STL_ITERATORS(TableIndexList); 75cdf0e10cSrcweir 76cdf0e10cSrcweir //========================================================================= 77cdf0e10cSrcweir //= OTableInfo 78cdf0e10cSrcweir //========================================================================= 79cdf0e10cSrcweir class ODbaseIndexDialog; 80cdf0e10cSrcweir /** holds the INF file of a table 81cdf0e10cSrcweir */ 82cdf0e10cSrcweir class OTableInfo 83cdf0e10cSrcweir { 84cdf0e10cSrcweir friend class ODbaseIndexDialog; 85cdf0e10cSrcweir private: 86cdf0e10cSrcweir String aTableName; 87cdf0e10cSrcweir TableIndexList aIndexList; 88cdf0e10cSrcweir 89cdf0e10cSrcweir public: OTableInfo()90cdf0e10cSrcweir OTableInfo() { } OTableInfo(const String & rName)91cdf0e10cSrcweir OTableInfo( const String& rName ) : aTableName(rName) { } 92cdf0e10cSrcweir 93cdf0e10cSrcweir void WriteInfFile( const String& rDSN ) const; 94cdf0e10cSrcweir }; 95cdf0e10cSrcweir 96cdf0e10cSrcweir //------------------------------------------------------------------------- 97cdf0e10cSrcweir typedef ::std::list< OTableInfo > TableInfoList; 98cdf0e10cSrcweir DECLARE_STL_ITERATORS(TableInfoList); 99cdf0e10cSrcweir 100cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////// 101cdf0e10cSrcweir // IndexDialog 102cdf0e10cSrcweir class ODbaseIndexDialog : public ModalDialog 103cdf0e10cSrcweir { 104cdf0e10cSrcweir protected: 105cdf0e10cSrcweir OKButton aPB_OK; 106cdf0e10cSrcweir CancelButton aPB_CANCEL; 107cdf0e10cSrcweir HelpButton aPB_HELP; 108cdf0e10cSrcweir 109cdf0e10cSrcweir FixedText m_FT_Tables; 110cdf0e10cSrcweir ComboBox aCB_Tables; 111cdf0e10cSrcweir 112cdf0e10cSrcweir FixedLine m_FL_Indexes; 113cdf0e10cSrcweir 114cdf0e10cSrcweir FixedText m_FT_TableIndexes; 115cdf0e10cSrcweir ListBox aLB_TableIndexes; 116cdf0e10cSrcweir 117cdf0e10cSrcweir FixedText m_FT_AllIndexes; 118cdf0e10cSrcweir ListBox aLB_FreeIndexes; 119cdf0e10cSrcweir 120cdf0e10cSrcweir ImageButton aIB_Add; 121cdf0e10cSrcweir ImageButton aIB_Remove; 122cdf0e10cSrcweir ImageButton aIB_AddAll; 123cdf0e10cSrcweir ImageButton aIB_RemoveAll; 124cdf0e10cSrcweir 125cdf0e10cSrcweir DECL_LINK( TableSelectHdl, ComboBox* ); 126cdf0e10cSrcweir DECL_LINK( AddClickHdl, PushButton* ); 127cdf0e10cSrcweir DECL_LINK( RemoveClickHdl, PushButton* ); 128cdf0e10cSrcweir DECL_LINK( AddAllClickHdl, PushButton* ); 129cdf0e10cSrcweir DECL_LINK( RemoveAllClickHdl, PushButton* ); 130cdf0e10cSrcweir DECL_LINK( OKClickHdl, PushButton* ); 131cdf0e10cSrcweir DECL_LINK( OnListEntrySelected, ListBox* ); 132cdf0e10cSrcweir 133cdf0e10cSrcweir String m_aDSN; 134cdf0e10cSrcweir TableInfoList m_aTableInfoList; 135cdf0e10cSrcweir TableIndexList m_aFreeIndexList; 136cdf0e10cSrcweir sal_Bool m_bCaseSensitiv; 137cdf0e10cSrcweir 138cdf0e10cSrcweir void Init(); 139cdf0e10cSrcweir void SetCtrls(); 140cdf0e10cSrcweir sal_Bool GetTable(const String& rName, TableInfoListIterator& _rPosition); 141cdf0e10cSrcweir 142cdf0e10cSrcweir OTableIndex implRemoveIndex(const String& _rName, TableIndexList& _rList, ListBox& _rDisplay, sal_Bool _bMustExist); 143cdf0e10cSrcweir void implInsertIndex(const OTableIndex& _rIndex, TableIndexList& _rList, ListBox& _rDisplay); 144cdf0e10cSrcweir RemoveFreeIndex(const String & _rName,sal_Bool _bMustExist)145cdf0e10cSrcweir OTableIndex RemoveFreeIndex( const String& _rName, sal_Bool _bMustExist ) { return implRemoveIndex(_rName, m_aFreeIndexList, aLB_FreeIndexes, _bMustExist); } InsertFreeIndex(const OTableIndex & _rIndex)146cdf0e10cSrcweir void InsertFreeIndex( const OTableIndex& _rIndex ) { implInsertIndex(_rIndex, m_aFreeIndexList, aLB_FreeIndexes); } 147cdf0e10cSrcweir OTableIndex RemoveTableIndex( const String& _rTableName, const String& _rIndexName, sal_Bool _bMustExist ); 148cdf0e10cSrcweir void InsertTableIndex( const String& _rTableName, const OTableIndex& _rIndex ); 149cdf0e10cSrcweir 150cdf0e10cSrcweir void checkButtons(); 151cdf0e10cSrcweir 152cdf0e10cSrcweir public: 153cdf0e10cSrcweir ODbaseIndexDialog( Window * pParent, String aDataSrcName ); 154cdf0e10cSrcweir virtual ~ODbaseIndexDialog(); 155cdf0e10cSrcweir }; 156cdf0e10cSrcweir 157cdf0e10cSrcweir //......................................................................... 158cdf0e10cSrcweir } // namespace dbaui 159cdf0e10cSrcweir //......................................................................... 160cdf0e10cSrcweir 161cdf0e10cSrcweir #endif // _DBAUI_DBFINDEX_HXX_ 162cdf0e10cSrcweir 163