Kaydet (Commit) 261d422d authored tarafından Noel Grandin's avatar Noel Grandin

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 457220bc.

Change-Id: I2c6b1092c8bfa4fa14acbc7445f546d43cb2a86e
Reviewed-on: https://gerrit.libreoffice.org/49833Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 0e687595
......@@ -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() );
}
......
......@@ -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));
......
......@@ -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() );
......
......@@ -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 );
......
......@@ -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()));
}
......
......@@ -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);
}
......
......@@ -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:
......
......@@ -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 ) )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment