diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-02 12:35:41 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-02 16:31:48 +0000 |
commit | 2f33a8cd231d3842a1e5521e3a61d8e73517137b (patch) | |
tree | 184c69d8545ce64cfc1c9e25fe4df9319eb252f4 | |
parent | fb41ebff32371ee7a7e07f671f7c769a8bb18718 (diff) |
coverity#1403662 Mixing enum types
Change-Id: Ic5e797c65dfc736a9ef0ab14f3ae563216143947
Reviewed-on: https://gerrit.libreoffice.org/36020
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | chart2/source/view/main/DummyXShape.cxx | 6 | ||||
-rw-r--r-- | editeng/source/items/textitem.cxx | 10 | ||||
-rw-r--r-- | editeng/source/uno/unofdesc.cxx | 8 | ||||
-rw-r--r-- | extensions/source/propctrlr/fontdialog.cxx | 9 | ||||
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 4 | ||||
-rw-r--r-- | forms/source/component/Grid.cxx | 10 | ||||
-rw-r--r-- | include/toolkit/helper/vclunohelper.hxx | 7 | ||||
-rw-r--r-- | include/vcl/unohelp.hxx | 8 | ||||
-rw-r--r-- | reportdesign/source/ui/misc/UITools.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/excel/xlstyle.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/oox/stylesbuffer.cxx | 4 | ||||
-rw-r--r-- | svx/source/fmcomp/fmgridif.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/html/htmlform.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/html/htmlforw.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 7 | ||||
-rw-r--r-- | toolkit/source/helper/vclunohelper.cxx | 177 | ||||
-rw-r--r-- | vcl/source/app/unohelp.cxx | 167 | ||||
-rw-r--r-- | xmloff/source/style/postuhdl.cxx | 5 |
19 files changed, 232 insertions, 223 deletions
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index b066f39a2d2d..322a21ec000e 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -27,7 +27,7 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/implbase.hxx> #include <editeng/unoprnms.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <basegfx/point/b2dpoint.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> @@ -741,13 +741,13 @@ struct FontAttribSetter else if(rPropName == "CharWeight") { float fWeight = rProp.second.get<float>(); - FontWeight eFontWeight = VCLUnoHelper::ConvertFontWeight(fWeight); + FontWeight eFontWeight = vcl::unohelper::ConvertFontWeight(fWeight); mrFont.SetWeight(eFontWeight); } else if(rPropName == "ChartWidth") { float fWidth = rProp.second.get<float>(); - FontWidth eFontWidth = VCLUnoHelper::ConvertFontWidth(fWidth); + FontWidth eFontWidth = vcl::unohelper::ConvertFontWidth(fWidth); mrFont.SetAverageFontWidth(eFontWidth); } } diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index 597086e3a4d7..72fc2c210f66 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -22,11 +22,11 @@ #include <com/sun/star/frame/status/FontHeight.hpp> #include <vcl/bitmapex.hxx> #include <tools/stream.hxx> -#include <toolkit/helper/vclunohelper.hxx> #include <math.h> #include <rtl/math.hxx> #include <unotools/fontdefs.hxx> #include <vcl/outdev.hxx> +#include <vcl/unohelp.hxx> #include <editeng/eeitem.hxx> #include <svtools/unitconv.hxx> @@ -512,7 +512,7 @@ bool SvxPostureItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= (bool)GetBoolValue(); break; case MID_POSTURE: - rVal <<= VCLUnoHelper::ConvertFontSlant(GetValue()); + rVal <<= vcl::unohelper::ConvertFontSlant(GetValue()); break; } return true; @@ -537,7 +537,7 @@ bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) eSlant = (awt::FontSlant)nValue; } - SetValue(VCLUnoHelper::ConvertFontSlant(eSlant)); + SetValue(vcl::unohelper::ConvertFontSlant(eSlant)); } } return true; @@ -649,7 +649,7 @@ bool SvxWeightItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const break; case MID_WEIGHT: { - rVal <<= (float)( VCLUnoHelper::ConvertFontWeight( GetValue() ) ); + rVal <<= (float)( vcl::unohelper::ConvertFontWeight( GetValue() ) ); } break; } @@ -674,7 +674,7 @@ bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) return false; fValue = (float)nValue; } - SetValue( VCLUnoHelper::ConvertFontWeight((float)fValue) ); + SetValue( vcl::unohelper::ConvertFontWeight((float)fValue) ); } break; } diff --git a/editeng/source/uno/unofdesc.cxx b/editeng/source/uno/unofdesc.cxx index 48dbeb4ddcc9..3d0b90ed3d02 100644 --- a/editeng/source/uno/unofdesc.cxx +++ b/editeng/source/uno/unofdesc.cxx @@ -21,7 +21,6 @@ #include <editeng/eeitem.hxx> #include <com/sun/star/uno/Any.hxx> -#include <toolkit/helper/vclunohelper.hxx> #include <editeng/fontitem.hxx> #include <editeng/fhgtitem.hxx> #include <editeng/postitem.hxx> @@ -31,6 +30,7 @@ #include <editeng/wrlmitem.hxx> #include <editeng/memberids.hrc> #include <svl/itempool.hxx> +#include <vcl/unohelp.hxx> #include <editeng/unofdesc.hxx> #include <editeng/svxfont.hxx> @@ -48,7 +48,7 @@ void SvxUnoFontDescriptor::ConvertToFont( const awt::FontDescriptor& rDesc, vcl: rFont.SetPitch( (FontPitch)rDesc.Pitch ); rFont.SetOrientation( (short)(rDesc.Orientation*10) ); rFont.SetKerning( rDesc.Kerning ? FontKerning::FontSpecific : FontKerning::NONE ); - rFont.SetWeight( VCLUnoHelper::ConvertFontWeight(rDesc.Weight) ); + rFont.SetWeight( vcl::unohelper::ConvertFontWeight(rDesc.Weight) ); rFont.SetItalic( (FontItalic)rDesc.Slant ); rFont.SetUnderline( (FontLineStyle)rDesc.Underline ); rFont.SetStrikeout( (FontStrikeout)rDesc.Strikeout ); @@ -66,8 +66,8 @@ void SvxUnoFontDescriptor::ConvertFromFont( const vcl::Font& rFont, awt::FontDes rDesc.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch()); rDesc.Orientation = static_cast< float >(rFont.GetOrientation() / 10); rDesc.Kerning = rFont.IsKerning(); - rDesc.Weight = VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() ); - rDesc.Slant = VCLUnoHelper::ConvertFontSlant( rFont.GetItalic() ); + rDesc.Weight = vcl::unohelper::ConvertFontWeight( rFont.GetWeight() ); + rDesc.Slant = vcl::unohelper::ConvertFontSlant( rFont.GetItalic() ); rDesc.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline()); rDesc.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout()); rDesc.WordLineMode = rFont.IsWordLineMode(); diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx index 9578f132f18f..88721feffa37 100644 --- a/extensions/source/propctrlr/fontdialog.cxx +++ b/extensions/source/propctrlr/fontdialog.cxx @@ -22,6 +22,7 @@ #include "formresid.hrc" #include "modulepcr.hxx" #include <vcl/svapp.hxx> +#include <vcl/unohelp.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/types.hxx> #include <comphelper/extract.hxx> @@ -226,8 +227,8 @@ namespace pcr nFontHeight = (float)OutputDevice::LogicToLogic(Size(0, (sal_Int32)nFontHeight), MapUnit::MapPoint, MapUnit::MapTwip).Height(); SvxFontHeightItem aSvxFontHeightItem((sal_uInt32)nFontHeight,100,CFID_HEIGHT); - FontWeight eWeight=VCLUnoHelper::ConvertFontWeight(nFontWeight); - FontItalic eItalic=VCLUnoHelper::ConvertFontSlant(nFontSlant); + FontWeight eWeight=vcl::unohelper::ConvertFontWeight(nFontWeight); + FontItalic eItalic=vcl::unohelper::ConvertFontSlant(nFontSlant); FontLineStyle eUnderline=(FontLineStyle)nFontLineStyle; FontStrikeout eStrikeout=(FontStrikeout)nFontStrikeout; @@ -341,7 +342,7 @@ namespace pcr const SvxWeightItem& rWeightItem = static_cast<const SvxWeightItem&>(_rSet.Get(CFID_WEIGHT)); - float nWeight = VCLUnoHelper::ConvertFontWeight(rWeightItem.GetWeight()); + float nWeight = vcl::unohelper::ConvertFontWeight(rWeightItem.GetWeight()); lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_WEIGHT,makeAny(nWeight)); } @@ -354,7 +355,7 @@ namespace pcr const SvxPostureItem& rPostureItem = static_cast<const SvxPostureItem&>(_rSet.Get(CFID_POSTURE)); - css::awt::FontSlant eSlant = VCLUnoHelper::ConvertFontSlant(rPostureItem.GetPosture()); + css::awt::FontSlant eSlant = vcl::unohelper::ConvertFontSlant(rPostureItem.GetPosture()); lcl_pushBackPropertyValue( _out_properties, PROPERTY_FONT_SLANT, makeAny((sal_Int16)eSlant)); } diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index bb65731c13f2..0593d8839492 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -93,7 +93,7 @@ #include <svx/numinf.hxx> #include <svx/svxdlg.hxx> #include <svx/svxids.hrc> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <tools/diagnose_ex.h> #include <tools/resary.hxx> #include <vcl/msgbox.hxx> @@ -760,7 +760,7 @@ namespace pcr displayName.append( ", " ); // font style - ::FontWeight eWeight = VCLUnoHelper::ConvertFontWeight( aFont.Weight ); + ::FontWeight eWeight = vcl::unohelper::ConvertFontWeight( aFont.Weight ); sal_uInt16 nStyleResID = RID_STR_FONTSTYLE_REGULAR; if ( aFont.Slant == FontSlant_ITALIC ) { diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx index c2bb083b7f9c..54b6809f6a41 100644 --- a/forms/source/component/Grid.cxx +++ b/forms/source/component/Grid.cxx @@ -33,7 +33,7 @@ #include <comphelper/container.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/queryinterface.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <vcl/svapp.hxx> using namespace ::com::sun::star::uno; @@ -823,7 +823,7 @@ void OGridControlModel::write(const Reference<XObjectOutputStream>& _rxOutStream if ( nAnyMask & FONTDESCRIPTOR ) { // Attrib - _rxOutStream->writeShort( sal::static_int_cast< sal_Int16 >( VCLUnoHelper::ConvertFontWeight( aFont.Weight ) ) ); + _rxOutStream->writeShort( sal::static_int_cast< sal_Int16 >( vcl::unohelper::ConvertFontWeight( aFont.Weight ) ) ); _rxOutStream->writeShort( sal::static_int_cast< sal_Int16 >( aFont.Slant ) ); _rxOutStream->writeShort( aFont.Underline ); _rxOutStream->writeShort( aFont.Strikeout ); @@ -833,7 +833,7 @@ void OGridControlModel::write(const Reference<XObjectOutputStream>& _rxOutStream // Size _rxOutStream->writeLong( aFont.Width ); _rxOutStream->writeLong( aFont.Height ); - _rxOutStream->writeShort( sal::static_int_cast< sal_Int16 >( VCLUnoHelper::ConvertFontWidth( aFont.CharacterWidth ) ) ); + _rxOutStream->writeShort( sal::static_int_cast< sal_Int16 >( vcl::unohelper::ConvertFontWidth( aFont.CharacterWidth ) ) ); // Type _rxOutStream->writeUTF( aFont.Name ); _rxOutStream->writeUTF( aFont.StyleName ); @@ -933,7 +933,7 @@ void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream) FontDescriptor aFont( getFont() ); if ( nAnyMask & FONTATTRIBS ) { - aFont.Weight = (float)VCLUnoHelper::ConvertFontWeight( _rxInStream->readShort() ); + aFont.Weight = (float)vcl::unohelper::ConvertFontWeight( _rxInStream->readShort() ); aFont.Slant = (FontSlant)_rxInStream->readShort(); aFont.Underline = _rxInStream->readShort(); aFont.Strikeout = _rxInStream->readShort(); @@ -945,7 +945,7 @@ void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream) { aFont.Width = (sal_Int16)_rxInStream->readLong(); aFont.Height = (sal_Int16)_rxInStream->readLong(); - aFont.CharacterWidth = (float)VCLUnoHelper::ConvertFontWidth( _rxInStream->readShort() ); + aFont.CharacterWidth = (float)vcl::unohelper::ConvertFontWidth( _rxInStream->readShort() ); } if ( nAnyMask & FONTTYPE ) { diff --git a/include/toolkit/helper/vclunohelper.hxx b/include/toolkit/helper/vclunohelper.hxx index 2dbf25320a24..91d0905814e3 100644 --- a/include/toolkit/helper/vclunohelper.hxx +++ b/include/toolkit/helper/vclunohelper.hxx @@ -25,7 +25,6 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/lang/IllegalArgumentException.hpp> -#include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/awt/MouseEvent.hpp> #include <vcl/bitmapex.hxx> @@ -104,12 +103,6 @@ public: static vcl::Font CreateFont( const css::awt::FontDescriptor& rDescr, const vcl::Font& rInitFont ); static vcl::Font CreateFont( const css::uno::Reference< css::awt::XFont >& rxFont ); static css::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric ); - static float ConvertFontWidth( FontWidth eWidth ); - static FontWidth ConvertFontWidth( float f ); - static float ConvertFontWeight( FontWeight eWeight ); - static FontWeight ConvertFontWeight( float f ); - static css::awt::FontSlant ConvertFontSlant( FontItalic eWeight ); - static FontItalic ConvertFontSlant( css::awt::FontSlant ); // Rectangle static bool IsZero(const css::awt::Rectangle& rRect); diff --git a/include/vcl/unohelp.hxx b/include/vcl/unohelp.hxx index c7ef4419c7ea..7fe34d48a6da 100644 --- a/include/vcl/unohelp.hxx +++ b/include/vcl/unohelp.hxx @@ -21,7 +21,9 @@ #define INCLUDED_VCL_UNOHELP_HXX #include <com/sun/star/uno/Reference.h> +#include <com/sun/star/awt/FontSlant.hpp> #include <rtl/ustring.hxx> +#include <tools/fontenum.hxx> #include <vcl/dllapi.h> namespace com { @@ -53,6 +55,12 @@ namespace unohelper VCL_DLLPUBLIC css::uno::Reference < css::i18n::XBreakIterator > CreateBreakIterator(); VCL_DLLPUBLIC css::uno::Reference < css::i18n::XCharacterClassification> CreateCharacterClassification(); VCL_DLLPUBLIC void NotifyAccessibleStateEventGlobally( const css::accessibility::AccessibleEventObject& rEventObject ); +VCL_DLLPUBLIC float ConvertFontWidth( FontWidth eWidth ); +VCL_DLLPUBLIC FontWidth ConvertFontWidth( float f ); +VCL_DLLPUBLIC float ConvertFontWeight( FontWeight eWeight ); +VCL_DLLPUBLIC FontWeight ConvertFontWeight( float f ); +VCL_DLLPUBLIC css::awt::FontSlant ConvertFontSlant( FontItalic eWeight ); +VCL_DLLPUBLIC FontItalic ConvertFontSlant( css::awt::FontSlant ); }} // namespace vcl::unohelper #endif // INCLUDED_VCL_UNOHELP_HXX diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 7d6294b4e062..f304c6f66927 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -29,6 +29,7 @@ #include <tools/diagnose_ex.h> #include <vcl/svapp.hxx> +#include <vcl/unohelp.hxx> #include <vcl/window.hxx> #include <vcl/settings.hxx> @@ -421,7 +422,7 @@ namespace if ( SfxItemState::SET == _rItemSet.GetItemState( ITEMID_CHARSCALE_W,true,&pItem) && dynamic_cast< const SvxCharScaleWidthItem *>( pItem ) != nullptr) { const SvxCharScaleWidthItem* pCharItem = static_cast<const SvxCharScaleWidthItem*>(pItem); - aNewFont.SetWidthType(VCLUnoHelper::ConvertFontWidth(pCharItem->GetValue())); + aNewFont.SetWidthType(vcl::unohelper::ConvertFontWidth(pCharItem->GetValue())); } if ( SfxItemState::SET == _rItemSet.GetItemState( ITEMID_UNDERLINE,true,&pItem) && dynamic_cast< const SvxUnderlineItem *>( pItem ) != nullptr) { diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx index 1df8cbab8a19..3b034963e895 100644 --- a/sc/source/filter/excel/xlstyle.cxx +++ b/sc/source/filter/excel/xlstyle.cxx @@ -28,7 +28,7 @@ #include <sal/macros.h> #include <rtl/tencinfo.h> #include <svtools/colorcfg.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <editeng/svxfont.hxx> #include "global.hxx" #include "xlroot.hxx" @@ -417,7 +417,7 @@ Awt::FontSlant XclFontData::GetApiPosture() const float XclFontData::GetApiWeight() const { - return VCLUnoHelper::ConvertFontWeight( GetScWeight() ); + return vcl::unohelper::ConvertFontWeight( GetScWeight() ); } sal_Int16 XclFontData::GetApiUnderline() const @@ -479,7 +479,7 @@ void XclFontData::SetApiPosture( Awt::FontSlant eApiPosture ) void XclFontData::SetApiWeight( float fApiWeight ) { - SetScWeight( VCLUnoHelper::ConvertFontWeight( fApiWeight ) ); + SetScWeight( vcl::unohelper::ConvertFontWeight( fApiWeight ) ); } void XclFontData::SetApiUnderline( sal_Int16 nApiUnderl ) diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index eccdd456f900..c2a9cb82ca25 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -53,7 +53,7 @@ #include <editeng/brushitem.hxx> #include <svx/rotmodit.hxx> #include <tools/fontenum.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <rtl/tencinfo.h> #include <rtl/ustrbuf.hxx> #include <oox/core/filterbase.hxx> @@ -903,7 +903,7 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, bool bEditEngineText, bool bSkip // font weight if( maUsedFlags.mbWeightUsed ) { - ::FontWeight fWeight = VCLUnoHelper::ConvertFontWeight( maApiData.maDesc.Weight ); + ::FontWeight fWeight = vcl::unohelper::ConvertFontWeight( maApiData.maDesc.Weight ); SvxWeightItem aWeightItem( fWeight, ATTR_FONT_WEIGHT ); ScfTools::PutItem( rItemSet, aWeightItem, bEditEngineText ? EE_CHAR_WEIGHT : ATTR_FONT_WEIGHT, bSkipPoolDefs ); ScfTools::PutItem( rItemSet, aWeightItem, bEditEngineText ? EE_CHAR_WEIGHT_CTL : ATTR_CTL_FONT_WEIGHT, bSkipPoolDefs ); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 3a8b87f7d5f5..fb116737b3ee 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -54,7 +54,7 @@ #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <tools/diagnose_ex.h> #include <sal/macros.h> @@ -89,9 +89,9 @@ css::awt::FontDescriptor ImplCreateFontDescriptor( const vcl::Font& rFont ) aFD.Family = (sal_Int16)rFont.GetFamilyType(); aFD.CharSet = rFont.GetCharSet(); aFD.Pitch = (sal_Int16)rFont.GetPitch(); - aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() ); - aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() ); - aFD.Slant = VCLUnoHelper::ConvertFontSlant( rFont.GetItalic() ); + aFD.CharacterWidth = vcl::unohelper::ConvertFontWidth( rFont.GetWidthType() ); + aFD.Weight= vcl::unohelper::ConvertFontWeight( rFont.GetWeight() ); + aFD.Slant = vcl::unohelper::ConvertFontSlant( rFont.GetItalic() ); aFD.Underline = (sal_Int16)rFont.GetUnderline(); aFD.Strikeout = (sal_Int16)rFont.GetStrikeout(); aFD.Orientation = rFont.GetOrientation(); @@ -111,8 +111,8 @@ vcl::Font ImplCreateFont( const css::awt::FontDescriptor& rDescr ) aFont.SetFamily( (FontFamily)rDescr.Family ); aFont.SetCharSet( (rtl_TextEncoding)rDescr.CharSet ); aFont.SetPitch( (FontPitch)rDescr.Pitch ); - aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) ); - aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) ); + aFont.SetWidthType( vcl::unohelper::ConvertFontWidth( rDescr.CharacterWidth ) ); + aFont.SetWeight( vcl::unohelper::ConvertFontWeight( rDescr.Weight ) ); aFont.SetItalic( (FontItalic)rDescr.Slant ); aFont.SetUnderline( (::FontLineStyle)rDescr.Underline ); aFont.SetStrikeout( (::FontStrikeout)rDescr.Strikeout ); diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index c8dc6f681a69..431509fd2f4b 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -22,7 +22,7 @@ #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <svtools/htmlkywd.hxx> #include <svtools/htmltokn.h> #include <svl/urihelper.hxx> @@ -1030,7 +1030,7 @@ uno::Reference< drawing::XShape > SwHTMLParser::InsertControl( true, &pItem ) && xPropSetInfo->hasPropertyByName( sPropName ) ) { - float fVal = VCLUnoHelper::ConvertFontWeight( + float fVal = vcl::unohelper::ConvertFontWeight( static_cast<const SvxWeightItem *>(pItem)->GetWeight() ); aTmp <<= fVal; rFCompPropSet->setPropertyValue( sPropName, aTmp ); diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index 12332ff02e4f..1d6df4fdeaa7 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -38,7 +38,7 @@ #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> #include <svl/urihelper.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <svx/svdouno.hxx> #include <svx/fmglob.hxx> #include <editeng/brushitem.hxx> @@ -1108,7 +1108,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, if( auto x = o3tl::tryAccess<float>(aTmp) ) { FontWeight eWeight = - VCLUnoHelper::ConvertFontWeight( *x ); + vcl::unohelper::ConvertFontWeight( *x ); if( eWeight != WEIGHT_DONTKNOW && eWeight != WEIGHT_NORMAL ) aItemSet.Put( SvxWeightItem( eWeight, RES_CHRATR_WEIGHT ) ); } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index fec9c2cd0e53..4e25a26c8cac 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -21,7 +21,7 @@ #include <vcl/svapp.hxx> #include <vcl/outdev.hxx> -#include <toolkit/helper/vclunohelper.hxx> +#include <vcl/unohelp.hxx> #include <com/sun/star/form/XForm.hpp> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/drawing/XShapes.hpp> @@ -2353,7 +2353,7 @@ awt::Size SwWW8ImplReader::MiserableDropDownFormHack(const OUString &rString, break; case RES_CHRATR_WEIGHT: - aTmp <<= (float)VCLUnoHelper::ConvertFontWeight( + aTmp <<= (float)vcl::unohelper::ConvertFontWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() ); aFont.SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() ); break; diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 876cb9e05eff..9e4c2e55650b 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -47,6 +47,7 @@ #include <comphelper/sequence.hxx> #include <comphelper/extract.hxx> #include <vcl/svapp.hxx> +#include <vcl/unohelp.hxx> #include <uno/data.h> #include <memory> @@ -733,13 +734,13 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt OutStream->writeLong( aFD.Height ); OutStream->writeShort( sal::static_int_cast< sal_Int16 >( - VCLUnoHelper::ConvertFontWidth( aFD.CharacterWidth )) ); + vcl::unohelper::ConvertFontWidth(aFD.CharacterWidth)) ); } else if ( n == BASEPROPERTY_FONT_ATTRIBS ) { OutStream->writeShort( sal::static_int_cast< sal_Int16 >( - VCLUnoHelper::ConvertFontWeight( aFD.Weight )) ); + vcl::unohelper::ConvertFontWeight(aFD.Weight)) ); OutStream->writeShort( sal::static_int_cast< sal_Int16 >(aFD.Slant) ); OutStream->writeShort( aFD.Underline ); @@ -957,7 +958,7 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre if ( maData.find(BASEPROPERTY_FONTDESCRIPTOR) != maData.end() ) // due to defaults... maData[BASEPROPERTY_FONTDESCRIPTOR] >>= *pFD; } - pFD->Weight = VCLUnoHelper::ConvertFontWeight( (FontWeight) InStream->readShort() ); + pFD->Weight = vcl::unohelper::ConvertFontWeight((FontWeight) InStream->readShort()); pFD->Slant = (css::awt::FontSlant)InStream->readShort(); pFD->Underline = InStream->readShort(); pFD->Strikeout = InStream->readShort(); diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 0c2004234bff..2c424dbd7bec 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -20,6 +20,7 @@ #include <tools/stream.hxx> #include <vcl/bitmap.hxx> #include <vcl/window.hxx> +#include <vcl/unohelp.hxx> #include <sal/macros.h> #include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/awt/XBitmap.hpp> @@ -196,170 +197,6 @@ css::uno::Reference< css::awt::XControlContainer> VCLUnoHelper::CreateControlCon return x; } -float VCLUnoHelper::ConvertFontWidth( FontWidth eWidth ) -{ - if( eWidth == WIDTH_DONTKNOW ) - return css::awt::FontWidth::DONTKNOW; - else if( eWidth == WIDTH_ULTRA_CONDENSED ) - return css::awt::FontWidth::ULTRACONDENSED; - else if( eWidth == WIDTH_EXTRA_CONDENSED ) - return css::awt::FontWidth::EXTRACONDENSED; - else if( eWidth == WIDTH_CONDENSED ) - return css::awt::FontWidth::CONDENSED; - else if( eWidth == WIDTH_SEMI_CONDENSED ) - return css::awt::FontWidth::SEMICONDENSED; - else if( eWidth == WIDTH_NORMAL ) - return css::awt::FontWidth::NORMAL; - else if( eWidth == WIDTH_SEMI_EXPANDED ) - return css::awt::FontWidth::SEMIEXPANDED; - else if( eWidth == WIDTH_EXPANDED ) - return css::awt::FontWidth::EXPANDED; - else if( eWidth == WIDTH_EXTRA_EXPANDED ) - return css::awt::FontWidth::EXTRAEXPANDED; - else if( eWidth == WIDTH_ULTRA_EXPANDED ) - return css::awt::FontWidth::ULTRAEXPANDED; - - OSL_FAIL( "Unknown FontWidth" ); - return css::awt::FontWidth::DONTKNOW; -} - -FontWidth VCLUnoHelper::ConvertFontWidth( float f ) -{ - if( f <= css::awt::FontWidth::DONTKNOW ) - return WIDTH_DONTKNOW; - else if( f <= css::awt::FontWidth::ULTRACONDENSED ) - return WIDTH_ULTRA_CONDENSED; - else if( f <= css::awt::FontWidth::EXTRACONDENSED ) - return WIDTH_EXTRA_CONDENSED; - else if( f <= css::awt::FontWidth::CONDENSED ) - return WIDTH_CONDENSED; - else if( f <= css::awt::FontWidth::SEMICONDENSED ) - return WIDTH_SEMI_CONDENSED; - else if( f <= css::awt::FontWidth::NORMAL ) - return WIDTH_NORMAL; - else if( f <= css::awt::FontWidth::SEMIEXPANDED ) - return WIDTH_SEMI_EXPANDED; - else if( f <= css::awt::FontWidth::EXPANDED ) - return WIDTH_EXPANDED; - else if( f <= css::awt::FontWidth::EXTRAEXPANDED ) - return WIDTH_EXTRA_EXPANDED; - else if( f <= css::awt::FontWidth::ULTRAEXPANDED ) - return WIDTH_ULTRA_EXPANDED; - - OSL_FAIL( "Unknown FontWidth" ); - return WIDTH_DONTKNOW; -} - -float VCLUnoHelper::ConvertFontWeight( FontWeight eWeight ) -{ - if( eWeight == WEIGHT_DONTKNOW ) - return css::awt::FontWeight::DONTKNOW; - else if( eWeight == WEIGHT_THIN ) - return css::awt::FontWeight::THIN; - else if( eWeight == WEIGHT_ULTRALIGHT ) - return css::awt::FontWeight::ULTRALIGHT; - else if( eWeight == WEIGHT_LIGHT ) - return css::awt::FontWeight::LIGHT; - else if( eWeight == WEIGHT_SEMILIGHT ) - return css::awt::FontWeight::SEMILIGHT; - else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) ) - return css::awt::FontWeight::NORMAL; - else if( eWeight == WEIGHT_SEMIBOLD ) - return css::awt::FontWeight::SEMIBOLD; - else if( eWeight == WEIGHT_BOLD ) - return css::awt::FontWeight::BOLD; - else if( eWeight == WEIGHT_ULTRABOLD ) - return css::awt::FontWeight::ULTRABOLD; - else if( eWeight == WEIGHT_BLACK ) - return css::awt::FontWeight::BLACK; - - OSL_FAIL( "Unknown FontWeight" ); - return css::awt::FontWeight::DONTKNOW; -} - -FontWeight VCLUnoHelper::ConvertFontWeight( float f ) -{ - if( f <= css::awt::FontWeight::DONTKNOW ) - return WEIGHT_DONTKNOW; - else if( f <= css::awt::FontWeight::THIN ) - return WEIGHT_THIN; - else if( f <= css::awt::FontWeight::ULTRALIGHT ) - return WEIGHT_ULTRALIGHT; - else if( f <= css::awt::FontWeight::LIGHT ) - return WEIGHT_LIGHT; - else if( f <= css::awt::FontWeight::SEMILIGHT ) - return WEIGHT_SEMILIGHT; - else if( f <= css::awt::FontWeight::NORMAL ) - return WEIGHT_NORMAL; - else if( f <= css::awt::FontWeight::SEMIBOLD ) - return WEIGHT_SEMIBOLD; - else if( f <= css::awt::FontWeight::BOLD ) - return WEIGHT_BOLD; - else if( f <= css::awt::FontWeight::ULTRABOLD ) - return WEIGHT_ULTRABOLD; - else if( f <= css::awt::FontWeight::BLACK ) - return WEIGHT_BLACK; - - OSL_FAIL( "Unknown FontWeight" ); - return WEIGHT_DONTKNOW; -} - -css::awt::FontSlant VCLUnoHelper::ConvertFontSlant(FontItalic eItalic) -{ - css::awt::FontSlant eRet(css::awt::FontSlant_DONTKNOW); - switch (eItalic) - { - case ITALIC_NONE: - eRet = css::awt::FontSlant_NONE; - break; - case ITALIC_OBLIQUE: - eRet = css::awt::FontSlant_OBLIQUE; - break; - case ITALIC_NORMAL: - eRet = css::awt::FontSlant_ITALIC; - break; - case ITALIC_DONTKNOW: - eRet = css::awt::FontSlant_DONTKNOW; - break; - case FontItalic_FORCE_EQUAL_SIZE: - eRet = css::awt::FontSlant_MAKE_FIXED_SIZE; - break; - } - return eRet; -} - -FontItalic VCLUnoHelper::ConvertFontSlant(css::awt::FontSlant eSlant) -{ - FontItalic eRet = ITALIC_DONTKNOW; - switch (eSlant) - { - case css::awt::FontSlant_NONE: - eRet = ITALIC_NONE; - break; - case css::awt::FontSlant_OBLIQUE: - eRet = ITALIC_OBLIQUE; - break; - case css::awt::FontSlant_ITALIC: - eRet = ITALIC_NORMAL; - break; - case css::awt::FontSlant_DONTKNOW: - eRet = ITALIC_DONTKNOW; - break; - case css::awt::FontSlant_REVERSE_OBLIQUE: - //there is no vcl reverse oblique - eRet = ITALIC_OBLIQUE; - break; - case css::awt::FontSlant_REVERSE_ITALIC: - //there is no vcl reverse normal - eRet = ITALIC_NORMAL; - break; - case css::awt::FontSlant_MAKE_FIXED_SIZE: - eRet = FontItalic_FORCE_EQUAL_SIZE; - break; - } - return eRet; -} - css::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const vcl::Font& rFont ) { css::awt::FontDescriptor aFD; @@ -370,9 +207,9 @@ css::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const vcl::Font& rF aFD.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamilyType()); aFD.CharSet = rFont.GetCharSet(); aFD.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch()); - aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() ); - aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() ); - aFD.Slant = VCLUnoHelper::ConvertFontSlant( rFont.GetItalic() ); + aFD.CharacterWidth = vcl::unohelper::ConvertFontWidth(rFont.GetWidthType()); + aFD.Weight = vcl::unohelper::ConvertFontWeight(rFont.GetWeight()); + aFD.Slant = vcl::unohelper::ConvertFontSlant(rFont.GetItalic()); aFD.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline()); aFD.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout()); aFD.Orientation = rFont.GetOrientation(); @@ -398,11 +235,11 @@ vcl::Font VCLUnoHelper::CreateFont( const css::awt::FontDescriptor& rDescr, cons if ( (FontPitch)rDescr.Pitch != PITCH_DONTKNOW ) aFont.SetPitch( (FontPitch)rDescr.Pitch ); if ( rDescr.CharacterWidth ) - aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) ); + aFont.SetWidthType(vcl::unohelper::ConvertFontWidth(rDescr.CharacterWidth)); if ( rDescr.Weight ) - aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) ); + aFont.SetWeight(vcl::unohelper::ConvertFontWeight(rDescr.Weight)); if ( rDescr.Slant != css::awt::FontSlant_DONTKNOW ) - aFont.SetItalic( VCLUnoHelper::ConvertFontSlant( rDescr.Slant ) ); + aFont.SetItalic(vcl::unohelper::ConvertFontSlant(rDescr.Slant)); if ( (FontLineStyle)rDescr.Underline != LINESTYLE_DONTKNOW ) aFont.SetUnderline( (FontLineStyle)rDescr.Underline ); if ( (FontStrikeout)rDescr.Strikeout != STRIKEOUT_DONTKNOW ) diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx index a515d6ed8a9f..e47d69ba9594 100644 --- a/vcl/source/app/unohelp.cxx +++ b/vcl/source/app/unohelp.cxx @@ -27,6 +27,8 @@ #include <com/sun/star/i18n/BreakIterator.hpp> #include <com/sun/star/i18n/CharacterClassification.hpp> +#include <com/sun/star/awt/FontWeight.hpp> +#include <com/sun/star/awt/FontWidth.hpp> #include <com/sun/star/awt/XExtendedToolkit.hpp> #include <com/sun/star/accessibility/AccessibleEventObject.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -64,4 +66,169 @@ void vcl::unohelper::NotifyAccessibleStateEventGlobally( const css::accessibilit } } +float vcl::unohelper::ConvertFontWidth( FontWidth eWidth ) +{ + if( eWidth == WIDTH_DONTKNOW ) + return css::awt::FontWidth::DONTKNOW; + else if( eWidth == WIDTH_ULTRA_CONDENSED ) + return css::awt::FontWidth::ULTRACONDENSED; + else if( eWidth == WIDTH_EXTRA_CONDENSED ) + return css::awt::FontWidth::EXTRACONDENSED; + else if( eWidth == WIDTH_CONDENSED ) + return css::awt::FontWidth::CONDENSED; + else if( eWidth == WIDTH_SEMI_CONDENSED ) + return css::awt::FontWidth::SEMICONDENSED; + else if( eWidth == WIDTH_NORMAL ) + return css::awt::FontWidth::NORMAL; + else if( eWidth == WIDTH_SEMI_EXPANDED ) + return css::awt::FontWidth::SEMIEXPANDED; + else if( eWidth == WIDTH_EXPANDED ) + return css::awt::FontWidth::EXPANDED; + else if( eWidth == WIDTH_EXTRA_EXPANDED ) + return css::awt::FontWidth::EXTRAEXPANDED; + else if( eWidth == WIDTH_ULTRA_EXPANDED ) + return css::awt::FontWidth::ULTRAEXPANDED; + + OSL_FAIL( "Unknown FontWidth" ); + return css::awt::FontWidth::DONTKNOW; +} + +FontWidth vcl::unohelper::ConvertFontWidth( float f ) +{ + if( f <= css::awt::FontWidth::DONTKNOW ) + return WIDTH_DONTKNOW; + else if( f <= css::awt::FontWidth::ULTRACONDENSED ) + return WIDTH_ULTRA_CONDENSED; + else if( f <= css::awt::FontWidth::EXTRACONDENSED ) + return WIDTH_EXTRA_CONDENSED; + else if( f <= css::awt::FontWidth::CONDENSED ) + return WIDTH_CONDENSED; + else if( f <= css::awt::FontWidth::SEMICONDENSED ) + return WIDTH_SEMI_CONDENSED; + else if( f <= css::awt::FontWidth::NORMAL ) + return WIDTH_NORMAL; + else if( f <= css::awt::FontWidth::SEMIEXPANDED ) + return WIDTH_SEMI_EXPANDED; + else if( f <= css::awt::FontWidth::EXPANDED ) + return WIDTH_EXPANDED; + else if( f <= css::awt::FontWidth::EXTRAEXPANDED ) + return WIDTH_EXTRA_EXPANDED; + else if( f <= css::awt::FontWidth::ULTRAEXPANDED ) + return WIDTH_ULTRA_EXPANDED; + + OSL_FAIL( "Unknown FontWidth" ); + return WIDTH_DONTKNOW; +} + +float vcl::unohelper::ConvertFontWeight( FontWeight eWeight ) +{ + if( eWeight == WEIGHT_DONTKNOW ) + return css::awt::FontWeight::DONTKNOW; + else if( eWeight == WEIGHT_THIN ) + return css::awt::FontWeight::THIN; + else if( eWeight == WEIGHT_ULTRALIGHT ) + return css::awt::FontWeight::ULTRALIGHT; + else if( eWeight == WEIGHT_LIGHT ) + return css::awt::FontWeight::LIGHT; + else if( eWeight == WEIGHT_SEMILIGHT ) + return css::awt::FontWeight::SEMILIGHT; + else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) ) + return css::awt::FontWeight::NORMAL; + else if( eWeight == WEIGHT_SEMIBOLD ) + return css::awt::FontWeight::SEMIBOLD; + else if( eWeight == WEIGHT_BOLD ) + return css::awt::FontWeight::BOLD; + else if( eWeight == WEIGHT_ULTRABOLD ) + return css::awt::FontWeight::ULTRABOLD; + else if( eWeight == WEIGHT_BLACK ) + return css::awt::FontWeight::BLACK; + + OSL_FAIL( "Unknown FontWeight" ); + return css::awt::FontWeight::DONTKNOW; +} + +FontWeight vcl::unohelper::ConvertFontWeight( float f ) +{ + if( f <= css::awt::FontWeight::DONTKNOW ) + return WEIGHT_DONTKNOW; + else if( f <= css::awt::FontWeight::THIN ) + return WEIGHT_THIN; + else if( f <= css::awt::FontWeight::ULTRALIGHT ) + return WEIGHT_ULTRALIGHT; + else if( f <= css::awt::FontWeight::LIGHT ) + return WEIGHT_LIGHT; + else if( f <= css::awt::FontWeight::SEMILIGHT ) + return WEIGHT_SEMILIGHT; + else if( f <= css::awt::FontWeight::NORMAL ) + return WEIGHT_NORMAL; + else if( f <= css::awt::FontWeight::SEMIBOLD ) + return WEIGHT_SEMIBOLD; + else if( f <= css::awt::FontWeight::BOLD ) + return WEIGHT_BOLD; + else if( f <= css::awt::FontWeight::ULTRABOLD ) + return WEIGHT_ULTRABOLD; + else if( f <= css::awt::FontWeight::BLACK ) + return WEIGHT_BLACK; + + OSL_FAIL( "Unknown FontWeight" ); + return WEIGHT_DONTKNOW; +} + +css::awt::FontSlant vcl::unohelper::ConvertFontSlant(FontItalic eItalic) +{ + css::awt::FontSlant eRet(css::awt::FontSlant_DONTKNOW); + switch (eItalic) + { + case ITALIC_NONE: + eRet = css::awt::FontSlant_NONE; + break; + case ITALIC_OBLIQUE: + eRet = css::awt::FontSlant_OBLIQUE; + break; + case ITALIC_NORMAL: + eRet = css::awt::FontSlant_ITALIC; + break; + case ITALIC_DONTKNOW: + eRet = css::awt::FontSlant_DONTKNOW; + break; + case FontItalic_FORCE_EQUAL_SIZE: + eRet = css::awt::FontSlant_MAKE_FIXED_SIZE; + break; + } + return eRet; +} + +FontItalic vcl::unohelper::ConvertFontSlant(css::awt::FontSlant eSlant) +{ + FontItalic eRet = ITALIC_DONTKNOW; + switch (eSlant) + { + case css::awt::FontSlant_NONE: + eRet = ITALIC_NONE; + break; + case css::awt::FontSlant_OBLIQUE: + eRet = ITALIC_OBLIQUE; + break; + case css::awt::FontSlant_ITALIC: + eRet = ITALIC_NORMAL; + break; + case css::awt::FontSlant_DONTKNOW: + eRet = ITALIC_DONTKNOW; + break; + case css::awt::FontSlant_REVERSE_OBLIQUE: + //there is no vcl reverse oblique + eRet = ITALIC_OBLIQUE; + break; + case css::awt::FontSlant_REVERSE_ITALIC: + //there is no vcl reverse normal + eRet = ITALIC_NORMAL; + break; + case css::awt::FontSlant_MAKE_FIXED_SIZE: + eRet = FontItalic_FORCE_EQUAL_SIZE; + break; + } + return eRet; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/style/postuhdl.cxx b/xmloff/source/style/postuhdl.cxx index a40a9ceeb578..fd6e0f6336a7 100644 --- a/xmloff/source/style/postuhdl.cxx +++ b/xmloff/source/style/postuhdl.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/awt/FontSlant.hpp> #include <tools/fontenum.hxx> +#include <vcl/unohelp.hxx> using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -50,7 +51,7 @@ bool XMLPosturePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValu FontItalic ePosture; bool bRet = SvXMLUnitConverter::convertEnum( ePosture, rStrImpValue, aPostureGenericMapping ); if( bRet ) - rValue <<= (awt::FontSlant)ePosture; + rValue <<= vcl::unohelper::ConvertFontSlant(ePosture); return bRet; } @@ -70,7 +71,7 @@ bool XMLPosturePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValu } OUStringBuffer aOut; - bool bRet = SvXMLUnitConverter::convertEnum( aOut, (FontItalic)eSlant, aPostureGenericMapping ); + bool bRet = SvXMLUnitConverter::convertEnum(aOut, vcl::unohelper::ConvertFontSlant(eSlant), aPostureGenericMapping); if( bRet ) rStrExpValue = aOut.makeStringAndClear(); |