summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-01-10 14:43:38 +0900
committerAndras Timar <andras.timar@collabora.com>2022-01-13 10:06:26 +0100
commit67c9d3d30308b4353e27eb4a75ba72ad2f6081c3 (patch)
treef347f5994becb9ccccb72e74db4d6c49825a69f0
parente910ee9278e38449212840efe9dd41d37816db7d (diff)
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. (cherry picked from commit b59e7800b777332ba3883ff1ab0509ffd58cff2a) Change-Id: If7293d95589f52d46f24bc7254f1eeb6f50729b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128226 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sc/source/ui/view/output.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 9948b666eebf..3585908d7e07 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -906,7 +906,7 @@ const BitmapEx& getIcon(sc::IconSetBitmapMap & rIconSetBitmapMap, ScIconSetType
}
void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldIconSetInfo, const tools::Rectangle& rRect, long nOneX, long nOneY,
- sc::IconSetBitmapMap & rIconSetBitmapMap)
+ sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
{
ScIconSetType eType = pOldIconSetInfo->eIconSetType;
sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
@@ -915,7 +915,18 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldI
long aHeight = 300;
if (pOldIconSetInfo->mnHeight)
- aHeight = convertTwipToMm100(pOldIconSetInfo->mnHeight);
+ {
+ if (bWorksInPixels)
+ {
+ aHeight = rRenderContext.LogicToPixel(Size(0, pOldIconSetInfo->mnHeight), MapMode(MapUnit::MapTwip)).Height();
+ if (comphelper::LibreOfficeKit::isActive())
+ {
+ aHeight *= comphelper::LibreOfficeKit::getDPIScale();
+ }
+ }
+ else
+ aHeight = convertTwipToMm100(pOldIconSetInfo->mnHeight);
+ }
Size aSize = rIcon.GetSizePixel();
double fRatio = aSize.Width() / aSize.Height();
@@ -930,7 +941,7 @@ void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldI
void drawCells(vcl::RenderContext& rRenderContext, boost::optional<Color> const & pColor, const SvxBrushItem* pBackground, boost::optional<Color>& pOldColor, const SvxBrushItem*& pOldBackground,
tools::Rectangle& rRect, long nPosX, long nLayoutSign, long nOneX, long nOneY, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo,
const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo,
- sc::IconSetBitmapMap & rIconSetBitmapMap)
+ sc::IconSetBitmapMap & rIconSetBitmapMap, bool bWorksInPixels)
{
long nSignedOneX = nOneX * nLayoutSign;
// need to paint if old color scale has been used and now
@@ -947,7 +958,7 @@ void drawCells(vcl::RenderContext& rRenderContext, boost::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 );
}
@@ -967,7 +978,7 @@ void drawCells(vcl::RenderContext& rRenderContext, boost::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 );
}
@@ -1130,7 +1141,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);
// extend for all merged cells
nMergedCols = 1;
@@ -1154,7 +1165,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext)
if (bWorksInPixels)
nPosXLogic = rRenderContext.PixelToLogic(Point(nPosX, 0)).X();
- drawCells(rRenderContext, boost::optional<Color>(), nullptr, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, nullptr, pOldDataBarInfo, nullptr, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap());
+ drawCells(rRenderContext, boost::optional<Color>(), nullptr, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, nullptr, pOldDataBarInfo, nullptr, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap(), bWorksInPixels);
nArrY += nSkip;
}