[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - sw/source

Luke Deller luke at deller.id.au
Mon May 27 06:44:34 PDT 2013


 sw/source/filter/ww8/wrtw8sty.cxx |    2 +-
 sw/source/filter/xml/xmltbli.cxx  |   26 ++++++--------------------
 2 files changed, 7 insertions(+), 21 deletions(-)

New commits:
commit b571605129426a1bf8eb7c9e9927785f8a9a5305
Author: Luke Deller <luke at deller.id.au>
Date:   Thu May 23 02:05:36 2013 +1000

    fix fdo#64872 infinite loop saving as doc
    
    When loading from odt, table cells which are covered (due to merging of
    cells) are replaced with an empty cell by
    SwXMLTableContext::ReplaceWithEmptyCell.  However if there is a sequence
    of cells covered from above then their replacements are accidentally
    inserted in reverse order, which produces this infinite loop problem when
    saving as doc.
    
    The reverse ordering in SwXMLTableContext::ReplaceWithEmptyCell was because
    the insert position came from SwXMLTableContext::GetPrevStartNode which was
    very careful to skip previous covered cells.  However those cells have
    already been replaced with an empty cell so they should not be skipped.
    
    Change-Id: I6a022cd1490afa181dbc3e4b2d6ed4af3077b363
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 36ee09b..f5370ea 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -531,7 +531,7 @@ void MSWordStyles::OutputStyle( SwFmt* pFmt, sal_uInt16 nPos )
         // (It must be the English word regardless of language settings)
         if ( nPos == 0 ) {
             assert( pFmt->GetPoolFmtId() == RES_POOLCOLL_STANDARD );
-            aName = OUString("Normal");
+            aName = rtl::OUString("Normal");
         } else if (aName.EqualsIgnoreCaseAscii("Normal")) {
             // If LO has a style named "Normal"(!) rename it to something unique
             aName.InsertAscii("LO-" , 0);
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 6cd2cdc..50d5e99 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1807,29 +1807,15 @@ const SwStartNode *SwXMLTableContext::GetPrevStartNode( sal_uInt32 nRow,
         // The last cell is the right one here.
         pPrevCell = GetCell( pRows->size()-1U, GetColumnCount()-1UL );
     }
-    else if( 0UL == nRow )
+    else if( nCol > 0UL )
     {
-        // There are no vertically merged cells within the first row, so the
-        // previous cell is the right one always.
-        if( nCol > 0UL )
-            pPrevCell = GetCell( nRow, nCol-1UL );
+        // The previous cell in this row.
+        pPrevCell = GetCell( nRow, nCol-1UL );
     }
-    else
+    else if( nRow > 0UL )
     {
-        // If there is a previous cell in the current row that is not spanned
-        // from the previous row, its the right one.
-        const SwXMLTableRow_Impl *pPrevRow = &(*pRows)[(sal_uInt16)nRow-1U];
-        sal_uInt32 i = nCol;
-        while( !pPrevCell &&  i > 0UL )
-        {
-            i--;
-            if( 1UL == pPrevRow->GetCell( i )->GetRowSpan() )
-                pPrevCell = GetCell( nRow, i );
-        }
-
-        // Otherwise, the last cell from the previous row is the right one.
-        if( !pPrevCell )
-            pPrevCell = pPrevRow->GetCell( GetColumnCount()-1UL );
+        // The last cell from the previous row.
+        pPrevCell = GetCell( nRow-1UL, GetColumnCount()-1UL );
     }
 
     const SwStartNode *pSttNd = 0;


More information about the Libreoffice-commits mailing list