diff options
author | Joseph Powers <jpowers27@cox.net> | 2011-01-03 21:47:20 -0800 |
---|---|---|
committer | Joseph Powers <jpowers27@cox.net> | 2011-01-03 21:47:20 -0800 |
commit | 5f7b8cf83751babb0cef560fe6442f0ace984317 (patch) | |
tree | 93400ba86ab2d0722e4beb40930b3556b3987787 /svx/source | |
parent | cd1238fec3ff862b7fe099418defb2def40255c1 (diff) |
Remove DECLARE_LIST(DbGridColumns, DbGridColumn*)
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/fmcomp/fmgridcl.cxx | 18 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridif.cxx | 21 | ||||
-rw-r--r-- | svx/source/fmcomp/gridctrl.cxx | 122 |
3 files changed, 90 insertions, 71 deletions
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 94921093fd87..1782b2e38ccc 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -1551,7 +1551,7 @@ void FmGridControl::ColumnResized(sal_uInt16 nId) DbGridControl::ColumnResized(nId); // Wert ans model uebergeben - DbGridColumn* pCol = DbGridControl::GetColumns().GetObject(GetModelColumnPos(nId)); + DbGridColumn* pCol = DbGridControl::GetColumns().at( GetModelColumnPos(nId) ); Reference< ::com::sun::star::beans::XPropertySet > xColModel(pCol->getModel()); if (xColModel.is()) { @@ -1597,7 +1597,7 @@ void FmGridControl::ColumnMoved(sal_uInt16 nId) { // suchen der Spalte und verschieben im Model // ColumnPos holen - DbGridColumn* pCol = DbGridControl::GetColumns().GetObject(GetModelColumnPos(nId)); + DbGridColumn* pCol = DbGridControl::GetColumns().at( GetModelColumnPos(nId) ); Reference< ::com::sun::star::beans::XPropertySet > xCol; // Einfuegen muß sich an den Column Positionen orientieren @@ -1660,7 +1660,7 @@ void FmGridControl::InitColumnsByModels(const Reference< ::com::sun::star::conta nWidth = LogicToPixel(Point(nWidth,0),MAP_10TH_MM).X(); AppendColumn(aName, (sal_uInt16)nWidth); - DbGridColumn* pCol = DbGridControl::GetColumns().GetObject(i); + DbGridColumn* pCol = DbGridControl::GetColumns().at( i ); pCol->setModel(xCol); } @@ -1738,12 +1738,6 @@ void FmGridControl::InitColumnByField( _pColumn->SetObject( (sal_Int16)nFieldPos ); return; } -/* - // handle readonly columns - sal_Bool bReadOnly = sal_True; - xField->getPropertyValue( FM_PROP_ISREADONLY ) >>= bReadOnly; - _pColumn->SetReadOnly( bReadOnly ); -*/ } // the control type is determined by the ColumnServiceName @@ -1773,7 +1767,7 @@ void FmGridControl::InitColumnsByFields(const Reference< ::com::sun::star::conta // Einfuegen muss sich an den Column Positionen orientieren for (sal_Int32 i = 0; i < xColumns->getCount(); i++) { - DbGridColumn* pCol = GetColumns().GetObject(i); + DbGridColumn* pCol = GetColumns().at( i ); OSL_ENSURE(pCol,"No grid column!"); if ( pCol ) { @@ -1794,7 +1788,7 @@ void FmGridControl::HideColumn(sal_uInt16 nId) if (nPos == (sal_uInt16)-1) return; - DbGridColumn* pColumn = GetColumns().GetObject(nPos); + DbGridColumn* pColumn = GetColumns().at( nPos ); if (pColumn->IsHidden()) GetPeer()->columnHidden(pColumn); @@ -1826,7 +1820,7 @@ void FmGridControl::ShowColumn(sal_uInt16 nId) if (nPos == (sal_uInt16)-1) return; - DbGridColumn* pColumn = GetColumns().GetObject(nPos); + DbGridColumn* pColumn = GetColumns().at( nPos ); if (!pColumn->IsHidden()) GetPeer()->columnVisible(pColumn); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 88f325e6d033..77ba9da2d8ff 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1352,7 +1352,7 @@ Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos((sal_uInt16)i)); DBG_ASSERT(nModelPos != (sal_uInt16)-1, "FmXGridPeer::queryFieldDataType : no model pos !"); - pCol = aColumns.GetObject(nModelPos); + pCol = aColumns[ nModelPos ]; const DbGridRowRef xRow = pGrid->GetSeekRow(); xFieldContent = (xRow.Is() && xRow->HasField(pCol->GetFieldPos())) ? xRow->GetField(pCol->GetFieldPos()).getColumn() : Reference< ::com::sun::star::sdb::XColumn > (); if (!xFieldContent.is()) @@ -1415,7 +1415,7 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type // don't use GetCurrentFieldValue to determine the field content as this isn't affected by the above SeekRow // FS - 30.09.99 - 68644 - pCol = aColumns.GetObject(nModelPos); + pCol = aColumns[ nModelPos ]; xFieldContent = xPaintRow->HasField( pCol->GetFieldPos() ) ? xPaintRow->GetField( pCol->GetFieldPos() ).getColumn() : Reference< XColumn > (); @@ -1435,7 +1435,7 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type // Strings werden direkt ueber das GetFieldText abgehandelt case TypeClass_STRING : { - String sText = aColumns.GetObject(nModelPos)->GetCellText( xPaintRow, pGrid->getNumberFormatter() ); + String sText = aColumns[ nModelPos ]->GetCellText( xPaintRow, pGrid->getNumberFormatter() ); pReturnArray[i] <<= ::rtl::OUString(sText); } break; @@ -1548,7 +1548,7 @@ void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt) throw( RuntimeE // it design mode it doesn't matter if (!isDesignMode()) { - DbGridColumn* pCol = pGrid->GetColumns().GetObject(i); + DbGridColumn* pCol = pGrid->GetColumns().at( i ); pCol->SetAlignmentFromModel(-1); bInvalidateColumn = sal_True; @@ -1832,7 +1832,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) throw( RuntimeExcep pGrid->AppendColumn(aName, (sal_uInt16)nWidth, (sal_Int16)::comphelper::getINT32(evt.Accessor)); // jetzt die Spalte setzen - DbGridColumn* pCol = pGrid->GetColumns().GetObject(::comphelper::getINT32(evt.Accessor)); + DbGridColumn* pCol = pGrid->GetColumns().at( ::comphelper::getINT32(evt.Accessor) ); pCol->setModel(xNewColumn); Any aHidden = xNewColumn->getPropertyValue(FM_PROP_HIDDEN); @@ -1876,7 +1876,7 @@ void FmXGridPeer::elementReplaced(const ContainerEvent& evt) throw( RuntimeExcep sal_uInt16 nNewPos = pGrid->GetModelColumnPos(nNewId); // set the model of the new column - DbGridColumn* pCol = pGrid->GetColumns().GetObject(nNewPos); + DbGridColumn* pCol = pGrid->GetColumns().at( nNewPos ); // for initializong this grid column, we need the fields of the grid's data source Reference< XColumnsSupplier > xSuppColumns; @@ -1941,9 +1941,9 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V // need to forward this to the columns DbGridColumns& rColumns = const_cast<DbGridColumns&>(pGrid->GetColumns()); - DbGridColumn* pLoop = rColumns.First(); - while (pLoop) + for ( size_t i = 0, n = rColumns.size(); i < n; ++i ) { + DbGridColumn* pLoop = rColumns[ i ]; FmXGridCell* pXCell = pLoop->GetCell(); if (pXCell) { @@ -1952,8 +1952,6 @@ void FmXGridPeer::setProperty( const ::rtl::OUString& PropertyName, const Any& V else pXCell->SetTextLineColor(aTextLineColor); } - - pLoop = rColumns.Next(); } if (isDesignMode()) @@ -2442,8 +2440,7 @@ Any FmXGridPeer::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException, // get the list position sal_uInt16 nPos = pGrid->GetModelColumnPos(nId); - DbGridColumn* pCol = pGrid->GetColumns().GetObject(nPos); -// DBG_ASSERT(pCol && pCol->GetCell(), "FmXGridPeer::getByIndex(): Invalid cell"); + DbGridColumn* pCol = pGrid->GetColumns().at( nPos ); Reference< ::com::sun::star::awt::XControl > xControl(pCol->GetCell()); aElement <<= xControl; diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 06beab935de9..c09cb47e71ff 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -1088,9 +1088,9 @@ void DbGridControl::Select() //------------------------------------------------------------------------------ void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat ) { - for ( sal_uInt32 i = 0; i < m_aColumns.Count(); ++i ) + for ( size_t i = 0; i < m_aColumns.size(); ++i ) { - DbGridColumn* pCol = m_aColumns.GetObject(i); + DbGridColumn* pCol = m_aColumns[ i ]; if (pCol) pCol->ImplInitWindow( GetDataWindow(), _eInitWhat ); } @@ -1162,8 +1162,8 @@ void DbGridControl::RemoveRows() // alle Columns deinitialisieren // existieren Spalten, dann alle Controller freigeben - for (sal_uInt32 i = 0; i < m_aColumns.Count(); i++) - m_aColumns.GetObject(i)->Clear(); + for (size_t i = 0; i < m_aColumns.size(); i++) + m_aColumns[ i ]->Clear(); DELETEZ(m_pSeekCursor); DELETEZ(m_pDataCursor); @@ -1666,9 +1666,9 @@ void DbGridControl::RemoveColumns() if ( IsEditing() ) DeactivateCell(); - for (sal_uInt32 i = 0; i < m_aColumns.Count(); i++) - delete m_aColumns.GetObject(i); - m_aColumns.Clear(); + for (size_t i = 0, n = m_aColumns.size(); i < n; i++) + delete m_aColumns[ i ]; + m_aColumns.clear(); DbGridControl_Base::RemoveColumns(); } @@ -1691,7 +1691,7 @@ sal_uInt16 DbGridControl::AppendColumn(const XubString& rName, sal_uInt16 nWidth sal_Int16 nViewPos = nModelPos; while (nModelPos--) { - if (m_aColumns.GetObject(nModelPos)->IsHidden()) + if ( m_aColumns[ nModelPos ]->IsHidden() ) --nViewPos; } // restore nModelPos, we need it later @@ -1701,16 +1701,20 @@ sal_uInt16 DbGridControl::AppendColumn(const XubString& rName, sal_uInt16 nWidth } // calculate the new id - for (nId=1; (GetModelColumnPos(nId) != GRID_COLUMN_NOT_FOUND) && (nId<=m_aColumns.Count()); ++nId) + for (nId=1; (GetModelColumnPos(nId) != GRID_COLUMN_NOT_FOUND) && (nId <= m_aColumns.size()); ++nId) ; DBG_ASSERT(GetViewColumnPos(nId) == (sal_uInt16)-1, "DbGridControl::AppendColumn : inconsistent internal state !"); // my column's models say "there is no column with id nId", but the view (the base class) says "there is a column ..." DbGridControl_Base::AppendColumn(rName, nWidth, nRealPos, nId); if (nModelPos == HEADERBAR_APPEND) - m_aColumns.Insert(CreateColumn(nId), LIST_APPEND); + m_aColumns.push_back( CreateColumn(nId) ); else - m_aColumns.Insert(CreateColumn(nId), nModelPos); + { + DbGridColumns::iterator it = m_aColumns.begin(); + ::std::advance( it, nModelPos ); + m_aColumns.insert( it, CreateColumn(nId) ); + } return nId; } @@ -1720,7 +1724,11 @@ void DbGridControl::RemoveColumn(sal_uInt16 nId) { sal_Int16 nIndex = GetModelColumnPos(nId); DbGridControl_Base::RemoveColumn(nId); - delete m_aColumns.Remove(nIndex); + + delete m_aColumns[ nIndex ]; + DbGridColumns::iterator it = m_aColumns.begin(); + ::std::advance( it, nIndex ); + m_aColumns.erase( it ); } //------------------------------------------------------------------------------ @@ -1731,7 +1739,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) // remove the col from the model sal_Int16 nOldModelPos = GetModelColumnPos(nId); #ifdef DBG_UTIL - DbGridColumn* pCol = m_aColumns.GetObject((sal_uInt32)nOldModelPos); + DbGridColumn* pCol = m_aColumns[ (sal_uInt32)nOldModelPos ]; DBG_ASSERT(!pCol->IsHidden(), "DbGridControl::ColumnMoved : moved a hidden col ? how this ?"); #endif @@ -1743,9 +1751,9 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) // from that we can compute the new model pos sal_uInt16 nNewModelPos; - for (nNewModelPos = 0; nNewModelPos < m_aColumns.Count(); ++nNewModelPos) + for (nNewModelPos = 0; nNewModelPos < m_aColumns.size(); ++nNewModelPos) { - if (!m_aColumns.GetObject(nNewModelPos)->IsHidden()) + if (!m_aColumns[ nNewModelPos ]->IsHidden()) { if (!nNewViewPos) break; @@ -1753,7 +1761,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) --nNewViewPos; } } - DBG_ASSERT(nNewModelPos<m_aColumns.Count(), "DbGridControl::ColumnMoved : could not find the new model position !"); + DBG_ASSERT( nNewModelPos < m_aColumns.size(), "DbGridControl::ColumnMoved : could not find the new model position !"); // this will work. of course the model isn't fully consistent with our view right now, but let's // look at the situation : a column has been moved with in the VIEW from pos m to n, say m<n (in the @@ -1813,7 +1821,16 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) // that. It's because it took me a while to see it myself, and the whole theme (hidden cols, model col // positions, view col positions) is really painful (at least for me) so the above pictures helped me a lot ;) - m_aColumns.Insert(m_aColumns.Remove((sal_uInt32)nOldModelPos), nNewModelPos); + + DbGridColumn* temp = m_aColumns[ nOldModelPos ]; + + DbGridColumns::iterator it = m_aColumns.begin(); + ::std::advance( it, nOldModelPos ); + m_aColumns.erase( it ); + + it = m_aColumns.begin(); + ::std::advance( it, nNewModelPos ); + m_aColumns.insert( it, temp ); } //------------------------------------------------------------------------------ @@ -2046,7 +2063,8 @@ void DbGridControl::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uI if (!IsValid(m_xPaintRow)) return; - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColumnId)); + size_t Location = GetModelColumnPos(nColumnId); + DbGridColumn* pColumn = (Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; if (pColumn) { Rectangle aArea(rRect); @@ -2238,9 +2256,9 @@ void DbGridControl::forceROController(sal_Bool bForce) m_bForceROController = bForce; // alle Columns durchgehen und denen Bescheid geben - for (sal_uInt16 i=0; i<m_aColumns.Count(); ++i) + for ( size_t i=0; i < m_aColumns.size(); ++i ) { - DbGridColumn* pColumn = m_aColumns.GetObject(i); + DbGridColumn* pColumn = m_aColumns[ i ]; if (!pColumn) continue; @@ -2711,9 +2729,9 @@ void DbGridControl::SetFilterMode(sal_Bool bMode) m_xEmptyRow = new DbGridRow(); // setting the new filter controls - for (sal_uInt16 i = 0; i<m_aColumns.Count(); ++i) + for ( size_t i = 0; i < m_aColumns.size(); ++i ) { - DbGridColumn* pCurCol = m_aColumns.GetObject(i); + DbGridColumn* pCurCol = m_aColumns[ i ]; if (!pCurCol->IsHidden()) pCurCol->UpdateControl(); } @@ -2729,7 +2747,8 @@ void DbGridControl::SetFilterMode(sal_Bool bMode) // ----------------------------------------------------------------------------- String DbGridControl::GetCellText(long _nRow, USHORT _nColId) const { - DbGridColumn* pColumn = m_aColumns.GetObject( GetModelColumnPos( _nColId ) ); + size_t Location = GetModelColumnPos( _nColId ); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; String sRet; if ( const_cast<DbGridControl*>(this)->SeekRow(_nRow) ) sRet = GetCurrentRowCellText(pColumn, m_xPaintRow); @@ -2750,7 +2769,8 @@ sal_uInt32 DbGridControl::GetTotalCellWidth(long nRow, sal_uInt16 nColId) { if (SeekRow(nRow)) { - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColId)); + size_t Location = GetModelColumnPos( nColId ); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; return GetDataWindow().GetTextWidth(GetCurrentRowCellText(pColumn,m_xPaintRow)); } else @@ -2865,7 +2885,8 @@ void DbGridControl::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel ) if (GetDataWindow().IsMouseCaptured()) GetDataWindow().ReleaseMouse(); - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColId)); + size_t Location = GetModelColumnPos( nColId ); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; OStringTransferable* pTransferable = new OStringTransferable(GetCurrentRowCellText(pColumn,m_xPaintRow)); Reference< XTransferable > xEnsureDelete(pTransferable); pTransferable->StartDrag(this, DND_ACTION_COPY); @@ -2885,7 +2906,7 @@ sal_Bool DbGridControl::canCopyCellText(sal_Int32 _nRow, sal_Int16 _nColId) void DbGridControl::copyCellText(sal_Int32 _nRow, sal_Int16 _nColId) { DBG_ASSERT(canCopyCellText(_nRow, _nColId), "DbGridControl::copyCellText: invalid call!"); - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(_nColId)); + DbGridColumn* pColumn = m_aColumns[ GetModelColumnPos(_nColId) ]; SeekRow(_nRow); OStringTransfer::CopyString( GetCurrentRowCellText( pColumn,m_xPaintRow ), this ); } @@ -3037,7 +3058,8 @@ CellController* DbGridControl::GetController(long /*nRow*/, sal_uInt16 nColumnId if (!IsValid(m_xCurrentRow) || !IsEnabled()) return NULL; - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColumnId)); + size_t Location = GetModelColumnPos(nColumnId); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; if (!pColumn) return NULL; @@ -3076,7 +3098,8 @@ CellController* DbGridControl::GetController(long /*nRow*/, sal_uInt16 nColumnId //------------------------------------------------------------------------------ void DbGridControl::InitController(CellControllerRef& /*rController*/, long /*nRow*/, sal_uInt16 nColumnId) { - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColumnId)); + size_t Location = GetModelColumnPos(nColumnId); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; if (pColumn) pColumn->UpdateFromField(m_xCurrentRow, m_xFormatter); } @@ -3289,7 +3312,8 @@ sal_Bool DbGridControl::SaveModified() if (!DbGridControl_Base::IsModified()) return sal_True; - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(GetCurColumnId())); + size_t Location = GetModelColumnPos( GetCurColumnId() ); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; sal_Bool bOK = pColumn->Commit(); DBG_ASSERT( Controller().Is(), "DbGridControl::SaveModified: was modified, by have no controller?!" ); if ( !Controller().Is() ) @@ -3481,7 +3505,8 @@ void DbGridControl::KeyInput( const KeyEvent& rEvt ) sal_uInt16 nColId = GetCurColumnId(); if (nRow >= 0 && nRow < GetRowCount() && nColId < ColCount()) { - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColId)); + size_t Location = GetModelColumnPos( nColId ); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; OStringTransfer::CopyString( GetCurrentRowCellText( pColumn,m_xPaintRow ), this ); return; } @@ -3505,7 +3530,8 @@ void DbGridControl::HideColumn(sal_uInt16 nId) // don't use my own RemoveColumn, this would remove it from m_aColumns, too // update my model - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nId)); + size_t Location = GetModelColumnPos( nId ); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; DBG_ASSERT(pColumn, "DbGridControl::HideColumn : somebody did hide a nonexistent column !"); if (pColumn) { @@ -3526,7 +3552,7 @@ void DbGridControl::ShowColumn(sal_uInt16 nId) if (nPos == (sal_uInt16)-1) return; - DbGridColumn* pColumn = m_aColumns.GetObject(nPos); + DbGridColumn* pColumn = m_aColumns[ nPos ]; if (!pColumn->IsHidden()) { DBG_ASSERT(GetViewColumnPos(nId) != (sal_uInt16)-1, "DbGridControl::ShowColumn : inconsistent internal state !"); @@ -3539,9 +3565,9 @@ void DbGridControl::ShowColumn(sal_uInt16 nId) // to determine the new view position we need an adjacent non-hidden column sal_uInt16 nNextNonHidden = (sal_uInt16)-1; // first search the cols to the right - for (sal_uInt16 i = nPos + 1; i<m_aColumns.Count(); ++i) + for ( size_t i = nPos + 1; i < m_aColumns.size(); ++i ) { - DbGridColumn* pCurCol = m_aColumns.GetObject(i); + DbGridColumn* pCurCol = m_aColumns[ i ]; if (!pCurCol->IsHidden()) { nNextNonHidden = i; @@ -3551,9 +3577,9 @@ void DbGridControl::ShowColumn(sal_uInt16 nId) if ((nNextNonHidden == (sal_uInt16)-1) && (nPos > 0)) { // then to the left - for (sal_uInt16 i = nPos; i>0; --i) + for ( size_t i = nPos; i > 0; --i ) { - DbGridColumn* pCurCol = m_aColumns.GetObject(i-1); + DbGridColumn* pCurCol = m_aColumns[ i-1 ]; if (!pCurCol->IsHidden()) { nNextNonHidden = i-1; @@ -3563,7 +3589,7 @@ void DbGridControl::ShowColumn(sal_uInt16 nId) } sal_uInt16 nNewViewPos = (nNextNonHidden == (sal_uInt16)-1) ? 1 // there is no visible column -> insert behinde the handle col - : GetViewColumnPos(m_aColumns.GetObject(nNextNonHidden)->GetId()) + 1; + : GetViewColumnPos( m_aColumns[ nNextNonHidden ]->GetId() ) + 1; // the first non-handle col has "view pos" 0, but the pos arg for InsertDataColumn expects // a position 1 for the first non-handle col -> +1 DBG_ASSERT(nNewViewPos != (sal_uInt16)-1, "DbGridControl::ShowColumn : inconsistent internal state !"); @@ -3587,13 +3613,13 @@ void DbGridControl::ShowColumn(sal_uInt16 nId) //------------------------------------------------------------------------------ sal_uInt16 DbGridControl::GetColumnIdFromModelPos( sal_uInt16 nPos ) const { - if (nPos >= m_aColumns.Count()) + if (nPos >= m_aColumns.size()) { DBG_ERROR("DbGridControl::GetColumnIdFromModelPos : invalid argument !"); return (sal_uInt16)-1; } - DbGridColumn* pCol = m_aColumns.GetObject(nPos); + DbGridColumn* pCol = m_aColumns[ nPos ]; #if (OSL_DEBUG_LEVEL > 0) || defined DBG_UTIL // in der Debug-Version rechnen wir die ModelPos in eine ViewPos um und vergleichen das mit dem Wert, // den wir zurueckliefern werden (nId an der entsprechenden Col in m_aColumns) @@ -3601,8 +3627,8 @@ sal_uInt16 DbGridControl::GetColumnIdFromModelPos( sal_uInt16 nPos ) const if (!pCol->IsHidden()) { // macht nur Sinn, wenn die Spalte sichtbar ist sal_uInt16 nViewPos = nPos; - for (sal_uInt16 i=0; i<m_aColumns.Count() && i<nPos; ++i) - if (m_aColumns.GetObject(i)->IsHidden()) + for ( size_t i = 0; i < m_aColumns.size() && i < nPos; ++i) + if ( m_aColumns[ i ]->IsHidden()) --nViewPos; DBG_ASSERT(pCol && GetColumnIdFromViewPos(nViewPos) == pCol->GetId(), @@ -3615,8 +3641,8 @@ sal_uInt16 DbGridControl::GetColumnIdFromModelPos( sal_uInt16 nPos ) const //------------------------------------------------------------------------------ sal_uInt16 DbGridControl::GetModelColumnPos( sal_uInt16 nId ) const { - for (sal_uInt16 i=0; i<m_aColumns.Count(); ++i) - if (m_aColumns.GetObject(i)->GetId() == nId) + for ( size_t i = 0; i < m_aColumns.size(); ++i ) + if ( m_aColumns[ i ]->GetId() == nId ) return i; return GRID_COLUMN_NOT_FOUND; @@ -3725,9 +3751,9 @@ void DbGridControl::ConnectToFields() m_pFieldListeners = pListeners; } - for (sal_Int32 i=0; i<(sal_Int32)m_aColumns.Count(); ++i) + for ( size_t i = 0; i < m_aColumns.size(); ++i ) { - DbGridColumn* pCurrent = m_aColumns.GetObject(i); + DbGridColumn* pCurrent = m_aColumns[ i ]; sal_uInt16 nViewPos = pCurrent ? GetViewColumnPos(pCurrent->GetId()) : (sal_uInt16)-1; if ((sal_uInt16)-1 == nViewPos) continue; @@ -3772,7 +3798,8 @@ void DbGridControl::FieldValueChanged(sal_uInt16 _nId, const PropertyChangeEvent // all other cases are handled elsewhere return; - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(_nId)); + size_t Location = GetModelColumnPos( _nId ); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; if (pColumn) { sal_Bool bAcquiredPaintSafety = sal_False; @@ -3856,7 +3883,8 @@ Reference<XAccessible > DbGridControl::CreateAccessibleControl( sal_Int32 _nInde Reference< XAccessible > DbGridControl::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) { USHORT nColumnId = GetColumnId( _nColumnPos ); - DbGridColumn* pColumn = m_aColumns.GetObject(GetModelColumnPos(nColumnId)); + size_t Location = GetModelColumnPos(nColumnId); + DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : NULL; if ( pColumn ) { Reference< ::com::sun::star::awt::XControl> xInt(pColumn->GetCell()); |