Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2603

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/03/2603/1

fdo#61458, index should be "flat"

Change-Id: I46db120fc5e7d616cd4c9eadee7fc4c502569e86
---
M sw/source/core/doc/doctxm.cxx
1 file changed, 28 insertions(+), 0 deletions(-)



diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 903a7bc..6d15761 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1559,6 +1559,32 @@
     return sRet;
 }
 
+/*--------------------------------------------------------------------
+  Description: Generate String with newlines changed to spaces,
+  consecutive spaces changed to a single space, and trailing space removed.
+ --------------------------------------------------------------------*/
+String lcl_RemoveLineBreaks( String sRet )
+{
+    xub_StrLen nOffset = 0;
+    sRet.SearchAndReplaceAll('\n', ' ');
+    for (xub_StrLen i = 1; i < sRet.Len(); i++)
+    {
+        if ( sRet.GetChar(i - 1) == ' ' && sRet.GetChar(i) == ' ' )
+        {
+            nOffset += 1;
+        }
+        else
+        {
+            sRet.SetChar(i - nOffset, sRet.GetChar(i));
+        }
+    }
+    if (sRet.GetChar(sRet.Len() - 1) == ' ')
+    {
+        nOffset += 1;
+    }
+    return sRet.Copy(0, sRet.Len() - nOffset);
+}
+
 // Add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc> in order to control,
 // which page description is used, no appropriate one is found.
 void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
@@ -1607,6 +1633,7 @@
                 {
                     SwIndex aIdx( pTOXNd, rTxt.Len() );
                     rBase.FillText( *pTOXNd, aIdx );
+                    rTxt = lcl_RemoveLineBreaks(rTxt);
                 }
                 break;
 
@@ -1617,6 +1644,7 @@
 
                     SwIndex aIdx( pTOXNd, rTxt.Len() );
                     rBase.FillText( *pTOXNd, aIdx );
+                    rTxt = lcl_RemoveLineBreaks(rTxt);
                 }
                 break;
 

-- 
To view, visit https://gerrit.libreoffice.org/2603
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I46db120fc5e7d616cd4c9eadee7fc4c502569e86
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ádám Király <kiraly.adam.csaba@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.