# HG changeset patch
# User Henning Brinkmann <hbrinkm@openoffice.org>
# Date 1249554137 -7200
# Node ID 68aff558b6943e56caf3d958c1dca5ba0c5db12e
# Parent  a9d3788736ef418b13a331cf09fd3fd1523732ea
debug output for SwNodeRange

diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
--- a/sw/inc/dbgoutsw.hxx
+++ b/sw/inc/dbgoutsw.hxx
@@ -54,6 +54,7 @@
 class SwNumRule;
 class SwOutlineNodes;
 class SwTxtFmtColl;
+class SwNodeRange;
 
 #define DBG_OUT_HERE printf("%s(%d):", __FILE__, __LINE__)
 #define DBG_OUT_HERE_FN printf("%s(%d) %s:", __FILE__, __LINE__, __FUNCTION__)
@@ -88,6 +89,7 @@
 SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt);
 SW_DLLPUBLIC const char * dbg_out(const SwFrmFmts & rFrmFmts);
 SW_DLLPUBLIC const char * dbg_out(const SwNumRuleTbl & rTbl);
+SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange);
 
 template<typename tKey, typename tMember, typename fHashFunction>
 String lcl_dbg_out(const std::hash_map<tKey, tMember, fHashFunction> & rMap)
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -1024,5 +1024,24 @@
 {
     return dbg_out(lcl_dbg_out(rTokens));
 }
+
+String lcl_dbg_out(const SwNodeRange & rRange)
+{
+    String aStr("[", RTL_TEXTENCODING_ASCII_US);
+    
+    aStr += lcl_dbg_out(rRange.aStart);
+    aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
+    aStr += lcl_dbg_out(rRange.aEnd);
+
+    aStr += String("]" , RTL_TEXTENCODING_ASCII_US);
+
+    return aStr;
+}
+
+SW_DLLPUBLIC const char * dbg_out(const SwNodeRange & rRange)
+{
+    return dbg_out(lcl_dbg_out(rRange));
+}
+
 #endif // DEBUG
 
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -31,6 +31,11 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
+#ifdef DEBUG
+#include <iostream>
+#include <dbgoutsw.hxx>
+#endif
+
 #include <stdlib.h>
 #include <node.hxx>
 #include <doc.hxx>
@@ -504,8 +509,15 @@
 	USHORT nSectNdCnt = 0;
 	BOOL bSaveNewFrms = bNewFrms;
 
+    sal_uInt32 nMax = 1024;
 	// bis alles verschoben ist
-	while( aRg.aStart < aRg.aEnd )
+	while( aRg.aStart < aRg.aEnd && nMax > 0)
+    {
+        nMax--;
+#ifdef DEBUG
+        ::std::clog << dbg_out(aRg) << ::std::endl;
+#endif
+    
 		switch( (pAktNode = &aRg.aEnd.GetNode())->GetNodeType() )
 		{
 		case ND_ENDNODE:
@@ -912,7 +924,8 @@
 			ASSERT( FALSE, "was ist das fuer ein Node??" );
 			break;
 		}
-
+    }
+    
 	if( nInsPos )							// kopiere den Rest
 	{
 		// der Rest muesste so stimmen
