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