Kaydet (Commit) 4f55dfb5 authored tarafından Noel Grandin's avatar Noel Grandin

convert AX_FONTDATA constants to scoped enum

Change-Id: I0de365c8f654973f483d09fc9170f40bda7cbd9e
Reviewed-on: https://gerrit.libreoffice.org/36457Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ec366658
...@@ -85,7 +85,7 @@ public: ...@@ -85,7 +85,7 @@ public:
/** Write an integer property value to the stream, the /** Write an integer property value to the stream, the
respective flag in the property mask is set. */ respective flag in the property mask is set. */
template< typename StreamType, typename DataType > template< typename StreamType, typename DataType >
void writeIntProperty( DataType& ornValue ) void writeIntProperty( DataType ornValue )
{ if( startNextProperty() ) maOutStrm.writeAligned< StreamType >( ornValue ); } { if( startNextProperty() ) maOutStrm.writeAligned< StreamType >( ornValue ); }
/** Write a boolean property value to the stream, the /** Write a boolean property value to the stream, the
respective flag in the property mask is set. */ respective flag in the property mask is set. */
......
...@@ -39,9 +39,9 @@ const sal_uInt32 AX_FONTDATA_STRIKEOUT = 0x00000008; ...@@ -39,9 +39,9 @@ const sal_uInt32 AX_FONTDATA_STRIKEOUT = 0x00000008;
const sal_uInt32 AX_FONTDATA_DISABLED = 0x00002000; const sal_uInt32 AX_FONTDATA_DISABLED = 0x00002000;
const sal_uInt32 AX_FONTDATA_AUTOCOLOR = 0x40000000; const sal_uInt32 AX_FONTDATA_AUTOCOLOR = 0x40000000;
const sal_Int32 AX_FONTDATA_LEFT = 1; enum class AxHorizontalAlign {
const sal_Int32 AX_FONTDATA_RIGHT = 2; Left = 1, Right = 2, Center = 3
const sal_Int32 AX_FONTDATA_CENTER = 3; };
/** All entries of a font property. */ /** All entries of a font property. */
struct OOX_DLLPUBLIC AxFontData struct OOX_DLLPUBLIC AxFontData
...@@ -50,7 +50,7 @@ struct OOX_DLLPUBLIC AxFontData ...@@ -50,7 +50,7 @@ struct OOX_DLLPUBLIC AxFontData
sal_uInt32 mnFontEffects; ///< Font effect flags. sal_uInt32 mnFontEffects; ///< Font effect flags.
sal_Int32 mnFontHeight; ///< Height of the font (not really twips, see code). sal_Int32 mnFontHeight; ///< Height of the font (not really twips, see code).
sal_Int32 mnFontCharSet; ///< Windows character set of the font. sal_Int32 mnFontCharSet; ///< Windows character set of the font.
sal_Int32 mnHorAlign; ///< Horizontal text alignment. AxHorizontalAlign mnHorAlign; ///< Horizontal text alignment.
bool mbDblUnderline; ///< True = double underline style (legacy VML drawing controls only). bool mbDblUnderline; ///< True = double underline style (legacy VML drawing controls only).
explicit AxFontData(); explicit AxFontData();
......
...@@ -854,7 +854,7 @@ void AxFontDataModel::importProperty( sal_Int32 nPropId, const OUString& rValue ...@@ -854,7 +854,7 @@ void AxFontDataModel::importProperty( sal_Int32 nPropId, const OUString& rValue
case XML_FontEffects: maFontData.mnFontEffects = AttributeConversion::decodeUnsigned( rValue ); break; case XML_FontEffects: maFontData.mnFontEffects = AttributeConversion::decodeUnsigned( rValue ); break;
case XML_FontHeight: maFontData.mnFontHeight = AttributeConversion::decodeInteger( rValue ); break; case XML_FontHeight: maFontData.mnFontHeight = AttributeConversion::decodeInteger( rValue ); break;
case XML_FontCharSet: maFontData.mnFontCharSet = 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 ); default: AxControlModelBase::importProperty( nPropId, rValue );
} }
} }
...@@ -894,9 +894,9 @@ void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlCon ...@@ -894,9 +894,9 @@ void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlCon
sal_Int32 nAlign = awt::TextAlign::LEFT; sal_Int32 nAlign = awt::TextAlign::LEFT;
switch( maFontData.mnHorAlign ) switch( maFontData.mnHorAlign )
{ {
case AX_FONTDATA_LEFT: nAlign = awt::TextAlign::LEFT; break; case AxHorizontalAlign::Left: nAlign = awt::TextAlign::LEFT; break;
case AX_FONTDATA_RIGHT: nAlign = awt::TextAlign::RIGHT; break; case AxHorizontalAlign::Right: nAlign = awt::TextAlign::RIGHT; break;
case AX_FONTDATA_CENTER: nAlign = awt::TextAlign::CENTER; break; case AxHorizontalAlign::Center: nAlign = awt::TextAlign::CENTER; break;
default: OSL_FAIL( "AxFontDataModel::convertProperties - unknown text alignment" ); default: OSL_FAIL( "AxFontDataModel::convertProperties - unknown text alignment" );
} }
// form controls expect short value // form controls expect short value
...@@ -934,9 +934,9 @@ void AxFontDataModel::convertFromProperties( PropertySet& rPropSet, const Contro ...@@ -934,9 +934,9 @@ void AxFontDataModel::convertFromProperties( PropertySet& rPropSet, const Contro
{ {
switch ( nAlign ) switch ( nAlign )
{ {
case awt::TextAlign::LEFT: maFontData.mnHorAlign = AX_FONTDATA_LEFT; break; case awt::TextAlign::LEFT: maFontData.mnHorAlign = AxHorizontalAlign::Left; break;
case awt::TextAlign::RIGHT: maFontData.mnHorAlign = AX_FONTDATA_RIGHT; break; case awt::TextAlign::RIGHT: maFontData.mnHorAlign = AxHorizontalAlign::Right; break;
case awt::TextAlign::CENTER: maFontData.mnHorAlign = AX_FONTDATA_CENTER; break; case awt::TextAlign::CENTER: maFontData.mnHorAlign = AxHorizontalAlign::Center; break;
default: OSL_FAIL( "AxFontDataModel::convertFromProperties - unknown text alignment" ); default: OSL_FAIL( "AxFontDataModel::convertFromProperties - unknown text alignment" );
} }
} }
......
...@@ -29,7 +29,7 @@ AxFontData::AxFontData() : ...@@ -29,7 +29,7 @@ AxFontData::AxFontData() :
mnFontEffects( 0 ), mnFontEffects( 0 ),
mnFontHeight( 160 ), mnFontHeight( 160 ),
mnFontCharSet( WINDOWS_CHARSET_DEFAULT ), mnFontCharSet( WINDOWS_CHARSET_DEFAULT ),
mnHorAlign( AX_FONTDATA_LEFT ), mnHorAlign( AxHorizontalAlign::Left ),
mbDblUnderline( false ) mbDblUnderline( false )
{ {
} }
...@@ -56,7 +56,9 @@ bool AxFontData::importBinaryModel( BinaryInputStream& rInStrm ) ...@@ -56,7 +56,9 @@ bool AxFontData::importBinaryModel( BinaryInputStream& rInStrm )
aReader.skipIntProperty< sal_Int32 >(); // font offset aReader.skipIntProperty< sal_Int32 >(); // font offset
aReader.readIntProperty< sal_uInt8 >( mnFontCharSet ); aReader.readIntProperty< sal_uInt8 >( mnFontCharSet );
aReader.skipIntProperty< sal_uInt8 >(); // font pitch/family 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 aReader.skipIntProperty< sal_uInt16 >(); // font weight
mbDblUnderline = false; mbDblUnderline = false;
return aReader.finalizeImport(); return aReader.finalizeImport();
...@@ -73,7 +75,7 @@ void AxFontData::exportBinaryModel( BinaryOutputStream& rOutStrm ) ...@@ -73,7 +75,7 @@ void AxFontData::exportBinaryModel( BinaryOutputStream& rOutStrm )
aWriter.writeIntProperty< sal_uInt8 >( mnFontCharSet ); aWriter.writeIntProperty< sal_uInt8 >( mnFontCharSet );
aWriter.skipProperty(); // font pitch/family aWriter.skipProperty(); // font pitch/family
aWriter.writeIntProperty< sal_uInt8 >( mnHorAlign ); aWriter.writeIntProperty< sal_uInt8 >( static_cast<sal_uInt8>(mnHorAlign) );
aWriter.skipProperty(); // font weight aWriter.skipProperty(); // font weight
aWriter.finalizeExport(); aWriter.finalizeExport();
} }
...@@ -93,7 +95,7 @@ bool AxFontData::importStdFont( BinaryInputStream& rInStrm ) ...@@ -93,7 +95,7 @@ bool AxFontData::importStdFont( BinaryInputStream& rInStrm )
// StdFont stores font height in 1/10,000 of points // StdFont stores font height in 1/10,000 of points
setHeightPoints( getLimitedValue< sal_Int16, sal_Int32 >( aFontInfo.mnHeight / 10000, 0, SAL_MAX_INT16 ) ); setHeightPoints( getLimitedValue< sal_Int16, sal_Int32 >( aFontInfo.mnHeight / 10000, 0, SAL_MAX_INT16 ) );
mnFontCharSet = aFontInfo.mnCharSet; mnFontCharSet = aFontInfo.mnCharSet;
mnHorAlign = AX_FONTDATA_LEFT; mnHorAlign = AxHorizontalAlign::Left;
return true; return true;
} }
return false; return false;
......
...@@ -735,10 +735,10 @@ void VmlDrawing::convertControlText( AxFontData& rAxFontData, sal_uInt32& rnOleT ...@@ -735,10 +735,10 @@ void VmlDrawing::convertControlText( AxFontData& rAxFontData, sal_uInt32& rnOleT
switch( nTextHAlign ) switch( nTextHAlign )
{ {
case XML_Left: rAxFontData.mnHorAlign = AX_FONTDATA_LEFT; break; case XML_Left: rAxFontData.mnHorAlign = AxHorizontalAlign::Left; break;
case XML_Center: rAxFontData.mnHorAlign = AX_FONTDATA_CENTER; break; case XML_Center: rAxFontData.mnHorAlign = AxHorizontalAlign::Center; break;
case XML_Right: rAxFontData.mnHorAlign = AX_FONTDATA_RIGHT; break; case XML_Right: rAxFontData.mnHorAlign = AxHorizontalAlign::Right; break;
default: rAxFontData.mnHorAlign = AX_FONTDATA_LEFT; default: rAxFontData.mnHorAlign = AxHorizontalAlign::Left;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment