tdf#150201 Fix endianness for placeable WMF

The constant PLACEABLE_SIGNATURE in graphicfilter2.cxx had wrong
endianness, which would cause the WMF file detection to fail for
placeable WMFs. Changed endianness since WMF files are in little endian.
Also added test using placeable and non-placeable WMFs.

To run the test:
make CPPUNIT_TEST_NAME="testDetectWMF" -sr CppunitTest_vcl_graphic_test

Change-Id: Ia3c61bae5ab27375636f21bc902f773804cf9273
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137634
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
diff --git a/vcl/qa/cppunit/GraphicDescriptorTest.cxx b/vcl/qa/cppunit/GraphicDescriptorTest.cxx
index c86d95e..a0bbd02 100644
--- a/vcl/qa/cppunit/GraphicDescriptorTest.cxx
+++ b/vcl/qa/cppunit/GraphicDescriptorTest.cxx
@@ -36,6 +36,7 @@ class GraphicDescriptorTest : public test::BootstrapFixtureBase
    void testDetectBMP();
    void testDetectWEBP();
    void testDetectEMF();
    void testDetectWMF();

    CPPUNIT_TEST_SUITE(GraphicDescriptorTest);
    CPPUNIT_TEST(testDetectPNG);
@@ -45,6 +46,7 @@ class GraphicDescriptorTest : public test::BootstrapFixtureBase
    CPPUNIT_TEST(testDetectBMP);
    CPPUNIT_TEST(testDetectWEBP);
    CPPUNIT_TEST(testDetectEMF);
    CPPUNIT_TEST(testDetectWMF);
    CPPUNIT_TEST_SUITE_END();
};

@@ -169,6 +171,28 @@ void GraphicDescriptorTest::testDetectEMF()
    CPPUNIT_ASSERT_EQUAL(tools::Long(300), aDescriptor.GetSize_100TH_MM().Height());
}

void GraphicDescriptorTest::testDetectWMF()
{
    // Test placeable wmf
    {
        SvFileStream aFileStream(m_directories.getURLFromSrc(u"/emfio/qa/cppunit/wmf/data/")
                                     + "tdf88163-wrong-font-size.wmf",
                                 StreamMode::READ);
        GraphicDescriptor aDescriptor(aFileStream, nullptr);
        aDescriptor.Detect(true);
        CPPUNIT_ASSERT_EQUAL(GraphicFileFormat::WMF, aDescriptor.GetFileFormat());
    }
    // Test non-placeable wmf
    {
        SvFileStream aFileStream(m_directories.getURLFromSrc(u"/emfio/qa/cppunit/wmf/data/")
                                     + "tdf88163-non-placeable.wmf",
                                 StreamMode::READ);
        GraphicDescriptor aDescriptor(aFileStream, nullptr);
        aDescriptor.Detect(true);
        CPPUNIT_ASSERT_EQUAL(GraphicFileFormat::WMF, aDescriptor.GetFileFormat());
    }
}

} // namespace

CPPUNIT_TEST_SUITE_REGISTRATION(GraphicDescriptorTest);
diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx
index fb001ee..fafaa18 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -34,7 +34,7 @@ constexpr sal_uInt32 EMF_CHECK_SIZE      = 44;
constexpr sal_uInt32 WMF_CHECK_SIZE      = 32;
constexpr sal_uInt32 EMR_HEADER          = 0x00000001;
constexpr sal_uInt32 ENHMETA_SIGNATURE   = 0x464d4520;
constexpr sal_uInt32 PLACEABLE_SIGNATURE = 0xd7cdc69a;
constexpr sal_uInt32 PLACEABLE_SIGNATURE = 0x9ac6cdd7;
namespace
{
enum class MetafileType : sal_uInt16