[Libreoffice] [PATCH] Cross-references to numbered paragraphs: remove trailing dots at the end of a cross-reference, or where they precede an open parenthesis that starts the next paragraph level in the cross-reference (bugzilla 33960).

Troy Rollo libreoffice at troy.rollo.name
Thu Apr 14 01:04:36 PDT 2011


---
 sw/source/core/doc/number.cxx |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 95ea5c8..d7df858 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -770,7 +770,15 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
                    pWorkingNodeNum->GetTxtNode() &&
                    pWorkingNodeNum->GetTxtNode()->HasNumber() ) )
             {
-                aRefNumStr.Insert( MakeNumString( pWorkingNodeNum->GetNumberVector() ), 0 );
+                String aPrevStr = MakeNumString( pWorkingNodeNum->GetNumberVector() );
+                int    nLen = aPrevStr.Len();
+
+                if ( nLen > 0 && aPrevStr.GetChar(nLen - 1) == '.' &&
+                     ( aRefNumStr.Len() == 0 ||
+                      aRefNumStr.GetChar(0) == '(' )
+                   )
+                        aPrevStr.Erase( nLen - 1, 1 );
+                aRefNumStr.Insert( aPrevStr, 0 );
             }
             else if ( aRefNumStr.Len() > 0 )
             {
-- 
1.7.2.5



More information about the LibreOffice mailing list