Kaydet (Commit) e3e2f691 authored tarafından Abhishek Shrivastava's avatar Abhishek Shrivastava Kaydeden (comit) Michael Stahl

tdf#106780 Fix for invalid attribute in impress ODF

This patch fixes the invalid ODF generated in impress.
In tables now the attribute is shown as table:name="default"
instead of "text:style-name".

For strict XML version we only set table:name="default"

For Extended/Compatibility XML we set both text:style-name
and table:name

Change-Id: I894fd31f5f0eed3f77b216b3114b5da53acf1f9f
Reviewed-on: https://gerrit.libreoffice.org/48373Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst bfc04bc4
...@@ -580,6 +580,8 @@ void XMLTableExport::exportTableTemplates() ...@@ -580,6 +580,8 @@ void XMLTableExport::exportTableTemplates()
for( sal_Int32 nIndex = 0; nIndex < xTableFamily->getCount(); nIndex++ ) try for( sal_Int32 nIndex = 0; nIndex < xTableFamily->getCount(); nIndex++ ) try
{ {
SvtSaveOptions::ODFSaneDefaultVersion eVersion = mrExport.getSaneDefaultVersion();
Reference< XStyle > xTableStyle( xTableFamily->getByIndex( nIndex ), UNO_QUERY_THROW ); Reference< XStyle > xTableStyle( xTableFamily->getByIndex( nIndex ), UNO_QUERY_THROW );
if( !xTableStyle->isInUse() ) if( !xTableStyle->isInUse() )
continue; continue;
...@@ -606,7 +608,20 @@ void XMLTableExport::exportTableTemplates() ...@@ -606,7 +608,20 @@ void XMLTableExport::exportTableTemplates()
} }
} }
else else
mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( xTableStyle->getName() ) ); {
// Below condition checks if any of the extended version of
// XML are set
if ((eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0)
{
mrExport.AddAttribute(XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( xTableStyle->getName() ) );
mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, GetExport().EncodeStyleName( xTableStyle->getName() ) );
}
else
{
mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, GetExport().EncodeStyleName( xTableStyle->getName() ) );
}
}
SvXMLElementExport tableTemplate( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_TEMPLATE, true, true ); SvXMLElementExport tableTemplate( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_TEMPLATE, true, true );
...@@ -631,7 +646,6 @@ void XMLTableExport::exportTableTemplates() ...@@ -631,7 +646,6 @@ void XMLTableExport::exportTableTemplates()
pElements++; pElements++;
} }
SvtSaveOptions::ODFSaneDefaultVersion eVersion = mrExport.getSaneDefaultVersion();
if (mbWriter && ((eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0)) if (mbWriter && ((eVersion & SvtSaveOptions::ODFSVER_EXTENDED) != 0))
{ {
pElements = getWriterSpecificTableStyleMap(); pElements = getWriterSpecificTableStyleMap();
......
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