Kaydet (Commit) ac5cec21 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

Cleanup zoomsliderctrl & viewlayoutctrl

Change-Id: Ie5f135e8457ed75146328a388f3b70273bf54ed2
üst b99aeb24
......@@ -152,8 +152,8 @@ long SvxZoomSliderControl::Zoom2Offset( sal_uInt16 nCurrentZoom ) const
return nRet;
}
SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& _rStb ) :
SfxStatusBarControl( _nSlotId, _nId, _rStb ),
SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStatusBar ) :
SfxStatusBarControl( _nSlotId, _nId, rStatusBar ),
mpImpl( new SvxZoomSliderControl_Impl )
{
mpImpl->maSliderButton = Image( SVX_RES( RID_SVXBMP_SLIDERBUTTON ) );
......@@ -161,16 +161,17 @@ SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nI
mpImpl->maDecreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERDECREASE ) );
//#ifndef MACOSX
if ( _rStb.GetDPIScaleFactor() > 1)
sal_Int32 nScaleFactor = rStatusBar.GetDPIScaleFactor();
if (nScaleFactor != 1)
{
Image arr[3] = {mpImpl->maSliderButton, mpImpl->maIncreaseButton, mpImpl->maDecreaseButton};
for (int i = 0; i < 3; i++)
{
BitmapEx b = arr[i].GetBitmapEx();
BitmapEx aBitmap = arr[i].GetBitmapEx();
//Use Lanczos scaling for the slider button because it does a better job with circles
b.Scale(_rStb.GetDPIScaleFactor(), _rStb.GetDPIScaleFactor(), i == 0 ? BMP_SCALE_LANCZOS : BMP_SCALE_FAST);
arr[i] = Image(b);
aBitmap.Scale(nScaleFactor, nScaleFactor, i == 0 ? BMP_SCALE_LANCZOS : BMP_SCALE_FAST);
arr[i] = Image(aBitmap);
}
mpImpl->maSliderButton = arr[0];
mpImpl->maIncreaseButton = arr[1];
......
......@@ -39,8 +39,8 @@ struct SwViewLayoutControl::SwViewLayoutControl_Impl
Image maImageBookMode_Active;
};
SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStb ) :
SfxStatusBarControl( _nSlotId, _nId, rStb ),
SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStatusBar ) :
SfxStatusBarControl( _nSlotId, _nId, rStatusBar ),
mpImpl( new SwViewLayoutControl_Impl )
{
mpImpl->mnState = 0;
......@@ -52,7 +52,8 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
mpImpl->maImageBookMode = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE) );
mpImpl->maImageBookMode_Active = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE) );
if ( rStb.GetDPIScaleFactor() > 1)
sal_Int32 nScaleFactor = rStatusBar.GetDPIScaleFactor();
if (nScaleFactor != 1)
{
Image arr[6] = {mpImpl->maImageSingleColumn, mpImpl->maImageSingleColumn_Active,
mpImpl->maImageAutomatic, mpImpl->maImageAutomatic_Active,
......@@ -60,9 +61,9 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
for (int i = 0; i < 6; i++)
{
BitmapEx b = arr[i].GetBitmapEx();
b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BMP_SCALE_FAST);
arr[i] = Image(b);
BitmapEx aBitmap = arr[i].GetBitmapEx();
aBitmap.Scale(nScaleFactor, nScaleFactor, BMP_SCALE_FAST);
arr[i] = Image(aBitmap);
}
mpImpl->maImageSingleColumn = arr[0];
......@@ -74,7 +75,6 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId,
mpImpl->maImageBookMode = arr[4];
mpImpl->maImageBookMode_Active = arr[5];
}
}
SwViewLayoutControl::~SwViewLayoutControl()
......@@ -124,8 +124,8 @@ void SwViewLayoutControl::Paint( const UserDrawEvent& rUsrEvt )
mpImpl->maImageAutomatic.GetSizePixel().Width() +
mpImpl->maImageBookMode.GetSizePixel().Width();
const long nXOffset = (aRect.GetWidth() - nImageWidthSum)/2;
const long nYOffset = (aControlRect.GetHeight() - mpImpl->maImageSingleColumn.GetSizePixel().Height())/2;
const long nXOffset = (aRect.GetWidth() - nImageWidthSum) / 2;
const long nYOffset = (aControlRect.GetHeight() - mpImpl->maImageSingleColumn.GetSizePixel().Height()) / 2;
aRect.Left() = aRect.Left() + nXOffset;
aRect.Top() = aRect.Top() + nYOffset;
......
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