20#include <rtl/tencinfo.h>
22#include <com/sun/star/awt/FontWeight.hpp>
23#include <com/sun/star/awt/FontSlant.hpp>
24#include <com/sun/star/awt/FontStrikeout.hpp>
25#include <com/sun/star/awt/FontUnderline.hpp>
26#include <com/sun/star/beans/XPropertySet.hpp>
33 const uno::Reference< beans::XPropertySet >& rxModelProps ) :
34 mxProps( rxModelProps,
uno::UNO_SET_THROW )
43 return aAny.get< OUString >();
54 return aAny.get<
float >();
59 mxProps->setPropertyValue(
"FontHeight" ,
uno::Any(
static_cast< float >( fSize ) ) );
65 return rtl_getBestWindowsCharsetFromTextEncoding(
static_cast< rtl_TextEncoding
>( aAny.get< sal_Int16 >() ) );
70 rtl_TextEncoding eFontEnc = RTL_TEXTENCODING_DONTKNOW;
72 eFontEnc = rtl_getTextEncodingFromWindowsCharset(
static_cast< sal_uInt8 >( nCharset ) );
73 if( eFontEnc == RTL_TEXTENCODING_DONTKNOW )
74 throw uno::RuntimeException(
"an unknown or missing encoding");
75 mxProps->setPropertyValue(
"FontCharset" ,
uno::Any(
static_cast< sal_Int16
>( eFontEnc ) ) );
91 return aAny.get<
float >() > awt::FontWeight::NORMAL;
96 mxProps->setPropertyValue(
"FontWeight" ,
uno::Any( bBold ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL ) );
102 return aAny.get< awt::FontSlant >() != awt::FontSlant_NONE;
107 mxProps->setPropertyValue(
"FontSlant" ,
uno::Any( bItalic ? awt::FontSlant_ITALIC : awt::FontSlant_NONE ) );
113 return aAny.get< sal_Int16 >() != awt::FontUnderline::NONE;
118 mxProps->setPropertyValue(
"FontUnderline" ,
uno::Any( bUnderline ? awt::FontUnderline::SINGLE : awt::FontUnderline::NONE ) );
124 return aAny.get< sal_Int16 >() != awt::FontStrikeout::NONE;
129 mxProps->setPropertyValue(
"FontStrikeout" ,
uno::Any( bStrikethrough ? awt::FontStrikeout::SINGLE : awt::FontStrikeout::NONE ) );
virtual void SAL_CALL setWeight(sal_Int16 nWeight) override
css::uno::Reference< css::beans::XPropertySet > mxProps
virtual void SAL_CALL setItalic(sal_Bool bItalic) override
virtual sal_Bool SAL_CALL getUnderline() override
virtual void SAL_CALL setSize(double fSize) override
virtual void SAL_CALL setName(const OUString &rName) override
virtual OUString SAL_CALL getName() override
virtual void SAL_CALL setUnderline(sal_Bool bUnderline) override
VbaNewFont(const css::uno::Reference< css::beans::XPropertySet > &rxModelProps)
virtual void SAL_CALL setCharset(sal_Int16 nCharset) override
virtual void SAL_CALL setStrikethrough(sal_Bool bStrikethrough) override
virtual double SAL_CALL getSize() override
virtual sal_Bool SAL_CALL getBold() override
virtual sal_Int16 SAL_CALL getWeight() override
virtual sal_Bool SAL_CALL getItalic() override
virtual void SAL_CALL setBold(sal_Bool bBold) override
virtual sal_Int16 SAL_CALL getCharset() override
virtual sal_Bool SAL_CALL getStrikethrough() override