openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1498846 - /openoffice/trunk/main/sc/source/filter/html/htmlpars.cxx
Date Tue, 02 Jul 2013 09:00:25 GMT
Author: orw
Date: Tue Jul  2 09:00:25 2013
New Revision: 1498846

URL: http://svn.apache.org/r1498846
Log:
122591: correct the iteration on an HTML table

Modified:
    openoffice/trunk/main/sc/source/filter/html/htmlpars.cxx

Modified: openoffice/trunk/main/sc/source/filter/html/htmlpars.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/filter/html/htmlpars.cxx?rev=1498846&r1=1498845&r2=1498846&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/filter/html/htmlpars.cxx (original)
+++ openoffice/trunk/main/sc/source/filter/html/htmlpars.cxx Tue Jul  2 09:00:25 2013
@@ -1897,40 +1897,6 @@ ScHTMLTable* ScHTMLTableMap::CreateTable
     return pTable;
 }
 
-// ----------------------------------------------------------------------------
-
-/** Simplified forward iterator for convenience.
-
-    Before the iterator can be dereferenced, it must be tested with the is()
-    method. The iterator may be invalid directly after construction (e.g. empty
-    container).
- */
-class ScHTMLTableIterator
-{
-public:
-    /** Constructs the iterator for the passed table map.
-        @param pTableMap  Pointer to the table map (is allowed to be NULL). */
-    explicit            ScHTMLTableIterator( const ScHTMLTableMap* pTableMap );
-
-    inline bool         is() const { return maIter != maEnd; }
-    inline ScHTMLTable* operator->() { return maIter->second.get(); }
-    inline ScHTMLTable& operator*() { return *maIter->second; }
-    inline ScHTMLTableIterator& operator++() { ++maIter; return *this; }
-
-private:
-    ScHTMLTableMap::const_iterator maIter;
-    ScHTMLTableMap::const_iterator maEnd;
-};
-
-ScHTMLTableIterator::ScHTMLTableIterator( const ScHTMLTableMap* pTableMap )
-{
-    if( pTableMap )
-    {
-        maIter = pTableMap->begin();
-        maEnd = pTableMap->end();
-    }
-}
-
 // ============================================================================
 
 ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ) :
@@ -2299,8 +2265,15 @@ void ScHTMLTable::ApplyCellBorders( ScDo
         }
     }
 
-    for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
-        aIter->ApplyCellBorders( pDoc, rFirstPos );
+    if ( mxNestedTables.get() )
+    {
+        for ( ScHTMLTableMap::const_iterator aIter( mxNestedTables->begin() );
+             aIter != mxNestedTables->end(); ++aIter )
+        {
+            if ( aIter->second.get() )
+                aIter->second->ApplyCellBorders( pDoc, rFirstPos );
+        }
+    }
 }
 
 // ----------------------------------------------------------------------------
@@ -2593,8 +2566,15 @@ void ScHTMLTable::CalcNeededDocSize(
 
 void ScHTMLTable::FillEmptyCells()
 {
-    for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
-        aIter->FillEmptyCells();
+    if ( mxNestedTables.get() )
+    {
+        for ( ScHTMLTableMap::const_iterator aIter( mxNestedTables->begin() );
+             aIter != mxNestedTables->end(); ++aIter )
+        {
+            if ( aIter->second.get() )
+                aIter->second->FillEmptyCells();
+        }
+    }
 
     // insert the final vertically merged ranges into maUsedCells
     for( const ScRange* pRange = maVMergedCells.First(); pRange; pRange = maVMergedCells.Next()
)
@@ -2627,8 +2607,15 @@ void ScHTMLTable::FillEmptyCells()
 void ScHTMLTable::RecalcDocSize()
 {
     // recalc table sizes recursively from inner to outer
-    for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
-        aIter->RecalcDocSize();
+    if ( mxNestedTables.get() )
+    {
+        for ( ScHTMLTableMap::const_iterator aIter( mxNestedTables->begin() );
+             aIter != mxNestedTables->end(); ++aIter )
+        {
+            if ( aIter->second.get() )
+                aIter->second->RecalcDocSize();
+        }
+    }
 
     /*  Two passes: first calculates the sizes of single columns/rows, then
         the sizes of spanned columns/rows. This allows to fill nested tables



Mime
View raw message