diff options
author | Oliver Bolte <obo@openoffice.org> | 2004-08-11 14:41:58 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2004-08-11 14:41:58 +0000 |
commit | 081128003c527509b3a33ed23b6d44d509a4c5ee (patch) | |
tree | ba6989bdb2880238a340199f06934a2d17673ff3 /sw/source | |
parent | dc1769ea73645fcec21ad20250b8aefe44ee8293 (diff) |
INTEGRATION: CWS tleamisc (1.13.26); FILE MERGED
2004/07/16 08:39:19 tl 1.13.26.1: #116743# setString for XTextRange implementations now inserts a new paragraph when encounterimng a CR character
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 52 |
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 |