Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > cd8ce32c919af60229fca1d7f792c60e > files > 56

openoffice.org-3.2.0-12.35.fc13.src.rpm

# HG changeset patch
# Parent 03902c50d92424e65b930d1c384a97a2655b72e6
#i111286# avoid crash when pasting footnote into frame

diff -r 03902c50d924 sw/source/core/txtnode/ndtxt.cxx
--- a/sw/source/core/txtnode/ndtxt.cxx	Tue May 04 16:15:43 2010 +0200
+++ b/sw/source/core/txtnode/ndtxt.cxx	Wed May 05 10:53:42 2010 +0200
@@ -1588,6 +1588,7 @@
 	// Del-Array fuer alle RefMarks ohne Ausdehnung
 	SwpHts aRefMrkArr;
 
+    USHORT nDeletedDummyChars(0);
 		//Achtung: kann ungueltig sein!!
     for (USHORT n = 0; ( n < nSize ); ++n)
     {
@@ -1681,9 +1682,19 @@
 		}
 		else
 		{
-            pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt,
-                                nAttrEnd, nsSetAttrMode::SETATTR_NOTXTATRCHR );
-            lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
+            pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt - nDeletedDummyChars,
+                                nAttrEnd - nDeletedDummyChars, nsSetAttrMode::SETATTR_NOTXTATRCHR );
+            if (pNewHt)
+            {
+                lcl_CopyHint( nWhich, pHt, pNewHt, pOtherDoc, pDest );
+            }
+            else if (pHt->HasDummyChar())
+            {
+                // The attribute that has failed to be copied would insert
+                // dummy char, so positions of the following attributes have
+                // to be shifted by one to compensate for that missing char.
+                ++nDeletedDummyChars;
+            }
         }
 
 		if( RES_TXTATR_REFMARK == nWhich && !pEndIdx && !bCopyRefMark )