summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emfio/Library_emfio.mk1
-rw-r--r--emfio/source/emfuno/xemfparser.cxx41
-rw-r--r--include/vcl/wmf.hxx3
3 files changed, 38 insertions, 7 deletions
diff --git a/emfio/Library_emfio.mk b/emfio/Library_emfio.mk
index c0a2dc2d42ff..e9a14249271a 100644
--- a/emfio/Library_emfio.mk
+++ b/emfio/Library_emfio.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_use_libraries,emfio,\
sax \
vcl \
svt \
+ utl \
))
$(eval $(call gb_Library_add_exception_objects,emfio,\
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
{
diff --git a/include/vcl/wmf.hxx b/include/vcl/wmf.hxx
index bea47d225052..67d6aa4f122b 100644
--- a/include/vcl/wmf.hxx
+++ b/include/vcl/wmf.hxx
@@ -55,7 +55,8 @@ struct WMF_EXTERNALHEADER
}
};
-bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_EXTERNALHEADER *pExtHeader );
+// for 1st test, export
+VCL_DLLPUBLIC bool ConvertWMFToGDIMetaFile( SvStream & rStreamWMF, GDIMetaFile & rGDIMetaFile, FilterConfigItem* pConfigItem, WMF_EXTERNALHEADER *pExtHeader );
VCL_DLLPUBLIC bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF );