summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-12 13:24:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-12 15:42:34 +0200
commit4f55dfb564e56515b6ebb4d10b089f67ad628fb6 (patch)
treea0a64cff53868567020bc817bc1c5691567071f1 /oox
parentec366658fcad31165ec6771b397f50cd9a2ffc2c (diff)
convert AX_FONTDATA constants to scoped enum
Change-Id: I0de365c8f654973f483d09fc9170f40bda7cbd9e Reviewed-on: https://gerrit.libreoffice.org/36457 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ole/axcontrol.cxx14
-rw-r--r--oox/source/ole/axfontdata.cxx10
2 files changed, 13 insertions, 11 deletions
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 889c7ad7ae05..283c0e48dc61 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -854,7 +854,7 @@ void AxFontDataModel::importProperty( sal_Int32 nPropId, const OUString& rValue
case XML_FontEffects: maFontData.mnFontEffects = AttributeConversion::decodeUnsigned( rValue ); break;
case XML_FontHeight: maFontData.mnFontHeight = AttributeConversion::decodeInteger( rValue ); break;
case XML_FontCharSet: maFontData.mnFontCharSet = AttributeConversion::decodeInteger( rValue ); break;
- case XML_ParagraphAlign: maFontData.mnHorAlign = AttributeConversion::decodeInteger( rValue ); break;
+ case XML_ParagraphAlign: maFontData.mnHorAlign = static_cast<AxHorizontalAlign>(AttributeConversion::decodeInteger( rValue )); break;
default: AxControlModelBase::importProperty( nPropId, rValue );
}
}
@@ -894,9 +894,9 @@ void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlCon
sal_Int32 nAlign = awt::TextAlign::LEFT;
switch( maFontData.mnHorAlign )
{
- case AX_FONTDATA_LEFT: nAlign = awt::TextAlign::LEFT; break;
- case AX_FONTDATA_RIGHT: nAlign = awt::TextAlign::RIGHT; break;
- case AX_FONTDATA_CENTER: nAlign = awt::TextAlign::CENTER; break;
+ case AxHorizontalAlign::Left: nAlign = awt::TextAlign::LEFT; break;
+ case AxHorizontalAlign::Right: nAlign = awt::TextAlign::RIGHT; break;
+ case AxHorizontalAlign::Center: nAlign = awt::TextAlign::CENTER; break;
default: OSL_FAIL( "AxFontDataModel::convertProperties - unknown text alignment" );
}
// form controls expect short value
@@ -934,9 +934,9 @@ void AxFontDataModel::convertFromProperties( PropertySet& rPropSet, const Contro
{
switch ( nAlign )
{
- case awt::TextAlign::LEFT: maFontData.mnHorAlign = AX_FONTDATA_LEFT; break;
- case awt::TextAlign::RIGHT: maFontData.mnHorAlign = AX_FONTDATA_RIGHT; break;
- case awt::TextAlign::CENTER: maFontData.mnHorAlign = AX_FONTDATA_CENTER; break;
+ case awt::TextAlign::LEFT: maFontData.mnHorAlign = AxHorizontalAlign::Left; break;
+ case awt::TextAlign::RIGHT: maFontData.mnHorAlign = AxHorizontalAlign::Right; break;
+ case awt::TextAlign::CENTER: maFontData.mnHorAlign = AxHorizontalAlign::Center; break;
default: OSL_FAIL( "AxFontDataModel::convertFromProperties - unknown text alignment" );
}
}
diff --git a/oox/source/ole/axfontdata.cxx b/oox/source/ole/axfontdata.cxx
index 549d807a0e36..22a31b0e15e5 100644
--- a/oox/source/ole/axfontdata.cxx
+++ b/oox/source/ole/axfontdata.cxx
@@ -29,7 +29,7 @@ AxFontData::AxFontData() :
mnFontEffects( 0 ),
mnFontHeight( 160 ),
mnFontCharSet( WINDOWS_CHARSET_DEFAULT ),
- mnHorAlign( AX_FONTDATA_LEFT ),
+ mnHorAlign( AxHorizontalAlign::Left ),
mbDblUnderline( false )
{
}
@@ -56,7 +56,9 @@ bool AxFontData::importBinaryModel( BinaryInputStream& rInStrm )
aReader.skipIntProperty< sal_Int32 >(); // font offset
aReader.readIntProperty< sal_uInt8 >( mnFontCharSet );
aReader.skipIntProperty< sal_uInt8 >(); // font pitch/family
- aReader.readIntProperty< sal_uInt8 >( mnHorAlign );
+ sal_uInt8 nTmp = 0;
+ aReader.readIntProperty< sal_uInt8 >( nTmp );
+ mnHorAlign = static_cast<AxHorizontalAlign>(nTmp);
aReader.skipIntProperty< sal_uInt16 >(); // font weight
mbDblUnderline = false;
return aReader.finalizeImport();
@@ -73,7 +75,7 @@ void AxFontData::exportBinaryModel( BinaryOutputStream& rOutStrm )
aWriter.writeIntProperty< sal_uInt8 >( mnFontCharSet );
aWriter.skipProperty(); // font pitch/family
- aWriter.writeIntProperty< sal_uInt8 >( mnHorAlign );
+ aWriter.writeIntProperty< sal_uInt8 >( static_cast<sal_uInt8>(mnHorAlign) );
aWriter.skipProperty(); // font weight
aWriter.finalizeExport();
}
@@ -93,7 +95,7 @@ bool AxFontData::importStdFont( BinaryInputStream& rInStrm )
// StdFont stores font height in 1/10,000 of points
setHeightPoints( getLimitedValue< sal_Int16, sal_Int32 >( aFontInfo.mnHeight / 10000, 0, SAL_MAX_INT16 ) );
mnFontCharSet = aFontInfo.mnCharSet;
- mnHorAlign = AX_FONTDATA_LEFT;
+ mnHorAlign = AxHorizontalAlign::Left;
return true;
}
return false;