Kaydet (Commit) 101cc7a8 authored tarafından Joren De Cuyper's avatar Joren De Cuyper Kaydeden (comit) Caolán McNamara

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/15668Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 8d74795e
......@@ -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;
......
......@@ -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
......
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