Tag: cws_src680_iconswitching1 User: kendy Date: 05/11/01 07:33:18 Modified: /dba/dbaccess/source/ui/dlg/ indexdialog.cxx
Log: RESYNC: (1.19-1.23); FILE MERGED File Changes: Directory: /dba/dbaccess/source/ui/dlg/ ======================================= File [changed]: indexdialog.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/dlg/indexdialog.cxx?r1=1.19.76.1&r2=1.19.76.2 Delta lines: +50 -69 --------------------- --- indexdialog.cxx 20 Jul 2005 13:48:33 -0000 1.19.76.1 +++ indexdialog.cxx 1 Nov 2005 15:33:12 -0000 1.19.76.2 @@ -1,22 +1,20 @@ /************************************************************************* * + * OpenOffice.org - a multi-platform office productivity suite + * * $RCSfile$ * * $Revision$ * * last change: $Author$ $Date$ * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. * - * Sun Microsystems Inc., October, 2000 * * GNU Lesser General Public License Version 2.1 * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. + * Copyright 2005 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or @@ -33,30 +31,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * - * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (the "License"); You may not use this file - * except in compliance with the License. You may obtain a copy of the - * License at http://www.openoffice.org/license.html. - * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. - * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc.. - * - * Copyright: 2000 by Sun Microsystems, Inc. - * - * All Rights Reserved. - * - * Contributor(s): _______________________________________ - * - * ************************************************************************/ #ifndef _DBAUI_INDEXDIALOG_HXX_ @@ -234,7 +208,8 @@ //================================================================== //= DbaIndexDialog //================================================================== - //------------------------------------------------------------------ +DBG_NAME(DbaIndexDialog) +//------------------------------------------------------------------ DbaIndexDialog::DbaIndexDialog( Window* _pParent, const Sequence< ::rtl::OUString >& _rFieldNames, const Reference< XNameAccess >& _rxIndexes, const Reference< XConnection >& _rxConnection, @@ -257,6 +232,8 @@ ,m_bEditAgain(sal_False) ,m_xORB(_rxORB) { + DBG_CTOR(DbaIndexDialog,NULL); + FreeResource(); m_aActions.SetSelectHdl(LINK(this, DbaIndexDialog, OnIndexAction)); @@ -301,7 +278,7 @@ // } // if all of the indexes have an empty description, we're not interested in displaying it - OIndexCollection::const_iterator aCheck; + Indexes::const_iterator aCheck; for ( aCheck = m_pIndexes->begin(); aCheck != m_pIndexes->end(); @@ -352,7 +329,7 @@ if (pSelected) { // is the current entry modified? - OIndexCollection::const_iterator aSelectedPos = reinterpret_cast<OIndexCollection::const_iterator>(pSelected->GetUserData()); + Indexes::const_iterator aSelectedPos = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(pSelected->GetUserData()); m_aActions.EnableItem(ID_INDEX_SAVE, aSelectedPos->isModified() || aSelectedPos->isNew()); m_aActions.EnableItem(ID_INDEX_RESET, aSelectedPos->isModified() || aSelectedPos->isNew()); bSelectedAnything = bSelectedAnything && !aSelectedPos->bPrimaryKey; @@ -373,8 +350,8 @@ Image aPKeyIcon(ModuleRes( bHiContrast ? IMG_PKEYICON_SCH : IMG_PKEYICON)); // fill the list with the index names m_aIndexes.Clear(); - OIndexCollection::iterator aIndexLoop = m_pIndexes->begin(); - OIndexCollection::iterator aEnd = m_pIndexes->end(); + Indexes::iterator aIndexLoop = m_pIndexes->begin(); + Indexes::iterator aEnd = m_pIndexes->end(); for (; aIndexLoop != aEnd; ++aIndexLoop) { SvLBoxEntry* pNewEntry = NULL; @@ -383,7 +360,7 @@ else pNewEntry = m_aIndexes.InsertEntry(aIndexLoop->sName); - pNewEntry->SetUserData(aIndexLoop); + pNewEntry->SetUserData(reinterpret_cast< void* >(sal_Int32(aIndexLoop - m_pIndexes->begin()))); } OnIndexSelected(&m_aIndexes); @@ -399,6 +376,8 @@ // save our geometry settings // Point aPos = GetPosPixel(); // m_aGeometrySettings.SetPosition(aPos.X(), aPos.Y()); + + DBG_DTOR(DbaIndexDialog,NULL); } //------------------------------------------------------------------ @@ -406,7 +385,7 @@ { DBG_ASSERT(_pEntry, "DbaIndexDialog::implCommit: invalid entry!"); - OIndexCollection::iterator aCommitPos = static_cast< OIndexCollection::iterator >(_pEntry->GetUserData()); + Indexes::iterator aCommitPos = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(_pEntry->GetUserData()); // if it's not a new index, remove it // (we can't modify indexes, only drop'n'insert) @@ -465,16 +444,16 @@ } SvLBoxEntry* pNewEntry = m_aIndexes.InsertEntry(sNewIndexName); - OIndexCollection::iterator aIndexDescriptor = m_pIndexes->insert(sNewIndexName); + Indexes::iterator aIndexDescriptor = m_pIndexes->insert(sNewIndexName); // pNewEntry->SetUserData(aIndexDescriptor); // update the user data on the entries in the list box: // they're iterators of the index collection, and thus they have changed when removing the index for (SvLBoxEntry* pAdjust = m_aIndexes.First(); pAdjust; pAdjust = m_aIndexes.Next(pAdjust)) { - OIndexCollection::iterator aAfterInsertPos = m_pIndexes->find(m_aIndexes.GetEntryText(pAdjust)); + Indexes::iterator aAfterInsertPos = m_pIndexes->find(m_aIndexes.GetEntryText(pAdjust)); DBG_ASSERT(aAfterInsertPos != m_pIndexes->end(), "DbaIndexDialog::OnNewIndex: problems with on of the entries!"); - pAdjust->SetUserData(aAfterInsertPos); + pAdjust->SetUserData(reinterpret_cast< void* >(sal_Int32(aAfterInsertPos - m_pIndexes->begin()))); } // select the entry and start in-place editing @@ -514,7 +493,7 @@ sal_Bool DbaIndexDialog::implDropIndex(SvLBoxEntry* _pEntry, sal_Bool _bRemoveFromCollection) { // do the drop - OIndexCollection::iterator aDropPos = static_cast< OIndexCollection::iterator >(_pEntry->GetUserData()); + Indexes::iterator aDropPos = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(_pEntry->GetUserData()); DBG_ASSERT(aDropPos != m_pIndexes->end(), "DbaIndexDialog::OnDropIndex: did not find the index in my collection!"); SQLExceptionInfo aExceptionInfo; @@ -545,9 +524,9 @@ // they're iterators of the index collection, and thus they have changed when removing the index for (SvLBoxEntry* pAdjust = m_aIndexes.First(); pAdjust; pAdjust = m_aIndexes.Next(pAdjust)) { - OIndexCollection::iterator aAfterDropPos = m_pIndexes->find(m_aIndexes.GetEntryText(pAdjust)); + Indexes::iterator aAfterDropPos = m_pIndexes->find(m_aIndexes.GetEntryText(pAdjust)); DBG_ASSERT(aAfterDropPos != m_pIndexes->end(), "DbaIndexDialog::OnDropIndex: problems with on of the remaining entries!"); - pAdjust->SetUserData(aAfterDropPos); + pAdjust->SetUserData(reinterpret_cast< void* >(sal_Int32(aAfterDropPos - m_pIndexes->begin()))); } // if the remvoved entry was the selected on ... @@ -596,7 +575,7 @@ SvLBoxEntry* pSelected = m_aIndexes.FirstSelected(); DBG_ASSERT(pSelected, "DbaIndexDialog::OnResetIndex: invalid call!"); - OIndexCollection::iterator aResetPos = static_cast< OIndexCollection::iterator >(pSelected->GetUserData()); + Indexes::iterator aResetPos = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(pSelected->GetUserData()); if (aResetPos->isNew()) { @@ -669,7 +648,8 @@ if (pSelected) { // the descriptor - OIndexCollection::const_iterator aSelected = static_cast<OIndexCollection::iterator>(pSelected->GetUserData()); + Indexes::const_iterator aSelected = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(pSelected->GetUserData()); + if (aSelected->isModified() || aSelected->isNew()) { QueryBox aQuestion(this, ModuleRes(QUERY_SAVE_CURRENT_INDEX)); @@ -705,13 +685,14 @@ //------------------------------------------------------------------ IMPL_LINK( DbaIndexDialog, OnEntryEdited, SvLBoxEntry*, _pEntry ) { - OIndexCollection::iterator aPosition = static_cast< OIndexCollection::iterator >(_pEntry->GetUserData()); + Indexes::iterator aPosition = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(_pEntry->GetUserData()); + DBG_ASSERT(aPosition >= m_pIndexes->begin() && aPosition < m_pIndexes->end(), "DbaIndexDialog::OnEntryEdited: invalid entry!"); String sNewName = m_aIndexes.GetEntryText(_pEntry); - OIndexCollection::const_iterator aSameName = m_pIndexes->find(sNewName); + Indexes::const_iterator aSameName = m_pIndexes->find(sNewName); if ((aSameName != aPosition) && (m_pIndexes->end() != aSameName)) { String sError(ModuleRes(STR_INDEX_NAME_ALREADY_USED)); @@ -753,7 +734,7 @@ if (m_pFields->IsModified() && !m_pFields->SaveModified()) return sal_False; - OIndexCollection::iterator aPreviouslySelected = static_cast<OIndexCollection::iterator>(m_pPreviousSelection->GetUserData()); + Indexes::iterator aPreviouslySelected = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(m_pPreviousSelection->GetUserData()); // the unique flag aPreviouslySelected->bUnique = m_aUnique.IsChecked(); @@ -814,7 +795,7 @@ { if (m_pPreviousSelection) { - OIndexCollection::iterator aPreviouslySelected = static_cast<OIndexCollection::iterator>(m_pPreviousSelection->GetUserData()); + Indexes::iterator aPreviouslySelected = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(m_pPreviousSelection->GetUserData()); if (!implSaveModified()) return sal_False; @@ -831,7 +812,7 @@ IMPL_LINK( DbaIndexDialog, OnModified, void*, NOTINTERESTEDIN ) { DBG_ASSERT(m_pPreviousSelection, "DbaIndexDialog, OnModified: invalid call!"); - OIndexCollection::iterator aPosition = static_cast< OIndexCollection::iterator >(m_pPreviousSelection->GetUserData()); + Indexes::iterator aPosition = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(m_pPreviousSelection->GetUserData()); aPosition->setModified(sal_True); updateToolbox(); @@ -845,7 +826,7 @@ if (_pEntry) { // the descriptor of the selected index - OIndexCollection::const_iterator aSelectedIndex = static_cast<OIndexCollection::iterator>(_pEntry->GetUserData()); + Indexes::const_iterator aSelectedIndex = m_pIndexes->begin() + reinterpret_cast<sal_IntPtr>(_pEntry->GetUserData()); // fill the controls m_aUnique.Check(aSelectedIndex->bUnique); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
