fdo#76597: Fix preservation issue of Spacing between paragraph

Change-Id: I458bed111893a8d2fef79b11e28263a5bd2ed9cf
Reviewed-on: https://gerrit.libreoffice.org/8842
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Rohit Deshmukh
2014-04-04 17:47:21 +05:30
committed by Miklos Vajna
parent a3be376746
commit 05c5da4c37
4 changed files with 35 additions and 2 deletions

Binary file not shown.

View File

@@ -3068,6 +3068,15 @@ DECLARE_OOXMLEXPORT_TEST(test76734_2K7, "test76734_2K7.docx")
assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]", "Requires", "wps");
}
DECLARE_OOXMLEXPORT_TEST(testFDO76597, "fdo76597.docx")
{
// check XML
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "before", "96");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[4]/w:pPr/w:spacing", "after", "120");
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();

View File

@@ -6335,6 +6335,13 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
AddToAttrList( m_pParagraphSpacingAttrList,
FSNS( XML_w, XML_beforeAutospacing ), "1" );
}
else if (m_bParaBeforeAutoSpacing && m_nParaBeforeSpacing == -1)
{
AddToAttrList( m_pParagraphSpacingAttrList,
FSNS( XML_w, XML_beforeAutospacing ), "0" );
AddToAttrList( m_pParagraphSpacingAttrList,
FSNS( XML_w, XML_before ), OString::number( rULSpace.GetUpper() ).getStr() );
}
else
{
AddToAttrList( m_pParagraphSpacingAttrList,
@@ -6348,6 +6355,13 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
AddToAttrList( m_pParagraphSpacingAttrList,
FSNS( XML_w, XML_afterAutospacing ), "1" );
}
else if (m_bParaAfterAutoSpacing && m_nParaAfterSpacing == -1)
{
AddToAttrList( m_pParagraphSpacingAttrList,
FSNS( XML_w, XML_afterAutospacing ), "0" );
AddToAttrList( m_pParagraphSpacingAttrList,
FSNS( XML_w, XML_after ), OString::number( rULSpace.GetLower()).getStr() );
}
else
{
AddToAttrList( m_pParagraphSpacingAttrList,

View File

@@ -559,9 +559,14 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
else
default_spacing = 280;
}
m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag
{
m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
}
else
{
default_spacing = -1;
m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
}
}
@@ -577,9 +582,14 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
else
default_spacing = 280;
}
m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
if (nIntValue) // If auto spacing is set, then only store set value in InteropGrabBag
{
m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ) );
m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
}
else
{
default_spacing = -1;
m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING, uno::makeAny( ConversionHelper::convertTwipToMM100(default_spacing) ),true, PARA_GRAB_BAG );
}
}