incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1359246 - /incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx
Date Mon, 09 Jul 2012 16:08:56 GMT
Author: af
Date: Mon Jul  9 16:08:56 2012
New Revision: 1359246

URL: http://svn.apache.org/viewvc?rev=1359246&view=rev
Log:
#i119953# Fixed crash on File->Insert.

          Reported by: Yan Ji
          Patch by: Oliver-Rainer Wittmann
          Review by: Andre Fischer

Modified:
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx?rev=1359246&r1=1359245&r2=1359246&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8par.cxx Mon Jul  9 16:08:56 2012
@@ -4048,31 +4048,27 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8G
 
     if (!mbNewDoc)
     {
-        // in ein Dokument einfuegen ?
-        // Da immer ganze Zeile eingelesen werden, muessen
-        // evtl. Zeilen eingefuegt / aufgebrochen werden
-        //
+        // inserting into an existing document:
+        // As only complete paragraphs are inserted, the current one
+        // needs to be splitted - once or even twice.
         const SwPosition* pPos = pPaM->GetPoint();
-        SwTxtNode const*const pSttNd = pPos->nNode.GetNode().GetTxtNode();
 
-        sal_uInt16 nCntPos = pPos->nContent.GetIndex();
+        // split current paragraph to get new paragraph for the insertion
+        rDoc.SplitNode( *pPos, false );
 
-        // EinfuegePos nicht in leerer Zeile
-        if( nCntPos && pSttNd->GetTxt().Len() )
-            rDoc.SplitNode( *pPos, false );            // neue Zeile erzeugen
-
-        if( pSttNd->GetTxt().Len() )
-        {   // EinfuegePos nicht am Ende der Zeile
-            rDoc.SplitNode( *pPos, false );    // neue Zeile
-            pPaM->Move( fnMoveBackward );   // gehe in leere Zeile
-        }
-
-        // verhinder das Einlesen von Tabellen in Fussnoten / Tabellen
-        sal_uLong nNd = pPos->nNode.GetIndex();
-        bReadNoTbl = 0 != pSttNd->FindTableNode() ||
-            ( nNd < rDoc.GetNodes().GetEndOfInserts().GetIndex() &&
-            rDoc.GetNodes().GetEndOfInserts().StartOfSectionIndex()
-            < nNd );
+        // another split, if insertion position was not at the end of the current paragraph.
+        SwTxtNode const*const pTxtNd = pPos->nNode.GetNode().GetTxtNode();
+        if ( pTxtNd->GetTxt().Len() )
+        {
+            rDoc.SplitNode( *pPos, false );
+            // move PaM back to the newly empty paragraph
+            pPaM->Move( fnMoveBackward );
+        }
+
+        // suppress insertion of tables inside footnotes.
+        const sal_uLong nNd = pPos->nNode.GetIndex();
+        bReadNoTbl = ( nNd < rDoc.GetNodes().GetEndOfInserts().GetIndex() &&
+                       rDoc.GetNodes().GetEndOfInserts().StartOfSectionIndex() < nNd );
 
     }
 



Mime
View raw message