[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Oct 25 12:27:46 UTC 2017
sw/qa/extras/rtfexport/data/tdf113202.rtf | 42 +++++++++++++++++++++++++++
sw/qa/extras/rtfexport/rtfexport.cxx | 6 +++
writerfilter/source/dmapper/DomainMapper.cxx | 8 +++++
3 files changed, 56 insertions(+)
New commits:
commit 63054103570377ef8949addfa153b23838c1672a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Oct 24 09:27:19 2017 +0200
tdf#113202 RTF import: fix lack of expected contextual spacing
Upper, lower and contextual spacing are all stored in SvxULSpaceItem, so
if after spacing is set as direct formatting, contextual spacing has to
be set directly as well (having it in the paragraph style has no
effect).
(cherry picked from commit f8b5ecc622e2b3e82576b27bf0ded9c8eac21cae)
Change-Id: Ie331c7561de7f2f16776a1613717e38fa083a541
Reviewed-on: https://gerrit.libreoffice.org/43808
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/rtfexport/data/tdf113202.rtf b/sw/qa/extras/rtfexport/data/tdf113202.rtf
new file mode 100644
index 000000000000..43860bf0becf
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf113202.rtf
@@ -0,0 +1,42 @@
+{\rtf1\adeflang1037\ansi\ansicpg1252\uc1\adeff1\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0
+{\fonttbl
+{\f0\fbidi \froman\fcharset238\fprq2 Times New Roman;}
+{\f3\fbidi \froman\fcharset2\fprq2 Symbol;}
+{\f40\fbidi \fswiss\fcharset238\fprq2 Verdana;}
+}
+\noqfpromote
+{\stylesheet
+{\s15\ql \li720\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin720\itap0\contextualspace \rtlch\fcs1 \af1\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 \sqformat \spriority34 List Paragraph;}
+}
+{\*\listtable
+{\list\listtemplateid1644085804\listhybrid
+{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext
+\leveltemplateid67698689\'01\u-3913 ?;}
+{\levelnumbers;}
+\f3\fbias0 \fi-360\li720\lin720 }
+{\listname ;}
+\listid2028170298}
+}
+{\*\listoverridetable
+{\listoverride\listid2028170298\listoverridecount0\ls1}
+}
+\paperw12240\paperh15840\margl1417\margr1417\margt1417\margb1417
+\pard\plain \ltrpar
+\s15\ql \fi-360\li720\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\contextualspace \rtlch\fcs1 \af1\afs22\alang1025 \ltrch\fcs0
+\f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 Profile 1 \endash A1\par}
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 Profile 1 \endash A2\par}
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 Profile 1 \endash A3\par}
+\pard \ltrpar\s15\ql \fi-360\li720\ri0\sl276\slmult1
+\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\contextualspace
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 Profile 4 }
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0
+\f40\fs16 \endash }
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 }
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0 \f40\fs16 A4}
+{\rtlch\fcs1 \af37\afs16 \ltrch\fcs0
+\f40\fs16
+\par }
+\pard\plain\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 151d6b0f4d61..fc6290d6ea15 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1309,6 +1309,12 @@ DECLARE_RTFEXPORT_TEST(testTdf112211, "tdf112211.rtf")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-635), aRule["FirstLineIndent"].get<sal_Int32>());
}
+DECLARE_RTFEXPORT_TEST(testTdf113202, "tdf113202.rtf")
+{
+ // This failed, contextual spacing in 4th paragraph was lost.
+ CPPUNIT_ASSERT(getProperty<bool>(getParagraph(4), "ParaContextMargin"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 95ff12ec8ae7..30e8faa54fe3 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -407,8 +407,16 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Spacing_after:
m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "after", OUString::number(nIntValue));
if (m_pImpl->GetTopContext())
+ {
// Don't overwrite NS_ooxml::LN_CT_Spacing_afterAutospacing.
m_pImpl->GetTopContext()->Insert(PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ), false);
+
+ uno::Any aContextualSpacingFromStyle = m_pImpl->GetPropertyFromStyleSheet(PROP_PARA_CONTEXT_MARGIN);
+ if (aContextualSpacingFromStyle.hasValue())
+ // Setting "after" spacing means Writer doesn't inherit
+ // contexual spacing anymore from style, but Word does.
+ m_pImpl->GetTopContext()->Insert(PROP_PARA_CONTEXT_MARGIN, aContextualSpacingFromStyle);
+ }
break;
case NS_ooxml::LN_CT_Spacing_afterLines:
m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "afterLines", OUString::number(nIntValue));
More information about the Libreoffice-commits
mailing list