office-gobmx/emfio/qa/cppunit/wmf/data/stockobject.emf
Hossein f385661ec1 tdf#148359 Fix emfio regression: missing emf image
This patch fixes tdf#148359 which prevented the display of EMF images
embedded in the rtf files or even loading when loading them directly.

Looking into the problem caused by the cleanup commit
3e7dd04dd8, it became visible that
while enums were converted to enum class, there was a cast that
was wrongly ommited:

    - sal_uInt16 nStockId = static_cast<sal_uInt8>(nIndex);
    + StockObject nStockId = static_cast<StockObject>(nIndex);

Now, it is re-written as:

    StockObject nStockId = static_cast<StockObject>(nIndex & 0xFF);

The symptom was that the StockObject field was mishandled, and thus
the shapes were displayed in white, instead of black.

"Stock Logical Object" is discussed in the MS document for EMF:

    * [MS-EMF] v20210625 - pages 44, 45 and 182

A unit test is provided to make sure that the regression does not
happen again. The test can be run by:

    make CPPUNIT_TEST_NAME=testStockObject -sr CppunitTest_emfio_wmf

Change-Id: I9a7f1008e92a96d9fb12aeb7bd057af828c1722a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132540
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-04-06 16:41:57 +02:00

12 KiB