xmloff: ODF export: actually ODF 1.2 does not allow graphic-properties
... in a style with family "paragraph", as detected by a --with-export-validation build due to the unit test added yesterday. So use the loext namespace for the style:graphic-properties element, and also omit it entirely (and rely on the style:paragraph-properties attributes fo:background-*) if the ODF version is set to 1.2 or 1.1. Also adapt a previous check that was missing the "drawing-page" style family, where the style:graphic-properties is allowed (commit 9746dc9ad62e7f3a39961733f2ac204e90289034) (regression from 7d9bb549d498d6beed2c4050c402d09643febdfa) Change-Id: Iedd66483f63020328bd61e1c1e19c62787b8ff6b
This commit is contained in:
parent
7e373e92fc
commit
b1922eecb5
@ -133,7 +133,8 @@ public:
|
||||
void exportXML(
|
||||
SvXMLExport& rExport,
|
||||
const ::std::vector< XMLPropertyState >& rProperties,
|
||||
SvXmlExportFlags nFlags = SvXmlExportFlags::NONE ) const;
|
||||
SvXmlExportFlags nFlags = SvXmlExportFlags::NONE,
|
||||
bool bUseExtensionNamespaceForGraphicProperties = false ) const;
|
||||
|
||||
/** like above but only properties whose property map index is within the
|
||||
* specified range are exported
|
||||
|
@ -684,6 +684,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
|
||||
GetExport().AddAttribute(
|
||||
XML_NAMESPACE_STYLE, XML_FAMILY, aStrFamilyName );
|
||||
if(aStrFamilyName != "graphic" &&
|
||||
aStrFamilyName != "drawing-page" &&
|
||||
aStrFamilyName != "presentation" &&
|
||||
aStrFamilyName != "chart" )
|
||||
bExtensionNamespace = true;
|
||||
|
@ -316,8 +316,14 @@ bool XMLStyleExport::exportStyle(
|
||||
// <style:properties>
|
||||
::std::vector< XMLPropertyState > xPropStates =
|
||||
rPropMapper->Filter( xPropSet, true );
|
||||
bool const bUseExtensionNamespaceForGraphicProperties(
|
||||
rXMLFamily != "drawing-page" &&
|
||||
rXMLFamily != "graphic" &&
|
||||
rXMLFamily != "presentation" &&
|
||||
rXMLFamily != "chart");
|
||||
rPropMapper->exportXML( GetExport(), xPropStates,
|
||||
SvXmlExportFlags::IGN_WS );
|
||||
SvXmlExportFlags::IGN_WS,
|
||||
bUseExtensionNamespaceForGraphicProperties );
|
||||
|
||||
rPropMapper->SetStyleName( OUString() );
|
||||
|
||||
|
@ -749,16 +749,18 @@ void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList,
|
||||
void SvXMLExportPropertyMapper::exportXML(
|
||||
SvXMLExport& rExport,
|
||||
const ::std::vector< XMLPropertyState >& rProperties,
|
||||
SvXmlExportFlags nFlags ) const
|
||||
SvXmlExportFlags nFlags,
|
||||
bool bUseExtensionNamespaceForGraphicProperties) const
|
||||
{
|
||||
exportXML( rExport, rProperties, -1, -1, nFlags );
|
||||
exportXML(rExport, rProperties, -1, -1, nFlags, bUseExtensionNamespaceForGraphicProperties);
|
||||
}
|
||||
|
||||
|
||||
void SvXMLExportPropertyMapper::exportXML(
|
||||
SvXMLExport& rExport,
|
||||
const ::std::vector< XMLPropertyState >& rProperties,
|
||||
sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
|
||||
SvXmlExportFlags nFlags, bool bExtensionNamespace ) const
|
||||
SvXmlExportFlags nFlags, bool bUseExtensionNamespaceForGraphicProperties) const
|
||||
{
|
||||
sal_uInt16 nPropTypeFlags = 0;
|
||||
for( sal_uInt16 i=0; i<MAX_PROP_TYPES; ++i )
|
||||
@ -766,6 +768,17 @@ void SvXMLExportPropertyMapper::exportXML(
|
||||
sal_uInt16 nPropType = aPropTokens[i].nType;
|
||||
if( 0==i || (nPropTypeFlags & (1 << nPropType)) != 0 )
|
||||
{
|
||||
sal_uInt16 nNamespace = XML_NAMESPACE_STYLE;
|
||||
if (bUseExtensionNamespaceForGraphicProperties &&
|
||||
aPropTokens[i].eToken == xmloff::token::XML_GRAPHIC_PROPERTIES)
|
||||
{
|
||||
nNamespace = XML_NAMESPACE_LO_EXT;
|
||||
if (rExport.getDefaultVersion() <= SvtSaveOptions::ODFVER_012)
|
||||
{
|
||||
continue; // don't write for ODF <= 1.2
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<sal_uInt16> aIndexArray;
|
||||
|
||||
_exportXML( nPropType, nPropTypeFlags,
|
||||
@ -779,10 +792,6 @@ void SvXMLExportPropertyMapper::exportXML(
|
||||
(nFlags & SvXmlExportFlags::EMPTY) ||
|
||||
!aIndexArray.empty() )
|
||||
{
|
||||
sal_uInt16 nNamespace = XML_NAMESPACE_STYLE;
|
||||
if(bExtensionNamespace && aPropTokens[i].eToken ==
|
||||
xmloff::token::XML_GRAPHIC_PROPERTIES)
|
||||
nNamespace = XML_NAMESPACE_LO_EXT;
|
||||
SvXMLElementExport aElem( rExport, nNamespace,
|
||||
aPropTokens[i].eToken,
|
||||
bool(nFlags & SvXmlExportFlags::IGN_WS),
|
||||
|
Loading…
x
Reference in New Issue
Block a user