[Libreoffice-commits] core.git: sw/inc sw/source

Mark Hung marklh9 at gmail.com
Sun Dec 11 11:12:32 UTC 2016


 sw/inc/swrect.hxx                |    2 ++
 sw/source/core/bastyp/swrect.cxx |    3 +++
 sw/source/core/inc/frame.hxx     |    8 ++++++++
 sw/source/core/layout/newfrm.cxx |   20 ++++++++++++++++++++
 4 files changed, 33 insertions(+)

New commits:
commit 611354a1c2e8281a80a1c3f5076a6c4593a4fe10
Author: Mark Hung <marklh9 at gmail.com>
Date:   Fri Dec 9 20:17:09 2016 +0800

    tdf#101729 recover fnGetSize,fnLeftDist,fnRightDist,fnXInc
    
    Above field of struct SwRectFnCollection were removed because of
    loplugin:unusedfields. I can't find them refered in the source
    code but they do affect alignments.
    
    Also append correspoinding member functions for SwRectFnSet.
    
    Partially recover d2df03574023b379ac09b1f71cae9e3ba3ac53e2
    and e18b08363a939b35e7f5dc435e606d2c62bddebd.
    
    Change-Id: I38f2b7a31565773b749cfeb1f47574c390d38527
    Reviewed-on: https://gerrit.libreoffice.org/31795
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx
index 2e0b0b2..9bb2545 100644
--- a/sw/inc/swrect.hxx
+++ b/sw/inc/swrect.hxx
@@ -132,10 +132,12 @@ public:
     void SetUpperLeftCorner(  const Point& rNew );
     void SetUpperRightCorner(  const Point& rNew );
     void SetLowerLeftCorner(  const Point& rNew );
+    const Size  Size_() const;
     const Point TopLeft()  const;
     const Point TopRight()  const;
     const Point BottomLeft()  const;
     const Point BottomRight()  const;
+    const Size  SwappedSize() const;
     long GetLeftDistance( long ) const;
     long GetBottomDistance( long ) const;
     long GetRightDistance( long ) const;
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
index 120b0d5..c40b7a2 100644
--- a/sw/source/core/bastyp/swrect.cxx
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -173,6 +173,9 @@ void SwRect::AddBottom( const long nAdd ){ m_Size.Height() += nAdd; }
 void SwRect::SetPosX( const long nNew ){ m_Point.setX(nNew); }
 void SwRect::SetPosY( const long nNew ){ m_Point.setY(nNew); }
 
+const Size  SwRect::Size_() const { return SSize(); }
+const Size  SwRect::SwappedSize() const { return Size( m_Size.getHeight(), m_Size.getWidth() ); }
+
 const Point SwRect::TopLeft() const { return Pos(); }
 const Point SwRect::TopRight() const { return Point( m_Point.getX() + m_Size.getWidth(), m_Point.getY() ); }
 const Point SwRect::BottomLeft() const { return Point( m_Point.getX(), m_Point.getY() + m_Size.getHeight() ); }
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 4ba2cf4..83c1cac 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -1095,6 +1095,7 @@ struct SwRectFnCollection
     SwRectGet     fnGetWidth;
     SwRectGet     fnGetHeight;
     SwRectPoint   fnGetPos;
+    SwRectSize    fnGetSize;
 
     SwRectSet     fnSetTop;
     SwRectSet     fnSetBottom;
@@ -1125,6 +1126,8 @@ struct SwRectFnCollection
     SwFrameGet      fnGetPrtRight;
     SwRectDist      fnTopDist;
     SwRectDist      fnBottomDist;
+    SwRectDist      fnLeftDist;
+    SwRectDist      fnRightDist;
     SwFrameMax      fnSetLimit;
     SwRectMax       fnOverStep;
 
@@ -1132,6 +1135,7 @@ struct SwRectFnCollection
     SwFrameMakePos  fnMakePos;
     SwOperator      fnXDiff;
     SwOperator      fnYDiff;
+    SwOperator      fnXInc;
     SwOperator      fnYInc;
 
     SwRectSetTwice  fnSetLeftAndWidth;
@@ -1182,6 +1186,7 @@ public:
     long  GetWidth (const SwRect& rRect) const { return (rRect.*fnRect->fnGetWidth) (); }
     long  GetHeight(const SwRect& rRect) const { return (rRect.*fnRect->fnGetHeight)(); }
     Point GetPos   (const SwRect& rRect) const { return (rRect.*fnRect->fnGetPos)   (); }
+    Size  GetSize  (const SwRect& rRect) const { return (rRect.*fnRect->fnGetSize)  (); }
 
     void SetTop   (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetTop)   (nNew); }
     void SetBottom(SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetBottom)(nNew); }
@@ -1212,6 +1217,8 @@ public:
     long  GetPrtRight    (const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetPrtRight)    (); }
     long  TopDist   (const SwRect& rRect, long nPos) const { return (rRect.*fnRect->fnTopDist)    (nPos); }
     long  BottomDist(const SwRect& rRect, long nPos) const { return (rRect.*fnRect->fnBottomDist) (nPos); }
+    long  LeftDist   (const SwRect& rRect, long nPos) const { return (rRect.*fnRect->fnLeftDist)    (nPos); }
+    long  RightDist   (const SwRect& rRect, long nPos) const { return (rRect.*fnRect->fnRightDist)    (nPos); }
     bool  SetLimit (SwFrame& rFrame, long nNew) const { return (rFrame.*fnRect->fnSetLimit) (nNew); }
     bool  OverStep  (const SwRect& rRect, long nPos) const { return (rRect.*fnRect->fnOverStep)   (nPos); }
 
@@ -1219,6 +1226,7 @@ public:
     void MakePos(SwFrame& rFrame, const SwFrame* pUp, const SwFrame* pPrv, bool bNotify) const { (rFrame.*fnRect->fnMakePos)(pUp, pPrv, bNotify); }
     long XDiff(long n1, long n2) const { return (fnRect->fnXDiff) (n1, n2); }
     long YDiff(long n1, long n2) const { return (fnRect->fnYDiff) (n1, n2); }
+    long XInc (long n1, long n2) const { return (fnRect->fnXInc)  (n1, n2); }
     long YInc (long n1, long n2) const { return (fnRect->fnYInc)  (n1, n2); }
 
     void SetLeftAndWidth(SwRect& rRect, long nLeft, long nWidth) const { (rRect.*fnRect->fnSetLeftAndWidth)(nLeft, nWidth); }
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index e49fb63..e1a96cd 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -63,6 +63,7 @@ static SwRectFnCollection aHorizontal = {
     &SwRect::Width_,
     &SwRect::Height_,
     &SwRect::TopLeft,
+    &SwRect::Size_,
     /* fnRectSet      */
     &SwRect::Top_,
     &SwRect::Bottom_,
@@ -93,6 +94,8 @@ static SwRectFnCollection aHorizontal = {
     &SwFrame::GetPrtRight,
     &SwRect::GetTopDistance,
     &SwRect::GetBottomDistance,
+    &SwRect::GetLeftDistance,
+    &SwRect::GetRightDistance,
     &SwFrame::SetMaxBottom,
     &SwRect::OverStepBottom,
 
@@ -101,6 +104,7 @@ static SwRectFnCollection aHorizontal = {
     &FirstMinusSecond,
     &FirstMinusSecond,
     &SwIncrement,
+    &SwIncrement,
     &SwRect::SetLeftAndWidth,
     &SwRect::SetTopAndHeight
 };
@@ -114,6 +118,7 @@ static SwRectFnCollection aVertical = {
     &SwRect::Height_,
     &SwRect::Width_,
     &SwRect::TopRight,
+    &SwRect::SwappedSize,
     /* fnRectSet      */
     &SwRect::Rigth_,
     &SwRect::Left_,
@@ -144,6 +149,8 @@ static SwRectFnCollection aVertical = {
     &SwFrame::GetPrtBottom,
     &SwRect::GetRightDistance,
     &SwRect::GetLeftDistance,
+    &SwRect::GetTopDistance,
+    &SwRect::GetBottomDistance,
     &SwFrame::SetMinLeft,
     &SwRect::OverStepLeft,
 
@@ -152,6 +159,7 @@ static SwRectFnCollection aVertical = {
     &FirstMinusSecond,
     &SecondMinusFirst,
     &SwIncrement,
+    &SwDecrement,
     &SwRect::SetTopAndHeight,
     &SwRect::SetRightAndWidth
 };
@@ -165,6 +173,7 @@ static SwRectFnCollection aBottomToTop = {
     &SwRect::Width_,
     &SwRect::Height_,
     &SwRect::BottomLeft,
+    &SwRect::Size_,
     /* fnRectSet      */
     &SwRect::Bottom_,
     &SwRect::Top_,
@@ -195,6 +204,8 @@ static SwRectFnCollection aBottomToTop = {
     &SwFrame::GetPrtRight,
     &SwRect::GetBottomDistance,
     &SwRect::GetTopDistance,
+    &SwRect::GetLeftDistance,
+    &SwRect::GetRightDistance,
     &SwFrame::SetMinTop,
     &SwRect::OverStepTop,
 
@@ -203,6 +214,7 @@ static SwRectFnCollection aBottomToTop = {
     &FirstMinusSecond,
     &SecondMinusFirst,
     &SwIncrement,
+    &SwDecrement,
     &SwRect::SetLeftAndWidth,
     &SwRect::SetBottomAndHeight
 };
@@ -216,6 +228,7 @@ static SwRectFnCollection aVerticalRightToLeft = {
     &SwRect::Height_,
     &SwRect::Width_,
     &SwRect::BottomRight,
+    &SwRect::SwappedSize,
     /* fnRectSet      */
     &SwRect::Left_,
     &SwRect::Rigth_,
@@ -246,6 +259,8 @@ static SwRectFnCollection aVerticalRightToLeft = {
     &SwFrame::GetPrtTop,
     &SwRect::GetLeftDistance,
     &SwRect::GetRightDistance,
+    &SwRect::GetBottomDistance,
+    &SwRect::GetTopDistance,
     &SwFrame::SetMaxRight,
     &SwRect::OverStepRight,
 
@@ -254,6 +269,7 @@ static SwRectFnCollection aVerticalRightToLeft = {
     &FirstMinusSecond,
     &FirstMinusSecond,
     &SwDecrement,
+    &SwIncrement,
     &SwRect::SetBottomAndHeight,
     &SwRect::SetLeftAndWidth
 };
@@ -267,6 +283,7 @@ static SwRectFnCollection aVerticalLeftToRight = {
     &SwRect::Height_,
     &SwRect::Width_,
     &SwRect::TopLeft,
+    &SwRect::SwappedSize,
     /* fnRectSet      */
     &SwRect::Left_,
     &SwRect::Rigth_,
@@ -297,6 +314,8 @@ static SwRectFnCollection aVerticalLeftToRight = {
     &SwFrame::GetPrtBottom,
     &SwRect::GetLeftDistance,
     &SwRect::GetRightDistance,
+    &SwRect::GetTopDistance,
+    &SwRect::GetBottomDistance,
     &SwFrame::SetMaxRight,
     &SwRect::OverStepRight,
 
@@ -305,6 +324,7 @@ static SwRectFnCollection aVerticalLeftToRight = {
     &FirstMinusSecond,
     &FirstMinusSecond,
     &SwIncrement,
+    &SwIncrement,
     &SwRect::SetTopAndHeight,
     &SwRect::SetLeftAndWidth
 };


More information about the Libreoffice-commits mailing list