summaryrefslogtreecommitdiff
path: root/emfio/source/emfuno/xemfparser.cxx
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2017-06-12 19:31:10 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-07-15 11:01:29 +0200
commit600a2aa24085cb972686b46061f9045785208a9e (patch)
tree33b323e9b28064d7faca98381d29a94324d78fa5 /emfio/source/emfuno/xemfparser.cxx
parent5868745db74ae930edb0058490076d82aaeafbe9 (diff)
emfplus: for convenience added fallback
For development and to not be dependent of the progress of the coming EMF+ importer, for now add fallback to using the old Metafile importer, plus conversion to primitive representation. That way the whole encapsulation is ready and can already be used Change-Id: I29afadaaaba71d75d0f5593852f4cc0cb3dd13f8
Diffstat (limited to 'emfio/source/emfuno/xemfparser.cxx')
-rw-r--r--emfio/source/emfuno/xemfparser.cxx41
1 files changed, 35 insertions, 6 deletions
diff --git a/emfio/source/emfuno/xemfparser.cxx b/emfio/source/emfuno/xemfparser.cxx
index ce18d4be3a3a..6fb27aadde23 100644
--- a/emfio/source/emfuno/xemfparser.cxx
+++ b/emfio/source/emfuno/xemfparser.cxx
@@ -31,6 +31,11 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <vcl/wmf.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
+
//#include <com/sun/star/xml/sax/XParser.hpp>
//#include <com/sun/star/xml/sax/Parser.hpp>
//#include <com/sun/star/xml/sax/InputSource.hpp>
@@ -114,12 +119,36 @@ namespace emfio
if (bTestCode)
{
- // for test, just create some graphic data
- const basegfx::B2DRange aRange(1000, 1000, 5000, 5000);
- const basegfx::BColor aColor(1.0, 0.0, 0.0);
- const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
-
- aRetval.push_back(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), aColor));
+ static bool bUseOldFilterEmbedded(true);
+
+ if (bUseOldFilterEmbedded)
+ {
+ GDIMetaFile aMtf;
+ std::unique_ptr<SvStream> pStream(::utl::UcbStreamHelper::CreateStream(xEmfStream));
+
+ if (pStream && ConvertWMFToGDIMetaFile(*pStream, aMtf, nullptr, nullptr))
+ {
+ const basegfx::B2DHomMatrix aMetafileTransform(
+ basegfx::tools::createScaleTranslateB2DHomMatrix(
+ 5000.0, 5000.0,
+ 1000.0, 1000.0));
+
+ aRetval.push_back(
+ new drawinglayer::primitive2d::MetafilePrimitive2D(
+ aMetafileTransform,
+ aMtf));
+ }
+ }
+
+ if(aRetval.empty())
+ {
+ // for test, just create some graphic data that will get visualized
+ const basegfx::B2DRange aRange(1000, 1000, 5000, 5000);
+ const basegfx::BColor aColor(1.0, 0.0, 0.0);
+ const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aRange));
+
+ aRetval.push_back(new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), aColor));
+ }
}
else
{