diff options
author | Noel Grandin <noel@peralex.com> | 2012-04-25 12:12:02 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-04-25 12:35:35 +0200 |
commit | 36394723ac332424d4b74b69ce8d125da4c915fa (patch) | |
tree | 9a1207caa5bfa28b2cad83e16b3bee22543bdb20 | |
parent | 2915069a67c81f2ee8607112379c65de66648ff0 (diff) |
Convert SV_DECL_PTRARR_DEL(SwColumns) to boost::ptr_vector
-rw-r--r-- | sw/inc/fmtclds.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/draw/dflyobj.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 70 | ||||
-rw-r--r-- | sw/source/core/layout/colfrm.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unosett.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/rtf/rtffly.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/rtf/swparrtf.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerwordglue.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/uiregionsw.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/colex.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/colmgr.cxx | 12 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/column.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/inc/colmgr.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/uiview/viewtab.cxx | 44 |
21 files changed, 100 insertions, 105 deletions
diff --git a/sw/inc/fmtclds.hxx b/sw/inc/fmtclds.hxx index 7e1cc64eb8e2..a7b08d3431eb 100644 --- a/sw/inc/fmtclds.hxx +++ b/sw/inc/fmtclds.hxx @@ -34,6 +34,7 @@ #include "swdllapi.h" #include <hintids.hxx> #include <format.hxx> +#include <boost/ptr_container/ptr_vector.hpp> // ColumnDescriptor class SwColumn @@ -49,7 +50,7 @@ class SwColumn public: SwColumn(); - sal_Bool operator==( const SwColumn & ); + sal_Bool operator==( const SwColumn & ) const; void SetWishWidth( sal_uInt16 nNew ) { nWish = nNew; } @@ -65,8 +66,7 @@ public: sal_uInt16 GetRight() const { return nRight; } }; -typedef SwColumn* SwColumnPtr; -SV_DECL_PTRARR_DEL( SwColumns, SwColumnPtr, 0 ) +typedef boost::ptr_vector<SwColumn> SwColumns; enum SwColLineAdj { @@ -119,7 +119,7 @@ public: const SwColumns &GetColumns() const { return aColumns; } SwColumns &GetColumns() { return aColumns; } - sal_uInt16 GetNumCols() const { return aColumns.Count(); } + sal_uInt16 GetNumCols() const { return aColumns.size(); } editeng::SvxBorderStyle GetLineStyle() const { return eLineStyle;} sal_uLong GetLineWidth() const { return nLineWidth;} diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 8e1e0a9f878d..624010d07cb8 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -836,12 +836,12 @@ void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const SwBorderAttrs &rAttrs = *aAccess.Get(); long nMin = rAttrs.CalcLeftLine()+rAttrs.CalcRightLine(); const SwFmtCol& rCol = rAttrs.GetAttrSet().GetCol(); - if ( rCol.GetColumns().Count() > 1 ) + if ( rCol.GetColumns().size() > 1 ) { - for ( sal_uInt16 i = 0; i < rCol.GetColumns().Count(); ++i ) + for ( sal_uInt16 i = 0; i < rCol.GetColumns().size(); ++i ) { - nMin += rCol.GetColumns()[i]->GetLeft() + - rCol.GetColumns()[i]->GetRight() + + nMin += rCol.GetColumns()[i].GetLeft() + + rCol.GetColumns()[i].GetRight() + MINFLY; } nMin -= MINFLY; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index e836f628bf0d..ce25435c7ba6 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -113,8 +113,6 @@ using namespace ::com::sun::star; using ::rtl::OUString; -SV_IMPL_PTRARR(SwColumns,SwColumn*) - TYPEINIT1(SwFmtVertOrient, SfxPoolItem); TYPEINIT1(SwFmtHoriOrient, SfxPoolItem); TYPEINIT2(SwFmtHeader, SfxPoolItem, SwClient ); @@ -796,7 +794,7 @@ SwColumn::SwColumn() : { } -sal_Bool SwColumn::operator==( const SwColumn &rCmp ) +sal_Bool SwColumn::operator==( const SwColumn &rCmp ) const { return (nWish == rCmp.GetWishWidth() && GetLeft() == rCmp.GetLeft() && @@ -818,8 +816,8 @@ SwFmtCol::SwFmtCol( const SwFmtCol& rCpy ) { for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i ) { - SwColumn *pCol = new SwColumn( *rCpy.GetColumns()[i] ); - aColumns.Insert( pCol, aColumns.Count() ); + SwColumn *pCol = new SwColumn( rCpy.GetColumns()[i] ); + aColumns.push_back( pCol ); } } @@ -835,12 +833,12 @@ SwFmtCol& SwFmtCol::operator=( const SwFmtCol& rCpy ) nWidth = rCpy.GetWishWidth(); bOrtho = rCpy.IsOrtho(); - if ( aColumns.Count() ) - aColumns.DeleteAndDestroy( 0, aColumns.Count() ); + if ( !aColumns.empty() ) + aColumns.clear(); for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i ) { - SwColumn *pCol = new SwColumn( *rCpy.GetColumns()[i] ); - aColumns.Insert( pCol, aColumns.Count() ); + SwColumn *pCol = new SwColumn( rCpy.GetColumns()[i] ); + aColumns.push_back( pCol ); } return *this; } @@ -867,11 +865,11 @@ int SwFmtCol::operator==( const SfxPoolItem& rAttr ) const eAdj == rCmp.GetLineAdj() && nWidth == rCmp.GetWishWidth() && bOrtho == rCmp.IsOrtho() && - aColumns.Count() == rCmp.GetNumCols()) ) + aColumns.size() == rCmp.GetNumCols()) ) return 0; - for ( sal_uInt16 i = 0; i < aColumns.Count(); ++i ) - if ( !(*aColumns[i] == *rCmp.GetColumns()[i]) ) + for ( sal_uInt16 i = 0; i < aColumns.size(); ++i ) + if ( !(aColumns[i] == rCmp.GetColumns()[i]) ) return 0; return 1; @@ -885,14 +883,14 @@ SfxPoolItem* SwFmtCol::Clone( SfxItemPool* ) const sal_uInt16 SwFmtCol::GetGutterWidth( sal_Bool bMin ) const { sal_uInt16 nRet = 0; - if ( aColumns.Count() == 2 ) - nRet = aColumns[0]->GetRight() + aColumns[1]->GetLeft(); - else if ( aColumns.Count() > 2 ) + if ( aColumns.size() == 2 ) + nRet = aColumns[0].GetRight() + aColumns[1].GetLeft(); + else if ( aColumns.size() > 2 ) { sal_Bool bSet = sal_False; - for ( sal_uInt16 i = 1; i < aColumns.Count()-1; ++i ) + for ( sal_uInt16 i = 1; i < aColumns.size()-1; ++i ) { - const sal_uInt16 nTmp = aColumns[i]->GetRight() + aColumns[i+1]->GetLeft(); + const sal_uInt16 nTmp = aColumns[i].GetRight() + aColumns[i+1].GetLeft(); if ( bSet ) { if ( nTmp != nRet ) @@ -919,13 +917,13 @@ void SwFmtCol::SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct ) else { sal_uInt16 nHalf = nNew / 2; - for ( sal_uInt16 i = 0; i < aColumns.Count(); ++i ) - { SwColumn *pCol = aColumns[i]; + for ( sal_uInt16 i = 0; i < aColumns.size(); ++i ) + { SwColumn *pCol = &aColumns[i]; pCol->SetLeft ( nHalf ); pCol->SetRight( nHalf ); if ( i == 0 ) pCol->SetLeft( 0 ); - else if ( i == (aColumns.Count() - 1) ) + else if ( i == (aColumns.size() - 1) ) pCol->SetRight( 0 ); } } @@ -935,11 +933,11 @@ void SwFmtCol::Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nA { // Deleting seems to be a bit radical on the first sight; but otherwise we // have to initialize all values of the remaining SwCloumns. - if ( aColumns.Count() ) - aColumns.DeleteAndDestroy( 0, aColumns.Count() ); + if ( !aColumns.empty() ) + aColumns.clear(); for ( sal_uInt16 i = 0; i < nNumCols; ++i ) { SwColumn *pCol = new SwColumn; - aColumns.Insert( pCol, i ); + aColumns.push_back( pCol ); } bOrtho = sal_True; nWidth = USHRT_MAX; @@ -950,29 +948,29 @@ void SwFmtCol::Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nA void SwFmtCol::SetOrtho( sal_Bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct ) { bOrtho = bNew; - if ( bNew && aColumns.Count() ) + if ( bNew && !aColumns.empty() ) Calc( nGutterWidth, nAct ); } sal_uInt16 SwFmtCol::CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const { - OSL_ENSURE( nCol < aColumns.Count(), ":-( ColumnsArr over indexed." ); + assert(nCol < aColumns.size()); if ( nWidth != nAct ) { - long nW = aColumns[nCol]->GetWishWidth(); + long nW = aColumns[nCol].GetWishWidth(); nW *= nAct; nW /= nWidth; return sal_uInt16(nW); } else - return aColumns[nCol]->GetWishWidth(); + return aColumns[nCol].GetWishWidth(); } sal_uInt16 SwFmtCol::CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const { - OSL_ENSURE( nCol < aColumns.Count(), ":-( ColumnsArr over indexed." ); + assert(nCol < aColumns.size()); sal_uInt16 nRet = CalcColWidth( nCol, nAct ); - SwColumn *pCol = aColumns[nCol]; + const SwColumn *pCol = &aColumns[nCol]; nRet = nRet - pCol->GetLeft(); nRet = nRet - pCol->GetRight(); return nRet; @@ -994,7 +992,7 @@ void SwFmtCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct ) //The fist column is PrtWidth + (gap width / 2) const sal_uInt16 nLeftWidth = nPrtWidth + nGutterHalf; - SwColumn *pCol = aColumns[0]; + SwColumn *pCol = &aColumns.front(); pCol->SetWishWidth( nLeftWidth ); pCol->SetRight( nGutterHalf ); pCol->SetLeft ( 0 ); @@ -1006,7 +1004,7 @@ void SwFmtCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct ) for ( i = 1; i < GetNumCols()-1; ++i ) { - pCol = aColumns[i]; + pCol = &aColumns[i]; pCol->SetWishWidth( nMidWidth ); pCol->SetLeft ( nGutterHalf ); pCol->SetRight( nGutterHalf ); @@ -1015,15 +1013,15 @@ void SwFmtCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct ) //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 = aColumns[aColumns.Count()-1]; + pCol = &aColumns.back(); pCol->SetWishWidth( nAvail ); pCol->SetLeft ( nGutterHalf ); pCol->SetRight( 0 ); //Convert the current width to the requested width. - for ( i = 0; i < aColumns.Count(); ++i ) + for ( i = 0; i < aColumns.size(); ++i ) { - pCol = aColumns[i]; + pCol = &aColumns[i]; long nTmp = pCol->GetWishWidth(); nTmp *= GetWishWidth(); nTmp /= nAct; @@ -1064,7 +1062,7 @@ bool SwFmtCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { uno::Sequence<text::TextColumn> aSetColumns = xCols->getColumns(); const text::TextColumn* pArray = aSetColumns.getConstArray(); - aColumns.DeleteAndDestroy(0, aColumns.Count()); + aColumns.clear(); //max count is 64k here - this is something the array can't do sal_uInt16 nCount = Min( (sal_uInt16)aSetColumns.getLength(), (sal_uInt16) 0x3fff ); @@ -1079,7 +1077,7 @@ bool SwFmtCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) nWidthSum = static_cast<sal_uInt16>(nWidthSum + pArray[i].Width); pCol->SetLeft ( static_cast<sal_uInt16>(MM100_TO_TWIP(pArray[i].LeftMargin)) ); pCol->SetRight( static_cast<sal_uInt16>(MM100_TO_TWIP(pArray[i].RightMargin)) ); - aColumns.Insert(pCol, i); + aColumns.insert(aColumns.begin() + i, pCol); } bRet = true; nWidth = nWidthSum; diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index 31fb081cb3a1..5f08cda28beb 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -283,9 +283,9 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, bAdjustAttributes = sal_True; else { - sal_uInt16 nCount = Min( rNew.GetColumns().Count(), rOld.GetColumns().Count() ); + sal_uInt16 nCount = Min( rNew.GetColumns().size(), rOld.GetColumns().size() ); for ( sal_uInt16 i = 0; i < nCount; ++i ) - if ( !(*rOld.GetColumns()[i] == *rNew.GetColumns()[i]) ) + if ( !(rOld.GetColumns()[i] == rNew.GetColumns()[i]) ) { bAdjustAttributes = sal_True; break; @@ -384,7 +384,7 @@ void SwLayoutFrm::AdjustColumns( const SwFmtCol *pAttr, sal_Bool bAdjustAttribut if ( bOrtho || bAdjustAttributes ) { - const SwColumn *pC = pAttr->GetColumns()[i]; + const SwColumn *pC = &pAttr->GetColumns()[i]; const SwAttrSet* pSet = pCol->GetAttrSet(); SvxLRSpaceItem aLR( pSet->GetLRSpace() ); diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 2de82b2d3af8..a6eba68accb0 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -2380,7 +2380,7 @@ SwXTextColumns::SwXTextColumns(const SwFmtCol& rFmtCol) : const SwColumns& rCols = rFmtCol.GetColumns(); for(sal_uInt16 i = 0; i < aTextColumns.getLength(); i++) { - SwColumn* pCol = rCols[i]; + const SwColumn* pCol = &rCols[i]; pColumns[i].Width = pCol->GetWishWidth(); nReference += pColumns[i].Width; diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx index 026fc4a496ad..826cb7e50726 100644 --- a/sw/source/filter/rtf/rtffly.cxx +++ b/sw/source/filter/rtf/rtffly.cxx @@ -963,7 +963,7 @@ void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet ) { for( sal_uInt16 n = 0, i = 0; n < aColumns.size(); n += 2, ++i ) { - SwColumn* pCol = aCol.GetColumns()[ i ]; + SwColumn* pCol = &aCol.GetColumns()[ i ]; sal_uLong nTmp = aColumns[ n ]; nTmp *= USHRT_MAX; nTmp /= nWidth; diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 30263be0de56..ccc8124e8e3b 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -601,7 +601,7 @@ bool rtfSections::SetCols(SwFrmFmt &rFmt, const rtfSection &rSection, sal_uInt16 nWishWidth = 0, nHalfPrev = 0; for(sal_uInt16 n=0, i=0; n < rSection.maPageInfo.maColumns.size() && i < nCols; n += 2, ++i ) { - SwColumn* pCol = aCol.GetColumns()[ i ]; + SwColumn* pCol = &aCol.GetColumns()[ i ]; pCol->SetLeft( nHalfPrev ); sal_uInt16 nSp = static_cast< sal_uInt16 >(rSection.maPageInfo.maColumns[ n+1 ]); nHalfPrev = nSp / 2; @@ -2757,7 +2757,7 @@ sal_Bool lcl_SetFmtCol( SwFmt& rFmt, sal_uInt16 nCols, sal_uInt16 nColSpace, sal_uInt16 nWishWidth = 0, nHalfPrev = 0; for( sal_uInt16 n = 0, i = 0; n < rColumns.size(); n += 2, ++i ) { - SwColumn* pCol = aCol.GetColumns()[ i ]; + SwColumn* pCol = &aCol.GetColumns()[ i ]; pCol->SetLeft( nHalfPrev ); sal_uInt16 nSp = rColumns[ n+1 ]; nHalfPrev = nSp / 2; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ed18354af7d2..572e85185e8a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -4243,7 +4243,7 @@ void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol& if ( n + 1 != nCols ) { - sal_uInt16 nSpacing = rColumns[n]->GetRight( ) + rColumns[n + 1]->GetLeft( ); + sal_uInt16 nSpacing = rColumns[n].GetRight( ) + rColumns[n + 1].GetLeft( ); pColAttrList->add( FSNS( XML_w, XML_space ), OString::valueOf( sal_Int32( nSpacing ) ).getStr( ) ); } diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 09705d907625..528e9401b6d3 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2919,8 +2919,8 @@ void RtfAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol& r if( ++n != nCols ) { m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_COLSR; - m_rExport.OutLong( rColumns[ n-1 ]->GetRight() + - rColumns[ n ]->GetLeft() ); + m_rExport.OutLong( rColumns[ n-1 ].GetRight() + + rColumns[ n ].GetLeft() ); } } } diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index de8247666915..eece703b0240 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -360,7 +360,7 @@ namespace sw const SvxLRSpaceItem &rOneLR = rTitleFmt.GetLRSpace(); const SvxLRSpaceItem &rTwoLR= rFollowFmt.GetLRSpace(); - if (rFirstColumns.Count() != rFollowColumns.Count()) + if (rFirstColumns.size() != rFollowColumns.size()) { //e.g. #i4320# bPlausableTitlePage = false; diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 02beffdc226e..700066bb5473 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1027,7 +1027,7 @@ sal_uInt16 MSWordSections::NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo const SwFmtCol& rCol = (const SwFmtCol&)aSet.Get( RES_COL ); const SwColumns& rColumns = rCol.GetColumns(); - return rColumns.Count(); + return rColumns.size(); } const WW8_SepInfo* MSWordSections::CurrentSectionInfo() diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 16a5539c9358..52cc2bc74d43 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -4379,8 +4379,8 @@ void WW8AttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol & else m_rWW8Export.pO->push_back( 137 ); m_rWW8Export.pO->push_back( static_cast<sal_uInt8>(n) ); - m_rWW8Export.InsUInt16( rColumns[n]->GetRight( ) + - rColumns[n + 1]->GetLeft( ) ); + m_rWW8Export.InsUInt16( rColumns[n].GetRight( ) + + rColumns[n + 1].GetLeft( ) ); } } } @@ -4390,7 +4390,7 @@ void AttributeOutputBase::FormatColumns( const SwFmtCol& rCol ) { const SwColumns& rColumns = rCol.GetColumns(); - sal_uInt16 nCols = rColumns.Count(); + sal_uInt16 nCols = rColumns.size(); if ( 1 < nCols && !GetExport( ).bOutFlyFrmAttrs ) { // dann besorge mal die Seitenbreite ohne Raender !! diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 33baeb711629..8a719998bc62 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -365,7 +365,7 @@ bool wwSectionManager::SetCols(SwFrmFmt &rFmt, const wwSection &rSection, const sal_uInt16 maxIdx = SAL_N_ELEMENTS(rSep.rgdxaColumnWidthSpacing); for (sal_uInt16 i = 0, nIdx = 1; i < nCols && nIdx < maxIdx; i++, nIdx+=2 ) { - SwColumn* pCol = aCol.GetColumns()[i]; + SwColumn* pCol = &aCol.GetColumns()[i]; const sal_Int32 nLeft = rSep.rgdxaColumnWidthSpacing[nIdx-1]/2; const sal_Int32 nRight = rSep.rgdxaColumnWidthSpacing[nIdx+1]/2; const sal_Int32 nWishWidth = rSep.rgdxaColumnWidthSpacing[nIdx] diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 49104bf098ce..f1ee6d8984a3 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -721,7 +721,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, TblFmtHdl, PushButton*, pButton ) nEnd1 = nWidth; for( sal_uInt16 i = 0; i < nNum; ++i ) { - SwColumn* pCol = rCols[i]; + const SwColumn* pCol = &rCols[i]; nStart1 = pCol->GetLeft() + nWidth1; nWidth1 += (long)rCol.CalcColWidth( i, (sal_uInt16)nWidth ); nEnd1 = nWidth1 - pCol->GetRight(); diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index bc18bc8e32f7..caa4958388f7 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -1584,7 +1584,7 @@ short SwInsertSectionTabDialog::Ok() if(SFX_ITEM_SET == pOutputItemSet->GetItemState(RES_COL, sal_False, &pCol)) { aRequest.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS, - ((const SwFmtCol*)pCol)->GetColumns().Count())); + ((const SwFmtCol*)pCol)->GetColumns().size())); } aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_NAME, m_pSectionData->GetSectionName())); diff --git a/sw/source/ui/frmdlg/colex.cxx b/sw/source/ui/frmdlg/colex.cxx index a81e606c7fd1..17575d6d6f2a 100644 --- a/sw/source/ui/frmdlg/colex.cxx +++ b/sw/source/ui/frmdlg/colex.cxx @@ -385,7 +385,7 @@ void SwColumnOnlyExample::Paint( const Rectangle& /*rRect*/ ) } const SwColumns& rCols = m_aCols.GetColumns(); - sal_uInt16 nColCount = rCols.Count(); + sal_uInt16 nColCount = rCols.size(); if( nColCount ) { DrawRect(aRect); @@ -394,7 +394,7 @@ void SwColumnOnlyExample::Paint( const Rectangle& /*rRect*/ ) long nSum = aTL.X(); for(sal_uInt16 i = 0; i < nColCount; i++) { - SwColumn* pCol = rCols[i]; + const SwColumn* pCol = &rCols[i]; aFrmRect.Left() = nSum + pCol->GetLeft();//nSum + pCol->GetLeft() + aTL.X(); nSum += pCol->GetWishWidth(); aFrmRect.Right() = nSum - pCol->GetRight(); @@ -405,7 +405,7 @@ void SwColumnOnlyExample::Paint( const Rectangle& /*rRect*/ ) nSum = aTL.X(); for(sal_uInt16 i = 0; i < nColCount - 1; i++) { - nSum += rCols[i]->GetWishWidth(); + nSum += rCols[i].GetWishWidth(); aUp.X() = nSum; aDown.X() = nSum; DrawLine(aUp, aDown); @@ -420,11 +420,11 @@ void SwColumnOnlyExample::SetColumns(const SwFmtCol& rCol) sal_uInt16 nWishSum = m_aCols.GetWishWidth(); long nFrmWidth = m_aFrmSize.Width(); SwColumns& rCols = m_aCols.GetColumns(); - sal_uInt16 nColCount = rCols.Count(); + sal_uInt16 nColCount = rCols.size(); for(sal_uInt16 i = 0; i < nColCount; i++) { - SwColumn* pCol = rCols[i]; + SwColumn* pCol = &rCols[i]; long nWish = pCol->GetWishWidth(); nWish *= nFrmWidth; nWish /= nWishSum; @@ -445,14 +445,14 @@ void SwColumnOnlyExample::SetColumns(const SwFmtCol& rCol) sal_uInt16 i; for(i = 0; i < nColCount; ++i) { - SwColumn* pCol = rCols[i]; + SwColumn* pCol = &rCols[i]; nColumnWidthSum += pCol->GetWishWidth(); nColumnWidthSum -= (pCol->GetRight() + pCol->GetLeft()); } nColumnWidthSum /= nColCount; for(i = 0; i < nColCount; ++i) { - SwColumn* pCol = rCols[i]; + SwColumn* pCol = &rCols[i]; pCol->SetWishWidth( static_cast< sal_uInt16 >(nColumnWidthSum + pCol->GetRight() + pCol->GetLeft())); } } diff --git a/sw/source/ui/frmdlg/colmgr.cxx b/sw/source/ui/frmdlg/colmgr.cxx index 6a419d984aa6..49ec5b6e0a23 100644 --- a/sw/source/ui/frmdlg/colmgr.cxx +++ b/sw/source/ui/frmdlg/colmgr.cxx @@ -43,11 +43,11 @@ ------------------------------------------------------------------------*/ void FitToActualSize(SwFmtCol& rCol, sal_uInt16 nWidth) { - const sal_uInt16 nCount = rCol.GetColumns().Count(); + const sal_uInt16 nCount = rCol.GetColumns().size(); for(sal_uInt16 i = 0; i < nCount; ++i) { const sal_uInt16 nTmp = rCol.CalcColWidth(i, nWidth); - rCol.GetColumns()[i]->SetWishWidth(nTmp); + rCol.GetColumns()[i].SetWishWidth(nTmp); } rCol.SetWishWidth(nWidth); } @@ -72,7 +72,7 @@ sal_uInt16 SwColMgr::GetGutterWidth( sal_uInt16 nPos ) const { OSL_ENSURE(nPos < GetCount() - 1, "Spalte ueberindiziert" ); const SwColumns& rCols = aFmtCol.GetColumns(); - nRet = rCols.GetObject(nPos)->GetRight() + rCols.GetObject(nPos + 1)->GetLeft(); + nRet = rCols[nPos].GetRight() + rCols[nPos + 1].GetLeft(); } return nRet; } @@ -86,8 +86,8 @@ void SwColMgr::SetGutterWidth(sal_uInt16 nGutterWidth, sal_uInt16 nPos ) OSL_ENSURE(nPos < GetCount() - 1, "Spalte ueberindiziert" ); SwColumns& rCols = aFmtCol.GetColumns(); sal_uInt16 nGutterWidth2 = nGutterWidth / 2; - rCols.GetObject(nPos)->SetRight(nGutterWidth2); - rCols.GetObject(nPos + 1)->SetLeft(nGutterWidth2); + rCols[nPos].SetRight(nGutterWidth2); + rCols[nPos + 1].SetLeft(nGutterWidth2); } } @@ -117,7 +117,7 @@ sal_uInt16 SwColMgr::GetColWidth(sal_uInt16 nIdx) const void SwColMgr::SetColWidth(sal_uInt16 nIdx, sal_uInt16 nWd) { OSL_ENSURE(nIdx < GetCount(), "Spaltenarray ueberindiziert."); - aFmtCol.GetColumns()[nIdx]->SetWishWidth(nWd); + aFmtCol.GetColumns()[nIdx].SetWishWidth(nWd); } diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index e9059f758620..3d3431f2e599 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -76,9 +76,6 @@ #define FRAME_FORMAT_WIDTH 1000 -// sw/inc/fmtclds.hxx -SV_IMPL_PTRARR( SwColumns, SwColumnPtr ) - /*-------------------------------------------------------------------- Description: static data --------------------------------------------------------------------*/ diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index c2d920daa7f2..19110e02fe5e 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1750,12 +1750,12 @@ IMPL_LINK_NOARG(SwFrmPage, RangeModifyHdl) SFX_ITEM_DEFAULT <= GetTabDialog()->GetExampleSet()->GetItemState(RES_COL)) { const SwFmtCol& rCol = (const SwFmtCol&)GetTabDialog()->GetExampleSet()->Get(RES_COL); - if ( rCol.GetColumns().Count() > 1 ) + if ( rCol.GetColumns().size() > 1 ) { - for ( sal_uInt16 i = 0; i < rCol.GetColumns().Count(); ++i ) + for ( sal_uInt16 i = 0; i < rCol.GetColumns().size(); ++i ) { - aVal.nMinWidth += rCol.GetColumns()[i]->GetLeft() + - rCol.GetColumns()[i]->GetRight() + + aVal.nMinWidth += rCol.GetColumns()[i].GetLeft() + + rCol.GetColumns()[i].GetRight() + MINFLY; } aVal.nMinWidth -= MINFLY;//one was already in there! diff --git a/sw/source/ui/inc/colmgr.hxx b/sw/source/ui/inc/colmgr.hxx index da8eae13d554..b53082a86db7 100644 --- a/sw/source/ui/inc/colmgr.hxx +++ b/sw/source/ui/inc/colmgr.hxx @@ -121,7 +121,7 @@ inline void SwColMgr::SetAutoWidth(sal_Bool bOn, sal_uInt16 nGutterWidth) inline void SwColMgr::NoCols() { - aFmtCol.GetColumns().DeleteAndDestroy(0, aFmtCol.GetColumns().Count()); + aFmtCol.GetColumns().clear(); } inline sal_Bool SwColMgr::HasLine() const { diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx index 49a54b22346b..f94c1231294f 100644 --- a/sw/source/ui/uiview/viewtab.cxx +++ b/sw/source/ui/uiview/viewtab.cxx @@ -84,24 +84,24 @@ void lcl_FillSvxColumn(const SwFmtCol& rCol, const SwColumns& rCols = rCol.GetColumns(); sal_uInt16 nWidth = 0; - sal_Bool bOrtho = rCol.IsOrtho() && rCols.Count(); + sal_Bool bOrtho = rCol.IsOrtho() && rCols.size(); long nInnerWidth = 0; if( bOrtho ) { nInnerWidth = nTotalWidth; - for ( sal_uInt16 i = 0; i < rCols.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rCols.size(); ++i ) { - SwColumn* pCol = rCols[i]; + const SwColumn* pCol = &rCols[i]; nInnerWidth -= pCol->GetLeft() + pCol->GetRight(); } if( nInnerWidth < 0 ) nInnerWidth = 0; else - nInnerWidth /= rCols.Count(); + nInnerWidth /= rCols.size(); } - for ( sal_uInt16 i = 0; i < rCols.Count(); ++i ) + for ( sal_uInt16 i = 0; i < rCols.size(); ++i ) { - SwColumn* pCol = rCols[i]; + const SwColumn* pCol = &rCols[i]; const sal_uInt16 nStart = sal_uInt16(pCol->GetLeft() + nWidth + nDistance); if( bOrtho ) nWidth = static_cast< sal_uInt16 >(nWidth + nInnerWidth + pCol->GetLeft() + pCol->GetRight()); @@ -146,7 +146,7 @@ void lcl_ConvertToCols(const SvxColumnItem& rColItem, sal_uInt16 nWidth = static_cast< sal_uInt16 >(rColItem[i].nEnd - rColItem[i].nStart); nWidth += nLeft + nRight; - SwColumn* pCol = rArr[i]; + SwColumn* pCol = &rArr[i]; pCol->SetWishWidth( sal_uInt16(long(rCols.GetWishWidth()) * long(nWidth) / long(nTotalWidth) )); pCol->SetLeft( nLeft ); @@ -155,11 +155,11 @@ void lcl_ConvertToCols(const SvxColumnItem& rColItem, nLeft = nRight; } - rArr[rColItem.Count()-1]->SetLeft( nLeft ); + rArr[rColItem.Count()-1].SetLeft( nLeft ); //Die Differenz aus der Gesamtwunschbreite und der Summe der bisher berechneten // Spalten und Raender sollte die Breite der letzten Spalte ergeben. - rArr[rColItem.Count()-1]->SetWishWidth( rCols.GetWishWidth() - (sal_uInt16)nSumAll ); + rArr[rColItem.Count()-1].SetWishWidth( rCols.GetWishWidth() - (sal_uInt16)nSumAll ); rCols.SetOrtho(sal_False, 0, 0 ); } @@ -222,9 +222,9 @@ void ResizeFrameCols(SwFmtCol& rCol, { // wenn die Wunschbreite zu gross wird, dann muessen alle Werte passend skaliert werden long nScale = (0xffffl << 8)/ nNewWishWidth; - for(sal_uInt16 i = 0; i < rArr.Count(); i++) + for(sal_uInt16 i = 0; i < rArr.size(); i++) { - SwColumn* pCol = rArr.GetObject(i); + SwColumn* pCol = &rArr[i]; long nVal = pCol->GetWishWidth(); lcl_Scale(nVal, nScale); pCol->SetWishWidth((sal_uInt16) nVal); @@ -241,9 +241,9 @@ void ResizeFrameCols(SwFmtCol& rCol, rCol.SetWishWidth( (sal_uInt16) (nNewWishWidth) ); if( nLeftDelta >= 2 || nLeftDelta <= -2) - rArr[0]->SetWishWidth(rArr[0]->GetWishWidth() + (sal_uInt16)nWishDiff); + rArr.front().SetWishWidth(rArr.front().GetWishWidth() + (sal_uInt16)nWishDiff); else - rArr[rArr.Count()-1]->SetWishWidth(rArr[rArr.Count()-1]->GetWishWidth() + (sal_uInt16)nWishDiff); + rArr.back().SetWishWidth(rArr.back().GetWishWidth() + (sal_uInt16)nWishDiff); //reset auto width rCol.SetOrtho(sal_False, 0, 0 ); } @@ -1348,7 +1348,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) SwSectionFmt *pFmt = pSect->GetFmt(); const SwFmtCol& rCol = pFmt->GetCol(); if(rSh.IsInRightToLeftText()) - nNum = rCol.GetColumns().Count() - nNum; + nNum = rCol.GetColumns().size() - nNum; else --nNum; SvxColumnItem aColItem(nNum); @@ -1387,7 +1387,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) const SwFmtCol& rCol = pFmt->GetCol(); if(rSh.IsInRightToLeftText()) - nNum = rCol.GetColumns().Count() - nNum; + nNum = rCol.GetColumns().size() - nNum; else nNum--; SvxColumnItem aColItem(nNum); @@ -1425,7 +1425,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) const SwFrmFmt& rMaster = rDesc.GetMaster(); SwFmtCol aCol(rMaster.GetCol()); if(rFrameDir.GetValue() == FRMDIR_HORI_RIGHT_TOP) - nNum = aCol.GetColumns().Count() - nNum; + nNum = aCol.GetColumns().size() - nNum; else nNum--; @@ -1589,7 +1589,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) &rDesc.GetMaster().GetCol(); const SwColumns& rCols = pCols->GetColumns(); sal_uInt16 nNum = rSh.GetCurOutColNum(); - sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), rCols.Count()); + sal_uInt16 nCount = Min(sal_uInt16(nNum + 1), sal_uInt16(rCols.size())); const SwRect aRect( rSh.GetAnyCurRect( pFmt ? RECT_FLY_PRT_EMBEDDED : RECT_PAGE_PRT, pPt )); @@ -1607,7 +1607,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) aRectangle.Left() = 0; for ( sal_uInt16 i = 0; i < nCount; ++i ) { - SwColumn* pCol = rCols[i]; + const SwColumn* pCol = &rCols[i]; nStart = pCol->GetLeft() + nWidth; if(i == nNum - 2) aRectangle.Left() = nStart; @@ -1633,7 +1633,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) aRectangle.Right() -= (nOuterWidth - nTotalWidth) / 2; } - if(nNum < rCols.Count()) + if(nNum < rCols.size()) { aRectangle.Right() += MINLAY; } @@ -1727,15 +1727,15 @@ void SwView::StateTabWin(SfxItemSet& rSet) nStart = 0, nEnd = nTotalWidth; - if( nNum > rCols.Count() ) + if( nNum > rCols.size() ) { OSL_ENSURE( !this, "wrong FmtCol is being edited!" ); - nNum = rCols.Count(); + nNum = rCols.size(); } for( sal_uInt16 i = 0; i < nNum; ++i ) { - SwColumn* pCol = rCols[i]; + const SwColumn* pCol = &rCols[i]; nStart = pCol->GetLeft() + nWidth; nWidth += pCols->CalcColWidth( i, nTotalWidth ); nEnd = nWidth - pCol->GetRight(); |