[Libreoffice-commits] core.git: oox/source reportdesign/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Feb 16 10:39:12 UTC 2018


 oox/source/export/shapes.cxx                    |    4 +-
 reportdesign/source/ui/report/EndMarker.cxx     |    2 -
 reportdesign/source/ui/report/ReportWindow.cxx  |    2 -
 reportdesign/source/ui/report/ScrollHelper.cxx  |    8 ++---
 reportdesign/source/ui/report/SectionWindow.cxx |   10 +++----
 reportdesign/source/ui/report/StartMarker.cxx   |    4 +-
 reportdesign/source/ui/report/ViewsWindow.cxx   |   34 ++++++++++++------------
 reportdesign/source/ui/report/dlgedfunc.cxx     |    4 +-
 8 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 261d422d9e0dc4d36ddfa43180e63286cbb89bf4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Feb 16 08:32:14 2018 +0200

    Revert "loplugin:changetoolsgen in oox,reportdesign" and reapply..
    
    the plugin because I
    (a) forgot to insert parentheses which changes the meaning of some expressions and
    (b) I now use the AdjustFoo calls when changing unary operations, which reads much better
    
    This reverts commit 457220bc2c0142c5b6f4135cb688ccfc99fec792.
    
    Change-Id: I2c6b1092c8bfa4fa14acbc7445f546d43cb2a86e
    Reviewed-on: https://gerrit.libreoffice.org/49833
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 72f2eac304ba..8f374c0d54d1 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -386,9 +386,9 @@ awt::Size ShapeExport::MapSize( const awt::Size& rSize ) const
     Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
 
     if ( !aRetSize.Width() )
-        aRetSize.setWidth( ++aRetSize.Width() );
+        aRetSize.AdjustWidth( 1 );
     if ( !aRetSize.Height() )
-        aRetSize.setHeight( ++aRetSize.Height() );
+        aRetSize.AdjustHeight( 1 );
     return awt::Size( aRetSize.Width(), aRetSize.Height() );
 }
 
diff --git a/reportdesign/source/ui/report/EndMarker.cxx b/reportdesign/source/ui/report/EndMarker.cxx
index fc1f2703f7f6..0e763fce8c24 100644
--- a/reportdesign/source/ui/report/EndMarker.cxx
+++ b/reportdesign/source/ui/report/EndMarker.cxx
@@ -48,7 +48,7 @@ void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl
     const long nCornerSpace = long(aCornerSpace);
 
     Size aSize = GetSizePixel();
-    aSize.setWidth( aSize.Width() + nCornerSpace );
+    aSize.AdjustWidth(nCornerSpace );
     tools::Rectangle aWholeRect(Point(-nCornerSpace,0),aSize);
     tools::PolyPolygon aPoly;
     aPoly.Insert( tools::Polygon(aWholeRect,nCornerSpace,nCornerSpace));
diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx
index 54f5db8c7955..a710f34f62e6 100644
--- a/reportdesign/source/ui/report/ReportWindow.cxx
+++ b/reportdesign/source/ui/report/ReportWindow.cxx
@@ -192,7 +192,7 @@ void OReportWindow::Resize()
         m_aHRuler->SetMargin1(0);
         m_aHRuler->SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin);
 
-        aStartPoint.setY( aStartPoint.Y() + aPageSize.Height() );
+        aStartPoint.AdjustY(aPageSize.Height() );
         nSectionsHeight -= aStartPoint.Y();
 
         aStartPoint.setX( aOffset.X() );
diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx
index d43921fdfb42..12251126cea5 100644
--- a/reportdesign/source/ui/report/ScrollHelper.cxx
+++ b/reportdesign/source/ui/report/ScrollHelper.cxx
@@ -125,7 +125,7 @@ Size OScrollWindowHelper::ResizeScrollBars()
     if ( aOutPixSz.Width() == 0 || aOutPixSz.Height() == 0 )
         return aOutPixSz;
 
-    aOutPixSz.setHeight( aOutPixSz.Height() - m_aReportWindow->getRulerHeight() );
+    aOutPixSz.AdjustHeight( -(m_aReportWindow->getRulerHeight()) );
     // determine the size of the output-area and if we need scrollbars
     const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize();
     bool bVVisible = false; // by default no vertical-ScrollBar
@@ -139,7 +139,7 @@ Size OScrollWindowHelper::ResizeScrollBars()
         if ( aOutPixSz.Width() < m_aTotalPixelSize.Width() && !bHVisible )
         {
             bHVisible = true;
-            aOutPixSz.setHeight( aOutPixSz.Height() - nScrSize );
+            aOutPixSz.AdjustHeight( -nScrSize );
             bChanged = true;
         }
 
@@ -147,14 +147,14 @@ Size OScrollWindowHelper::ResizeScrollBars()
         if ( aOutPixSz.Height() < m_aTotalPixelSize.Height() && !bVVisible )
         {
             bVVisible = true;
-            aOutPixSz.setWidth( aOutPixSz.Width() - nScrSize );
+            aOutPixSz.AdjustWidth( -nScrSize );
             bChanged = true;
         }
 
     }
     while ( bChanged );   // until no visibility has changed
 
-    aOutPixSz.setHeight( aOutPixSz.Height() + m_aReportWindow->getRulerHeight() );
+    aOutPixSz.AdjustHeight(m_aReportWindow->getRulerHeight() );
 
     // show or hide scrollbars
     m_aVScroll->Show( bVVisible );
diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx
index c80d20a364aa..0e98b03e0ae3 100644
--- a/reportdesign/source/ui/report/SectionWindow.cxx
+++ b/reportdesign/source/ui/report/SectionWindow.cxx
@@ -231,7 +231,7 @@ void OSectionWindow::Resize()
     long nEndWidth = long(REPORT_ENDMARKER_WIDTH * GetMapMode().GetScaleX());
 
     const Point aThumbPos = m_pParent->getView()->getThumbPos();
-    aOutputSize.setWidth( aOutputSize.Width() - aThumbPos.X() );
+    aOutputSize.AdjustWidth( -(aThumbPos.X()) );
     aOutputSize.Height() -=  m_aSplitter->GetSizePixel().Height();
 
     if ( m_aStartMarker->isCollapsed() )
@@ -254,19 +254,19 @@ void OSectionWindow::Resize()
         Point aReportPos(nStartWidth,0);
         aSectionSize.setWidth( aOutputSize.Width() - nStartWidth );
         if ( bShowEndMarker )
-            aSectionSize.setWidth( aSectionSize.Width() - nEndWidth );
+            aSectionSize.AdjustWidth( -nEndWidth );
 
         m_aReportSection->SetPosSizePixel(aReportPos,aSectionSize);
 
         // set splitter
-        aReportPos.setY( aReportPos.Y() + aSectionSize.Height() );
+        aReportPos.AdjustY(aSectionSize.Height() );
         m_aSplitter->SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter->GetSizePixel().Height()));
         aSectionSize.setHeight( static_cast<long>(1000 * static_cast<double>(GetMapMode().GetScaleY())) );
         m_aSplitter->SetDragRectPixel( tools::Rectangle(Point(nStartWidth,0),aSectionSize));
 
         // set end marker
-        aReportPos.setX( aReportPos.X() + aSectionSize.Width() );
-        aReportPos.Y() = 0;
+        aReportPos.AdjustX(aSectionSize.Width() );
+        aReportPos.setY( 0 );
         m_aEndMarker->Show(bShowEndMarker);
         m_aEndMarker->SetPosSizePixel(aReportPos,Size(nEndWidth,aOutputSize.Height()));
     }
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index 06b90386d8ec..82f36400ef08 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -114,7 +114,7 @@ void OStartMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
     {
         const long nVRulerWidth = m_aVRuler->GetSizePixel().Width();
         long nSize = aSize.Width() - nVRulerWidth;
-        aSize.setWidth( aSize.Width() + nCornerWidth );
+        aSize.AdjustWidth(nCornerWidth );
         rRenderContext.SetClipRegion(vcl::Region(rRenderContext.PixelToLogic(tools::Rectangle(Point(),
                                                                              Size(nSize, aSize.Height())))));
     }
@@ -240,7 +240,7 @@ void OStartMarker::Resize()
     m_aText->SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight));
 
     aPos.setX( nExtraWidth );
-    aPos.setY( aPos.Y() + static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ) ;
+    aPos.AdjustY(static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ) ;
     m_aImage->SetPosSizePixel(aPos,aImageSize);
 }
 
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 080b74700d8c..224977bc80de 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -204,12 +204,12 @@ void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Poin
         aSectionSize.setHeight( nMinHeight );
     }
     const StyleSettings& rSettings = GetSettings().GetStyleSettings();
-    aSectionSize.setHeight( aSectionSize.Height() + static_cast<long>(rSettings.GetSplitSize() * static_cast<double>(_rSectionWindow.GetMapMode().GetScaleY())) );
+    aSectionSize.AdjustHeight(static_cast<long>(rSettings.GetSplitSize() * static_cast<double>(_rSectionWindow.GetMapMode().GetScaleY())) );
 
     if ( _bSet )
         _rSectionWindow.SetPosSizePixel(_rStartPoint,aSectionSize);
 
-    _rStartPoint.setY( _rStartPoint.Y() + aSectionSize.Height() );
+    _rStartPoint.AdjustY(aSectionSize.Height() );
 }
 
 
@@ -261,7 +261,7 @@ void OViewsWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
     Size aOut(GetOutputSizePixel());
     long nStartWidth = long(REPORT_STARTMARKER_WIDTH * rRenderContext.GetMapMode().GetScaleX());
 
-    aOut.setWidth( aOut.Width() - nStartWidth );
+    aOut.AdjustWidth( -nStartWidth );
     aOut = rRenderContext.PixelToLogic(aOut);
 
     tools::Rectangle aRect(rRenderContext.PixelToLogic(Point(nStartWidth,0)), aOut);
@@ -1023,7 +1023,7 @@ void OViewsWindow::BegDragObj_createInvisibleObjectAtPosition(const tools::Recta
             rView.MarkObj( pNewObj, rView.GetSdrPageView() );
         }
         const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
-        aNewPos.setY( aNewPos.Y() - nSectionHeight );
+        aNewPos.AdjustY( -nSectionHeight );
     }
 }
 
@@ -1045,7 +1045,7 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi
         if (pView == _pSection)
             break;
         const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
-        aAbsolutePnt.setY( aAbsolutePnt.Y() +  nSectionHeight );
+        aAbsolutePnt.AdjustY(nSectionHeight );
     }
     m_aDragDelta = Point(SAL_MAX_INT32, SAL_MAX_INT32);
     SAL_INFO(
@@ -1096,7 +1096,7 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi
         rView.SetWorkArea( aClipRect );
 
         const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
-        aNewObjPos.setY( aNewObjPos.Y() + nSectionHeight );
+        aNewObjPos.AdjustY(nSectionHeight );
     }
 
     const sal_Int32 nDeltaX = std::abs(aLeftTop.X() - aAbsolutePnt.X());
@@ -1128,7 +1128,7 @@ void OViewsWindow::BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionVi
         rReportSection.getSectionView().BegDragObj(aNewPos, nullptr, pHdl, nDrgLog);
 
         const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
-        aNewPos.setY( aNewPos.Y() - nSectionHeight );
+        aNewPos.AdjustY( -nSectionHeight );
     }
 }
 
@@ -1157,11 +1157,11 @@ void OViewsWindow::BegMarkObj(const Point& _aPnt,const OSectionView* _pSection)
         else if ( bAdd )
         {
             const long nSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
-            aNewPos.setY( aNewPos.Y() + nSectionHeight );
+            aNewPos.AdjustY(nSectionHeight );
         }
         else
         {
-            aNewPos.setY( aNewPos.Y() - nLastSectionHeight );
+            aNewPos.AdjustY( -nLastSectionHeight );
         }
         rReportSection.getSectionView().BegMarkObj ( aNewPos );
         nLastSectionHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
@@ -1189,7 +1189,7 @@ OSectionView* OViewsWindow::getSectionRelativeToPosition(const OSectionView* _pS
         {
             OReportSection& rReportSection = (*aIter)->getReportSection();
             const sal_Int32 nHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
-            _rPnt.setY( _rPnt.Y() + nHeight );
+            _rPnt.AdjustY(nHeight );
             if ( (nCount -1) > 0 && (_rPnt.Y() < 0) )
                 --aIter;
         }
@@ -1206,7 +1206,7 @@ OSectionView* OViewsWindow::getSectionRelativeToPosition(const OSectionView* _pS
             const long nHeight = rReportSection.PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
             if ( (_rPnt.Y() - nHeight) < 0  )
                 break;
-            _rPnt.setY( _rPnt.Y() - nHeight );
+            _rPnt.AdjustY( -nHeight );
         }
         if ( aIter != aEnd )
             pSection = &(*aIter)->getReportSection().getSectionView();
@@ -1361,7 +1361,7 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection, b
         if ( &rReportSection.getSectionView() == _pSection )
             break;
         const long nSectionHeight = (*aIter)->PixelToLogic(rReportSection.GetOutputSizePixel()).Height();
-        aCurrentSectionPos.setY( aCurrentSectionPos.Y() + nSectionHeight );
+        aCurrentSectionPos.AdjustY(nSectionHeight );
     }
     aRealMousePos += aCurrentSectionPos;
 
@@ -1386,7 +1386,7 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection, b
             aClipRect.SetTop( -aPosForWorkArea.Y() );
             rView.SetWorkArea( aClipRect );
         }
-        aPosForWorkArea.setY( aPosForWorkArea.Y() + nSectionHeight );
+        aPosForWorkArea.AdjustY(nSectionHeight );
     }
 
 
@@ -1401,7 +1401,7 @@ void OViewsWindow::MovAction(const Point& _aPnt,const OSectionView* _pSection, b
         }
         rReportSection.getSectionView().MovAction ( aRealMousePos );
         const long nSectionHeight = (*aIter)->PixelToLogic((*aIter)->GetOutputSizePixel()).Height();
-        aRealMousePos.setY( aRealMousePos.Y() - nSectionHeight );
+        aRealMousePos.AdjustY( -nSectionHeight );
     }
 }
 
@@ -1491,7 +1491,7 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode)
                 {
                     // restrict movement to work area
                     tools::Rectangle rWorkArea = rView.GetWorkArea();
-                    rWorkArea.SetRight( ++rWorkArea.Right() );
+                    rWorkArea.AdjustRight( 1 );
 
                     if ( !rWorkArea.IsEmpty() )
                     {
@@ -1618,8 +1618,8 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode)
                             case SdrHdlKind::UpperLeft:
                             case SdrHdlKind::LowerLeft:
                             case SdrHdlKind::Upper:
-                                aNewRect.SetLeft( aNewRect.Left() + nX );
-                                aNewRect.SetTop( aNewRect.Top() + nY );
+                                aNewRect.AdjustLeft(nX );
+                                aNewRect.AdjustTop(nY );
                                 break;
                             case SdrHdlKind::UpperRight:
                             case SdrHdlKind::Right:
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index 1f81381d3619..4ce3b25da416 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -77,7 +77,7 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
     Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH));
     aStartWidth *= m_pParent->GetMapMode().GetScaleX();
 
-    aOut.setWidth( aOut.Width() - static_cast<long>(aStartWidth) );
+    aOut.AdjustWidth( -static_cast<long>(aStartWidth) );
     aOut.Height() = m_pParent->GetOutputSizePixel().Height();
 
     Point aPos = pScrollWindow->getThumbPos();
@@ -86,7 +86,7 @@ void DlgEdFunc::ForceScroll( const Point& rPos )
     tools::Rectangle aOutRect( aPos, aOut );
     aOutRect = m_pParent->PixelToLogic( aOutRect );
     tools::Rectangle aWorkArea(Point(), pScrollWindow->getTotalSize());
-    aWorkArea.SetRight( aWorkArea.Right() - static_cast<long>(aStartWidth) );
+    aWorkArea.AdjustRight( -static_cast<long>(aStartWidth) );
     aWorkArea = pScrollWindow->PixelToLogic( aWorkArea );
     if( !aOutRect.IsInside( rPos ) && aWorkArea.IsInside( rPos ) )
     {


More information about the Libreoffice-commits mailing list