[Libreoffice-commits] core.git: solenv/clang-format svx/inc svx/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 9 00:10:18 UTC 2021


 solenv/clang-format/excludelist                   |    2 
 svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx    |   65 ++---
 svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx |  263 ++++++++++------------
 3 files changed, 158 insertions(+), 172 deletions(-)

New commits:
commit 767f408c64d067e3a70604938b0e050a69e3d563
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Jan 3 21:44:19 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Jan 9 01:09:30 2021 +0100

    remove sdrgrafprimitive2d.{cxx,hxx} from excludelist
    
    Change-Id: I9533fe0bb082f6688d6f8030e5bc0d6960abf359
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108844
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 4b0e44a74377..642bbb35aa72 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -11500,7 +11500,6 @@ svx/inc/sdr/primitive2d/sdrconnectorprimitive2d.hxx
 svx/inc/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx
 svx/inc/sdr/primitive2d/sdrdecompositiontools.hxx
 svx/inc/sdr/primitive2d/sdrellipseprimitive2d.hxx
-svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx
 svx/inc/sdr/primitive2d/sdrmeasureprimitive2d.hxx
 svx/inc/sdr/primitive2d/sdrole2primitive2d.hxx
 svx/inc/sdr/primitive2d/sdrolecontentprimitive2d.hxx
@@ -11876,7 +11875,6 @@ svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
 svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx
 svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
-svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
 svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
 svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx
diff --git a/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx b/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx
index 731e0f18c339..1a24f3aab862 100644
--- a/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx
+++ b/svx/inc/sdr/primitive2d/sdrgrafprimitive2d.hxx
@@ -25,38 +25,41 @@
 #include <sdr/attribute/sdrlinefilleffectstextattribute.hxx>
 
 namespace drawinglayer::primitive2d
