diff options
author | Noel Grandin <noel@peralex.com> | 2012-07-13 14:53:01 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-17 15:33:31 +0200 |
commit | 4991bd87045fd2e3861512d768eaed323db871dc (patch) | |
tree | 813fa618275ce0bf94f9c4f88239b61ccbf892fa /sw | |
parent | c516b333872adb08f45bc48fba2a2e97e22586e7 (diff) |
Convert SV_DECL_PTRARR_SORT_DEL(SwWriteTableCols) to o3tl::sorted_vector
Change-Id: Id410727331d6b9dc599814dce15dc3d02037bc7b
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/html/htmltabw.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/inc/wrtswtbl.hxx | 7 | ||||
-rw-r--r-- | sw/source/filter/writer/wrtswtbl.cxx | 33 |
3 files changed, 24 insertions, 26 deletions
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 16ad4f2c7324..241bd1966587 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -593,9 +593,9 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, nFrameMask &= ~1; if( !(aRows[aRows.Count()-1])->bBottomBorder ) nFrameMask &= ~2; - if( !(aCols[0])->bLeftBorder ) + if( !(aCols.front())->bLeftBorder ) nFrameMask &= ~4; - if( !(aCols[aCols.Count()-1])->bRightBorder ) + if( !(aCols.back())->bRightBorder ) nFrameMask &= ~8; // Wert fur RULES bestimmen @@ -626,7 +626,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, sal_Bool bColsHaveBorderOnly = sal_True; SwWriteTableCol *pCol = aCols[0]; sal_uInt16 nCol; - for( nCol=1; nCol<aCols.Count(); nCol++ ) + for( nCol=1; nCol<aCols.size(); nCol++ ) { SwWriteTableCol *pNextCol = aCols[nCol]; sal_Bool bBorder = ( pCol->bRightBorder || pNextCol->bLeftBorder ); @@ -660,7 +660,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, if( bColsOption ) { sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_cols). - append('=').append(static_cast<sal_Int32>(aCols.Count())); + append('=').append(static_cast<sal_Int32>(aCols.size())); } // ALIGN= ausgeben @@ -763,7 +763,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OOO_STRING_SVTOOLS_HTML_caption, sal_False ); } - sal_uInt16 nCols = aCols.Count(); + sal_uInt16 nCols = aCols.size(); // <COLGRP>/<COL> ausgeben: Bei Export ueber Layout nur wenn beim // Import welche da waren, sonst immer. diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx index 9bdd4e59fdf4..80198fb11676 100644 --- a/sw/source/filter/inc/wrtswtbl.hxx +++ b/sw/source/filter/inc/wrtswtbl.hxx @@ -32,6 +32,7 @@ #include <tools/color.hxx> #include <svl/svarray.hxx> #include <boost/ptr_container/ptr_vector.hpp> +#include <o3tl/sorted_vector.hxx> #include <swdllapi.h> @@ -230,8 +231,10 @@ inline int SwWriteTableCol::operator<( const SwWriteTableCol& rCol ) const } -typedef SwWriteTableCol *SwWriteTableColPtr; -SV_DECL_PTRARR_SORT_DEL( SwWriteTableCols, SwWriteTableColPtr, 5 ) +class SwWriteTableCols : public o3tl::sorted_vector<SwWriteTableCol*, o3tl::less_ptr_to<SwWriteTableCol> > { +public: + ~SwWriteTableCols() { DeleteAndDestroyAll(); } +}; //----------------------------------------------------------------------- diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index c82eb772ab78..699570ad2a84 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -42,7 +42,6 @@ using ::editeng::SvxBorderLine; using namespace ::com::sun::star; SV_IMPL_OP_PTRARR_SORT( SwWriteTableRows, SwWriteTableRowPtr ) -SV_IMPL_OP_PTRARR_SORT( SwWriteTableCols, SwWriteTableColPtr ) //----------------------------------------------------------------------- @@ -277,7 +276,7 @@ sal_uInt16 SwWriteTable::MergeBoxBorders( const SwTableBox *pBox, if( rBoxItem.GetRight() ) { nBorderMask |= 8; - MergeBorders( rBoxItem.GetRight(), nCol+nColSpan==aCols.Count() ); + MergeBorders( rBoxItem.GetRight(), nCol+nColSpan==aCols.size() ); } // If any distance is set, the smallest one is used. This holds for @@ -335,7 +334,7 @@ sal_uInt16 SwWriteTable::GetRightSpace( sal_uInt16 nCol, sal_uInt16 nColSpan ) c // In der letzten Spalte noch einmal zusaetzlich CELLSPACING und // und die Liniendicke abziehen - if( nCol+nColSpan==aCols.Count() ) + if( nCol+nColSpan==aCols.size() ) { nSpace += (nCellSpacing + nRightSub); @@ -493,11 +492,8 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, nCPos = nCPos + GetBoxWidth( pBox ); SwWriteTableCol *pCol = new SwWriteTableCol( nCPos ); - sal_uInt16 nCol; - if( aCols.Seek_Entry( pCol, &nCol ) ) + if( !aCols.insert( pCol ).second ) delete pCol; - else - aCols.Insert( pCol ); if( nBox==nBoxes-1 ) { @@ -522,9 +518,10 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, } #endif nCPos = nStartCPos + nParentLineWidth; + #if OSL_DEBUG_LEVEL > 0 - SwWriteTableCol aCol( nStartCPos + nParentLineWidth ); - OSL_ENSURE( aCols.Seek_Entry(&aCol), + SwWriteTableCol aSrchCol( nCPos ); + OSL_ENSURE( aCols.find( &aSrchCol ) != aCols.end(), "Parent-Zelle nicht gefunden" ); OSL_ENSURE( SwWriteTableCol(nCheckPos) == SwWriteTableCol(nCPos), @@ -629,10 +626,8 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, sal_Bool bOutAtRow = !nParentLineWidth; if( !bOutAtRow && nStartCPos==0 ) { - sal_uInt16 nEndCol; SwWriteTableCol aCol( nParentLineWidth ); - bOutAtRow = aCols.Seek_Entry(&aCol,&nEndCol) && - nEndCol == aCols.Count()-1; + bOutAtRow = aCols.find( &aCol ) == (aCols.end() - 1); } if( bOutAtRow ) { @@ -669,10 +664,10 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, // Und ihren Index sal_uInt16 nOldCol = nCol; - SwWriteTableCol aCol( nCPos ); - bool const bFound2 = aCols.Seek_Entry( &aCol, &nCol ); - OSL_ENSURE( bFound2, "missing column" ); - (void) bFound2; // unused in non-debug + SwWriteTableCol aSrchCol( nCPos ); + SwWriteTableCols::const_iterator it = aCols.find( &aSrchCol ); + OSL_ENSURE( it != aCols.end(), "missing column" ); + nCol = it - aCols.begin(); if( !ShouldExpandSub( pBox, bSubExpanded, nDepth ) ) { @@ -700,7 +695,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, // #i30094# add a sanity check here to ensure that // we don't access an invalid aCols[] as &nCol // above can be changed. - if (!(nBorderMask & 4) && nOldCol < aCols.Count()) + if (!(nBorderMask & 4) && nOldCol < aCols.size()) { SwWriteTableCol *pCol = aCols[nOldCol]; OSL_ENSURE(pCol, "No TableCol found, panic!"); @@ -766,7 +761,7 @@ SwWriteTable::SwWriteTable(const SwTableLines& rLines, long nWidth, // Erstmal die Tabellen-Struktur festlegen. Hinter der Tabelle ist in // jedem Fall eine Spalte zu Ende SwWriteTableCol *pCol = new SwWriteTableCol( nParentWidth ); - aCols.Insert( pCol ); + aCols.insert( pCol ); CollectTableRowsCols( 0, 0, 0, nParentWidth, rLines, nMaxDepth - 1 ); // Und jetzt mit leben fuellen @@ -814,7 +809,7 @@ SwWriteTable::SwWriteTable( const SwHTMLTableLayout *pLayoutInfo ) pLayoutCol->IsRelWidthOption() ); } - aCols.Insert( pCol ); + aCols.insert( pCol ); } for( nRow=0; nRow<nRows; nRow++ ) |