fix non-const accesses in previous commit:

Probably using const_cast is "good enough" here for the exising use
cases of modifying elements in a sorted_vector; not exposing non-const
accessors in sorted_vector should deter adding these in the future.

Change-Id: I613d7d40041b01109fd1d54f51c105acf56ae34a
This commit is contained in:
Michael Stahl 2012-07-26 14:21:59 +02:00
parent ef3990b07b
commit 8d832481e1
4 changed files with 6 additions and 7 deletions

View file

@ -150,8 +150,6 @@ public:
const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
{ return maTabStops[nPos]; }
SvxTabStop& operator[]( const sal_uInt16 nPos )
{ return maTabStops[nPos]; }
// "pure virtual Methods" from SfxPoolItem
virtual int operator==( const SfxPoolItem& ) const;

View file

@ -967,8 +967,7 @@ sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const
SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI )
{
maTabStops.clear();
maTabStops.insert( rTSI.maTabStops );
maTabStops = rTSI.maTabStops;
return *this;
}

View file

@ -472,14 +472,14 @@ void ScHTMLLayoutParser::ModifyOffset( ScHTMLColOffset* pOffset, sal_uInt16& nOl
{
do
{
(*pOffset)[nPos] += nDiff;
const_cast<sal_uLong&>((*pOffset)[nPos]) += nDiff;
} while ( nPos-- );
}
else
{
do
{
(*pOffset)[nPos] += nDiff;
const_cast<sal_uLong&>((*pOffset)[nPos]) += nDiff;
} while ( ++nPos < (sal_uInt16)pOffset->size() );
}
}

View file

@ -3797,7 +3797,9 @@ void SwRTFParser::SetSwgValues( SfxItemSet& rSet )
// Tabs anpassen !!
for( sal_uInt16 n = 0; n < aTStop.Count(); ++n)
if( SVX_TAB_ADJUST_DEFAULT != aTStop[n].GetAdjustment() )
aTStop[n].GetTabPos() -= nOffset;
{
const_cast<SvxTabStop&>(aTStop[n]).GetTabPos() -= nOffset;
}
// negativer Einzug, dann auf 0 Pos einen Tab setzen
if( rLR.GetTxtFirstLineOfst() < 0 )