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

New commits:
commit adf39dbade8652ceca9007484bfa20f04c5ebec0
Author: Oliver Specht <oliver.spe...@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
    
    Change-Id: I00d334197b960c4ed17fdee3ea8a1c734cbfa4c1
    Reviewed-on: https://gerrit.libreoffice.org/18292
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    (cherry picked from commit 089d7f53ea232972961c14706a54187f075fa973)
    Reviewed-on: https://gerrit.libreoffice.org/18297
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/core/unocore/unoftn.cxx 
b/sw/source/core/unocore/unoftn.cxx
index 535603b..7d3ff5c 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -262,7 +262,12 @@ void SAL_CALL
 SwXFootnote::setLabel(const OUString& aLabel) throw (uno::RuntimeException, 
std::exception)
 {
     SolarMutexGuard aGuard;
-
+    OUString newLabel(aLabel);
+    //new line must not occur as footnote label
+    if(newLabel.indexOf('\n') >=0 )
+    {
+       newLabel = newLabel.replace('\n', ' ');
+    }
     SwFormatFootnote const*const pFormat = m_pImpl->GetFootnoteFormat();
     if(pFormat)
     {
@@ -271,11 +276,11 @@ SwXFootnote::setLabel(const OUString& aLabel) throw 
(uno::RuntimeException, std:
         SwTextNode& rTextNode = (SwTextNode&)pTextFootnote->GetTextNode();
 
         SwPaM aPam(rTextNode, pTextFootnote->GetStart());
-        GetDoc()->SetCurFootnote(aPam, aLabel, pFormat->GetNumber(), 
pFormat->IsEndNote());
+        GetDoc()->SetCurFootnote(aPam, newLabel, pFormat->GetNumber(), 
pFormat->IsEndNote());
     }
     else if (m_pImpl->m_bIsDescriptor)
     {
-        m_pImpl->m_sLabel = aLabel;
+        m_pImpl->m_sLabel = newLabel;
     }
     else
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to