Kaydet (Commit) ef829348 authored tarafından Pallavi Jadhav's avatar Pallavi Jadhav Kaydeden (comit) Miklos Vajna

fdo#76934 : DOCX: Preservation: AutoSpacing property not getting preserved.

	Issue :
	- In styles.xml, beforeAutospacing property was set to true.
	- In code LO grab bags AustoSpacing property using "ParaInteropGrabBag".
	- But ParaInteropGrabBag had only an entry for direct paragraph properties,
	  not paragraph styles.
	- Hence while importing AustoSpacing property from styles.xml, LO was throwing exception
          as "Some style properties could not be set: Unknown property: ParaInteropGrabBag".

	Implementation :
	- Added "ParaInteropGarbBag" entry for Paragraph styles in
          sw/source/core/unocore/unomap.cxx
	- Removed code from StyleSheetTable::ApplyStyleSheets() as it was previously added to
          "Ignore" the AutoSpacing property.
	  The code was previously added beacuse due to AutpSpacing in styles.xml,
          LO was throwing an exception and this was causing unhandling of properties after AutoSpacing.
	  So to prevent unhandling of other properties due to AutoSpacing property, a check was added to
          "Ignore" AutoSpacing, thus enabling handling of properties after AutoSpacing.
	  Please refer to : https://gerrit.libreoffice.org/#/c/8902/
	  But as now we have to "Preserve AutoSpacing" this check needs to be removed in order to set
          it in StyelSheetTable.cxx.
	- Added Export Unit test case

Change-Id: I6748f97befcdf40643e75388766e05740290306b
Reviewed-on: https://gerrit.libreoffice.org/9561Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst c0190efe
...@@ -3426,6 +3426,21 @@ DECLARE_OOXMLEXPORT_TEST(testFdo78910, "fdo78910.docx") ...@@ -3426,6 +3426,21 @@ DECLARE_OOXMLEXPORT_TEST(testFdo78910, "fdo78910.docx")
assertXPath ( pXmlDoc, "//w:hyperlink[2]/w:r[5]/w:fldChar", "fldCharType", "end" ); assertXPath ( pXmlDoc, "//w:hyperlink[2]/w:r[5]/w:fldChar", "fldCharType", "end" );
} }
DECLARE_OOXMLEXPORT_TEST(testfdo76934, "fdo76934.docx")
{
/* Issue was, AuoSpacing property if present inside styles.xml, LO was not able to
* preserve it.
*/
xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
if (!pXmlDoc)
return;
// Ensure that after fix LO is preserving AutoSpacing property in styles.xml
assertXPath ( pXmlDoc, "/w:styles[1]/w:style[36]/w:pPr[1]/w:spacing[1]", "beforeAutospacing", "1" );
}
DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx") DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
{ {
xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml"); xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml");
......
...@@ -535,7 +535,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() ...@@ -535,7 +535,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
{ OUString(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { OUString(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, cppu::UnoType<bool>::get(), PropertyAttribute::MAYBEVOID, 0 }, \
{ OUString(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL,cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, 0}, \ { OUString(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL,cppu::UnoType<sal_Int16>::get(), PropertyAttribute::MAYBEVOID, 0}, \
{ OUString(UNO_NAME_HIDDEN), FN_UNO_HIDDEN, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, \ { OUString(UNO_NAME_HIDDEN), FN_UNO_HIDDEN, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, \
{ OUString(UNO_NAME_STYLE_INTEROP_GRAB_BAG), FN_UNO_STYLE_INTEROP_GRAB_BAG, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), PROPERTY_NONE, 0}, { OUString(UNO_NAME_STYLE_INTEROP_GRAB_BAG), FN_UNO_STYLE_INTEROP_GRAB_BAG, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), PROPERTY_NONE, 0}, \
{ OUString(UNO_NAME_PARA_INTEROP_GRAB_BAG), RES_PARATR_GRABBAG, cppu::UnoType< cppu::UnoSequenceType<css::beans::PropertyValue> >::get(), PROPERTY_NONE, 0},
#define COMMON_FLDTYP_PROPERTIES \ #define COMMON_FLDTYP_PROPERTIES \
{ OUString(UNO_NAME_IS_FIELD_USED), FIELD_PROP_IS_FIELD_USED, cppu::UnoType<float>::get(), PropertyAttribute::READONLY, 0},\ { OUString(UNO_NAME_IS_FIELD_USED), FIELD_PROP_IS_FIELD_USED, cppu::UnoType<float>::get(), PropertyAttribute::READONLY, 0},\
......
...@@ -1113,8 +1113,7 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable ) ...@@ -1113,8 +1113,7 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
// Don't add the style name properties // Don't add the style name properties
bool bIsParaStyleName = aPropValues[nProp].Name == "ParaStyleName"; bool bIsParaStyleName = aPropValues[nProp].Name == "ParaStyleName";
bool bIsCharStyleName = aPropValues[nProp].Name == "CharStyleName"; bool bIsCharStyleName = aPropValues[nProp].Name == "CharStyleName";
bool bIsParaInteropGrabBag = aPropValues[nProp].Name == "ParaInteropGrabBag"; if ( !bIsParaStyleName && !bIsCharStyleName )
if ( !bIsParaStyleName && !bIsCharStyleName && !bIsParaInteropGrabBag)
{ {
aSortedPropVals.Insert( aPropValues[nProp] ); aSortedPropVals.Insert( aPropValues[nProp] );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment