[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sc/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Mon Jul 16 07:51:25 PDT 2012


 sc/source/filter/excel/xetable.cxx |   53 ++++++++++---------------------------
 1 file changed, 15 insertions(+), 38 deletions(-)

New commits:
commit de9c6a7829b08968491c8b57b5bd4f182e5e873e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Jul 16 16:44:43 2012 +0200

    Revert "fix excel row height export problems ( I hope ) fdo#50304"
    
    This reverts commit 9746c6de3a05fe9284d6d6bb2f636bfe912733cd.
    
    Signed-off-by: Kohei Yoshida <kohei.yoshida at gmail.com>
    Signed-off-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 69db2be..e3967f2 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -2029,41 +2029,22 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt
     XclExpDefaultRowData aMaxDefData;
     size_t nMaxDefCount = 0;
     // only look for default format in existing rows, if there are more than unused
-    bool bSearchExisting = ( maRowMap.size() >= (  GetMaxPos().Row() - maRowMap.size() ) );
-    if ( bSearchExisting )
-    {
-        for (itr = itrBeg; itr != itrEnd; ++itr)
-        {
-            const RowRef& rRow = itr->second;
-            if (rRow->IsDefaultable())
-            {
-                XclExpDefaultRowData aDefData( *rRow );
-                size_t& rnDefCount = aDefRowMap[ aDefData ];
-                ++rnDefCount;
-                if( rnDefCount > nMaxDefCount )
-                {
-                    nMaxDefCount = rnDefCount;
-                    aMaxDefData = aDefData;
-                }
-            }
-        }
-    }
-    else
+    for (itr = itrBeg; itr != itrEnd; ++itr)
     {
-        // find a suitable unused row to get the default height from,
-        // searching backwards from max row
-        for ( SCROW nRow = GetMaxPos().Row(); nRow >= 0; --nRow )
+        const RowRef& rRow = itr->second;
+        if (rRow->IsDefaultable())
         {
-            if ( maRowMap.find( nRow ) == maRowMap.end() )
+            XclExpDefaultRowData aDefData( *rRow );
+            size_t& rnDefCount = aDefRowMap[ aDefData ];
+            ++rnDefCount;
+            if( rnDefCount > nMaxDefCount )
             {
-                // use first encountered unused row height as default
-                // I wonder should we do this always ( and abandon the search
-                // of exising rows )
-                aMaxDefData.mnHeight = GetDoc().GetRowHeight(nRow, GetCurrScTab(), false);
-                break;
+                nMaxDefCount = rnDefCount;
+                aMaxDefData = aDefData;
             }
         }
     }
+
     // return the default row format to caller
     rDefRowData = aMaxDefData;
 
@@ -2165,17 +2146,13 @@ XclExpDimensions* XclExpRowBuffer::GetDimensions()
 
 XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt32 nXclRow, bool bRowAlwaysEmpty )
 {
-    RowMap::iterator itr = maRowMap.begin();
-    for ( size_t nFrom = maRowMap.size(); nFrom <= nXclRow; ++nFrom )
+    RowMap::iterator itr = maRowMap.find(nXclRow);
+    if (itr == maRowMap.end())
     {
-        itr = maRowMap.find(nFrom);
-        if ( itr == maRowMap.end() )
-        {
-            RowRef p(new XclExpRow(GetRoot(), nFrom, maOutlineBfr, bRowAlwaysEmpty));
-            maRowMap.insert(RowMap::value_type(nFrom, p));
-        }
+        RowRef p(new XclExpRow(GetRoot(), nXclRow, maOutlineBfr, bRowAlwaysEmpty));
+        ::std::pair<RowMap::iterator, bool> r = maRowMap.insert(RowMap::value_type(nXclRow, p));
+        itr = r.first;
     }
-    itr = maRowMap.find(nXclRow);
     return *itr->second;
 }
 


More information about the Libreoffice-commits mailing list