diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-02-24 14:09:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-02-24 15:48:51 +0000 |
commit | 3a74745367a73ed9351379fc32bbe9253cdae697 (patch) | |
tree | 0fec3ca84576a0f51e4f48cdda82b67e7282c3ab /sw | |
parent | c9126dfbabcde1bf8b157942a5f5134ad547b957 (diff) |
vector::data seems more natural than &vector::front
Change-Id: I0ce48075ad186cf1f9bd3e13fa76269fa9819af1
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 49 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 6 |
2 files changed, 27 insertions, 28 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 1b420b73d0ba..7b16eaaee4ff 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -918,15 +918,15 @@ void SwFormatCol::SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct ) else { sal_uInt16 nHalf = nNew / 2; - for ( size_t i = 0; i < m_aColumns.size(); ++i ) + for (size_t i = 0; i < m_aColumns.size(); ++i) { - SwColumn *pCol = &m_aColumns[i]; - pCol->SetLeft ( nHalf ); - pCol->SetRight( nHalf ); + SwColumn &rCol = m_aColumns[i]; + rCol.SetLeft(nHalf); + rCol.SetRight(nHalf); if ( i == 0 ) - pCol->SetLeft( 0 ); + rCol.SetLeft(0); else if ( i+1 == m_aColumns.size() ) - pCol->SetRight( 0 ); + rCol.SetRight(0); } } } @@ -992,42 +992,41 @@ void SwFormatCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct ) (nAct - ((GetNumCols()-1) * nGutterWidth)) / GetNumCols(); sal_uInt16 nAvail = nAct; - //The fist column is PrtWidth + (gap width / 2) + //The first column is PrtWidth + (gap width / 2) const sal_uInt16 nLeftWidth = nPrtWidth + nGutterHalf; - SwColumn *pCol = &m_aColumns.front(); - pCol->SetWishWidth( nLeftWidth ); - pCol->SetRight( nGutterHalf ); - pCol->SetLeft ( 0 ); + SwColumn &rFirstCol = m_aColumns.front(); + rFirstCol.SetWishWidth(nLeftWidth); + rFirstCol.SetRight(nGutterHalf); + rFirstCol.SetLeft(0); nAvail = nAvail - nLeftWidth; //Column 2 to n-1 is PrtWidth + gap width const sal_uInt16 nMidWidth = nPrtWidth + nGutterWidth; - sal_uInt16 i; - for ( i = 1; i < GetNumCols()-1; ++i ) + for (sal_uInt16 i = 1; i < GetNumCols()-1; ++i) { - pCol = &m_aColumns[i]; - pCol->SetWishWidth( nMidWidth ); - pCol->SetLeft ( nGutterHalf ); - pCol->SetRight( nGutterHalf ); + SwColumn &rCol = m_aColumns[i]; + rCol.SetWishWidth(nMidWidth); + rCol.SetLeft(nGutterHalf); + rCol.SetRight(nGutterHalf); nAvail = nAvail - nMidWidth; } //The last column is equivalent to the first one - to compensate rounding //errors we add the remaining space of the other columns to the last one. - pCol = &m_aColumns.back(); - pCol->SetWishWidth( nAvail ); - pCol->SetLeft ( nGutterHalf ); - pCol->SetRight( 0 ); + SwColumn &rLastCol = m_aColumns.back(); + rLastCol.SetWishWidth(nAvail); + rLastCol.SetLeft(nGutterHalf); + rLastCol.SetRight(0); //Convert the current width to the requested width. - for ( i = 0; i < m_aColumns.size(); ++i ) + for (sal_uInt16 i = 0; i < m_aColumns.size(); ++i) { - pCol = &m_aColumns[i]; - long nTmp = pCol->GetWishWidth(); + SwColumn &rCol = m_aColumns[i]; + long nTmp = rCol.GetWishWidth(); nTmp *= GetWishWidth(); nTmp /= nAct; - pCol->SetWishWidth( sal_uInt16(nTmp) ); + rCol.SetWishWidth(sal_uInt16(nTmp)); } } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 2dea97d55e24..374f58d89e11 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -387,9 +387,9 @@ void WW8AttributeOutput::EndStyle() impl_SkipOdd( m_rWW8Export.pO, m_rWW8Export.pTableStrm->Tell() ); short nLen = m_rWW8Export.pO->size() - 2; // length of the style - sal_uInt8* p = &m_rWW8Export.pO->front() + nPOPosStdLen1; + sal_uInt8* p = m_rWW8Export.pO->data() + nPOPosStdLen1; ShortToSVBT16( nLen, p ); // nachtragen - p = &m_rWW8Export.pO->front() + nPOPosStdLen2; + p = m_rWW8Export.pO->data() + nPOPosStdLen2; ShortToSVBT16( nLen, p ); // dito m_rWW8Export.pTableStrm->WriteBytes(m_rWW8Export.pO->data(), m_rWW8Export.pO->size()); @@ -538,7 +538,7 @@ void MSWordStyles::WriteProperties( const SwFormat* pFormat, bool bParProp, sal_ void WW8AttributeOutput::EndStyleProperties( bool /*bParProp*/ ) { sal_uInt16 nLen = m_rWW8Export.pO->size() - m_nStyleStartSize; - sal_uInt8* pUpxLen = &m_rWW8Export.pO->front() + m_nStyleLenPos; // Laenge zum Nachtragen + sal_uInt8* pUpxLen = m_rWW8Export.pO->data() + m_nStyleLenPos; // Laenge zum Nachtragen ShortToSVBT16( nLen, pUpxLen ); // add default length } |