summaryrefslogtreecommitdiff
path: root/chart2/source/tools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-01-01 10:06:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-02 11:38:12 +0100
commit0691e3a0d901fe0373ec261cb22e8e6745303e5f (patch)
treec1cbe28a22195068146a1e538452d537a2d3c47d /chart2/source/tools
parent97429d17665a4a251701b0ba5281413c7fcf56ab (diff)
use concrete types in chart2, createText
Change-Id: Ic3b5920192c62cbdd025b480b01d04fb57d0be00 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127837 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/tools')
-rw-r--r--chart2/source/tools/RelativeSizeHelper.cxx33
1 files changed, 32 insertions, 1 deletions
diff --git a/chart2/source/tools/RelativeSizeHelper.cxx b/chart2/source/tools/RelativeSizeHelper.cxx
index a142d5b293e8..c1bdc28fcb35 100644
--- a/chart2/source/tools/RelativeSizeHelper.cxx
+++ b/chart2/source/tools/RelativeSizeHelper.cxx
@@ -21,7 +21,7 @@
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <tools/diagnose_ex.h>
-
+#include <svx/unoshape.hxx>
#include <vector>
#include <algorithm>
@@ -52,6 +52,37 @@ double RelativeSizeHelper::calculate(
}
void RelativeSizeHelper::adaptFontSizes(
+ SvxShapeText& xTargetProperties,
+ const awt::Size & rOldReferenceSize,
+ const awt::Size & rNewReferenceSize )
+{
+ float fFontHeight = 0;
+
+ vector< OUString > aProperties;
+ aProperties.emplace_back("CharHeight" );
+ aProperties.emplace_back("CharHeightAsian" );
+ aProperties.emplace_back("CharHeightComplex" );
+
+ for (auto const& property : aProperties)
+ {
+ try
+ {
+ if( xTargetProperties.SvxShape::getPropertyValue(property) >>= fFontHeight )
+ {
+ xTargetProperties.SvxShape::setPropertyValue(
+ property,
+ Any( static_cast< float >(
+ calculate( fFontHeight, rOldReferenceSize, rNewReferenceSize ))));
+ }
+ }
+ catch( const Exception & )
+ {
+ DBG_UNHANDLED_EXCEPTION("chart2");
+ }
+ }
+}
+
+void RelativeSizeHelper::adaptFontSizes(
const Reference< XPropertySet > & xTargetProperties,
const awt::Size & rOldReferenceSize,
const awt::Size & rNewReferenceSize )