diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-07-06 15:57:32 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-06 16:25:54 +0200 |
commit | a8651a4bf3031bdf16a84ddf774eaf699a617426 (patch) | |
tree | 0f72e5cc4532706fd966d3416adf0badc1c2a5bd /sw/source/core | |
parent | 3686e3702a5e3a97f1217435941c2d28a5a81bb0 (diff) |
fdo#33960: fix cross reference number test failure
(cherry picked from commit 190ca072fc1c8679c586867582c816d98016f343)
Conflicts:
sw/source/core/doc/number.cxx
Change-Id: If50a09a14ad30fa3dcb587d6e59a5a0d161394b1
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/doc/number.cxx | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index 41fc6709fe21..c6e26fe9aa0b 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -752,6 +752,8 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum, if ( rNodeNum.GetLevelInListTree() >= 0 ) { sal_Bool bOldHadPrefix = sal_True; + bool bFirstIteration = true; + ::rtl::OUString sOldPrefix; const SwNodeNum* pWorkingNodeNum( &rNodeNum ); do @@ -787,26 +789,44 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum, if (nStrip) { - aPrevStr.Erase( 0, nStrip ); - aExtremities.nPrefixChars -= nStrip; - nLen -= nStrip; + aPrevStr.Erase( 0, nStrip ); + aExtremities.nPrefixChars -= nStrip; + nLen -= nStrip; } - if ( bOldHadPrefix && + if ((bFirstIteration || bOldHadPrefix) && aExtremities.nSuffixChars && !aExtremities.nPrefixChars ) { - aPrevStr.Erase( nLen - aExtremities.nSuffixChars, aExtremities.nSuffixChars ); + int nStrip2 = aPrevStr.Len(); + while (aPrevStr.Len() - nStrip2 < aExtremities.nSuffixChars) + { + char const cur = aPrevStr.GetChar(nStrip2); + if (!bFirstIteration && '\t' != cur && ' ' != cur) + { + break; + } + --nStrip2; + } + if (nStrip2 < aPrevStr.Len()) + { + aPrevStr.Erase(nStrip2, aPrevStr.Len() - nStrip2); + } + } + else if (sOldPrefix.getLength()) + { + aRefNumStr.Insert(sOldPrefix, 0); } + sOldPrefix = ::rtl::OUString(); + bOldHadPrefix = ( aExtremities.nPrefixChars > 0); aRefNumStr.Insert( aPrevStr, 0 ); - } else if ( aRefNumStr.Len() > 0 ) { - aRefNumStr.Insert( String::CreateFromAscii(" "), 0 ); + sOldPrefix += " "; bOldHadPrefix = true; } @@ -825,6 +845,7 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum, { break; } + bFirstIteration = false; } while ( pWorkingNodeNum && pWorkingNodeNum->GetLevelInListTree() >= 0 && static_cast<sal_uInt8>(pWorkingNodeNum->GetLevelInListTree()) >= nRestrictInclToThisLevel ); |