[Libreoffice-commits] core.git: oox/source sw/qa
Joren De Cuyper
jorendc at libreoffice.org
Sat May 9 13:01:11 PDT 2015
oox/source/export/vmlexport.cxx | 77 +++++++--------
sw/qa/extras/ooxmlexport/data/NoFillAttrInImagedata.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 11 ++
3 files changed, 51 insertions(+), 37 deletions(-)
New commits:
commit 101cc7a8a471b50947ccca0711417b2c0f3ef574
Author: Joren De Cuyper <jorendc at libreoffice.org>
Date: Thu May 7 21:39:49 2015 +0200
Do not write v:fill properties on export of imagedata
See validation log of fdo73214:
ERROR cvc-complex-type.3.2.2: Attribute 'type' is not allowed to appear in element 'v:imagedata'.
ERROR cvc-complex-type.3.2.2: Attribute 'color2' is not allowed to appear in element 'v:imagedata'.
http://dev-builds.libreoffice.org/crashtest/d879d5346b525c478e93363b7ec06e797ce01461/validation/docx/fdo73214-1.docx.log
Change-Id: I99eacc05ed28c3cd848326fd08f3668a1ce0f4fb
Reviewed-on: https://gerrit.libreoffice.org/15668
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 570416d..a7ed878 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -562,39 +562,6 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
sal_uInt32 nValue;
sax_fastparser::FastAttributeList *pAttrList = FastSerializerHelper::createAttrList();
- if ( rProps.GetOpt( ESCHER_Prop_fillType, nValue ) )
- {
- const char *pFillType = NULL;
- switch ( nValue )
- {
- case ESCHER_FillSolid: pFillType = "solid"; break;
- // TODO case ESCHER_FillPattern: pFillType = ""; break;
- case ESCHER_FillTexture: pFillType = "tile"; break;
- // TODO case ESCHER_FillPicture: pFillType = ""; break;
- // TODO case ESCHER_FillShade: pFillType = ""; break;
- // TODO case ESCHER_FillShadeCenter: pFillType = ""; break;
- // TODO case ESCHER_FillShadeShape: pFillType = ""; break;
- // TODO case ESCHER_FillShadeScale: pFillType = ""; break;
- // TODO case ESCHER_FillShadeTitle: pFillType = ""; break;
- // TODO case ESCHER_FillBackground: pFillType = ""; break;
- default:
-#if OSL_DEBUG_LEVEL > 0
- fprintf( stderr, "TODO: unhandled fill type\n" );
-#endif
- break;
- }
- if ( pFillType )
- pAttrList->add( XML_type, pFillType );
- }
- else if (!rProps.GetOpt(ESCHER_Prop_fillColor, nValue))
- pAttrList->add( XML_on, "false" );
-
- if ( rProps.GetOpt( ESCHER_Prop_fillColor, nValue ) )
- impl_AddColor( m_pShapeAttrList, XML_fillcolor, nValue );
-
- if ( rProps.GetOpt( ESCHER_Prop_fillBackColor, nValue ) )
- impl_AddColor( pAttrList, XML_color2, nValue );
-
bool imageData = false;
EscherPropSortStruct aStruct;
if ( rProps.GetOpt( ESCHER_Prop_fillBlip, aStruct ) && m_pTextExport)
@@ -613,14 +580,50 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
if ( rProps.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) )
impl_AddBool( pAttrList, FSNS(XML_o, XML_detectmouseclick), nValue != 0 );
- if (rProps.GetOpt(ESCHER_Prop_fillOpacity, nValue))
- // Partly undo the transformation at the end of EscherPropertyContainer::CreateFillProperties(): VML opacity is 0..1.
- pAttrList->add(XML_opacity, OString::number(double((nValue * 100) >> 16) / 100));
-
if (imageData)
m_pSerializer->singleElementNS( XML_v, XML_imagedata, XFastAttributeListRef( pAttrList ) );
else
+ {
+ if ( rProps.GetOpt( ESCHER_Prop_fillType, nValue ) )
+ {
+ const char *pFillType = NULL;
+ switch ( nValue )
+ {
+ case ESCHER_FillSolid: pFillType = "solid"; break;
+ // TODO case ESCHER_FillPattern: pFillType = ""; break;
+ case ESCHER_FillTexture: pFillType = "tile"; break;
+ // TODO case ESCHER_FillPicture: pFillType = ""; break;
+ // TODO case ESCHER_FillShade: pFillType = ""; break;
+ // TODO case ESCHER_FillShadeCenter: pFillType = ""; break;
+ // TODO case ESCHER_FillShadeShape: pFillType = ""; break;
+ // TODO case ESCHER_FillShadeScale: pFillType = ""; break;
+ // TODO case ESCHER_FillShadeTitle: pFillType = ""; break;
+ // TODO case ESCHER_FillBackground: pFillType = ""; break;
+ default:
+ #if OSL_DEBUG_LEVEL > 0
+ fprintf( stderr, "TODO: unhandled fill type\n" );
+ #endif
+ break;
+ }
+ if ( pFillType )
+ pAttrList->add( XML_type, pFillType );
+ }
+ else if (!rProps.GetOpt(ESCHER_Prop_fillColor, nValue))
+ pAttrList->add( XML_on, "false" );
+
+ if ( rProps.GetOpt( ESCHER_Prop_fillColor, nValue ) )
+ impl_AddColor( m_pShapeAttrList, XML_fillcolor, nValue );
+
+ if ( rProps.GetOpt( ESCHER_Prop_fillBackColor, nValue ) )
+ impl_AddColor( pAttrList, XML_color2, nValue );
+
+
+ if (rProps.GetOpt(ESCHER_Prop_fillOpacity, nValue))
+ // Partly undo the transformation at the end of EscherPropertyContainer::CreateFillProperties(): VML opacity is 0..1.
+ pAttrList->add(XML_opacity, OString::number(double((nValue * 100) >> 16) / 100));
m_pSerializer->singleElementNS( XML_v, XML_fill, XFastAttributeListRef( pAttrList ) );
+
+ }
}
bAlreadyWritten[ ESCHER_Prop_fillType ] = true;
bAlreadyWritten[ ESCHER_Prop_fillColor ] = true;
diff --git a/sw/qa/extras/ooxmlexport/data/NoFillAttrInImagedata.docx b/sw/qa/extras/ooxmlexport/data/NoFillAttrInImagedata.docx
new file mode 100644
index 0000000..3819e79
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/NoFillAttrInImagedata.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 6a76477..a14388d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -1108,6 +1108,17 @@ DECLARE_OOXMLEXPORT_TEST(testTransparentShadow, "transparent-shadow.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int16(50), nShadowTransparence);
}
+DECLARE_OOXMLEXPORT_TEST(NoFillAttrInImagedata, "NoFillAttrInImagedata.docx")
+{
+ //problem was that type and color2 which are v:fill attributes were written in 'v:imagedata'
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Fallback/w:pict/v:rect/v:imagedata", "type", "");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Fallback/w:pict/v:rect/v:imagedata", "color2", "");
+}
+
DECLARE_OOXMLEXPORT_TEST(testBnc837302, "bnc837302.docx")
{
// The problem was that text with empty author was not inserted as a redline
More information about the Libreoffice-commits
mailing list