+{
+class SdrGrafPrimitive2D final : public BufferedDecompositionPrimitive2D
+{
+private:
+    ::basegfx::B2DHomMatrix maTransform;
+    attribute::SdrLineFillEffectsTextAttribute maSdrLFSTAttribute;
+    GraphicObject maGraphicObject;
+    GraphicAttr maGraphicAttr;
+
+    // local decomposition.
+    virtual void
+    create2DDecomposition(Primitive2DContainer& rContainer,
+                          const geometry::ViewInformation2D& aViewInformation) const override;
+
+public:
+    SdrGrafPrimitive2D(const ::basegfx::B2DHomMatrix& rTransform,
+                       const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute,
+                       const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr);
+
+    // data access
+    const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+    const attribute::SdrLineFillEffectsTextAttribute& getSdrLFSTAttribute() const
     {
-        class SdrGrafPrimitive2D final : public BufferedDecompositionPrimitive2D
-        {
-        private:
-            ::basegfx::B2DHomMatrix                     maTransform;
-            attribute::SdrLineFillEffectsTextAttribute   maSdrLFSTAttribute;
-            GraphicObject                               maGraphicObject;
-            GraphicAttr                                 maGraphicAttr;
-
-            // local decomposition.
-            virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& aViewInformation) const override;
-
-        public:
-            SdrGrafPrimitive2D(
-                const ::basegfx::B2DHomMatrix& rTransform,
-                const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute,
-                const GraphicObject& rGraphicObject,
-                const GraphicAttr& rGraphicAttr);
-
-            // data access
-            const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
-            const attribute::SdrLineFillEffectsTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
-            const GraphicObject& getGraphicObject() const { return maGraphicObject; }
-            const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
-            bool isTransparent() const;
-
-            // compare operator
-            virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
-
-            // provide unique ID
-            virtual sal_uInt32 getPrimitive2DID() const override;
-        };
+        return maSdrLFSTAttribute;
+    }
+    const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+    const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
+    bool isTransparent() const;
+
+    // compare operator
+    virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
+
+    // provide unique ID
+    virtual sal_uInt32 getPrimitive2DID() const override;
+};
 } // end of namespace drawinglayer::primitive2d
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
index 2f934d0cbf1d..36f34106e1fd 100644
--- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx
@@ -26,154 +26,139 @@
 
 namespace drawinglayer::primitive2d
 {
-        void SdrGrafPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const
+void SdrGrafPrimitive2D::create2DDecomposition(
+    Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const
+{
+    Primitive2DContainer aRetval;
+
+    // create unit outline polygon
+    const basegfx::B2DPolygon& aUnitOutline(basegfx::utils::createUnitPolygon());
+
+    // add fill, but only when graphic is transparent
+    if (!getSdrLFSTAttribute().getFill().isDefault() && isTransparent())
+    {
+        basegfx::B2DPolyPolygon aTransformed(aUnitOutline);
+
+        aTransformed.transform(getTransform());
+        aRetval.push_back(
+            createPolyPolygonFillPrimitive(aTransformed, getSdrLFSTAttribute().getFill(),
+                                           getSdrLFSTAttribute().getFillFloatTransGradient()));
+    }
+
+    // add graphic content
+    if (255 != getGraphicAttr().GetTransparency())
+    {
+        // standard graphic fill
+        const Primitive2DReference xGraphicContentPrimitive(
+            new GraphicPrimitive2D(getTransform(), getGraphicObject(), getGraphicAttr()));
+        aRetval.push_back(xGraphicContentPrimitive);
+    }
+
+    // add line
+    if (!getSdrLFSTAttribute().getLine().isDefault())
+    {
+        // if line width is given, polygon needs to be grown by half of it to make the
+        // outline to be outside of the bitmap
+        if (0.0 != getSdrLFSTAttribute().getLine().getWidth())
         {
-            Primitive2DContainer  aRetval;
-
-            // create unit outline polygon
-            const basegfx::B2DPolygon& aUnitOutline(basegfx::utils::createUnitPolygon());
-
-            // add fill, but only when graphic is transparent
-            if(!getSdrLFSTAttribute().getFill().isDefault() && isTransparent())
-            {
-                basegfx::B2DPolyPolygon aTransformed(aUnitOutline);
-
-                aTransformed.transform(getTransform());
-                aRetval.push_back(
-                    createPolyPolygonFillPrimitive(
-                        aTransformed,
-                        getSdrLFSTAttribute().getFill(),
-                        getSdrLFSTAttribute().getFillFloatTransGradient()));
-            }
-
-            // add graphic content
-            if(255 != getGraphicAttr().GetTransparency())
-            {
-                // standard graphic fill
-                const Primitive2DReference xGraphicContentPrimitive(
-                    new GraphicPrimitive2D(
-                        getTransform(),
-                        getGraphicObject(),
-                        getGraphicAttr()));
-                aRetval.push_back(xGraphicContentPrimitive);
-            }
-
-            // add line
-            if(!getSdrLFSTAttribute().getLine().isDefault())
-            {
-                // if line width is given, polygon needs to be grown by half of it to make the
-                // outline to be outside of the bitmap
-                if(0.0 != getSdrLFSTAttribute().getLine().getWidth())
-                {
-                    // decompose to get scale
-                    basegfx::B2DVector aScale, aTranslate;
-                    double fRotate, fShearX;
-                    getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
-
-                    // create expanded range (add relative half line width to unit rectangle)
-                    double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5);
-                    double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
-                    double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
-                    const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
-                    basegfx::B2DPolygon aExpandedUnitOutline(basegfx::utils::createPolygonFromRect(aExpandedRange));
-
-                    aExpandedUnitOutline.transform(getTransform());
-                    aRetval.push_back(
-                        createPolygonLinePrimitive(
-                            aExpandedUnitOutline,
-                            getSdrLFSTAttribute().getLine(),
-                            attribute::SdrLineStartEndAttribute()));
-                }
-                else
-                {
-                    basegfx::B2DPolygon aTransformed(aUnitOutline);
-
-                    aTransformed.transform(getTransform());
-                    aRetval.push_back(
-                        createPolygonLinePrimitive(
-                            aTransformed,
-                            getSdrLFSTAttribute().getLine(),
-                            attribute::SdrLineStartEndAttribute()));
-                }
-            }
-
-            // Soft edges should be before text, since text is not affected by soft edges
-            if (!aRetval.empty() && getSdrLFSTAttribute().getSoftEdgeRadius())
-            {
-                aRetval = createEmbeddedSoftEdgePrimitive(
-                    aRetval, getSdrLFSTAttribute().getSoftEdgeRadius());
-            }
-
-            // add text
-            if(!getSdrLFSTAttribute().getText().isDefault())
-            {
-                aRetval.push_back(
-                    createTextPrimitive(
-                        basegfx::B2DPolyPolygon(aUnitOutline),
-                        getTransform(),
-                        getSdrLFSTAttribute().getText(),
-                        getSdrLFSTAttribute().getLine(),
-                        false,
-                        false));
-            }
-
-            // tdf#132199: put glow before shadow, to have shadow of the glow, not the opposite
-            if (!aRetval.empty() && !getSdrLFSTAttribute().getGlow().isDefault())
-            {
-                // glow
-                aRetval = createEmbeddedGlowPrimitive(aRetval, getSdrLFSTAttribute().getGlow());
-            }
-
-            // add shadow
-            if(!getSdrLFSTAttribute().getShadow().isDefault())
-            {
-                aRetval = createEmbeddedShadowPrimitive(
-                    aRetval,
-                    getSdrLFSTAttribute().getShadow(),
-                    getTransform());
-            }
-
-            rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end());
+            // decompose to get scale
+            basegfx::B2DVector aScale, aTranslate;
+            double fRotate, fShearX;
+            getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+            // create expanded range (add relative half line width to unit rectangle)
+            double fHalfLineWidth(getSdrLFSTAttribute().getLine().getWidth() * 0.5);
+            double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
+            double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
+            const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX,
+                                                   1.0 + fScaleY);
+            basegfx::B2DPolygon aExpandedUnitOutline(
+                basegfx::utils::createPolygonFromRect(aExpandedRange));
+
+            aExpandedUnitOutline.transform(getTransform());
+            aRetval.push_back(createPolygonLinePrimitive(aExpandedUnitOutline,
+                                                         getSdrLFSTAttribute().getLine(),
+                                                         attribute::SdrLineStartEndAttribute()));
         }
-
-        SdrGrafPrimitive2D::SdrGrafPrimitive2D(
-            const basegfx::B2DHomMatrix& rTransform,
-            const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute,
-            const GraphicObject& rGraphicObject,
-            const GraphicAttr& rGraphicAttr)
-        :   BufferedDecompositionPrimitive2D(),
-            maTransform(rTransform),
-            maSdrLFSTAttribute(rSdrLFSTAttribute),
-            maGraphicObject(rGraphicObject),
-            maGraphicAttr(rGraphicAttr)
+        else
         {
-            // reset some values from GraphicAttr which are part of transformation already
-            maGraphicAttr.SetRotation(0_deg10);
+            basegfx::B2DPolygon aTransformed(aUnitOutline);
+
+            aTransformed.transform(getTransform());
+            aRetval.push_back(createPolygonLinePrimitive(aTransformed,
+                                                         getSdrLFSTAttribute().getLine(),
+                                                         attribute::SdrLineStartEndAttribute()));
         }
+    }
+
+    // Soft edges should be before text, since text is not affected by soft edges
+    if (!aRetval.empty() && getSdrLFSTAttribute().getSoftEdgeRadius())
+    {
+        aRetval
+            = createEmbeddedSoftEdgePrimitive(aRetval, getSdrLFSTAttribute().getSoftEdgeRadius());
+    }
+
+    // add text
+    if (!getSdrLFSTAttribute().getText().isDefault())
+    {
+        aRetval.push_back(createTextPrimitive(basegfx::B2DPolyPolygon(aUnitOutline), getTransform(),
+                                              getSdrLFSTAttribute().getText(),
+                                              getSdrLFSTAttribute().getLine(), false, false));
+    }
+
+    // tdf#132199: put glow before shadow, to have shadow of the glow, not the opposite
+    if (!aRetval.empty() && !getSdrLFSTAttribute().getGlow().isDefault())
+    {
+        // glow
+        aRetval = createEmbeddedGlowPrimitive(aRetval, getSdrLFSTAttribute().getGlow());
+    }
+
+    // add shadow
+    if (!getSdrLFSTAttribute().getShadow().isDefault())
+    {
+        aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrLFSTAttribute().getShadow(),
+                                                getTransform());
+    }
+
+    rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end());
+}
+
+SdrGrafPrimitive2D::SdrGrafPrimitive2D(
+    const basegfx::B2DHomMatrix& rTransform,
+    const attribute::SdrLineFillEffectsTextAttribute& rSdrLFSTAttribute,
+    const GraphicObject& rGraphicObject, const GraphicAttr& rGraphicAttr)
+    : BufferedDecompositionPrimitive2D()
+    , maTransform(rTransform)
+    , maSdrLFSTAttribute(rSdrLFSTAttribute)
+    , maGraphicObject(rGraphicObject)
+    , maGraphicAttr(rGraphicAttr)
+{
+    // reset some values from GraphicAttr which are part of transformation already
+    maGraphicAttr.SetRotation(0_deg10);
+}
 
