summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx52
1 files changed, 50 insertions, 2 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 5e1524cb2cbb..c72723a4591d 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: unocrsrhelper.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: kz $ $Date: 2004-08-02 14:17:35 $
+ * last change: $Author: obo $ $Date: 2004-08-11 15:41:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,6 +96,12 @@
#ifndef _UNOFRAME_HXX
#include <unoframe.hxx>
#endif
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+#ifndef _PAM_HXX
+#include <pam.hxx>
+#endif
#ifndef _FMTFTN_HXX //autogen
#include <fmtftn.hxx>
#endif
@@ -865,5 +871,47 @@ void InsertFile(SwUnoCrsr* pUnoCrsr,
delete pMed;
}
+/* -----------------14.07.04 ------------------------
+ *
+ * --------------------------------------------------*/
+
+// insert text and scan for CR characters in order to insert
+// paragraph breaks at those positions by calling SplitNode
+sal_Bool DocInsertStringSplitCR(
+ SwDoc &rDoc,
+ const SwPaM &rNewCursor, const String &rText )
+{
+ sal_Bool bOK = sal_True;
+
+ OUString aTxt;
+ xub_StrLen nStartIdx = 0;
+ xub_StrLen nIdx = rText.Search( '\r', nStartIdx );
+ while (nIdx != STRING_NOTFOUND)
+ {
+ DBG_ASSERT( nIdx - nStartIdx >= 0, "index negative!" );
+ aTxt = rText.Copy( nStartIdx, nIdx - nStartIdx );
+ if (aTxt.getLength() && !rDoc.Insert( rNewCursor, aTxt ))
+ {
+ DBG_ERROR( "Doc->Insert(Str) failed." );
+ bOK = sal_False;
+ }
+ if (!rDoc.SplitNode( *rNewCursor.GetPoint() ) )
+ {
+ DBG_ERROR( "SplitNode failed" );
+ bOK = sal_False;
+ }
+ nStartIdx = nIdx + 1;
+ nIdx = rText.Search( '\r', nStartIdx );
+ }
+ aTxt = rText.Copy( nStartIdx );
+ if (aTxt.getLength() && !rDoc.Insert( rNewCursor, aTxt ))
+ {
+ DBG_ERROR( "Doc->Insert(Str) failed." );
+ bOK = sal_False;
+ }
+
+ return bOK;
+}
+
}//namespace SwUnoCursorHelper