summaryrefslogtreecommitdiff
path: root/svx/source/fmcomp/gridctrl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/fmcomp/gridctrl.cxx')
-rw-r--r--svx/source/fmcomp/gridctrl.cxx156
1 files changed, 90 insertions, 66 deletions
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 34d1e05906..d315301b81 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,18 +29,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
-#ifndef _SVX_FMHELP_HRC
+#include <sal/macros.h>
#include "fmhelp.hrc"
-#endif
#include <svx/gridctrl.hxx>
#include "gridcell.hxx"
#include "svx/dbtoolsclient.hxx"
#include "svx/fmtools.hxx"
#include <svtools/stringtransfer.hxx>
-#ifndef _SVX_FMPROP_HRC
#include "fmprop.hrc"
-#endif
#include <svtools/stringtransfer.hxx>
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
@@ -64,9 +62,7 @@
#include "svx/fmresids.hrc"
#endif
-#ifndef _SVX_SVXIDS_HRC
#include <svx/svxids.hrc>
-#endif
#include <tools/shl.hxx>
#include <svx/dialmgr.hxx>
#include "fmservs.hxx"
@@ -739,7 +735,6 @@ void DbGridControl::NavigationBar::SetState(sal_uInt16 nWhich)
// event (ImplGenerateMouseMove) even if nothing happened. This may lead to some unwanted effects, so we
// do this check.
// For further explanation see Bug 69900.
- // FS - 18.11.99
pWnd->Enable(bAvailable);
}
@@ -785,7 +780,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
case STATE_CHANGE_MIRRORING:
{
BOOL bIsRTLEnabled = IsRTLEnabled();
- for ( size_t i=0; i < sizeof( pWindows ) / sizeof( pWindows[0] ); ++i )
+ for ( size_t i=0; i < SAL_N_ELEMENTS( pWindows ); ++i )
pWindows[i]->EnableRTL( bIsRTLEnabled );
}
break;
@@ -799,7 +794,7 @@ void DbGridControl::NavigationBar::StateChanged( StateChangedType nType )
if ( IsControlFont() )
aFont.Merge( GetControlFont() );
- for (size_t i=0; i < sizeof(pWindows)/sizeof(pWindows[0]); ++i)
+ for (size_t i=0; i < SAL_N_ELEMENTS(pWindows); ++i)
{
pWindows[i]->SetZoom(aZoom);
pWindows[i]->SetZoomedPointFont(aFont);
@@ -828,7 +823,7 @@ DbGridRow::DbGridRow(CursorWrapper* pCur, sal_Bool bPaintCursor)
Reference< XPropertySet > xColSet;
::cppu::extractInterface(xColSet, xColumns->getByIndex(i));
pColumn = new DataColumn(xColSet);
- m_aVariants.Insert(pColumn, LIST_APPEND);
+ m_aVariants.push_back( pColumn );
}
if (pCur->rowDeleted())
@@ -866,9 +861,9 @@ DbGridRow::DbGridRow(CursorWrapper* pCur, sal_Bool bPaintCursor)
//------------------------------------------------------------------------------
DbGridRow::~DbGridRow()
{
- sal_uInt32 nCount = m_aVariants.Count();
- for (sal_uInt32 i = 0; i < nCount; i++)
- delete m_aVariants.GetObject(i);
+ for ( size_t i = 0, n = m_aVariants.size(); i < n; ++i )
+ delete m_aVariants[ i ];
+ m_aVariants.clear();
}
//------------------------------------------------------------------------------
@@ -1095,9 +1090,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 );
}
@@ -1169,8 +1164,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);
@@ -1494,7 +1489,7 @@ void DbGridControl::setDataSource(const Reference< XRowSet >& _xCursor, sal_uInt
// retrieve the datebase of the Numberformatter
try
{
- xSupplier->getNumberFormatSettings()->getPropertyValue(rtl::OUString::createFromAscii("NullDate")) >>= m_aNullDate;
+ xSupplier->getNumberFormatSettings()->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate"))) >>= m_aNullDate;
}
catch(Exception&)
{
@@ -1673,9 +1668,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();
}
@@ -1698,7 +1693,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
@@ -1708,16 +1703,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;
}
@@ -1727,7 +1726,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 );
}
//------------------------------------------------------------------------------
@@ -1738,7 +1741,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
@@ -1750,9 +1753,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;
@@ -1760,7 +1763,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,14 +1816,23 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId)
// +---+---+---+---+---+---+
//
// Now, all is consistent again.
- // (except of the hidden column : The cycling of the cols occured on the model, not on the view. maybe
+ // (except of the hidden column : The cycling of the cols occurred on the model, not on the view. maybe
// the user expected the latter but there really is no good argument against our method ;) ...)
//
// And no, this large explanation isn't just because I wanted to play a board game or something like
// 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 );
}
//------------------------------------------------------------------------------
@@ -2053,7 +2065,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);
@@ -2245,9 +2258,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;
@@ -2278,7 +2291,7 @@ void DbGridControl::forceROController(sal_Bool bForce)
void DbGridControl::AdjustDataSource(sal_Bool bFull)
{
TRACE_RANGE("DbGridControl::AdjustDataSource");
- ::vos::OGuard aGuard(Application::GetSolarMutex());
+ SolarMutexGuard aGuard;
// wird die aktuelle Zeile gerade neu bestimmt,
// wird kein abgleich vorgenommen
@@ -2718,9 +2731,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();
}
@@ -2736,7 +2749,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);
@@ -2757,7 +2771,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
@@ -2810,7 +2825,7 @@ void DbGridControl::PostExecuteRowContextMenu(sal_uInt16 /*nRow*/, const PopupMe
void DbGridControl::DataSourcePropertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException )
{
TRACE_RANGE("DbGridControl::DataSourcePropertyChanged");
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SolarMutexGuard aGuard;
// prop "IsModified" changed ?
// during update don't care about the modified state
if (!IsUpdating() && evt.PropertyName.compareTo(FM_PROP_ISMODIFIED) == COMPARE_EQUAL)
@@ -2872,7 +2887,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);
@@ -2892,7 +2908,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 );
}
@@ -3044,7 +3060,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;
@@ -3083,7 +3100,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);
}
@@ -3296,7 +3314,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() )
@@ -3488,7 +3507,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;
}
@@ -3512,7 +3532,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)
{
@@ -3533,7 +3554,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 !");
@@ -3546,9 +3567,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;
@@ -3558,9 +3579,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;
@@ -3570,7 +3591,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 !");
@@ -3594,13 +3615,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)
@@ -3608,8 +3629,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(),
@@ -3622,8 +3643,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;
@@ -3634,7 +3655,7 @@ void DbGridControl::implAdjustInSolarThread(BOOL _bRows)
{
TRACE_RANGE("DbGridControl::implAdjustInSolarThread");
::osl::MutexGuard aGuard(m_aAdjustSafety);
- if (::vos::OThread::getCurrentIdentifier() != Application::GetMainThreadIdentifier())
+ if (::osl::Thread::getCurrentIdentifier() != Application::GetMainThreadIdentifier())
{
m_nAsynAdjustEvent = PostUserEvent(LINK(this, DbGridControl, OnAsyncAdjust), reinterpret_cast< void* >( _bRows ));
m_bPendingAdjustRows = _bRows;
@@ -3732,9 +3753,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;
@@ -3779,7 +3800,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;
@@ -3797,7 +3819,7 @@ void DbGridControl::FieldValueChanged(sal_uInt16 _nId, const PropertyChangeEvent
return;
}
// here we got the solar mutex, transfer it to a guard for safety reasons
- ::vos::OGuard aPaintSafety(Application::GetSolarMutex());
+ SolarMutexGuard aPaintSafety;
Application::GetSolarMutex().release();
// and finally do the update ...
@@ -3863,7 +3885,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());
@@ -3891,3 +3914,4 @@ Reference< XAccessible > DbGridControl::CreateAccessibleCell( sal_Int32 _nRow, s
// -----------------------------------------------------------------------------
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */