diff options
author | Noel Grandin <noel@peralex.com> | 2015-12-10 12:27:50 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-12-11 10:11:23 +0200 |
commit | 58d8d8ac67aa9b907f1304a48efa0f7a473d9de4 (patch) | |
tree | a0d88f3c8a57ce9d08d97c803ea0ec83a3dd8b62 /svgio | |
parent | 44ad6aca0dee29841ec7cd15c6d0ad9b3dcaedbe (diff) |
tdf#69977: uno::Sequence is expensive
when used as a mutable data-structure. Plain std::vector halves the time
taken to display the chart dialog
Create a class to represent the std::vector we are going to be passing
around, and move some of the utility methods into it to make the code
prettier.
Also create an optimised append(&&) method for the common case of
appending small temporaries.
Change-Id: I7f5b43fb4a8a84e40e6a52fcb7e9f974091b4485
Diffstat (limited to 'svgio')
40 files changed, 228 insertions, 240 deletions
diff --git a/svgio/inc/svgio/svgreader/svgcharacternode.hxx b/svgio/inc/svgio/svgreader/svgcharacternode.hxx index e37145e4dddc..45670ee3a668 100644 --- a/svgio/inc/svgio/svgreader/svgcharacternode.hxx +++ b/svgio/inc/svgio/svgreader/svgcharacternode.hxx @@ -143,7 +143,7 @@ namespace svgio SvgTextPosition& rSvgTextPosition, const SvgStyleAttributes& rSvgStyleAttributes) const; void decomposeTextWithStyle( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition, const SvgStyleAttributes& rSvgStyleAttributes) const; @@ -155,7 +155,7 @@ namespace svgio virtual ~SvgCharacterNode(); virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; - void decomposeText(drawinglayer::primitive2d::Primitive2DSequence& rTarget, SvgTextPosition& rSvgTextPosition) const; + void decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const; void whiteSpaceHandling(); void addGap(); void concatenate(const OUString& rText); diff --git a/svgio/inc/svgio/svgreader/svgcirclenode.hxx b/svgio/inc/svgio/svgreader/svgcirclenode.hxx index a997ed9230fe..9acbe907cf38 100644 --- a/svgio/inc/svgio/svgreader/svgcirclenode.hxx +++ b/svgio/inc/svgio/svgreader/svgcirclenode.hxx @@ -47,7 +47,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// Cx content, set if found in current context const SvgNumber& getCx() const { return maCx; } diff --git a/svgio/inc/svgio/svgreader/svgclippathnode.hxx b/svgio/inc/svgio/svgreader/svgclippathnode.hxx index f49eaebac62c..706d4bd84df2 100644 --- a/svgio/inc/svgio/svgreader/svgclippathnode.hxx +++ b/svgio/inc/svgio/svgreader/svgclippathnode.hxx @@ -45,11 +45,11 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// apply contained clipPath to given geometry #i124852# transform may be needed void apply( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DHomMatrix* pTransform) const; /// clipPathUnits content diff --git a/svgio/inc/svgio/svgreader/svgellipsenode.hxx b/svgio/inc/svgio/svgreader/svgellipsenode.hxx index dbb9f95763f3..040235c75af8 100644 --- a/svgio/inc/svgio/svgreader/svgellipsenode.hxx +++ b/svgio/inc/svgio/svgreader/svgellipsenode.hxx @@ -48,7 +48,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// Cx content, set if found in current context const SvgNumber& getCx() const { return maCx; } diff --git a/svgio/inc/svgio/svgreader/svggnode.hxx b/svgio/inc/svgio/svgreader/svggnode.hxx index d010d04c13ed..8d9ad9dec53f 100644 --- a/svgio/inc/svgio/svgreader/svggnode.hxx +++ b/svgio/inc/svgio/svgreader/svggnode.hxx @@ -45,7 +45,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// transform content const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } diff --git a/svgio/inc/svgio/svgreader/svgimagenode.hxx b/svgio/inc/svgio/svgreader/svgimagenode.hxx index 9e7ca50de7eb..c21a9f5eaf3e 100644 --- a/svgio/inc/svgio/svgreader/svgimagenode.hxx +++ b/svgio/inc/svgio/svgreader/svgimagenode.hxx @@ -55,7 +55,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// SvgAspectRatio content const SvgAspectRatio& getSvgAspectRatio() const { return maSvgAspectRatio; } diff --git a/svgio/inc/svgio/svgreader/svglinenode.hxx b/svgio/inc/svgio/svgreader/svglinenode.hxx index bf0e647a4734..23e20bd3088e 100644 --- a/svgio/inc/svgio/svgreader/svglinenode.hxx +++ b/svgio/inc/svgio/svgreader/svglinenode.hxx @@ -48,7 +48,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// X1 content, set if found in current context const SvgNumber& getX1() const { return maX1; } diff --git a/svgio/inc/svgio/svgreader/svgmarkernode.hxx b/svgio/inc/svgio/svgreader/svgmarkernode.hxx index cc60fc800808..ee4698d599b7 100644 --- a/svgio/inc/svgio/svgreader/svgmarkernode.hxx +++ b/svgio/inc/svgio/svgreader/svgmarkernode.hxx @@ -38,7 +38,7 @@ namespace svgio private: /// buffered decomposition - drawinglayer::primitive2d::Primitive2DSequence aPrimitives; + drawinglayer::primitive2d::Primitive2DContainer aPrimitives; /// use styles SvgStyleAttributes maSvgStyleAttributes; @@ -66,7 +66,7 @@ namespace svgio virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; /// get marker primitives buffered, uses decomposeSvgNode internally - const drawinglayer::primitive2d::Primitive2DSequence& getMarkerPrimitives() const; + const drawinglayer::primitive2d::Primitive2DContainer& getMarkerPrimitives() const; /// InfoProvider support for % values virtual const basegfx::B2DRange getCurrentViewPort() const override; diff --git a/svgio/inc/svgio/svgreader/svgmasknode.hxx b/svgio/inc/svgio/svgreader/svgmasknode.hxx index 231aa179aa9f..84c4bb1de38a 100644 --- a/svgio/inc/svgio/svgreader/svgmasknode.hxx +++ b/svgio/inc/svgio/svgreader/svgmasknode.hxx @@ -50,11 +50,11 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// apply contained clipPath to given geometry #i124852# transform may be needed void apply( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DHomMatrix* pTransform) const; /// x content, set if found in current context diff --git a/svgio/inc/svgio/svgreader/svgnode.hxx b/svgio/inc/svgio/svgreader/svgnode.hxx index d951a284b20c..ab7f28a2850d 100644 --- a/svgio/inc/svgio/svgreader/svgnode.hxx +++ b/svgio/inc/svgio/svgreader/svgnode.hxx @@ -144,7 +144,7 @@ namespace svgio void parseAttributes(const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs); virtual const SvgStyleAttributes* getSvgStyleAttributes() const; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent); - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const; /// #i125258# tell if this node is allowed to have a parent style (e.g. defs do not) virtual bool supportsParentStyle() const; diff --git a/svgio/inc/svgio/svgreader/svgpathnode.hxx b/svgio/inc/svgio/svgreader/svgpathnode.hxx index d8645d8e50a3..0c24244455fb 100644 --- a/svgio/inc/svgio/svgreader/svgpathnode.hxx +++ b/svgio/inc/svgio/svgreader/svgpathnode.hxx @@ -48,7 +48,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// path content, set if found in current context const basegfx::B2DPolyPolygon* getPath() const { return mpPolyPolygon; } diff --git a/svgio/inc/svgio/svgreader/svgpatternnode.hxx b/svgio/inc/svgio/svgreader/svgpatternnode.hxx index f526346609ac..a5b6870ba8fe 100644 --- a/svgio/inc/svgio/svgreader/svgpatternnode.hxx +++ b/svgio/inc/svgio/svgreader/svgpatternnode.hxx @@ -31,7 +31,7 @@ namespace svgio { private: /// buffered decomposition - drawinglayer::primitive2d::Primitive2DSequence aPrimitives; + drawinglayer::primitive2d::Primitive2DContainer aPrimitives; /// use styles SvgStyleAttributes maSvgStyleAttributes; @@ -69,7 +69,7 @@ namespace svgio void getValuesRelative(double& rfX, double& rfY, double& rfW, double& rfH, const basegfx::B2DRange& rGeoRange, SvgNode& rUser) const; /// get pattern primitives buffered, uses decomposeSvgNode internally - const drawinglayer::primitive2d::Primitive2DSequence& getPatternPrimitives() const; + const drawinglayer::primitive2d::Primitive2DContainer& getPatternPrimitives() const; /// InfoProvider support for % values virtual const basegfx::B2DRange getCurrentViewPort() const override; diff --git a/svgio/inc/svgio/svgreader/svgpolynode.hxx b/svgio/inc/svgio/svgreader/svgpolynode.hxx index 28b72305771a..0e47c7499c2e 100644 --- a/svgio/inc/svgio/svgreader/svgpolynode.hxx +++ b/svgio/inc/svgio/svgreader/svgpolynode.hxx @@ -50,7 +50,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// type read access bool isPolyline() const { return mbIsPolyline; } diff --git a/svgio/inc/svgio/svgreader/svgrectnode.hxx b/svgio/inc/svgio/svgreader/svgrectnode.hxx index 414091305a88..f103876ab49a 100644 --- a/svgio/inc/svgio/svgreader/svgrectnode.hxx +++ b/svgio/inc/svgio/svgreader/svgrectnode.hxx @@ -50,7 +50,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// x content, set if found in current context const SvgNumber& getX() const { return maX; } diff --git a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx index cb1982dd3578..c227986b7d35 100644 --- a/svgio/inc/svgio/svgreader/svgstyleattributes.hxx +++ b/svgio/inc/svgio/svgreader/svgstyleattributes.hxx @@ -232,35 +232,35 @@ namespace svgio /// internal helpers void add_fillGradient( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgGradientNode& rFillGradient, const basegfx::B2DRange& rGeoRange) const; void add_fillPatternTransform( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgPatternNode& rFillGradient, const basegfx::B2DRange& rGeoRange) const; void add_fillPattern( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgPatternNode& rFillGradient, const basegfx::B2DRange& rGeoRange) const; void add_fill( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DRange& rGeoRange) const; void add_stroke( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DRange& rGeoRange) const; bool prepare_singleMarker( - drawinglayer::primitive2d::Primitive2DSequence& rMarkerPrimitives, + drawinglayer::primitive2d::Primitive2DContainer& rMarkerPrimitives, basegfx::B2DHomMatrix& rMarkerTransform, basegfx::B2DRange& rClipRange, const SvgMarkerNode& rMarker) const; void add_markers( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::tools::PointIndexSet* pHelpPointIndices) const; public: @@ -270,15 +270,15 @@ namespace svgio /// helper which does the necessary with a given path void add_text( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - drawinglayer::primitive2d::Primitive2DSequence& rSource) const; + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rSource) const; void add_path( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::tools::PointIndexSet* pHelpPointIndices) const; void add_postProcess( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - const drawinglayer::primitive2d::Primitive2DSequence& rSource, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + const drawinglayer::primitive2d::Primitive2DContainer& rSource, const basegfx::B2DHomMatrix* pTransform) const; /// helper to set mpCssStyleParent temporarily for CSS style hierarchies diff --git a/svgio/inc/svgio/svgreader/svgsvgnode.hxx b/svgio/inc/svgio/svgreader/svgsvgnode.hxx index 158c832ab2f4..15d49505bc4c 100644 --- a/svgio/inc/svgio/svgreader/svgsvgnode.hxx +++ b/svgio/inc/svgio/svgreader/svgsvgnode.hxx @@ -56,7 +56,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// Seeks width and height of viewport, which is current before the new viewport is set. // needed for percentage unit in x, y, width or height diff --git a/svgio/inc/svgio/svgreader/svgtextnode.hxx b/svgio/inc/svgio/svgreader/svgtextnode.hxx index 6d0d5c558d00..7922f133b979 100644 --- a/svgio/inc/svgio/svgreader/svgtextnode.hxx +++ b/svgio/inc/svgio/svgreader/svgtextnode.hxx @@ -41,12 +41,12 @@ namespace svgio /// local helpers void DecomposeChild( const SvgNode& rCandidate, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const; static void addTextPrimitives( const SvgNode& rCandidate, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - drawinglayer::primitive2d::Primitive2DSequence& rSource); + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rSource); public: SvgTextNode( @@ -56,7 +56,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// transform content, set if found in current context const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } diff --git a/svgio/inc/svgio/svgreader/svgtextpathnode.hxx b/svgio/inc/svgio/svgreader/svgtextpathnode.hxx index 93ed9f82825e..c0e4242ed27d 100644 --- a/svgio/inc/svgio/svgreader/svgtextpathnode.hxx +++ b/svgio/inc/svgio/svgreader/svgtextpathnode.hxx @@ -54,8 +54,8 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; void decomposePathNode( - const drawinglayer::primitive2d::Primitive2DSequence& rPathContent, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const drawinglayer::primitive2d::Primitive2DContainer& rPathContent, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DPoint& rTextStart) const; bool isValid() const; diff --git a/svgio/inc/svgio/svgreader/svgusenode.hxx b/svgio/inc/svgio/svgreader/svgusenode.hxx index 4f788db09bdb..d235747e5ff4 100644 --- a/svgio/inc/svgio/svgreader/svgusenode.hxx +++ b/svgio/inc/svgio/svgreader/svgusenode.hxx @@ -52,7 +52,7 @@ namespace svgio virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const override; + virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; /// transform content const basegfx::B2DHomMatrix* getTransform() const { return mpaTransform; } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 4b87b501a274..3c40e3e21df5 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -15,6 +15,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/seqstream.hxx> +#include <comphelper/sequence.hxx> #include <com/sun/star/graphic/SvgTools.hpp> #include <com/sun/star/graphic/Primitive2DTools.hpp> @@ -32,6 +33,7 @@ using namespace css::io; using namespace css::graphic; using drawinglayer::primitive2d::arePrimitive2DSequencesEqual; using drawinglayer::primitive2d::Primitive2DSequence; +using drawinglayer::primitive2d::Primitive2DContainer; class Test : public test::BootstrapFixture, public XmlTestTools { @@ -84,7 +86,7 @@ void Test::tearDown() void Test::checkRectPrimitive(Primitive2DSequence& rPrimitive) { Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(rPrimitive); + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(rPrimitive)); CPPUNIT_ASSERT (pDocument); @@ -126,7 +128,7 @@ void Test::testTdf87309() CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf87309.getLength()); Primitive2dXmlDump dumper; - xmlDocPtr pDocument = dumper.dumpAndParse(aSequenceTdf87309); + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf87309)); CPPUNIT_ASSERT (pDocument); diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 3e09e9ec5c8b..b2b127fd1d37 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -501,7 +501,7 @@ namespace svgio } void SvgCharacterNode::decomposeTextWithStyle( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition, const SvgStyleAttributes& rSvgStyleAttributes) const { @@ -514,7 +514,7 @@ namespace svgio { if(!rSvgTextPosition.isRotated()) { - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xRef); + rTarget.push_back(xRef); } else { @@ -525,12 +525,12 @@ namespace svgio if(pCandidate) { const localTextBreakupHelper alocalTextBreakupHelper(*pCandidate, rSvgTextPosition); - const drawinglayer::primitive2d::Primitive2DSequence aResult( + const drawinglayer::primitive2d::Primitive2DContainer aResult( alocalTextBreakupHelper.getResult()); - if(aResult.hasElements()) + if(!aResult.empty()) { - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aResult); + rTarget.append(aResult); } // also consume for the implied single space @@ -566,7 +566,7 @@ namespace svgio maText += rText; } - void SvgCharacterNode::decomposeText(drawinglayer::primitive2d::Primitive2DSequence& rTarget, SvgTextPosition& rSvgTextPosition) const + void SvgCharacterNode::decomposeText(drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const { if(!getText().isEmpty()) { diff --git a/svgio/source/svgreader/svgcirclenode.cxx b/svgio/source/svgreader/svgcirclenode.cxx index 14988eae9760..3ac0d0b93cf4 100644 --- a/svgio/source/svgreader/svgcirclenode.cxx +++ b/svgio/source/svgreader/svgcirclenode.cxx @@ -113,7 +113,7 @@ namespace svgio } } - void SvgCircleNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced*/) const + void SvgCircleNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const { const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); @@ -130,11 +130,11 @@ namespace svgio getCy().isSet() ? getCy().solve(*this, ycoordinate) : 0.0), fR)); - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, nullptr); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); } diff --git a/svgio/source/svgreader/svgclippathnode.cxx b/svgio/source/svgreader/svgclippathnode.cxx index 5064933a97b0..ada214bc8360 100644 --- a/svgio/source/svgreader/svgclippathnode.cxx +++ b/svgio/source/svgreader/svgclippathnode.cxx @@ -98,14 +98,14 @@ namespace svgio } } - void SvgClipPathNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const + void SvgClipPathNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const { - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; // decompose children SvgNode::decomposeSvgNode(aNewTarget, bReferenced); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { if(getTransform()) { @@ -115,30 +115,30 @@ namespace svgio *getTransform(), aNewTarget)); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xRef); + rTarget.push_back(xRef); } else { // append to current target - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewTarget); + rTarget.append(aNewTarget); } } } void SvgClipPathNode::apply( - drawinglayer::primitive2d::Primitive2DSequence& rContent, + drawinglayer::primitive2d::Primitive2DContainer& rContent, const basegfx::B2DHomMatrix* pTransform) const { - if(rContent.hasElements() && Display_none != getDisplay()) + if(!rContent.empty() && Display_none != getDisplay()) { const drawinglayer::geometry::ViewInformation2D aViewInformation2D; - drawinglayer::primitive2d::Primitive2DSequence aClipTarget; + drawinglayer::primitive2d::Primitive2DContainer aClipTarget; basegfx::B2DPolyPolygon aClipPolyPolygon; // get clipPath definition as primitives decomposeSvgNode(aClipTarget, true); - if(aClipTarget.hasElements()) + if(!aClipTarget.empty()) { // extract filled polygons as base for a mask PolyPolygon drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D, true); @@ -164,10 +164,7 @@ namespace svgio if(objectBoundingBox == getClipPathUnits()) { // clip is object-relative, transform using content transformation - const basegfx::B2DRange aContentRange( - drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - rContent, - aViewInformation2D)); + const basegfx::B2DRange aContentRange(rContent.getB2DRange(aViewInformation2D)); aClipPolyPolygon.transform( basegfx::tools::createScaleTranslateB2DHomMatrix( @@ -194,8 +191,7 @@ namespace svgio // if the content is completely inside or outside of it; get ranges const basegfx::B2DRange aClipRange(aClipPolyPolygon.getB2DRange()); const basegfx::B2DRange aContentRange( - drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - rContent, + rContent.getB2DRange( aViewInformation2D)); if(aClipRange.isInside(aContentRange)) @@ -243,13 +239,13 @@ namespace svgio aClipPolyPolygon, rContent)); - rContent = drawinglayer::primitive2d::Primitive2DSequence(&xEmbedTransparence, 1); + rContent = drawinglayer::primitive2d::Primitive2DContainer { xEmbedTransparence }; } else { if(!bAddContent) { - rContent.realloc(0); + rContent.clear(); } } } @@ -257,7 +253,7 @@ namespace svgio { // An empty clipping path will completely clip away the element that had // the clip-path property applied. (Svg spec) - rContent.realloc(0); + rContent.clear(); } } } diff --git a/svgio/source/svgreader/svgellipsenode.cxx b/svgio/source/svgreader/svgellipsenode.cxx index 571f8aac6e1c..2f0b12df1565 100644 --- a/svgio/source/svgreader/svgellipsenode.cxx +++ b/svgio/source/svgreader/svgellipsenode.cxx @@ -127,7 +127,7 @@ namespace svgio } } - void SvgEllipseNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced*/) const + void SvgEllipseNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const { const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); @@ -145,11 +145,11 @@ namespace svgio getCy().isSet() ? getCy().solve(*this, ycoordinate) : 0.0), fRx, fRy)); - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, nullptr); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); } diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx index d59865a92f0c..a4bc674c580f 100644 --- a/svgio/source/svgreader/svggnode.cxx +++ b/svgio/source/svgreader/svggnode.cxx @@ -88,7 +88,7 @@ namespace svgio } } - void SvgGNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const + void SvgGNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const { if(SVGTokenDefs == getType()) { @@ -106,12 +106,12 @@ namespace svgio if(fOpacity > 0.0 && Display_none != getDisplay()) { - drawinglayer::primitive2d::Primitive2DSequence aContent; + drawinglayer::primitive2d::Primitive2DContainer aContent; // decompose children SvgNode::decomposeSvgNode(aContent, bReferenced); - if(aContent.hasElements()) + if(!aContent.empty()) { pStyle->add_postProcess(rTarget, aContent, getTransform()); } diff --git a/svgio/source/svgreader/svgimagenode.cxx b/svgio/source/svgreader/svgimagenode.cxx index 91286fa0b199..a53798a45d24 100644 --- a/svgio/source/svgreader/svgimagenode.cxx +++ b/svgio/source/svgreader/svgimagenode.cxx @@ -161,7 +161,7 @@ namespace svgio void extractFromGraphic( const Graphic& rGraphic, - drawinglayer::primitive2d::Primitive2DSequence& rEmbedded, + drawinglayer::primitive2d::Primitive2DContainer& rEmbedded, basegfx::B2DRange& rViewBox, BitmapEx& rBitmapEx) { @@ -188,7 +188,7 @@ namespace svgio } } - void SvgImageNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced*/) const + void SvgImageNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const { // get size range and create path const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); @@ -201,7 +201,7 @@ namespace svgio if(fWidth > 0.0 && fHeight > 0.0) { BitmapEx aBitmapEx; - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; // prepare Target and ViewBox for evtl. AspectRatio mappings const double fX(getX().isSet() ? getX().solve(*this, xcoordinate) : 0.0); @@ -264,11 +264,9 @@ namespace svgio { mpXLink->decomposeSvgNode(aNewTarget, true); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { - aViewBox = drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - aNewTarget, - drawinglayer::geometry::ViewInformation2D()); + aViewBox = aNewTarget.getB2DRange(drawinglayer::geometry::ViewInformation2D()); } } } @@ -276,7 +274,7 @@ namespace svgio if(!aBitmapEx.IsEmpty()) { // create content from created bitmap - aNewTarget.realloc(1); + aNewTarget.resize(1); aNewTarget[0] = new drawinglayer::primitive2d::BitmapPrimitive2D( aBitmapEx, basegfx::B2DHomMatrix()); @@ -285,12 +283,12 @@ namespace svgio aViewBox = basegfx::B2DRange(0.0, 0.0, 1.0, 1.0); } - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { if(aTarget.equal(aViewBox)) { // just add to rTarget - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewTarget); + rTarget.append(aNewTarget); } else { @@ -309,7 +307,7 @@ namespace svgio aEmbeddingTransform, aNewTarget)); - aNewTarget = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); + aNewTarget = drawinglayer::primitive2d::Primitive2DContainer { xRef }; } if(!rRatio.isMeetOrSlice()) @@ -321,7 +319,7 @@ namespace svgio basegfx::tools::createPolygonFromRect(aTarget)), aNewTarget)); - aNewTarget = drawinglayer::primitive2d::Primitive2DSequence(&xMask, 1); + aNewTarget = drawinglayer::primitive2d::Primitive2DContainer { xMask }; } } else @@ -336,7 +334,7 @@ namespace svgio aEmbeddingTransform, aNewTarget)); - aNewTarget = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); + aNewTarget = drawinglayer::primitive2d::Primitive2DContainer { xRef }; } } diff --git a/svgio/source/svgreader/svglinenode.cxx b/svgio/source/svgreader/svglinenode.cxx index 5c2327c5111a..6d184807702a 100644 --- a/svgio/source/svgreader/svglinenode.cxx +++ b/svgio/source/svgreader/svglinenode.cxx @@ -121,7 +121,7 @@ namespace svgio } } - void SvgLineNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced*/) const + void SvgLineNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const { const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); @@ -141,11 +141,11 @@ namespace svgio aPath.append(X); aPath.append(Y); - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, nullptr); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); } diff --git a/svgio/source/svgreader/svgmarkernode.cxx b/svgio/source/svgreader/svgmarkernode.cxx index 031b35c7c377..c0c2dc76ebcf 100644 --- a/svgio/source/svgreader/svgmarkernode.cxx +++ b/svgio/source/svgreader/svgmarkernode.cxx @@ -173,9 +173,9 @@ namespace svgio } } - const drawinglayer::primitive2d::Primitive2DSequence& SvgMarkerNode::getMarkerPrimitives() const + const drawinglayer::primitive2d::Primitive2DContainer& SvgMarkerNode::getMarkerPrimitives() const { - if(!aPrimitives.hasElements() && Display_none != getDisplay()) + if(aPrimitives.empty() && Display_none != getDisplay()) { decomposeSvgNode(const_cast< SvgMarkerNode* >(this)->aPrimitives, true); } diff --git a/svgio/source/svgreader/svgmasknode.cxx b/svgio/source/svgreader/svgmasknode.cxx index ae2068be98eb..bf72eaca25d1 100644 --- a/svgio/source/svgreader/svgmasknode.cxx +++ b/svgio/source/svgreader/svgmasknode.cxx @@ -165,14 +165,14 @@ namespace svgio } } - void SvgMaskNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const + void SvgMaskNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const { - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; // decompose children SvgNode::decomposeSvgNode(aNewTarget, bReferenced); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { if(getTransform()) { @@ -182,32 +182,31 @@ namespace svgio *getTransform(), aNewTarget)); - aNewTarget = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); + aNewTarget = drawinglayer::primitive2d::Primitive2DContainer { xRef }; } // append to current target - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewTarget); + rTarget.append(aNewTarget); } } void SvgMaskNode::apply( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DHomMatrix* pTransform) const { - if(rTarget.hasElements() && Display_none != getDisplay()) + if(!rTarget.empty() && Display_none != getDisplay()) { - drawinglayer::primitive2d::Primitive2DSequence aMaskTarget; + drawinglayer::primitive2d::Primitive2DContainer aMaskTarget; // get mask definition as primitives decomposeSvgNode(aMaskTarget, true); - if(aMaskTarget.hasElements()) + if(!aMaskTarget.empty()) { // get range of content to be masked const basegfx::B2DRange aContentRange( - drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - rTarget, - drawinglayer::geometry::ViewInformation2D())); + rTarget.getB2DRange( + drawinglayer::geometry::ViewInformation2D())); const double fContentWidth(aContentRange.getWidth()); const double fContentHeight(aContentRange.getHeight()); @@ -252,7 +251,7 @@ namespace svgio aContentRange.getMinimum()), aMaskTarget)); - aMaskTarget = drawinglayer::primitive2d::Primitive2DSequence(&xTransform, 1); + aMaskTarget = drawinglayer::primitive2d::Primitive2DContainer { xTransform }; } else // userSpaceOnUse { @@ -264,7 +263,7 @@ namespace svgio *pTransform, aMaskTarget)); - aMaskTarget = drawinglayer::primitive2d::Primitive2DSequence(&xTransform, 1); + aMaskTarget = drawinglayer::primitive2d::Primitive2DContainer { xTransform }; } } @@ -277,7 +276,7 @@ namespace svgio basegfx::BColorModifierSharedPtr( new basegfx::BColorModifier_luminance_to_alpha()))); - aMaskTarget = drawinglayer::primitive2d::Primitive2DSequence(&xInverseMask, 1); + aMaskTarget = drawinglayer::primitive2d::Primitive2DContainer { xInverseMask }; } // prepare new content @@ -295,24 +294,24 @@ namespace svgio basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect( aOffscreenBufferRange)), - drawinglayer::primitive2d::Primitive2DSequence(&xNewContent, 1)); + drawinglayer::primitive2d::Primitive2DContainer { xNewContent }); } // redefine target. Use TransparencePrimitive2D with created mask // geometry - rTarget = drawinglayer::primitive2d::Primitive2DSequence(&xNewContent, 1); + rTarget = drawinglayer::primitive2d::Primitive2DContainer { xNewContent }; } else { // content is geometrically empty - rTarget.realloc(0); + rTarget.clear(); } } else { // An empty clipping path will completely clip away the element that had // the clip-path property applied. (Svg spec) - rTarget.realloc(0); + rTarget.clear(); } } } diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index d2b6532f2319..f08d2b2e36f1 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -485,7 +485,7 @@ namespace svgio } } - void SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const + void SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const { if(Display_none == getDisplay()) { @@ -537,12 +537,12 @@ namespace svgio // - all non-terminal nodes (might contain visible nodes down the hierarchy) if( !rGrandChildren.empty() || ( pChildStyles && (Visibility_visible == pChildStyles->getVisibility())) ) { - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; pCandidate->decomposeSvgNode(aNewTarget, bReferenced); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewTarget); + rTarget.append(aNewTarget); } } } @@ -552,7 +552,7 @@ namespace svgio } } - if(rTarget.hasElements()) + if(!rTarget.empty()) { const SvgStyleAttributes* pStyles = getSvgStyleAttributes(); if(pStyles) @@ -590,7 +590,7 @@ namespace svgio rTitle, rDesc)); - rTarget = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); + rTarget = drawinglayer::primitive2d::Primitive2DContainer { xRef }; } } } diff --git a/svgio/source/svgreader/svgpathnode.cxx b/svgio/source/svgreader/svgpathnode.cxx index 54ae47137689..818a98c32034 100644 --- a/svgio/source/svgreader/svgpathnode.cxx +++ b/svgio/source/svgreader/svgpathnode.cxx @@ -102,18 +102,18 @@ namespace svgio } } - void SvgPathNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced*/) const + void SvgPathNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const { // fill and/or stroke needed, also a path const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); if(pStyle && getPath()) { - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; pStyle->add_path(*getPath(), aNewTarget, &maHelpPointIndices); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); } diff --git a/svgio/source/svgreader/svgpatternnode.cxx b/svgio/source/svgreader/svgpatternnode.cxx index 4167da883361..c99c4f112a69 100644 --- a/svgio/source/svgreader/svgpatternnode.cxx +++ b/svgio/source/svgreader/svgpatternnode.cxx @@ -264,14 +264,14 @@ namespace svgio } } - const drawinglayer::primitive2d::Primitive2DSequence& SvgPatternNode::getPatternPrimitives() const + const drawinglayer::primitive2d::Primitive2DContainer& SvgPatternNode::getPatternPrimitives() const { - if(!aPrimitives.hasElements() && Display_none != getDisplay()) + if(aPrimitives.empty() && Display_none != getDisplay()) { decomposeSvgNode(const_cast< SvgPatternNode* >(this)->aPrimitives, true); } - if(!aPrimitives.hasElements() && !maXLink.isEmpty()) + if(aPrimitives.empty() && !maXLink.isEmpty()) { const_cast< SvgPatternNode* >(this)->tryToFindLink(); diff --git a/svgio/source/svgreader/svgpolynode.cxx b/svgio/source/svgreader/svgpolynode.cxx index 6b3ebb1562c7..fe9efd1c273b 100644 --- a/svgio/source/svgreader/svgpolynode.cxx +++ b/svgio/source/svgreader/svgpolynode.cxx @@ -100,17 +100,17 @@ namespace svgio } } - void SvgPolyNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced*/) const + void SvgPolyNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const { const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); if(pStyle && getPolygon()) { - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; pStyle->add_path(basegfx::B2DPolyPolygon(*getPolygon()), aNewTarget, nullptr); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); } diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx index 170fb913b639..7b826362fdff 100644 --- a/svgio/source/svgreader/svgrectnode.cxx +++ b/svgio/source/svgreader/svgrectnode.cxx @@ -155,7 +155,7 @@ namespace svgio } } - void SvgRectNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced*/) const + void SvgRectNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const { // get size range and create path const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); @@ -202,11 +202,11 @@ namespace svgio aPath = basegfx::tools::createPolygonFromRect(aRange); } - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; pStyle->add_path(basegfx::B2DPolyPolygon(aPath), aNewTarget, nullptr); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); } diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 6c2fef789404..1c93bd96fc05 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -252,10 +252,10 @@ namespace svgio } void SvgStyleAttributes::add_text( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - drawinglayer::primitive2d::Primitive2DSequence& rSource) const + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rSource) const { - if(rSource.hasElements()) + if(!rSource.empty()) { // at this point the primitives in rSource are of type TextSimplePortionPrimitive2D // or TextDecoratedPortionPrimitive2D and have the Fill Color (pAttributes->getFill()) @@ -315,7 +315,7 @@ namespace svgio else if(pFill) { // add the already prepared primitives for single color fill - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, rSource); + rTarget.append(rSource); } // add stroke @@ -329,7 +329,7 @@ namespace svgio void SvgStyleAttributes::add_fillGradient( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgGradientNode& rFillGradient, const basegfx::B2DRange& rGeoRange) const { @@ -388,8 +388,7 @@ namespace svgio aEnd *= aGeoToUnit; } - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( - rTarget, + rTarget.push_back( new drawinglayer::primitive2d::SvgLinearGradientPrimitive2D( aGradientTransform, rPath, @@ -450,8 +449,7 @@ namespace svgio } } - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( - rTarget, + rTarget.push_back( new drawinglayer::primitive2d::SvgRadialGradientPrimitive2D( aGradientTransform, rPath, @@ -467,7 +465,7 @@ namespace svgio void SvgStyleAttributes::add_fillPatternTransform( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgPatternNode& rFillPattern, const basegfx::B2DRange& rGeoRange) const { @@ -478,16 +476,15 @@ namespace svgio // path and back-transforming the result basegfx::B2DPolyPolygon aPath(rPath); basegfx::B2DHomMatrix aInv(*rFillPattern.getPatternTransform()); - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; aInv.invert(); aPath.transform(aInv); add_fillPattern(aPath, aNewTarget, rFillPattern, aPath.getB2DRange()); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( - rTarget, + rTarget.push_back( new drawinglayer::primitive2d::TransformPrimitive2D( *rFillPattern.getPatternTransform(), aNewTarget)); @@ -502,14 +499,14 @@ namespace svgio void SvgStyleAttributes::add_fillPattern( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const SvgPatternNode& rFillPattern, const basegfx::B2DRange& rGeoRange) const { // fill polyPolygon with given pattern - const drawinglayer::primitive2d::Primitive2DSequence& rPrimitives = rFillPattern.getPatternPrimitives(); + const drawinglayer::primitive2d::Primitive2DContainer& rPrimitives = rFillPattern.getPatternPrimitives(); - if(rPrimitives.hasElements()) + if(!rPrimitives.empty()) { double fTargetWidth(rGeoRange.getWidth()); double fTargetHeight(rGeoRange.getHeight()); @@ -567,7 +564,7 @@ namespace svgio } // apply aMapPrimitivesToUnitRange to content when used - drawinglayer::primitive2d::Primitive2DSequence aPrimitives(rPrimitives); + drawinglayer::primitive2d::Primitive2DContainer aPrimitives(rPrimitives); if(!aMapPrimitivesToUnitRange.isIdentity()) { @@ -576,12 +573,11 @@ namespace svgio aMapPrimitivesToUnitRange, aPrimitives)); - aPrimitives = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); + aPrimitives = drawinglayer::primitive2d::Primitive2DContainer { xRef }; } // embed in PatternFillPrimitive2D - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( - rTarget, + rTarget.push_back( new drawinglayer::primitive2d::PatternFillPrimitive2D( rPath, aPrimitives, @@ -593,7 +589,7 @@ namespace svgio void SvgStyleAttributes::add_fill( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DRange& rGeoRange) const { const basegfx::BColor* pFill = getFill(); @@ -606,7 +602,7 @@ namespace svgio if(basegfx::fTools::more(fFillOpacity, 0.0)) { - drawinglayer::primitive2d::Primitive2DSequence aNewFill; + drawinglayer::primitive2d::Primitive2DContainer aNewFill; if(pFillGradient) { @@ -621,19 +617,18 @@ namespace svgio else // if(pFill) { // create fill content - aNewFill.realloc(1); + aNewFill.resize(1); aNewFill[0] = new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( rPath, *pFill); } - if(aNewFill.hasElements()) + if(!aNewFill.empty()) { if(basegfx::fTools::less(fFillOpacity, 1.0)) { // embed in UnifiedTransparencePrimitive2D - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( - rTarget, + rTarget.push_back( new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aNewFill, 1.0 - fFillOpacity)); @@ -641,7 +636,7 @@ namespace svgio else { // append - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewFill); + rTarget.append(aNewFill); } } } @@ -650,7 +645,7 @@ namespace svgio void SvgStyleAttributes::add_stroke( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DRange& rGeoRange) const { const basegfx::BColor* pStroke = getStroke(); @@ -659,7 +654,7 @@ namespace svgio if(pStroke || pStrokeGradient || pStrokePattern) { - drawinglayer::primitive2d::Primitive2DSequence aNewStroke; + drawinglayer::primitive2d::Primitive2DContainer aNewStroke; const double fStrokeOpacity(getStrokeOpacity().solve(mrOwner)); if(basegfx::fTools::more(fStrokeOpacity, 0.0)) @@ -708,7 +703,7 @@ namespace svgio if(pStrokeGradient || pStrokePattern) { // put primitive into Primitive2DReference and Primitive2DSequence - const drawinglayer::primitive2d::Primitive2DSequence aSeq(&aNewLinePrimitive, 1); + const drawinglayer::primitive2d::Primitive2DContainer aSeq { aNewLinePrimitive }; // use neutral ViewInformation and create LineGeometryExtractor2D const drawinglayer::geometry::ViewInformation2D aViewInformation2D; @@ -745,16 +740,15 @@ namespace svgio } else // if(pStroke) { - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aNewStroke, aNewLinePrimitive); + aNewStroke.push_back(aNewLinePrimitive); } - if(aNewStroke.hasElements()) + if(!aNewStroke.empty()) { if(basegfx::fTools::less(fStrokeOpacity, 1.0)) { // embed in UnifiedTransparencePrimitive2D - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( - rTarget, + rTarget.push_back( new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aNewStroke, 1.0 - fStrokeOpacity)); @@ -762,7 +756,7 @@ namespace svgio else { // append - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewStroke); + rTarget.append(aNewStroke); } } } @@ -771,7 +765,7 @@ namespace svgio } bool SvgStyleAttributes::prepare_singleMarker( - drawinglayer::primitive2d::Primitive2DSequence& rMarkerPrimitives, + drawinglayer::primitive2d::Primitive2DContainer& rMarkerPrimitives, basegfx::B2DHomMatrix& rMarkerTransform, basegfx::B2DRange& rClipRange, const SvgMarkerNode& rMarker) const @@ -783,7 +777,7 @@ namespace svgio // get marker primitive representation rMarkerPrimitives = rMarker.getMarkerPrimitives(); - if(rMarkerPrimitives.hasElements()) + if(!rMarkerPrimitives.empty()) { basegfx::B2DRange aPrimitiveRange(0.0, 0.0, 1.0, 1.0); const basegfx::B2DRange* pViewBox = rMarker.getViewBox(); @@ -862,7 +856,7 @@ namespace svgio void SvgStyleAttributes::add_markers( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::tools::PointIndexSet* pHelpPointIndices) const { // try to access linked markers @@ -883,7 +877,7 @@ namespace svgio const SvgMarkerNode* pPrepared = nullptr; // values for the prepared marker, results of prepare_singleMarker - drawinglayer::primitive2d::Primitive2DSequence aPreparedMarkerPrimitives; + drawinglayer::primitive2d::Primitive2DContainer aPreparedMarkerPrimitives; basegfx::B2DHomMatrix aPreparedMarkerTransform; basegfx::B2DRange aPreparedMarkerClipRange; @@ -1031,11 +1025,11 @@ namespace svgio aClipPolygon.transform(aCombinedTransform); xMarker = new drawinglayer::primitive2d::MaskPrimitive2D( aClipPolygon, - drawinglayer::primitive2d::Primitive2DSequence(&xMarker, 1)); + drawinglayer::primitive2d::Primitive2DContainer { xMarker }); } // add marker - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xMarker); + rTarget.push_back(xMarker); } } } @@ -1045,7 +1039,7 @@ namespace svgio void SvgStyleAttributes::add_path( const basegfx::B2DPolyPolygon& rPath, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::tools::PointIndexSet* pHelpPointIndices) const { if(!rPath.count()) @@ -1113,11 +1107,11 @@ namespace svgio } void SvgStyleAttributes::add_postProcess( - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - const drawinglayer::primitive2d::Primitive2DSequence& rSource, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + const drawinglayer::primitive2d::Primitive2DContainer& rSource, const basegfx::B2DHomMatrix* pTransform) const { - if(rSource.hasElements()) + if(!rSource.empty()) { const double fOpacity(getOpacity().getNumber()); @@ -1126,7 +1120,7 @@ namespace svgio return; } - drawinglayer::primitive2d::Primitive2DSequence aSource(rSource); + drawinglayer::primitive2d::Primitive2DContainer aSource(rSource); if(basegfx::fTools::less(fOpacity, 1.0)) { @@ -1136,7 +1130,7 @@ namespace svgio aSource, 1.0 - fOpacity)); - aSource = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); + aSource = drawinglayer::primitive2d::Primitive2DContainer { xRef }; } if(pTransform) @@ -1148,7 +1142,7 @@ namespace svgio *pTransform, aSource)); - aSource = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); + aSource = drawinglayer::primitive2d::Primitive2DContainer { xRef }; } if(!getClipPathXLink().isEmpty()) @@ -1163,7 +1157,7 @@ namespace svgio } } - if(aSource.hasElements()) // test again, applied clipPath may have lead to empty geometry + if(!aSource.empty()) // test again, applied clipPath may have lead to empty geometry { if(!getMaskXLink().isEmpty()) { @@ -1177,10 +1171,10 @@ namespace svgio } } - if(aSource.hasElements()) // test again, applied mask may have lead to empty geometry + if(!aSource.empty()) // test again, applied mask may have lead to empty geometry { // append to current target - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aSource); + rTarget.append(aSource); } } } diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx index 86a11d7b8b1e..bc61a4514418 100644 --- a/svgio/source/svgreader/svgsvgnode.cxx +++ b/svgio/source/svgreader/svgsvgnode.cxx @@ -294,9 +294,9 @@ namespace svgio } // ToDo: Consider attribute overflow in method decomposeSvgNode - void SvgSvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const + void SvgSvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const { - drawinglayer::primitive2d::Primitive2DSequence aSequence; + drawinglayer::primitive2d::Primitive2DContainer aSequence; // #i125258# check now if we need to init some style settings locally. Do not do this // in the constructor, there is not yet informatikon e.g. about existing CssStyles. @@ -306,7 +306,7 @@ namespace svgio // decompose children SvgNode::decomposeSvgNode(aSequence, bReferenced); - if(aSequence.hasElements()) + if(!aSequence.empty()) { if(getParent()) { @@ -355,9 +355,8 @@ namespace svgio // I use content itself as fallback to set missing values for viewport // Any better idea for such ill structures svg documents? const basegfx::B2DRange aChildRange( - drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - aSequence, - drawinglayer::geometry::ViewInformation2D())); + aSequence.getB2DRange( + drawinglayer::geometry::ViewInformation2D())); fWReference = aChildRange.getWidth(); } // referenced values are already in 'user unit' @@ -383,8 +382,7 @@ namespace svgio // I use content itself as fallback to set missing values for viewport // Any better idea for such ill structures svg documents? const basegfx::B2DRange aChildRange( - drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - aSequence, + aSequence.getB2DRange( drawinglayer::geometry::ViewInformation2D())); fHReference = aChildRange.getHeight(); } @@ -412,7 +410,7 @@ namespace svgio if(aTarget.equal(*getViewBox())) { // no mapping needed, append - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aSequence); + rTarget.append(aSequence); } else { @@ -435,7 +433,7 @@ namespace svgio if(rRatio.isMeetOrSlice()) { // embed in transformation - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xRef); + rTarget.push_back(xRef); } else { @@ -443,9 +441,9 @@ namespace svgio const drawinglayer::primitive2d::Primitive2DReference xMask( new drawinglayer::primitive2d::MaskPrimitive2D( basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aTarget)), - drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1))); + drawinglayer::primitive2d::Primitive2DContainer { xRef })); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xMask); + rTarget.push_back(xMask); } } } @@ -463,7 +461,7 @@ namespace svgio basegfx::tools::createTranslateB2DHomMatrix(fX, fY), aSequence)); - aSequence = drawinglayer::primitive2d::Primitive2DSequence(&xRef, 1); + aSequence = drawinglayer::primitive2d::Primitive2DContainer { xRef, }; } // embed in MaskPrimitive2D to clip @@ -475,7 +473,7 @@ namespace svgio aSequence)); // append - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xMask); + rTarget.push_back(xMask); } } } @@ -543,7 +541,7 @@ namespace svgio aViewBoxMapping, aSequence)); - aSequence = drawinglayer::primitive2d::Primitive2DSequence(&xTransform, 1); + aSequence = drawinglayer::primitive2d::Primitive2DContainer { xTransform }; } } else // no viewbox @@ -561,9 +559,8 @@ namespace svgio else { const basegfx::B2DRange aChildRange( - drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - aSequence, - drawinglayer::geometry::ViewInformation2D())); + aSequence.getB2DRange( + drawinglayer::geometry::ViewInformation2D())); const double fChildWidth(aChildRange.getWidth()); const double fChildHeight(aChildRange.getHeight()); fW = bWidthIsAbsolute ? getWidth().solveNonPercentage(*this) : fChildWidth; @@ -585,8 +582,7 @@ namespace svgio // different from Svg we have the possibility with primitives to get // a correct bounding box for the geometry. Get it for evtl. taking action const basegfx::B2DRange aContentRange( - drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence( - aSequence, + aSequence.getB2DRange( drawinglayer::geometry::ViewInformation2D())); if(aSvgCanvasRange.isInside(aContentRange)) @@ -603,9 +599,9 @@ namespace svgio basegfx::BColor(0.0, 0.0, 0.0))); const drawinglayer::primitive2d::Primitive2DReference xHidden( new drawinglayer::primitive2d::HiddenGeometryPrimitive2D( - drawinglayer::primitive2d::Primitive2DSequence(&xLine, 1))); + drawinglayer::primitive2d::Primitive2DContainer { xLine })); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aSequence, xHidden); + aSequence.push_back(xHidden); } else if(aSvgCanvasRange.overlaps(aContentRange)) { @@ -621,16 +617,16 @@ namespace svgio aSvgCanvasRange)), aSequence)); - aSequence = drawinglayer::primitive2d::Primitive2DSequence(&xMask, 1); + aSequence = drawinglayer::primitive2d::Primitive2DContainer { xMask }; } else { // not inside, no overlap. Empty Svg - aSequence.realloc(0); + aSequence.clear(); } } - if(aSequence.hasElements()) + if(!aSequence.empty()) { // embed in transform primitive to scale to 1/100th mm // where 1 inch == 25.4 mm to get from Svg coordinates (px) to @@ -646,10 +642,10 @@ namespace svgio aTransform, aSequence)); - aSequence = drawinglayer::primitive2d::Primitive2DSequence(&xTransform, 1); + aSequence = drawinglayer::primitive2d::Primitive2DContainer { xTransform }; // append to result - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aSequence); + rTarget.append(aSequence); } } } diff --git a/svgio/source/svgreader/svgtextnode.cxx b/svgio/source/svgreader/svgtextnode.cxx index 5f3e0ceac1f5..4637bcee51c2 100644 --- a/svgio/source/svgreader/svgtextnode.cxx +++ b/svgio/source/svgreader/svgtextnode.cxx @@ -88,10 +88,10 @@ namespace svgio void SvgTextNode::addTextPrimitives( const SvgNode& rCandidate, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, - drawinglayer::primitive2d::Primitive2DSequence& rSource) + drawinglayer::primitive2d::Primitive2DContainer& rTarget, + drawinglayer::primitive2d::Primitive2DContainer& rSource) { - if(rSource.hasElements()) + if(!rSource.empty()) { const SvgStyleAttributes* pAttributes = rCandidate.getSvgStyleAttributes(); @@ -104,12 +104,12 @@ namespace svgio { // should not happen, every subnode from SvgTextNode will at least // return the attributes from SvgTextNode. Nonetheless, add text - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, rSource); + rTarget.append(rSource); } } } - void SvgTextNode::DecomposeChild(const SvgNode& rCandidate, drawinglayer::primitive2d::Primitive2DSequence& rTarget, SvgTextPosition& rSvgTextPosition) const + void SvgTextNode::DecomposeChild(const SvgNode& rCandidate, drawinglayer::primitive2d::Primitive2DContainer& rTarget, SvgTextPosition& rSvgTextPosition) const { switch(rCandidate.getType()) { @@ -131,7 +131,7 @@ namespace svgio { // remember original TextStart to later detect hor/ver offsets const basegfx::B2DPoint aTextStart(rSvgTextPosition.getPosition()); - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; // decompose to regular TextPrimitives for(sal_uInt32 a(0); a < nCount; a++) @@ -139,16 +139,16 @@ namespace svgio DecomposeChild(*rChildren[a], aNewTarget, rSvgTextPosition); } - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { - const drawinglayer::primitive2d::Primitive2DSequence aPathContent(aNewTarget); - aNewTarget.realloc(0); + const drawinglayer::primitive2d::Primitive2DContainer aPathContent(aNewTarget); + aNewTarget.clear(); // dismantle TextPrimitives and map them on curve/path rSvgTextPathNode.decomposePathNode(aPathContent, aNewTarget, aTextStart); } - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { addTextPrimitives(rCandidate, rTarget, aNewTarget); } @@ -166,7 +166,7 @@ namespace svgio if(nCount) { SvgTextPosition aSvgTextPosition(&rSvgTextPosition, rSvgTspanNode, rSvgTspanNode.getSvgTextPositions()); - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; for(sal_uInt32 a(0); a < nCount; a++) { @@ -175,7 +175,7 @@ namespace svgio rSvgTextPosition.setPosition(aSvgTextPosition.getPosition()); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { addTextPrimitives(rCandidate, rTarget, aNewTarget); } @@ -191,7 +191,7 @@ namespace svgio { const SvgNodeVector& rChildren = pRefText->getChildren(); const sal_uInt32 nCount(rChildren.size()); - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; if(nCount) { @@ -204,7 +204,7 @@ namespace svgio const_cast< SvgNode& >(rChildCandidate).setAlternativeParent(); } - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { addTextPrimitives(rCandidate, rTarget, aNewTarget); } @@ -221,7 +221,7 @@ namespace svgio } } - void SvgTextNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced`*/) const + void SvgTextNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced`*/) const { // text has a group of child nodes, allowed are SVGTokenCharacter, SVGTokenTspan, // SVGTokenTref and SVGTokenTextPath. These increase a given current text position @@ -234,7 +234,7 @@ namespace svgio if(fOpacity > 0.0) { SvgTextPosition aSvgTextPosition(nullptr, *this, getSvgTextPositions()); - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; const SvgNodeVector& rChildren = getChildren(); const sal_uInt32 nCount(rChildren.size()); @@ -245,15 +245,15 @@ namespace svgio DecomposeChild(rCandidate, aNewTarget, aSvgTextPosition); } - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { - drawinglayer::primitive2d::Primitive2DSequence aNewTarget2; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget2; addTextPrimitives(*this, aNewTarget2, aNewTarget); aNewTarget = aNewTarget2; } - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { pStyle->add_postProcess(rTarget, aNewTarget, getTransform()); } diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx index fc2a0a2fc9bf..96eacd082ca5 100644 --- a/svgio/source/svgreader/svgtextpathnode.cxx +++ b/svgio/source/svgreader/svgtextpathnode.cxx @@ -377,11 +377,11 @@ namespace svgio } void SvgTextPathNode::decomposePathNode( - const drawinglayer::primitive2d::Primitive2DSequence& rPathContent, - drawinglayer::primitive2d::Primitive2DSequence& rTarget, + const drawinglayer::primitive2d::Primitive2DContainer& rPathContent, + drawinglayer::primitive2d::Primitive2DContainer& rTarget, const basegfx::B2DPoint& rTextStart) const { - if(rPathContent.hasElements()) + if(!rPathContent.empty()) { const SvgPathNode* pSvgPathNode = dynamic_cast< const SvgPathNode* >(getDocument().findSvgNodeById(maXLink)); @@ -431,7 +431,7 @@ namespace svgio if(fPosition >= 0.0) { - const sal_Int32 nLength(rPathContent.getLength()); + const sal_Int32 nLength(rPathContent.size()); sal_Int32 nCurrent(0); while(fPosition < fBasegfxPathLength && nCurrent < nLength) @@ -453,12 +453,12 @@ namespace svgio fPosition, rTextStart); - const drawinglayer::primitive2d::Primitive2DSequence aResult( + const drawinglayer::primitive2d::Primitive2DContainer aResult( aPathTextBreakupHelper.getResult()); - if(aResult.hasElements()) + if(!aResult.empty()) { - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aResult); + rTarget.append(aResult); } // advance position to consumed diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx index 133f63f76ea4..826aed2729f4 100644 --- a/svgio/source/svgreader/svgusenode.cxx +++ b/svgio/source/svgreader/svgusenode.cxx @@ -138,7 +138,7 @@ namespace svgio } } - void SvgUseNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool /*bReferenced*/) const + void SvgUseNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool /*bReferenced*/) const { // try to access link to content const SvgNode* mpXLink = getDocument().findSvgNodeById(maXLink); @@ -146,7 +146,7 @@ namespace svgio if(mpXLink && Display_none != mpXLink->getDisplay()) { // decompose children - drawinglayer::primitive2d::Primitive2DSequence aNewTarget; + drawinglayer::primitive2d::Primitive2DContainer aNewTarget; // todo: in case mpXLink is a SVGTokenSvg or SVGTokenSymbol the // SVG docs want the getWidth() and getHeight() from this node @@ -155,7 +155,7 @@ namespace svgio mpXLink->decomposeSvgNode(aNewTarget, true); const_cast< SvgNode* >(mpXLink)->setAlternativeParent(); - if(aNewTarget.hasElements()) + if(!aNewTarget.empty()) { basegfx::B2DHomMatrix aTransform; @@ -178,11 +178,11 @@ namespace svgio aTransform, aNewTarget)); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(rTarget, xRef); + rTarget.push_back(xRef); } else { - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(rTarget, aNewTarget); + rTarget.append(aNewTarget); } } } diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx index 4c722a039171..1484c9f46c62 100644 --- a/svgio/source/svguno/xsvgparser.cxx +++ b/svgio/source/svguno/xsvgparser.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <cppuhelper/implbase2.hxx> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/sequence.hxx> #include <com/sun/star/xml/sax/XParser.hpp> #include <com/sun/star/xml/sax/Parser.hpp> #include <com/sun/star/xml/sax/InputSource.hpp> @@ -154,7 +155,9 @@ namespace svgio if(Display_none != pCandidate->getDisplay()) { - pCandidate->decomposeSvgNode(aRetval, false); + drawinglayer::primitive2d::Primitive2DContainer aTmp = comphelper::sequenceToContainer<drawinglayer::primitive2d::Primitive2DContainer>(aRetval); + pCandidate->decomposeSvgNode(aTmp, false); + aRetval = comphelper::containerToSequence(aTmp); } } } |