summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/output.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-01-09 13:04:18 +0900
committerAndras Timar <andras.timar@collabora.com>2022-01-13 10:05:58 +0100
commite910ee9278e38449212840efe9dd41d37816db7d (patch)
treef2ea62585bef0802b929095efb182e7e8ae13988 /sc/source/ui/view/output.cxx
parent98d897ff144fa97b9b4db3a0e5657630747feca9 (diff)
sc: make icon size of cond. formatting same as font size
This makes the behavior of the Calc te same as other spreadsheet programs, where the icon size of the conditional formatting is the same as the font size and not the actual cell height (as it is the behaviour now). (cherry picked from commit 80956822bff4a0105ca53fc3fb99cfa1128b4f13) Change-Id: I00c96ad83458cd31f67c0b6f566e3d01dd8cd47b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128225 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sc/source/ui/view/output.cxx')
-rw-r--r--sc/source/ui/view/output.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index ae29550b0c08..9948b666eebf 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -39,6 +39,7 @@
#include <sal/log.hxx>
#include <comphelper/lok.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <tools/UnitConversion.hxx>
#include <output.hxx>
#include <document.hxx>
@@ -907,12 +908,23 @@ 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)
{
- //long nSize = 16;
ScIconSetType eType = pOldIconSetInfo->eIconSetType;
sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
const BitmapEx& rIcon = getIcon(rIconSetBitmapMap, eType, nIndex);
- long aOrigSize = std::max<long>(0,std::min(rRect.GetSize().getWidth() - 4 * nOneX, rRect.GetSize().getHeight() -4 * nOneY));
- rRenderContext.DrawBitmapEx( Point( rRect.Left() + 2 * nOneX, rRect.Top() + 2 * nOneY), Size(aOrigSize, aOrigSize), rIcon );
+
+ long aHeight = 300;
+
+ if (pOldIconSetInfo->mnHeight)
+ aHeight = convertTwipToMm100(pOldIconSetInfo->mnHeight);
+
+ Size aSize = rIcon.GetSizePixel();
+ double fRatio = aSize.Width() / aSize.Height();
+ long aWidth = fRatio * aHeight;
+
+ rRenderContext.Push();
+ rRenderContext.SetClipRegion(vcl::Region(rRect));
+ rRenderContext.DrawBitmapEx(Point(rRect.Left() + 2 * nOneX, rRect.Bottom() - 2 * nOneY - aHeight), Size(aWidth, aHeight), rIcon);
+ rRenderContext.Pop();
}
void drawCells(vcl::RenderContext& rRenderContext, boost::optional<Color> const & pColor, const SvxBrushItem* pBackground, boost::optional<Color>& pOldColor, const SvxBrushItem*& pOldBackground,