View | Details | Raw Unified | Return to issue 122591
Collapse All | Expand All

(-)a/main/sc/source/filter/html/htmlpars.cxx (-40 / +27 lines)
Lines 1897-1936 ScHTMLTable* ScHTMLTableMap::CreateTable( const ImportInfo& rInfo, bool bPreForm Link Here
1897
    return pTable;
1897
    return pTable;
1898
}
1898
}
1899
1899
1900
// ----------------------------------------------------------------------------
1901
1902
/** Simplified forward iterator for convenience.
1903
1904
    Before the iterator can be dereferenced, it must be tested with the is()
1905
    method. The iterator may be invalid directly after construction (e.g. empty
1906
    container).
1907
 */
1908
class ScHTMLTableIterator
1909
{
1910
public:
1911
    /** Constructs the iterator for the passed table map.
1912
        @param pTableMap  Pointer to the table map (is allowed to be NULL). */
1913
    explicit            ScHTMLTableIterator( const ScHTMLTableMap* pTableMap );
1914
1915
    inline bool         is() const { return maIter != maEnd; }
1916
    inline ScHTMLTable* operator->() { return maIter->second.get(); }
1917
    inline ScHTMLTable& operator*() { return *maIter->second; }
1918
    inline ScHTMLTableIterator& operator++() { ++maIter; return *this; }
1919
1920
private:
1921
    ScHTMLTableMap::const_iterator maIter;
1922
    ScHTMLTableMap::const_iterator maEnd;
1923
};
1924
1925
ScHTMLTableIterator::ScHTMLTableIterator( const ScHTMLTableMap* pTableMap )
1926
{
1927
    if( pTableMap )
1928
    {
1929
        maIter = pTableMap->begin();
1930
        maEnd = pTableMap->end();
1931
    }
1932
}
1933
1934
// ============================================================================
1900
// ============================================================================
1935
1901
1936
ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ) :
1902
ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ) :
Lines 2299-2306 void ScHTMLTable::ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos Link Here
2299
        }
2265
        }
2300
    }
2266
    }
2301
2267
2302
    for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
2268
    if ( mxNestedTables.get() )
2303
        aIter->ApplyCellBorders( pDoc, rFirstPos );
2269
    {
2270
        for ( ScHTMLTableMap::const_iterator aIter( mxNestedTables->begin() );
2271
             aIter != mxNestedTables->end(); ++aIter )
2272
        {
2273
            if ( aIter->second.get() )
2274
                aIter->second->ApplyCellBorders( pDoc, rFirstPos );
2275
        }
2276
    }
2304
}
2277
}
2305
2278
2306
// ----------------------------------------------------------------------------
2279
// ----------------------------------------------------------------------------
Lines 2593-2600 void ScHTMLTable::CalcNeededDocSize( Link Here
2593
2566
2594
void ScHTMLTable::FillEmptyCells()
2567
void ScHTMLTable::FillEmptyCells()
2595
{
2568
{
2596
    for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
2569
    if ( mxNestedTables.get() )
2597
        aIter->FillEmptyCells();
2570
    {
2571
        for ( ScHTMLTableMap::const_iterator aIter( mxNestedTables->begin() );
2572
             aIter != mxNestedTables->end(); ++aIter )
2573
        {
2574
            if ( aIter->second.get() )
2575
                aIter->second->FillEmptyCells();
2576
        }
2577
    }
2598
2578
2599
    // insert the final vertically merged ranges into maUsedCells
2579
    // insert the final vertically merged ranges into maUsedCells
2600
    for( const ScRange* pRange = maVMergedCells.First(); pRange; pRange = maVMergedCells.Next() )
2580
    for( const ScRange* pRange = maVMergedCells.First(); pRange; pRange = maVMergedCells.Next() )
Lines 2627-2634 void ScHTMLTable::FillEmptyCells() Link Here
2627
void ScHTMLTable::RecalcDocSize()
2607
void ScHTMLTable::RecalcDocSize()
2628
{
2608
{
2629
    // recalc table sizes recursively from inner to outer
2609
    // recalc table sizes recursively from inner to outer
2630
    for( ScHTMLTableIterator aIter( mxNestedTables.get() ); aIter.is(); ++aIter )
2610
    if ( mxNestedTables.get() )
2631
        aIter->RecalcDocSize();
2611
    {
2612
        for ( ScHTMLTableMap::const_iterator aIter( mxNestedTables->begin() );
2613
             aIter != mxNestedTables->end(); ++aIter )
2614
        {
2615
            if ( aIter->second.get() )
2616
                aIter->second->RecalcDocSize();
2617
        }
2618
    }
2632
2619
2633
    /*  Two passes: first calculates the sizes of single columns/rows, then
2620
    /*  Two passes: first calculates the sizes of single columns/rows, then
2634
        the sizes of spanned columns/rows. This allows to fill nested tables
2621
        the sizes of spanned columns/rows. This allows to fill nested tables

Return to issue 122591