[Libreoffice-commits] core.git: Branch 'feature/emfplusprimitiveparser' - 3 commits - drawinglayer/source emfio/CppunitTest_emfio_emf_test.mk emfio/CppunitTest_emfio_wmf_test.mk emfio/qa emfio/source vcl/CppunitTest_vcl_filters_test.mk vcl/qa

Noel Grandin noel.grandin at collabora.co.uk
Sat Jul 15 00:19:21 UTC 2017


Rebased ref, commits from common ancestor:
commit 2faf17d0b0e7079f394ac2307070b988af1e5123
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Sat Jul 15 00:49:33 2017 +0200

    loplugin:useuniqueptr in basic..cppcanvas
    
    Porting over b0e05f9ade9e93c569c6a62c59ac1819e615f27b to copies
    of emfpp*.[ch]xx
    
    Change-Id: I059d2cc371f24ce3d43fc2e255b1dc1c227cf555

diff --git a/drawinglayer/source/tools/emfppath.cxx b/drawinglayer/source/tools/emfppath.cxx
index 64b3411e4b49..d68fd425994c 100644
--- a/drawinglayer/source/tools/emfppath.cxx
+++ b/drawinglayer/source/tools/emfppath.cxx
@@ -50,18 +50,14 @@ namespace emfplushelper
         }
 
         nPoints = _nPoints;
-        pPoints = new float [nPoints*2];
+        pPoints.reset( new float [nPoints*2] );
 
         if (!bLines)
-            pPointTypes = new sal_uInt8 [_nPoints];
-        else
-            pPointTypes = nullptr;
+            pPointTypes.reset( new sal_uInt8 [_nPoints] );
     }
 
     EMFPPath::~EMFPPath ()
     {
-        delete [] pPoints;
-        delete [] pPointTypes;
     }
 
     // TODO: remove rR argument when debug code is no longer needed
diff --git a/drawinglayer/source/tools/emfppath.hxx b/drawinglayer/source/tools/emfppath.hxx
index 64c7c39c7438..1e8c69771f59 100644
--- a/drawinglayer/source/tools/emfppath.hxx
+++ b/drawinglayer/source/tools/emfppath.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPPATH_HXX
 
 #include <emfphelperdata.hxx>
+#include <memory>
 
 namespace emfplushelper
 {
@@ -28,8 +29,8 @@ namespace emfplushelper
     {
         ::basegfx::B2DPolyPolygon    aPolygon;
         sal_Int32                    nPoints;
-        float*                       pPoints;
-        sal_uInt8*                   pPointTypes;
+        std::unique_ptr<float[]>     pPoints;
+        std::unique_ptr<sal_uInt8[]> pPointTypes;
 
         EMFPPath(sal_Int32 _nPoints, bool bLines = false);
 
diff --git a/drawinglayer/source/tools/emfppen.cxx b/drawinglayer/source/tools/emfppen.cxx
index cb8bbf4cb8d5..9bc66e6716af 100644
--- a/drawinglayer/source/tools/emfppen.cxx
+++ b/drawinglayer/source/tools/emfppen.cxx
@@ -77,11 +77,7 @@ namespace emfplushelper
         , dashStyle(0)
         , dashCap(0)
         , dashOffset(0.0)
-        , dashPatternLen(0)
-        , dashPattern(nullptr)
         , alignment(0)
-        , compoundArrayLen(0)
-        , compoundArray(nullptr)
         , customStartCapLen(0)
         , customStartCap(nullptr)
         , customEndCapLen(0)
@@ -91,8 +87,6 @@ namespace emfplushelper
 
     EMFPPen::~EMFPPen()
     {
-        delete[] dashPattern;
-        delete[] compoundArray;
         delete customStartCap;
         delete customEndCap;
     }
@@ -159,7 +153,7 @@ namespace emfplushelper
                 case EmfPlusLineStyleDot:        nLen = SAL_N_ELEMENTS(dot); pPattern = dot; break;
                 case EmfPlusLineStyleDashDot:    nLen = SAL_N_ELEMENTS(dashdot); pPattern = dashdot; break;
                 case EmfPlusLineStyleDashDotDot: nLen = SAL_N_ELEMENTS(dashdotdot); pPattern = dashdotdot; break;
-                case EmfPlusLineStyleCustom:     nLen = dashPatternLen; pPattern = dashPattern; break;
+                case EmfPlusLineStyleCustom:     nLen = dashPattern.size(); pPattern = dashPattern.data(); break;
             }
 
             if (nLen > 0)
@@ -256,6 +250,8 @@ namespace emfplushelper
         if (penDataFlags & PenDataDashedLine)
         {
             dashStyle = EmfPlusLineStyleCustom;
+            sal_Int32 dashPatternLen;
+
             s.ReadInt32(dashPatternLen);
             SAL_INFO("cppcanvas.emf", "EMF+\t\tdashPatternLen: " << dashPatternLen);
 
@@ -264,7 +260,7 @@ namespace emfplushelper
                 dashPatternLen = SAL_MAX_INT32 / sizeof(float);
             }
 
-            dashPattern = new float[dashPatternLen];
+            dashPattern.resize( dashPatternLen );
 
             for (i = 0; i < dashPatternLen; i++)
             {
@@ -272,10 +268,6 @@ namespace emfplushelper
                 SAL_INFO("cppcanvas.emf", "EMF+\t\t\tdashPattern[" << i << "]: " << dashPattern[i]);
             }
         }
-        else
-        {
-            dashPatternLen = 0;
-        }
 
         if (penDataFlags & PenDataNonCenter)
         {
@@ -288,6 +280,7 @@ namespace emfplushelper
 
         if (penDataFlags & PenDataCompoundLine)
         {
+            sal_Int32 compoundArrayLen;
             s.ReadInt32(compoundArrayLen);
 
             if (compoundArrayLen<0 || sal_uInt32(compoundArrayLen)>SAL_MAX_INT32 / sizeof(float))
@@ -295,17 +288,13 @@ namespace emfplushelper
                 compoundArrayLen = SAL_MAX_INT32 / sizeof(float);
             }
 
-            compoundArray = new float[compoundArrayLen];
+            compoundArray.resize(compoundArrayLen);
 
             for (i = 0; i < compoundArrayLen; i++)
             {
                 s.ReadFloat(compoundArray[i]);
             }
         }
-        else
-        {
-            compoundArrayLen = 0;
-        }
 
         if (penDataFlags & PenDataCustomStartCap)
         {
diff --git a/drawinglayer/source/tools/emfppen.hxx b/drawinglayer/source/tools/emfppen.hxx
index c4a260f6e4a3..c338fef62029 100644
--- a/drawinglayer/source/tools/emfppen.hxx
+++ b/drawinglayer/source/tools/emfppen.hxx
@@ -22,6 +22,7 @@
 
 #include <emfpbrush.hxx>
 #include <com/sun/star/rendering/StrokeAttributes.hpp>
+#include <vector>
 
 namespace emfplushelper
 {
@@ -46,11 +47,9 @@ namespace emfplushelper
         sal_Int32 dashStyle;
         sal_Int32 dashCap;
         float dashOffset;
-        sal_Int32 dashPatternLen;
-        float *dashPattern;
+        std::vector<float> dashPattern;
         sal_Int32 alignment;
-        sal_Int32 compoundArrayLen;
-        float *compoundArray;
+        std::vector<float> compoundArray;
         sal_Int32 customStartCapLen;
         EMFPCustomLineCap *customStartCap;
         sal_Int32 customEndCapLen;
commit ae0901317d26c06a4a8f52af296aff5eaa6328a2
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 931d4be419d15482cfbf7b706e7ac8018bf1072e
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..e4f3e3ce7322 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -860,12 +860,8 @@ namespace emfplushelper
                             float lx, ly, lw, lh;
                             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* >(maEMFPObjects[formatId & 0xff].get());
-
-                            (void)(text); // avoid warning
-                            (void)(stringFormat); // avoid warning
-
+    //                      OUString text = read_uInt16s_ToOUString(rMS, stringLength);
+    //                      EMFPStringFormat *stringFormat = static_cast< EMFPStringFormat* >(maEMFPObjects[formatId & 0xff].get());
     //                        css::rendering::FontRequest aFontRequest;
     //
     //                        if (stringFormat)
@@ -1249,6 +1245,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);


More information about the Libreoffice-commits mailing list