tdf#113050 sdext.pdfimport: Add FillImage field to PolyPolyElement

Use -1 to mean the existing solid fill, otherwise it's the ID
of the image to use as the fill.

Change-Id: I596c26145f5285f75af631a3bb7ddf09600982a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163570
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sdext/source/pdfimport/inc/genericelements.hxx b/sdext/source/pdfimport/inc/genericelements.hxx
index 6d1459a..4332d4f 100644
--- a/sdext/source/pdfimport/inc/genericelements.hxx
+++ b/sdext/source/pdfimport/inc/genericelements.hxx
@@ -213,7 +213,7 @@ namespace pdfi
        friend class ElementFactory;
        PolyPolyElement( Element* pParent, sal_Int32 nGCId,
                         const basegfx::B2DPolyPolygon& rPolyPoly,
                         sal_Int8 nAction );
                         sal_Int8 nAction, ImageId nFillImage );
    public:
        virtual void visitedBy( ElementTreeVisitor&, const std::list< std::unique_ptr<Element> >::const_iterator& rParentIt ) override;

@@ -225,6 +225,7 @@ namespace pdfi

        basegfx::B2DPolyPolygon PolyPoly;
        sal_Int8                Action;
        ImageId                 FillImage;
    };

    struct ImageElement final : public DrawElement
@@ -299,8 +300,8 @@ namespace pdfi
            createPolyPolyElement( Element* pParent,
                                   sal_Int32 nGCId,
                                   const basegfx::B2DPolyPolygon& rPolyPoly,
                                   sal_Int8 nAction)
        { return new PolyPolyElement( pParent, nGCId, rPolyPoly, nAction ); }
                                   sal_Int8 nAction, ImageId nFillImage )
        { return new PolyPolyElement( pParent, nGCId, rPolyPoly, nAction, nFillImage ); }
        static ImageElement* createImageElement( Element* pParent, sal_Int32 nGCId, ImageId nImage )
        { return new ImageElement( pParent, nGCId, nImage ); }

diff --git a/sdext/source/pdfimport/tree/genericelements.cxx b/sdext/source/pdfimport/tree/genericelements.cxx
index 1d11cd0..100e145 100644
--- a/sdext/source/pdfimport/tree/genericelements.cxx
+++ b/sdext/source/pdfimport/tree/genericelements.cxx
@@ -124,10 +124,12 @@ void ImageElement::visitedBy( ElementTreeVisitor&                          rVisi
PolyPolyElement::PolyPolyElement( Element*                       pParent,
                                  sal_Int32                      nGCId,
                                  const basegfx::B2DPolyPolygon& rPolyPoly,
                                  sal_Int8                       nAction )
                                  sal_Int8                       nAction,
                                  ImageId                        nFillImage )
    : DrawElement( pParent, nGCId ),
      PolyPoly( rPolyPoly ),
      Action( nAction )
      Action( nAction ),
      FillImage( nFillImage )
{
}

diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index 32280f8..0ef30a1 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -389,9 +389,10 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1,
                                      double nxStep, double nyStep,
                                      int /* nPaintType */,
                                      css::geometry::AffineMatrix2D& rMat,
                                      const css::uno::Sequence<css::beans::PropertyValue>& /*xTile*/)
                                      const css::uno::Sequence<css::beans::PropertyValue>& xTile)
{
    const GraphicsContext& rGC(getCurrentContext());
    auto nTile = m_aImages.addImage(xTile);

    basegfx::B2DTuple aScale, aTranslation;
    double fRotate, fShearX;
@@ -431,7 +432,8 @@ void PDFIProcessor::tilingPatternFill(int nX0, int nY0, int nX1, int nY1,
        m_pCurElement,
        getGCId(getCurrentContext()),
        aB2DPoly,
        PATH_EOFILL ); // Hmm how do I know if this should be EO or not?
        PATH_EOFILL, // Hmm how do I know if this should be EO or not?
        nTile );
    pPolyElement->updateGeometry();
    pPolyElement->ZOrder = m_nNextZOrder++;
}
@@ -445,7 +447,8 @@ void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D 
        m_pCurElement,
        getGCId(getCurrentContext()),
        aPoly,
        PATH_STROKE );
        PATH_STROKE,
        -1 );
    pPoly->updateGeometry();
    pPoly->ZOrder = m_nNextZOrder++;
}
@@ -459,7 +462,8 @@ void PDFIProcessor::fillPath( const uno::Reference< rendering::XPolyPolygon2D >&
        m_pCurElement,
        getGCId(getCurrentContext()),
        aPoly,
        PATH_FILL );
        PATH_FILL,
        -1 );
    pPoly->updateGeometry();
    pPoly->ZOrder = m_nNextZOrder++;
}
@@ -473,7 +477,8 @@ void PDFIProcessor::eoFillPath( const uno::Reference< rendering::XPolyPolygon2D 
        m_pCurElement,
        getGCId(getCurrentContext()),
        aPoly,
        PATH_EOFILL );
        PATH_EOFILL,
        -1 );
    pPoly->updateGeometry();
    pPoly->ZOrder = m_nNextZOrder++;
}