summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Specht <oliver.specht@cib.de>2015-09-03 10:36:53 +0200
committerMichael Stahl <mstahl@redhat.com>2015-09-15 17:36:44 +0200
commita02d7cbd70f3c5703f61f380caf91c460aa3a530 (patch)
treeca0d48ba2027453fdd0464f032c49719c65ade37
parent0bd99a77e1655cee63ad7ec2bb25e45d13aac44d (diff)
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@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> (cherry picked from commit adf39dbade8652ceca9007484bfa20f04c5ebec0) Signed-off-by: Michael Stahl <mstahl@redhat.com> Change-Id: I00d334197b960c4ed17fdee3ea8a1c734cbfa4c1
-rw-r--r--sw/source/core/unocore/unoftn.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index b0b750236448..2f6c0e1ee653 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
{