tdf#113704 EMF+ Add support for EmfPlusRecordTypeFillRegion record

Change-Id: I60366d4a27fdf5a3cc020ca54f4a2aa9b974db5e
Reviewed-on: https://gerrit.libreoffice.org/44795
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 9d2c7db..d9accff 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -63,6 +63,7 @@ namespace emfplushelper
            case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
            case EmfPlusRecordTypeDrawPie: return "EmfPlusRecordTypeDrawPie";
            case EmfPlusRecordTypeDrawArc: return "EmfPlusRecordTypeDrawArc";
            case EmfPlusRecordTypeFillRegion: return "EmfPlusRecordTypeFillRegion";
            case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
            case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
            case EmfPlusRecordTypeDrawBeziers: return "EmfPlusRecordTypeDrawBeziers";
@@ -179,17 +180,17 @@ namespace emfplushelper
            }
            case EmfPlusObjectTypeImageAttributes:
            {
                SAL_INFO("drawinglayer", "EMF+\t Object type 'image attributes' not yet implemented");
                SAL_WARN("drawinglayer", "EMF+\t TODO Object type 'image attributes' not yet implemented");
                break;
            }
            case EmfPlusObjectTypeCustomLineCap:
            {
                SAL_INFO("drawinglayer", "EMF+\t Object type 'custom line cap' not yet implemented");
                SAL_WARN("drawinglayer", "EMF+\t TODO Object type 'custom line cap' not yet implemented");
                break;
            }
            default:
            {
                SAL_INFO("drawinglayer", "EMF+\tObject unhandled flags: 0x" << std::hex << (flags & 0xff00) << std::dec);
                SAL_WARN("drawinglayer", "EMF+\t TODO Object unhandled flags: 0x" << std::hex << (flags & 0xff00) << std::dec);
            }
        }
    }
@@ -459,9 +460,9 @@ namespace emfplushelper
        if (!polygon.count())
          return;

        SAL_INFO("drawinglayer", "EMF+\tfill polygon");
        if (isColor) // use Color
        {
            SAL_INFO("drawinglayer", "EMF+\t Fill polygon, ARGB color: 0x" << std::hex << brushIndexOrColor << std::dec);
            mrTargetHolders.Current().append(
                o3tl::make_unique<drawinglayer::primitive2d::PolyPolygonColorPrimitive2D>(
                    polygon,
@@ -474,7 +475,7 @@ namespace emfplushelper
        else // use Brush
        {
            EMFPBrush* brush = static_cast<EMFPBrush*>( maEMFPObjects[brushIndexOrColor & 0xff].get() );
            SAL_INFO("drawinglayer", "EMF+\tbrush fill slot: " << brushIndexOrColor << " (type: " << (brush ? brush->GetType() : -1) << ")");
            SAL_INFO("drawinglayer", "EMF+\t Fill polygon, brush slot: " << brushIndexOrColor << " (brush type: " << (brush ? brush->GetType() : -1) << ")");

            // give up in case something wrong happened
            if( !brush )
@@ -942,6 +943,16 @@ namespace emfplushelper
                        EMFPPlusFillPolygon(static_cast<EMFPPath*>(maEMFPObjects[index].get())->GetPolygon(*this), flags & 0x8000, brushIndexOrColor);
                    }
                    break;
                    case EmfPlusRecordTypeFillRegion:
                    {
                        sal_uInt32 index = flags & 0xff;
                        sal_uInt32 brushIndexOrColor;
                        rMS.ReadUInt32(brushIndexOrColor);
                        SAL_INFO("drawinglayer", "EMF+ FillRegion slot: " << index);

                        EMFPPlusFillPolygon(static_cast<EMFPRegion*>(maEMFPObjects[flags & 0xff].get())->regionPolyPolygon, flags & 0x8000, brushIndexOrColor);
                    }
                    break;
                    case EmfPlusRecordTypeDrawEllipse:
                    case EmfPlusRecordTypeFillEllipse:
                    {
@@ -1301,38 +1312,32 @@ namespace emfplushelper
                    case EmfPlusRecordTypeSetRenderingOrigin:
                    {
                        rMS.ReadInt32(mnOriginX).ReadInt32(mnOriginY);
                        SAL_INFO("drawinglayer", "EMF+ SetRenderingOrigin");
                        SAL_INFO("drawinglayer", "EMF+\torigin [x,y]: " << mnOriginX << "," << mnOriginY);
                        SAL_INFO("drawinglayer", "EMF+ SetRenderingOrigin, [x,y]: " << mnOriginX << "," << mnOriginY);
                        break;
                    }
                    case EmfPlusRecordTypeSetTextRenderingHint:
                    {
                        SAL_INFO("drawinglayer", "EMF+ SetTextRenderingHint");
                        SAL_INFO("drawinglayer", "EMF+\tTODO");
                        SAL_INFO("drawinglayer", "TODO\t EMF+ SetTextRenderingHint");
                        break;
                    }
                    case EmfPlusRecordTypeSetAntiAliasMode:
                    {
                        SAL_INFO("drawinglayer", "EMF+ SetAntiAliasMode");
                        SAL_INFO("drawinglayer", "EMF+\tTODO");
                        SAL_INFO("drawinglayer", "TODO\t EMF+ SetAntiAliasMode");
                        break;
                    }
                    case EmfPlusRecordTypeSetInterpolationMode:
                    {
                        SAL_INFO("drawinglayer", "EMF+ InterpolationMode");
                        SAL_INFO("drawinglayer", "EMF+\tTODO");
                        SAL_INFO("drawinglayer", "TODO\t EMF+ InterpolationMode");
                        break;
                    }
                    case EmfPlusRecordTypeSetPixelOffsetMode:
                    {
                        SAL_INFO("drawinglayer", "EMF+ SetPixelOffsetMode");
                        SAL_INFO("drawinglayer", "EMF+\tTODO");
                        SAL_INFO("drawinglayer", "TODO\t EMF+ SetPixelOffsetMode");
                        break;
                    }
                    case EmfPlusRecordTypeSetCompositingQuality:
                    {
                        SAL_INFO("drawinglayer", "EMF+ SetCompositingQuality");
                        SAL_INFO("drawinglayer", "EMF+\tTODO");
                        SAL_INFO("drawinglayer", "TODO\t EMF+ SetCompositingQuality");
                        break;
                    }
                    case EmfPlusRecordTypeSave:
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx b/drawinglayer/source/tools/emfphelperdata.hxx
index 98a90ab..431e9b0 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -53,7 +53,7 @@ namespace emfplushelper
    #define EmfPlusRecordTypeFillPie 0x4010
    #define EmfPlusRecordTypeDrawPie 0x4011
    #define EmfPlusRecordTypeDrawArc 0x4012
    //TODO EmfPlusRecordTypeFillRegion 0x4013
    #define EmfPlusRecordTypeFillRegion 0x4013
    #define EmfPlusRecordTypeFillPath 0x4014
    #define EmfPlusRecordTypeDrawPath 0x4015
    //TODO EmfPlusRecordTypeFillClosedCurve 0x4016