diff options
-rw-r--r-- | include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx | 6 | ||||
-rw-r--r-- | svx/source/dialog/framelinkarray.cxx | 25 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 38 |
4 files changed, 39 insertions, 44 deletions
diff --git a/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx index 40638aa9d05b..93ebdcfde7f2 100644 --- a/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx +++ b/include/svx/sdr/primitive2d/sdrframeborderprimitive2d.hxx @@ -90,7 +90,7 @@ namespace drawinglayer::primitive2d class SVXCORE_DLLPUBLIC SdrFrameBorderPrimitive2D final : public BufferedDecompositionPrimitive2D { private: - std::shared_ptr<SdrFrameBorderDataVector> maFrameBorders; + SdrFrameBorderDataVector maFrameBorders; double mfMinimalNonZeroBorderWidth; double mfMinimalNonZeroBorderWidthUsedForDecompose; bool mbForceToSingleDiscreteUnit; @@ -102,7 +102,7 @@ namespace drawinglayer::primitive2d public: SdrFrameBorderPrimitive2D( - std::shared_ptr<SdrFrameBorderDataVector>& rFrameBorders, + SdrFrameBorderDataVector&& rFrameBorders, bool bForceToSingleDiscreteUnit); // compare operator @@ -114,7 +114,7 @@ namespace drawinglayer::primitive2d const geometry::ViewInformation2D& rViewInformation) const override; // data access - const std::shared_ptr<SdrFrameBorderDataVector>& getFrameBorders() const { return maFrameBorders; } + const SdrFrameBorderDataVector& getFrameBorders() const { return maFrameBorders; } bool doForceToSingleDiscreteUnit() const { return mbForceToSingleDiscreteUnit; } // provide unique ID diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx index a14279f329f1..322e2225d5e6 100644 --- a/svx/source/dialog/framelinkarray.cxx +++ b/svx/source/dialog/framelinkarray.cxx @@ -1275,8 +1275,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( const sal_Int32 nEndCol(nLastCol < GetColCount() - 1 ? nLastCol + 1 : nLastCol); // prepare SdrFrameBorderDataVector - std::shared_ptr<drawinglayer::primitive2d::SdrFrameBorderDataVector> aData( - std::make_shared<drawinglayer::primitive2d::SdrFrameBorderDataVector>()); + drawinglayer::primitive2d::SdrFrameBorderDataVector aData; // remember for which merged cells crossed lines were already created. To // do so, hold the sal_Int32 cell index in a set for fast check @@ -1328,7 +1327,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( if(rTop.IsUsed()) { - HelperCreateHorizontalEntry(*this, rTop, nCol, nRow, aOrigin, aX, aY, *aData, true, pForceColor); + HelperCreateHorizontalEntry(*this, rTop, nCol, nRow, aOrigin, aX, aY, aData, true, pForceColor); } } @@ -1340,7 +1339,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( if(rBottom.IsUsed()) { - HelperCreateHorizontalEntry(*this, rBottom, nCol, nRow + 1, aOrigin, aX, aY, *aData, false, pForceColor); + HelperCreateHorizontalEntry(*this, rBottom, nCol, nRow + 1, aOrigin, aX, aY, aData, false, pForceColor); } } @@ -1353,7 +1352,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( if(rLeft.IsUsed()) { - HelperCreateVerticalEntry(*this, rLeft, nCol, nRow, aOrigin, aX, aY, *aData, true, pForceColor); + HelperCreateVerticalEntry(*this, rLeft, nCol, nRow, aOrigin, aX, aY, aData, true, pForceColor); } } @@ -1365,7 +1364,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( if(rRight.IsUsed()) { - HelperCreateVerticalEntry(*this, rRight, nCol + 1, nRow, aOrigin, aX, aY, *aData, false, pForceColor); + HelperCreateVerticalEntry(*this, rRight, nCol + 1, nRow, aOrigin, aX, aY, aData, false, pForceColor); } } @@ -1441,12 +1440,12 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( } // create top-left to bottom-right geometry - HelperCreateTLBREntry(*this, rTLBR, *aData, aOrigin, aX, aY, + HelperCreateTLBREntry(*this, rTLBR, aData, aOrigin, aX, aY, nColLeft, nRowTop, nColRight, nRowBottom, pForceColor, bNeedToClip ? &aClipRange : nullptr); // create bottom-left to top-right geometry - HelperCreateBLTREntry(*this, rBLTR, *aData, aOrigin, aX, aY, + HelperCreateBLTREntry(*this, rBLTR, aData, aOrigin, aX, aY, nColLeft, nRowTop, nColRight, nRowBottom, pForceColor, bNeedToClip ? &aClipRange : nullptr); } @@ -1465,10 +1464,10 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( if(rTLBR.IsUsed() || rBLTR.IsUsed()) { - HelperCreateTLBREntry(*this, rTLBR, *aData, aOrigin, aX, aY, + HelperCreateTLBREntry(*this, rTLBR, aData, aOrigin, aX, aY, nCol, nRow, nCol, nRow, pForceColor, nullptr); - HelperCreateBLTREntry(*this, rBLTR, *aData, aOrigin, aX, aY, + HelperCreateBLTREntry(*this, rBLTR, aData, aOrigin, aX, aY, nCol, nRow, nCol, nRow, pForceColor, nullptr); } } @@ -1485,7 +1484,7 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( if (rLeft.IsUsed()) { - HelperCreateVerticalEntry(*this, rLeft, nCol, nRow, aOrigin, aX, aY, *aData, true, pForceColor); + HelperCreateVerticalEntry(*this, rLeft, nCol, nRow, aOrigin, aX, aY, aData, true, pForceColor); } } } @@ -1500,12 +1499,12 @@ drawinglayer::primitive2d::Primitive2DContainer Array::CreateB2DPrimitiveRange( // SdrFrameBorderDataVector is used drawinglayer::primitive2d::Primitive2DContainer aSequence; - if(!aData->empty()) + if(!aData.empty()) { aSequence.append( drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::SdrFrameBorderPrimitive2D( - aData, + std::move(aData), true))); // force visualization to minimal one discrete unit (pixel) } diff --git a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx index b2f010395fbd..e2f2fa772dd8 100644 --- a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx @@ -767,7 +767,7 @@ namespace drawinglayer::primitive2d Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const { - if(!getFrameBorders()) + if(getFrameBorders().empty()) { return; } @@ -783,7 +783,7 @@ namespace drawinglayer::primitive2d { // decompose all buffered SdrFrameBorderData entries and try to merge them // to reduce existing number of BorderLinePrimitive2D(s) - for(const auto& rCandidate : *getFrameBorders()) + for(const auto& rCandidate : getFrameBorders()) { // get decomposition on one SdrFrameBorderData entry Primitive2DContainer aPartial; @@ -847,17 +847,17 @@ namespace drawinglayer::primitive2d } SdrFrameBorderPrimitive2D::SdrFrameBorderPrimitive2D( - std::shared_ptr<SdrFrameBorderDataVector>& rFrameBorders, + SdrFrameBorderDataVector&& rFrameBorders, bool bForceToSingleDiscreteUnit) : maFrameBorders(std::move(rFrameBorders)), mfMinimalNonZeroBorderWidth(0.0), mfMinimalNonZeroBorderWidthUsedForDecompose(0.0), mbForceToSingleDiscreteUnit(bForceToSingleDiscreteUnit) { - if(getFrameBorders() && doForceToSingleDiscreteUnit()) + if(!getFrameBorders().empty() && doForceToSingleDiscreteUnit()) { // detect used minimal non-zero partial border width - for(const auto& rCandidate : *getFrameBorders()) + for(const auto& rCandidate : getFrameBorders()) { mfMinimalNonZeroBorderWidth = getMinimalNonZeroValue( mfMinimalNonZeroBorderWidth, @@ -872,9 +872,7 @@ namespace drawinglayer::primitive2d { const SdrFrameBorderPrimitive2D& rCompare = static_cast<const SdrFrameBorderPrimitive2D&>(rPrimitive); - return (getFrameBorders() == rCompare.getFrameBorders() - || (getFrameBorders() && rCompare.getFrameBorders() - && *getFrameBorders() == *rCompare.getFrameBorders())) + return getFrameBorders() == rCompare.getFrameBorders() && doForceToSingleDiscreteUnit() == rCompare.doForceToSingleDiscreteUnit(); } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 03deb9e7816d..7c3954838f90 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2468,8 +2468,7 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons ::SwAlignRect( aUpperAligned, gProp.pSGlobalShell, &rDev ); // prepare SdrFrameBorderDataVector - std::shared_ptr<drawinglayer::primitive2d::SdrFrameBorderDataVector> aData( - std::make_shared<drawinglayer::primitive2d::SdrFrameBorderDataVector>()); + drawinglayer::primitive2d::SdrFrameBorderDataVector aData; while ( true ) { @@ -2611,12 +2610,12 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons if(!aX.equalZero()) { const basegfx::B2DVector aY(basegfx::getNormalizedPerpendicular(aX)); - aData->emplace_back( + aData.emplace_back( aOrigin, aX, aStyles[0], pTmpColor); - drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData->back()); + drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData.back()); rInstance.addSdrConnectStyleData(true, aStyles[1], -aY, true); // aLFromT rInstance.addSdrConnectStyleData(true, aStyles[2], -aX, true); // aLFromL @@ -2635,12 +2634,12 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons if(!aX.equalZero()) { const basegfx::B2DVector aY(basegfx::getNormalizedPerpendicular(aX)); - aData->emplace_back( + aData.emplace_back( aOrigin, aX, aStyles[0], pTmpColor); - drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData->back()); + drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData.back()); rInstance.addSdrConnectStyleData(true, aStyles[3], -aY, false); // aTFromR rInstance.addSdrConnectStyleData(true, aStyles[2], -aX, true); // aTFromT @@ -2658,13 +2657,13 @@ void SwTabFramePainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) cons // create instance of SdrFrameBorderPrimitive2D if // SdrFrameBorderDataVector is used - if(!aData->empty()) + if(!aData.empty()) { drawinglayer::primitive2d::Primitive2DContainer aSequence; aSequence.append( drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::SdrFrameBorderPrimitive2D( - aData, + std::move(aData), true))); // force visualization to minimal one discrete unit (pixel) // paint mrTabFrame.ProcessPrimitives(aSequence); @@ -4726,8 +4725,7 @@ namespace drawinglayer::primitive2d basegfx::B2DPoint aBottomRight(getB2DHomMatrix() * basegfx::B2DPoint(1.0, 1.0)); // prepare SdrFrameBorderDataVector - std::shared_ptr<drawinglayer::primitive2d::SdrFrameBorderDataVector> aData( - std::make_shared<drawinglayer::primitive2d::SdrFrameBorderDataVector>()); + drawinglayer::primitive2d::SdrFrameBorderDataVector aData; if(getStyleTop().IsUsed()) { @@ -4771,12 +4769,12 @@ namespace drawinglayer::primitive2d { // create BorderPrimitive(s) for top border const basegfx::B2DVector aVector(aTopRight - aTopLeft); - aData->emplace_back( + aData.emplace_back( aTopLeft, aVector, getStyleTop(), nullptr); - drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData->back()); + drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData.back()); if(getStyleLeft().IsUsed()) { @@ -4793,12 +4791,12 @@ namespace drawinglayer::primitive2d { // create BorderPrimitive(s) for right border const basegfx::B2DVector aVector(aBottomRight - aTopRight); - aData->emplace_back( + aData.emplace_back( aTopRight, aVector, getStyleRight(), nullptr); - drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData->back()); + drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData.back()); if(getStyleTop().IsUsed()) { @@ -4815,12 +4813,12 @@ namespace drawinglayer::primitive2d { // create BorderPrimitive(s) for bottom border const basegfx::B2DVector aVector(aBottomLeft - aBottomRight); - aData->emplace_back( + aData.emplace_back( aBottomRight, aVector, getStyleBottom(), nullptr); - drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData->back()); + drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData.back()); if(getStyleRight().IsUsed()) { @@ -4837,12 +4835,12 @@ namespace drawinglayer::primitive2d { // create BorderPrimitive(s) for left border const basegfx::B2DVector aVector(aTopLeft - aBottomLeft); - aData->emplace_back( + aData.emplace_back( aBottomLeft, aVector, getStyleLeft(), nullptr); - drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData->back()); + drawinglayer::primitive2d::SdrFrameBorderData& rInstance(aData.back()); if(getStyleBottom().IsUsed()) { @@ -4857,12 +4855,12 @@ namespace drawinglayer::primitive2d // create instance of SdrFrameBorderPrimitive2D if // SdrFrameBorderDataVector is used - if(!aData->empty()) + if(!aData.empty()) { rContainer.append( drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::SdrFrameBorderPrimitive2D( - aData, + std::move(aData), true))); // force visualization to minimal one discrete unit (pixel) } } |