21#include <com/sun/star/awt/Size.hpp>
22#include <com/sun/star/beans/XPropertySet.hpp>
31using ::com::sun::star::uno::Reference;
32using ::com::sun::star::uno::Any;
33using ::com::sun::star::uno::Exception;
40 const awt::Size & rOldReferenceSize,
41 const awt::Size & rNewReferenceSize )
43 if( rOldReferenceSize.Width <= 0 ||
44 rOldReferenceSize.Height <= 0 )
48 static_cast< double >( rNewReferenceSize.Width ) /
static_cast< double >( rOldReferenceSize.Width ),
49 static_cast< double >( rNewReferenceSize.Height ) /
static_cast< double >( rOldReferenceSize.Height ))
55 const awt::Size & rOldReferenceSize,
56 const awt::Size & rNewReferenceSize )
58 float fFontHeight = 0;
65 for (
auto const&
property : aProperties)
69 if( xTargetProperties.SvxShape::getPropertyValue(
property) >>= fFontHeight )
71 xTargetProperties.SvxShape::setPropertyValue(
73 Any(
static_cast< float >(
74 calculate( fFontHeight, rOldReferenceSize, rNewReferenceSize ))));
77 catch(
const Exception & )
85 const Reference< XPropertySet > & xTargetProperties,
86 const awt::Size & rOldReferenceSize,
87 const awt::Size & rNewReferenceSize )
89 if( ! xTargetProperties.is())
92 float fFontHeight = 0;
99 for (
auto const&
property : aProperties)
103 if( xTargetProperties->getPropertyValue(
property) >>= fFontHeight )
105 xTargetProperties->setPropertyValue(
107 Any(
static_cast< float >(
108 calculate( fFontHeight, rOldReferenceSize, rNewReferenceSize ))));
111 catch(
const Exception & )
PropertiesInfo aProperties
static double calculate(double fValue, const css::awt::Size &rOldReferenceSize, const css::awt::Size &rNewReferenceSize)
static void adaptFontSizes(const css::uno::Reference< css::beans::XPropertySet > &xTargetProperties, const css::awt::Size &rOldReferenceSize, const css::awt::Size &rNewReferenceSize)
#define DBG_UNHANDLED_EXCEPTION(...)