summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2015-09-03 10:36:53 +0200
committerCaolán McNamara <caolanm@redhat.com>2015-09-03 11:12:00 +0000
commitadf39dbade8652ceca9007484bfa20f04c5ebec0 (patch)
tree64fb0b3e0c6b7c237e4925ba2818e24684ea5a80
parent9761e8b7eb2f4efedfff67a6574540d4ea2e9c5a (diff)
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 <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 089d7f53ea232972961c14706a54187f075fa973) Reviewed-on: https://gerrit.libreoffice.org/18297 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/unocore/unoftn.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 535603b190e5..7d3ff5c4fd7f 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
{