diff options
author | Ádám Csaba Király <kiraly.adam.csaba@gmail.com> | 2013-03-08 16:56:57 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2013-03-11 10:08:30 +0100 |
commit | 4ec9f68f25f1d75f63e57570eb24f30ebfcfe2b2 (patch) | |
tree | 5f0b92151f97e1037c5ae22ab91b37efe6acee8f /sw | |
parent | 730df392f5c5424a46fcb360c21d34a04622eb9f (diff) |
fdo#61458, index should be "flat"
Change-Id: I46db120fc5e7d616cd4c9eadee7fc4c502569e86
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/doctxm.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 903a7bce00d6..6d15761c3897 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1559,6 +1559,32 @@ static String lcl_GetNumString( const SwTOXSortTabBase& rBase, bool bUsePrefix, 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 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx, { SwIndex aIdx( pTOXNd, rTxt.Len() ); rBase.FillText( *pTOXNd, aIdx ); + rTxt = lcl_RemoveLineBreaks(rTxt); } break; @@ -1617,6 +1644,7 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx, SwIndex aIdx( pTOXNd, rTxt.Len() ); rBase.FillText( *pTOXNd, aIdx ); + rTxt = lcl_RemoveLineBreaks(rTxt); } break; |