summaryrefslogtreecommitdiff
path: root/vcl/source/control/button.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-21 15:56:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-22 20:18:57 +0100
commit4a8968039a2e1d9e7aee10433ced1f59c0392d7a (patch)
tree7074b5b4a94b5d509487872b8201bc5872dc107e /vcl/source/control/button.cxx
parent1d7f96a324a4c2ab82a04513c6a38dc31fd061fa (diff)
loplugin:changetoolsgen in vcl
Change-Id: I0fc68cf51fb23ed9bb86a5087e8247c81b024494 Reviewed-on: https://gerrit.libreoffice.org/50107 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/control/button.cxx')
-rw-r--r--vcl/source/control/button.cxx398
1 files changed, 199 insertions, 199 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 249f8be08aec..4b6ff1ddc3a5 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -257,8 +257,8 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
nTextStyle &= ~DrawTextFlags::Mnemonic;
}
- aImageSize.Width() = CalcZoom( aImageSize.Width() );
- aImageSize.Height() = CalcZoom( aImageSize.Height() );
+ aImageSize.setWidth( CalcZoom( aImageSize.Width() ) );
+ aImageSize.setHeight( CalcZoom( aImageSize.Height() ) );
// Drawing text or symbol only is simple, use style and output rectangle
if (bHasSymbol && !bDrawImage && !bDrawText)
@@ -308,16 +308,16 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
aSymbol = tools::Rectangle(Point(), Size(nSymbolHeight, nSymbolHeight));
ImplCalcSymbolRect(aSymbol);
- aRect.Left() += 3 * nSymbolHeight / 2;
- aTSSize.Width() = 3 * nSymbolHeight / 2;
+ aRect.AdjustLeft(3 * nSymbolHeight / 2 );
+ aTSSize.setWidth( 3 * nSymbolHeight / 2 );
}
else
{
aSymbol = tools::Rectangle(Point(), rSize);
ImplCalcSymbolRect(aSymbol);
- aTSSize.Width() = aSymbol.GetWidth();
+ aTSSize.setWidth( aSymbol.GetWidth() );
}
- aTSSize.Height() = aSymbol.GetHeight();
+ aTSSize.setHeight( aSymbol.GetHeight() );
aSymbolSize = aSymbol.GetSize();
}
@@ -330,7 +330,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
(eImageAlign == ImageAlign::Right) ||
(eImageAlign == ImageAlign::RightBottom))
{
- aRect.Right() -= (aImageSize.Width() + nImageSep);
+ aRect.AdjustRight( -sal_Int32(aImageSize.Width() + nImageSep) );
}
else if ((eImageAlign == ImageAlign::TopLeft) ||
(eImageAlign == ImageAlign::Top) ||
@@ -339,16 +339,16 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
(eImageAlign == ImageAlign::Bottom) ||
(eImageAlign == ImageAlign::BottomRight))
{
- aRect.Bottom() -= (aImageSize.Height() + nImageSep);
+ aRect.AdjustBottom( -sal_Int32(aImageSize.Height() + nImageSep) );
}
aRect = GetControlTextRect(*pDev, aRect, aText, nTextStyle, &aDeviceTextSize);
aTextSize = aRect.GetSize();
- aTSSize.Width() += aTextSize.Width();
+ aTSSize.AdjustWidth(aTextSize.Width() );
if (aTSSize.Height() < aTextSize.Height())
- aTSSize.Height() = aTextSize.Height();
+ aTSSize.setHeight( aTextSize.Height() );
if (bAddImageSep && bDrawImage)
{
@@ -358,66 +358,66 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
}
}
- aMax.Width() = std::max(aTSSize.Width(), aImageSize.Width());
- aMax.Height() = std::max(aTSSize.Height(), aImageSize.Height());
+ aMax.setWidth( std::max(aTSSize.Width(), aImageSize.Width()) );
+ aMax.setHeight( std::max(aTSSize.Height(), aImageSize.Height()) );
// Now calculate the output area for the image and the text according to the image align flags
if ((eImageAlign == ImageAlign::Left) ||
(eImageAlign == ImageAlign::Right))
{
- aImagePos.Y() = rPos.Y() + (aMax.Height() - aImageSize.Height()) / 2;
- aTextPos.Y() = rPos.Y() + (aMax.Height() - aTSSize.Height()) / 2;
+ aImagePos.setY( rPos.Y() + (aMax.Height() - aImageSize.Height()) / 2 );
+ aTextPos.setY( rPos.Y() + (aMax.Height() - aTSSize.Height()) / 2 );
}
else if ((eImageAlign == ImageAlign::LeftBottom) ||
(eImageAlign == ImageAlign::RightBottom))
{
- aImagePos.Y() = rPos.Y() + aMax.Height() - aImageSize.Height();
- aTextPos.Y() = rPos.Y() + aMax.Height() - aTSSize.Height();
+ aImagePos.setY( rPos.Y() + aMax.Height() - aImageSize.Height() );
+ aTextPos.setY( rPos.Y() + aMax.Height() - aTSSize.Height() );
}
else if ((eImageAlign == ImageAlign::Top) ||
(eImageAlign == ImageAlign::Bottom))
{
- aImagePos.X() = rPos.X() + (aMax.Width() - aImageSize.Width()) / 2;
- aTextPos.X() = rPos.X() + (aMax.Width() - aTSSize.Width()) / 2;
+ aImagePos.setX( rPos.X() + (aMax.Width() - aImageSize.Width()) / 2 );
+ aTextPos.setX( rPos.X() + (aMax.Width() - aTSSize.Width()) / 2 );
}
else if ((eImageAlign == ImageAlign::TopRight) ||
(eImageAlign == ImageAlign::BottomRight))
{
- aImagePos.X() = rPos.X() + aMax.Width() - aImageSize.Width();
- aTextPos.X() = rPos.X() + aMax.Width() - aTSSize.Width();
+ aImagePos.setX( rPos.X() + aMax.Width() - aImageSize.Width() );
+ aTextPos.setX( rPos.X() + aMax.Width() - aTSSize.Width() );
}
if ((eImageAlign == ImageAlign::LeftTop) ||
(eImageAlign == ImageAlign::Left) ||
(eImageAlign == ImageAlign::LeftBottom))
{
- aTextPos.X() = rPos.X() + aImageSize.Width() + nImageSep;
+ aTextPos.setX( rPos.X() + aImageSize.Width() + nImageSep );
}
else if ((eImageAlign == ImageAlign::RightTop) ||
(eImageAlign == ImageAlign::Right) ||
(eImageAlign == ImageAlign::RightBottom))
{
- aImagePos.X() = rPos.X() + aTSSize.Width() + nImageSep;
+ aImagePos.setX( rPos.X() + aTSSize.Width() + nImageSep );
}
else if ((eImageAlign == ImageAlign::TopLeft) ||
(eImageAlign == ImageAlign::Top) ||
(eImageAlign == ImageAlign::TopRight))
{
- aTextPos.Y() = rPos.Y() + aImageSize.Height() + nImageSep;
+ aTextPos.setY( rPos.Y() + aImageSize.Height() + nImageSep );
}
else if ((eImageAlign == ImageAlign::BottomLeft) ||
(eImageAlign == ImageAlign::Bottom) ||
(eImageAlign == ImageAlign::BottomRight))
{
- aImagePos.Y() = rPos.Y() + aTSSize.Height() + nImageSep;
+ aImagePos.setY( rPos.Y() + aTSSize.Height() + nImageSep );
}
else if (eImageAlign == ImageAlign::Center)
{
- aImagePos.X() = rPos.X() + (aMax.Width() - aImageSize.Width()) / 2;
- aImagePos.Y() = rPos.Y() + (aMax.Height() - aImageSize.Height()) / 2;
- aTextPos.X() = rPos.X() + (aMax.Width() - aTSSize.Width()) / 2;
- aTextPos.Y() = rPos.Y() + (aMax.Height() - aTSSize.Height()) / 2;
+ aImagePos.setX( rPos.X() + (aMax.Width() - aImageSize.Width()) / 2 );
+ aImagePos.setY( rPos.Y() + (aMax.Height() - aImageSize.Height()) / 2 );
+ aTextPos.setX( rPos.X() + (aMax.Width() - aTSSize.Width()) / 2 );
+ aTextPos.setY( rPos.Y() + (aMax.Height() - aTSSize.Height()) / 2 );
}
aUnion = tools::Rectangle(aImagePos, aImageSize);
aUnion.Union(tools::Rectangle(aTextPos, aTSSize));
@@ -450,15 +450,15 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
if (nXOffset < 0) nXOffset = 0;
if (nYOffset < 0) nYOffset = 0;
- aImagePos.X() += nXOffset;
- aImagePos.Y() += nYOffset;
- aTextPos.X() += nXOffset;
- aTextPos.Y() += nYOffset;
+ aImagePos.AdjustX(nXOffset );
+ aImagePos.AdjustY(nYOffset );
+ aTextPos.AdjustX(nXOffset );
+ aTextPos.AdjustY(nYOffset );
// set rPos and rSize to the union
rSize = aUnion.GetSize();
- rPos.X() += nXOffset;
- rPos.Y() += nYOffset;
+ rPos.AdjustX(nXOffset );
+ rPos.AdjustY(nYOffset );
if (bHasSymbol)
{
@@ -470,7 +470,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
else
{
*pSymbolRect = tools::Rectangle(aTextPos, aSymbolSize);
- aTextPos.X() += 3 * nSymbolHeight / 2;
+ aTextPos.AdjustX(3 * nSymbolHeight / 2 );
}
if (mpButtonData->mbSmallSymbol)
{
@@ -511,20 +511,20 @@ void Button::ImplSetFocusRect(const tools::Rectangle &rFocusRect)
if (!aFocusRect.IsEmpty())
{
- aFocusRect.Left()--;
- aFocusRect.Top()--;
- aFocusRect.Right()++;
- aFocusRect.Bottom()++;
+ aFocusRect.AdjustLeft( -1 );
+ aFocusRect.AdjustTop( -1 );
+ aFocusRect.AdjustRight( 1 );
+ aFocusRect.AdjustBottom( 1 );
}
if (aFocusRect.Left() < aOutputRect.Left())
- aFocusRect.Left() = aOutputRect.Left();
+ aFocusRect.SetLeft( aOutputRect.Left() );
if (aFocusRect.Top() < aOutputRect.Top())
- aFocusRect.Top() = aOutputRect.Top();
+ aFocusRect.SetTop( aOutputRect.Top() );
if (aFocusRect.Right() > aOutputRect.Right())
- aFocusRect.Right() = aOutputRect.Right();
+ aFocusRect.SetRight( aOutputRect.Right() );
if (aFocusRect.Bottom() > aOutputRect.Bottom())
- aFocusRect.Bottom() = aOutputRect.Bottom();
+ aFocusRect.SetBottom( aOutputRect.Bottom() );
mpButtonData->maFocusRect = aFocusRect;
}
@@ -868,11 +868,11 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl
long nSymbolSize = pDev->GetTextHeight() / 2 + 1;
nSeparatorX = aInRect.Right() - 2*nSymbolSize;
- aSize.Width() -= 2*nSymbolSize;
+ aSize.AdjustWidth( -(2*nSymbolSize) );
// center symbol rectangle in the separated area
- aSymbolRect.Right() -= nSymbolSize/2;
- aSymbolRect.Left() = aSymbolRect.Right() - nSymbolSize;
+ aSymbolRect.AdjustRight( -(nSymbolSize/2) );
+ aSymbolRect.SetLeft( aSymbolRect.Right() - nSymbolSize );
ImplDrawAlignedImage( pDev, aPos, aSize, nImageSep,
nDrawFlags, nTextStyle, nullptr, true );
@@ -1064,10 +1064,10 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
//ImplDrawPushButtonFrame( &aWin, aInRect, nButtonStyle & ~DrawButtonFlags::Pressed );
// looks better this way as symbols were displaced slightly using the above approach
- aInRect.Top()+=4;
- aInRect.Bottom()-=4;
- aInRect.Left()+=4;
- aInRect.Right()-=4;
+ aInRect.AdjustTop(4 );
+ aInRect.AdjustBottom( -4 );
+ aInRect.AdjustLeft(4 );
+ aInRect.AdjustRight( -4 );
// prepare single line hint (needed on mac to decide between normal push button and
// rectangular bevel button look)
@@ -1102,10 +1102,10 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
tools::Rectangle aTempRect(aInRect);
if (bRollOver)
ImplDrawPushButtonFrame(rRenderContext, aTempRect, nButtonStyle);
- aInRect.Left() += 2;
- aInRect.Top() += 2;
- aInRect.Right() -= 2;
- aInRect.Bottom() -= 2;
+ aInRect.AdjustLeft(2 );
+ aInRect.AdjustTop(2 );
+ aInRect.AdjustRight( -2 );
+ aInRect.AdjustBottom( -2 );
}
else
{
@@ -1157,8 +1157,8 @@ void PushButton::ImplSetDefButton( bool bSet )
{
// adjust pos/size when toggling from non-default to default
aPos.Move(-dLeft, -dTop);
- aSize.Width() += dLeft + dRight;
- aSize.Height() += dTop + dBottom;
+ aSize.AdjustWidth(dLeft + dRight );
+ aSize.AdjustHeight(dTop + dBottom );
}
ImplGetButtonState() |= DrawButtonFlags::Default;
}
@@ -1168,8 +1168,8 @@ void PushButton::ImplSetDefButton( bool bSet )
{
// adjust pos/size when toggling from default to non-default
aPos.Move(dLeft, dTop);
- aSize.Width() -= dLeft + dRight;
- aSize.Height() -= dTop + dBottom;
+ aSize.AdjustWidth( -(dLeft + dRight) );
+ aSize.AdjustHeight( -(dTop + dBottom) );
}
ImplGetButtonState() &= ~DrawButtonFlags::Default;
}
@@ -1635,21 +1635,21 @@ Size PushButton::CalcMinimumSize() const
mnDDStyle == PushButtonDropdownStyle::SplitMenuButton )
{
long nSymbolSize = GetTextHeight() / 2 + 1;
- aSize.Width() += 2*nSymbolSize;
+ aSize.AdjustWidth(2*nSymbolSize );
}
if ( !PushButton::GetText().isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
{
Size textSize = GetTextRect( tools::Rectangle( Point(), Size( 0x7fffffff, 0x7fffffff ) ),
PushButton::GetText(), ImplGetTextStyle( DrawFlags::NONE ) ).GetSize();
- aSize.Width() += textSize.Width();
- aSize.Height() = std::max( aSize.Height(), long( textSize.Height() * 1.15 ) );
+ aSize.AdjustWidth(textSize.Width() );
+ aSize.setHeight( std::max( aSize.Height(), long( textSize.Height() * 1.15 ) ) );
}
// cf. ImplDrawPushButton ...
if( (GetStyle() & WB_SMALLSTYLE) == 0 )
{
- aSize.Width() += 24;
- aSize.Height() += 12;
+ aSize.AdjustWidth(24 );
+ aSize.AdjustHeight(12 );
}
return CalcWindowSize( aSize );
@@ -1943,13 +1943,13 @@ void RadioButton::ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext)
Size aImageSize = maImage.GetSizePixel();
bool bEnabled = IsEnabled();
- aImageSize.Width() = CalcZoom(aImageSize.Width());
- aImageSize.Height() = CalcZoom(aImageSize.Height());
+ aImageSize.setWidth( CalcZoom(aImageSize.Width()) );
+ aImageSize.setHeight( CalcZoom(aImageSize.Height()) );
- aImageRect.Left()++;
- aImageRect.Top()++;
- aImageRect.Right()--;
- aImageRect.Bottom()--;
+ aImageRect.AdjustLeft( 1 );
+ aImageRect.AdjustTop( 1 );
+ aImageRect.AdjustRight( -1 );
+ aImageRect.AdjustBottom( -1 );
// display border and selection status
aImageRect = aDecoView.DrawFrame(aImageRect, DrawFrameStyle::DoubleIn);
@@ -1968,17 +1968,17 @@ void RadioButton::ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext)
Image* pImage = &maImage;
Point aImagePos(aImageRect.TopLeft());
- aImagePos.X() += (aImageRect.GetWidth() - aImageSize.Width()) / 2;
- aImagePos.Y() += (aImageRect.GetHeight() - aImageSize.Height()) / 2;
+ aImagePos.AdjustX((aImageRect.GetWidth() - aImageSize.Width()) / 2 );
+ aImagePos.AdjustY((aImageRect.GetHeight() - aImageSize.Height()) / 2 );
if (IsZoom())
rRenderContext.DrawImage(aImagePos, aImageSize, *pImage, nImageStyle);
else
rRenderContext.DrawImage(aImagePos, *pImage, nImageStyle);
- aImageRect.Left()++;
- aImageRect.Top()++;
- aImageRect.Right()--;
- aImageRect.Bottom()--;
+ aImageRect.AdjustLeft( 1 );
+ aImageRect.AdjustTop( 1 );
+ aImageRect.AdjustRight( -1 );
+ aImageRect.AdjustBottom( -1 );
ImplSetFocusRect(aImageRect);
@@ -1988,16 +1988,16 @@ void RadioButton::ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext)
rRenderContext.SetFillColor();
if ((aImageSize.Width() >= 20) || (aImageSize.Height() >= 20))
{
- aImageRect.Left()++;
- aImageRect.Top()++;
- aImageRect.Right()--;
- aImageRect.Bottom()--;
+ aImageRect.AdjustLeft( 1 );
+ aImageRect.AdjustTop( 1 );
+ aImageRect.AdjustRight( -1 );
+ aImageRect.AdjustBottom( -1 );
}
rRenderContext.DrawRect(aImageRect);
- aImageRect.Left()++;
- aImageRect.Top()++;
- aImageRect.Right()--;
- aImageRect.Bottom()--;
+ aImageRect.AdjustLeft( 1 );
+ aImageRect.AdjustTop( 1 );
+ aImageRect.AdjustRight( -1 );
+ aImageRect.AdjustBottom( -1 );
rRenderContext.DrawRect(aImageRect);
}
@@ -2029,8 +2029,8 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() );
Size aSize( rSize );
Point aPos( rPos );
- aPos.X() += rImageSize.Width() + nImageSep;
- aSize.Width() -= rImageSize.Width() + nImageSep;
+ aPos.AdjustX(rImageSize.Width() + nImageSep );
+ aSize.AdjustWidth( -(rImageSize.Width() + nImageSep) );
// if the text rect height is smaller than the height of the image
// then for single lines the default should be centered text
@@ -2039,43 +2039,43 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
{
nTextStyle &= ~DrawTextFlags(DrawTextFlags::Top|DrawTextFlags::Bottom);
nTextStyle |= DrawTextFlags::VCenter;
- aSize.Height() = rImageSize.Height();
+ aSize.setHeight( rImageSize.Height() );
}
ImplDrawAlignedImage( pDev, aPos, aSize, 1, nDrawFlags, nTextStyle );
rMouseRect = tools::Rectangle( aPos, aSize );
- rMouseRect.Left() = rPos.X();
+ rMouseRect.SetLeft( rPos.X() );
- rStateRect.Left() = rPos.X();
- rStateRect.Top() = rMouseRect.Top();
+ rStateRect.SetLeft( rPos.X() );
+ rStateRect.SetTop( rMouseRect.Top() );
if ( aSize.Height() > rImageSize.Height() )
- rStateRect.Top() += ( aSize.Height() - rImageSize.Height() ) / 2;
+ rStateRect.AdjustTop(( aSize.Height() - rImageSize.Height() ) / 2 );
else
{
- rStateRect.Top() -= ( rImageSize.Height() - aSize.Height() ) / 2;
+ rStateRect.AdjustTop( -(( rImageSize.Height() - aSize.Height() ) / 2) );
if( rStateRect.Top() < 0 )
- rStateRect.Top() = 0;
+ rStateRect.SetTop( 0 );
}
- rStateRect.Right() = rStateRect.Left() + rImageSize.Width()-1;
- rStateRect.Bottom() = rStateRect.Top() + rImageSize.Height()-1;
+ rStateRect.SetRight( rStateRect.Left() + rImageSize.Width()-1 );
+ rStateRect.SetBottom( rStateRect.Top() + rImageSize.Height()-1 );
if ( rStateRect.Bottom() > rMouseRect.Bottom() )
- rMouseRect.Bottom() = rStateRect.Bottom();
+ rMouseRect.SetBottom( rStateRect.Bottom() );
}
else
{
- rStateRect.Left() = rPos.X();
+ rStateRect.SetLeft( rPos.X() );
if ( nWinStyle & WB_VCENTER )
- rStateRect.Top() = rPos.Y()+((rSize.Height()-rImageSize.Height())/2);
+ rStateRect.SetTop( rPos.Y()+((rSize.Height()-rImageSize.Height())/2) );
else if ( nWinStyle & WB_BOTTOM )
- rStateRect.Top() = rPos.Y()+rSize.Height()-rImageSize.Height(); //-1;
+ rStateRect.SetTop( rPos.Y()+rSize.Height()-rImageSize.Height() ); //-1;
else
- rStateRect.Top() = rPos.Y();
- rStateRect.Right() = rStateRect.Left()+rImageSize.Width()-1;
- rStateRect.Bottom() = rStateRect.Top()+rImageSize.Height()-1;
+ rStateRect.SetTop( rPos.Y() );
+ rStateRect.SetRight( rStateRect.Left()+rImageSize.Width()-1 );
+ rStateRect.SetBottom( rStateRect.Top()+rImageSize.Height()-1 );
rMouseRect = rStateRect;
ImplSetFocusRect( rStateRect );
@@ -2095,26 +2095,26 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
Size aTmpSize( (aImageSize.Width()+8), (aImageSize.Height()+8) );
if ( bTopImage )
{
- aImageRect.Left() = (rSize.Width()-aTmpSize.Width())/2;
- aImageRect.Top() = (rSize.Height()-(aTmpSize.Height()+nTextHeight+6))/2;
+ aImageRect.SetLeft( (rSize.Width()-aTmpSize.Width())/2 );
+ aImageRect.SetTop( (rSize.Height()-(aTmpSize.Height()+nTextHeight+6))/2 );
}
else
- aImageRect.Top() = (rSize.Height()-aTmpSize.Height())/2;
+ aImageRect.SetTop( (rSize.Height()-aTmpSize.Height())/2 );
- aImageRect.Right() = aImageRect.Left()+aTmpSize.Width();
- aImageRect.Bottom() = aImageRect.Top()+aTmpSize.Height();
+ aImageRect.SetRight( aImageRect.Left()+aTmpSize.Width() );
+ aImageRect.SetBottom( aImageRect.Top()+aTmpSize.Height() );
// display text
Point aTxtPos = rPos;
if ( bTopImage )
{
- aTxtPos.X() += (rSize.Width()-nTextWidth)/2;
- aTxtPos.Y() += aImageRect.Bottom()+6;
+ aTxtPos.AdjustX((rSize.Width()-nTextWidth)/2 );
+ aTxtPos.AdjustY(aImageRect.Bottom()+6 );
}
else
{
- aTxtPos.X() += aImageRect.Right()+8;
- aTxtPos.Y() += (rSize.Height()-nTextHeight)/2;
+ aTxtPos.AdjustX(aImageRect.Right()+8 );
+ aTxtPos.AdjustY((rSize.Height()-nTextHeight)/2 );
}
pDev->DrawCtrlText( aTxtPos, aText, 0, aText.getLength() );
}
@@ -2136,8 +2136,8 @@ void RadioButton::ImplDrawRadioButton(vcl::RenderContext& rRenderContext)
else
aImageSize = maImage.GetSizePixel();
- aImageSize.Width() = CalcZoom(aImageSize.Width());
- aImageSize.Height() = CalcZoom(aImageSize.Height());
+ aImageSize.setWidth( CalcZoom(aImageSize.Width()) );
+ aImageSize.setHeight( CalcZoom(aImageSize.Height()) );
// Draw control text
ImplDraw(&rRenderContext, DrawFlags::NONE, Point(), GetOutputSizePixel(),
@@ -2422,21 +2422,21 @@ void RadioButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize
tools::Rectangle aStateRect;
tools::Rectangle aMouseRect;
- aImageSize.Width() = CalcZoom( aImageSize.Width() );
- aImageSize.Height() = CalcZoom( aImageSize.Height() );
- aBrd1Size.Width() = CalcZoom( aBrd1Size.Width() );
- aBrd1Size.Height() = CalcZoom( aBrd1Size.Height() );
- aBrd2Size.Width() = CalcZoom( aBrd2Size.Width() );
- aBrd2Size.Height() = CalcZoom( aBrd2Size.Height() );
+ aImageSize.setWidth( CalcZoom( aImageSize.Width() ) );
+ aImageSize.setHeight( CalcZoom( aImageSize.Height() ) );
+ aBrd1Size.setWidth( CalcZoom( aBrd1Size.Width() ) );
+ aBrd1Size.setHeight( CalcZoom( aBrd1Size.Height() ) );
+ aBrd2Size.setWidth( CalcZoom( aBrd2Size.Width() ) );
+ aBrd2Size.setHeight( CalcZoom( aBrd2Size.Height() ) );
if ( !aBrd1Size.Width() )
- aBrd1Size.Width() = 1;
+ aBrd1Size.setWidth( 1 );
if ( !aBrd1Size.Height() )
- aBrd1Size.Height() = 1;
+ aBrd1Size.setHeight( 1 );
if ( !aBrd2Size.Width() )
- aBrd2Size.Width() = 1;
+ aBrd2Size.setWidth( 1 );
if ( !aBrd2Size.Height() )
- aBrd2Size.Height() = 1;
+ aBrd2Size.setHeight( 1 );
pDev->Push();
pDev->SetMapMode();
@@ -2836,7 +2836,7 @@ void RadioButton::ImplSetMinimumNWFSize()
if( aSize.Height() > aCurSize.Height() )
{
- aCurSize.Height() = aSize.Height();
+ aCurSize.setHeight( aSize.Height() );
SetSizePixel( aCurSize );
}
}
@@ -2852,8 +2852,8 @@ Size RadioButton::CalcMinimumSize() const
else
{
aSize = maImage.GetSizePixel();
- aSize.Width() += 8;
- aSize.Height() += 8;
+ aSize.AdjustWidth(8 );
+ aSize.AdjustHeight(8 );
}
OUString aText = GetText();
@@ -2864,21 +2864,21 @@ Size RadioButton::CalcMinimumSize() const
Size aTextSize = GetTextRect( tools::Rectangle( Point(), Size( 0x7fffffff, 0x7fffffff ) ),
aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize();
- aSize.Width()+=2; // for focus rect
+ aSize.AdjustWidth(2 ); // for focus rect
if (!bTopImage)
{
- aSize.Width() += ImplGetImageToTextDistance();
- aSize.Width() += aTextSize.Width();
+ aSize.AdjustWidth(ImplGetImageToTextDistance() );
+ aSize.AdjustWidth(aTextSize.Width() );
if ( aSize.Height() < aTextSize.Height() )
- aSize.Height() = aTextSize.Height();
+ aSize.setHeight( aTextSize.Height() );
}
else
{
- aSize.Height() += 6;
- aSize.Height() += GetTextHeight();
+ aSize.AdjustHeight(6 );
+ aSize.AdjustHeight(GetTextHeight() );
if ( aSize.Width() < aTextSize.Width() )
- aSize.Width() = aTextSize.Width();
+ aSize.setWidth( aTextSize.Width() );
}
}
@@ -2897,13 +2897,13 @@ void RadioButton::ShowFocus(const tools::Rectangle& rRect)
ImplControlValue aControlValue;
tools::Rectangle aInRect(Point(0, 0), GetSizePixel());
- aInRect.Left() = rRect.Left(); // exclude the radio element itself from the focusrect
+ aInRect.SetLeft( rRect.Left() ); // exclude the radio element itself from the focusrect
//to-do, figure out a better solution here
- aInRect.Left()-=2;
- aInRect.Right()+=2;
- aInRect.Top()-=2;
- aInRect.Bottom()+=2;
+ aInRect.AdjustLeft( -2 );
+ aInRect.AdjustRight(2 );
+ aInRect.AdjustTop( -2 );
+ aInRect.AdjustBottom(2 );
DrawNativeControl(ControlType::Radiobutton, ControlPart::Focus, aInRect,
ControlState::FOCUSED, aControlValue, OUString());
@@ -3048,8 +3048,8 @@ void CheckBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
const long nImageSep = GetDrawPixel( pDev, ImplGetImageToTextDistance() );
Size aSize( rSize );
Point aPos( rPos );
- aPos.X() += rImageSize.Width() + nImageSep;
- aSize.Width() -= rImageSize.Width() + nImageSep;
+ aPos.AdjustX(rImageSize.Width() + nImageSep );
+ aSize.AdjustWidth( -(rImageSize.Width() + nImageSep) );
// if the text rect height is smaller than the height of the image
// then for single lines the default should be centered text
@@ -3058,46 +3058,46 @@ void CheckBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
{
nTextStyle &= ~DrawTextFlags(DrawTextFlags::Top|DrawTextFlags::Bottom);
nTextStyle |= DrawTextFlags::VCenter;
- aSize.Height() = rImageSize.Height();
+ aSize.setHeight( rImageSize.Height() );
}
ImplDrawAlignedImage( pDev, aPos, aSize, 1, nDrawFlags, nTextStyle );
rMouseRect = tools::Rectangle( aPos, aSize );
- rMouseRect.Left() = rPos.X();
- rStateRect.Left() = rPos.X();
- rStateRect.Top() = rMouseRect.Top();
+ rMouseRect.SetLeft( rPos.X() );
+ rStateRect.SetLeft( rPos.X() );
+ rStateRect.SetTop( rMouseRect.Top() );
if ( aSize.Height() > rImageSize.Height() )
- rStateRect.Top() += ( aSize.Height() - rImageSize.Height() ) / 2;
+ rStateRect.AdjustTop(( aSize.Height() - rImageSize.Height() ) / 2 );
else
{
- rStateRect.Top() -= ( rImageSize.Height() - aSize.Height() ) / 2;
+ rStateRect.AdjustTop( -(( rImageSize.Height() - aSize.Height() ) / 2) );
if( rStateRect.Top() < 0 )
- rStateRect.Top() = 0;
+ rStateRect.SetTop( 0 );
}
- rStateRect.Right() = rStateRect.Left()+rImageSize.Width()-1;
- rStateRect.Bottom() = rStateRect.Top()+rImageSize.Height()-1;
+ rStateRect.SetRight( rStateRect.Left()+rImageSize.Width()-1 );
+ rStateRect.SetBottom( rStateRect.Top()+rImageSize.Height()-1 );
if ( rStateRect.Bottom() > rMouseRect.Bottom() )
- rMouseRect.Bottom() = rStateRect.Bottom();
+ rMouseRect.SetBottom( rStateRect.Bottom() );
}
else
{
if ( mbLegacyNoTextAlign && ( nWinStyle & WB_CENTER ) )
- rStateRect.Left() = rPos.X()+((rSize.Width()-rImageSize.Width())/2);
+ rStateRect.SetLeft( rPos.X()+((rSize.Width()-rImageSize.Width())/2) );
else if ( mbLegacyNoTextAlign && ( nWinStyle & WB_RIGHT ) )
- rStateRect.Left() = rPos.X()+rSize.Width()-rImageSize.Width();
+ rStateRect.SetLeft( rPos.X()+rSize.Width()-rImageSize.Width() );
else
- rStateRect.Left() = rPos.X();
+ rStateRect.SetLeft( rPos.X() );
if ( nWinStyle & WB_VCENTER )
- rStateRect.Top() = rPos.Y()+((rSize.Height()-rImageSize.Height())/2);
+ rStateRect.SetTop( rPos.Y()+((rSize.Height()-rImageSize.Height())/2) );
else if ( nWinStyle & WB_BOTTOM )
- rStateRect.Top() = rPos.Y()+rSize.Height()-rImageSize.Height();
+ rStateRect.SetTop( rPos.Y()+rSize.Height()-rImageSize.Height() );
else
- rStateRect.Top() = rPos.Y();
- rStateRect.Right() = rStateRect.Left()+rImageSize.Width()-1;
- rStateRect.Bottom() = rStateRect.Top()+rImageSize.Height()-1;
+ rStateRect.SetTop( rPos.Y() );
+ rStateRect.SetRight( rStateRect.Left()+rImageSize.Width()-1 );
+ rStateRect.SetBottom( rStateRect.Top()+rImageSize.Height()-1 );
// provide space for focusrect
// note: this assumes that the control's size was adjusted
// accordingly in Get/LoseFocus, so the onscreen position won't change
@@ -3114,8 +3114,8 @@ void CheckBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
void CheckBox::ImplDrawCheckBox(vcl::RenderContext& rRenderContext)
{
Size aImageSize = ImplGetCheckImageSize();
- aImageSize.Width() = CalcZoom( aImageSize.Width() );
- aImageSize.Height() = CalcZoom( aImageSize.Height() );
+ aImageSize.setWidth( CalcZoom( aImageSize.Width() ) );
+ aImageSize.setHeight( CalcZoom( aImageSize.Height() ) );
HideFocus();
@@ -3278,21 +3278,21 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
tools::Rectangle aStateRect;
tools::Rectangle aMouseRect;
- aImageSize.Width() = CalcZoom( aImageSize.Width() );
- aImageSize.Height() = CalcZoom( aImageSize.Height() );
- aBrd1Size.Width() = CalcZoom( aBrd1Size.Width() );
- aBrd1Size.Height() = CalcZoom( aBrd1Size.Height() );
- aBrd2Size.Width() = CalcZoom( aBrd2Size.Width() );
- aBrd2Size.Height() = CalcZoom( aBrd2Size.Height() );
+ aImageSize.setWidth( CalcZoom( aImageSize.Width() ) );
+ aImageSize.setHeight( CalcZoom( aImageSize.Height() ) );
+ aBrd1Size.setWidth( CalcZoom( aBrd1Size.Width() ) );
+ aBrd1Size.setHeight( CalcZoom( aBrd1Size.Height() ) );
+ aBrd2Size.setWidth( CalcZoom( aBrd2Size.Width() ) );
+ aBrd2Size.setHeight( CalcZoom( aBrd2Size.Height() ) );
if ( !aBrd1Size.Width() )
- aBrd1Size.Width() = 1;
+ aBrd1Size.setWidth( 1 );
if ( !aBrd1Size.Height() )
- aBrd1Size.Height() = 1;
+ aBrd1Size.setHeight( 1 );
if ( !aBrd2Size.Width() )
- aBrd2Size.Width() = 1;
+ aBrd2Size.setWidth( 1 );
if ( !aBrd2Size.Height() )
- aBrd2Size.Height() = 1;
+ aBrd2Size.setHeight( 1 );
if ( !nCheckWidth )
nCheckWidth = 1;
@@ -3311,10 +3311,10 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
pDev->SetLineColor();
pDev->SetFillColor( Color( COL_BLACK ) );
pDev->DrawRect( aStateRect );
- aStateRect.Left() += aBrd1Size.Width();
- aStateRect.Top() += aBrd1Size.Height();
- aStateRect.Right() -= aBrd1Size.Width();
- aStateRect.Bottom() -= aBrd1Size.Height();
+ aStateRect.AdjustLeft(aBrd1Size.Width() );
+ aStateRect.AdjustTop(aBrd1Size.Height() );
+ aStateRect.AdjustRight( -(aBrd1Size.Width()) );
+ aStateRect.AdjustBottom( -(aBrd1Size.Height()) );
if ( meState == TRISTATE_INDET )
pDev->SetFillColor( Color( COL_LIGHTGRAY ) );
else
@@ -3323,10 +3323,10 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
if ( meState == TRISTATE_TRUE )
{
- aStateRect.Left() += aBrd2Size.Width();
- aStateRect.Top() += aBrd2Size.Height();
- aStateRect.Right() -= aBrd2Size.Width();
- aStateRect.Bottom() -= aBrd2Size.Height();
+ aStateRect.AdjustLeft(aBrd2Size.Width() );
+ aStateRect.AdjustTop(aBrd2Size.Height() );
+ aStateRect.AdjustRight( -(aBrd2Size.Width()) );
+ aStateRect.AdjustBottom( -(aBrd2Size.Height()) );
Point aPos11( aStateRect.TopLeft() );
Point aPos12( aStateRect.BottomRight() );
Point aPos21( aStateRect.TopRight() );
@@ -3341,18 +3341,18 @@ void CheckBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
{
if ( !(i % 2) )
{
- aTempPos11.X() = aPos11.X()+nDX;
- aTempPos12.X() = aPos12.X()+nDX;
- aTempPos21.X() = aPos21.X()+nDX;
- aTempPos22.X() = aPos22.X()+nDX;
+ aTempPos11.setX( aPos11.X()+nDX );
+ aTempPos12.setX( aPos12.X()+nDX );
+ aTempPos21.setX( aPos21.X()+nDX );
+ aTempPos22.setX( aPos22.X()+nDX );
}
else
{
nDX++;
- aTempPos11.X() = aPos11.X()-nDX;
- aTempPos12.X() = aPos12.X()-nDX;
- aTempPos21.X() = aPos21.X()-nDX;
- aTempPos22.X() = aPos22.X()-nDX;
+ aTempPos11.setX( aPos11.X()-nDX );
+ aTempPos12.setX( aPos12.X()-nDX );
+ aTempPos21.setX( aPos21.X()-nDX );
+ aTempPos22.setX( aPos22.X()-nDX );
}
pDev->DrawLine( aTempPos11, aTempPos12 );
pDev->DrawLine( aTempPos21, aTempPos22 );
@@ -3378,8 +3378,8 @@ void CheckBox::GetFocus()
Point aPos( GetPosPixel() );
Size aSize( GetSizePixel() );
aPos.Move(-1,-1);
- aSize.Height() += 2;
- aSize.Width() += 2;
+ aSize.AdjustHeight(2 );
+ aSize.AdjustWidth(2 );
setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
Invalidate();
}
@@ -3409,8 +3409,8 @@ void CheckBox::LoseFocus()
Point aPos( GetPosPixel() );
Size aSize( GetSizePixel() );
aPos.Move(1,1);
- aSize.Height() -= 2;
- aSize.Width() -= 2;
+ aSize.AdjustHeight( -2 );
+ aSize.AdjustWidth( -2 );
setPosSizePixel( aPos.X(), aPos.Y(), aSize.Width(), aSize.Height() );
Invalidate();
}
@@ -3672,7 +3672,7 @@ void CheckBox::ImplSetMinimumNWFSize()
if( aSize.Height() > aCurSize.Height() )
{
- aCurSize.Height() = aSize.Height();
+ aCurSize.setHeight( aSize.Height() );
SetSizePixel( aCurSize );
}
}
@@ -3694,11 +3694,11 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
Size aTextSize = GetTextRect( tools::Rectangle( Point(), Size( nMaxWidth > 0 ? nMaxWidth : 0x7fffffff, 0x7fffffff ) ),
aText, FixedText::ImplGetTextStyle( GetStyle() ) ).GetSize();
- aSize.Width()+=2; // for focus rect
- aSize.Width() += ImplGetImageToTextDistance();
- aSize.Width() += aTextSize.Width();
+ aSize.AdjustWidth(2 ); // for focus rect
+ aSize.AdjustWidth(ImplGetImageToTextDistance() );
+ aSize.AdjustWidth(aTextSize.Width() );
if ( aSize.Height() < aTextSize.Height() )
- aSize.Height() = aTextSize.Height();
+ aSize.setHeight( aTextSize.Height() );
}
else
{
@@ -3725,13 +3725,13 @@ void CheckBox::ShowFocus(const tools::Rectangle& rRect)
ImplControlValue aControlValue;
tools::Rectangle aInRect(Point(0, 0), GetSizePixel());
- aInRect.Left() = rRect.Left(); // exclude the checkbox itself from the focusrect
+ aInRect.SetLeft( rRect.Left() ); // exclude the checkbox itself from the focusrect
//to-do, figure out a better solution here
- aInRect.Left()-=2;
- aInRect.Right()+=2;
- aInRect.Top()-=2;
- aInRect.Bottom()+=2;
+ aInRect.AdjustLeft( -2 );
+ aInRect.AdjustRight(2 );
+ aInRect.AdjustTop( -2 );
+ aInRect.AdjustBottom(2 );
DrawNativeControl(ControlType::Checkbox, ControlPart::Focus, aInRect,
ControlState::FOCUSED, aControlValue, OUString());