diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-06-09 19:55:17 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-07-15 11:01:29 +0200 |
commit | 83535a28c57ffb59f795dd35332d6b3426071e32 (patch) | |
tree | a35406c5ed8c7971681385cbb081aad325e1cf54 /svx | |
parent | 79f5cb620984c4d04d53a497e698472b2192d2bb (diff) |
emfplus: create a wmf/emf/emf+ primitive based importer
First steps to organize an importer that can read/interpret
wmf/emf/emf+ and deliver a primitive representation for
the content by parsing it. Use the same mechanisms as
already applied for Svg, so to reuse abilities to keep
original binary data to allow save again and embedding in
files and have an implemented replacement bitmap based
representation. For this, unify the used helper classes
to handle more than just Svg. For 1st try, add test code
and static bool switches
Change-Id: I6e0a82943541d811a8f8d65a84115569fcd8cee7
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/pch/precompiled_svxcore.hxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv2.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 34 | ||||
-rw-r--r-- | svx/source/svdraw/svdxcgv.cxx | 10 | ||||
-rw-r--r-- | svx/source/xoutdev/_xoutbmp.cxx | 10 |
6 files changed, 32 insertions, 32 deletions
diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx index 454ecd4aa586..c5f848d6af20 100644 --- a/svx/inc/pch/precompiled_svxcore.hxx +++ b/svx/inc/pch/precompiled_svxcore.hxx @@ -141,7 +141,7 @@ #include <vcl/settings.hxx> #include <vcl/spinfld.hxx> #include <vcl/svapp.hxx> -#include <vcl/svgdata.hxx> +#include <vcl/vectorgraphicdata.hxx> #include <vcl/syswin.hxx> #include <vcl/timer.hxx> #include <vcl/vclenum.hxx> diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index e100af7b72b4..08fbfa0caffe 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -604,7 +604,7 @@ void SdrEditView::CheckPossibilities() const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj); const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj); - if(pSdrGrafObj && ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) || pSdrGrafObj->isEmbeddedSvg())) + if(pSdrGrafObj && ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) || pSdrGrafObj->isEmbeddedVectorGraphicData())) { bImportMtfPossible = true; } diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index b26b34cc48a6..b97868fbf485 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -2000,8 +2000,8 @@ namespace { if (pGraf->HasGDIMetaFile()) return pGraf->GetTransformedGraphic(SdrGrafObjTransformsAttrs::COLOR|SdrGrafObjTransformsAttrs::MIRROR).GetGDIMetaFile(); - assert(pGraf->isEmbeddedSvg()); - return pGraf->getMetafileFromEmbeddedSvg(); + assert(pGraf->isEmbeddedVectorGraphicData()); + return pGraf->getMetafileFromEmbeddedVectorGraphicData(); } } @@ -2039,7 +2039,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) sal_uIntPtr nInsAnz=0; tools::Rectangle aLogicRect; - if (pGraf && (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedSvg())) + if (pGraf && (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedVectorGraphicData())) { GDIMetaFile aMetaFile(GetMetaFile(pGraf)); if(aMetaFile.GetActionSize()) diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index d0f042ca0b71..0bf050507bd5 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -285,12 +285,12 @@ void SdrGrafObj::onGraphicChanged() if (!pGraphic || pGraphic->IsSwappedOut()) // don't force swap-in for this return; - const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + const VectorGraphicDataPtr& rVectorGraphicDataPtr = pGraphic->GetGraphic().getVectorGraphicData(); - if (!rSvgDataPtr.get()) + if (!rVectorGraphicDataPtr.get()) return; - const drawinglayer::primitive2d::Primitive2DContainer aSequence(rSvgDataPtr->getPrimitive2DSequence()); + const drawinglayer::primitive2d::Primitive2DContainer aSequence(rVectorGraphicDataPtr->getPrimitive2DSequence()); if (aSequence.empty()) return; @@ -432,11 +432,11 @@ const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const { if(!mpReplacementGraphic && pGraphic) { - const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + const VectorGraphicDataPtr& rVectorGraphicDataPtr = pGraphic->GetGraphic().getVectorGraphicData(); - if(rSvgDataPtr.get()) + if(rVectorGraphicDataPtr.get()) { - const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement()); + const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rVectorGraphicDataPtr->getReplacement()); } else if (pGraphic->GetGraphic().getPdfData().hasElements()) { @@ -742,11 +742,11 @@ OUString SdrGrafObj::TakeObjNameSingul() const if (!pGraphic) return OUString(); - const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + const VectorGraphicDataPtr& rVectorGraphicDataPtr = pGraphic->GetGraphic().getVectorGraphicData(); OUStringBuffer sName; - if(rSvgDataPtr.get()) + if(rVectorGraphicDataPtr.get()) { sName.append(ImpGetResStr(STR_ObjNameSingulGRAFSVG)); } @@ -795,11 +795,11 @@ OUString SdrGrafObj::TakeObjNamePlural() const if(!pGraphic) return OUString(); - const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + const VectorGraphicDataPtr& rVectorGraphicDataPtr = pGraphic->GetGraphic().getVectorGraphicData(); OUStringBuffer sName; - if(rSvgDataPtr.get()) + if(rVectorGraphicDataPtr.get()) { sName.append(ImpGetResStr(STR_ObjNamePluralGRAFSVG)); } @@ -1030,16 +1030,16 @@ bool SdrGrafObj::HasGDIMetaFile() const return( pGraphic->GetType() == GraphicType::GdiMetafile ); } -bool SdrGrafObj::isEmbeddedSvg() const +bool SdrGrafObj::isEmbeddedVectorGraphicData() const { - return GraphicType::Bitmap == GetGraphicType() && GetGraphic().getSvgData().get(); + return GraphicType::Bitmap == GetGraphicType() && GetGraphic().getVectorGraphicData().get(); } -GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const +GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedVectorGraphicData() const { GDIMetaFile aRetval; - if(isEmbeddedSvg() && GetModel()) + if(isEmbeddedVectorGraphicData() && GetModel()) { ScopedVclPtrInstance< VirtualDevice > pOut; const tools::Rectangle aBoundRect(GetCurrentBoundRect()); @@ -1061,15 +1061,15 @@ GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const GDIMetaFile SdrGrafObj::GetMetaFile(GraphicType &rGraphicType) const { - if (isEmbeddedSvg()) + if (isEmbeddedVectorGraphicData()) { - // Embedded Svg + // Embedded Vector Graphic Data // There is currently no helper to create SdrObjects from primitives (even if I'm thinking // about writing one for some time). To get the roundtrip to SdrObjects it is necessary to // use the old converter path over the MetaFile mechanism. Create Metafile from Svg // primitives here pretty directly rGraphicType = GraphicType::GdiMetafile; - return getMetafileFromEmbeddedSvg(); + return getMetafileFromEmbeddedVectorGraphicData(); } else if (GraphicType::GdiMetafile == rGraphicType) { diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 3a440970b953..f4b9a6482084 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -47,7 +47,7 @@ #include <vcl/virdev.hxx> #include <svl/style.hxx> #include <fmobj.hxx> -#include <vcl/svgdata.hxx> +#include <vcl/vectorgraphicdata.hxx> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <drawinglayer/primitive2d/groupprimitive2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> @@ -462,9 +462,9 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked) const { const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(GetMarkedObjectByIndex(0)); - if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg()) + if(pSdrGrafObj && pSdrGrafObj->isEmbeddedVectorGraphicData()) { - aBmp = pSdrGrafObj->GetGraphic().getSvgData()->getReplacement(); + aBmp = pSdrGrafObj->GetGraphic().getVectorGraphicData()->getReplacement(); } } } @@ -608,10 +608,10 @@ Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject* if(pSdrGrafObj) { - if(pSdrGrafObj->isEmbeddedSvg()) + if(pSdrGrafObj->isEmbeddedVectorGraphicData()) { // get Metafile for Svg content - aRet = pSdrGrafObj->getMetafileFromEmbeddedSvg(); + aRet = pSdrGrafObj->getMetafileFromEmbeddedVectorGraphicData(); } else { diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index a611baff4bf8..db5474ecf63c 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -147,11 +147,11 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, aURL.setBase( aName ); } - // #i121128# use shortcut to write SVG data in original form (if possible) - const SvgDataPtr& aSvgDataPtr(rGraphic.getSvgData()); + // #i121128# use shortcut to write Vector Graphic Data data in original form (if possible) + const VectorGraphicDataPtr& aVectorGraphicDataPtr(rGraphic.getVectorGraphicData()); - if(aSvgDataPtr.get() - && aSvgDataPtr->getSvgDataArrayLength() + if(aVectorGraphicDataPtr.get() + && aVectorGraphicDataPtr->getVectorGraphicDataArrayLength() && rFilterName.equalsIgnoreAsciiCase("svg")) { if(!(nFlags & XOutFlags::DontAddExtension)) @@ -165,7 +165,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName, if(pOStm) { - pOStm->WriteBytes(aSvgDataPtr->getSvgDataArray().getConstArray(), aSvgDataPtr->getSvgDataArrayLength()); + pOStm->WriteBytes(aVectorGraphicDataPtr->getVectorGraphicDataArray().getConstArray(), aVectorGraphicDataPtr->getVectorGraphicDataArrayLength()); aMedium.Commit(); if(!aMedium.GetError()) |