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:
committed by
Miklos Vajna
parent
93a2279c26
commit
f1ec5dcfca
@@ -233,8 +233,11 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
|
|||||||
ImplEESdrObject aObj( *this, *(Reference< XShape >*)
|
ImplEESdrObject aObj( *this, *(Reference< XShape >*)
|
||||||
xXIndexAccess->getByIndex( n ).getValue() );
|
xXIndexAccess->getByIndex( n ).getValue() );
|
||||||
if( aObj.IsValid() )
|
if( aObj.IsValid() )
|
||||||
|
{
|
||||||
|
aObj.SetOOXML(bOOxmlExport);
|
||||||
ImplWriteShape( aObj, rSolverContainer, ePageType, bOOxmlExport );
|
ImplWriteShape( aObj, rSolverContainer, ePageType, bOOxmlExport );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mpEscherEx->LeaveGroup();
|
mpEscherEx->LeaveGroup();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -686,6 +689,8 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
|
|||||||
ImplFlipBoundingBox( rObj, aPropOpt );
|
ImplFlipBoundingBox( rObj, aPropOpt );
|
||||||
|
|
||||||
aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
|
aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
|
||||||
|
const SdrObject* sdrObj = rObj.GetSdrObject();
|
||||||
|
mpEscherEx->AddSdrObjectVMLObject(*sdrObj );
|
||||||
mpEscherEx->Commit( aPropOpt, rObj.GetRect());
|
mpEscherEx->Commit( aPropOpt, rObj.GetRect());
|
||||||
if( mpEscherEx->GetGroupLevel() > 1 )
|
if( mpEscherEx->GetGroupLevel() > 1 )
|
||||||
mpEscherEx->AddChildAnchor( rObj.GetRect() );
|
mpEscherEx->AddChildAnchor( rObj.GetRect() );
|
||||||
@@ -784,6 +789,8 @@ void ImplEESdrWriter::ImplWriteAdditionalText( ImplEESdrObject& rObj,
|
|||||||
}
|
}
|
||||||
rObj.SetAngle( nAngle );
|
rObj.SetAngle( nAngle );
|
||||||
aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
|
aPropOpt.CreateShapeProperties( rObj.GetShapeRef() );
|
||||||
|
const SdrObject* sdrObj = rObj.GetSdrObject();
|
||||||
|
mpEscherEx->AddSdrObjectVMLObject(*sdrObj );
|
||||||
mpEscherEx->Commit( aPropOpt, rObj.GetRect());
|
mpEscherEx->Commit( aPropOpt, rObj.GetRect());
|
||||||
|
|
||||||
// write the childanchor
|
// write the childanchor
|
||||||
@@ -1288,4 +1295,9 @@ bool ImplEESdrObject::GetOOXML() const
|
|||||||
return mbOOXML;
|
return mbOOXML;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImplEESdrObject::SetOOXML(bool bOOXML)
|
||||||
|
{
|
||||||
|
mbOOXML = bOOXML;
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -87,6 +87,7 @@ public:
|
|||||||
sal_uInt32 ImplGetText();
|
sal_uInt32 ImplGetText();
|
||||||
sal_Bool ImplHasText() const;
|
sal_Bool ImplHasText() const;
|
||||||
bool GetOOXML() const;
|
bool GetOOXML() const;
|
||||||
|
void SetOOXML(bool bOOXML);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1085,6 +1085,7 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
|
|||||||
{ "ooxml-cloudCallout", "cloudCallout" },
|
{ "ooxml-cloudCallout", "cloudCallout" },
|
||||||
{ "ooxml-callout1", "callout1" },
|
{ "ooxml-callout1", "callout1" },
|
||||||
{ "ooxml-ribbon", "ribbon" },
|
{ "ooxml-ribbon", "ribbon" },
|
||||||
|
{ "ooxml-rect", "rectangle" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
@@ -1687,6 +1687,10 @@ public:
|
|||||||
|
|
||||||
/// returns the ShapeID
|
/// returns the ShapeID
|
||||||
sal_uInt32 AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false );
|
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
|
/// If objects are written through AddSdrObject the
|
||||||
/// SolverContainer has to be written, and maybe some
|
/// SolverContainer has to be written, and maybe some
|
||||||
|
@@ -89,6 +89,7 @@ public:
|
|||||||
sal_uInt32 AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1,
|
sal_uInt32 AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1,
|
||||||
sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
|
sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
|
||||||
sal_Int16 eVRel = -1, const Point* pNdTopLeft = 0, const sal_Bool bOOxmlExport = false );
|
sal_Int16 eVRel = -1, const Point* pNdTopLeft = 0, const sal_Bool bOOxmlExport = false );
|
||||||
|
virtual void AddSdrObjectVMLObject( const SdrObject& rObj);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Add an attribute to the generated <v:shape/> element.
|
/// Add an attribute to the generated <v:shape/> element.
|
||||||
@@ -109,7 +110,6 @@ protected:
|
|||||||
///
|
///
|
||||||
/// The parameter is just what we got from StartShape().
|
/// The parameter is just what we got from StartShape().
|
||||||
virtual void EndShape( sal_Int32 nShapeElement );
|
virtual void EndShape( sal_Int32 nShapeElement );
|
||||||
|
|
||||||
virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
|
virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -175,7 +175,7 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uIn
|
|||||||
{
|
{
|
||||||
m_nShapeType = nShapeType;
|
m_nShapeType = nShapeType;
|
||||||
m_nShapeFlags = nShapeFlags;
|
m_nShapeFlags = nShapeFlags;
|
||||||
|
m_pShapeAttrList->add( XML_name, ShapeIdString( nShapeId ) );
|
||||||
m_pShapeAttrList->add( XML_id, 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;
|
return nRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VMLExport::AddSdrObjectVMLObject( const SdrObject& rObj)
|
||||||
|
{
|
||||||
|
m_pSdrObject = &rObj;
|
||||||
|
}
|
||||||
void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect )
|
void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect )
|
||||||
{
|
{
|
||||||
if ( m_nShapeType == ESCHER_ShpInst_Nil )
|
if ( m_nShapeType == ESCHER_ShpInst_Nil )
|
||||||
@@ -385,7 +389,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
|
|||||||
nTop = it->nPropValue;
|
nTop = it->nPropValue;
|
||||||
rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft );
|
rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft );
|
||||||
}
|
}
|
||||||
|
if(nTop!=0 && nLeft!=0)
|
||||||
m_pShapeAttrList->add( XML_coordorigin,
|
m_pShapeAttrList->add( XML_coordorigin,
|
||||||
OStringBuffer( 20 ).append( sal_Int32( nLeft ) )
|
OStringBuffer( 20 ).append( sal_Int32( nLeft ) )
|
||||||
.append( "," ).append( sal_Int32( nTop ) )
|
.append( "," ).append( sal_Int32( nTop ) )
|
||||||
@@ -414,6 +418,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
|
|||||||
rProps.GetOpt( ESCHER_Prop_geoRight, nRight );
|
rProps.GetOpt( ESCHER_Prop_geoRight, nRight );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(nTop!=0 && nLeft!=0 && nBottom!=0 && nRight!=0 )
|
||||||
m_pShapeAttrList->add( XML_coordsize,
|
m_pShapeAttrList->add( XML_coordsize,
|
||||||
OStringBuffer( 20 ).append( sal_Int32( nRight ) - sal_Int32( nLeft ) )
|
OStringBuffer( 20 ).append( sal_Int32( nRight ) - sal_Int32( nLeft ) )
|
||||||
.append( "," ).append( sal_Int32( nBottom ) - sal_Int32( nTop ) )
|
.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 nX = impl_GetPointComponent( pVerticesIt, nPointSize );
|
||||||
sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nPointSize );
|
sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nPointSize );
|
||||||
|
if (nX >= 0 && nY >= 0 )
|
||||||
aPath.append( "m" ).append( nX ).append( "," ).append( nY );
|
aPath.append( "m" ).append( nX ).append( "," ).append( nY );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -495,14 +501,15 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
|
|||||||
{
|
{
|
||||||
sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nPointSize);
|
sal_Int32 nX = impl_GetPointComponent(pVerticesIt, nPointSize);
|
||||||
sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nPointSize);
|
sal_Int32 nY = impl_GetPointComponent(pVerticesIt, nPointSize);
|
||||||
|
if (nX >= 0 && nY >= 0 )
|
||||||
aPath.append("l").append(nX).append(",").append(nY);
|
aPath.append("l").append(nX).append(",").append(nY);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OString pathString = aPath.makeStringAndClear();
|
||||||
if ( !aPath.isEmpty() )
|
if ( !aPath.isEmpty() && pathString != "xe" )
|
||||||
m_pShapeAttrList->add( XML_path, aPath.getStr() );
|
m_pShapeAttrList->add( XML_path, pathString );
|
||||||
}
|
}
|
||||||
#if OSL_DEBUG_LEVEL > 0
|
#if OSL_DEBUG_LEVEL > 0
|
||||||
else
|
else
|
||||||
@@ -774,6 +781,17 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
|
|||||||
bAlreadyWritten[ESCHER_Prop_fNoLineDrawDash] = true;
|
bAlreadyWritten[ESCHER_Prop_fNoLineDrawDash] = true;
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
#if OSL_DEBUG_LEVEL > 0
|
#if OSL_DEBUG_LEVEL > 0
|
||||||
fprintf( stderr, "TODO VMLExport::Commit(), unimplemented id: %d, value: %" SAL_PRIuUINT32 ", data: [%" SAL_PRIuUINT32 ", %p]\n",
|
fprintf( stderr, "TODO VMLExport::Commit(), unimplemented id: %d, value: %" SAL_PRIuUINT32 ", data: [%" SAL_PRIuUINT32 ", %p]\n",
|
||||||
|
BIN
sw/qa/extras/ooxmlexport/data/fdo69616.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/fdo69616.docx
Normal file
Binary file not shown.
@@ -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");
|
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
|
#endif
|
||||||
|
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
Reference in New Issue
Block a user