diff options
author | Rohit Deshmukh <rohit.deshmukh@synerzip.com> | 2014-01-06 11:26:46 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-01-24 08:43:08 +0000 |
commit | f1ec5dcfca45e9623d3da05503353df63e8dba4f (patch) | |
tree | 31b45d048744ef616c9f331fa311ea5b0ff690f8 | |
parent | 93a2279c267e8c017550c4fe435d8c2718405aa2 (diff) |
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>
-rw-r--r-- | filter/source/msfilter/eschesdo.cxx | 16 | ||||
-rw-r--r-- | filter/source/msfilter/eschesdo.hxx | 1 | ||||
-rw-r--r-- | filter/source/msfilter/util.cxx | 1 | ||||
-rw-r--r-- | include/filter/msfilter/escherex.hxx | 6 | ||||
-rw-r--r-- | include/oox/export/vmlexport.hxx | 2 | ||||
-rw-r--r-- | oox/source/export/vmlexport.cxx | 48 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo69616.docx | bin | 0 -> 22253 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 |
8 files changed, 64 insertions, 19 deletions
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index c5fb1936374a..afddce7af2fc 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -233,7 +233,10 @@ 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(); } @@ -686,7 +689,9 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, ImplFlipBoundingBox( rObj, aPropOpt ); aPropOpt.CreateShapeProperties( rObj.GetShapeRef() ); - mpEscherEx->Commit( aPropOpt, rObj.GetRect() ); + const SdrObject* sdrObj = rObj.GetSdrObject(); + mpEscherEx->AddSdrObjectVMLObject(*sdrObj ); + mpEscherEx->Commit( aPropOpt, rObj.GetRect()); if( mpEscherEx->GetGroupLevel() > 1 ) mpEscherEx->AddChildAnchor( rObj.GetRect() ); @@ -784,7 +789,9 @@ void ImplEESdrWriter::ImplWriteAdditionalText( ImplEESdrObject& rObj, } rObj.SetAngle( nAngle ); aPropOpt.CreateShapeProperties( rObj.GetShapeRef() ); - mpEscherEx->Commit( aPropOpt, rObj.GetRect() ); + const SdrObject* sdrObj = rObj.GetSdrObject(); + mpEscherEx->AddSdrObjectVMLObject(*sdrObj ); + mpEscherEx->Commit( aPropOpt, rObj.GetRect()); // write the childanchor mpEscherEx->AddChildAnchor( rObj.GetRect() ); @@ -1288,4 +1295,9 @@ bool ImplEESdrObject::GetOOXML() const return mbOOXML; } +void ImplEESdrObject::SetOOXML(bool bOOXML) +{ + mbOOXML = bOOXML; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx index 53f5705cb958..dd78abaf3b56 100644 --- a/filter/source/msfilter/eschesdo.hxx +++ b/filter/source/msfilter/eschesdo.hxx @@ -87,6 +87,7 @@ public: sal_uInt32 ImplGetText(); sal_Bool ImplHasText() const; bool GetOOXML() const; + void SetOOXML(bool bOOXML); }; diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 72e15dd0ab3e..a2b121c85227 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -1085,6 +1085,7 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] { "ooxml-cloudCallout", "cloudCallout" }, { "ooxml-callout1", "callout1" }, { "ooxml-ribbon", "ribbon" }, + { "ooxml-rect", "rectangle" }, }; static struct { diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx index d69e49d04674..70a017ae0759 100644 --- a/include/filter/msfilter/escherex.hxx +++ b/include/filter/msfilter/escherex.hxx @@ -1675,7 +1675,7 @@ public: // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!) virtual void AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlagIds, sal_uInt32 nShapeID = 0 ); - virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); + virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect); sal_uInt32 GetColor( const sal_uInt32 nColor, sal_Bool bSwap = sal_True ); sal_uInt32 GetColor( const Color& rColor, sal_Bool bSwap = sal_True ); @@ -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 diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index bc7bf294b09e..2b414c0d81be 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -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: diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 85003b7d5445..09600294042b 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -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,11 +389,11 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect nTop = it->nPropValue; rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft ); } - - m_pShapeAttrList->add( XML_coordorigin, - OStringBuffer( 20 ).append( sal_Int32( nLeft ) ) - .append( "," ).append( sal_Int32( nTop ) ) - .makeStringAndClear() ); + if(nTop!=0 && nLeft!=0) + m_pShapeAttrList->add( XML_coordorigin, + OStringBuffer( 20 ).append( sal_Int32( nLeft ) ) + .append( "," ).append( sal_Int32( nTop ) ) + .makeStringAndClear() ); } bAlreadyWritten[ ESCHER_Prop_geoLeft ] = true; bAlreadyWritten[ ESCHER_Prop_geoTop ] = true; @@ -414,10 +418,11 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect rProps.GetOpt( ESCHER_Prop_geoRight, nRight ); } - m_pShapeAttrList->add( XML_coordsize, - OStringBuffer( 20 ).append( sal_Int32( nRight ) - sal_Int32( nLeft ) ) - .append( "," ).append( sal_Int32( nBottom ) - sal_Int32( nTop ) ) - .makeStringAndClear() ); + 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 ) ) + .makeStringAndClear() ); } bAlreadyWritten[ ESCHER_Prop_geoRight ] = true; bAlreadyWritten[ ESCHER_Prop_geoBottom ] = true; @@ -451,7 +456,8 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect { sal_Int32 nX = impl_GetPointComponent( pVerticesIt, nPointSize ); sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nPointSize ); - aPath.append( "m" ).append( nX ).append( "," ).append( nY ); + if (nX >= 0 && nY >= 0 ) + aPath.append( "m" ).append( nX ).append( "," ).append( nY ); } break; case 0xb300: @@ -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); - aPath.append("l").append(nX).append(",").append(nY); + 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", diff --git a/sw/qa/extras/ooxmlexport/data/fdo69616.docx b/sw/qa/extras/ooxmlexport/data/fdo69616.docx Binary files differnew file mode 100644 index 000000000000..7c7f52e16865 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo69616.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 9ce53cb3d646..7c8fa7ea2b06 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -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(); |