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 /drawinglayer/source | |
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 'drawinglayer/source')
60 files changed, 526 insertions, 436 deletions
diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx index 70cae59dffdd..f4adb26da181 100644 --- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx +++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx @@ -161,8 +161,8 @@ namespace drawinglayer const primitive2d::Primitive2DReference xEmbedRef( new primitive2d::TransformPrimitive2D( aEmbedding, - Primitive2DSequence)); - const primitive2d::Primitive2DSequence xEmbedSeq(&xEmbedRef, 1); + primitive2d::Primitive2DContainer())); + const primitive2d::Primitive2DContainer xEmbedSeq { xEmbedRef }; BitmapEx aBitmapEx( tools::convertToBitmapEx( diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx index d8c088315c74..a6d23de24e3e 100644 --- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx @@ -35,7 +35,7 @@ namespace drawinglayer { AnimatedSwitchPrimitive2D::AnimatedSwitchPrimitive2D( const animation::AnimationEntry& rAnimationEntry, - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, bool bIsTextAnimation) : GroupPrimitive2D(rChildren), mpAnimationEntry(nullptr), @@ -63,12 +63,12 @@ namespace drawinglayer return false; } - Primitive2DSequence AnimatedSwitchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer AnimatedSwitchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - if(getChildren().hasElements()) + if(!getChildren().empty()) { const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime())); - const sal_uInt32 nLen(getChildren().getLength()); + const sal_uInt32 nLen(getChildren().size()); sal_uInt32 nIndex(basegfx::fround(fState * (double)nLen)); if(nIndex >= nLen) @@ -77,10 +77,10 @@ namespace drawinglayer } const Primitive2DReference xRef(getChildren()[nIndex], uno::UNO_QUERY_THROW); - return Primitive2DSequence(&xRef, 1L); + return Primitive2DContainer { xRef }; } - return Primitive2DSequence(); + return Primitive2DContainer(); } // provide unique ID @@ -97,15 +97,15 @@ namespace drawinglayer { AnimatedBlinkPrimitive2D::AnimatedBlinkPrimitive2D( const animation::AnimationEntry& rAnimationEntry, - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, bool bIsTextAnimation) : AnimatedSwitchPrimitive2D(rAnimationEntry, rChildren, bIsTextAnimation) { } - Primitive2DSequence AnimatedBlinkPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer AnimatedBlinkPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - if(getChildren().hasElements()) + if(!getChildren().empty()) { const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime())); @@ -115,7 +115,7 @@ namespace drawinglayer } } - return Primitive2DSequence(); + return Primitive2DContainer(); } // provide unique ID @@ -133,7 +133,7 @@ namespace drawinglayer AnimatedInterpolatePrimitive2D::AnimatedInterpolatePrimitive2D( const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack, const animation::AnimationEntry& rAnimationEntry, - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, bool bIsTextAnimation) : AnimatedSwitchPrimitive2D(rAnimationEntry, rChildren, bIsTextAnimation), maMatrixStack() @@ -148,7 +148,7 @@ namespace drawinglayer } } - Primitive2DSequence AnimatedInterpolatePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer AnimatedInterpolatePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { const sal_uInt32 nSize(maMatrixStack.size()); @@ -195,7 +195,7 @@ namespace drawinglayer // create new transform primitive reference, return new sequence const Primitive2DReference xRef(new TransformPrimitive2D(aTargetTransform, getChildren())); - return Primitive2DSequence(&xRef, 1L); + return Primitive2DContainer { xRef }; } else { diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx index ea10d205e2d8..90b5bbdc4adc 100644 --- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx @@ -35,17 +35,17 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence BackgroundColorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer BackgroundColorPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { if(!rViewInformation.getViewport().isEmpty()) { const basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(rViewInformation.getViewport())); const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), getBColor())); - return Primitive2DSequence(&xRef, 1L); + return Primitive2DContainer { xRef }; } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -77,17 +77,17 @@ namespace drawinglayer return rViewInformation.getViewport(); } - Primitive2DSequence BackgroundColorPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer BackgroundColorPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); - if(getBuffered2DDecomposition().hasElements() && (maLastViewport != rViewInformation.getViewport())) + if(!getBuffered2DDecomposition().empty() && (maLastViewport != rViewInformation.getViewport())) { // conditions of last local decomposition have changed, delete - const_cast< BackgroundColorPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< BackgroundColorPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember ViewRange const_cast< BackgroundColorPrimitive2D* >(this)->maLastViewport = rViewInformation.getViewport(); diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx index aba65aac7f2d..361cd22df805 100644 --- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx @@ -21,6 +21,7 @@ #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <basegfx/tools/canvastools.hxx> +#include <comphelper/sequence.hxx> @@ -48,18 +49,18 @@ namespace drawinglayer basegfx::B2DRange BasePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { - return getB2DRangeFromPrimitive2DSequence(get2DDecomposition(rViewInformation), rViewInformation); + return get2DDecomposition(rViewInformation).getB2DRange(rViewInformation); } - Primitive2DSequence BasePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer BasePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - return Primitive2DSequence(); + return Primitive2DContainer(); } Primitive2DSequence SAL_CALL BasePrimitive2D::getDecomposition( const uno::Sequence< beans::PropertyValue >& rViewParameters ) throw ( uno::RuntimeException, std::exception ) { const geometry::ViewInformation2D aViewInformation(rViewParameters); - return get2DDecomposition(aViewInformation); + return comphelper::containerToSequence(get2DDecomposition(aViewInformation)); } css::geometry::RealRectangle2D SAL_CALL BasePrimitive2D::getRange( const uno::Sequence< beans::PropertyValue >& rViewParameters ) throw ( uno::RuntimeException, std::exception ) @@ -76,9 +77,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence BufferedDecompositionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer BufferedDecompositionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - return Primitive2DSequence(); + return Primitive2DContainer(); } BufferedDecompositionPrimitive2D::BufferedDecompositionPrimitive2D() @@ -87,13 +88,13 @@ namespace drawinglayer { } - Primitive2DSequence BufferedDecompositionPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer BufferedDecompositionPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { - const Primitive2DSequence aNewSequence(create2DDecomposition(rViewInformation)); + const Primitive2DContainer aNewSequence(create2DDecomposition(rViewInformation)); const_cast< BufferedDecompositionPrimitive2D* >(this)->setBuffered2DDecomposition(aNewSequence); } @@ -110,7 +111,7 @@ namespace drawinglayer namespace primitive2d { // convert helper stl vector of primitives to Primitive2DSequence - Primitive2DSequence Primitive2DVectorToPrimitive2DSequence(const Primitive2DVector& rSource, bool bInvert) + Primitive2DSequence Primitive2DContainerToPrimitive2DSequence(const Primitive2DContainer& rSource, bool bInvert) { const sal_uInt32 nSize(rSource.size()); Primitive2DSequence aRetval; @@ -125,7 +126,26 @@ namespace drawinglayer // all entries taken over to Uno References as owners. To avoid // errors with users of this mechanism to delete pointers to BasePrimitive2D // itself, clear given vector - const_cast< Primitive2DVector& >(rSource).clear(); + const_cast< Primitive2DContainer& >(rSource).clear(); + + return aRetval; + } + Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert) const + { + const sal_uInt32 nSize(size()); + Primitive2DContainer aRetval; + + aRetval.resize(nSize); + + for(sal_uInt32 a(0); a < nSize; a++) + { + aRetval[bInvert ? nSize - 1 - a : a] = (*this)[a]; + } + + // all entries taken over to Uno References as owners. To avoid + // errors with users of this mechanism to delete pointers to BasePrimitive2D + // itself, clear given vector + const_cast< Primitive2DContainer& >(*this).clear(); return aRetval; } @@ -157,13 +177,29 @@ namespace drawinglayer } // get B2DRange from a given Primitive2DSequence - basegfx::B2DRange getB2DRangeFromPrimitive2DSequence(const Primitive2DSequence& rCandidate, const geometry::ViewInformation2D& aViewInformation) + basegfx::B2DRange Primitive2DContainer::getB2DRange(const geometry::ViewInformation2D& aViewInformation) const { basegfx::B2DRange aRetval; - if(rCandidate.hasElements()) + if(!empty()) { - const sal_Int32 nCount(rCandidate.getLength()); + const sal_Int32 nCount(this->size()); + + for(sal_Int32 a(0L); a < nCount; a++) + { + aRetval.expand(getB2DRangeFromPrimitive2DReference((*this)[a], aViewInformation)); + } + } + + return aRetval; + } + basegfx::B2DRange getB2DRangeFromPrimitive2DSequence(const Primitive2DContainer& rCandidate, const geometry::ViewInformation2D& aViewInformation) + { + basegfx::B2DRange aRetval; + + if(!rCandidate.empty()) + { + const sal_Int32 nCount(rCandidate.size()); for(sal_Int32 a(0L); a < nCount; a++) { @@ -237,6 +273,38 @@ namespace drawinglayer return true; } + bool Primitive2DContainer::operator==(const Primitive2DContainer& rB) const + { + const bool bAHasElements(!empty()); + + if(bAHasElements != !rB.empty()) + { + return false; + } + + if(!bAHasElements) + { + return true; + } + + const size_t nCount(size()); + + if(nCount != rB.size()) + { + return false; + } + + for(size_t a(0L); a < nCount; a++) + { + if(!arePrimitive2DReferencesEqual((*this)[a], rB[a])) + { + return false; + } + } + + return true; + } + // concatenate sequence void appendPrimitive2DSequenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DSequence& rSource) { @@ -271,6 +339,30 @@ namespace drawinglayer } } + void appendPrimitive2DSequenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DContainer& rSource) + { + appendPrimitive2DSequenceToPrimitive2DSequence(rDest, comphelper::containerToSequence(rSource)); + } + + void Primitive2DContainer::append(const Primitive2DContainer& rSource) + { + insert(end(), rSource.begin(), rSource.end()); + } +/* + void Primitive2DContainer::append(Primitive2DContainer&& rSource) + { + resize(size() + rSource.size()); + memcpy(data() + size(), + rSource.data(), + rSource.size() * sizeof(Primitive2DReference)); + memset(reinterpret_cast<void*>(rSource.data()), 0, rSource.size() * sizeof(Primitive2DReference)); + } +*/ + void Primitive2DContainer::append(const Primitive2DSequence& rSource) + { + std::copy(rSource.begin(), rSource.end(), std::back_inserter(*this)); + } + // concatenate single Primitive2D void appendPrimitive2DReferenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DReference& rSource) { diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index 30e656d99866..038e3e928be6 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -161,9 +161,9 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( return basegfx::B2DPolyPolygon( clipPolygon ); } - Primitive2DSequence BorderLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer BorderLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; if(!getStart().equal(getEnd()) && ( isInsideUsed() || isOutsideUsed() ) ) { @@ -181,7 +181,7 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( const basegfx::B2DPoint aTmpStart(getStart() - (fExt * aVector)); const basegfx::B2DPoint aTmpEnd(getEnd() + (fExt * aVector)); - xRetval.realloc(2); + xRetval.resize(2); double fLeftWidth = getLeftWidth(); bool bLeftHairline = lcl_UseHairline(fLeftWidth, getStart(), getEnd(), rViewInformation); @@ -239,7 +239,7 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( aPolygon.append( getStart() ); aPolygon.append( getEnd() ); - xRetval.realloc(1); + xRetval.resize(1); xRetval[0] = Primitive2DReference(new PolygonHairlinePrimitive2D( aPolygon, aColor)); @@ -276,7 +276,7 @@ primitive2d::Primitive2DReference makeSolidLinePrimitive( } sal_uInt32 n = aDashed.count(); - xRetval.realloc(n); + xRetval.resize(n); for (sal_uInt32 i = 0; i < n; ++i) { basegfx::B2DPolygon aDash = aDashed.getB2DPolygon(i); diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index d782962fa11d..1367692b8f3c 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -237,7 +237,7 @@ namespace drawinglayer return xRetval; } - Primitive2DSequence ControlPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer ControlPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // try to create a bitmap decomposition. If that fails for some reason, // at least create a replacement decomposition. @@ -248,7 +248,7 @@ namespace drawinglayer xReference = createPlaceholderDecomposition(rViewInformation); } - return Primitive2DSequence(&xReference, 1L); + return Primitive2DContainer { xReference }; } ControlPrimitive2D::ControlPrimitive2D( @@ -329,23 +329,23 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence ControlPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer ControlPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // this primitive is view-dependent related to the scaling. If scaling has changed, // destroy existing decomposition. To detect change, use size of unit size in view coordinates ::osl::MutexGuard aGuard( m_aMutex ); const basegfx::B2DVector aNewScaling(rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0)); - if(getBuffered2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().empty()) { if(!maLastViewScaling.equal(aNewScaling)) { // conditions of last local decomposition have changed, delete - const_cast< ControlPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< ControlPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember ViewTransformation const_cast< ControlPrimitive2D* >(this)->maLastViewScaling = aNewScaling; diff --git a/drawinglayer/source/primitive2d/cropprimitive2d.cxx b/drawinglayer/source/primitive2d/cropprimitive2d.cxx index b2a7ea4f535d..6a76d4ef419b 100644 --- a/drawinglayer/source/primitive2d/cropprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/cropprimitive2d.cxx @@ -37,7 +37,7 @@ namespace drawinglayer namespace primitive2d { CropPrimitive2D::CropPrimitive2D( - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, const basegfx::B2DHomMatrix& rTransformation, double fCropLeft, double fCropTop, @@ -68,11 +68,11 @@ namespace drawinglayer return false; } - Primitive2DSequence CropPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer CropPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; - if(getChildren().hasElements()) + if(!getChildren().empty()) { // get original object scale in unit coordinates (no mirroring) const basegfx::B2DVector aObjectScale(basegfx::absolute(getTransformation() * basegfx::B2DVector(1.0, 1.0))); @@ -130,7 +130,7 @@ namespace drawinglayer { // the new range is completely inside the old range (unit range), // so no masking is needed - xRetval = Primitive2DSequence(&xTransformPrimitive, 1); + xRetval = Primitive2DContainer { xTransformPrimitive }; } else { @@ -142,9 +142,9 @@ namespace drawinglayer const Primitive2DReference xMask( new MaskPrimitive2D( aMaskPolyPolygon, - Primitive2DSequence(&xTransformPrimitive, 1))); + Primitive2DContainer { xTransformPrimitive })); - xRetval = Primitive2DSequence(&xMask, 1); + xRetval = Primitive2DContainer { xMask }; } } } diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx index e406a3b506b1..06d481d6709a 100644 --- a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx @@ -27,12 +27,12 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence DiscreteBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer DiscreteBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // use getViewTransformation() and getObjectTransformation() from // ObjectAndViewTransformationDependentPrimitive2D to create a BitmapPrimitive2D // with the correct mapping - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; if(!getBitmapEx().IsEmpty()) { @@ -67,7 +67,7 @@ namespace drawinglayer // create BitmapPrimitive2D with now object-local coordinate data const Primitive2DReference xRef(new BitmapPrimitive2D(getBitmapEx(), aObjectTransform)); - xRetval = Primitive2DSequence(&xRef, 1); + xRetval = Primitive2DContainer { xRef }; } return xRetval; diff --git a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx index b845602c4fb9..0f663a4345f2 100644 --- a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx @@ -163,9 +163,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence DiscreteShadowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer DiscreteShadowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; if(!getDiscreteShadow().getBitmapEx().IsEmpty()) { @@ -178,7 +178,7 @@ namespace drawinglayer const double fBigLenX((fBorderX * 2.0) + fSingleX); const double fBigLenY((fBorderY * 2.0) + fSingleY); - xRetval.realloc(8); + xRetval.resize(8); // TopLeft xRetval[0] = Primitive2DReference( @@ -266,7 +266,7 @@ namespace drawinglayer getTransform(), xRetval)); - xRetval = Primitive2DSequence(&xTransformed, 1); + xRetval = Primitive2DContainer { xTransformed }; } return xRetval; diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx index d3538f45b9ed..284b91c0f4b7 100644 --- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx @@ -62,10 +62,10 @@ namespace drawinglayer } // return if there are shadow primitives - return maShadowPrimitives.hasElements(); + return !maShadowPrimitives.empty(); } - Primitive2DSequence Embedded3DPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer Embedded3DPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // use info to create a yellow 2d rectangle, similar to empty 3d scenes and/or groups const basegfx::B2DRange aLocal2DRange(getB2DRange(rViewInformation)); @@ -73,7 +73,7 @@ namespace drawinglayer const basegfx::BColor aYellow(1.0, 1.0, 0.0); const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aOutline, aYellow)); - return Primitive2DSequence(&xRef, 1L); + return Primitive2DContainer { xRef }; } Embedded3DPrimitive2D::Embedded3DPrimitive2D( @@ -132,7 +132,7 @@ namespace drawinglayer // taken into account if(impGetShadow3D(rViewInformation)) { - const basegfx::B2DRange aShadow2DRange(getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); + const basegfx::B2DRange aShadow2DRange(maShadowPrimitives.getB2DRange(rViewInformation)); if(!aShadow2DRange.isEmpty()) { diff --git a/drawinglayer/source/primitive2d/epsprimitive2d.cxx b/drawinglayer/source/primitive2d/epsprimitive2d.cxx index a2d5cf63f5c3..6d29e7a5afbb 100644 --- a/drawinglayer/source/primitive2d/epsprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/epsprimitive2d.cxx @@ -25,9 +25,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer EpsPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; const GDIMetaFile& rSubstituteContent = getMetaFile(); if( rSubstituteContent.GetActionSize() ) @@ -35,7 +35,7 @@ namespace drawinglayer // the default decomposition will use the Metafile replacement visualisation. // To really use the Eps data, a renderer has to know and interpret this primitive // directly. - xRetval.realloc(1); + xRetval.resize(1); xRetval[0] = Primitive2DReference( new MetafilePrimitive2D( diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx index 7f506eea8f2d..cc7a1a0cdfec 100644 --- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx @@ -150,13 +150,14 @@ namespace drawinglayer } } - Primitive2DSequence FillGradientPrimitive2D::createOverlappingFill( + Primitive2DContainer FillGradientPrimitive2D::createOverlappingFill( const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, const basegfx::BColor& rOuterColor, const basegfx::B2DPolygon& rUnitPolygon) const { // prepare return value - Primitive2DSequence aRetval(rEntries.size() + 1); + Primitive2DContainer aRetval; + aRetval.resize(rEntries.size() + 1); // create solid fill with outmost color aRetval[0] = Primitive2DReference( @@ -183,13 +184,14 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence FillGradientPrimitive2D::createNonOverlappingFill( + Primitive2DContainer FillGradientPrimitive2D::createNonOverlappingFill( const std::vector< drawinglayer::texture::B2DHomMatrixAndBColor >& rEntries, const basegfx::BColor& rOuterColor, const basegfx::B2DPolygon& rUnitPolygon) const { // prepare return value - Primitive2DSequence aRetval(rEntries.size() + 1); + Primitive2DContainer aRetval; + aRetval.resize(rEntries.size() + 1); // get outmost visible range from object basegfx::B2DRange aOutmostRange(getOutputRange()); @@ -245,7 +247,7 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence FillGradientPrimitive2D::createFill(bool bOverlapping) const + Primitive2DContainer FillGradientPrimitive2D::createFill(bool bOverlapping) const { // prepare shape of the Unit Polygon basegfx::B2DPolygon aUnitPolygon; @@ -282,7 +284,7 @@ namespace drawinglayer } } - Primitive2DSequence FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer FillGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // default creates overlapping fill which works with AntiAliasing and without. // The non-overlapping version does not create single filled polygons, but @@ -299,7 +301,7 @@ namespace drawinglayer } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } diff --git a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx index 0bb39f53494e..21117e283572 100644 --- a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx @@ -39,9 +39,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence FillGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer FillGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; const attribute::FillGraphicAttribute& rAttribute = getFillGraphic(); if(!rAttribute.isDefault()) @@ -66,10 +66,10 @@ namespace drawinglayer // get matrices and realloc retval aTiling.appendTransformations(aMatrices); - aRetval.realloc(aMatrices.size()); + aRetval.resize(aMatrices.size()); // prepare content primitive - const Primitive2DSequence xSeq = create2DDecompositionOfGraphic( + const Primitive2DContainer xSeq = create2DDecompositionOfGraphic( rGraphic, basegfx::B2DHomMatrix()); diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx index 886c1b26327f..1c34c1140f67 100644 --- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx @@ -37,9 +37,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer FillHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; if(!getFillHatch().isDefault()) { @@ -105,7 +105,7 @@ namespace drawinglayer // prepare return value const bool bFillBackground(getFillHatch().isFillBackground()); - aRetval.realloc(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); + aRetval.resize(bFillBackground ? aMatrices.size() + 1L : aMatrices.size()); // evtl. create filled background if(bFillBackground) @@ -185,7 +185,7 @@ namespace drawinglayer return getOutputRange(); } - Primitive2DSequence FillHatchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer FillHatchPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance()); diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index 4a0607a0e6e2..d2e9c882922c 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -32,10 +32,10 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence GraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& + Primitive2DContainer GraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& ) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; if(255L == getGraphicAttr().GetTransparency()) { @@ -110,7 +110,7 @@ namespace drawinglayer aTransformedGraphic, aTransform); - if(!aRetval.getLength()) + if(!aRetval.size()) { // content is invisible, done return aRetval; @@ -131,7 +131,7 @@ namespace drawinglayer basegfx::clamp(aSuppressGraphicAttr.GetGamma(), 0.0, 10.0), aSuppressGraphicAttr.IsInvert()); - if(!aRetval.getLength()) + if(!aRetval.size()) { // content is invisible, done return aRetval; @@ -150,7 +150,7 @@ namespace drawinglayer aRetval, fTransparency)); - aRetval = Primitive2DSequence(&aUnifiedTransparence, 1); + aRetval = Primitive2DContainer { aUnifiedTransparence }; } } @@ -179,7 +179,7 @@ namespace drawinglayer getGraphicAttr().GetRightCrop() * aCropScaleFactor.getX(), getGraphicAttr().GetBottomCrop() * aCropScaleFactor.getY())); - aRetval = Primitive2DSequence(&xPrimitive, 1); + aRetval = Primitive2DContainer { xPrimitive }; } return aRetval; diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index be7ff6541fa7..a924b3dd6454 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -193,11 +193,11 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence create2DDecompositionOfGraphic( + Primitive2DContainer create2DDecompositionOfGraphic( const Graphic& rGraphic, const basegfx::B2DHomMatrix& rTransform) { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; switch(rGraphic.GetType()) { @@ -212,7 +212,7 @@ namespace drawinglayer { // create sub-primitives for animated bitmap and the needed animation loop animation::AnimationEntryLoop aAnimationLoop(aData.loopCount() ? aData.loopCount() : 0xffff); - Primitive2DSequence aBitmapPrimitives(aData.count()); + Primitive2DContainer aBitmapPrimitives(aData.count()); for(sal_uInt32 a(0); a < aData.count(); a++) { @@ -228,7 +228,7 @@ namespace drawinglayer aAnimationList.append(aAnimationLoop); // create and add animated switch primitive - aRetval.realloc(1); + aRetval.resize(1); aRetval[0] = new AnimatedSwitchPrimitive2D( aAnimationList, aBitmapPrimitives, @@ -256,7 +256,7 @@ namespace drawinglayer aEmbedSvg = rTransform * aEmbedSvg; // add Svg primitives embedded - aRetval.realloc(1); + aRetval.resize(1); aRetval[0] = new TransformPrimitive2D( aEmbedSvg, rGraphic.getSvgData()->getPrimitive2DSequence()); @@ -264,7 +264,7 @@ namespace drawinglayer } else { - aRetval.realloc(1); + aRetval.resize(1); aRetval[0] = new BitmapPrimitive2D( rGraphic.GetBitmapEx(), rTransform); @@ -278,7 +278,7 @@ namespace drawinglayer // create MetafilePrimitive2D const GDIMetaFile& rMetafile = rGraphic.GetGDIMetaFile(); - aRetval.realloc(1); + aRetval.resize(1); aRetval[0] = new MetafilePrimitive2D( rTransform, rMetafile); @@ -316,8 +316,8 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence create2DColorModifierEmbeddingsAsNeeded( - const Primitive2DSequence& rChildren, + Primitive2DContainer create2DColorModifierEmbeddingsAsNeeded( + const Primitive2DContainer& rChildren, GraphicDrawMode aGraphicDrawMode, double fLuminance, double fContrast, @@ -327,9 +327,9 @@ namespace drawinglayer double fGamma, bool bInvert) { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; - if(!rChildren.getLength()) + if(!rChildren.size()) { // no child content, done return aRetval; @@ -363,7 +363,7 @@ namespace drawinglayer basegfx::BColorModifierSharedPtr( new basegfx::BColorModifier_gray()))); - aRetval = Primitive2DSequence(&aPrimitiveGrey, 1); + aRetval = Primitive2DContainer { aPrimitiveGrey }; break; } case GRAPHICDRAWMODE_MONO: @@ -375,7 +375,7 @@ namespace drawinglayer basegfx::BColorModifierSharedPtr( new basegfx::BColorModifier_black_and_white(0.5)))); - aRetval = Primitive2DSequence(&aPrimitiveBlackAndWhite, 1); + aRetval = Primitive2DContainer { aPrimitiveBlackAndWhite }; break; } // coverity[dead_error_begin] - intentional dead case @@ -410,7 +410,7 @@ namespace drawinglayer fLuminance, fContrast)))); - aRetval = Primitive2DSequence(&aPrimitiveRGBLuminannceContrast, 1); + aRetval = Primitive2DContainer { aPrimitiveRGBLuminannceContrast }; } // gamma (boolean) @@ -423,7 +423,7 @@ namespace drawinglayer new basegfx::BColorModifier_gamma( fGamma)))); - aRetval = Primitive2DSequence(&aPrimitiveGamma, 1); + aRetval = Primitive2DContainer { aPrimitiveGamma }; } // invert (boolean) @@ -435,7 +435,7 @@ namespace drawinglayer basegfx::BColorModifierSharedPtr( new basegfx::BColorModifier_invert()))); - aRetval = Primitive2DSequence(&aPrimitiveInvert, 1); + aRetval = Primitive2DContainer { aPrimitiveInvert }; } return aRetval; diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx index b83ed34dccce..69ce961c3517 100644 --- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx @@ -35,9 +35,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence GridPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer GridPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; if(!rViewInformation.getViewport().isEmpty() && getWidth() > 0.0 && getHeight() > 0.0) { @@ -234,7 +234,7 @@ namespace drawinglayer const sal_uInt32 nRetvalCount((nCountPoint ? 1 : 0) + (nCountCross ? 1 : 0)); sal_uInt32 nInsertCounter(0); - aRetval.realloc(nRetvalCount); + aRetval.resize(nRetvalCount); // add PointArrayPrimitive2D if point markers were added if(nCountPoint) @@ -319,20 +319,20 @@ namespace drawinglayer return aUnitRange; } - Primitive2DSequence GridPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer GridPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); - if(getBuffered2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().empty()) { if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< GridPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< GridPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember ViewRange and ViewTransformation const_cast< GridPrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); diff --git a/drawinglayer/source/primitive2d/groupprimitive2d.cxx b/drawinglayer/source/primitive2d/groupprimitive2d.cxx index eae9502cf5c4..6ad6e7759f83 100644 --- a/drawinglayer/source/primitive2d/groupprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/groupprimitive2d.cxx @@ -30,7 +30,7 @@ namespace drawinglayer { namespace primitive2d { - GroupPrimitive2D::GroupPrimitive2D( const Primitive2DSequence& rChildren ) + GroupPrimitive2D::GroupPrimitive2D( const Primitive2DContainer& rChildren ) : BasePrimitive2D(), maChildren(rChildren) { @@ -46,14 +46,14 @@ namespace drawinglayer { const GroupPrimitive2D& rCompare = static_cast< const GroupPrimitive2D& >(rPrimitive); - return (arePrimitive2DSequencesEqual(getChildren(), rCompare.getChildren())); + return getChildren() == rCompare.getChildren(); } return false; } /// default: just return children, so all renderers not supporting group will use it's content - Primitive2DSequence GroupPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer GroupPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { return getChildren(); } diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx index 3962f65c0f8b..83977cf4e870 100644 --- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx @@ -35,7 +35,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence HelplinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer HelplinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { std::vector< BasePrimitive2D* > aTempPrimitiveTarget; @@ -130,7 +130,7 @@ namespace drawinglayer } // prepare return value - Primitive2DSequence aRetval(aTempPrimitiveTarget.size()); + Primitive2DContainer aRetval(aTempPrimitiveTarget.size()); for(size_t a(0); a < aTempPrimitiveTarget.size(); a++) { @@ -177,20 +177,20 @@ namespace drawinglayer return false; } - Primitive2DSequence HelplinePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer HelplinePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); - if(getBuffered2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().empty()) { if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< HelplinePrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< HelplinePrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember ViewRange and ViewTransformation const_cast< HelplinePrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); diff --git a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx index 0723b2952abf..e5d9e38e1a44 100644 --- a/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx @@ -31,19 +31,19 @@ namespace drawinglayer namespace primitive2d { HiddenGeometryPrimitive2D::HiddenGeometryPrimitive2D( - const Primitive2DSequence& rChildren) + const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren) { } basegfx::B2DRange HiddenGeometryPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { - return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + return getChildren().getB2DRange(rViewInformation); } - Primitive2DSequence HiddenGeometryPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer HiddenGeometryPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - return Primitive2DSequence(); + return Primitive2DContainer(); } // provide unique ID diff --git a/drawinglayer/source/primitive2d/invertprimitive2d.cxx b/drawinglayer/source/primitive2d/invertprimitive2d.cxx index e5cb6e80254e..e7554ed0ab0f 100644 --- a/drawinglayer/source/primitive2d/invertprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/invertprimitive2d.cxx @@ -31,7 +31,7 @@ namespace drawinglayer namespace primitive2d { InvertPrimitive2D::InvertPrimitive2D( - const Primitive2DSequence& rChildren) + const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren) { } diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx index 1d0bbae6545c..d96ac229f346 100644 --- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx @@ -36,9 +36,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence MarkerArrayPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer MarkerArrayPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; const std::vector< basegfx::B2DPoint >& rPositions = getPositions(); const sal_uInt32 nMarkerCount(rPositions.size()); @@ -57,7 +57,7 @@ namespace drawinglayer aLogicHalfSize *= 0.5; // number of primitives is known; realloc accordingly - xRetval.realloc(nMarkerCount); + xRetval.resize(nMarkerCount); for(sal_uInt32 a(0); a < nMarkerCount; a++) { diff --git a/drawinglayer/source/primitive2d/maskprimitive2d.cxx b/drawinglayer/source/primitive2d/maskprimitive2d.cxx index 530ff008675a..618c93f7e6e2 100644 --- a/drawinglayer/source/primitive2d/maskprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/maskprimitive2d.cxx @@ -32,7 +32,7 @@ namespace drawinglayer { MaskPrimitive2D::MaskPrimitive2D( const basegfx::B2DPolyPolygon& rMask, - const Primitive2DSequence& rChildren) + const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren), maMask(rMask) { diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index 1140228ed582..bf21d18b95f5 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -34,9 +34,10 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence MediaPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer MediaPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence xRetval(1); + Primitive2DContainer xRetval; + xRetval.resize(1); // create background object basegfx::B2DPolygon aBackgroundPolygon(basegfx::tools::createUnitPolygon()); @@ -51,7 +52,7 @@ namespace drawinglayer { const GraphicObject aGraphicObject(maSnapshot); const GraphicAttr aGraphicAttr; - xRetval.realloc(2); + xRetval.resize(2); xRetval[0] = xRefBackground; xRetval[1] = Primitive2DReference(new GraphicPrimitive2D(getTransform(), aGraphicObject, aGraphicAttr)); } @@ -74,7 +75,7 @@ namespace drawinglayer // invisible content for HitTest and BoundRect const Primitive2DReference xHiddenLines(new HiddenGeometryPrimitive2D(xRetval)); - xRetval = Primitive2DSequence(&xHiddenLines, 1); + xRetval = Primitive2DContainer { xHiddenLines, }; } else { @@ -86,7 +87,7 @@ namespace drawinglayer // add transform primitive const Primitive2DReference aScaled(new TransformPrimitive2D(aTransform, xRetval)); - xRetval = Primitive2DSequence(&aScaled, 1L); + xRetval = Primitive2DContainer { aScaled }; } } diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx index 4a641d60891c..167eb712a75f 100644 --- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx @@ -428,10 +428,10 @@ namespace } } - drawinglayer::primitive2d::Primitive2DSequence getPrimitive2DSequence(const PropertyHolder& rPropertyHolder) + drawinglayer::primitive2d::Primitive2DContainer getPrimitive2DSequence(const PropertyHolder& rPropertyHolder) { const sal_uInt32 nCount(aTargets.size()); - drawinglayer::primitive2d::Primitive2DSequence xRetval(nCount); + drawinglayer::primitive2d::Primitive2DContainer xRetval(nCount); for(sal_uInt32 a(0); a < nCount; a++) { @@ -444,7 +444,7 @@ namespace // the buffer to not delete them in the destructor. aTargets.clear(); - if(xRetval.hasElements() && rPropertyHolder.getClipPolyPolygonActive()) + if(!xRetval.empty() && rPropertyHolder.getClipPolyPolygonActive()) { const basegfx::B2DPolyPolygon& rClipPolyPolygon = rPropertyHolder.getClipPolyPolygon(); @@ -455,7 +455,7 @@ namespace rClipPolyPolygon, xRetval)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xMask, 1); + xRetval = drawinglayer::primitive2d::Primitive2DContainer { xMask }; } } @@ -538,7 +538,7 @@ namespace drawinglayer { protected: /// local decomposition. - virtual Primitive2DSequence create2DDecomposition( + virtual Primitive2DContainer create2DDecomposition( const geometry::ViewInformation2D& rViewInformation) const override; public: @@ -551,7 +551,7 @@ namespace drawinglayer } }; - Primitive2DSequence NonOverlappingFillGradientPrimitive2D::create2DDecomposition( + Primitive2DContainer NonOverlappingFillGradientPrimitive2D::create2DDecomposition( const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillGradient().isDefault()) @@ -560,7 +560,7 @@ namespace drawinglayer } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } } // end of namespace primitive2d @@ -990,7 +990,7 @@ namespace // MaskPrimitive2D accordingly. if(rPropertyHolders.Current().getClipPolyPolygonActive() && rTargetHolders.size() > 1) { - drawinglayer::primitive2d::Primitive2DSequence aSubContent; + drawinglayer::primitive2d::Primitive2DContainer aSubContent; if(rPropertyHolders.Current().getClipPolyPolygon().count() && rTargetHolders.Current().size()) @@ -1001,7 +1001,7 @@ namespace rTargetHolders.Pop(); - if(aSubContent.hasElements()) + if(!aSubContent.empty()) { rTargetHolders.Current().append( new drawinglayer::primitive2d::GroupPrimitive2D( @@ -1036,7 +1036,7 @@ namespace // check if currently active if(rPropertyHolders.Current().isRasterOpActive() && rTargetHolders.size() > 1) { - drawinglayer::primitive2d::Primitive2DSequence aSubContent; + drawinglayer::primitive2d::Primitive2DContainer aSubContent; if(rTargetHolders.Current().size()) { @@ -1045,7 +1045,7 @@ namespace rTargetHolders.Pop(); - if(aSubContent.hasElements()) + if(!aSubContent.empty()) { if(rPropertyHolders.Current().isRasterOpForceBlack()) { @@ -1120,7 +1120,7 @@ namespace if(!rPropertyHolder.getTransformation().isIdentity()) { const drawinglayer::primitive2d::Primitive2DReference xPrim(pRetval); - const drawinglayer::primitive2d::Primitive2DSequence xSeq(&xPrim, 1); + const drawinglayer::primitive2d::Primitive2DContainer xSeq { xPrim }; pRetval = new drawinglayer::primitive2d::TransformPrimitive2D( rPropertyHolder.getTransformation(), @@ -1196,7 +1196,7 @@ namespace rTarget.append( new drawinglayer::primitive2d::TransformPrimitive2D( rProperty.getTransformation(), - drawinglayer::primitive2d::Primitive2DSequence(&xPrim, 1))); + drawinglayer::primitive2d::Primitive2DContainer { xPrim })); } } @@ -1425,7 +1425,7 @@ namespace aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); // prepare Primitive2DSequence, put text in foreground - drawinglayer::primitive2d::Primitive2DSequence aSequence(2); + drawinglayer::primitive2d::Primitive2DContainer aSequence(2); aSequence[1] = drawinglayer::primitive2d::Primitive2DReference(pResult); // prepare filled polygon @@ -1457,7 +1457,7 @@ namespace rTarget.append( new drawinglayer::primitive2d::TransformPrimitive2D( rProperty.getTransformation(), - drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1))); + drawinglayer::primitive2d::Primitive2DContainer { aReference })); } } } @@ -1575,7 +1575,7 @@ namespace else { // when a transformation is set, embed to it - drawinglayer::primitive2d::Primitive2DSequence xTargets(aTargetVector.size()); + drawinglayer::primitive2d::Primitive2DContainer xTargets(aTargetVector.size()); for(size_t a(0); a < aTargetVector.size(); a++) { @@ -2116,7 +2116,7 @@ namespace if(aGDIMetaFile.GetActionSize()) { // create sub-content - drawinglayer::primitive2d::Primitive2DSequence xSubContent; + drawinglayer::primitive2d::Primitive2DContainer xSubContent; { rTargetHolders.Push(); @@ -2132,7 +2132,7 @@ namespace rTargetHolders.Pop(); } - if(xSubContent.hasElements()) + if(!xSubContent.empty()) { // add with transformation rTargetHolders.Current().append( @@ -2299,7 +2299,7 @@ namespace { // really a gradient aRange.transform(rPropertyHolders.Current().getTransformation()); - drawinglayer::primitive2d::Primitive2DSequence xGradient(1); + drawinglayer::primitive2d::Primitive2DContainer xGradient(1); if(rPropertyHolders.Current().isRasterOpInvert()) { @@ -2356,7 +2356,7 @@ namespace rTargetHolders.Current().append( new drawinglayer::primitive2d::MaskPrimitive2D( aOutline, - drawinglayer::primitive2d::Primitive2DSequence(&aFillHatch, 1))); + drawinglayer::primitive2d::Primitive2DContainer { aFillHatch })); } break; @@ -2859,13 +2859,13 @@ namespace // create primitives there and get them createHairlineAndFillPrimitive(aOutline, rTargetHolders.Current(), rPropertyHolders.Current()); - const drawinglayer::primitive2d::Primitive2DSequence aSubContent( + const drawinglayer::primitive2d::Primitive2DContainer aSubContent( rTargetHolders.Current().getPrimitive2DSequence(rPropertyHolders.Current())); // back to old target rTargetHolders.Pop(); - if(aSubContent.hasElements()) + if(!aSubContent.empty()) { rTargetHolders.Current().append( new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( @@ -2967,7 +2967,7 @@ namespace { // create the sub-content with no embedding specific to the // sub-metafile, this seems not to be used. - drawinglayer::primitive2d::Primitive2DSequence xSubContent; + drawinglayer::primitive2d::Primitive2DContainer xSubContent; { rTargetHolders.Push(); // #i# for sub-Mteafile contents, do start with new, default render state @@ -2978,7 +2978,7 @@ namespace rTargetHolders.Pop(); } - if(xSubContent.hasElements()) + if(!xSubContent.empty()) { // prepare sub-content transform basegfx::B2DHomMatrix aSubTransform; @@ -3011,7 +3011,7 @@ namespace aSubTransform, xSubContent)); - xSubContent = drawinglayer::primitive2d::Primitive2DSequence(&aEmbeddedTransform, 1); + xSubContent = drawinglayer::primitive2d::Primitive2DContainer { aEmbeddedTransform }; } // check if gradient is a real gradient @@ -3042,7 +3042,7 @@ namespace rTargetHolders.Current().append( new drawinglayer::primitive2d::TransparencePrimitive2D( xSubContent, - drawinglayer::primitive2d::Primitive2DSequence(&xTransparence, 1))); + drawinglayer::primitive2d::Primitive2DContainer { xTransparence })); } } } @@ -3176,7 +3176,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence MetafilePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer MetafilePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // prepare target and porperties; each will have one default entry TargetHolders aTargetHolders; @@ -3190,19 +3190,19 @@ namespace drawinglayer // get the content. There should be only one target, as in the start condition, // but iterating will be the right thing to do when some push/pop is not closed - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; while(aTargetHolders.size() > 1) { - appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, + xRetval.append( aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current())); aTargetHolders.Pop(); } - appendPrimitive2DSequenceToPrimitive2DSequence(xRetval, + xRetval.append( aTargetHolders.Current().getPrimitive2DSequence(aPropertyHolders.Current())); - if(xRetval.hasElements()) + if(!xRetval.empty()) { // get target size const Rectangle aMtfTarget(getMetaFile().GetPrefMapMode().GetOrigin(), getMetaFile().GetPrefSize()); @@ -3222,7 +3222,7 @@ namespace drawinglayer aAdaptedTransform, xRetval)); - xRetval = Primitive2DSequence(&aEmbeddedTransform, 1); + xRetval = Primitive2DContainer { aEmbeddedTransform }; } return xRetval; diff --git a/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx index 4e370379594c..f87e27118387 100644 --- a/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx @@ -31,7 +31,7 @@ namespace drawinglayer namespace primitive2d { ModifiedColorPrimitive2D::ModifiedColorPrimitive2D( - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, const basegfx::BColorModifierSharedPtr& rColorModifier) : GroupPrimitive2D(rChildren), maColorModifier(rColorModifier) diff --git a/drawinglayer/source/primitive2d/objectinfoprimitive2d.cxx b/drawinglayer/source/primitive2d/objectinfoprimitive2d.cxx index ea77adab7563..60468257f779 100644 --- a/drawinglayer/source/primitive2d/objectinfoprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/objectinfoprimitive2d.cxx @@ -26,7 +26,7 @@ namespace drawinglayer namespace primitive2d { ObjectInfoPrimitive2D::ObjectInfoPrimitive2D( - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, const OUString& rName, const OUString& rTitle, const OUString& rDesc) diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx index c4fd3f03d105..bacbd4bd485c 100644 --- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx @@ -35,12 +35,12 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PagePreviewPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer PagePreviewPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence xRetval; - Primitive2DSequence aContent(getPageContent()); + Primitive2DContainer xRetval; + Primitive2DContainer aContent(getPageContent()); - if(aContent.hasElements() + if(!aContent.empty() && basegfx::fTools::more(getContentWidth(), 0.0) && basegfx::fTools::more(getContentHeight(), 0.0)) { @@ -53,7 +53,7 @@ namespace drawinglayer { // check if content overlaps with target size and needs to be embedded with a // clipping primitive - const basegfx::B2DRange aRealContentRange(getB2DRangeFromPrimitive2DSequence(aContent, rViewInformation)); + const basegfx::B2DRange aRealContentRange(aContent.getB2DRange(rViewInformation)); const basegfx::B2DRange aAllowedContentRange(0.0, 0.0, getContentWidth(), getContentHeight()); if(!aAllowedContentRange.isInside(aRealContentRange)) @@ -62,7 +62,7 @@ namespace drawinglayer new MaskPrimitive2D( basegfx::B2DPolyPolygon( basegfx::tools::createPolygonFromRect(aAllowedContentRange)), aContent)); - aContent = Primitive2DSequence(&xReferenceA, 1); + aContent = Primitive2DContainer { xReferenceA }; } // create a mapping from content to object. @@ -112,7 +112,7 @@ namespace drawinglayer // embed in necessary transformation to map from SdrPage to SdrPageObject const Primitive2DReference xReferenceB(new TransformPrimitive2D(aPageTrans, aContent)); - xRetval = Primitive2DSequence(&xReferenceB, 1); + xRetval = Primitive2DContainer { xReferenceB }; } } @@ -124,7 +124,7 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, double fContentWidth, double fContentHeight, - const Primitive2DSequence& rPageContent, + const Primitive2DContainer& rPageContent, bool bKeepAspectRatio) : BufferedDecompositionPrimitive2D(), mxDrawPage(rxDrawPage), diff --git a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx index 19140d977308..e2f1bcbb4420 100644 --- a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx @@ -36,11 +36,11 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PatternFillPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer PatternFillPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; - if(getChildren().hasElements()) + if(!getChildren().empty()) { if(!getReferenceRange().isEmpty() && getReferenceRange().getWidth() > 0.0 && getReferenceRange().getHeight() > 0.0) { @@ -56,8 +56,8 @@ namespace drawinglayer // check if content needs to be clipped const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); - const basegfx::B2DRange aContentRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); - Primitive2DSequence aContent(getChildren()); + const basegfx::B2DRange aContentRange(getChildren().getB2DRange(rViewInformation)); + Primitive2DContainer aContent(getChildren()); if(!aUnitRange.isInside(aContentRange)) { @@ -66,11 +66,11 @@ namespace drawinglayer basegfx::B2DPolyPolygon(basegfx::tools::createPolygonFromRect(aUnitRange)), aContent)); - aContent = Primitive2DSequence(&xRef, 1); + aContent = Primitive2DContainer { xRef }; } // resize result - aRetval.realloc(aMatrices.size()); + aRetval.resize(aMatrices.size()); // create one primitive for each matrix for(size_t a(0); a < aMatrices.size(); a++) @@ -92,7 +92,7 @@ namespace drawinglayer aMaskTransform, aRetval)); - aRetval = Primitive2DSequence(&xRef, 1); + aRetval = Primitive2DContainer { xRef }; } // embed result in mask @@ -102,7 +102,7 @@ namespace drawinglayer getMask(), aRetval)); - aRetval = Primitive2DSequence(&xRef, 1); + aRetval = Primitive2DContainer { xRef }; } } @@ -114,7 +114,7 @@ namespace drawinglayer PatternFillPrimitive2D::PatternFillPrimitive2D( const basegfx::B2DPolyPolygon& rMask, - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, const basegfx::B2DRange& rReferenceRange) : BufferedDecompositionPrimitive2D(), maMask(rMask), diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index dfc4aa4a8f52..d69efacea6b9 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -92,7 +92,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer PolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // calculate logic DashLength const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(getDiscreteDashLength(), 0.0)); @@ -110,7 +110,7 @@ namespace drawinglayer basegfx::tools::applyLineDashing(getB2DPolygon(), aDash, &aDashedPolyPolyA, &aDashedPolyPolyB, 2.0 * fLogicDashLength); // prepare return value - Primitive2DSequence aRetval(2); + Primitive2DContainer aRetval(2); aRetval[0] = Primitive2DReference(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyA, getRGBColorA())); aRetval[1] = Primitive2DReference(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyB, getRGBColorB())); @@ -120,7 +120,7 @@ namespace drawinglayer else { const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(getB2DPolygon(), getRGBColorA())); - return Primitive2DSequence(&xRef, 1L); + return Primitive2DContainer { xRef }; } } @@ -175,12 +175,12 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence PolygonMarkerPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer PolygonMarkerPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); bool bNeedNewDecomposition(false); - if(getBuffered2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().empty()) { if(rViewInformation.getInverseObjectToViewTransformation() != maLastInverseObjectToViewTransformation) { @@ -191,10 +191,10 @@ namespace drawinglayer if(bNeedNewDecomposition) { // conditions of last local decomposition have changed, delete - const_cast< PolygonMarkerPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< PolygonMarkerPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember last used InverseObjectToViewTransformation PolygonMarkerPrimitive2D* pThat = const_cast< PolygonMarkerPrimitive2D* >(this); @@ -223,7 +223,7 @@ namespace drawinglayer namespace primitive2d { - Primitive2DSequence PolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(getB2DPolygon().count()) { @@ -265,7 +265,7 @@ namespace drawinglayer } // prepare return value - Primitive2DSequence aRetval(aAreaPolyPolygon.count()); + Primitive2DContainer aRetval(aAreaPolyPolygon.count()); // create primitive for(sal_uInt32 b(0L); b < aAreaPolyPolygon.count(); b++) @@ -292,12 +292,12 @@ namespace drawinglayer aHairLinePolyPolygon, getLineAttribute().getColor())); - return Primitive2DSequence(&xRef, 1); + return Primitive2DContainer { xRef }; } } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -408,9 +408,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolygonWavePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolygonWavePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; if(getB2DPolygon().count()) { @@ -422,13 +422,13 @@ namespace drawinglayer // create waveline curve const basegfx::B2DPolygon aWaveline(basegfx::tools::createWaveline(getB2DPolygon(), getWaveWidth(), getWaveHeight())); const Primitive2DReference xRef(new PolygonStrokePrimitive2D(aWaveline, getLineAttribute(), getStrokeAttribute())); - aRetval = Primitive2DSequence(&xRef, 1); + aRetval = Primitive2DContainer { xRef }; } else { // flat waveline, decompose to simple line primitive const Primitive2DReference xRef(new PolygonStrokePrimitive2D(getB2DPolygon(), getLineAttribute(), getStrokeAttribute())); - aRetval = Primitive2DSequence(&xRef, 1); + aRetval = Primitive2DContainer { xRef }; } } @@ -521,7 +521,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // copy local polygon, it may be changed basegfx::B2DPolygon aLocalPolygon(getB2DPolygon()); @@ -569,7 +569,7 @@ namespace drawinglayer } // prepare return value - Primitive2DSequence aRetval(1L + (aArrowA.count() ? 1L : 0L) + (aArrowB.count() ? 1L : 0L)); + Primitive2DContainer aRetval(1L + (aArrowA.count() ? 1L : 0L) + (aArrowB.count() ? 1L : 0L)); sal_uInt32 nInd(0L); // add shaft diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index ec18be6997b0..adaf4ddec411 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -42,14 +42,14 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DSequence aRetval(nCount); + Primitive2DContainer aRetval(nCount); for(sal_uInt32 a(0L); a < nCount; a++) { @@ -60,7 +60,7 @@ namespace drawinglayer } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -102,14 +102,14 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DSequence aRetval(nCount); + Primitive2DContainer aRetval(nCount); for(sal_uInt32 a(0L); a < nCount; a++) { @@ -125,7 +125,7 @@ namespace drawinglayer } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -175,14 +175,14 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); const sal_uInt32 nCount(aPolyPolygon.count()); if(nCount) { - Primitive2DSequence aRetval(nCount); + Primitive2DContainer aRetval(nCount); for(sal_uInt32 a(0L); a < nCount; a++) { @@ -195,7 +195,7 @@ namespace drawinglayer } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -300,7 +300,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillGradient().isDefault()) { @@ -311,17 +311,17 @@ namespace drawinglayer getDefinitionRange(), getFillGradient()); const Primitive2DReference xSubRef(pNewGradient); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); + const Primitive2DContainer aSubSequence { xSubRef }; // create mask primitive MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1); + return Primitive2DContainer { xRef }; } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -372,7 +372,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillHatch().isDefault()) { @@ -384,17 +384,17 @@ namespace drawinglayer getBackgroundColor(), getFillHatch()); const Primitive2DReference xSubRef(pNewHatch); - const Primitive2DSequence aSubSequence(&xSubRef, 1L); + const Primitive2DContainer aSubSequence { xSubRef }; // create mask primitive MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); const Primitive2DReference xRef(pNewMask); - return Primitive2DSequence(&xRef, 1); + return Primitive2DContainer { xRef }; } else { - return Primitive2DSequence(); + return Primitive2DContainer(); } } @@ -450,7 +450,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(!getFillGraphic().isDefault()) { @@ -521,14 +521,14 @@ namespace drawinglayer const Primitive2DReference xRef( new MaskPrimitive2D( getB2DPolyPolygon(), - Primitive2DSequence(&xSubRef, 1))); + Primitive2DContainer { xSubRef })); - return Primitive2DSequence(&xRef, 1); + return Primitive2DContainer { xRef }; } } } - return Primitive2DSequence(); + return Primitive2DContainer(); } PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D( @@ -578,9 +578,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; if(getTransparence() < 1.0 && getB2DPolyPolygon().count()) { @@ -592,7 +592,7 @@ namespace drawinglayer getB2DPolyPolygon(), getColor())); - aRetval = Primitive2DSequence(&aFill, 1); + aRetval = Primitive2DContainer { aFill }; } if(getDiscreteGrow() > 0.0) @@ -605,18 +605,18 @@ namespace drawinglayer getB2DPolyPolygon(), aLineAttribute)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFatLine); + aRetval.push_back(aFatLine); } // embed filled to transparency (if used) - if(aRetval.getLength() && getTransparence() > 0.0) + if(!aRetval.empty() && getTransparence() > 0.0) { const Primitive2DReference aTrans( new UnifiedTransparencePrimitive2D( aRetval, getTransparence())); - aRetval = Primitive2DSequence(&aTrans, 1); + aRetval = Primitive2DContainer { aTrans }; } } diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx b/drawinglayer/source/primitive2d/primitivetools2d.cxx index 228b63a2d7bd..9b44f4edb231 100644 --- a/drawinglayer/source/primitive2d/primitivetools2d.cxx +++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx @@ -27,7 +27,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence DiscreteMetricDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer DiscreteMetricDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -35,13 +35,13 @@ namespace drawinglayer const basegfx::B2DVector aDiscreteVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0)); const double fDiscreteUnit(std::min(fabs(aDiscreteVector.getX()), fabs(aDiscreteVector.getY()))); - if(getBuffered2DDecomposition().hasElements() && !basegfx::fTools::equal(fDiscreteUnit, getDiscreteUnit())) + if(!getBuffered2DDecomposition().empty() && !basegfx::fTools::equal(fDiscreteUnit, getDiscreteUnit())) { // conditions of last local decomposition have changed, delete - const_cast< DiscreteMetricDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< DiscreteMetricDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember new valid DiscreteUnit const_cast< DiscreteMetricDependentPrimitive2D* >(this)->updateDiscreteUnit(fDiscreteUnit); @@ -59,20 +59,20 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence ViewportDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer ViewportDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); // get the current Viewport const basegfx::B2DRange& rViewport = rViewInformation.getViewport(); - if(getBuffered2DDecomposition().hasElements() && !rViewport.equal(getViewport())) + if(!getBuffered2DDecomposition().empty() && !rViewport.equal(getViewport())) { // conditions of last local decomposition have changed, delete - const_cast< ViewportDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< ViewportDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember new valid DiscreteUnit const_cast< ViewportDependentPrimitive2D* >(this)->maViewport = rViewport; @@ -90,20 +90,20 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence ViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer ViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); // get the current ViewTransformation const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation(); - if(getBuffered2DDecomposition().hasElements() && rViewTransformation != getViewTransformation()) + if(!getBuffered2DDecomposition().empty() && rViewTransformation != getViewTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< ViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< ViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember new valid ViewTransformation const_cast< ViewTransformationDependentPrimitive2D* >(this)->maViewTransformation = rViewTransformation; @@ -121,29 +121,29 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence ObjectAndViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer ObjectAndViewTransformationDependentPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); // get the current ViewTransfromation const basegfx::B2DHomMatrix& rViewTransformation = rViewInformation.getViewTransformation(); - if(getBuffered2DDecomposition().hasElements() && rViewTransformation != getViewTransformation()) + if(!getBuffered2DDecomposition().empty() && rViewTransformation != getViewTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } // get the current ObjectTransformation const basegfx::B2DHomMatrix& rObjectTransformation = rViewInformation.getObjectTransformation(); - if(getBuffered2DDecomposition().hasElements() && rObjectTransformation != getObjectTransformation()) + if(!getBuffered2DDecomposition().empty() && rObjectTransformation != getObjectTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember new valid ViewTransformation, and ObjectTransformation const_cast< ObjectAndViewTransformationDependentPrimitive2D* >(this)->maViewTransformation = rViewTransformation; diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index f3042c034f85..5aaf906826ac 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -78,7 +78,7 @@ namespace drawinglayer } // return if there are shadow primitives - return maShadowPrimitives.hasElements(); + return !maShadowPrimitives.empty(); } void ScenePrimitive2D::calculateDiscreteSizes( @@ -128,17 +128,16 @@ namespace drawinglayer } } - Primitive2DSequence ScenePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer ScenePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; // create 2D shadows from contained 3D primitives. This creates the shadow primitives on demand and tells if // there are some or not. Do this at start, the shadow might still be visible even when the scene is not if(impGetShadow3D(rViewInformation)) { // test visibility - const basegfx::B2DRange aShadow2DRange( - getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); + const basegfx::B2DRange aShadow2DRange(maShadowPrimitives.getB2DRange(rViewInformation)); const basegfx::B2DRange aViewRange( rViewInformation.getViewport()); @@ -298,7 +297,7 @@ namespace drawinglayer // create bitmap primitive and add const Primitive2DReference xRef(new BitmapPrimitive2D(maOldRenderedBitmap, aNew2DTransform)); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef); + aRetval.push_back(xRef); // test: Allow to add an outline in the debugger when tests are needed static bool bAddOutlineToCreated3DSceneRepresentation(false); @@ -308,7 +307,7 @@ namespace drawinglayer basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon()); aOutline.transform(aNew2DTransform); const Primitive2DReference xRef2(new PolygonHairlinePrimitive2D(aOutline, basegfx::BColor(1.0, 0.0, 0.0))); - appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, xRef2); + aRetval.push_back(xRef2); } } } @@ -316,9 +315,9 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence ScenePrimitive2D::getGeometry2D() const + Primitive2DContainer ScenePrimitive2D::getGeometry2D() const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; // create 2D projected geometry from 3D geometry if(getChildren3D().hasElements()) @@ -338,9 +337,9 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence ScenePrimitive2D::getShadow2D(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer ScenePrimitive2D::getShadow2D(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; // create 2D shadows from contained 3D primitives if(impGetShadow3D(rViewInformation)) @@ -446,7 +445,7 @@ namespace drawinglayer // expand by evtl. existing shadow primitives if(impGetShadow3D(rViewInformation)) { - const basegfx::B2DRange aShadow2DRange(getB2DRangeFromPrimitive2DSequence(maShadowPrimitives, rViewInformation)); + const basegfx::B2DRange aShadow2DRange(maShadowPrimitives.getB2DRange(rViewInformation)); if(!aShadow2DRange.isEmpty()) { @@ -457,7 +456,7 @@ namespace drawinglayer return aRetval; } - Primitive2DSequence ScenePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer ScenePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); @@ -467,7 +466,7 @@ namespace drawinglayer bool bNeedNewDecomposition(false); bool bDiscreteSizesAreCalculated(false); - if(getBuffered2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().empty()) { basegfx::B2DRange aVisibleDiscreteRange; calculateDiscreteSizes(rViewInformation, aDiscreteRange, aVisibleDiscreteRange, aUnitVisibleRange); @@ -495,10 +494,10 @@ namespace drawinglayer if(bNeedNewDecomposition) { // conditions of last local decomposition have changed, delete - const_cast< ScenePrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< ScenePrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { if(!bDiscreteSizesAreCalculated) { diff --git a/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx b/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx index 11025b456822..c285ec1b414a 100644 --- a/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx +++ b/drawinglayer/source/primitive2d/sdrdecompositiontools2d.cxx @@ -102,7 +102,7 @@ namespace drawinglayer // create HiddenGeometryPrimitive2D return Primitive2DReference( - new HiddenGeometryPrimitive2D(Primitive2DSequence(&xReference, 1))); + new HiddenGeometryPrimitive2D(Primitive2DContainer { xReference })); } } // end of namespace primitive2d } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx index abdce86fcbcb..3467d95b295c 100644 --- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx @@ -39,7 +39,7 @@ namespace drawinglayer ShadowPrimitive2D::ShadowPrimitive2D( const basegfx::B2DHomMatrix& rShadowTransform, const basegfx::BColor& rShadowColor, - const Primitive2DSequence& rChildren) + const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren), maShadowTransform(rShadowTransform), maShadowColor(rShadowColor) @@ -61,16 +61,16 @@ namespace drawinglayer basegfx::B2DRange ShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { - basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); + basegfx::B2DRange aRetval(getChildren().getB2DRange(rViewInformation)); aRetval.transform(getShadowTransform()); return aRetval; } - Primitive2DSequence ShadowPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer ShadowPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; - if(getChildren().hasElements()) + if(!getChildren().empty()) { // create a modifiedColorPrimitive containing the shadow color and the content const basegfx::BColorModifierSharedPtr aBColorModifier( @@ -80,11 +80,11 @@ namespace drawinglayer new ModifiedColorPrimitive2D( getChildren(), aBColorModifier)); - const Primitive2DSequence aSequenceB(&xRefA, 1L); + const Primitive2DContainer aSequenceB { xRefA }; // build transformed primitiveVector with shadow offset and add to target const Primitive2DReference xRefB(new TransformPrimitive2D(getShadowTransform(), aSequenceB)); - aRetval = Primitive2DSequence(&xRefB, 1L); + aRetval = Primitive2DContainer { xRefB }; } return aRetval; diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx index d26ac9b95e6d..5d659ec6547a 100644 --- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx @@ -32,7 +32,7 @@ namespace drawinglayer { StructureTagPrimitive2D::StructureTagPrimitive2D( const vcl::PDFWriter::StructElement& rStructureElement, - const Primitive2DSequence& rChildren) + const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren), maStructureElement(rStructureElement) { diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx index 4bc3994f5ec5..17a134d47939 100644 --- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx @@ -65,11 +65,11 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SvgGradientHelper::createSingleGradientEntryFill() const + Primitive2DContainer SvgGradientHelper::createSingleGradientEntryFill() const { const SvgGradientEntryVector& rEntries = getGradientEntries(); const sal_uInt32 nCount(rEntries.size()); - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; if(nCount) { @@ -85,7 +85,7 @@ namespace drawinglayer if(fOpacity < 1.0) { - const Primitive2DSequence aContent(&xRef, 1); + const Primitive2DContainer aContent { xRef }; xRef = Primitive2DReference( new UnifiedTransparencePrimitive2D( @@ -93,7 +93,7 @@ namespace drawinglayer 1.0 - fOpacity)); } - xRetval = Primitive2DSequence(&xRef, 1); + xRetval = Primitive2DContainer { xRef }; } } else @@ -184,8 +184,8 @@ namespace drawinglayer } double SvgGradientHelper::createRun( - Primitive2DVector& rTargetColor, - Primitive2DVector& rTargetOpacity, + Primitive2DContainer& rTargetColor, + Primitive2DContainer& rTargetOpacity, double fPos, double fMax, const SvgGradientEntryVector& rEntries, @@ -238,21 +238,21 @@ namespace drawinglayer return fPos; } - Primitive2DSequence SvgGradientHelper::createResult( - const Primitive2DVector& rTargetColor, - const Primitive2DVector& rTargetOpacity, + Primitive2DContainer SvgGradientHelper::createResult( + const Primitive2DContainer& rTargetColor, + const Primitive2DContainer& rTargetOpacity, const basegfx::B2DHomMatrix& rUnitGradientToObject, bool bInvert) const { - Primitive2DSequence xRetval; - const Primitive2DSequence aTargetColorEntries(Primitive2DVectorToPrimitive2DSequence(rTargetColor, bInvert)); - const Primitive2DSequence aTargetOpacityEntries(Primitive2DVectorToPrimitive2DSequence(rTargetOpacity, bInvert)); + Primitive2DContainer xRetval; + const Primitive2DContainer aTargetColorEntries(rTargetColor.maybeInvert(bInvert)); + const Primitive2DContainer aTargetOpacityEntries(rTargetOpacity.maybeInvert(bInvert)); - if(aTargetColorEntries.hasElements()) + if(!aTargetColorEntries.empty()) { Primitive2DReference xRefContent; - if(aTargetOpacityEntries.hasElements()) + if(!aTargetOpacityEntries.empty()) { const Primitive2DReference xRefOpacity = new TransparencePrimitive2D( aTargetColorEntries, @@ -260,7 +260,7 @@ namespace drawinglayer xRefContent = new TransformPrimitive2D( rUnitGradientToObject, - Primitive2DSequence(&xRefOpacity, 1)); + Primitive2DContainer { xRefOpacity }); } else { @@ -271,9 +271,9 @@ namespace drawinglayer xRefContent = new MaskPrimitive2D( getPolyPolygon(), - Primitive2DSequence(&xRefContent, 1)); + Primitive2DContainer { xRefContent }); - xRetval = Primitive2DSequence(&xRefContent, 1); + xRetval = Primitive2DContainer { xRefContent }; } return xRetval; @@ -343,8 +343,8 @@ namespace drawinglayer } void SvgLinearGradientPrimitive2D::createAtom( - Primitive2DVector& rTargetColor, - Primitive2DVector& rTargetOpacity, + Primitive2DContainer& rTargetColor, + Primitive2DContainer& rTargetOpacity, const SvgGradientEntry& rFrom, const SvgGradientEntry& rTo, sal_Int32 nOffset) const @@ -376,9 +376,9 @@ namespace drawinglayer } } - Primitive2DSequence SvgLinearGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer SvgLinearGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; if(!getPreconditionsChecked()) { @@ -454,8 +454,8 @@ namespace drawinglayer const basegfx::B2DRange aUnitRange(aUnitPoly.getB2DRange()); // prepare result vectors - Primitive2DVector aTargetColor; - Primitive2DVector aTargetOpacity; + Primitive2DContainer aTargetColor; + Primitive2DContainer aTargetOpacity; if(basegfx::fTools::more(aUnitRange.getWidth(), 0.0)) { @@ -476,17 +476,17 @@ namespace drawinglayer // else the start and end pads are already created and fPos == aUnitRange.getMaxX(). // Its possible to express the repeated linear gradient by adding the // transformed central run. Create it this way - Primitive2DSequence aTargetColorEntries(Primitive2DVectorToPrimitive2DSequence(aTargetColor)); - Primitive2DSequence aTargetOpacityEntries(Primitive2DVectorToPrimitive2DSequence(aTargetOpacity)); + Primitive2DContainer aTargetColorEntries(aTargetColor.maybeInvert()); + Primitive2DContainer aTargetOpacityEntries(aTargetOpacity.maybeInvert()); aTargetColor.clear(); aTargetOpacity.clear(); - if(aTargetColorEntries.hasElements()) + if(!aTargetColorEntries.empty()) { // add original central run as group primitive aTargetColor.push_back(new GroupPrimitive2D(aTargetColorEntries)); - if(aTargetOpacityEntries.hasElements()) + if(!aTargetOpacityEntries.empty()) { aTargetOpacity.push_back(new GroupPrimitive2D(aTargetOpacityEntries)); } @@ -515,7 +515,7 @@ namespace drawinglayer aTargetColor.push_back(new TransformPrimitive2D(aTransform, aTargetColorEntries)); - if(aTargetOpacityEntries.hasElements()) + if(!aTargetOpacityEntries.empty()) { aTargetOpacity.push_back(new TransformPrimitive2D(aTransform, aTargetOpacityEntries)); } @@ -542,7 +542,7 @@ namespace drawinglayer aTargetColor.push_back(new TransformPrimitive2D(aTransform, aTargetColorEntries)); - if(aTargetOpacityEntries.hasElements()) + if(!aTargetOpacityEntries.empty()) { aTargetOpacity.push_back(new TransformPrimitive2D(aTransform, aTargetOpacityEntries)); } @@ -627,8 +627,8 @@ namespace drawinglayer } void SvgRadialGradientPrimitive2D::createAtom( - Primitive2DVector& rTargetColor, - Primitive2DVector& rTargetOpacity, + Primitive2DContainer& rTargetColor, + Primitive2DContainer& rTargetOpacity, const SvgGradientEntry& rFrom, const SvgGradientEntry& rTo, sal_Int32 nOffset) const @@ -720,9 +720,9 @@ namespace drawinglayer } } - Primitive2DSequence SvgRadialGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer SvgRadialGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; if(!getPreconditionsChecked()) { @@ -800,8 +800,8 @@ namespace drawinglayer fMax = std::max(fMax, basegfx::B2DVector(aUnitRange.getMaxX(), aUnitRange.getMinY()).getLength()); // prepare result vectors - Primitive2DVector aTargetColor; - Primitive2DVector aTargetOpacity; + Primitive2DContainer aTargetColor; + Primitive2DContainer aTargetOpacity; if(0.0 < fMax) { @@ -924,9 +924,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SvgLinearAtomPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer SvgLinearAtomPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; const double fDelta(getOffsetB() - getOffsetA()); if(!basegfx::fTools::equalZero(fDelta)) @@ -951,7 +951,7 @@ namespace drawinglayer const double fUnitStep(1.0 / nSteps); // prepare result set (known size) - xRetval.realloc(nSteps); + xRetval.resize(nSteps); for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep) { @@ -1011,9 +1011,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence SvgRadialAtomPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer SvgRadialAtomPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; const double fDeltaScale(getScaleB() - getScaleA()); if(!basegfx::fTools::equalZero(fDeltaScale)) @@ -1029,7 +1029,7 @@ namespace drawinglayer const double fUnitStep(1.0 / nSteps); // prepare result set (known size) - xRetval.realloc(nSteps); + xRetval.resize(nSteps); for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep) { diff --git a/drawinglayer/source/primitive2d/textbreakuphelper.cxx b/drawinglayer/source/primitive2d/textbreakuphelper.cxx index b3dfbeee09d5..fb2bc5b3e157 100644 --- a/drawinglayer/source/primitive2d/textbreakuphelper.cxx +++ b/drawinglayer/source/primitive2d/textbreakuphelper.cxx @@ -57,7 +57,7 @@ namespace drawinglayer { } - void TextBreakupHelper::breakupPortion(Primitive2DVector& rTempResult, sal_Int32 nIndex, sal_Int32 nLength, bool bWordLineMode) + void TextBreakupHelper::breakupPortion(Primitive2DContainer& rTempResult, sal_Int32 nIndex, sal_Int32 nLength, bool bWordLineMode) { if(nLength && !(nIndex == mrSource.getTextPosition() && nLength == mrSource.getTextLength())) { @@ -189,7 +189,7 @@ namespace drawinglayer { if(mrSource.getTextLength()) { - Primitive2DVector aTempResult; + Primitive2DContainer aTempResult; static css::uno::Reference< css::i18n::XBreakIterator > xBreakIterator; if(!xBreakIterator.is()) @@ -281,13 +281,13 @@ namespace drawinglayer } } - mxResult = Primitive2DVectorToPrimitive2DSequence(aTempResult); + mxResult = aTempResult; } } - const Primitive2DSequence& TextBreakupHelper::getResult(BreakupUnit aBreakupUnit) const + const Primitive2DContainer& TextBreakupHelper::getResult(BreakupUnit aBreakupUnit) const { - if(!mxResult.hasElements()) + if(mxResult.empty()) { const_cast< TextBreakupHelper* >(this)->breakup(aBreakupUnit); } diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index 93e9ba1f0450..c414640a34c8 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -155,16 +155,16 @@ namespace drawinglayer // TODO: Handle Font Emphasis Above/Below } - Primitive2DSequence TextDecoratedPortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer TextDecoratedPortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { if(getWordLineMode()) { // support for single word mode; split to single word primitives // using TextBreakupHelper const TextBreakupHelper aTextBreakupHelper(*this); - const Primitive2DSequence aBroken(aTextBreakupHelper.getResult(BreakupUnit_word)); + const Primitive2DContainer aBroken(aTextBreakupHelper.getResult(BreakupUnit_word)); - if(aBroken.hasElements()) + if(!aBroken.empty()) { // was indeed split to several words, use as result return aBroken; @@ -177,7 +177,7 @@ namespace drawinglayer } std::vector< Primitive2DReference > aNewPrimitives; basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose aDecTrans(getTextTransform()); - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; // create basic geometry such as SimpleTextPrimitive, Overline, Underline, // Strikeout, etc... @@ -189,7 +189,7 @@ namespace drawinglayer getFontAttribute().getSymbol(), getFontAttribute().getVertical(), getFontAttribute().getItalic(), - getFontAttribute().getMonospaced(), + getFontAttribute().getMonospaced(), false, // no outline anymore, handled locally getFontAttribute().getRTL(), getFontAttribute().getBiDiStrong()); @@ -202,7 +202,7 @@ namespace drawinglayer if(nMemberCount) { - aRetval.realloc(nMemberCount); + aRetval.resize(nMemberCount); for(sal_uInt32 a(0); a < nMemberCount; a++) { @@ -211,7 +211,7 @@ namespace drawinglayer } // Handle Shadow, Outline and TextRelief - if(aRetval.hasElements()) + if(!aRetval.empty()) { // outline AND shadow depend on NO TextRelief (see dialog) const bool bHasTextRelief(TEXT_RELIEF_NONE != getTextRelief()); @@ -279,7 +279,7 @@ namespace drawinglayer aDecTrans.getTranslate(), aDecTrans.getRotate(), aTextEffectStyle2D)); - aRetval = Primitive2DSequence(&aNewTextEffect, 1); + aRetval = Primitive2DContainer { aNewTextEffect }; } else if(bHasOutline) { @@ -290,16 +290,16 @@ namespace drawinglayer aDecTrans.getTranslate(), aDecTrans.getRotate(), TEXTEFFECTSTYLE2D_OUTLINE)); - aRetval = Primitive2DSequence(&aNewTextEffect, 1); + aRetval = Primitive2DContainer { aNewTextEffect }; } if(aShadow.is()) { // put shadow in front if there is one to paint timely before // but placed behind content - const Primitive2DSequence aContent(aRetval); - aRetval = Primitive2DSequence(&aShadow, 1); - appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aContent); + const Primitive2DContainer aContent(aRetval); + aRetval = Primitive2DContainer { aShadow }; + aRetval.append(aContent); } } } diff --git a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx index f55d1dbaacba..64cfc35bc2e8 100644 --- a/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texteffectprimitive2d.cxx @@ -32,9 +32,9 @@ namespace drawinglayer { static double fDiscreteSize(1.1); - Primitive2DSequence TextEffectPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer TextEffectPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; // get the distance of one discrete units from target display. Use between 1.0 and sqrt(2) to // have good results on rotated objects, too @@ -66,7 +66,7 @@ namespace drawinglayer TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED_DEFAULT == getTextEffectStyle2D() || TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED_DEFAULT == getTextEffectStyle2D()); basegfx::B2DHomMatrix aTransform(aBackTransform); - aRetval.realloc(2); + aRetval.resize(2); if(bEmbossed) { @@ -95,7 +95,7 @@ namespace drawinglayer aRetval[0] = Primitive2DReference( new TransformPrimitive2D( aTransform, - Primitive2DSequence(&xModifiedColor, 1))); + Primitive2DContainer { xModifiedColor })); // add original, too const basegfx::BColorModifierSharedPtr aBColorModifierToWhite( @@ -121,7 +121,7 @@ namespace drawinglayer aRetval[0] = Primitive2DReference( new TransformPrimitive2D( aTransform, - Primitive2DSequence(&xModifiedColor, 1))); + Primitive2DContainer { xModifiedColor })); // add original, too aRetval[1] = Primitive2DReference(new GroupPrimitive2D(getTextContent())); @@ -133,7 +133,7 @@ namespace drawinglayer { // create transform primitives in all directions basegfx::B2DHomMatrix aTransform; - aRetval.realloc(9); + aRetval.resize(9); aTransform.set(0, 2, aDistance.getX()); aTransform.set(1, 2, 0.0); @@ -184,7 +184,7 @@ namespace drawinglayer } TextEffectPrimitive2D::TextEffectPrimitive2D( - const Primitive2DSequence& rTextContent, + const Primitive2DContainer& rTextContent, const basegfx::B2DPoint& rRotationCenter, double fDirection, TextEffectStyle2D eTextEffectStyle2D) @@ -218,26 +218,26 @@ namespace drawinglayer // then will ask 9 times at nearly the same content. This may even be refined here using the // TextEffectStyle information, e.g. for TEXTEFFECTSTYLE2D_RELIEF the grow needs only to // be in two directions - basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getTextContent(), rViewInformation)); + basegfx::B2DRange aRetval(getTextContent().getB2DRange(rViewInformation)); aRetval.grow(fDiscreteSize); return aRetval; } - Primitive2DSequence TextEffectPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer TextEffectPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { ::osl::MutexGuard aGuard( m_aMutex ); - if(getBuffered2DDecomposition().hasElements()) + if(!getBuffered2DDecomposition().empty()) { if(maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation()) { // conditions of last local decomposition have changed, delete - const_cast< TextEffectPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DSequence()); + const_cast< TextEffectPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer()); } } - if(!getBuffered2DDecomposition().hasElements()) + if(getBuffered2DDecomposition().empty()) { // remember ViewRange and ViewTransformation const_cast< TextEffectPrimitive2D* >(this)->maLastObjectToViewTransformation = rViewInformation.getObjectToViewTransformation(); diff --git a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx index f69d4766d014..71e0e03df636 100644 --- a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx @@ -30,7 +30,7 @@ namespace drawinglayer { namespace primitive2d { - TextHierarchyLinePrimitive2D::TextHierarchyLinePrimitive2D(const Primitive2DSequence& rChildren) + TextHierarchyLinePrimitive2D::TextHierarchyLinePrimitive2D(const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren) { } @@ -47,7 +47,7 @@ namespace drawinglayer { namespace primitive2d { - TextHierarchyParagraphPrimitive2D::TextHierarchyParagraphPrimitive2D(const Primitive2DSequence& rChildren) + TextHierarchyParagraphPrimitive2D::TextHierarchyParagraphPrimitive2D(const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren) { } @@ -64,7 +64,7 @@ namespace drawinglayer { namespace primitive2d { - TextHierarchyBulletPrimitive2D::TextHierarchyBulletPrimitive2D(const Primitive2DSequence& rChildren) + TextHierarchyBulletPrimitive2D::TextHierarchyBulletPrimitive2D(const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren) { } @@ -81,7 +81,7 @@ namespace drawinglayer { namespace primitive2d { - TextHierarchyBlockPrimitive2D::TextHierarchyBlockPrimitive2D(const Primitive2DSequence& rChildren) + TextHierarchyBlockPrimitive2D::TextHierarchyBlockPrimitive2D(const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren) { } @@ -99,7 +99,7 @@ namespace drawinglayer namespace primitive2d { TextHierarchyFieldPrimitive2D::TextHierarchyFieldPrimitive2D( - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, const FieldType& rFieldType, const OUString& rString) : GroupPrimitive2D(rChildren), @@ -132,7 +132,7 @@ namespace drawinglayer { namespace primitive2d { - TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(const Primitive2DSequence& rChildren) + TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren) { } diff --git a/drawinglayer/source/primitive2d/textlineprimitive2d.cxx b/drawinglayer/source/primitive2d/textlineprimitive2d.cxx index e5d58548766b..1c3c25f55dd2 100644 --- a/drawinglayer/source/primitive2d/textlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textlineprimitive2d.cxx @@ -31,9 +31,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence TextLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer TextLinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence xRetval; + Primitive2DContainer xRetval; if(TEXT_LINE_NONE != getTextLine()) { @@ -219,7 +219,7 @@ namespace drawinglayer } // add primitive - appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, aNewPrimitive); + xRetval.push_back(aNewPrimitive); if(bDoubleLine) { @@ -245,9 +245,8 @@ namespace drawinglayer aTransform.translate(aTranslate.getX(), aTranslate.getY()); // add transform primitive - const Primitive2DSequence aContent(&aNewPrimitive, 1); - appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, - Primitive2DReference(new TransformPrimitive2D(aTransform, aContent))); + const Primitive2DContainer aContent { aNewPrimitive }; + xRetval.push_back( Primitive2DReference(new TransformPrimitive2D(aTransform, aContent))); } } diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx b/drawinglayer/source/primitive2d/textprimitive2d.cxx index 43aaa2bc0758..b8adefb3baf9 100644 --- a/drawinglayer/source/primitive2d/textprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx @@ -167,9 +167,9 @@ namespace drawinglayer } } - Primitive2DSequence TextSimplePortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer TextSimplePortionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; if(getTextLength()) { @@ -185,7 +185,7 @@ namespace drawinglayer if(nCount) { // alloc space for the primitives - aRetval.realloc(nCount); + aRetval.resize(nCount); // color-filled polypolygons for(sal_uInt32 a(0L); a < nCount; a++) @@ -210,7 +210,7 @@ namespace drawinglayer fRotate, TEXTEFFECTSTYLE2D_OUTLINE)); - aRetval = Primitive2DSequence(&aNewTextEffect, 1); + aRetval = Primitive2DContainer { aNewTextEffect }; } } } diff --git a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx index b65c54cbc6bc..fc518d1ac9a1 100644 --- a/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx @@ -66,7 +66,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence TextCharacterStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer TextCharacterStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // strikeout with character const OUString aSingleCharString(getStrikeoutChar()); @@ -108,7 +108,7 @@ namespace drawinglayer getLocale(), getFontColor())); - return Primitive2DSequence(&xReference, 1); + return Primitive2DContainer { xReference }; } TextCharacterStrikeoutPrimitive2D::TextCharacterStrikeoutPrimitive2D( @@ -151,7 +151,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence TextGeometryStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer TextGeometryStrikeoutPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { OSL_ENSURE(TEXT_STRIKEOUT_SLASH != getTextStrikeout() && TEXT_STRIKEOUT_X != getTextStrikeout(), "Wrong TEXT_STRIKEOUT type; a TextCharacterStrikeoutPrimitive2D should be used (!)"); @@ -205,7 +205,7 @@ namespace drawinglayer // add primitive const attribute::LineAttribute aLineAttribute(getFontColor(), fStrikeoutHeight, basegfx::B2DLineJoin::NONE); - Primitive2DSequence xRetval(1); + Primitive2DContainer xRetval(1); xRetval[0] = Primitive2DReference(new PolygonStrokePrimitive2D(aStrikeoutLine, aLineAttribute)); if(bDoubleLine) @@ -227,7 +227,7 @@ namespace drawinglayer aTransform.translate(aTranslate.getX(), aTranslate.getY()); // add transform primitive - appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, + xRetval.push_back( Primitive2DReference( new TransformPrimitive2D( aTransform, diff --git a/drawinglayer/source/primitive2d/transformprimitive2d.cxx b/drawinglayer/source/primitive2d/transformprimitive2d.cxx index b70c0b6a4d67..b1d5cbf53a6b 100644 --- a/drawinglayer/source/primitive2d/transformprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/transformprimitive2d.cxx @@ -33,7 +33,7 @@ namespace drawinglayer { TransformPrimitive2D::TransformPrimitive2D( const basegfx::B2DHomMatrix& rTransformation, - const Primitive2DSequence& rChildren) + const Primitive2DContainer& rChildren) : GroupPrimitive2D(rChildren), maTransformation(rTransformation) { @@ -53,7 +53,7 @@ namespace drawinglayer basegfx::B2DRange TransformPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { - basegfx::B2DRange aRetval(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); + basegfx::B2DRange aRetval(getChildren().getB2DRange(rViewInformation)); aRetval.transform(getTransformation()); return aRetval; } diff --git a/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx index 193674d9ad8e..fe6ba1cb5521 100644 --- a/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/transparenceprimitive2d.cxx @@ -31,8 +31,8 @@ namespace drawinglayer namespace primitive2d { TransparencePrimitive2D::TransparencePrimitive2D( - const Primitive2DSequence& rChildren, - const Primitive2DSequence& rTransparence) + const Primitive2DContainer& rChildren, + const Primitive2DContainer& rTransparence) : GroupPrimitive2D(rChildren), maTransparence(rTransparence) { diff --git a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx index 111ecda61cd4..595d33670738 100644 --- a/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx @@ -37,7 +37,7 @@ namespace drawinglayer namespace primitive2d { UnifiedTransparencePrimitive2D::UnifiedTransparencePrimitive2D( - const Primitive2DSequence& rChildren, + const Primitive2DContainer& rChildren, double fTransparence) : GroupPrimitive2D(rChildren), mfTransparence(fTransparence) @@ -60,10 +60,10 @@ namespace drawinglayer { // do not use the fallback to decomposition here since for a correct BoundRect we also // need invisible (1.0 == getTransparence()) geometry; these would be deleted in the decomposition - return getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation); + return getChildren().getB2DRange( rViewInformation); } - Primitive2DSequence UnifiedTransparencePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DContainer UnifiedTransparencePrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const { if(0.0 == getTransparence()) { @@ -88,22 +88,22 @@ namespace drawinglayer // I will take the last one here. The small overhead of two primitives will only be // used when UnifiedTransparencePrimitive2D is not handled directly. - const basegfx::B2DRange aPolygonRange(getB2DRangeFromPrimitive2DSequence(getChildren(), rViewInformation)); + const basegfx::B2DRange aPolygonRange(getChildren().getB2DRange(rViewInformation)); const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aPolygonRange)); const basegfx::BColor aGray(getTransparence(), getTransparence(), getTransparence()); - Primitive2DSequence aTransparenceContent(2); + Primitive2DContainer aTransparenceContent(2); aTransparenceContent[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), aGray)); aTransparenceContent[1] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolygon, aGray)); // create sub-transparence group with a gray-colored rectangular fill polygon const Primitive2DReference xRefB(new TransparencePrimitive2D(getChildren(), aTransparenceContent)); - return Primitive2DSequence(&xRefB, 1L); + return Primitive2DContainer { xRefB }; } else { // completely transparent or invalid definition, add nothing - return Primitive2DSequence(); + return Primitive2DContainer(); } } diff --git a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx index 4f631c9788f1..2c4e9b14103a 100644 --- a/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx @@ -33,9 +33,9 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence WallpaperBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer WallpaperBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { - Primitive2DSequence aRetval; + Primitive2DContainer aRetval; if(!getLocalObjectRange().isEmpty() && !getBitmapEx().IsEmpty()) { @@ -59,7 +59,7 @@ namespace drawinglayer getBitmapEx(), aObjectTransform)); - aRetval = Primitive2DSequence(&xReference, 1); + aRetval = Primitive2DContainer { xReference }; } else { @@ -157,7 +157,7 @@ namespace drawinglayer new BitmapPrimitive2D( getBitmapEx(), aObjectTransform)); - aRetval = Primitive2DSequence(&xReference, 1); + aRetval = Primitive2DContainer { xReference }; // clip when not completely inside object range bNeedsClipping = !getLocalObjectRange().isInside(aTargetRange); @@ -194,7 +194,7 @@ namespace drawinglayer new drawinglayer::primitive2d::FillGraphicPrimitive2D( aObjectTransform, aFillGraphicAttribute)); - aRetval = Primitive2DSequence(&xFillBitmap, 1); + aRetval = Primitive2DContainer { xFillBitmap }; // always embed tiled fill to clipping bNeedsClipping = true; @@ -209,7 +209,7 @@ namespace drawinglayer new drawinglayer::primitive2d::MaskPrimitive2D( aPolyPolygon, aRetval)); - aRetval = Primitive2DSequence(&xClippedFill, 1); + aRetval = Primitive2DContainer { xClippedFill }; } } } diff --git a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx index e488422a653e..cfc9478b4660 100644 --- a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx @@ -29,7 +29,7 @@ namespace drawinglayer { namespace primitive2d { - Primitive2DSequence WrongSpellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + Primitive2DContainer WrongSpellPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { // ATM this decompose is view-independent, what the original VCL-Display is not. To mimic // the old behaviour here if wanted it is necessary to add get2DDecomposition and implement @@ -68,7 +68,7 @@ namespace drawinglayer // create the waveline primitive Primitive2DReference xPrimitive(new PolygonWavePrimitive2D(aPolygon, aLineAttribute, fWaveWidth, 0.5 * fWaveWidth)); - Primitive2DSequence xRetval(&xPrimitive, 1); + Primitive2DContainer xRetval { xPrimitive }; return xRetval; } diff --git a/drawinglayer/source/processor2d/baseprocessor2d.cxx b/drawinglayer/source/processor2d/baseprocessor2d.cxx index d5d4ea492bcc..49b2d551b2f3 100644 --- a/drawinglayer/source/processor2d/baseprocessor2d.cxx +++ b/drawinglayer/source/processor2d/baseprocessor2d.cxx @@ -18,6 +18,7 @@ */ #include <drawinglayer/processor2d/baseprocessor2d.hxx> +#include <comphelper/sequence.hxx> @@ -42,11 +43,11 @@ namespace drawinglayer { } - void BaseProcessor2D::process(const primitive2d::Primitive2DSequence& rSource) + void BaseProcessor2D::process(const primitive2d::Primitive2DContainer& rSource) { - if(rSource.hasElements()) + if(!rSource.empty()) { - const sal_Int32 nCount(rSource.getLength()); + const sal_Int32 nCount(rSource.size()); for(sal_Int32 a(0L); a < nCount; a++) { @@ -67,7 +68,7 @@ namespace drawinglayer { // unknown implementation, use UNO API call instead and process recursively const uno::Sequence< beans::PropertyValue >& rViewParameters(getViewInformation2D().getViewInformationSequence()); - process(xReference->getDecomposition(rViewParameters)); + process(comphelper::sequenceToContainer<primitive2d::Primitive2DContainer>(xReference->getDecomposition(rViewParameters))); } } } diff --git a/drawinglayer/source/processor2d/contourextractor2d.cxx b/drawinglayer/source/processor2d/contourextractor2d.cxx index 62896bb13331..8ea370b3162e 100644 --- a/drawinglayer/source/processor2d/contourextractor2d.cxx +++ b/drawinglayer/source/processor2d/contourextractor2d.cxx @@ -149,17 +149,17 @@ namespace drawinglayer { // 2D Scene primitive containing 3D stuff; extract 2D contour in world coordinates const primitive2d::ScenePrimitive2D& rScenePrimitive2DCandidate(static_cast< const primitive2d::ScenePrimitive2D& >(rCandidate)); - const primitive2d::Primitive2DSequence xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D()); - const primitive2d::Primitive2DSequence xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D())); + const primitive2d::Primitive2DContainer xExtracted2DSceneGeometry(rScenePrimitive2DCandidate.getGeometry2D()); + const primitive2d::Primitive2DContainer xExtracted2DSceneShadow(rScenePrimitive2DCandidate.getShadow2D(getViewInformation2D())); // process content - if(xExtracted2DSceneGeometry.hasElements()) + if(!xExtracted2DSceneGeometry.empty()) { process(xExtracted2DSceneGeometry); } // process content - if(xExtracted2DSceneShadow.hasElements()) + if(!xExtracted2DSceneShadow.empty()) { process(xExtracted2DSceneShadow); } diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index 4e59773a9cb0..cda04f3df7a8 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -506,9 +506,9 @@ namespace drawinglayer // so force this primitive to process its children directly if the switch is set // (which is the default). Else, ignore invisible content const primitive2d::HiddenGeometryPrimitive2D& rHiddenGeometry(static_cast< const primitive2d::HiddenGeometryPrimitive2D& >(rCandidate)); - const primitive2d::Primitive2DSequence& rChildren = rHiddenGeometry.getChildren(); + const primitive2d::Primitive2DContainer& rChildren = rHiddenGeometry.getChildren(); - if(rChildren.hasElements()) + if(!rChildren.empty()) { if(getUseInvisiblePrimitiveContent()) { diff --git a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx index 1805d23a05c0..14e2df882867 100644 --- a/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx +++ b/drawinglayer/source/processor2d/textaspolygonextractor2d.cxx @@ -161,7 +161,7 @@ namespace drawinglayer { const primitive2d::ModifiedColorPrimitive2D& rModifiedColorCandidate(static_cast< const primitive2d::ModifiedColorPrimitive2D& >(rCandidate)); - if(rModifiedColorCandidate.getChildren().hasElements()) + if(!rModifiedColorCandidate.getChildren().empty()) { maBColorModifierStack.push(rModifiedColorCandidate.getColorModifier()); process(rModifiedColorCandidate.getChildren()); diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 86591ac593c8..f5d97280305f 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -237,13 +237,13 @@ namespace drawinglayer namespace processor2d { Rectangle VclMetafileProcessor2D::impDumpToMetaFile( - const primitive2d::Primitive2DSequence& rContent, + const primitive2d::Primitive2DContainer& rContent, GDIMetaFile& o_rContentMetafile) { // Prepare VDev, MetaFile and connections OutputDevice* pLastOutputDevice = mpOutputDevice; GDIMetaFile* pLastMetafile = mpMetaFile; - basegfx::B2DRange aPrimitiveRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D())); + basegfx::B2DRange aPrimitiveRange(rContent.getB2DRange(getViewInformation2D())); // transform primitive range with current transformation (e.g shadow offset) aPrimitiveRange.transform(maCurrentTransformation); @@ -1006,7 +1006,7 @@ namespace drawinglayer } // process recursively - const primitive2d::Primitive2DSequence rContent = rFieldPrimitive.get2DDecomposition(getViewInformation2D()); + const primitive2d::Primitive2DContainer rContent = rFieldPrimitive.get2DDecomposition(getViewInformation2D()); process(rContent); // for the end comment the type is not relevant yet, they are all the same. Just add. @@ -1015,7 +1015,7 @@ namespace drawinglayer if(mpPDFExtOutDevData && drawinglayer::primitive2d::FIELD_TYPE_URL == rFieldPrimitive.getType()) { // emulate data handling from ImpEditEngine::Paint - const basegfx::B2DRange aViewRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D())); + const basegfx::B2DRange aViewRange(rContent.getB2DRange(getViewInformation2D())); const Rectangle aRectLogic( (sal_Int32)floor(aViewRange.getMinX()), (sal_Int32)floor(aViewRange.getMinY()), (sal_Int32)ceil(aViewRange.getMaxX()), (sal_Int32)ceil(aViewRange.getMaxY())); @@ -1476,7 +1476,7 @@ namespace drawinglayer aLocalPolyPolygon, rHatchCandidate.getBackgroundColor())); - process(primitive2d::Primitive2DSequence(&xBackground, 1)); + process(primitive2d::Primitive2DContainer { xBackground }); } SvtGraphicFill* pSvtGraphicFill = nullptr; @@ -1752,7 +1752,7 @@ namespace drawinglayer // mask group. Special handling for MetaFiles. const primitive2d::MaskPrimitive2D& rMaskCandidate = static_cast< const primitive2d::MaskPrimitive2D& >(rCandidate); - if(rMaskCandidate.getChildren().hasElements()) + if(!rMaskCandidate.getChildren().empty()) { basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask()); @@ -1820,9 +1820,9 @@ namespace drawinglayer // - uses DrawTransparent for single PolyPoylgons directly. Can be detected by // checking the content for single PolyPolygonColorPrimitive2D const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate = static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rUniTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DContainer rContent = rUniTransparenceCandidate.getChildren(); - if(rContent.hasElements()) + if(!rContent.empty()) { if(0.0 == rUniTransparenceCandidate.getTransparence()) { @@ -1836,7 +1836,7 @@ namespace drawinglayer const primitive2d::PolyPolygonColorPrimitive2D* pPoPoColor = nullptr; static bool bForceToMetafile(false); - if(!bForceToMetafile && 1 == rContent.getLength()) + if(!bForceToMetafile && 1 == rContent.size()) { const primitive2d::Primitive2DReference xReference(rContent[0]); pPoPoColor = dynamic_cast< const primitive2d::PolyPolygonColorPrimitive2D* >(xReference.get()); @@ -1960,17 +1960,17 @@ namespace drawinglayer // If that detection goes wrong, I have to create an transparence-blended bitmap. Eventually // do that in stripes, else RenderTransparencePrimitive2D may just be used const primitive2d::TransparencePrimitive2D& rTransparenceCandidate = static_cast< const primitive2d::TransparencePrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rTransparenceCandidate.getChildren(); - const primitive2d::Primitive2DSequence rTransparence = rTransparenceCandidate.getTransparence(); + const primitive2d::Primitive2DContainer& rContent = rTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DContainer& rTransparence = rTransparenceCandidate.getTransparence(); - if(rContent.hasElements() && rTransparence.hasElements()) + if(!rContent.empty() && !rTransparence.empty()) { // try to identify a single FillGradientPrimitive2D in the // transparence part of the primitive const primitive2d::FillGradientPrimitive2D* pFiGradient = nullptr; static bool bForceToBigTransparentVDev(false); - if(!bForceToBigTransparentVDev && 1 == rTransparence.getLength()) + if(!bForceToBigTransparentVDev && 1 == rTransparence.size()) { const primitive2d::Primitive2DReference xReference(rTransparence[0]); pFiGradient = dynamic_cast< const primitive2d::FillGradientPrimitive2D* >(xReference.get()); @@ -2007,7 +2007,7 @@ namespace drawinglayer // transparence primitives with non-trivial transparence content) i will for now not // refine to tiling here. - basegfx::B2DRange aViewRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rContent, getViewInformation2D())); + basegfx::B2DRange aViewRange(rContent.getB2DRange(getViewInformation2D())); aViewRange.transform(maCurrentTransformation); const Rectangle aRectLogic( (sal_Int32)floor(aViewRange.getMinX()), (sal_Int32)floor(aViewRange.getMinY()), diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx index 0f7c71ff38e8..80fce399dd34 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx @@ -74,7 +74,7 @@ namespace drawinglayer private: /// local helper(s) Rectangle impDumpToMetaFile( - const primitive2d::Primitive2DSequence& rContent, + const primitive2d::Primitive2DContainer& rContent, GDIMetaFile& o_rContentMetafile); void impConvertFillGradientAttributeToVCLGradient( Gradient& o_rVCLGradient, diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 8dcd74e77ac5..d955451c0277 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -867,9 +867,9 @@ namespace drawinglayer // Detect if a single PolyPolygonColorPrimitive2D is contained; in that case, // use the faster OutputDevice::DrawTransparent method const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate = static_cast< const primitive2d::UnifiedTransparencePrimitive2D& >(rCandidate); - const primitive2d::Primitive2DSequence rContent = rUniTransparenceCandidate.getChildren(); + const primitive2d::Primitive2DContainer rContent = rUniTransparenceCandidate.getChildren(); - if(rContent.hasElements()) + if(!rContent.empty()) { if(0.0 == rUniTransparenceCandidate.getTransparence()) { @@ -884,7 +884,7 @@ namespace drawinglayer // natively), so i am now enabling this shortcut static bool bAllowUsingDrawTransparent(true); - if(bAllowUsingDrawTransparent && 1 == rContent.getLength()) + if(bAllowUsingDrawTransparent && 1 == rContent.size()) { const primitive2d::Primitive2DReference xReference(rContent[0]); const primitive2d::BasePrimitive2D* pBasePrimitive = dynamic_cast< const primitive2d::BasePrimitive2D* >(xReference.get()); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index b6edfa4a3d7d..2d411f38e14e 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -864,7 +864,7 @@ namespace drawinglayer // mask group. Force output to VDev and create mask from given mask void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate) { - if(rMaskCandidate.getChildren().hasElements()) + if(!rMaskCandidate.getChildren().empty()) { basegfx::B2DPolyPolygon aMask(rMaskCandidate.getMask()); @@ -917,7 +917,7 @@ namespace drawinglayer // modified color group. Force output to unified color. void VclProcessor2D::RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate) { - if(rModifiedCandidate.getChildren().hasElements()) + if(!rModifiedCandidate.getChildren().empty()) { maBColorModifierStack.push(rModifiedCandidate.getColorModifier()); process(rModifiedCandidate.getChildren()); @@ -930,7 +930,7 @@ namespace drawinglayer { static bool bForceToDecomposition(false); - if(rTransCandidate.getChildren().hasElements()) + if(!rTransCandidate.getChildren().empty()) { if(bForceToDecomposition) { @@ -947,7 +947,7 @@ namespace drawinglayer else if(rTransCandidate.getTransparence() > 0.0 && rTransCandidate.getTransparence() < 1.0) { // transparence is in visible range - basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D())); + basegfx::B2DRange aRange(rTransCandidate.getChildren().getB2DRange(getViewInformation2D())); aRange.transform(maCurrentTransformation); impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true); @@ -974,9 +974,9 @@ namespace drawinglayer // sub-transparence group. Draw to VDev first. void VclProcessor2D::RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate) { - if(rTransCandidate.getChildren().hasElements()) + if(!rTransCandidate.getChildren().empty()) { - basegfx::B2DRange aRange(primitive2d::getB2DRangeFromPrimitive2DSequence(rTransCandidate.getChildren(), getViewInformation2D())); + basegfx::B2DRange aRange(rTransCandidate.getChildren().getB2DRange(getViewInformation2D())); aRange.transform(maCurrentTransformation); impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true); diff --git a/drawinglayer/source/processor3d/geometry2dextractor.cxx b/drawinglayer/source/processor3d/geometry2dextractor.cxx index 82216ac65917..f7155b1dc335 100644 --- a/drawinglayer/source/processor3d/geometry2dextractor.cxx +++ b/drawinglayer/source/processor3d/geometry2dextractor.cxx @@ -94,7 +94,7 @@ namespace drawinglayer a2DHairline.transform(getObjectTransformation()); const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(rPrimitive.getBColor())); const primitive2d::Primitive2DReference xRef(new primitive2d::PolygonHairlinePrimitive2D(a2DHairline, aModifiedColor)); - primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xRef); + maPrimitive2DSequence.push_back(xRef); } break; } @@ -109,7 +109,7 @@ namespace drawinglayer a2DFill.transform(getObjectTransformation()); const basegfx::BColor aModifiedColor(maBColorModifierStack.getModifiedColor(rPrimitive.getMaterial().getColor())); const primitive2d::Primitive2DReference xRef(new primitive2d::PolyPolygonColorPrimitive2D(a2DFill, aModifiedColor)); - primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(maPrimitive2DSequence, xRef); + maPrimitive2DSequence.push_back(xRef); } break; } diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx index 7598fe44bc53..0235d530dd2d 100644 --- a/drawinglayer/source/processor3d/shadow3dextractor.cxx +++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx @@ -53,8 +53,8 @@ namespace drawinglayer const primitive3d::ShadowPrimitive3D& rPrimitive = static_cast< const primitive3d::ShadowPrimitive3D& >(rCandidate); // set new target - primitive2d::Primitive2DVector aNewSubList; - primitive2d::Primitive2DVector* pLastTargetSequence = mpPrimitive2DSequence; + primitive2d::Primitive2DContainer aNewSubList; + primitive2d::Primitive2DContainer* pLastTargetSequence = mpPrimitive2DSequence; mpPrimitive2DSequence = &aNewSubList; // activate convert @@ -78,13 +78,13 @@ namespace drawinglayer primitive2d::BasePrimitive2D* pNew = new primitive2d::ShadowPrimitive2D( rPrimitive.getShadowTransform(), rPrimitive.getShadowColor(), - primitive2d::Primitive2DVectorToPrimitive2DSequence(aNewSubList)); + aNewSubList); if(basegfx::fTools::more(rPrimitive.getShadowTransparence(), 0.0)) { // create simpleTransparencePrimitive, add created primitives const primitive2d::Primitive2DReference xRef(pNew); - const primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&xRef, 1); + const primitive2d::Primitive2DContainer aNewTransPrimitiveVector { xRef }; pNew = new primitive2d::UnifiedTransparencePrimitive2D( aNewTransPrimitiveVector, @@ -253,10 +253,6 @@ namespace drawinglayer { OSL_ENSURE(0 == maPrimitive2DSequence.size(), "OOps, someone used Shadow3DExtractingProcessor, but did not fetch the results (!)"); - for(size_t a(0); a < maPrimitive2DSequence.size(); a++) - { - delete maPrimitive2DSequence[a]; - } } basegfx::B2DPolygon Shadow3DExtractingProcessor::impDoShadowProjection(const basegfx::B3DPolygon& rSource) @@ -300,9 +296,9 @@ namespace drawinglayer return aRetval; } - const primitive2d::Primitive2DSequence Shadow3DExtractingProcessor::getPrimitive2DSequence() const + const primitive2d::Primitive2DContainer& Shadow3DExtractingProcessor::getPrimitive2DSequence() const { - return Primitive2DVectorToPrimitive2DSequence(maPrimitive2DSequence); + return maPrimitive2DSequence; } } // end of namespace processor3d diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx index c903a5f5f31e..5fc04550cf05 100644 --- a/drawinglayer/source/tools/converters.cxx +++ b/drawinglayer/source/tools/converters.cxx @@ -37,7 +37,7 @@ namespace drawinglayer namespace tools { BitmapEx convertToBitmapEx( - const drawinglayer::primitive2d::Primitive2DSequence& rSeq, + const drawinglayer::primitive2d::Primitive2DContainer& rSeq, const geometry::ViewInformation2D& rViewInformation2D, sal_uInt32 nDiscreteWidth, sal_uInt32 nDiscreteHeight, @@ -48,12 +48,12 @@ namespace drawinglayer static bool bDoSaveForVisualControl(false); #endif - if(rSeq.hasElements() && nDiscreteWidth && nDiscreteHeight) + if(!rSeq.empty() && nDiscreteWidth && nDiscreteHeight) { // get destination size in pixels const MapMode aMapModePixel(MAP_PIXEL); const sal_uInt32 nViewVisibleArea(nDiscreteWidth * nDiscreteHeight); - drawinglayer::primitive2d::Primitive2DSequence aSequence(rSeq); + drawinglayer::primitive2d::Primitive2DContainer aSequence(rSeq); if(nViewVisibleArea > nMaxQuadratPixels) { @@ -67,7 +67,7 @@ namespace drawinglayer basegfx::tools::createScaleB2DHomMatrix(fReduceFactor, fReduceFactor), rSeq)); - aSequence = drawinglayer::primitive2d::Primitive2DSequence(&aEmbed, 1); + aSequence = drawinglayer::primitive2d::Primitive2DContainer { aEmbed }; } const Point aEmptyPoint; @@ -120,7 +120,7 @@ namespace drawinglayer basegfx::BColorModifierSharedPtr( new basegfx::BColorModifier_replace( basegfx::BColor(0.0, 0.0, 0.0))))); - const primitive2d::Primitive2DSequence xSeq(&xRef, 1); + const primitive2d::Primitive2DContainer xSeq { xRef }; // render pContentProcessor->process(xSeq); |