[Libreoffice-commits] core.git: Branch 'feature/emfplusprimitiveparser' - 879 commits - accessibility/inc accessibility/source android/Bootstrap android/source avmedia/source basctl/inc basctl/source basctl/uiconfig basegfx/source basegfx/test basic/inc basic/qa basic/source bin/distro-install-desktop-integration bin/distro-install-sdk bin/findunusedcode bin/gbuild-to-ide bin/gbuild-to-ideNS bin/generate-bash-completion bin/generate-bash-completion.py bin/gen-iwyu-dummy-lib bin/update_pch bridges/Library_cpp_uno.mk bridges/source canvas/source chart2/inc chart2/Module_chart2.mk chart2/qa chart2/source chart2/uiconfig cli_ure/source codemaker/Module_codemaker.mk codemaker/source comphelper/source compilerplugins/clang config_host.mk.in configmgr/source configure.ac connectivity/source cppcanvas/inc cppcanvas/source cppuhelper/source cppu/qa cppu/source cpputools/source cui/inc cui/Library_cui.mk cui/source cui/uiconfig dbaccess/inc dbaccess/Module_dbaccess.mk dbaccess/source dbaccess/uiconfig desk top/inc desktop/qa desktop/source desktop/unx distro-configs/LibreOfficeFlatpak.conf download.lst drawinglayer/inc drawinglayer/Library_drawinglayer.mk drawinglayer/qa drawinglayer/source dtrans/source editeng/CppunitTest_editeng_core.mk editeng/inc editeng/qa editeng/source embeddedobj/Library_embobj.mk embeddedobj/source embedserv/source emfio/CppunitTest_emfio_emf_test.mk emfio/CppunitTest_emfio_wmf_test.mk emfio/emfio.component emfio/inc emfio/Library_emfio.mk emfio/Makefile emfio/Module_emfio.mk emfio/qa emfio/README emfio/source extensions/Library_abp.mk extensions/Library_dbp.mk extensions/qa extensions/source extensions/uiconfig external/boost external/expat external/fontconfig external/graphite external/harfbuzz external/hunspell external/icu external/jpeg-turbo external/lcms2 external/libatomic_ops external/libexttextcat external/liborcus external/libwpd external/libxmlsec external/lpsolve external/Module_external.mk external/pdfium external/poppler extras/source filter/qa filter/source forms/source formula/source fpicker/source framework/inc framework/source framework/uiconfig .gitignore helpcompiler/source helpcontent2 hwpfilter/source i18nlangtag/qa i18nlangtag/source i18npool/inc i18npool/qa i18npool/source i18nutil/source icon-themes/breeze icon-themes/galaxy idlc/inc idlc/source idl/inc idl/source include/basic include/canvas include/comphelper include/connectivity include/cppcanvas include/cppuhelper include/dbaccess include/desktop include/drawinglayer include/editeng include/filter include/formula include/i18nlangtag include/o3tl include/oox include/osl include/sal include/sax include/sfx2 include/svl include/svtools include/svx include/test include/toolkit include/tools include/uno include/unotools include/vbahelper include/vcl include/xmloff instsetoo_native/inc_common ios/experimental io/source javaunohelper/com jurt/com jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/source libreofficekit/qa libreofficekit/source lingucomponent/sour ce linguistic/source lotuswordpro/source Makefile.fetch Makefile.in mysqlc/source offapi/com offapi/UnoApi_offapi.mk officecfg/registry onlineupdate/qa onlineupdate/source oovbaapi/ooo oox/inc oox/Library_oox.mk oox/qa oox/source opencl/source package/source postprocess/packimages postprocess/Rdb_services.mk qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests registry/source registry/test reportbuilder/java reportdesign/inc reportdesign/source reportdesign/uiconfig RepositoryExternal.mk Repository.mk RepositoryModule_build.mk RepositoryModule_host.mk rsc/inc rsc/source salhelper/Module_salhelper.mk sal/osl sal/qa sal/rtl sal/textenc sax/inc sax/qa sax/source sax/test scaddins/source sc/CppunitTest_sc_cellobj.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_sc.mk sc/Module_sc.mk

Armin Le Grand Armin.Le.Grand at cib.de
Thu Jul 13 12:45:30 UTC 2017


Rebased ref, commits from common ancestor:
commit d0c846aee06f81a2a743cc56d2ee34f8f4f67b78
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Mon Jun 26 10:08:00 2017 +0200

    emfplus: corrections for UnitTest in vcl
    
    The CppunitTest_vcl_filters_test was not working due
    to a wmf file now being loadable. This leaded to better
    check errors on stream and react on it in test code.
    Hrad to find since that test - for whatever reason - is
    not executed on win. Also need to check result of
    EmfReader. Added emfio to test's module list
    
    Change-Id: Iea2b835408e919a8456e8f178cbfc782885ffebb

diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index ccef93ce673f..63b6eb51c2d7 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -83,7 +83,7 @@ void Test::checkRectPrimitive(Primitive2DSequence& rPrimitive)
 
 void Test::testWorking()
 {
-    Primitive2DSequence aSequenceRect = parseEmf("/emfio/qa/cppunit/data/fdo79679-2.emf");
+    Primitive2DSequence aSequenceRect = parseEmf("/emfio/qa/cppunit/emf/data/fdo79679-2.emf");
     CPPUNIT_ASSERT_EQUAL(1, (int) aSequenceRect.getLength());
     checkRectPrimitive(aSequenceRect);
 }
diff --git a/emfio/source/emfuno/xemfparser.cxx b/emfio/source/emfuno/xemfparser.cxx
index ff4dcccb6589..32a2bc1a86ef 100644
--- a/emfio/source/emfuno/xemfparser.cxx
+++ b/emfio/source/emfuno/xemfparser.cxx
@@ -136,62 +136,73 @@ namespace emfio
                 pStream->ReadUInt32(nMetaType);
                 pStream->Seek(nOrgPos);
 
+                bool bReadError(false);
+
                 if (nMetaType == 0x464d4520)
                 {
-                    emfio::EmfReader(*pStream, aMtf).ReadEnhWMF();
+                    // read and get possible failure/error, ReadEnhWMF returns success
+                    bReadError = !emfio::EmfReader(*pStream, aMtf).ReadEnhWMF();
                 }
                 else
                 {
                     emfio::WmfReader(*pStream, aMtf, bExternalHeaderUsed ? &aExternalHeader : nullptr).ReadWMF();
+
+                    // Need to check for ErrCode at stream to not lose former work.
+                    // This may contain important information and will behave the
+                    // same as before. When we have an error, do not create content
+                    ErrCode aErrCode(pStream->GetError());
+
+                    bReadError = aErrCode.IsError();
                 }
 
                 pStream->SetEndian(nOrigNumberFormat);
-                Size aSize(aMtf.GetPrefSize());
 
-                if (aMtf.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel)
-                {
-                    aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, MapUnit::Map100thMM);
-                }
-                else
+                if (!bReadError)
                 {
-                    aSize = OutputDevice::LogicToLogic(aSize, aMtf.GetPrefMapMode(), MapMode(MapUnit::Map100thMM));
+                    Size aSize(aMtf.GetPrefSize());
+
+                    if (aMtf.GetPrefMapMode().GetMapUnit() == MapUnit::MapPixel)
+                    {
+                        aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, MapUnit::Map100thMM);
+                    }
+                    else
+                    {
+                        aSize = OutputDevice::LogicToLogic(aSize, aMtf.GetPrefMapMode(), MapMode(MapUnit::Map100thMM));
+                    }
+
+                    // use size
+                    const basegfx::B2DHomMatrix aMetafileTransform(
+                        basegfx::tools::createScaleB2DHomMatrix(
+                            aSize.Width(),
+                            aSize.Height()));
+
+                    // ...and create a single MetafilePrimitive2D containing the Metafile.
+                    // CAUTION: Currently, ReadWindowMetafile uses the local VectorGraphicData
+                    // and a MetafileAccessor hook at the MetafilePrimitive2D inside of
+                    // ImpGraphic::ImplGetGDIMetaFile to get the Metafile. Thus, the first
+                    // and only primitive in this case *has to be* a MetafilePrimitive2D.
+                    aRetval.push_back(
+                        new drawinglayer::primitive2d::MetafilePrimitive2D(
+                            aMetafileTransform,
+                            aMtf));
+
+                    // // force to use decomposition directly to get rid of the metafile
+                    // const css::uno::Sequence< css::beans::PropertyValue > aViewParameters;
+                    // drawinglayer::primitive2d::MetafilePrimitive2D aMetafilePrimitive2D(
+                    //     aMetafileTransform,
+                    //     aMtf);
+                    // aRetval.append(aMetafilePrimitive2D.getDecomposition(aViewParameters));
+
+                    // 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));
+                    // }
                 }
-
-                // use size
-                const basegfx::B2DHomMatrix aMetafileTransform(
-                    basegfx::tools::createScaleB2DHomMatrix(
-                        aSize.Width(),
-                        aSize.Height()));
-
-                // ...and create a single MetafilePrimitive2D containing the Metafile.
-                // CAUTION: Currently, ReadWindowMetafile uses the local VectorGraphicData
-                // and a MetafileAccessor hook at the MetafilePrimitive2D inside of
-                // ImpGraphic::ImplGetGDIMetaFile to get the Metafile. Thus, the first
-                // and only primitive in this case *has to be* a MetafilePrimitive2D.
-                aRetval.push_back(
-                    new drawinglayer::primitive2d::MetafilePrimitive2D(
-                        aMetafileTransform,
-                        aMtf));
-
-                // // force to use decomposition directly to get rid of the metafile
-                // const css::uno::Sequence< css::beans::PropertyValue > aViewParameters;
-                // drawinglayer::primitive2d::MetafilePrimitive2D aMetafilePrimitive2D(
-                //     aMetafileTransform,
-                //     aMtf);
-                // aRetval.append(aMetafilePrimitive2D.getDecomposition(aViewParameters));
-
-                // 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/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index 7137ee13b96f..03a423233c9e 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_filters_test, \
 	tl \
 	unotest \
 	vcl \
+    emfio \
 ))
 
 $(eval $(call gb_CppunitTest_use_sdk_api,vcl_filters_test))
@@ -44,6 +45,7 @@ $(eval $(call gb_CppunitTest_use_components,vcl_filters_test,\
     ucb/source/core/ucb1 \
     ucb/source/ucp/file/ucpfile1 \
     uui/util/uui \
+    emfio/emfio \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,vcl_filters_test))
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
index 0b28c706fd84..d6a32f2875d5 100644
--- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx
@@ -57,7 +57,30 @@ bool VclFiltersTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return mGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream) == ERRCODE_NONE;
+    bool bRetval(ERRCODE_NONE == mGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream));
+
+    if (!bRetval)
+    {
+        // if error occurred, we are done
+        return bRetval;
+    }
+
+    // if not and we have an embedded Vector Graphic Data, trigger it's interpretation
+    // to check for error. Graphic with VectorGraphicData (Svg/Emf/Wmf) load without error
+    // as long as one of the three types gets detected. Thus, cycles like load/save in
+    // other format will work (what may be wanted). For the test framework it was indirectly
+    // intended to trigger an error when load in the sense of deep data interpretation fails,
+    // so we need to trigger this here
+    if (aGraphic.getVectorGraphicData().get())
+    {
+        if (aGraphic.getVectorGraphicData()->getRange().isEmpty())
+        {
+            // invalid file or file with no content
+            return false;
+        }
+    }
+
+    return true;
 }
 
 void VclFiltersTest::testScaling()
commit e166aa08173379de507049371baa27738670a5e4
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Fri Jun 23 14:02:38 2017 +0200

    emfplus: more corrections due to linux build
    
    Change-Id: Ib2c3bff23043638d315405b5a91b2596e92f7ffa

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 039986566d00..2ac5bbc0c8d6 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -519,16 +519,18 @@ namespace drawinglayer
                             {
                                 primitive2d::Primitive2DContainer aDecomposition;
                                 rMetafilePrimitive.get2DDecomposition(aDecomposition, getViewInformation2D());
-                                const primitive2d::ModifiedColorPrimitive2D aPrimitiveR(
-                                    aDecomposition,
-                                    basegfx::BColorModifierSharedPtr(
-                                        new basegfx::BColorModifier_RGBLuminanceContrast(
-                                            0.5, // red
-                                            -0.5, // green
-                                            -0.5, // blue
-                                            0.0, // luminance
-                                            0.0))); // contrast
-                                processBasePrimitive2D(aPrimitiveR);
+                                primitive2d::BasePrimitive2D* pBasePrimitive = nullptr;
+                                const primitive2d::Primitive2DReference aPrimitiveR(
+                                    pBasePrimitive = new primitive2d::ModifiedColorPrimitive2D(
+                                        aDecomposition,
+                                        basegfx::BColorModifierSharedPtr(
+                                            new basegfx::BColorModifier_RGBLuminanceContrast(
+                                                0.5, // red
+                                                -0.5, // green
+                                                -0.5, // blue
+                                                0.0, // luminance
+                                                0.0)))); // contrast
+                                processBasePrimitive2D(*pBasePrimitive);
                                 RenderMetafilePrimitive2D(rMetafilePrimitive);
                             }
                             else
diff --git a/drawinglayer/source/tools/emfpbrush.cxx b/drawinglayer/source/tools/emfpbrush.cxx
index d55a16ad30d7..19b1441ddb1d 100644
--- a/drawinglayer/source/tools/emfpbrush.cxx
+++ b/drawinglayer/source/tools/emfpbrush.cxx
@@ -211,7 +211,7 @@ namespace emfplushelper
                 if (additionalFlags & 0x02)
                 {
                     SAL_INFO("cppcanvas.emf", "EMF+\tuse transformation");
-                    rR.readXForm(s, brush_transformation);
+                    EmfPlusHelperData::readXForm(s, brush_transformation);
                     hasTransformation = true;
                     SAL_INFO("cppcanvas.emf",
                                 "EMF+\tm11: " << brush_transformation.get(0,0) << " m12: " << brush_transformation.get(1,0) <<
@@ -297,7 +297,7 @@ namespace emfplushelper
                 if (additionalFlags & 0x02)
                 {
                     SAL_INFO("cppcanvas.emf", "EMF+\tuse transformation");
-                    rR.readXForm(s, brush_transformation);
+                    EmfPlusHelperData::readXForm(s, brush_transformation);
                     hasTransformation = true;
                     SAL_INFO("cppcanvas.emf",
                         "EMF+\tm11: " << brush_transformation.get(0,0) << " m12: " << brush_transformation.get(1,0) <<
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 0f81783dec5d..b2eb9bac137d 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -1249,6 +1249,8 @@ namespace emfplushelper
                                     ", " << transform.get(0,2) << ", " << transform.get(1,2));
                             }
 
+                            (void)(text); // avoid warning
+
     //                        rendering::FontRequest aFontRequest;
     //                        // add the text action
     //                        setFont(aFontRequest, flags & 0xff, rFactoryParms, rState);
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index 67f423436fa4..21f5dcdddabd 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -223,7 +223,7 @@ namespace emfplushelper
 
         // readers
         void processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, bool bUseWholeStream = false);
-        void ReadPoint(SvStream& s, float& x, float& y, sal_uInt32 flags);
+        static void ReadPoint(SvStream& s, float& x, float& y, sal_uInt32 flags);
 
         // internal mapper
         void mappingChanged();
@@ -248,8 +248,8 @@ namespace emfplushelper
         ::basegfx::B2DSize MapSize(double iwidth, double iheight);
 
         // readers
-        void ReadRectangle(SvStream& s, float& x, float& y, float &width, float& height, bool bCompressed = false);
-        bool readXForm(SvStream& rIn, basegfx::B2DHomMatrix& rTarget);
+        static void ReadRectangle(SvStream& s, float& x, float& y, float &width, float& height, bool bCompressed = false);
+        static bool readXForm(SvStream& rIn, basegfx::B2DHomMatrix& rTarget);
     };
 }
 
diff --git a/drawinglayer/source/tools/emfppen.cxx b/drawinglayer/source/tools/emfppen.cxx
index 851518b486f5..cb8bbf4cb8d5 100644
--- a/drawinglayer/source/tools/emfppen.cxx
+++ b/drawinglayer/source/tools/emfppen.cxx
@@ -184,7 +184,7 @@ namespace emfplushelper
 
         if (penDataFlags & PenDataTransform)
         {
-            rR.readXForm(s, pen_transformation);
+            EmfPlusHelperData::readXForm(s, pen_transformation);
         }
 
         if (penDataFlags & PenDataStartCap)
diff --git a/emfio/CppunitTest_emfio_emf_test.mk b/emfio/CppunitTest_emfio_emf_test.mk
index 6965613e9cd8..49cf14f90e51 100644
--- a/emfio/CppunitTest_emfio_emf_test.mk
+++ b/emfio/CppunitTest_emfio_emf_test.mk
@@ -7,31 +7,31 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_CppunitTest_CppunitTest,emfio))
+$(eval $(call gb_CppunitTest_CppunitTest,emfio_emf))
 
-$(eval $(call gb_CppunitTest_set_componentfile,emfio,emfio/emfio))
+$(eval $(call gb_CppunitTest_set_componentfile,emfio_emf,emfio/emfio))
 
-$(eval $(call gb_CppunitTest_set_include,emfio,\
+$(eval $(call gb_CppunitTest_set_include,emfio_emf,\
     $$(INCLUDE) \
     -I$(SRCDIR)/emfio/inc \
 ))
 
-$(eval $(call gb_CppunitTest_use_externals,emfio,\
+$(eval $(call gb_CppunitTest_use_externals,emfio_emf,\
     boost_headers \
     libxml2 \
 ))
 
-$(eval $(call gb_CppunitTest_add_exception_objects,emfio,\
+$(eval $(call gb_CppunitTest_add_exception_objects,emfio_emf,\
     emfio/qa/cppunit/emf/EmfImportTest \
 ))
 
-$(eval $(call gb_CppunitTest_use_sdk_api,emfio))
+$(eval $(call gb_CppunitTest_use_sdk_api,emfio_emf))
 
-$(eval $(call gb_CppunitTest_use_library_objects,emfio,\
+$(eval $(call gb_CppunitTest_use_library_objects,emfio_emf,\
     emfio \
 ))
 
-$(eval $(call gb_CppunitTest_use_libraries,emfio,\
+$(eval $(call gb_CppunitTest_use_libraries,emfio_emf,\
     basegfx \
     drawinglayer \
     cppu \
@@ -46,10 +46,10 @@ $(eval $(call gb_CppunitTest_use_libraries,emfio,\
     utl \
 ))
 
-$(eval $(call gb_CppunitTest_use_ure,emfio))
-$(eval $(call gb_CppunitTest_use_vcl,emfio))
+$(eval $(call gb_CppunitTest_use_ure,emfio_emf))
+$(eval $(call gb_CppunitTest_use_vcl,emfio_emf))
 
-$(eval $(call gb_CppunitTest_use_components,emfio,\
+$(eval $(call gb_CppunitTest_use_components,emfio_emf,\
     configmgr/source/configmgr \
     dtrans/util/mcnttype \
     framework/util/fwk \
@@ -63,6 +63,6 @@ $(eval $(call gb_CppunitTest_use_components,emfio,\
     unotools/util/utl \
 ))
 
-$(eval $(call gb_CppunitTest_use_configuration,emfio))
+$(eval $(call gb_CppunitTest_use_configuration,emfio_emf))
 
 # vim: set noet sw=4 ts=4:
diff --git a/emfio/CppunitTest_emfio_wmf_test.mk b/emfio/CppunitTest_emfio_wmf_test.mk
index 82f53ce2f3fe..c24dd19acfef 100644
--- a/emfio/CppunitTest_emfio_wmf_test.mk
+++ b/emfio/CppunitTest_emfio_wmf_test.mk
@@ -7,32 +7,32 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_CppunitTest_CppunitTest,emfio))
+$(eval $(call gb_CppunitTest_CppunitTest,emfio_wmf))
 
-$(eval $(call gb_CppunitTest_set_componentfile,emfio,emfio/emfio))
+$(eval $(call gb_CppunitTest_set_componentfile,emfio_wmf,emfio/emfio))
 
-$(eval $(call gb_CppunitTest_set_include,emfio,\
+$(eval $(call gb_CppunitTest_set_include,emfio_wmf,\
     $$(INCLUDE) \
     -I$(SRCDIR)/emfio/inc \
 ))
 
-$(eval $(call gb_CppunitTest_use_externals,emfio,\
+$(eval $(call gb_CppunitTest_use_externals,emfio_wmf,\
     boost_headers \
     libxml2 \
     $(if $(filter PDFIUM,$(BUILD_TYPE)),pdfium) \
 ))
 
-$(eval $(call gb_CppunitTest_add_exception_objects,emfio, \
+$(eval $(call gb_CppunitTest_add_exception_objects,emfio_wmf, \
     emfio/qa/cppunit/wmf/wmfimporttest \
 ))
 
-$(eval $(call gb_CppunitTest_use_sdk_api,emfio))
+$(eval $(call gb_CppunitTest_use_sdk_api,emfio_wmf))
 
-$(eval $(call gb_CppunitTest_use_library_objects,emfio, \
+$(eval $(call gb_CppunitTest_use_library_objects,emfio_wmf, \
     emfio \
 ))
 
-$(eval $(call gb_CppunitTest_use_libraries,emfio,\
+$(eval $(call gb_CppunitTest_use_libraries,emfio_wmf,\
     $(call gb_Helper_optional,BREAKPAD, \
                crashreport) \
     basegfx \
@@ -58,7 +58,7 @@ $(eval $(call gb_CppunitTest_use_libraries,emfio,\
     xmlreader \
 ))
 
-$(eval $(call gb_CppunitTest_use_externals,emfio,\
+$(eval $(call gb_CppunitTest_use_externals,emfio_wmf,\
     $(if $(filter LINUX MACOSX %BSD SOLARIS,$(OS)), \
             curl) \
     jpeg \
@@ -69,7 +69,7 @@ $(eval $(call gb_CppunitTest_use_externals,emfio,\
 ))
 
 ifeq ($(OS),MACOSX)
-$(eval $(call gb_CppunitTest_add_libs,emfio,\
+$(eval $(call gb_CppunitTest_add_libs,emfio_wmf,\
     -framework IOKit \
     -F/System/Library/PrivateFrameworks \
     -framework CoreUI \
@@ -78,12 +78,12 @@ $(eval $(call gb_CppunitTest_add_libs,emfio,\
 endif
 
 ifeq ($(ENABLE_JAVA),TRUE)
-$(eval $(call gb_CppunitTest_use_libraries,emfio,\
+$(eval $(call gb_CppunitTest_use_libraries,emfio_wmf,\
     jvmaccess \
 ))
 endif
 
-$(eval $(call gb_CppunitTest_use_externals,emfio,\
+$(eval $(call gb_CppunitTest_use_externals,emfio_wmf,\
     gio \
     graphite \
     harfbuzz \
@@ -91,30 +91,30 @@ $(eval $(call gb_CppunitTest_use_externals,emfio,\
     lcms2 \
 ))
 ifeq ($(ENABLE_HEADLESS),)
-$(eval $(call gb_CppunitTest_use_externals,emfio,\
+$(eval $(call gb_CppunitTest_use_externals,emfio_wmf,\
      epoxy \
  ))
 endif
 
 ifeq ($(OS),MACOSX)
-$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio,\
+$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio_wmf,\
     ApplicationServices \
 ))
-$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio,\
+$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio_wmf,\
     $(if $(filter X86_64,$(CPUNAME)),,QuickTime) \
     Cocoa \
     Carbon \
     CoreFoundation \
 ))
 ifneq ($(ENABLE_MACOSX_SANDBOX),TRUE)
-$(eval $(call gb_CppunitTest_use_libraries,emfio,\
+$(eval $(call gb_CppunitTest_use_libraries,emfio_wmf,\
     AppleRemote \
 ))
 endif
 endif
 
 ifeq ($(USING_X11),TRUE)
-$(eval $(call gb_CppunitTest_use_externals,emfio,\
+$(eval $(call gb_CppunitTest_use_externals,emfio_wmf,\
     cairo \
     cups \
     dbus \
@@ -125,14 +125,14 @@ $(eval $(call gb_CppunitTest_use_externals,emfio,\
 endif
 
 ifeq ($(ENABLE_HEADLESS),TRUE)
-$(eval $(call gb_CppunitTest_use_externals,emfio,\
+$(eval $(call gb_CppunitTest_use_externals,emfio_wmf,\
     cairo \
     freetype \
     fontconfig \
 ))
 else
 ifeq ($(OS),LINUX)
-$(eval $(call gb_CppunitTest_add_libs,emfio,\
+$(eval $(call gb_CppunitTest_add_libs,emfio_wmf,\
     -lm \
     -ldl \
     -lpthread \
@@ -142,12 +142,12 @@ endif
 endif
 
 ifeq ($(OS),ANDROID)
-$(eval $(call gb_CppunitTest_add_libs,emfio,\
+$(eval $(call gb_CppunitTest_add_libs,emfio_wmf,\
     -llog \
     -landroid \
     -llo-bootstrap \
 ))
-$(eval $(call gb_CppunitTest_use_externals,emfio,\
+$(eval $(call gb_CppunitTest_use_externals,emfio_wmf,\
     cairo \
     fontconfig \
     freetype \
@@ -156,14 +156,14 @@ $(eval $(call gb_CppunitTest_use_externals,emfio,\
 endif
 
 ifeq ($(OS),IOS)
-$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio,\
+$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio_wmf,\
     UIKit \
     CoreFoundation \
 ))
 endif
 
 ifeq ($(OS),WNT)
-$(eval $(call gb_CppunitTest_use_system_win32_libs,emfio,\
+$(eval $(call gb_CppunitTest_use_system_win32_libs,emfio_wmf,\
     advapi32 \
     crypt32 \
     gdi32 \
@@ -183,7 +183,7 @@ $(eval $(call gb_CppunitTest_use_system_win32_libs,emfio,\
 endif
 
 ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
-$(eval $(call gb_CppunitTest_add_libs,emfio,\
+$(eval $(call gb_CppunitTest_add_libs,emfio_wmf,\
     -lm $(DLOPEN_LIBS) \
     -lpthread \
     -lX11 \
@@ -191,27 +191,27 @@ $(eval $(call gb_CppunitTest_add_libs,emfio,\
 ))
 endif
 
-$(eval $(call gb_CppunitTest_use_ure,emfio))
+$(eval $(call gb_CppunitTest_use_ure,emfio_wmf))
 
-$(eval $(call gb_CppunitTest_use_components,emfio,\
+$(eval $(call gb_CppunitTest_use_components,emfio_wmf,\
     configmgr/source/configmgr \
     i18npool/util/i18npool \
     ucb/source/core/ucb1 \
     unotools/util/utl \
 ))
 
-$(eval $(call gb_CppunitTest_use_configuration,emfio))
+$(eval $(call gb_CppunitTest_use_configuration,emfio_wmf))
 
 # See gb_CppunitTest__use_vcl (solenv/gbuild/CppunitTest.mk; headless):
 ifeq ($(USING_X11),TRUE)
-$(call gb_CppunitTest_get_target,emfio): \
+$(call gb_CppunitTest_get_target,emfio_wmf): \
     $(call gb_Library_get_target,desktop_detector)
 endif
 
 # Hack to suppress ASan ODR violation warnings about symbols present in both the
 # vcl objects linked into this test library and the vcl library (which gets
 # dynamically loaded during the test):
-$(call gb_CppunitTest_get_target,emfio): \
+$(call gb_CppunitTest_get_target,emfio_wmf): \
     EXTRA_ENV_VARS := \
         ASAN_OPTIONS="$${ASAN_OPTIONS+$$ASAN_OPTIONS:}"detect_odr_violation=0
 
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index d6d056936d99..9e36a9afe113 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -18,16 +18,14 @@
  */
 
 #include <emfreader.hxx>
-
 #include <osl/endian.h>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <vcl/dibtools.hxx>
 #include <o3tl/make_unique.hxx>
-
+#include <tools/stream.hxx>
 #include <memory>
 
 #ifdef DBG_UTIL
-#include <tools/stream.hxx>
 #include <vcl/pngwrite.hxx>
 #endif
 
@@ -456,6 +454,17 @@ namespace emfio
         mpInputStream->SeekRel(nRemainder);
     }
 
+    // these are referenced from inside the templates
+    SvStream& operator >> (SvStream& rStream, sal_Int16 &n)
+    {
+        return rStream.ReadInt16(n);
+    }
+
+    SvStream& operator >> (SvStream& rStream, sal_Int32 &n)
+    {
+        return rStream.ReadInt32(n);
+    }
+
     /**
      * Reads polygons from the stream.
      * The \<class T> parameter is for the type of the points (sal_uInt32 or sal_uInt16).
@@ -544,18 +553,6 @@ namespace emfio
         }
     }
 
-    // these are referenced from inside the templates
-
-    SvStream& operator>>(SvStream& rStream, sal_Int16 &n)
-    {
-        return rStream.ReadInt16(n);
-    }
-
-    SvStream& operator>>(SvStream& rStream, sal_Int32 &n)
-    {
-        return rStream.ReadInt32(n);
-    }
-
     /**
      * Reads a poly polygon from the WMF file and draws it.
      * The \<class T> parameter refers to the type of the points. (e.g. sal_uInt16 or sal_uInt32)
diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx
index 9cbe518d7e28..61f61abb4b84 100644
--- a/emfio/source/reader/wmfreader.cxx
+++ b/emfio/source/reader/wmfreader.cxx
@@ -114,7 +114,7 @@
 
 namespace
 {
-    static void GetWinExtMax(const Point& rSource, tools::Rectangle& rPlaceableBound, const sal_Int16 nMapMode)
+    void GetWinExtMax(const Point& rSource, tools::Rectangle& rPlaceableBound, const sal_Int16 nMapMode)
     {
         Point aSource(rSource);
         if (nMapMode == MM_HIMETRIC)
@@ -129,7 +129,7 @@ namespace
             rPlaceableBound.Bottom() = aSource.Y();
     }
 
-    static void GetWinExtMax(const tools::Rectangle& rSource, tools::Rectangle& rPlaceableBound, const sal_Int16 nMapMode)
+    void GetWinExtMax(const tools::Rectangle& rSource, tools::Rectangle& rPlaceableBound, const sal_Int16 nMapMode)
     {
         GetWinExtMax(rSource.TopLeft(), rPlaceableBound, nMapMode);
         GetWinExtMax(rSource.BottomRight(), rPlaceableBound, nMapMode);
commit 57bc92fb5ee2bafe04d032103fcbd2f07b016cdc
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Fri Jun 23 12:16:33 2017 +0200

    emfplus: UnitTests and gerrit build corrections
    
    Needed to migrate UnitTest for Emf/Wmf import from
    vcl to emfio. Corrected stuff based on gerrit build
    feedback
    
    Change-Id: I7fd2456f814ea19583072ba09730a07e9b9d4061

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index fdb0fb11c42f..0f81783dec5d 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -390,7 +390,7 @@ namespace emfplushelper
 
     void EmfPlusHelperData::processEmfPlusData(
         SvMemoryStream& rMS,
-        const drawinglayer::geometry::ViewInformation2D& rViewInformation)
+        const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/)
     {
         sal_uInt64 length = rMS.GetSize();
 
@@ -862,6 +862,10 @@ namespace emfplushelper
                             SAL_INFO("cppcanvas.emf", "EMF+ DrawString layoutRect: " << lx << "," << ly << " - " << lw << "x" << lh);
                             OUString text = read_uInt16s_ToOUString(rMS, stringLength);
                             EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(maEMFPObjects[formatId & 0xff].get());
+
+                            (void)(text); // avoid warning
+                            (void)(stringFormat); // avoid warning
+
     //                        css::rendering::FontRequest aFontRequest;
     //
     //                        if (stringFormat)
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index f10c05724f60..93162e4d3fad 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -46,6 +46,7 @@
 #include <vcl/gradient.hxx>
 #include <vcl/hatch.hxx>
 #include <emfplushelper.hxx>
+#include <numeric>
 
 namespace drawinglayer
 {
diff --git a/emfio/CppunitTest_emfio.mk b/emfio/CppunitTest_emfio_emf_test.mk
similarity index 97%
rename from emfio/CppunitTest_emfio.mk
rename to emfio/CppunitTest_emfio_emf_test.mk
index e785ac45b6e5..6965613e9cd8 100644
--- a/emfio/CppunitTest_emfio.mk
+++ b/emfio/CppunitTest_emfio_emf_test.mk
@@ -21,6 +21,10 @@ $(eval $(call gb_CppunitTest_use_externals,emfio,\
     libxml2 \
 ))
 
+$(eval $(call gb_CppunitTest_add_exception_objects,emfio,\
+    emfio/qa/cppunit/emf/EmfImportTest \
+))
+
 $(eval $(call gb_CppunitTest_use_sdk_api,emfio))
 
 $(eval $(call gb_CppunitTest_use_library_objects,emfio,\
@@ -42,10 +46,6 @@ $(eval $(call gb_CppunitTest_use_libraries,emfio,\
     utl \
 ))
 
-$(eval $(call gb_CppunitTest_add_exception_objects,emfio,\
-    emfio/qa/cppunit/EmfImportTest \
-))
-
 $(eval $(call gb_CppunitTest_use_ure,emfio))
 $(eval $(call gb_CppunitTest_use_vcl,emfio))
 
diff --git a/vcl/CppunitTest_vcl_wmf_test.mk b/emfio/CppunitTest_emfio_wmf_test.mk
similarity index 61%
rename from vcl/CppunitTest_vcl_wmf_test.mk
rename to emfio/CppunitTest_emfio_wmf_test.mk
index 9e057d9c7581..82f53ce2f3fe 100644
--- a/vcl/CppunitTest_vcl_wmf_test.mk
+++ b/emfio/CppunitTest_emfio_wmf_test.mk
@@ -7,46 +7,39 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_CppunitTest_CppunitTest,vcl_wmf_test))
+$(eval $(call gb_CppunitTest_CppunitTest,emfio))
 
-$(eval $(call gb_CppunitTest_add_exception_objects,vcl_wmf_test, \
-    vcl/qa/cppunit/wmf/wmfimporttest \
+$(eval $(call gb_CppunitTest_set_componentfile,emfio,emfio/emfio))
+
+$(eval $(call gb_CppunitTest_set_include,emfio,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/emfio/inc \
 ))
 
-$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_externals,emfio,\
     boost_headers \
     libxml2 \
     $(if $(filter PDFIUM,$(BUILD_TYPE)),pdfium) \
 ))
 
-$(eval $(call gb_CppunitTest_set_include,vcl_wmf_test,\
-    $$(INCLUDE) \
-    -I$(SRCDIR)/vcl/inc \
-    -I$(SRCDIR)/vcl/source/filter/wmf \
+$(eval $(call gb_CppunitTest_add_exception_objects,emfio, \
+    emfio/qa/cppunit/wmf/wmfimporttest \
 ))
 
-$(eval $(call gb_CppunitTest_use_library_objects,vcl_wmf_test, \
-    test-setupvcl \
-    vcl \
-))
+$(eval $(call gb_CppunitTest_use_sdk_api,emfio))
 
-$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
-    $(if $(filter LINUX MACOSX %BSD SOLARIS,$(OS)), \
-            curl) \
-    jpeg \
-    $(if $(filter-out IOS WNT,$(OS)), \
-            nss3 \
-            plc4) \
-    libeot \
+$(eval $(call gb_CppunitTest_use_library_objects,emfio, \
+    emfio \
 ))
 
-$(eval $(call gb_CppunitTest_use_libraries,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_libraries,emfio,\
     $(call gb_Helper_optional,BREAKPAD, \
                crashreport) \
     basegfx \
-    comphelper \
+    drawinglayer \
     cppu \
     cppuhelper \
+    comphelper \
     i18nlangtag \
     i18nutil \
     $(if $(filter OPENCL,$(BUILD_TYPE)),opencl) \
@@ -56,15 +49,27 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_wmf_test,\
     svl \
     svt \
     test \
+    test-setupvcl \
     tl \
     ucbhelper \
     unotest \
+    vcl \
     utl \
     xmlreader \
 ))
 
+$(eval $(call gb_CppunitTest_use_externals,emfio,\
+    $(if $(filter LINUX MACOSX %BSD SOLARIS,$(OS)), \
+            curl) \
+    jpeg \
+    $(if $(filter-out IOS WNT,$(OS)), \
+            nss3 \
+            plc4) \
+    libeot \
+))
+
 ifeq ($(OS),MACOSX)
-$(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_add_libs,emfio,\
     -framework IOKit \
     -F/System/Library/PrivateFrameworks \
     -framework CoreUI \
@@ -73,12 +78,12 @@ $(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
 endif
 
 ifeq ($(ENABLE_JAVA),TRUE)
-$(eval $(call gb_CppunitTest_use_libraries,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_libraries,emfio,\
     jvmaccess \
 ))
 endif
 
-$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_externals,emfio,\
     gio \
     graphite \
     harfbuzz \
@@ -86,30 +91,30 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
     lcms2 \
 ))
 ifeq ($(ENABLE_HEADLESS),)
-$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_externals,emfio,\
      epoxy \
  ))
 endif
 
 ifeq ($(OS),MACOSX)
-$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio,\
     ApplicationServices \
 ))
-$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio,\
     $(if $(filter X86_64,$(CPUNAME)),,QuickTime) \
     Cocoa \
     Carbon \
     CoreFoundation \
 ))
 ifneq ($(ENABLE_MACOSX_SANDBOX),TRUE)
-$(eval $(call gb_CppunitTest_use_libraries,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_libraries,emfio,\
     AppleRemote \
 ))
 endif
 endif
 
 ifeq ($(USING_X11),TRUE)
-$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_externals,emfio,\
     cairo \
     cups \
     dbus \
@@ -120,14 +125,14 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
 endif
 
 ifeq ($(ENABLE_HEADLESS),TRUE)
-$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_externals,emfio,\
     cairo \
     freetype \
     fontconfig \
 ))
 else
 ifeq ($(OS),LINUX)
-$(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_add_libs,emfio,\
     -lm \
     -ldl \
     -lpthread \
@@ -137,12 +142,12 @@ endif
 endif
 
 ifeq ($(OS),ANDROID)
-$(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_add_libs,emfio,\
     -llog \
     -landroid \
     -llo-bootstrap \
 ))
-$(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_externals,emfio,\
     cairo \
     fontconfig \
     freetype \
@@ -151,14 +156,14 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_wmf_test,\
 endif
 
 ifeq ($(OS),IOS)
-$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_system_darwin_frameworks,emfio,\
     UIKit \
     CoreFoundation \
 ))
 endif
 
 ifeq ($(OS),WNT)
-$(eval $(call gb_CppunitTest_use_system_win32_libs,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_system_win32_libs,emfio,\
     advapi32 \
     crypt32 \
     gdi32 \
@@ -174,11 +179,11 @@ $(eval $(call gb_CppunitTest_use_system_win32_libs,vcl_wmf_test,\
     setupapi \
     shlwapi \
 ))
-#$(eval $(call gb_CppunitTest_add_nativeres,vcl_wmf_test,vcl/salsrc))
+#$(eval $(call gb_CppunitTest_add_nativeres,emfio,vcl/salsrc))
 endif
 
 ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
-$(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_add_libs,emfio,\
     -lm $(DLOPEN_LIBS) \
     -lpthread \
     -lX11 \
@@ -186,29 +191,27 @@ $(eval $(call gb_CppunitTest_add_libs,vcl_wmf_test,\
 ))
 endif
 
-$(eval $(call gb_CppunitTest_use_sdk_api,vcl_wmf_test))
-
-$(eval $(call gb_CppunitTest_use_ure,vcl_wmf_test))
+$(eval $(call gb_CppunitTest_use_ure,emfio))
 
-$(eval $(call gb_CppunitTest_use_components,vcl_wmf_test,\
+$(eval $(call gb_CppunitTest_use_components,emfio,\
     configmgr/source/configmgr \
     i18npool/util/i18npool \
     ucb/source/core/ucb1 \
     unotools/util/utl \
 ))
 
-$(eval $(call gb_CppunitTest_use_configuration,vcl_wmf_test))
+$(eval $(call gb_CppunitTest_use_configuration,emfio))
 
 # See gb_CppunitTest__use_vcl (solenv/gbuild/CppunitTest.mk; headless):
 ifeq ($(USING_X11),TRUE)
-$(call gb_CppunitTest_get_target,vcl_wmf_test): \
+$(call gb_CppunitTest_get_target,emfio): \
     $(call gb_Library_get_target,desktop_detector)
 endif
 
 # Hack to suppress ASan ODR violation warnings about symbols present in both the
 # vcl objects linked into this test library and the vcl library (which gets
 # dynamically loaded during the test):
-$(call gb_CppunitTest_get_target,vcl_wmf_test): \
+$(call gb_CppunitTest_get_target,emfio): \
     EXTRA_ENV_VARS := \
         ASAN_OPTIONS="$${ASAN_OPTIONS+$$ASAN_OPTIONS:}"detect_odr_violation=0
 
diff --git a/emfio/Module_emfio.mk b/emfio/Module_emfio.mk
index 719bd0180628..c4d5ec70be9c 100644
--- a/emfio/Module_emfio.mk
+++ b/emfio/Module_emfio.mk
@@ -23,7 +23,8 @@ $(eval $(call gb_Module_add_targets,emfio,\
 ))
 
 $(eval $(call gb_Module_add_check_targets,emfio,\
-    CppunitTest_emfio \
+    CppunitTest_emfio_emf_test \
+	$(if $(MERGELIBS),,CppunitTest_emfio_wmf_test) \
 ))
 
 # vim: set noet ts=4 sw=4:
diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index 7442a3111f04..2d14d9cfe633 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -599,7 +599,7 @@ namespace emfio
             bool bDrawTo = false,
             bool bRecordPath = false
         );
-        void                DrawPolyBezier(tools::Polygon rPolygin,
+        void                DrawPolyBezier(tools::Polygon rPolygon,
             bool bDrawTo,
             bool bRecordPath
         );
diff --git a/emfio/qa/cppunit/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
similarity index 100%
rename from emfio/qa/cppunit/EmfImportTest.cxx
rename to emfio/qa/cppunit/emf/EmfImportTest.cxx
diff --git a/emfio/qa/cppunit/data/fdo79679-2.emf b/emfio/qa/cppunit/emf/data/fdo79679-2.emf
similarity index 100%
rename from emfio/qa/cppunit/data/fdo79679-2.emf
rename to emfio/qa/cppunit/emf/data/fdo79679-2.emf
diff --git a/vcl/qa/cppunit/wmf/data/ETO_PDY.emf b/emfio/qa/cppunit/wmf/data/ETO_PDY.emf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/ETO_PDY.emf
rename to emfio/qa/cppunit/wmf/data/ETO_PDY.emf
diff --git a/vcl/qa/cppunit/wmf/data/ETO_PDY.wmf b/emfio/qa/cppunit/wmf/data/ETO_PDY.wmf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/ETO_PDY.wmf
rename to emfio/qa/cppunit/wmf/data/ETO_PDY.wmf
diff --git a/vcl/qa/cppunit/wmf/data/computer_mail.emf b/emfio/qa/cppunit/wmf/data/computer_mail.emf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/computer_mail.emf
rename to emfio/qa/cppunit/wmf/data/computer_mail.emf
diff --git a/vcl/qa/cppunit/wmf/data/image1.emf b/emfio/qa/cppunit/wmf/data/image1.emf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/image1.emf
rename to emfio/qa/cppunit/wmf/data/image1.emf
diff --git a/vcl/qa/cppunit/wmf/data/line_styles.emf b/emfio/qa/cppunit/wmf/data/line_styles.emf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/line_styles.emf
rename to emfio/qa/cppunit/wmf/data/line_styles.emf
diff --git a/vcl/qa/cppunit/wmf/data/sine_wave.emf b/emfio/qa/cppunit/wmf/data/sine_wave.emf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/sine_wave.emf
rename to emfio/qa/cppunit/wmf/data/sine_wave.emf
diff --git a/vcl/qa/cppunit/wmf/data/tdf39894.emf b/emfio/qa/cppunit/wmf/data/tdf39894.emf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/tdf39894.emf
rename to emfio/qa/cppunit/wmf/data/tdf39894.emf
diff --git a/vcl/qa/cppunit/wmf/data/tdf39894.wmf b/emfio/qa/cppunit/wmf/data/tdf39894.wmf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/tdf39894.wmf
rename to emfio/qa/cppunit/wmf/data/tdf39894.wmf
diff --git a/vcl/qa/cppunit/wmf/data/tdf93750.emf b/emfio/qa/cppunit/wmf/data/tdf93750.emf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/tdf93750.emf
rename to emfio/qa/cppunit/wmf/data/tdf93750.emf
diff --git a/vcl/qa/cppunit/wmf/data/visio_import_source.wmf b/emfio/qa/cppunit/wmf/data/visio_import_source.wmf
similarity index 100%
rename from vcl/qa/cppunit/wmf/data/visio_import_source.wmf
rename to emfio/qa/cppunit/wmf/data/visio_import_source.wmf
diff --git a/vcl/qa/cppunit/wmf/wmfimporttest.cxx b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
similarity index 98%
rename from vcl/qa/cppunit/wmf/wmfimporttest.cxx
rename to emfio/qa/cppunit/wmf/wmfimporttest.cxx
index 96e11c0984d2..3c7520a7a2f2 100644
--- a/vcl/qa/cppunit/wmf/wmfimporttest.cxx
+++ b/emfio/qa/cppunit/wmf/wmfimporttest.cxx
@@ -23,6 +23,7 @@
 #include <unotest/bootstrapfixturebase.hxx>
 #include <vcl/wmf.hxx>
 #include <vcl/metaact.hxx>
+#include <mtftools.hxx>
 
 using namespace css;
 
@@ -37,7 +38,7 @@ class WmfTest : public test::BootstrapFixtureBase, public XmlTestTools
 
 public:
     WmfTest() :
-        maDataUrl("/vcl/qa/cppunit/wmf/data/")
+        maDataUrl("/emfio/qa/cppunit/wmf/data/")
     {}
 
     // Hack around missing "once per class" setUp/tearDown in CppUnit; must be
@@ -248,7 +249,7 @@ void WmfTest::testTdf99402()
 {
     // Symbol font should arrive with RTL_TEXTENCODING_SYMBOL encoding,
     // even if charset is OEM_CHARSET/DEFAULT_CHARSET in WMF
-    LOGFONTW logfontw;
+    emfio::LOGFONTW logfontw;
     logfontw.lfHeight = 0;
     logfontw.lfWidth = 0;
     logfontw.lfEscapement = 0;
@@ -260,7 +261,7 @@ void WmfTest::testTdf99402()
     logfontw.lfPitchAndFamily = FF_ROMAN | DEFAULT_PITCH;
     logfontw.alfFaceName = "Symbol";
 
-    WinMtfFontStyle fontStyle(logfontw);
+    emfio::WinMtfFontStyle fontStyle(logfontw);
 
     CPPUNIT_ASSERT_EQUAL(RTL_TEXTENCODING_SYMBOL, fontStyle.aFont.GetCharSet());
 }
diff --git a/emfio/source/emfuno/xemfparser.cxx b/emfio/source/emfuno/xemfparser.cxx
index 433210c5ecd2..ff4dcccb6589 100644
--- a/emfio/source/emfuno/xemfparser.cxx
+++ b/emfio/source/emfuno/xemfparser.cxx
@@ -113,7 +113,7 @@ namespace emfio
 
         uno::Sequence< uno::Reference< ::graphic::XPrimitive2D > > XEmfParser::getDecomposition(
             const uno::Reference< ::io::XInputStream >& xEmfStream,
-            const OUString& aAbsolutePath,
+            const OUString& /*aAbsolutePath*/,
             const uno::Sequence< ::beans::PropertyValue >& rProperties)
         {
             drawinglayer::primitive2d::Primitive2DContainer aRetval;
diff --git a/include/drawinglayer/primitive2d/metafileprimitive2d.hxx b/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
index e849e38b5752..a6d6c34338bd 100644
--- a/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
@@ -83,7 +83,7 @@ namespace drawinglayer
             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
 
             /// from MetafileAccessor
-            virtual bool accessMetafile(GDIMetaFile& rTargetMetafile) const;
+            virtual bool accessMetafile(GDIMetaFile& rTargetMetafile) const override;
 
             /// provide unique ID
             DeclPrimitive2DIDBlock()
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index fe5d973907b8..eb5681278951 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -151,7 +151,6 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
 	CppunitTest_vcl_mapmode \
 	CppunitTest_vcl_outdev \
 	CppunitTest_vcl_app_test \
-	$(if $(MERGELIBS),,CppunitTest_vcl_wmf_test) \
 	CppunitTest_vcl_jpeg_read_write_test \
 	CppunitTest_vcl_svm_test \
 	CppunitTest_vcl_pdfexport \
commit 5f29d5c7a5b00419dfe17b05844141fbc8451931
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Thu Jun 22 18:10:16 2017 +0200

    emfplus: finetuning, UnitTest, not active by default
    
    Change-Id: Ie085ad2610a306c7f9c44551114041d0950d1af5

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 38c196f53b8f..93c6bd0033bb 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1710,10 +1710,9 @@ namespace drawinglayer
                 }
                 case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
                 {
-                    static bool bUseMetaFilePrimitiveDecomposition(true);
                     const primitive2d::MetafilePrimitive2D& aMetafile = static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate);
 
-                    if(bUseMetaFilePrimitiveDecomposition && !aMetafile.getMetaFile().GetUseCanvas())
+                    if(!aMetafile.getMetaFile().GetUseCanvas())
                     {
                         // Use new Metafile decomposition.
                         // TODO EMF+ stuffed into METACOMMENT support required
@@ -1721,8 +1720,24 @@ namespace drawinglayer
                     }
                     else
                     {
+#ifdef DBG_UTIL
+                        // switch to test EMFPlus-enhanced MetafileDecomposition, don't do
+                        // this by default in debug mode
+                        static bool bTestEMFPDecomposition(false);
+
+                        if (bTestEMFPDecomposition)
+                        {
+                            process(rCandidate);
+                        }
+                        else
+                        {
+                            // direct draw of MetaFile
+                            RenderMetafilePrimitive2D(aMetafile);
+                        }
+#else // DBG_UTIL
                         // direct draw of MetaFile, use default processing
                         RenderMetafilePrimitive2D(aMetafile);
+#endif // DBG_UTIL
                     }
 
                     break;
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 177c780f212f..039986566d00 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -505,11 +505,13 @@ namespace drawinglayer
                     else
                     {
 #ifdef DBG_UTIL
-                        // switch to test EMFPlus-enhanced MetafileDecomposition
-                        static bool bTestEMFPDecomposition(true);
-                        // switch to show the new visualization color.-changed behind
-                        // the original output vor visual testing
-                        static bool bUseChangedColorObject(true);
+                        // switch to test EMFPlus-enhanced MetafileDecomposition, don't do
+                        // this by default in debug mode
+                        static bool bTestEMFPDecomposition(false);
+
+                        // switch to show the new visualization color changed behind
+                        // the original output vor visual testing, also not by default in debug mode
+                        static bool bUseChangedColorObject(false);
 
                         if (bTestEMFPDecomposition)
                         {
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index a700df8dac6c..67f423436fa4 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -25,8 +25,6 @@
 #include <tools/stream.hxx>
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/vector/b2dsize.hxx>
-//#include <com/sun/star/rendering/XCanvasFont.hpp>
-//#include <com/sun/star/rendering/TextDirection.hpp>
 
 // predefines
 class SvStream;
@@ -252,10 +250,6 @@ namespace emfplushelper
         // readers
         void ReadRectangle(SvStream& s, float& x, float& y, float &width, float& height, bool bCompressed = false);
         bool readXForm(SvStream& rIn, basegfx::B2DHomMatrix& rTarget);
-
-        /// data holders access
-//        wmfemfhelper::TargetHolders& getTargetHolders() const { return mrTargetHolders; }
-//        wmfemfhelper::PropertyHolders& getPropertyHolders() const { return mrPropertyHolders; }
     };
 }
 
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index 4c7a298b912f..f10c05724f60 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -18,16 +18,9 @@
  */
 
 #include <wmfemfhelper.hxx>
-
-//#include <basegfx/tools/canvastools.hxx>
-//#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
-//#include <basegfx/color/bcolor.hxx>
 #include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
 #include <vcl/lineinfo.hxx>
-//#include <drawinglayer/attribute/lineattribute.hxx>
-//#include <drawinglayer/attribute/strokeattribute.hxx>
 #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
-//#include <vcl/metaact.hxx>
 #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
@@ -37,24 +30,19 @@
 #include <vcl/salbtype.hxx>
 #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
 #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
-//#include <vcl/svapp.hxx>
 #include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
 #include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
 #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
 #include <basegfx/polygon/b2dpolygonclipper.hxx>
 #include <drawinglayer/primitive2d/invertprimitive2d.hxx>
 #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/fillgraphicprimitive2d.hxx>
 #include <drawinglayer/primitive2d/wallpaperprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/textprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
 #include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
-//#include <i18nlangtag/languagetag.hxx>
 #include <drawinglayer/primitive2d/textlineprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx>
 #include <drawinglayer/primitive2d/epsprimitive2d.hxx>
 #include <tools/fract.hxx>
-//#include <numeric>
 #include <vcl/gradient.hxx>
 #include <vcl/hatch.hxx>
 #include <emfplushelper.hxx>
diff --git a/emfio/CppunitTest_emfio.mk b/emfio/CppunitTest_emfio.mk
index 8214bc87e794..e785ac45b6e5 100644
--- a/emfio/CppunitTest_emfio.mk
+++ b/emfio/CppunitTest_emfio.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_libraries,emfio,\
     unotest \
     tl \
     vcl \
+    utl \
 ))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,emfio,\
diff --git a/emfio/qa/cppunit/EmfImportTest.cxx b/emfio/qa/cppunit/EmfImportTest.cxx
index f315fc8937d0..ccef93ce673f 100644
--- a/emfio/qa/cppunit/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/EmfImportTest.cxx
@@ -63,8 +63,9 @@ Primitive2DSequence Test::parseEmf(const char* aSource)
 
     Sequence<sal_Int8> aData(pBuffer.get(), nSize + 1);
     Reference<XInputStream> aInputStream(new comphelper::SequenceInputStream(aData));
+    css::uno::Sequence< css::beans::PropertyValue > aEmptyValues;
 
-    return xEmfParser->getDecomposition(aInputStream, aPath);
+    return xEmfParser->getDecomposition(aInputStream, aPath, aEmptyValues);
 }
 
 void Test::checkRectPrimitive(Primitive2DSequence& rPrimitive)
@@ -74,16 +75,10 @@ void Test::checkRectPrimitive(Primitive2DSequence& rPrimitive)
 
     CPPUNIT_ASSERT (pDocument);
 
-    // emfio: add examples
+    // emfio: add examples (later)
     // assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00cc00"); // rect background color
     // assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "height", "100"); // rect background height
     // assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "width", "100"); // rect background width
-    // assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "minx", "10");
-    // assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "miny", "10");
-    // assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxx", "110");
-    // assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "maxy", "110");
-    // assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#ff0000"); // rect stroke color
-    // assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "3"); // rect stroke width
 }
 
 void Test::testWorking()
diff --git a/include/vcl/dibtools.hxx b/include/vcl/dibtools.hxx
index fcb3f3671616..0e4bf060ce71 100644
--- a/include/vcl/dibtools.hxx
+++ b/include/vcl/dibtools.hxx
@@ -64,7 +64,7 @@ bool VCL_DLLPUBLIC WriteDIBBitmapEx(
     const BitmapEx& rSource,
     SvStream& rOStm);
 
-// needed for emfio migration
+// needed in emfio for emf/wmf migration
 sal_uInt32 VCL_DLLPUBLIC getDIBV5HeaderSize();
 
 #endif // INCLUDED_VCL_DIBTOOLS_HXX
commit c72b77d2d7ee02e16716f8b30b55eca942bce5d0
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Thu Jun 22 13:03:50 2017 +0200

    emfplus: unified transformations, added test code
    
    More unifications, changed all Map*() methods to use a single
    B2DHomMatrix which is created based on former stuff, XForm now
    completely replaced. To check, added debug-only code and switches
    to the VclPixelProcessor so that visual checks get easy when
    using these modes (overlay of both methods with modded colors).
    Also resynched to master.
    
    Change-Id: I7b749f90bfde2ec1c2e49ee90ca2ef368da0547e

diff --git a/drawinglayer/inc/emfplushelper.hxx b/drawinglayer/inc/emfplushelper.hxx
index 839a94d82e95..78e59dbf1abc 100644
--- a/drawinglayer/inc/emfplushelper.hxx
+++ b/drawinglayer/inc/emfplushelper.hxx
@@ -20,12 +20,16 @@
 #ifndef INCLUDED_DRAWINGLAYER_INC_EMFPLUSHELPER_HXX
 #define INCLUDED_DRAWINGLAYER_INC_EMFPLUSHELPER_HXX
 
+#include <sal/types.h>
 #include <sal/config.h>
+#include <memory>
 
  /// predefines
 namespace emfplushelper { struct EmfPlusHelperData; }
 namespace wmfemfhelper { class TargetHolders; }
 namespace wmfemfhelper { class PropertyHolders; }
+namespace drawinglayer { namespace geometry { class ViewInformation2D; }}
+class SvMemoryStream;
 
 namespace emfplushelper
 {
diff --git a/drawinglayer/inc/wmfemfhelper.hxx b/drawinglayer/inc/wmfemfhelper.hxx
index a11b6578e572..7ae8e64ad6e8 100644
--- a/drawinglayer/inc/wmfemfhelper.hxx
+++ b/drawinglayer/inc/wmfemfhelper.hxx
@@ -22,6 +22,9 @@
 
 #include <sal/config.h>
 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <vcl/font.hxx>
+#include <vcl/outdevstate.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
 
 // predefines
 namespace drawinglayer { namespace geometry { class ViewInformation2D; }}
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index 65ec52c894de..148eb9c5725b 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -21,7 +21,7 @@
 #include <wmfemfhelper.hxx>
 
 //#include <basegfx/tools/canvastools.hxx>
-//#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
+#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
 //#include <basegfx/color/bcolor.hxx>
 //#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
 //#include <vcl/lineinfo.hxx>
@@ -29,7 +29,7 @@
 //#include <drawinglayer/attribute/strokeattribute.hxx>
 //#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
 //#include <vcl/metaact.hxx>
-//#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
 //#include <basegfx/matrix/b2dhommatrixtools.hxx>
 //#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
 //#include <basegfx/polygon/b2dpolygontools.hxx>
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index a93f85df4595..177c780f212f 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -497,17 +497,52 @@ namespace drawinglayer
 
                     const primitive2d::MetafilePrimitive2D& rMetafilePrimitive( static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate) );
 
-                    static bool bTestMetaFilePrimitiveDecomposition( true );
-                    if( bTestMetaFilePrimitiveDecomposition && !rMetafilePrimitive.getMetaFile().GetUseCanvas() )
+                    if( !rMetafilePrimitive.getMetaFile().GetUseCanvas() )
                     {
                         // use new Metafile decomposition
-                        // TODO EMF+ stuffed into METACOMMENT support required
                         process(rCandidate);
                     }
                     else
                     {
+#ifdef DBG_UTIL
+                        // switch to test EMFPlus-enhanced MetafileDecomposition
+                        static bool bTestEMFPDecomposition(true);
+                        // switch to show the new visualization color.-changed behind
+                        // the original output vor visual testing
+                        static bool bUseChangedColorObject(true);
+
+                        if (bTestEMFPDecomposition)
+                        {
+                            if (bUseChangedColorObject)
+                            {
+                                primitive2d::Primitive2DContainer aDecomposition;
+                                rMetafilePrimitive.get2DDecomposition(aDecomposition, getViewInformation2D());
+                                const primitive2d::ModifiedColorPrimitive2D aPrimitiveR(
+                                    aDecomposition,
+                                    basegfx::BColorModifierSharedPtr(
+                                        new basegfx::BColorModifier_RGBLuminanceContrast(
+                                            0.5, // red
+                                            -0.5, // green
+                                            -0.5, // blue
+                                            0.0, // luminance
+                                            0.0))); // contrast
+                                processBasePrimitive2D(aPrimitiveR);
+                                RenderMetafilePrimitive2D(rMetafilePrimitive);
+                            }
+                            else
+                            {
+                                process(rCandidate);
+                            }
+                        }
+                        else
+                        {
+                            // direct draw of MetaFile
+                            RenderMetafilePrimitive2D(rMetafilePrimitive);
+                        }
+#else // DBG_UTIL
                         // direct draw of MetaFile
-                        RenderMetafilePrimitive2D( rMetafilePrimitive );
+                        RenderMetafilePrimitive2D(rMetafilePrimitive);
+#endif // DBG_UTIL
                     }
 
                     if(bForceLineSnap)
diff --git a/drawinglayer/source/tools/emfpbrush.hxx b/drawinglayer/source/tools/emfpbrush.hxx
index 852b2d469b4b..792b5f018790 100644
--- a/drawinglayer/source/tools/emfpbrush.hxx
+++ b/drawinglayer/source/tools/emfpbrush.hxx
@@ -21,6 +21,8 @@
 #define INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPBRUSH_HXX
 
 #include <emfphelperdata.hxx>
+#include <tools/color.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
 
 namespace emfplushelper
 {
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 80d9a7f3fafa..fdb0fb11c42f 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -28,6 +28,8 @@
 #include <basegfx/curve/b2dcubicbezier.hxx>
 #include <wmfemfhelper.hxx>
 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
 
 namespace emfplushelper
 {
@@ -131,14 +133,14 @@ namespace emfplushelper
             case EmfPlusObjectTypeBrush:
             {
                 EMFPBrush *brush;
-                aObjects[index].reset(brush = new EMFPBrush());
+                maEMFPObjects[index].reset(brush = new EMFPBrush());
                 brush->Read(rObjectStream, *this);
                 break;
             }
             case EmfPlusObjectTypePen:
             {
                 EMFPPen *pen;
-                aObjects[index].reset(pen = new EMFPPen());
+                maEMFPObjects[index].reset(pen = new EMFPPen());
                 pen->Read(rObjectStream, *this);
                 break;
             }
@@ -151,21 +153,21 @@ namespace emfplushelper
                 SAL_INFO("cppcanvas.emf", "EMF+\tpath");
                 SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " points: " << std::dec << points << " additional flags: 0x" << std::hex << pathFlags << std::dec);
                 EMFPPath *path;
-                aObjects[index].reset(path = new EMFPPath(points));
+                maEMFPObjects[index].reset(path = new EMFPPath(points));
                 path->Read(rObjectStream, pathFlags, *this);
                 break;
             }
             case EmfPlusObjectTypeRegion:
             {
                 EMFPRegion *region;
-                aObjects[index].reset(region = new EMFPRegion());
+                maEMFPObjects[index].reset(region = new EMFPRegion());
                 region->Read(rObjectStream);
                 break;
             }
             case EmfPlusObjectTypeImage:
             {
                 EMFPImage *image;
-                aObjects[index].reset(image = new EMFPImage);
+                maEMFPObjects[index].reset(image = new EMFPImage);
                 image->type = 0;
                 image->width = 0;
                 image->height = 0;
@@ -177,7 +179,7 @@ namespace emfplushelper
             case EmfPlusObjectTypeFont:
             {
                 EMFPFont *font;
-                aObjects[index].reset(font = new EMFPFont);
+                maEMFPObjects[index].reset(font = new EMFPFont);
                 font->emSize = 0;
                 font->sizeUnit = 0;
                 font->fontFlags = 0;
@@ -187,7 +189,7 @@ namespace emfplushelper
             case EmfPlusObjectTypeStringFormat:
             {
                 EMFPStringFormat *stringFormat;
-                aObjects[index].reset(stringFormat = new EMFPStringFormat());
+                maEMFPObjects[index].reset(stringFormat = new EMFPStringFormat());
                 stringFormat->Read(rObjectStream);
                 break;
             }
@@ -287,49 +289,39 @@ namespace emfplushelper
         return true;
     }
 
-    void EmfPlusHelperData::MapToDevice(double& x, double& y)
+    void EmfPlusHelperData::mappingChanged()
     {
-        // TODO: other units
-        x = 100 * mnMmX*x / mnPixX;
-        y = 100 * mnMmY*y / mnPixY;
+        // Call when mnMmX/mnMmY/mnPixX/mnPixY/mnFrameLeft/mnFrameTop/maWorldTransform/ changes.
+        // Currently not used are mnHDPI/mnVDPI/mnFrameRight/mnFrameBottom. *If* these should
+        // be used in the future, this method will need to be called.
+        //
+        // Re-calculate maMapTransform to contain the complete former transformation so that
+        // it can be applied by a single matrix multiplication or be added to an encapsulated
+        // primitive later
+        //
+        // To evtl. correct and see where this came from, please compare with the implementations
+        // of EmfPlusHelperData::MapToDevice and EmfPlusHelperData::Map* in prev versions
+        maMapTransform = maWorldTransform;
+        maMapTransform *= basegfx::tools::createScaleB2DHomMatrix(100.0 * mnMmX / mnPixX, 100.0 * mnMmY / mnPixY);
+        maMapTransform *= basegfx::tools::createTranslateB2DHomMatrix(double(-mnFrameLeft), double(-mnFrameTop));
+        maMapTransform *= basegfx::tools::createScaleB2DHomMatrix(maBaseTransform.get(0, 0), maBaseTransform.get(1, 1));
     }
 
     ::basegfx::B2DPoint EmfPlusHelperData::Map(double ix, double iy)
     {
-        double x, y;
-
-        x = ix*aWorldTransform.get(0,0) + iy*aWorldTransform.get(0,1) + aWorldTransform.get(0,2);
-        y = ix*aWorldTransform.get(1,0) + iy*aWorldTransform.get(1,1) + aWorldTransform.get(1,2);
-
-        MapToDevice(x, y);
-
-        x -= mnFrameLeft;
-        y -= mnFrameTop;
-
-        x *= aBaseTransform.get(0,0);
-        y *= aBaseTransform.get(1,1);
-
-        return ::basegfx::B2DPoint(x, y);
+        // map in one step using complete MapTransform (see mappingChanged)
+        return maMapTransform * ::basegfx::B2DPoint(ix, iy);
     }
 
     ::basegfx::B2DSize EmfPlusHelperData::MapSize(double iwidth, double iheight)
     {
-        double w, h;
-
-        w = iwidth*aWorldTransform.get(0,0) + iheight*aWorldTransform.get(1,0);
-        h = iwidth*aWorldTransform.get(1,0) + iheight*aWorldTransform.get(1,1);
-
-        MapToDevice(w, h);
-
-        w *= aBaseTransform.get(0,0);
-        h *= aBaseTransform.get(1,1);
-
-        return ::basegfx::B2DSize(w, h);
+        // map in one step using complete MapTransform (see mappingChanged)
+        return maMapTransform * ::basegfx::B2DSize(iwidth, iheight);
     }
 
     void EmfPlusHelperData::EMFPPlusDrawPolygon(const ::basegfx::B2DPolyPolygon& polygon, sal_uInt32 penIndex)
     {
-        const EMFPPen* pen = static_cast<EMFPPen*>(aObjects[penIndex & 0xff].get());
+        const EMFPPen* pen = static_cast<EMFPPen*>(maEMFPObjects[penIndex & 0xff].get());
         SAL_WARN_IF(!pen, "cppcanvas.emf", "emf+ missing pen");
 
         if (pen && polygon.count())
@@ -359,14 +351,15 @@ namespace emfplushelper
         SvMemoryStream& rMS,
         wmfemfhelper::TargetHolders& rTargetHolders,
         wmfemfhelper::PropertyHolders& rPropertyHolders)
-    :   aBaseTransform(),
-        aWorldTransform(),
-        aObjects(),
-        fPageScale(0.0),
-        nOriginX(0),
-        nOriginY(0),
-        nHDPI(0),
-        nVDPI(0),
+    :   maBaseTransform(),
+        maWorldTransform(),
+        maMapTransform(),
+        maEMFPObjects(),
+        mfPageScale(0.0),
+        mnOriginX(0),
+        mnOriginY(0),
+        mnHDPI(0),
+        mnVDPI(0),
         mnFrameLeft(0),
         mnFrameTop(0),
         mnFrameRight(0),
@@ -387,7 +380,8 @@ namespace emfplushelper
         SAL_INFO("cppcanvas.emf", "EMF+ picture frame: " << mnFrameLeft << "," << mnFrameTop << " - " << mnFrameRight << "," << mnFrameBottom);
         rMS.ReadInt32(mnPixX).ReadInt32(mnPixY).ReadInt32(mnMmX).ReadInt32(mnMmY);
         SAL_INFO("cppcanvas.emf", "EMF+ ref device pixel size: " << mnPixX << "x" << mnPixY << " mm size: " << mnMmX << "x" << mnMmY);
-        readXForm(rMS, aBaseTransform);
+        readXForm(rMS, maBaseTransform);
+        mappingChanged();
     }
 
     EmfPlusHelperData::~EmfPlusHelperData()
@@ -466,9 +460,9 @@ namespace emfplushelper
                     {
                         sal_uInt32 header, version;
 
-                        rMS.ReadUInt32(header).ReadUInt32(version).ReadInt32(nHDPI).ReadInt32(nVDPI);
+                        rMS.ReadUInt32(header).ReadUInt32(version).ReadInt32(mnHDPI).ReadInt32(mnVDPI);
                         SAL_INFO("cppcanvas.emf", "EMF+ Header");
-                        SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " version: " << std::dec << version << " horizontal DPI: " << nHDPI << " vertical DPI: " << nVDPI << " dual: " << (flags & 1));
+                        SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " version: " << std::dec << version << " horizontal DPI: " << mnHDPI << " vertical DPI: " << mnVDPI << " dual: " << (flags & 1));
                         break;
                     }
                     case EmfPlusRecordTypeEndOfFile:
@@ -573,8 +567,8 @@ namespace emfplushelper
                         rMS.ReadUInt32(brushIndexOrColor);
                         SAL_INFO("cppcanvas.emf", "EMF+ FillPath slot: " << index);
 
-                        EMFPPlusFillPolygon(static_cast<EMFPPath*>(aObjects[index].get())->GetPolygon(*this), flags & 0x8000, brushIndexOrColor);
-    //                    EMFPPlusFillPolygon(static_cast<EMFPPath*>(aObjects[index])->GetPolygon(*this), rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor);
+                        EMFPPlusFillPolygon(static_cast<EMFPPath*>(maEMFPObjects[index].get())->GetPolygon(*this), flags & 0x8000, brushIndexOrColor);
+    //                    EMFPPlusFillPolygon(static_cast<EMFPPath*>(maEMFPObjects[index])->GetPolygon(*this), rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor);
                     }
                     break;
                     case EmfPlusRecordTypeDrawEllipse:
@@ -705,7 +699,7 @@ namespace emfplushelper
                         rMS.ReadUInt32(penIndex);
                         SAL_INFO("cppcanvas.emf", "EMF+ DrawPath");
                         SAL_INFO("cppcanvas.emf", "EMF+\tpen: " << penIndex);
-                        EMFPPath* path = static_cast<EMFPPath*>(aObjects[flags & 0xff].get());
+                        EMFPPath* path = static_cast<EMFPPath*>(maEMFPObjects[flags & 0xff].get());
                         SAL_WARN_IF(!path, "cppcanvas.emf", "EmfPlusRecordTypeDrawPath missing path");
 
                         EMFPPlusDrawPolygon(path->GetPolygon(*this), penIndex);
@@ -768,10 +762,10 @@ namespace emfplushelper
                         SAL_INFO("cppcanvas.emf", "EMF+ " << (type == EmfPlusRecordTypeDrawImagePoints ? "DrawImagePoints" : "DrawImage") << "attributes index: " << attrIndex << "source unit: " << sourceUnit);
                         SAL_INFO("cppcanvas.emf", "EMF+\tTODO: use image attributes");
 
-                        if (sourceUnit == 2 && aObjects[flags & 0xff].get())
+                        if (sourceUnit == 2 && maEMFPObjects[flags & 0xff].get())
                         {
                             // we handle only GraphicsUnit.Pixel now
-                            EMFPImage& image = *static_cast<EMFPImage *>(aObjects[flags & 0xff].get());
+                            EMFPImage& image = *static_cast<EMFPImage *>(maEMFPObjects[flags & 0xff].get());
                             float sx, sy, sw, sh;
                             sal_Int32 aCount;
                             ReadRectangle(rMS, sx, sy, sw, sh);
@@ -867,7 +861,7 @@ namespace emfplushelper
                             rMS.ReadFloat(lx).ReadFloat(ly).ReadFloat(lw).ReadFloat(lh);
                             SAL_INFO("cppcanvas.emf", "EMF+ DrawString layoutRect: " << lx << "," << ly << " - " << lw << "x" << lh);
                             OUString text = read_uInt16s_ToOUString(rMS, stringLength);
-                            EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(aObjects[formatId & 0xff].get());
+                            EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(maEMFPObjects[formatId & 0xff].get());
     //                        css::rendering::FontRequest aFontRequest;
     //
     //                        if (stringFormat)
@@ -922,9 +916,9 @@ namespace emfplushelper
                     }
                     case EmfPlusRecordTypeSetPageTransform:
                     {
-                        rMS.ReadFloat(fPageScale);
+                        rMS.ReadFloat(mfPageScale);
                         SAL_INFO("cppcanvas.emf", "EMF+ SetPageTransform");
-                        SAL_INFO("cppcanvas.emf", "EMF+\tscale: " << fPageScale << " unit: " << flags);
+                        SAL_INFO("cppcanvas.emf", "EMF+\tscale: " << mfPageScale << " unit: " << flags);
 
                         if (flags != UnitTypePixel)
                         {
@@ -932,16 +926,17 @@ namespace emfplushelper
                         }
                         else
                         {
-                            mnMmX *= fPageScale;
-                            mnMmY *= fPageScale;
+                            mnMmX *= mfPageScale;
+                            mnMmY *= mfPageScale;
+                            mappingChanged();
                         }
                         break;
                     }
                     case EmfPlusRecordTypeSetRenderingOrigin:
                     {
-                        rMS.ReadInt32(nOriginX).ReadInt32(nOriginY);
+                        rMS.ReadInt32(mnOriginX).ReadInt32(mnOriginY);
                         SAL_INFO("cppcanvas.emf", "EMF+ SetRenderingOrigin");
-                        SAL_INFO("cppcanvas.emf", "EMF+\torigin [x,y]: " << nOriginX << "," << nOriginY);
+                        SAL_INFO("cppcanvas.emf", "EMF+\torigin [x,y]: " << mnOriginX << "," << mnOriginY);
                         break;
                     }
                     case EmfPlusRecordTypeSetTextRenderingHint:
@@ -1017,17 +1012,19 @@ namespace emfplushelper
                         SAL_INFO("cppcanvas.emf", "EMF+ SetWorldTransform");
                         basegfx::B2DHomMatrix transform;
                         readXForm(rMS, transform);
-                        aWorldTransform = transform;
+                        maWorldTransform = transform;
+                        mappingChanged();
                         SAL_INFO("cppcanvas.emf",
-                            "EMF+\tm11: " << aWorldTransform.get(0,0) << "\tm12: " << aWorldTransform.get(1,0) <<
-                            "\tm21: " << aWorldTransform.get(0,1) << "\tm22: " << aWorldTransform.get(1,1) <<
-                            "\tdx: " << aWorldTransform.get(0,2) << "\tdy: " << aWorldTransform.get(1,2));
+                            "EMF+\tm11: " << maWorldTransform.get(0,0) << "\tm12: " << maWorldTransform.get(1,0) <<
+                            "\tm21: " << maWorldTransform.get(0,1) << "\tm22: " << maWorldTransform.get(1,1) <<
+                            "\tdx: " << maWorldTransform.get(0,2) << "\tdy: " << maWorldTransform.get(1,2));
                         break;
                     }
                     case EmfPlusRecordTypeResetWorldTransform:
                     {
                         SAL_INFO("cppcanvas.emf", "EMF+ ResetWorldTransform");
-                        aWorldTransform.identity();
+                        maWorldTransform.identity();
+                        mappingChanged();
                         break;
                     }
                     case EmfPlusRecordTypeMultiplyWorldTransform:
@@ -1044,19 +1041,21 @@ namespace emfplushelper
                         if (flags & 0x2000)
                         {
                             // post multiply
-                            aWorldTransform *= transform;
+                            maWorldTransform *= transform;
                         }
                         else
                         {
                             // pre multiply
-                            transform *= aWorldTransform;
-                            aWorldTransform = transform;
+                            transform *= maWorldTransform;
+                            maWorldTransform = transform;
                         }
 
+                        mappingChanged();
+
                         SAL_INFO("cppcanvas.emf",
-                            "EMF+\tmatrix m11: " << aWorldTransform.get(0, 0) << "m12: " << aWorldTransform.get(0, 1) <<
-                            "EMF+\tm21: " << aWorldTransform.get(1, 0) << "m22: " << aWorldTransform.get(1, 1) <<
-                            "EMF+\tdx: " << aWorldTransform.get(2, 0) << "dy: " << aWorldTransform.get(2, 1));
+                            "EMF+\tmatrix m11: " << maWorldTransform.get(0, 0) << "m12: " << maWorldTransform.get(0, 1) <<
+                            "EMF+\tm21: " << maWorldTransform.get(1, 0) << "m22: " << maWorldTransform.get(1, 1) <<
+                            "EMF+\tdx: " << maWorldTransform.get(2, 0) << "dy: " << maWorldTransform.get(2, 1));
                         break;
                     }
                     case EmfPlusRecordTypeTranslateWorldTransform:
@@ -1077,19 +1076,21 @@ namespace emfplushelper
                         if (flags & 0x2000)
                         {
                             // post multiply
-                            aWorldTransform *= transform;
+                            maWorldTransform *= transform;
                         }
                         else
                         {
                             // pre multiply
-                            transform *= aWorldTransform;
-                            aWorldTransform = transform;
+                            transform *= maWorldTransform;
+                            maWorldTransform = transform;
                         }
 
+                        mappingChanged();
+
                         SAL_INFO("cppcanvas.emf",
-                            "EMF+\tmatrix m11: " << aWorldTransform.get(0, 0) << "m12: " << aWorldTransform.get(0, 1) <<
-                            "EMF+\tm21: " << aWorldTransform.get(1, 0) << "m22: " << aWorldTransform.get(1, 1) <<
-                            "EMF+\tdx: " << aWorldTransform.get(2, 0) << "dy: " << aWorldTransform.get(2, 1));
+                            "EMF+\tmatrix m11: " << maWorldTransform.get(0, 0) << "m12: " << maWorldTransform.get(0, 1) <<
+                            "EMF+\tm21: " << maWorldTransform.get(1, 0) << "m22: " << maWorldTransform.get(1, 1) <<
+                            "EMF+\tdx: " << maWorldTransform.get(2, 0) << "dy: " << maWorldTransform.get(2, 1));
                         break;
                     }
                     case EmfPlusRecordTypeScaleWorldTransform:
@@ -1102,26 +1103,28 @@ namespace emfplushelper
 
                         SAL_INFO("cppcanvas.emf", "EMF+ ScaleWorldTransform Sx: " << transform.get(0,0) << " Sy: " << transform.get(1,1));
                         SAL_INFO("cppcanvas.emf",
-                            "EMF+\t m11: " << aWorldTransform.get(0,0) << ", m12: " << aWorldTransform.get(0,1) <<
-                            "EMF+\t m21: " << aWorldTransform.get(1,0) << ", m22: " << aWorldTransform.get(1,1) <<
-                            "EMF+\t dx: " << aWorldTransform.get(2,0) << ", dy: " << aWorldTransform.get(2,1));
+                            "EMF+\t m11: " << maWorldTransform.get(0,0) << ", m12: " << maWorldTransform.get(0,1) <<
+                            "EMF+\t m21: " << maWorldTransform.get(1,0) << ", m22: " << maWorldTransform.get(1,1) <<
+                            "EMF+\t dx: " << maWorldTransform.get(2,0) << ", dy: " << maWorldTransform.get(2,1));
 
                         if (flags & 0x2000)
                         {
                             // post multiply
-                            aWorldTransform *= transform;
+                            maWorldTransform *= transform;
                         }
                         else
                         {
                             // pre multiply
-                            transform *= aWorldTransform;
-                            aWorldTransform = transform;
+                            transform *= maWorldTransform;
+                            maWorldTransform = transform;
                         }
 
+                        mappingChanged();
+
                         SAL_INFO("cppcanvas.emf",
-                            "EMF+\t m11: " << aWorldTransform.get(0, 0) << ", m12: " << aWorldTransform.get(0, 1) <<
-                            "EMF+\t m21: " << aWorldTransform.get(1, 0) << ", m22: " << aWorldTransform.get(1, 1) <<
-                            "EMF+\t dx: " << aWorldTransform.get(2, 0) << ", dy: " << aWorldTransform.get(2, 1));
+                            "EMF+\t m11: " << maWorldTransform.get(0, 0) << ", m12: " << maWorldTransform.get(0, 1) <<
+                            "EMF+\t m21: " << maWorldTransform.get(1, 0) << ", m22: " << maWorldTransform.get(1, 1) <<
+                            "EMF+\t dx: " << maWorldTransform.get(2, 0) << ", dy: " << maWorldTransform.get(2, 1));
                         break;
                     }
                     case EmfPlusRecordTypeSetClipRect:
@@ -1161,7 +1164,7 @@ namespace emfplushelper
                         SAL_INFO("cppcanvas.emf", "EMF+ SetClipPath combine mode: " << combineMode);
                         SAL_INFO("cppcanvas.emf", "EMF+\tpath in slot: " << (flags & 0xff));
 
-                        EMFPPath& path = *static_cast<EMFPPath*>(aObjects[flags & 0xff].get());
+                        EMFPPath& path = *static_cast<EMFPPath*>(maEMFPObjects[flags & 0xff].get());
                         ::basegfx::B2DPolyPolygon& clipPoly(path.GetPolygon(*this));
                         // clipPoly.transform(rState.mapModeTransform);
 
@@ -1192,7 +1195,7 @@ namespace emfplushelper
                         int combineMode = (flags >> 8) & 0xf;
                         SAL_INFO("cppcanvas.emf", "EMF+ SetClipRegion");
                         SAL_INFO("cppcanvas.emf", "EMF+\tregion in slot: " << (flags & 0xff) << " combine mode: " << combineMode);
-                        EMFPRegion *region = static_cast<EMFPRegion*>(aObjects[flags & 0xff].get());
+                        EMFPRegion *region = static_cast<EMFPRegion*>(maEMFPObjects[flags & 0xff].get());
 
                         // reset clip
                         if (region && region->parts == 0 && region->initialState == EmfPlusRegionInitialStateInfinite)
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index c2d799cfd5f5..a700df8dac6c 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -21,9 +21,17 @@
 #define INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPHELPERDATA_HXX
 
 #include <emfplushelper.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <tools/stream.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dsize.hxx>
 //#include <com/sun/star/rendering/XCanvasFont.hpp>
 //#include <com/sun/star/rendering/TextDirection.hpp>
 
+// predefines
+class SvStream;
+namespace basegfx { class B2DPolyPolygon; }
+
 namespace emfplushelper
 {
     // EMF+ commands
@@ -171,7 +179,7 @@ namespace emfplushelper
 
 //    typedef struct
 //    {
-//        basegfx::B2DHomMatrix   aWorldTransform;
+//        basegfx::B2DHomMatrix   maWorldTransform;
 //        OutDevState             aDevState;
 //    } EmfPlusGraphicState;
 //
@@ -181,29 +189,31 @@ namespace emfplushelper
     {
     private:
         /* EMF+ */
-        basegfx::B2DHomMatrix   aBaseTransform;
-        basegfx::B2DHomMatrix   aWorldTransform;
-        std::unique_ptr<EMFPObject> aObjects[256];
-        float                   fPageScale;
-        sal_Int32               nOriginX;
-        sal_Int32               nOriginY;
-        sal_Int32               nHDPI;
-        sal_Int32               nVDPI;
+        basegfx::B2DHomMatrix       maBaseTransform;
+        basegfx::B2DHomMatrix       maWorldTransform;
+        basegfx::B2DHomMatrix       maMapTransform;
+
+        std::unique_ptr<EMFPObject> maEMFPObjects[256];
+        float                       mfPageScale;
+        sal_Int32                   mnOriginX;
+        sal_Int32                   mnOriginY;
+        sal_Int32                   mnHDPI;
+        sal_Int32                   mnVDPI;
 
         /* EMF+ emf header info */
-        sal_Int32               mnFrameLeft;
-        sal_Int32               mnFrameTop;
-        sal_Int32               mnFrameRight;
-        sal_Int32               mnFrameBottom;
-        sal_Int32               mnPixX;
-        sal_Int32               mnPixY;
-        sal_Int32               mnMmX;
-        sal_Int32               mnMmY;
+        sal_Int32                   mnFrameLeft;
+        sal_Int32                   mnFrameTop;
+        sal_Int32                   mnFrameRight;
+        sal_Int32                   mnFrameBottom;
+        sal_Int32                   mnPixX;
+        sal_Int32                   mnPixY;
+        sal_Int32                   mnMmX;
+        sal_Int32                   mnMmY;
 
         /* multipart object data */
-        bool                    mbMultipart;
-        sal_uInt16              mMFlags;
-        SvMemoryStream          mMStream;
+        bool                        mbMultipart;
+        sal_uInt16                  mMFlags;
+        SvMemoryStream              mMStream;
 
         /* emf+ graphic state stack */
 //        GraphicStateMap         mGSStack;
@@ -218,7 +228,7 @@ namespace emfplushelper
         void ReadPoint(SvStream& s, float& x, float& y, sal_uInt32 flags);
 
         // internal mapper
-        void MapToDevice(double& x, double& y);
+        void mappingChanged();
 
         // primitive creators
         void EMFPPlusDrawPolygon(const ::basegfx::B2DPolyPolygon& polygon, sal_uInt32 penIndex);
diff --git a/drawinglayer/source/tools/emfpimage.hxx b/drawinglayer/source/tools/emfpimage.hxx
index d5a06c5e56b9..455a88ea7757 100644
--- a/drawinglayer/source/tools/emfpimage.hxx
+++ b/drawinglayer/source/tools/emfpimage.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPIMAGE_HXX
 
 #include <emfphelperdata.hxx>
+#include <vcl/graph.hxx>
 
 namespace emfplushelper
 {
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index b272f4a51eb3..4c7a298b912f 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -22,39 +22,41 @@
 //#include <basegfx/tools/canvastools.hxx>
 //#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
 //#include <basegfx/color/bcolor.hxx>
-//#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
-//#include <vcl/lineinfo.hxx>
+#include <drawinglayer/primitive2d/pointarrayprimitive2d.hxx>
+#include <vcl/lineinfo.hxx>
 //#include <drawinglayer/attribute/lineattribute.hxx>
 //#include <drawinglayer/attribute/strokeattribute.hxx>
-//#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
 //#include <vcl/metaact.hxx>
-//#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
-//#include <basegfx/matrix/b2dhommatrixtools.hxx>
-//#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-//#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
 #include <drawinglayer/primitive2d/discretebitmapprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
 #include <vcl/salbtype.hxx>
-//#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
+#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
 //#include <vcl/svapp.hxx>
-//#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
-//#include <basegfx/polygon/b2dpolygonclipper.hxx>
+#include <drawinglayer/primitive2d/transparenceprimitive2d.hxx>
+#include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolygonclipper.hxx>
 #include <drawinglayer/primitive2d/invertprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
+#include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx>
 //#include <drawinglayer/primitive2d/fillgraphicprimitive2d.hxx>
 #include <drawinglayer/primitive2d/wallpaperprimitive2d.hxx>
 //#include <drawinglayer/primitive2d/textprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
-//#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx>
 //#include <i18nlangtag/languagetag.hxx>
 #include <drawinglayer/primitive2d/textlineprimitive2d.hxx>
 #include <drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx>
-//#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
+#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
 #include <tools/fract.hxx>
 //#include <numeric>
+#include <vcl/gradient.hxx>
+#include <vcl/hatch.hxx>
 #include <emfplushelper.hxx>
 
 namespace drawinglayer
diff --git a/include/vcl/gdimetafiletools.hxx b/include/vcl/gdimetafiletools.hxx
index ea47ced5032e..2296ab219e22 100644
--- a/include/vcl/gdimetafiletools.hxx
+++ b/include/vcl/gdimetafiletools.hxx
@@ -46,6 +46,7 @@ class VCL_DLLPUBLIC MetafileAccessor
 {
 public:
     virtual bool accessMetafile(GDIMetaFile& rTargetMetafile) const = 0;
+    virtual ~MetafileAccessor();
 };
 
 
diff --git a/vcl/source/gdi/gdimetafiletools.cxx b/vcl/source/gdi/gdimetafiletools.cxx
index 6cbdcdc0734f..b826b2fa8a0c 100644
--- a/vcl/source/gdi/gdimetafiletools.cxx
+++ b/vcl/source/gdi/gdimetafiletools.cxx
@@ -1083,4 +1083,8 @@ bool usesClipActions(const GDIMetaFile& rSource)
     return false;
 }
 
+MetafileAccessor::~MetafileAccessor()
+{
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit cf8d924fa6c4692ca6c6499dffc7c81a5b682d1d
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Wed Jun 21 19:31:32 2017 +0200

    emfplus: more corrections and rough geometry
    
    Corrected/streamlined more, added 1st rough geometry
    creation to have a proof of concept. Checked the
    helper classes based on EMFPObject and their derivates.
    First versions of EMFPPlusDrawPolygon and
    EMFPPlusFillPolygon, but the complex info in the data
    objects needs more complex primitive creation. Not sure
    if primitive creators like createHairlineAndFillPrimitive
    will be usable, these are based on PropertyHolder info.
    Also added usage of HandleNewClipRegion, that should be
    usable
    
    Change-Id: I96119be290140bee252ee21a3e1187fad60e9c7d

diff --git a/drawinglayer/inc/wmfemfhelper.hxx b/drawinglayer/inc/wmfemfhelper.hxx
index 699b065795df..a11b6578e572 100644
--- a/drawinglayer/inc/wmfemfhelper.hxx
+++ b/drawinglayer/inc/wmfemfhelper.hxx
@@ -208,6 +208,11 @@ namespace wmfemfhelper
     drawinglayer::primitive2d::Primitive2DContainer interpretMetafile(
         const GDIMetaFile& rMetaFile,
         const drawinglayer::geometry::ViewInformation2D& rViewInformation);
+
+    void HandleNewClipRegion(
+        const basegfx::B2DPolyPolygon& rClipPolyPolygon,
+        TargetHolders& rTargetHolders,
+        PropertyHolders& rPropertyHolders);
 }
 
 #endif
diff --git a/drawinglayer/source/tools/emfpbrush.cxx b/drawinglayer/source/tools/emfpbrush.cxx
index c093a5682572..d55a16ad30d7 100644
--- a/drawinglayer/source/tools/emfpbrush.cxx
+++ b/drawinglayer/source/tools/emfpbrush.cxx
@@ -64,23 +64,32 @@ namespace emfplushelper
 
     EMFPBrush::~EMFPBrush()
     {
-        if (blendPositions != nullptr) {
+        if (blendPositions != nullptr)
+        {
             delete[] blendPositions;
             blendPositions = nullptr;
         }
-        if (colorblendPositions != nullptr) {
+
+        if (colorblendPositions != nullptr)
+        {
             delete[] colorblendPositions;
             colorblendPositions = nullptr;
         }
-        if (colorblendColors != nullptr) {
+
+        if (colorblendColors != nullptr)
+        {
             delete[] colorblendColors;
             colorblendColors = nullptr;
         }
-        if (surroundColors != nullptr) {
+
+        if (surroundColors != nullptr)
+        {
             delete[] surroundColors;
             surroundColors = nullptr;
         }
-        if (path) {
+
+        if (path)
+        {
             delete path;
             path = nullptr;
         }
@@ -95,232 +104,267 @@ namespace emfplushelper
         SAL_INFO("cppcanvas.emf", "EMF+\tbrush");
         SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << header << " type: " << type << std::dec);
 
-        switch (type) {
-        case BrushTypeSolidColor:
+        switch (type)
         {
-            sal_uInt32 color;
+            case BrushTypeSolidColor:
+            {
+                sal_uInt32 color;
+                s.ReadUInt32(color);
 
-            s.ReadUInt32(color);
-            solidColor = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
-            SAL_INFO("cppcanvas.emf", "EMF+\tsolid color: 0x" << std::hex << color << std::dec);
-            break;
-        }
-        case BrushTypeHatchFill:
-        {
-            sal_uInt32 style;
-            sal_uInt32 foregroundColor;
-            sal_uInt32 backgroundColor;
-            s.ReadUInt32(style);
-            s.ReadUInt32(foregroundColor);
-            s.ReadUInt32(backgroundColor);
-
-            hatchStyle = static_cast<EmfPlusHatchStyle>(style);
-            solidColor = ::Color(0xff - (foregroundColor >> 24), (foregroundColor >> 16) & 0xff, (foregroundColor >> 8) & 0xff, foregroundColor & 0xff);
-            secondColor = ::Color(0xff - (backgroundColor >> 24), (backgroundColor >> 16) & 0xff, (backgroundColor >> 8) & 0xff, backgroundColor & 0xff);
-            SAL_INFO("cppcanvas.emf", "EMF+\thatch style " << style << " foregroundcolor: 0x" << solidColor.AsRGBHexString() << " background 0x" << secondColor.AsRGBHexString());
-            break;
-        }
-        case BrushTypeTextureFill:
-        {
-            SAL_WARN("cppcanvas.emf", "EMF+\tTODO: implement BrushTypeTextureFill brush");
-            break;
-        }
-        case BrushTypePathGradient:
-        {
-            s.ReadUInt32(additionalFlags).ReadInt32(wrapMode);
+                solidColor = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+                SAL_INFO("cppcanvas.emf", "EMF+\tsolid color: 0x" << std::hex << color << std::dec);
+                break;
+            }
+            case BrushTypeHatchFill:
+            {
+                sal_uInt32 style;
+                sal_uInt32 foregroundColor;
+                sal_uInt32 backgroundColor;
+                s.ReadUInt32(style);
+                s.ReadUInt32(foregroundColor);
+                s.ReadUInt32(backgroundColor);
+
+                hatchStyle = static_cast<EmfPlusHatchStyle>(style);
+                solidColor = ::Color(0xff - (foregroundColor >> 24), (foregroundColor >> 16) & 0xff, (foregroundColor >> 8) & 0xff, foregroundColor & 0xff);
+                secondColor = ::Color(0xff - (backgroundColor >> 24), (backgroundColor >> 16) & 0xff, (backgroundColor >> 8) & 0xff, backgroundColor & 0xff);
+                SAL_INFO("cppcanvas.emf", "EMF+\thatch style " << style << " foregroundcolor: 0x" << solidColor.AsRGBHexString() << " background 0x" << secondColor.AsRGBHexString());
+                break;
+            }
+            case BrushTypeTextureFill:
+            {
+                SAL_WARN("cppcanvas.emf", "EMF+\tTODO: implement BrushTypeTextureFill brush");
+                break;
+            }
+            case BrushTypePathGradient:
+            {
+                s.ReadUInt32(additionalFlags).ReadInt32(wrapMode);
+                SAL_INFO("cppcanvas.emf", "EMF+\tpath gradient, additional flags: 0x" << std::hex << additionalFlags << std::dec);
+                sal_uInt32 color;
+                s.ReadUInt32(color);
+                solidColor = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+                SAL_INFO("cppcanvas.emf", "EMF+\tcenter color: 0x" << std::hex << color << std::dec);
+                s.ReadFloat(areaX).ReadFloat(areaY);
+                SAL_INFO("cppcanvas.emf", "EMF+\tcenter point: " << areaX << "," << areaY);
+                s.ReadInt32(surroundColorsNumber);
+                SAL_INFO("cppcanvas.emf", "EMF+\t number of surround colors: " << surroundColorsNumber);
+
+                if (surroundColorsNumber<0 || sal_uInt32(surroundColorsNumber)>SAL_MAX_INT32 / sizeof(::Color))
+                {
+                    surroundColorsNumber = SAL_MAX_INT32 / sizeof(::Color);
+                }
 
-            SAL_INFO("cppcanvas.emf", "EMF+\tpath gradient, additional flags: 0x" << std::hex << additionalFlags << std::dec);
+                surroundColors = new ::Color[surroundColorsNumber];
 
-            sal_uInt32 color;
+                for (int i = 0; i < surroundColorsNumber; i++)
+                {
+                    s.ReadUInt32(color);
+                    surroundColors[i] = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+                    if (i == 0)
+                        secondColor = surroundColors[0];
+                    SAL_INFO("cppcanvas.emf", "EMF+\tsurround color[" << i << "]: 0x" << std::hex << color << std::dec);
+                }
 
-            s.ReadUInt32(color);
-            solidColor = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
-            SAL_INFO("cppcanvas.emf", "EMF+\tcenter color: 0x" << std::hex << color << std::dec);
+                if (additionalFlags & 0x01)
+                {
+                    sal_Int32 pathLength;
 
-            s.ReadFloat(areaX).ReadFloat(areaY);
-            SAL_INFO("cppcanvas.emf", "EMF+\tcenter point: " << areaX << "," << areaY);
+                    s.ReadInt32(pathLength);
+                    SAL_INFO("cppcanvas.emf", "EMF+\tpath length: " << pathLength);
 
-            s.ReadInt32(surroundColorsNumber);
-            SAL_INFO("cppcanvas.emf", "EMF+\t number of surround colors: " << surroundColorsNumber);
+                    sal_uInt64 const pos = s.Tell();
 
-            if (surroundColorsNumber<0 || sal_uInt32(surroundColorsNumber)>SAL_MAX_INT32 / sizeof(::Color))
-                surroundColorsNumber = SAL_MAX_INT32 / sizeof(::Color);
+                    sal_uInt32 pathHeader;
+                    sal_Int32 pathPoints, pathFlags;
+                    s.ReadUInt32(pathHeader).ReadInt32(pathPoints).ReadInt32(pathFlags);
 
-            surroundColors = new ::Color[surroundColorsNumber];
-            for (int i = 0; i < surroundColorsNumber; i++) {
-                s.ReadUInt32(color);
-                surroundColors[i] = ::Color(0xff - (color >> 24), (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
-                if (i == 0)
-                    secondColor = surroundColors[0];
-                SAL_INFO("cppcanvas.emf", "EMF+\tsurround color[" << i << "]: 0x" << std::hex << color << std::dec);
-            }
+                    SAL_INFO("cppcanvas.emf", "EMF+\tpath (brush path gradient)");
+                    SAL_INFO("cppcanvas.emf", "EMF+\theader: 0x" << std::hex << pathHeader << " points: " << std::dec << pathPoints << " additional flags: 0x" << std::hex << pathFlags << std::dec);
 
-            if (additionalFlags & 0x01) {
-                sal_Int32 pathLength;
+                    path = new EMFPPath(pathPoints);
+                    path->Read(s, pathFlags, rR);
 
-                s.ReadInt32(pathLength);
-                SAL_INFO("cppcanvas.emf", "EMF+\tpath length: " << pathLength);
+                    s.Seek(pos + pathLength);
 
-                sal_uInt64 const pos = s.Tell();

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list