From bddd6c77811e0489a5632437116f5eec356cc397 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 16 Feb 2018 13:01:37 +0200 Subject: Revert "loplugin:changetoolsgen in avmedia..basic" and reapply 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 1adb1a320a7e9832a41545bde13fd59d27ce7954. Change-Id: I52924b35008c8e4b44c8a6b6657cc3a1ac513886 Reviewed-on: https://gerrit.libreoffice.org/49848 Tested-by: Jenkins Reviewed-by: Noel Grandin --- basctl/source/basicide/baside2.cxx | 10 +++++----- basctl/source/basicide/baside2b.cxx | 18 +++++++++--------- basctl/source/basicide/basides1.cxx | 6 +++--- basctl/source/basicide/objdlg.cxx | 4 ++-- basctl/source/dlged/dlged.cxx | 24 ++++++++++++------------ basctl/source/dlged/dlgedobj.cxx | 24 ++++++++++++------------ basctl/source/dlged/propbrw.cxx | 8 ++++---- 7 files changed, 47 insertions(+), 47 deletions(-) (limited to 'basctl') diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 43d7d0fd9f19..7edd29b9bbb7 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -131,7 +131,7 @@ void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, { aFont.SetWeight( WEIGHT_NORMAL ); pPrinter->SetFont( aFont ); - aPos.setX( aPos.X() + pPrinter->GetTextWidth( rTitle ) ); + aPos.AdjustX(pPrinter->GetTextWidth( rTitle ) ); if( bOutput ) { @@ -810,8 +810,8 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) } Size aPaperSz = pPrinter->GetOutputSize(); - aPaperSz.setWidth( aPaperSz.Width() - (Print::nLeftMargin + Print::nRightMargin) ); - aPaperSz.setHeight( aPaperSz.Height() - (Print::nTopMargin + Print::nBottomMargin) ); + aPaperSz.AdjustWidth( -(Print::nLeftMargin + Print::nRightMargin) ); + aPaperSz.AdjustHeight( -(Print::nTopMargin + Print::nBottomMargin) ); // nLinepPage is not correct if there's a line break sal_Int32 nLinespPage = aPaperSz.Height()/nLineHeight; @@ -835,7 +835,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) sal_Int32 nBeginIndex = nLine*nCharspLine; sal_Int32 nCopyCount = std::min(nCharspLine, aLine.getLength()-nBeginIndex); OUString aTmpLine = aLine.copy(nBeginIndex, nCopyCount); - aPos.setY( aPos.Y() + nLineHeight ); + aPos.AdjustY(nLineHeight ); if ( aPos.Y() > ( aPaperSz.Height() + Print::nTopMargin ) ) { nCurPage++; @@ -845,7 +845,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage ) if( nCurPage-1 == nPrintPage ) pPrinter->DrawText( aPos, aTmpLine ); } - aPos.setY( aPos.Y() + 10 ); // nParaSpace + aPos.AdjustY(10 ); // nParaSpace } pPrinter->SetFont( aOldFont ); diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 2e5ec45676bd..3f81bde3bb5a 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -372,8 +372,8 @@ void EditorWindow::RequestHelp( const HelpEvent& rHEvt ) { aTopLeft = GetEditView()->GetTextEngine()->PaMtoEditCursor( aStartOfWord ).BottomLeft(); aTopLeft = GetEditView()->GetWindowPos( aTopLeft ); - aTopLeft.setX( aTopLeft.X() + 5 ); - aTopLeft.setY( aTopLeft.Y() + 5 ); + aTopLeft.AdjustX(5 ); + aTopLeft.AdjustY(5 ); aTopLeft = OutputToScreenPixel( aTopLeft ); } } @@ -1571,8 +1571,8 @@ WatchWindow::WatchWindow (Layout* pParent) aRemoveWatchButton->SetModeImage(Image(BitmapEx(RID_BMP_REMOVEWATCH))); aRemoveWatchButton->SetQuickHelpText(IDEResId(RID_STR_REMOVEWATCHTIP)); Size aSz( aRemoveWatchButton->GetModeImage().GetSizePixel() ); - aSz.setWidth( aSz.Width() + 6 ); - aSz.setHeight( aSz.Height() + 6 ); + aSz.AdjustWidth(6 ); + aSz.AdjustHeight(6 ); aRemoveWatchButton->SetSizePixel( aSz ); aRemoveWatchButton->Show(); @@ -1656,7 +1656,7 @@ void WatchWindow::Resize() if ( aBoxSz.Height() < 4 ) aBoxSz.setHeight( 0 ); - aBoxSz.setHeight( aBoxSz.Height() - nHeaderBarHeight ); + aBoxSz.AdjustHeight( -nHeaderBarHeight ); aTreeListBox->SetSizePixel( aBoxSz ); aTreeListBox->GetHScroll()->SetPageSize( aTreeListBox->GetHScroll()->GetVisibleSize() ); @@ -1991,8 +1991,8 @@ void ComplexEditorWindow::Resize() { Size aOutSz = GetOutputSizePixel(); Size aSz(aOutSz); - aSz.setWidth( aSz.Width() - 2*DWBORDER ); - aSz.setHeight( aSz.Height() - 2*DWBORDER ); + aSz.AdjustWidth( -(2*DWBORDER) ); + aSz.AdjustHeight( -(2*DWBORDER) ); long nBrkWidth = 20; long nSBWidth = aEWVScrollBar->GetSizePixel().Width(); @@ -2844,12 +2844,12 @@ void CodeCompleteWindow::ResizeAndPositionListBox() if( aVisArea.TopRight().getY() + aPos.getY() + aSize.getHeight() > aBottomPoint.getY() ) {//clipped at the bottom: move it up const long& nParentFontHeight = pParent->GetEditEngine()->GetFont().GetFontHeight(); //parent's font (in the IDE): needed for height - aPos.setY( aPos.Y() - aSize.getHeight() + nParentFontHeight + nCursorPad ); + aPos.AdjustY( -(aSize.getHeight() + nParentFontHeight + nCursorPad) ); } if( aVisArea.TopLeft().getX() + aPos.getX() + aSize.getWidth() > aBottomPoint.getX() ) {//clipped at the right side, move it a bit left - aPos.setX( aPos.X() - aSize.getWidth() + aVisArea.TopLeft().getX() ); + aPos.AdjustX( -(aSize.getWidth() + aVisArea.TopLeft().getX()) ); } //set the position SetPosPixel( aPos ); diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index c79557501913..b78f9138bf32 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -1247,11 +1247,11 @@ void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize ) Size aSz( rSize ); Size aScrollBarBoxSz( aScrollBarBox->GetSizePixel() ); - aSz.setHeight( aSz.Height() - aScrollBarBoxSz.Height() ); - aSz.setHeight( aSz.Height() - aTabBarSize.Height() ); + aSz.AdjustHeight( -(aScrollBarBoxSz.Height()) ); + aSz.AdjustHeight( -(aTabBarSize.Height()) ); Size aOutSz( aSz ); - aSz.setWidth( aSz.Width() - aScrollBarBoxSz.Width() ); + aSz.AdjustWidth( -(aScrollBarBoxSz.Width()) ); aScrollBarBox->SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) ); aVScrollBar->SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) ); aHScrollBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width(), aScrollBarBoxSz.Height() ) ); diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx index d5775b6278c0..34846e67e1fa 100644 --- a/basctl/source/basicide/objdlg.cxx +++ b/basctl/source/basicide/objdlg.cxx @@ -58,8 +58,8 @@ ObjectCatalog::ObjectCatalog (vcl::Window* pParent) Point aPos = rParent.OutputToScreenPixel(Point(0, 0)); Size const aParentSize = rParent.GetSizePixel(); Size const aSize = GetSizePixel(); - aPos.setX( aPos.X() + (aParentSize.Width() - aSize.Width()) / 2 ); - aPos.setY( aPos.Y() + (aParentSize.Height() - aSize.Height()) / 2 ); + aPos.AdjustX((aParentSize.Width() - aSize.Width()) / 2 ); + aPos.AdjustY((aParentSize.Height() - aSize.Height()) / 2 ); SetPosPixel(aPos); } diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 397a1bc69f75..dc01d9abde64 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -493,8 +493,8 @@ void DlgEditor::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle // align with grid Size aGridSize_(long(pDlgEdView->GetSnapGridWidthX()), long(pDlgEdView->GetSnapGridWidthY())); - aSize.setWidth( aSize.Width() - aSize.Width() % aGridSize_.Width() ); - aSize.setHeight( aSize.Height() - aSize.Height() % aGridSize_.Height() ); + aSize.AdjustWidth( -(aSize.Width() % aGridSize_.Width()) ); + aSize.AdjustHeight( -(aSize.Height() % aGridSize_.Height()) ); Point aPos; Size aOutSize = rRenderContext.GetOutputSize(); @@ -502,16 +502,16 @@ void DlgEditor::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle aPos.setY( (aOutSize.Height()>>1) - (aSize.Height()>>1) ); // align with grid - aPos.setX( aPos.X() - aPos.X() % aGridSize_.Width() ); - aPos.setY( aPos.Y() - aPos.Y() % aGridSize_.Height() ); + aPos.AdjustX( -(aPos.X() % aGridSize_.Width()) ); + aPos.AdjustY( -(aPos.Y() % aGridSize_.Height()) ); // don't put in the corner Point aMinPos = rRenderContext.PixelToLogic( Point( 30, 20 ) ); if( (aPos.X() < aMinPos.X()) || (aPos.Y() < aMinPos.Y()) ) { aPos = aMinPos; - aPos.setX( aPos.X() - aPos.X() % aGridSize_.Width() ); - aPos.setY( aPos.Y() - aPos.Y() % aGridSize_.Height() ); + aPos.AdjustX( -(aPos.X() % aGridSize_.Width()) ); + aPos.AdjustY( -(aPos.Y() % aGridSize_.Height()) ); } // set dialog position and size @@ -617,8 +617,8 @@ void DlgEditor::CreateDefaultObject() // set position and size Size aSize = rWindow.PixelToLogic( Size( 96, 24 ) ); Point aPoint = pDlgEdForm->GetSnapRect().Center(); - aPoint.setX( aPoint.X() - aSize.Width() / 2 ); - aPoint.setY( aPoint.Y() - aSize.Height() / 2 ); + aPoint.AdjustX( -(aSize.Width() / 2) ); + aPoint.AdjustY( -(aSize.Height() / 2) ); pDlgEdObj->SetSnapRect( tools::Rectangle( aPoint, aSize ) ); // set default property values @@ -1156,8 +1156,8 @@ void DlgEditor::Print( Printer* pPrinter, const OUString& rTitle ) // not wor pPrinter->SetFont( aFont ); Size aPaperSz = pPrinter->GetOutputSize(); - aPaperSz.setWidth( aPaperSz.Width() - (Print::nLeftMargin + Print::nRightMargin) ); - aPaperSz.setHeight( aPaperSz.Height() - (Print::nTopMargin + Print::nBottomMargin) ); + aPaperSz.AdjustWidth( -(Print::nLeftMargin + Print::nRightMargin) ); + aPaperSz.AdjustHeight( -(Print::nTopMargin + Print::nBottomMargin) ); lcl_PrintHeader( pPrinter, rTitle ); @@ -1186,8 +1186,8 @@ void DlgEditor::Print( Printer* pPrinter, const OUString& rTitle ) // not wor (aPaperSz.Width() / 2) - (aOutputSz.Width() / 2), (aPaperSz.Height()/ 2) - (aOutputSz.Height() / 2)); - aPosOffs.setX( aPosOffs.X() + Print::nLeftMargin ); - aPosOffs.setY( aPosOffs.Y() + Print::nTopMargin ); + aPosOffs.AdjustX(Print::nLeftMargin ); + aPosOffs.AdjustY(Print::nTopMargin ); pPrinter->DrawBitmap( aPosOffs, aOutputSz, aDlg ); diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index d14f49fcdc9f..6eecc246a849 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -140,8 +140,8 @@ bool DlgEdObj::TransformSdrToControlCoordinates( aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MapUnit::Map100thMM ) ); // subtract form position - aPos.setWidth( aPos.Width() - aFormPos.Width() ); - aPos.setHeight( aPos.Height() - aFormPos.Height() ); + aPos.AdjustWidth( -(aFormPos.Width()) ); + aPos.AdjustHeight( -(aFormPos.Height()) ); // take window borders into account Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY ); @@ -153,8 +153,8 @@ bool DlgEdObj::TransformSdrToControlCoordinates( if( bDecoration ) { awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo(); - aPos.setWidth( aPos.Width() - aDeviceInfo.LeftInset ); - aPos.setHeight( aPos.Height() - aDeviceInfo.TopInset ); + aPos.AdjustWidth( -(aDeviceInfo.LeftInset) ); + aPos.AdjustHeight( -(aDeviceInfo.TopInset) ); } // convert pixel to logic units @@ -201,8 +201,8 @@ bool DlgEdObj::TransformSdrToFormCoordinates( if( bDecoration ) { awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo(); - aSize.setWidth( aSize.Width() - aDeviceInfo.LeftInset + aDeviceInfo.RightInset ); - aSize.setHeight( aSize.Height() - aDeviceInfo.TopInset + aDeviceInfo.BottomInset ); + aSize.AdjustWidth( -(aDeviceInfo.LeftInset + aDeviceInfo.RightInset) ); + aSize.AdjustHeight( -(aDeviceInfo.TopInset + aDeviceInfo.BottomInset) ); } // convert pixel to logic units aPos = pDevice->PixelToLogic(aPos, MapMode(MapUnit::MapAppFont)); @@ -251,8 +251,8 @@ bool DlgEdObj::TransformControlToSdrCoordinates( aFormPos = pDevice->LogicToPixel(aFormPos, MapMode(MapUnit::MapAppFont)); // add form position - aPos.setWidth( aPos.Width() + aFormPos.Width() ); - aPos.setHeight( aPos.Height() + aFormPos.Height() ); + aPos.AdjustWidth(aFormPos.Width() ); + aPos.AdjustHeight(aFormPos.Height() ); // take window borders into account bool bDecoration = true; @@ -260,8 +260,8 @@ bool DlgEdObj::TransformControlToSdrCoordinates( if( bDecoration ) { awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo(); - aPos.setWidth( aPos.Width() + aDeviceInfo.LeftInset ); - aPos.setHeight( aPos.Height() + aDeviceInfo.TopInset ); + aPos.AdjustWidth(aDeviceInfo.LeftInset ); + aPos.AdjustHeight(aDeviceInfo.TopInset ); } // convert pixel to 100th_mm @@ -309,8 +309,8 @@ bool DlgEdObj::TransformFormToSdrCoordinates( if( bDecoration ) { awt::DeviceInfo aDeviceInfo = pForm->getDeviceInfo(); - aSize.setWidth( aSize.Width() + aDeviceInfo.LeftInset + aDeviceInfo.RightInset ); - aSize.setHeight( aSize.Height() + aDeviceInfo.TopInset + aDeviceInfo.BottomInset ); + aSize.AdjustWidth(aDeviceInfo.LeftInset + aDeviceInfo.RightInset ); + aSize.AdjustHeight(aDeviceInfo.TopInset + aDeviceInfo.BottomInset ); } // convert pixel to 100th_mm diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index 963674da5f7f..cbf3e47b70ed 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -156,8 +156,8 @@ void PropBrw::ImplReCreateController() Point aPropWinPos = Point( WIN_BORDER, WIN_BORDER ); Size aPropWinSize(STD_WIN_SIZE_X,STD_WIN_SIZE_Y); - aPropWinSize.setWidth( aPropWinSize.Width() - (2*WIN_BORDER) ); - aPropWinSize.setHeight( aPropWinSize.Height() - (2*WIN_BORDER) ); + aPropWinSize.AdjustWidth( -(2*WIN_BORDER) ); + aPropWinSize.AdjustHeight( -(2*WIN_BORDER) ); if ( m_xBrowserComponentWindow.is() ) { @@ -426,8 +426,8 @@ void PropBrw::Resize() // adjust size Size aSize_ = GetOutputSizePixel(); Size aPropWinSize( aSize_ ); - aPropWinSize.setWidth( aPropWinSize.Width() - (2*WIN_BORDER) ); - aPropWinSize.setHeight( aPropWinSize.Height() - (2*WIN_BORDER) ); + aPropWinSize.AdjustWidth( -(2*WIN_BORDER) ); + aPropWinSize.AdjustHeight( -(2*WIN_BORDER) ); if (m_xBrowserComponentWindow.is()) { -- cgit