diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-01-09 13:04:18 +0900 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-01-11 13:38:18 +0100 |
commit | 204409386483cfb369e8fe2ed79b6560a1a52d8f (patch) | |
tree | 84dc17cbcc1e0431b065cfe89d7b3d24704300a7 /sc | |
parent | f0a907a62af92ea067f4442979d2c2891e46781e (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).
Change-Id: I00c96ad83458cd31f67c0b6f566e3d01dd8cd47b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128186
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/fillinfo.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/colorscale.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/output.cxx | 18 |
3 files changed, 22 insertions, 3 deletions
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx index 0e17f179cc58..ebde70abcdcc 100644 --- a/sc/inc/fillinfo.hxx +++ b/sc/inc/fillinfo.hxx @@ -93,6 +93,7 @@ struct ScIconSetInfo { sal_Int32 nIconIndex; ScIconSetType eIconSetType; + tools::Long mnHeight = 0; bool mbShowValue; }; diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 52496653ab1b..361e51bd3c01 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> @@ -1057,6 +1059,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); + tools::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 0b715dfc21d3..59beff1a9c83 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, tools::Long nOneX, tools::Long nOneY, sc::IconSetBitmapMap & rIconSetBitmapMap) { - //long nSize = 16; ScIconSetType eType = pOldIconSetInfo->eIconSetType; sal_Int32 nIndex = pOldIconSetInfo->nIconIndex; const BitmapEx& rIcon = getIcon(rIconSetBitmapMap, eType, nIndex); - tools::Long aOrigSize = std::max<tools::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 ); + + tools::Long aHeight = 300; + + if (pOldIconSetInfo->mnHeight) + aHeight = convertTwipToMm100(pOldIconSetInfo->mnHeight); + + Size aSize = rIcon.GetSizePixel(); + double fRatio = aSize.Width() / aSize.Height(); + tools::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, std::optional<Color> const & pColor, const SvxBrushItem* pBackground, std::optional<Color>& pOldColor, const SvxBrushItem*& pOldBackground, |