Kaydet (Commit) 9746dc9a authored tarafından Markus Mohrhard's avatar Markus Mohrhard

fix ODF validation errors

Introduced by 7d9bb549

Change-Id: I09411486b93a031a0c405579d34d9e744b8002a7
üst 0879c444
...@@ -126,7 +126,8 @@ public: ...@@ -126,7 +126,8 @@ public:
bool Equals( const ::std::vector< XMLPropertyState >& aProperties1, bool Equals( const ::std::vector< XMLPropertyState >& aProperties1,
const ::std::vector< XMLPropertyState >& aProperties2 ) const; const ::std::vector< XMLPropertyState >& aProperties2 ) const;
/** fills the given attribute list with the items in the given set */ /** fills the given attribute list with the items in the given set
*/
void exportXML( void exportXML(
SvXMLAttributeList& rAttrList, SvXMLAttributeList& rAttrList,
const ::std::vector< XMLPropertyState >& rProperties, const ::std::vector< XMLPropertyState >& rProperties,
...@@ -149,12 +150,15 @@ public: ...@@ -149,12 +150,15 @@ public:
sal_uInt16 nFlags = 0 ) const; sal_uInt16 nFlags = 0 ) const;
/** like above but only properties whose property map index is within the /** like above but only properties whose property map index is within the
specified range are exported */ * specified range are exported
*
* @param bExtensionNamespace use the extension namespace for graphic-properties
*/
void exportXML( void exportXML(
SvXMLExport& rExport, SvXMLExport& rExport,
const ::std::vector< XMLPropertyState >& rProperties, const ::std::vector< XMLPropertyState >& rProperties,
sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx, sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
sal_uInt16 nFlags = 0 ) const; sal_uInt16 nFlags = 0, bool bExtensionNamespace = false ) const;
/** this method is called for every item that has the /** this method is called for every item that has the
MID_FLAG_ELEMENT_EXPORT flag set */ MID_FLAG_ELEMENT_EXPORT flag set */
......
...@@ -115,7 +115,7 @@ SvXMLImportContext *XMLChartStyleContext::CreateChildContext( ...@@ -115,7 +115,7 @@ SvXMLImportContext *XMLChartStyleContext::CreateChildContext(
{ {
SvXMLImportContext* pContext = NULL; SvXMLImportContext* pContext = NULL;
if( XML_NAMESPACE_STYLE == nPrefix ) if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
{ {
sal_uInt32 nFamily = 0; sal_uInt32 nFamily = 0;
if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
......
...@@ -57,7 +57,7 @@ SvXMLImportContext *XMLGraphicsDefaultStyle::CreateChildContext( sal_uInt16 nPre ...@@ -57,7 +57,7 @@ SvXMLImportContext *XMLGraphicsDefaultStyle::CreateChildContext( sal_uInt16 nPre
{ {
SvXMLImportContext *pContext = 0; SvXMLImportContext *pContext = 0;
if( XML_NAMESPACE_STYLE == nPrefix ) if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
{ {
sal_uInt32 nFamily = 0; sal_uInt32 nFamily = 0;
if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
......
...@@ -95,7 +95,7 @@ SvXMLImportContext *XMLShapeStyleContext::CreateChildContext( ...@@ -95,7 +95,7 @@ SvXMLImportContext *XMLShapeStyleContext::CreateChildContext(
{ {
SvXMLImportContext *pContext = 0; SvXMLImportContext *pContext = 0;
if( XML_NAMESPACE_STYLE == nPrefix ) if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
{ {
sal_uInt32 nFamily = 0; sal_uInt32 nFamily = 0;
if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
......
...@@ -685,10 +685,15 @@ void SvXMLAutoStylePoolP_Impl::exportXML( ...@@ -685,10 +685,15 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
XML_NAMESPACE_STYLE, XML_NAME, XML_NAMESPACE_STYLE, XML_NAME,
aExpStyles[i].mpProperties->GetName() ); aExpStyles[i].mpProperties->GetName() );
bool bExtensionNamespace = false;
if( rFamily.mbAsFamily ) if( rFamily.mbAsFamily )
{ {
GetExport().AddAttribute( GetExport().AddAttribute(
XML_NAMESPACE_STYLE, XML_FAMILY, aStrFamilyName ); XML_NAMESPACE_STYLE, XML_FAMILY, aStrFamilyName );
if(aStrFamilyName != "graphic" &&
aStrFamilyName != "presentation" &&
aStrFamilyName != "chart" )
bExtensionNamespace = true;
} }
if( !aExpStyles[i].mpParent->isEmpty() ) if( !aExpStyles[i].mpParent->isEmpty() )
...@@ -741,7 +746,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML( ...@@ -741,7 +746,7 @@ void SvXMLAutoStylePoolP_Impl::exportXML(
rFamily.mxMapper->exportXML( rFamily.mxMapper->exportXML(
GetExport(), GetExport(),
aExpStyles[i].mpProperties->GetProperties(), aExpStyles[i].mpProperties->GetProperties(),
nStart, nEnd, XML_EXPORT_FLAG_IGN_WS ); nStart, nEnd, XML_EXPORT_FLAG_IGN_WS, bExtensionNamespace );
pAntiImpl->exportStyleContent( pAntiImpl->exportStyleContent(
GetExport().GetDocHandler(), GetExport().GetDocHandler(),
......
...@@ -163,7 +163,7 @@ SvXMLImportContext *XMLPropStyleContext::CreateChildContext( ...@@ -163,7 +163,7 @@ SvXMLImportContext *XMLPropStyleContext::CreateChildContext(
SvXMLImportContext *pContext = 0; SvXMLImportContext *pContext = 0;
sal_uInt32 nFamily = 0; sal_uInt32 nFamily = 0;
if( XML_NAMESPACE_STYLE == nPrefix ) if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
{ {
if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) ) if( IsXMLToken( rLocalName, XML_GRAPHIC_PROPERTIES ) )
nFamily = XML_TYPE_PROP_GRAPHIC; nFamily = XML_TYPE_PROP_GRAPHIC;
......
...@@ -745,7 +745,7 @@ void SvXMLExportPropertyMapper::exportXML( ...@@ -745,7 +745,7 @@ void SvXMLExportPropertyMapper::exportXML(
SvXMLExport& rExport, SvXMLExport& rExport,
const ::std::vector< XMLPropertyState >& rProperties, const ::std::vector< XMLPropertyState >& rProperties,
sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx, sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx,
sal_uInt16 nFlags ) const sal_uInt16 nFlags, bool bExtensionNamespace ) const
{ {
sal_uInt16 nPropTypeFlags = 0; sal_uInt16 nPropTypeFlags = 0;
for( sal_uInt16 i=0; i<MAX_PROP_TYPES; ++i ) for( sal_uInt16 i=0; i<MAX_PROP_TYPES; ++i )
...@@ -766,7 +766,11 @@ void SvXMLExportPropertyMapper::exportXML( ...@@ -766,7 +766,11 @@ void SvXMLExportPropertyMapper::exportXML(
(nFlags & XML_EXPORT_FLAG_EMPTY) != 0 || (nFlags & XML_EXPORT_FLAG_EMPTY) != 0 ||
!aIndexArray.empty() ) !aIndexArray.empty() )
{ {
SvXMLElementExport aElem( rExport, XML_NAMESPACE_STYLE, 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, aPropTokens[i].eToken,
(nFlags & XML_EXPORT_FLAG_IGN_WS) != 0, (nFlags & XML_EXPORT_FLAG_IGN_WS) != 0,
false ); false );
......
...@@ -161,7 +161,7 @@ SvXMLImportContext *XMLTextShapeStyleContext::CreateChildContext( ...@@ -161,7 +161,7 @@ SvXMLImportContext *XMLTextShapeStyleContext::CreateChildContext(
{ {
SvXMLImportContext *pContext = 0; SvXMLImportContext *pContext = 0;
if( XML_NAMESPACE_STYLE == nPrefix ) if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
{ {
sal_uInt32 nFamily = 0; sal_uInt32 nFamily = 0;
if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) ) if( IsXMLToken( rLocalName, XML_TEXT_PROPERTIES ) )
......
...@@ -773,7 +773,7 @@ XMLTransformerContext *XMLStyleOASISTContext::CreateChildContext( ...@@ -773,7 +773,7 @@ XMLTransformerContext *XMLStyleOASISTContext::CreateChildContext(
{ {
XMLTransformerContext *pContext = 0; XMLTransformerContext *pContext = 0;
if( XML_NAMESPACE_STYLE == nPrefix ) if( XML_NAMESPACE_STYLE == nPrefix || XML_NAMESPACE_LO_EXT == nPrefix )
{ {
XMLPropType ePropType = XMLPropType ePropType =
XMLPropertiesTContext_Impl::GetPropType( rLocalName ); XMLPropertiesTContext_Impl::GetPropType( rLocalName );
......
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