-        bool SdrGrafPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
-        {
-            if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
-            {
-                const SdrGrafPrimitive2D& rCompare = static_cast<const SdrGrafPrimitive2D&>(rPrimitive);
+bool SdrGrafPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+    if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+    {
+        const SdrGrafPrimitive2D& rCompare = static_cast<const SdrGrafPrimitive2D&>(rPrimitive);
 
-                return (getTransform() == rCompare.getTransform()
-                    && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()
-                    && getGraphicObject() == rCompare.getGraphicObject()
-                    && getGraphicAttr() == rCompare.getGraphicAttr());
-            }
+        return (getTransform() == rCompare.getTransform()
+                && getSdrLFSTAttribute() == rCompare.getSdrLFSTAttribute()
+                && getGraphicObject() == rCompare.getGraphicObject()
+                && getGraphicAttr() == rCompare.getGraphicAttr());
+    }
 
-            return false;
-        }
+    return false;
+}
 
-        bool SdrGrafPrimitive2D::isTransparent() const
-        {
-            return ((0 != getGraphicAttr().GetTransparency())
-                || (getGraphicObject().IsTransparent()));
-        }
+bool SdrGrafPrimitive2D::isTransparent() const
+{
+    return ((0 != getGraphicAttr().GetTransparency()) || (getGraphicObject().IsTransparent()));
+}
 
-        // provide unique ID
-        ImplPrimitive2DIDBlock(SdrGrafPrimitive2D, PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D)
+// provide unique ID
+ImplPrimitive2DIDBlock(SdrGrafPrimitive2D, PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D)
 
 } // end of namespace
 


More information about the Libreoffice-commits mailing list