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). Change-Id: Ie331c7561de7f2f16776a1613717e38fa083a541 Reviewed-on: https://gerrit.libreoffice.org/43735 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
42
sw/qa/extras/rtfexport/data/tdf113202.rtf
Normal file
42
sw/qa/extras/rtfexport/data/tdf113202.rtf
Normal file
@@ -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
|
||||
}
|
@@ -1307,6 +1307,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: */
|
||||
|
@@ -405,8 +405,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));
|
||||
|
Reference in New Issue
Block a user