[Libreoffice-commits] core.git: 3 commits - include/svx svx/source sw/source

Michael Stahl mstahl at redhat.com
Thu Feb 20 04:40:02 PST 2014


 include/svx/framelink.hxx          |   14 +++++++-------
 svx/source/dialog/framelink.cxx    |   32 ++++++++++++++++----------------
 sw/source/core/layout/paintfrm.cxx |    3 ++-
 3 files changed, 25 insertions(+), 24 deletions(-)

New commits:
commit 9fb9fc301502c2762ad4a8059d8d1c818d2843db
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 20 12:32:51 2014 +0100

    fdo#75118: actually these are floats, compare with approxEqual
    
    Change-Id: Ib195af3ebd5f602761d1660abb1798d72d0f352d

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 169a358..8fa85c6 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2596,7 +2596,8 @@ void SwTabFrmPainter::PaintLines(OutputDevice& rDev, const SwRect& rRect) const
             aPaintStart.Y() -= nTwipYCorr;
             aPaintEnd.Y()   -= nTwipYCorr;
 
-            if (aStyles[0].Prim() <= 0 && aStyles[0].Secn() <= 0)
+            if (::rtl::math::approxEqual(aStyles[0].Prim(), 0.0) &&
+                ::rtl::math::approxEqual(aStyles[0].Secn(), 0.0))
             {
                 continue; // fdo#75118 do not paint zero-width lines
             }
commit c96da60124652bac4bd8d2ebf18be67e1365d89d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 20 12:05:52 2014 +0100

    svx::frame::Style::Set(): typo: subtract if it's _not_ 0
    
    (regression from 2c91cb08d65cd35fa8ef6eaca3677aa82fb58cbe)
    
    Change-Id: I9803b630067de26503fceb32b5d7c6a46f352a7a

diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index b220a08..52a992f 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -1229,7 +1229,7 @@ void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWid
             // Still too thick? Decrease the line widths.
             if( GetWidth() > nMaxWidth )
             {
-                if (rtl::math::approxEqual(mfPrim, 0.0) && rtl::math::approxEqual(mfPrim, mfSecn))
+                if (!rtl::math::approxEqual(mfPrim, 0.0) && rtl::math::approxEqual(mfPrim, mfSecn))
                 {
                     // Both lines equal - decrease both to keep symmetry.
                     --mfPrim;
commit 474b2ff232591442fb22363c82abc66e7e2101a0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Feb 20 11:51:43 2014 +0100

    svx: these Style members are floats
    
    Change-Id: Id1a5e363c8c39b3ad9e61f9b914461d15f5c3028

diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx
index afae83e..b8f2bfc 100644
--- a/include/svx/framelink.hxx
+++ b/include/svx/framelink.hxx
@@ -124,14 +124,14 @@ public:
     inline const Color& GetColorSecn() const { return maColorSecn; }
     inline const Color& GetColorGap() const { return maColorGap; }
     inline bool         UseGapColor() const { return mbUseGapColor; }
-    inline double       Prim() const { return mnPrim; }
-    inline double       Dist() const { return mnDist; }
-    inline double       Secn() const { return mnSecn; }
+    inline double       Prim() const { return mfPrim; }
+    inline double       Dist() const { return mfDist; }
+    inline double       Secn() const { return mfSecn; }
     double Scale() const;
     inline editeng::SvxBorderStyle Type() const { return mnType; }
 
     /** Returns the total width of this frame style. */
-    inline double       GetWidth() const { return mnPrim + mnDist + mnSecn; }
+    inline double       GetWidth() const { return mfPrim + mfDist + mfSecn; }
 
     /** Sets the frame style to invisible state. */
     void                Clear();
@@ -165,9 +165,9 @@ private:
     Color               maColorGap;
     bool                mbUseGapColor;
     RefMode             meRefMode;  /// Reference point handling for this frame border.
-    double              mnPrim;     /// Width of primary (single, left, or top) line.
-    double              mnDist;     /// Distance between primary and secondary line.
-    double              mnSecn;     /// Width of secondary (right or bottom) line.
+    double              mfPrim;     /// Width of primary (single, left, or top) line.
+    double              mfDist;     /// Distance between primary and secondary line.
+    double              mfSecn;     /// Width of secondary (right or bottom) line.
     double              mfScale;
     editeng::SvxBorderStyle      mnType;
 };
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 8268374..b220a08 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -1176,16 +1176,16 @@ void Style::Clear()
 
 void Style::Set( double nP, double nD, double nS )
 {
-    /*  nP  nD  nS  ->  mnPrim  mnDist  mnSecn
+    /*  nP  nD  nS  ->  mfPrim  mfDist  mfSecn
         --------------------------------------
         any any 0       nP      0       0
         0   any >0      nS      0       0
         >0  0   >0      nP      0       0
         >0  >0  >0      nP      nD      nS
      */
-    mnPrim = rtl::math::round(nP ? nP : nS, 2);
-    mnDist = rtl::math::round((nP && nS) ? nD : 0, 2);
-    mnSecn = rtl::math::round((nP && nD) ? nS : 0, 2);
+    mfPrim = rtl::math::round(nP ? nP : nS, 2);
+    mfDist = rtl::math::round((nP && nS) ? nD : 0, 2);
+    mfSecn = rtl::math::round((nP && nD) ? nS : 0, 2);
 }
 
 void Style::Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS )
@@ -1219,29 +1219,29 @@ void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWid
         // Enlarge the style if distance is too small due to rounding losses.
         double nPixWidth = SCALEVALUE( nPrim + nDist + nSecn );
         if( nPixWidth > GetWidth() )
-            mnDist = nPixWidth - mnPrim - mnSecn;
+            mfDist = nPixWidth - mfPrim - mfSecn;
         // Shrink the style if it is too thick for the control.
         while( GetWidth() > nMaxWidth )
         {
             // First decrease space between lines.
-            if( mnDist )
-                --mnDist;
+            if (mfDist)
+                --mfDist;
             // Still too thick? Decrease the line widths.
             if( GetWidth() > nMaxWidth )
             {
-                if( rtl::math::approxEqual(mnPrim, 0.0) && rtl::math::approxEqual(mnPrim, mnSecn) )
+                if (rtl::math::approxEqual(mfPrim, 0.0) && rtl::math::approxEqual(mfPrim, mfSecn))
                 {
                     // Both lines equal - decrease both to keep symmetry.
-                    --mnPrim;
-                    --mnSecn;
+                    --mfPrim;
+                    --mfSecn;
                 }
                 else
                 {
                     // Decrease each line for itself
-                    if( mnPrim )
-                        --mnPrim;
-                    if( (GetWidth() > nMaxWidth) && !rtl::math::approxEqual(mnSecn, 0.0) )
-                        --mnSecn;
+                    if (mfPrim)
+                        --mfPrim;
+                    if ((GetWidth() > nMaxWidth) && !rtl::math::approxEqual(mfSecn, 0.0))
+                        --mfSecn;
                 }
             }
         }
@@ -1261,8 +1261,8 @@ void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWid
 
 Style& Style::MirrorSelf()
 {
-    if( mnSecn )
-        std::swap( mnPrim, mnSecn );
+    if (mfSecn)
+        std::swap( mfPrim, mfSecn );
     if( meRefMode != REFMODE_CENTERED )
         meRefMode = (meRefMode == REFMODE_BEGIN) ? REFMODE_END : REFMODE_BEGIN;
     return *this;


More information about the Libreoffice-commits mailing list