sc/inc/fillinfo.hxx | 1 + sc/source/core/data/colorscale.cxx | 6 ++++++ sc/source/ui/view/output.cxx | 18 +++++++++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-)
New commits: commit e910ee9278e38449212840efe9dd41d37816db7d Author: Tomaž Vajngerl <[email protected]> AuthorDate: Sun Jan 9 13:04:18 2022 +0900 Commit: Andras Timar <[email protected]> CommitDate: Thu Jan 13 10:05:58 2022 +0100 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 <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx index 850fb4738ae0..efff6220f853 100644 --- a/sc/inc/fillinfo.hxx +++ b/sc/inc/fillinfo.hxx @@ -93,6 +93,7 @@ struct ScIconSetInfo { sal_Int32 nIconIndex; ScIconSetType eIconSetType; + long mnHeight = 0; bool mbShowValue; }; diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 64c0d990c147..754c9e656734 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -16,6 +16,8 @@ #include <tokenarray.hxx> #include <refupdatecontext.hxx> #include <refdata.hxx> +#include <editeng/fhgtitem.hxx> +#include <scitems.hxx> #include <formula/token.hxx> #include <vcl/bitmapex.hxx> @@ -1056,6 +1058,10 @@ std::unique_ptr<ScIconSetInfo> ScIconSetFormat::GetIconSetInfo(const ScAddress& std::unique_ptr<ScIconSetInfo> pInfo(new ScIconSetInfo); + const SfxPoolItem& rPoolItem = mpDoc->GetPattern(rAddr)->GetItem(ATTR_FONT_HEIGHT); + long aFontHeight = static_cast<const SvxFontHeightItem&>(rPoolItem).GetHeight(); + pInfo->mnHeight = aFontHeight; + if(mpFormatData->mbReverse) { sal_Int32 nMaxIndex = mpFormatData->m_Entries.size() - 1; 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,
