diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2016-10-28 23:55:53 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-10-29 21:48:30 +0000 |
commit | b7c2764145be2c3fc50397f241dbdb0c53f9befd (patch) | |
tree | f861b28305b99047f430d0c067447eb615c6641b /sc | |
parent | a0cf18f58fd060dd3ef4f60ad7b17c8f8dc662dd (diff) |
convert usages of DPIScalingFactor from int to float
Change-Id: I049b3d2cde4dcb8c8c0690d75a015a43cb71b0c0
Reviewed-on: https://gerrit.libreoffice.org/30381
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 41 | ||||
-rw-r--r-- | sc/source/ui/cctrl/dpcontrol.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 6 |
4 files changed, 37 insertions, 38 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 374914be90ac..9327e0099ed8 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -86,8 +86,7 @@ ScMenuFloatingWindow::ScMenuFloatingWindow(vcl::Window* pParent, ScDocument* pDo const StyleSettings& rStyle = GetSettings().GetStyleSettings(); - sal_Int32 nScaleFactor = GetDPIScaleFactor(); - const sal_uInt16 nPopupFontHeight = 12 * nScaleFactor; + const sal_uInt16 nPopupFontHeight = 12 * GetDPIScaleFactor(); maLabelFont = rStyle.GetLabelFont(); maLabelFont.SetFontHeight(nPopupFontHeight); } @@ -890,9 +889,9 @@ ScCheckListMenuWindow::ScCheckListMenuWindow(vcl::Window* pParent, ScDocument* p mePrevToggleAllState(TRISTATE_INDET), maTabStops(this) { - sal_Int32 nScaleFactor = GetDPIScaleFactor(); + float fScaleFactor = GetDPIScaleFactor(); - maWndSize = Size(200 * nScaleFactor, 330 * nScaleFactor); + maWndSize = Size(200 * fScaleFactor, 330 * fScaleFactor); maTabStops.AddTabStop( this ); maTabStops.AddTabStop( maEdSearch.get() ); @@ -928,21 +927,21 @@ void ScCheckListMenuWindow::dispose() void ScCheckListMenuWindow::getSectionPosSize( Point& rPos, Size& rSize, SectionType eType) const { - sal_Int32 nScaleFactor = GetDPIScaleFactor(); + float fScaleFactor = GetDPIScaleFactor(); // constant parameters. - const long nSearchBoxMargin = 10 *nScaleFactor; - const long nListBoxMargin = 5 * nScaleFactor; // horizontal distance from the side of the dialog to the listbox border. - const long nListBoxInnerPadding = 5 * nScaleFactor; - const long nTopMargin = 5 * nScaleFactor; + const long nSearchBoxMargin = 10 *fScaleFactor; + const long nListBoxMargin = 5 * fScaleFactor; // horizontal distance from the side of the dialog to the listbox border. + const long nListBoxInnerPadding = 5 * fScaleFactor; + const long nTopMargin = 5 * fScaleFactor; const long nMenuHeight = maMenuSize.getHeight(); - const long nSingleItemBtnAreaHeight = 32 * nScaleFactor; // height of the middle area below the list box where the single-action buttons are. - const long nBottomBtnAreaHeight = 50 * nScaleFactor; // height of the bottom area where the OK and Cancel buttons are. - const long nBtnWidth = 90 * nScaleFactor; + const long nSingleItemBtnAreaHeight = 32 * fScaleFactor; // height of the middle area below the list box where the single-action buttons are. + const long nBottomBtnAreaHeight = 50 * fScaleFactor; // height of the bottom area where the OK and Cancel buttons are. + const long nBtnWidth = 90 * fScaleFactor; const long nLabelHeight = getLabelFont().GetFontHeight(); const long nBtnHeight = nLabelHeight * 2; - const long nBottomMargin = 10 * nScaleFactor; - const long nMenuListMargin = 5 * nScaleFactor; + const long nBottomMargin = 10 * fScaleFactor; + const long nMenuListMargin = 5 * fScaleFactor; const long nSearchBoxHeight = nLabelHeight * 2; // parameters calculated from constants. @@ -1000,7 +999,7 @@ void ScCheckListMenuWindow::getSectionPosSize( break; case BTN_SINGLE_SELECT: { - long h = 26 * nScaleFactor; + long h = 26 * fScaleFactor; rPos = Point(nListBoxMargin, nSingleBtnAreaY); rPos.X() += nListBoxWidth - h - 10 - h - 10; rPos.Y() += (nSingleItemBtnAreaHeight - h)/2; @@ -1009,7 +1008,7 @@ void ScCheckListMenuWindow::getSectionPosSize( break; case BTN_SINGLE_UNSELECT: { - long h = 26 * nScaleFactor; + long h = 26 * fScaleFactor; rPos = Point(nListBoxMargin, nSingleBtnAreaY); rPos.X() += nListBoxWidth - h - 10; rPos.Y() += (nSingleItemBtnAreaHeight - h)/2; @@ -1095,13 +1094,13 @@ void ScCheckListMenuWindow::packWindow() maChkToggleAll->SetClickHdl( LINK(this, ScCheckListMenuWindow, TriStateHdl) ); maChkToggleAll->Show(); - sal_Int32 nScaleFactor = GetDPIScaleFactor(); + float fScaleFactor = GetDPIScaleFactor(); Image aSingleSelect(ScResId(RID_IMG_SELECT_CURRENT)); - if (nScaleFactor != 1) + if (fScaleFactor > 1) { BitmapEx aBitmap = aSingleSelect.GetBitmapEx(); - aBitmap.Scale(nScaleFactor, nScaleFactor, BmpScaleFlag::Fast); + aBitmap.Scale(fScaleFactor, fScaleFactor, BmpScaleFlag::Fast); aSingleSelect = Image(aBitmap); } @@ -1113,10 +1112,10 @@ void ScCheckListMenuWindow::packWindow() maBtnSelectSingle->Show(); Image aSingleUnselect(ScResId(RID_IMG_UNSELECT_CURRENT)); - if (nScaleFactor != 1) + if (fScaleFactor > 1) { BitmapEx aBitmap = aSingleUnselect.GetBitmapEx(); - aBitmap.Scale(nScaleFactor, nScaleFactor, BmpScaleFlag::Fast); + aBitmap.Scale(fScaleFactor, fScaleFactor, BmpScaleFlag::Fast); aSingleUnselect = Image(aBitmap); } diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index 65d9a541217a..cc0aaf972e61 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -145,9 +145,9 @@ void ScDPFieldButton::draw() void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const { - sal_Int32 nScaleFactor = mpOutDev->GetDPIScaleFactor(); + float fScaleFactor = mpOutDev->GetDPIScaleFactor(); - long nMaxSize = 18L * nScaleFactor; // Button max size in either dimension + long nMaxSize = 18L * fScaleFactor; // Button max size in either dimension long nW = std::min(maSize.getWidth() / 2, nMaxSize); long nH = std::min(maSize.getHeight(), nMaxSize); @@ -170,7 +170,7 @@ void ScDPFieldButton::drawPopupButton() Size aSize; getPopupBoundingBox(aPos, aSize); - sal_Int32 nScaleFactor = mpOutDev->GetDPIScaleFactor(); + float fScaleFactor = mpOutDev->GetDPIScaleFactor(); // Background & outer black border mpOutDev->SetLineColor(COL_BLACK); @@ -185,7 +185,7 @@ void ScDPFieldButton::drawPopupButton() Point aCenter(aPos.X() + (aSize.Width() / 2), aPos.Y() + (aSize.Height() / 2)); - Size aArrowSize(4 * nScaleFactor, 2 * nScaleFactor); + Size aArrowSize(4 * fScaleFactor, 2 * fScaleFactor); tools::Polygon aPoly(3); aPoly.SetPoint(Point(aCenter.X() - aArrowSize.Width(), aCenter.Y() - aArrowSize.Height()), 0); @@ -196,8 +196,8 @@ void ScDPFieldButton::drawPopupButton() if (mbHasHiddenMember) { // tiny little box to display in presence of hidden member(s). - Point aBoxPos(aPos.X() + aSize.Width() - 5 * nScaleFactor, aPos.Y() + aSize.Height() - 5 * nScaleFactor); - Size aBoxSize(3 * nScaleFactor, 3 * nScaleFactor); + Point aBoxPos(aPos.X() + aSize.Width() - 5 * fScaleFactor, aPos.Y() + aSize.Height() - 5 * fScaleFactor); + Size aBoxSize(3 * fScaleFactor, 3 * fScaleFactor); mpOutDev->DrawRect(Rectangle(aBoxPos, aBoxSize)); } } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index b57737e99210..48506a8ccd76 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5999,9 +5999,9 @@ void ScGridWindow::UpdateCursorOverlay() // show the cursor as 4 (thin) rectangles Rectangle aRect(aScrPos, Size(nSizeXPix - 1, nSizeYPix - 1)); - sal_Int32 nScale = GetDPIScaleFactor(); + float fScaleFactor = GetDPIScaleFactor(); - long aCursorWidth = 1 * nScale; + long aCursorWidth = 1 * fScaleFactor; Rectangle aLeft = Rectangle(aRect); aLeft.Top() -= aCursorWidth; @@ -6190,9 +6190,9 @@ void ScGridWindow::UpdateAutoFillOverlay() ScDocument* pDoc = pViewData->GetDocument(); bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); - sal_Int32 nScale = GetDPIScaleFactor(); + float fScaleFactor = GetDPIScaleFactor(); // Size should be even - Size aFillHandleSize(6 * nScale, 6 * nScale); + Size aFillHandleSize(6 * fScaleFactor, 6 * fScaleFactor); Point aFillPos = pViewData->GetScrPos( nX, nY, eWhich, true ); long nSizeXPix; @@ -6210,10 +6210,10 @@ void ScGridWindow::UpdateAutoFillOverlay() Rectangle aFillRect(aFillPos, aFillHandleSize); // expand rect to increase hit area - mpAutoFillRect.reset(new Rectangle(aFillRect.Left() - nScale, - aFillRect.Top() - nScale, - aFillRect.Right() + nScale, - aFillRect.Bottom() + nScale)); + mpAutoFillRect.reset(new Rectangle(aFillRect.Left() - fScaleFactor, + aFillRect.Top() - fScaleFactor, + aFillRect.Right() + fScaleFactor, + aFillRect.Bottom() + fScaleFactor)); // #i70788# get the OverlayManager safely rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager(); diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index dc5c221cfea7..81ae3c778551 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -332,12 +332,12 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner ) if ( bMinimized ) return; - sal_Int32 aScaleFactor = pFrameWin->GetDPIScaleFactor(); + float fScaleFactor = pFrameWin->GetDPIScaleFactor(); - long nSplitSizeX = SPLIT_HANDLE_SIZE * aScaleFactor; + long nSplitSizeX = SPLIT_HANDLE_SIZE * fScaleFactor; if ( aViewData.GetHSplitMode() == SC_SPLIT_FIX ) nSplitSizeX = 1; - long nSplitSizeY = SPLIT_HANDLE_SIZE * aScaleFactor; + long nSplitSizeY = SPLIT_HANDLE_SIZE * fScaleFactor; if ( aViewData.GetVSplitMode() == SC_SPLIT_FIX ) nSplitSizeY = 1; |