[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/source

Oliver Specht oliver.specht at cib.de
Tue Sep 15 08:53:47 PDT 2015


 sw/source/core/unocore/unoftn.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit a02d7cbd70f3c5703f61f380caf91c460aa3a530
Author: Oliver Specht <oliver.specht at cib.de>
Date:   Thu Sep 3 10:36:53 2015 +0200

    tdf#79018: Prevent line break as footnote label
    
    footnote labels must not contain line breaks
    
    Reviewed-on: https://gerrit.libreoffice.org/18292
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 089d7f53ea232972961c14706a54187f075fa973)
    Reviewed-on: https://gerrit.libreoffice.org/18297
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit adf39dbade8652ceca9007484bfa20f04c5ebec0)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Change-Id: I00d334197b960c4ed17fdee3ea8a1c734cbfa4c1

diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index b0b7502..2f6c0e1 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -263,6 +263,13 @@ SwXFootnote::setLabel(const OUString& aLabel) throw (uno::RuntimeException, std:
 {
     SolarMutexGuard aGuard;
 
+    OUString newLabel(aLabel);
+    //new line must not occur as footnote label
+    if(newLabel.indexOf('\n') >=0 )
+    {
+       newLabel = newLabel.replace('\n', ' ');
+    }
+
     SwFmtFtn const*const pFmt = m_pImpl->GetFootnoteFormat();
     if(pFmt)
     {
@@ -271,11 +278,11 @@ SwXFootnote::setLabel(const OUString& aLabel) throw (uno::RuntimeException, std:
         SwTxtNode& rTxtNode = (SwTxtNode&)pTxtFtn->GetTxtNode();
 
         SwPaM aPam(rTxtNode, pTxtFtn->GetStart());
-        GetDoc()->SetCurFtn(aPam, aLabel, pFmt->GetNumber(), pFmt->IsEndNote());
+        GetDoc()->SetCurFtn(aPam, newLabel, pFmt->GetNumber(), pFmt->IsEndNote());
     }
     else if (m_pImpl->m_bIsDescriptor)
     {
-        m_pImpl->m_sLabel = aLabel;
+        m_pImpl->m_sLabel = newLabel;
     }
     else
     {


More information about the Libreoffice-commits mailing list