sc/source/ui/view/output.cxx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)
New commits: commit 3d86217598fd6507536d2c9998f9c404abae3d6a Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Mon Jan 10 14:54:31 2022 +0900 Commit: Aron Budea <aron.bu...@collabora.com> CommitDate: Sat Nov 12 15:19:17 2022 +0100 sc: fix cond. format icon size, when we work with pixels This is the case when the device is bWorksInPixels is true, which is the case when running LOKit. Change-Id: Ibfced11bf614604521240908f4821fb9abfbf362 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128200 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> (cherry picked from commit f2e1c6033890e513aa8e6b15dd6f26905d4622c8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142608 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Aron Budea <aron.bu...@collabora.com> diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 82126f68fe1d..1b40ae0b4b62 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -910,7 +910,7 @@ const BitmapEx& getIcon(sc::IconSetBitmapMap & rIconSetBitmapMap, ScIconSetType } void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldIconSetInfo, const tools::Rectangle& rRect, tools::Long nOneX, tools::Long nOneY, - sc::IconSetBitmapMap & rIconSetBitmapMap) + sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels) { ScIconSetType eType = pOldIconSetInfo->eIconSetType; sal_Int32 nIndex = pOldIconSetInfo->nIconIndex; @@ -919,7 +919,18 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldI tools::Long aHeight = o3tl::convert(10, o3tl::Length::pt, o3tl::Length::mm100); if (pOldIconSetInfo->mnHeight) - aHeight = o3tl::convert(pOldIconSetInfo->mnHeight, o3tl::Length::twip, o3tl::Length::mm100); + { + if (bWorksInPixels) + { + aHeight = rRenderContext.LogicToPixel(Size(0, pOldIconSetInfo->mnHeight), MapMode(MapUnit::MapTwip)).Height(); + if (comphelper::LibreOfficeKit::isActive()) + { + aHeight *= comphelper::LibreOfficeKit::getDPIScale(); + } + } + else + aHeight = o3tl::convert(pOldIconSetInfo->mnHeight, o3tl::Length::twip, o3tl::Length::mm100); + } Size aSize = rIcon.GetSizePixel(); double fRatio = aSize.Width() / aSize.Height(); @@ -934,7 +945,7 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldI void drawCells(vcl::RenderContext& rRenderContext, std::optional<Color> const & pColor, const SvxBrushItem* pBackground, std::optional<Color>& pOldColor, const SvxBrushItem*& pOldBackground, tools::Rectangle& rRect, tools::Long nPosX, tools::Long nLayoutSign, tools::Long nOneX, tools::Long nOneY, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo, const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo, - sc::IconSetBitmapMap & rIconSetBitmapMap) + sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels) { tools::Long nSignedOneX = nOneX * nLayoutSign; // need to paint if old color scale has been used and now @@ -951,7 +962,7 @@ void drawCells(vcl::RenderContext& rRenderContext, std::optional<Color> const & if( pOldDataBarInfo ) drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY); if( pOldIconSetInfo ) - drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, rIconSetBitmapMap); + drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, rIconSetBitmapMap, bWorksInPixels); rRect.SetLeft( nPosX - nSignedOneX ); } @@ -971,7 +982,7 @@ void drawCells(vcl::RenderContext& rRenderContext, std::optional<Color> const & if( pOldDataBarInfo ) drawDataBars(rRenderContext, pOldDataBarInfo, rRect, nOneX, nOneY); if( pOldIconSetInfo ) - drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, rIconSetBitmapMap); + drawIconSets(rRenderContext, pOldIconSetInfo, rRect, nOneX, nOneY, rIconSetBitmapMap, bWorksInPixels); rRect.SetLeft( nPosX - nSignedOneX ); } @@ -1155,7 +1166,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) if (bWorksInPixels) nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 0)).X(); - drawCells(rRenderContext, pColor, pBackground, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap()); + drawCells(rRenderContext, pColor, pBackground, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap(), bWorksInPixels); nPosX = nNewPosX; } @@ -1164,7 +1175,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext) if (bWorksInPixels) nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 0)).X(); - drawCells(rRenderContext, std::optional<Color>(), nullptr, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, nullptr, pOldDataBarInfo, nullptr, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap()); + drawCells(rRenderContext, std::optional<Color>(), nullptr, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, nullptr, pOldDataBarInfo, nullptr, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap(), bWorksInPixels); nArrY += nSkip; }