fdo#69616: Fix for VML part missing for group.

Cause:
 - In altenrate content, Fallback contains only group tag.
Implementation:
 - Added export logic in Vml export.
 - Added unit test case for vml group.

Change-Id: Ia1c9834950528dc892caea1cb675a7f42165d9ba
Reviewed-on: https://gerrit.libreoffice.org/7276
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Rohit Deshmukh 2014-01-06 11:26:46 +05:30 committed by Miklos Vajna
parent 93a2279c26
commit f1ec5dcfca
8 changed files with 64 additions and 19 deletions

View File

@ -233,8 +233,11 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
ImplEESdrObject aObj( *this, *(Reference< XShape >*)
xXIndexAccess->getByIndex( n ).getValue() );
if( aObj.IsValid() )
{
aObj.SetOOXML(bOOxmlExport);
ImplWriteShape( aObj, rSolverContainer, ePageType, bOOxmlExport );
}
}
mpEscherEx->LeaveGroup();
}
break;
@ -686,6 +689,8 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
ImplFlipBoundingBox( rObj, aPropOpt );
aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
const SdrObject* sdrObj = rObj.GetSdrObject();
mpEscherEx->AddSdrObjectVMLObject(*sdrObj );
mpEscherEx->Commit( aPropOpt, rObj.GetRect());
if( mpEscherEx->GetGroupLevel() > 1 )
mpEscherEx->AddChildAnchor( rObj.GetRect() );
@ -784,6 +789,8 @@ void ImplEESdrWriter::ImplWriteAdditionalText( ImplEESdrObject& rObj,
}
rObj.SetAngle( nAngle );
aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
const SdrObject* sdrObj = rObj.GetSdrObject();
mpEscherEx->AddSdrObjectVMLObject(*sdrObj );
mpEscherEx->Commit( aPropOpt, rObj.GetRect());
// write the childanchor
@ -1288,4 +1295,9 @@ bool ImplEESdrObject::GetOOXML() const
return mbOOXML;
}
void ImplEESdrObject::SetOOXML(bool bOOXML)
{
mbOOXML = bOOXML;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -87,6 +87,7 @@ public:
sal_uInt32 ImplGetText();
sal_Bool ImplHasText() const;
bool GetOOXML() const;
void SetOOXML(bool bOOXML);
};

View File

@ -1085,6 +1085,7 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
{ "ooxml-cloudCallout", "cloudCallout" },
{ "ooxml-callout1", "callout1" },
{ "ooxml-ribbon", "ribbon" },
{ "ooxml-rect", "rectangle" },
};
static struct {

View File

@ -1687,6 +1687,10 @@ public:
/// returns the ShapeID
sal_uInt32 AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false );
virtual void AddSdrObjectVMLObject( const SdrObject& /*rObj*/)
{
// Required for Exporting VML shape
}
/// If objects are written through AddSdrObject the
/// SolverContainer has to be written, and maybe some

View File

@ -89,6 +89,7 @@ public:
sal_uInt32 AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1,
sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
sal_Int16 eVRel = -1, const Point* pNdTopLeft = 0, const sal_Bool bOOxmlExport = false );
virtual void AddSdrObjectVMLObject( const SdrObject& rObj);
protected:
/// Add an attribute to the generated <v:shape/> element.
@ -109,7 +110,6 @@ protected:
///
/// The parameter is just what we got from StartShape().
virtual void EndShape( sal_Int32 nShapeElement );
virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
private:

View File

@ -175,7 +175,7 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uIn
{
m_nShapeType = nShapeType;
m_nShapeFlags = nShapeFlags;
m_pShapeAttrList->add( XML_name, ShapeIdString( nShapeId ) );
m_pShapeAttrList->add( XML_id, ShapeIdString( nShapeId ) );
}
@ -322,6 +322,10 @@ inline sal_Int32 impl_GetPointComponent( const sal_uInt8* &pVal, sal_uInt16 nPoi
return nRet;
}
void VMLExport::AddSdrObjectVMLObject( const SdrObject& rObj)
{
m_pSdrObject = &rObj;
}
void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect )
{
if ( m_nShapeType == ESCHER_ShpInst_Nil )
@ -385,7 +389,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
nTop = it->nPropValue;
rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft );
}
if(nTop!=0 && nLeft!=0)
m_pShapeAttrList->add( XML_coordorigin,
OStringBuffer( 20 ).append( sal_Int32( nLeft ) )
.append( "," ).append( sal_Int32( nTop ) )
@ -414,6 +418,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
rProps.GetOpt( ESCHER_Prop_geoRight, nRight );
}
if(nTop!=0 && nLeft!=0 && nBottom!=0 && nRight!=0 )
m_pShapeAttrList->add( XML_coordsize,
OStringBuffer( 20 ).append( sal_Int32( nRight ) - sal_Int32( nLeft ) )
.append( "," ).append( sal_Int32( nBottom ) - sal_Int32( nTop ) )
@ -451,6 +456,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
{
sal_Int32 nX = impl_GetPointComponent( pVerticesIt, nPointSize );
sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nPointSize );
if (nX >= 0 && nY >= 0 )
aPath.append( "m" ).append( nX ).append( "," ).append( nY );
}
break;
@ -495,14 +501,15 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
{
sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nPointSize);
sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nPointSize);
if (nX >= 0 && nY >= 0 )
aPath.append("l").append(nX).append(",").append(nY);
}
break;
}
}
if ( !aPath.isEmpty() )
m_pShapeAttrList->add( XML_path, aPath.getStr() );
OString pathString = aPath.makeStringAndClear();
if ( !aPath.isEmpty() && pathString != "xe" )
m_pShapeAttrList->add( XML_path, pathString );
}
#if OSL_DEBUG_LEVEL > 0
else
@ -774,6 +781,17 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
bAlreadyWritten[ESCHER_Prop_fNoLineDrawDash] = true;
}
break;
case ESCHER_Prop_wzName:
{
SvMemoryStream aStream;
aStream.Write(it->pBuf, it->nPropSize);
aStream.Seek(0);
OUString idStr = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true);
aStream.Seek(0);
m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, RTL_TEXTENCODING_UTF8));
bAlreadyWritten[ESCHER_Prop_wzName] = true;
}
break;
default:
#if OSL_DEBUG_LEVEL > 0
fprintf( stderr, "TODO VMLExport::Commit(), unimplemented id: %d, value: %" SAL_PRIuUINT32 ", data: [%" SAL_PRIuUINT32 ", %p]\n",

Binary file not shown.

View File

@ -2594,6 +2594,15 @@ DECLARE_OOXMLEXPORT_TEST(testFDO73546, "FDO73546.docx")
assertXPath(pXmlDoc, "/w:hdr/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor", "distL","0");
}
DECLARE_OOXMLEXPORT_TEST(testFdo69616, "fdo69616.docx")
{
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
// VML
CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Fallback/w:pict/v:group", "coordorigin").match("696,725"));
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();