[Libreoffice-commits] core.git: include/svx svx/source
Noel Grandin
noel.grandin at collabora.co.uk
Tue May 8 07:07:08 UTC 2018
include/svx/gridctrl.hxx | 8 +---
svx/source/fmcomp/fmgridcl.cxx | 12 +++---
svx/source/fmcomp/fmgridif.cxx | 20 +++++------
svx/source/fmcomp/gridctrl.cxx | 72 ++++++++++++++++-------------------------
4 files changed, 48 insertions(+), 64 deletions(-)
New commits:
commit 137ec9e3185bc19884e8fc1a56151c8892b0c52e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri May 4 17:07:59 2018 +0200
loplugin:useuniqueptr in FmGridListener
Change-Id: I774aaf10dd9701f40a098280b68557d8b8045b34
Reviewed-on: https://gerrit.libreoffice.org/53884
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx
index 432a3a463134..f4782b91baa2 100644
--- a/include/svx/gridctrl.hxx
+++ b/include/svx/gridctrl.hxx
@@ -98,8 +98,6 @@ typedef tools::SvRef<DbGridRow> DbGridRowRef;
// DbGridControl
class DbGridColumn;
-typedef ::std::vector< DbGridColumn* > DbGridColumns;
-
class FmGridListener
{
@@ -233,7 +231,7 @@ private:
css::uno::Reference< css::util::XNumberFormatter > m_xFormatter;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
- DbGridColumns m_aColumns; // Column description
+ std::vector< std::unique_ptr<DbGridColumn> > m_aColumns; // Column description
VclPtr<NavigationBar> m_aBar;
DbGridRowRef m_xDataRow; // Row which can be modified
// comes from the data cursor
@@ -328,7 +326,7 @@ protected:
virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = sal_uInt16(-1)) override;
void RemoveColumn(sal_uInt16 nId);
- DbGridColumn* CreateColumn(sal_uInt16 nId) const;
+ std::unique_ptr<DbGridColumn> CreateColumn(sal_uInt16 nId) const;
virtual void ColumnMoved(sal_uInt16 nId) override;
virtual bool SaveRow() override;
virtual bool IsTabAllowed(bool bForward) const override;
@@ -403,7 +401,7 @@ public:
virtual void Dispatch(sal_uInt16 nId) override;
CursorWrapper* getDataSource() const {return m_pDataCursor.get();}
- const DbGridColumns& GetColumns() const {return m_aColumns;}
+ const std::vector< std::unique_ptr<DbGridColumn> >& GetColumns() const {return m_aColumns;}
void EnableHandle(bool bEnable);
bool HasHandle() const {return m_bHandle;}
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index 972a66c94666..668fb08a731b 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -1508,7 +1508,7 @@ void FmGridControl::ColumnResized(sal_uInt16 nId)
DbGridControl::ColumnResized(nId);
// transfer value to the model
- DbGridColumn* pCol = DbGridControl::GetColumns().at( GetModelColumnPos(nId) );
+ DbGridColumn* pCol = DbGridControl::GetColumns()[ GetModelColumnPos(nId) ].get();
Reference< css::beans::XPropertySet > xColModel(pCol->getModel());
if (xColModel.is())
{
@@ -1550,7 +1550,7 @@ void FmGridControl::ColumnMoved(sal_uInt16 nId)
{
// locate the column and move in the model;
// get ColumnPos
- DbGridColumn* pCol = DbGridControl::GetColumns().at( GetModelColumnPos(nId) );
+ DbGridColumn* pCol = DbGridControl::GetColumns()[ GetModelColumnPos(nId) ].get();
Reference< css::beans::XPropertySet > xCol;
// inserting must be based on the column positions
@@ -1612,7 +1612,7 @@ void FmGridControl::InitColumnsByModels(const Reference< css::container::XIndexC
nWidth = LogicToPixel(Point(nWidth, 0), MapMode(MapUnit::Map10thMM)).X();
AppendColumn(aName, static_cast<sal_uInt16>(nWidth));
- DbGridColumn* pCol = DbGridControl::GetColumns().at( i );
+ DbGridColumn* pCol = DbGridControl::GetColumns()[ i ].get();
pCol->setModel(xCol);
}
@@ -1716,7 +1716,7 @@ void FmGridControl::InitColumnsByFields(const Reference< css::container::XIndexA
// inserting must be based on the column positions
for (sal_Int32 i = 0; i < xColumns->getCount(); i++)
{
- DbGridColumn* pCol = GetColumns().at( i );
+ DbGridColumn* pCol = GetColumns()[ i ].get();
OSL_ENSURE(pCol,"No grid column!");
if ( pCol )
{
@@ -1736,7 +1736,7 @@ void FmGridControl::HideColumn(sal_uInt16 nId)
if (nPos == sal_uInt16(-1))
return;
- DbGridColumn* pColumn = GetColumns().at( nPos );
+ DbGridColumn* pColumn = GetColumns()[ nPos ].get();
if (pColumn->IsHidden())
GetPeer()->columnHidden(pColumn);
@@ -1767,7 +1767,7 @@ void FmGridControl::ShowColumn(sal_uInt16 nId)
if (nPos == sal_uInt16(-1))
return;
- DbGridColumn* pColumn = GetColumns().at( nPos );
+ DbGridColumn* pColumn = GetColumns()[ nPos ].get();
if (!pColumn->IsHidden())
GetPeer()->columnVisible(pColumn);
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index e3cee1d1e471..9dbba769b08f 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1219,7 +1219,7 @@ Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType
VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >();
sal_Int32 nColumns = pGrid->GetViewColCount();
- DbGridColumns aColumns = pGrid->GetColumns();
+ std::vector< std::unique_ptr<DbGridColumn> > const & aColumns = pGrid->GetColumns();
Sequence<sal_Bool> aReturnSequence(nColumns);
sal_Bool* pReturnArray = aReturnSequence.getArray();
@@ -1242,7 +1242,7 @@ Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType
sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos(static_cast<sal_uInt16>(i)));
DBG_ASSERT(nModelPos != sal_uInt16(-1), "FmXGridPeer::queryFieldDataType : no model pos !");
- pCol = aColumns[ nModelPos ];
+ pCol = aColumns[ nModelPos ].get();
const DbGridRowRef xRow = pGrid->GetSeekRow();
xFieldContent = (xRow.is() && xRow->HasField(pCol->GetFieldPos())) ? xRow->GetField(pCol->GetFieldPos()).getColumn() : Reference< css::sdb::XColumn > ();
if (!xFieldContent.is())
@@ -1287,7 +1287,7 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type
ENSURE_OR_THROW( xPaintRow.is(), "invalid paint row" );
// I need the columns of the control for GetFieldText
- DbGridColumns aColumns = pGrid->GetColumns();
+ std::vector< std::unique_ptr<DbGridColumn> > const & aColumns = pGrid->GetColumns();
// and through all the columns
sal_Int32 nColumnCount = pGrid->GetViewColCount();
@@ -1304,7 +1304,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
- DbGridColumn* pCol = aColumns[ nModelPos ];
+ DbGridColumn* pCol = aColumns[ nModelPos ].get();
xFieldContent = xPaintRow->HasField( pCol->GetFieldPos() )
? xPaintRow->GetField( pCol->GetFieldPos() ).getColumn()
: Reference< XColumn > ();
@@ -1436,7 +1436,7 @@ void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt)
// in design mode it doesn't matter
if (!isDesignMode())
{
- DbGridColumn* pCol = pGrid->GetColumns().at( i );
+ DbGridColumn* pCol = pGrid->GetColumns()[i].get();
pCol->SetAlignmentFromModel(-1);
bInvalidateColumn = true;
@@ -1727,7 +1727,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt)
pGrid->AppendColumn(aName, static_cast<sal_uInt16>(nWidth), static_cast<sal_Int16>(::comphelper::getINT32(evt.Accessor)));
// now set the column
- DbGridColumn* pCol = pGrid->GetColumns().at( ::comphelper::getINT32(evt.Accessor) );
+ DbGridColumn* pCol = pGrid->GetColumns()[ ::comphelper::getINT32(evt.Accessor) ].get();
pCol->setModel(xNewColumn);
Any aHidden = xNewColumn->getPropertyValue(FM_PROP_HIDDEN);
@@ -1770,7 +1770,7 @@ void FmXGridPeer::elementReplaced(const ContainerEvent& evt)
sal_uInt16 nNewPos = pGrid->GetModelColumnPos(nNewId);
// set the model of the new column
- DbGridColumn* pCol = pGrid->GetColumns().at( nNewPos );
+ DbGridColumn* pCol = pGrid->GetColumns()[ nNewPos ].get();
// for initializing this grid column, we need the fields of the grid's data source
Reference< XColumnsSupplier > xSuppColumns;
@@ -1833,8 +1833,8 @@ void FmXGridPeer::setProperty( const OUString& PropertyName, const Any& Value)
}
// need to forward this to the columns
- DbGridColumns& rColumns = const_cast<DbGridColumns&>(pGrid->GetColumns());
- for (DbGridColumn* pLoop : rColumns)
+ std::vector< std::unique_ptr<DbGridColumn> > const & rColumns = pGrid->GetColumns();
+ for (auto const & pLoop : rColumns)
{
FmXGridCell* pXCell = pLoop->GetCell();
if (pXCell)
@@ -2334,7 +2334,7 @@ Any FmXGridPeer::getByIndex(sal_Int32 _nIndex)
if ( nPos == GRID_COLUMN_NOT_FOUND )
return aElement;
- DbGridColumn* pCol = pGrid->GetColumns().at( nPos );
+ DbGridColumn* pCol = pGrid->GetColumns()[ nPos ].get();
Reference< css::awt::XControl > xControl(pCol->GetCell());
aElement <<= xControl;
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index 9f706812a1db..2048e63e7a35 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1098,10 +1098,9 @@ void DbGridControl::Select()
void DbGridControl::ImplInitWindow( const InitWindowFacet _eInitWhat )
{
- for (DbGridColumn* pCol : m_aColumns)
+ for (auto const & pCol : m_aColumns)
{
- if (pCol)
- pCol->ImplInitWindow( GetDataWindow(), _eInitWhat );
+ pCol->ImplInitWindow( GetDataWindow(), _eInitWhat );
}
if ( _eInitWhat & InitWindowFacet::WritingMode )
@@ -1169,7 +1168,7 @@ void DbGridControl::RemoveRows()
// de-initialize all columns
// if there are columns, free all controllers
- for (DbGridColumn* pColumn : m_aColumns)
+ for (auto const & pColumn : m_aColumns)
pColumn->Clear();
m_pSeekCursor.reset();
@@ -1642,16 +1641,14 @@ void DbGridControl::RemoveColumns()
if ( IsEditing() )
DeactivateCell();
- for (DbGridColumn* pColumn : m_aColumns)
- delete pColumn;
m_aColumns.clear();
EditBrowseBox::RemoveColumns();
}
-DbGridColumn* DbGridControl::CreateColumn(sal_uInt16 nId) const
+std::unique_ptr<DbGridColumn> DbGridControl::CreateColumn(sal_uInt16 nId) const
{
- return new DbGridColumn(nId, *const_cast<DbGridControl*>(this));
+ return std::unique_ptr<DbGridColumn>(new DbGridColumn(nId, *const_cast<DbGridControl*>(this)));
}
sal_uInt16 DbGridControl::AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nModelPos, sal_uInt16 nId)
@@ -1675,7 +1672,7 @@ sal_uInt16 DbGridControl::AppendColumn(const OUString& rName, sal_uInt16 nWidth,
}
// calculate the new id
- for (nId=1; (GetModelColumnPos(nId) != GRID_COLUMN_NOT_FOUND) && sal::static_int_cast<DbGridColumns::size_type>(nId) <= m_aColumns.size(); ++nId)
+ for (nId=1; (GetModelColumnPos(nId) != GRID_COLUMN_NOT_FOUND) && size_t(nId) <= m_aColumns.size(); ++nId)
;
DBG_ASSERT(GetViewColumnPos(nId) == GRID_COLUMN_NOT_FOUND, "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 ..."
@@ -1684,11 +1681,7 @@ sal_uInt16 DbGridControl::AppendColumn(const OUString& rName, sal_uInt16 nWidth,
if (nModelPos == HEADERBAR_APPEND)
m_aColumns.push_back( CreateColumn(nId) );
else
- {
- DbGridColumns::iterator it = m_aColumns.begin();
- ::std::advance( it, nModelPos );
- m_aColumns.insert( it, CreateColumn(nId) );
- }
+ m_aColumns.insert( m_aColumns.begin() + nModelPos, CreateColumn(nId) );
return nId;
}
@@ -1700,7 +1693,6 @@ void DbGridControl::RemoveColumn(sal_uInt16 nId)
const sal_uInt16 nIndex = GetModelColumnPos(nId);
if(nIndex != GRID_COLUMN_NOT_FOUND)
{
- delete m_aColumns[nIndex];
m_aColumns.erase( m_aColumns.begin()+nIndex );
}
}
@@ -1712,7 +1704,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId)
// remove the col from the model
sal_uInt16 nOldModelPos = GetModelColumnPos(nId);
#ifdef DBG_UTIL
- DbGridColumn* pCol = m_aColumns[ static_cast<sal_uInt32>(nOldModelPos) ];
+ DbGridColumn* pCol = m_aColumns[ nOldModelPos ].get();
DBG_ASSERT(!pCol->IsHidden(), "DbGridControl::ColumnMoved : moved a hidden col ? how this ?");
#endif
@@ -1723,7 +1715,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId)
sal_uInt16 nNewViewPos = GetViewColumnPos(nId);
// from that we can compute the new model pos
- DbGridColumns::size_type nNewModelPos;
+ size_t nNewModelPos;
for (nNewModelPos = 0; nNewModelPos < m_aColumns.size(); ++nNewModelPos)
{
if (!m_aColumns[ nNewModelPos ]->IsHidden())
@@ -1794,15 +1786,9 @@ 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 ;)
- 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 );
+ auto temp = std::move(m_aColumns[ nOldModelPos ]);
+ m_aColumns.erase( m_aColumns.begin() + nOldModelPos );
+ m_aColumns.insert( m_aColumns.begin() + nNewModelPos, std::move(temp) );
}
bool DbGridControl::SeekRow(long nRow)
@@ -2031,7 +2017,7 @@ void DbGridControl::PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect,
return;
size_t Location = GetModelColumnPos(nColumnId);
- DbGridColumn* pColumn = (Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = (Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
if (pColumn)
{
tools::Rectangle aArea(rRect);
@@ -2632,7 +2618,7 @@ void DbGridControl::SetFilterMode(bool bMode)
m_xEmptyRow = new DbGridRow();
// setting the new filter controls
- for (DbGridColumn* pCurCol : m_aColumns)
+ for (auto const & pCurCol : m_aColumns)
{
if (!pCurCol->IsHidden())
pCurCol->UpdateControl();
@@ -2650,7 +2636,7 @@ void DbGridControl::SetFilterMode(bool bMode)
OUString DbGridControl::GetCellText(long _nRow, sal_uInt16 _nColId) const
{
size_t Location = GetModelColumnPos( _nColId );
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
OUString sRet;
if ( const_cast<DbGridControl*>(this)->SeekRow(_nRow) )
sRet = GetCurrentRowCellText(pColumn, m_xPaintRow);
@@ -2671,7 +2657,7 @@ sal_uInt32 DbGridControl::GetTotalCellWidth(long nRow, sal_uInt16 nColId)
if (SeekRow(nRow))
{
size_t Location = GetModelColumnPos( nColId );
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
return GetDataWindow().GetTextWidth(GetCurrentRowCellText(pColumn,m_xPaintRow));
}
else
@@ -2777,7 +2763,7 @@ void DbGridControl::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel )
GetDataWindow().ReleaseMouse();
size_t Location = GetModelColumnPos( nColId );
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
rtl::Reference<OStringTransferable> pTransferable = new OStringTransferable(GetCurrentRowCellText(pColumn,m_xPaintRow));
pTransferable->StartDrag(this, DND_ACTION_COPY);
}
@@ -2794,7 +2780,7 @@ bool DbGridControl::canCopyCellText(sal_Int32 _nRow, sal_uInt16 _nColId)
void DbGridControl::copyCellText(sal_Int32 _nRow, sal_uInt16 _nColId)
{
DBG_ASSERT(canCopyCellText(_nRow, _nColId), "DbGridControl::copyCellText: invalid call!");
- DbGridColumn* pColumn = m_aColumns[ GetModelColumnPos(_nColId) ];
+ DbGridColumn* pColumn = m_aColumns[ GetModelColumnPos(_nColId) ].get();
SeekRow(_nRow);
OStringTransfer::CopyString( GetCurrentRowCellText( pColumn,m_xPaintRow ), this );
}
@@ -2882,7 +2868,7 @@ CellController* DbGridControl::GetController(long /*nRow*/, sal_uInt16 nColumnId
return nullptr;
size_t Location = GetModelColumnPos(nColumnId);
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
if (!pColumn)
return nullptr;
@@ -3108,7 +3094,7 @@ bool DbGridControl::SaveModified()
return true;
size_t Location = GetModelColumnPos( GetCurColumnId() );
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
bool bOK = pColumn && pColumn->Commit();
DBG_ASSERT( Controller().is(), "DbGridControl::SaveModified: was modified, by have no controller?!" );
if ( !Controller().is() )
@@ -3296,7 +3282,7 @@ void DbGridControl::KeyInput( const KeyEvent& rEvt )
if (nRow >= 0 && nRow < GetRowCount() && nColId < ColCount())
{
size_t Location = GetModelColumnPos( nColId );
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
OStringTransfer::CopyString( GetCurrentRowCellText( pColumn, m_xCurrentRow ), this );
return;
}
@@ -3320,7 +3306,7 @@ void DbGridControl::HideColumn(sal_uInt16 nId)
// update my model
size_t Location = GetModelColumnPos( nId );
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
DBG_ASSERT(pColumn, "DbGridControl::HideColumn : somebody did hide a nonexistent column !");
if (pColumn)
{
@@ -3340,7 +3326,7 @@ void DbGridControl::ShowColumn(sal_uInt16 nId)
if (nPos == GRID_COLUMN_NOT_FOUND)
return;
- DbGridColumn* pColumn = m_aColumns[ nPos ];
+ DbGridColumn* pColumn = m_aColumns[ nPos ].get();
if (!pColumn->IsHidden())
{
DBG_ASSERT(GetViewColumnPos(nId) != GRID_COLUMN_NOT_FOUND, "DbGridControl::ShowColumn : inconsistent internal state !");
@@ -3355,7 +3341,7 @@ void DbGridControl::ShowColumn(sal_uInt16 nId)
// first search the cols to the right
for ( size_t i = nPos + 1; i < m_aColumns.size(); ++i )
{
- DbGridColumn* pCurCol = m_aColumns[ i ];
+ DbGridColumn* pCurCol = m_aColumns[ i ].get();
if (!pCurCol->IsHidden())
{
nNextNonHidden = i;
@@ -3367,7 +3353,7 @@ void DbGridControl::ShowColumn(sal_uInt16 nId)
// then to the left
for ( size_t i = nPos; i > 0; --i )
{
- DbGridColumn* pCurCol = m_aColumns[ i-1 ];
+ DbGridColumn* pCurCol = m_aColumns[ i-1 ].get();
if (!pCurCol->IsHidden())
{
nNextNonHidden = i-1;
@@ -3406,7 +3392,7 @@ sal_uInt16 DbGridControl::GetColumnIdFromModelPos( sal_uInt16 nPos ) const
return GRID_COLUMN_NOT_FOUND;
}
- DbGridColumn* pCol = m_aColumns[ nPos ];
+ DbGridColumn* pCol = m_aColumns[ nPos ].get();
#if (OSL_DEBUG_LEVEL > 0) || defined DBG_UTIL
// in the debug version, we convert the ModelPos into a ViewPos and compare this with the
// value we will return (nId at the corresponding Col in m_aColumns)
@@ -3526,7 +3512,7 @@ void DbGridControl::ConnectToFields()
m_pFieldListeners = pListeners;
}
- for (DbGridColumn* pCurrent : m_aColumns)
+ for (auto const & pCurrent : m_aColumns)
{
sal_uInt16 nViewPos = pCurrent ? GetViewColumnPos(pCurrent->GetId()) : GRID_COLUMN_NOT_FOUND;
if (GRID_COLUMN_NOT_FOUND == nViewPos)
@@ -3569,7 +3555,7 @@ void DbGridControl::FieldValueChanged(sal_uInt16 _nId)
return;
size_t Location = GetModelColumnPos( _nId );
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
if (pColumn)
{
std::unique_ptr<vcl::SolarMutexTryAndBuyGuard> pGuard;
@@ -3645,7 +3631,7 @@ Reference< XAccessible > DbGridControl::CreateAccessibleCell( sal_Int32 _nRow, s
{
sal_uInt16 nColumnId = GetColumnId( _nColumnPos );
size_t Location = GetModelColumnPos(nColumnId);
- DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ] : nullptr;
+ DbGridColumn* pColumn = ( Location < m_aColumns.size() ) ? m_aColumns[ Location ].get() : nullptr;
if ( pColumn )
{
Reference< css::awt::XControl> xInt(pColumn->GetCell());
More information about the Libreoffice-commits
mailing list