diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-12-12 20:59:59 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-12-26 07:53:52 +0000 |
commit | 4ee7e71d850315f5ae4c3b763b0e80e8d83a6454 (patch) | |
tree | d56a29ddbe67de84d3df8edeac617576f4d00a7e /oox | |
parent | 1386e26b2d7fc5173266ffbfb94bc82b1d3f7bb9 (diff) |
svx: rename mnPitch to mnPitchFamily, add resolvePitchFamily
Rename mnPitch to mnPitchFamily as it contains both. Extract the
code to resolve what is pitch and what is family into its own
(static) function.
Change-Id: I0c17351ea690a85decefb8d73dd07644ce5c78d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143991
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/drawingml/textfont.hxx | 10 | ||||
-rw-r--r-- | oox/source/drawingml/textfont.cxx | 20 |
2 files changed, 19 insertions, 11 deletions
diff --git a/oox/inc/drawingml/textfont.hxx b/oox/inc/drawingml/textfont.hxx index 6bdf13ab890a..231b18cffecb 100644 --- a/oox/inc/drawingml/textfont.hxx +++ b/oox/inc/drawingml/textfont.hxx @@ -51,6 +51,8 @@ public: sal_Int16& rnFontFamily, const ::oox::core::XmlFilterBase& rFilter ) const; + static void resolvePitch(sal_Int32 nOoxPitch, sal_Int16& rnFontPitch, sal_Int16& rnFontFamily); + private: bool implGetFontData( OUString& rFontName, @@ -58,10 +60,10 @@ private: sal_Int16& rnFontFamily ) const; private: - OUString maTypeface; - OUString maPanose; - sal_Int32 mnPitch; - sal_Int32 mnCharset; + OUString maTypeface; + OUString maPanose; + sal_Int32 mnPitchFamily; + sal_Int32 mnCharset; }; diff --git a/oox/source/drawingml/textfont.cxx b/oox/source/drawingml/textfont.cxx index bcfe516893ee..e5899780ad2c 100644 --- a/oox/source/drawingml/textfont.cxx +++ b/oox/source/drawingml/textfont.cxx @@ -48,7 +48,7 @@ sal_Int16 lclGetFontFamily( sal_Int32 nOoxValue ) } // namespace TextFont::TextFont() : - mnPitch( 0 ), + mnPitchFamily(0), mnCharset( WINDOWS_CHARSET_ANSI ) { } @@ -56,16 +56,16 @@ TextFont::TextFont() : void TextFont::setAttributes( const AttributeList& rAttribs ) { maTypeface = rAttribs.getStringDefaulted( XML_typeface); - maPanose = rAttribs.getStringDefaulted( XML_panose); - mnPitch = rAttribs.getInteger( XML_pitchFamily, 0 ); - mnCharset = rAttribs.getInteger( XML_charset, WINDOWS_CHARSET_DEFAULT ); + maPanose = rAttribs.getStringDefaulted( XML_panose); + mnPitchFamily = rAttribs.getInteger( XML_pitchFamily, 0 ); + mnCharset = rAttribs.getInteger( XML_charset, WINDOWS_CHARSET_DEFAULT ); } void TextFont::setAttributes( const OUString& sFontName ) { maTypeface = sFontName; maPanose.clear(); - mnPitch = 0; + mnPitchFamily = 0; mnCharset = WINDOWS_CHARSET_DEFAULT; } @@ -86,11 +86,17 @@ bool TextFont::getFontData( OUString& rFontName, sal_Int16& rnFontPitch, sal_Int bool TextFont::implGetFontData( OUString& rFontName, sal_Int16& rnFontPitch, sal_Int16& rnFontFamily ) const { rFontName = maTypeface; - rnFontPitch = lclGetFontPitch( extractValue< sal_Int16 >( mnPitch, 0, 4 ) ); - rnFontFamily = lclGetFontFamily( extractValue< sal_Int16 >( mnPitch, 4, 4 ) ); + resolvePitch(mnPitchFamily, rnFontPitch, rnFontFamily); return !rFontName.isEmpty(); } +void TextFont::resolvePitch(sal_Int32 nOoxPitchFamily, sal_Int16& rnFontPitch, sal_Int16& rnFontFamily) +{ + rnFontPitch = lclGetFontPitch(extractValue<sal_Int16>(nOoxPitchFamily, 0, 4)); + rnFontFamily = lclGetFontFamily(extractValue<sal_Int16>(nOoxPitchFamily, 4, 4)); +} + + } // namespace oox::drawingml /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |