chart2/source/inc/CharacterProperties.hxx   |    3 ++
 chart2/source/tools/CharacterProperties.cxx |   39 ++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

New commits:
commit b773eb296ee526185ca29b7a2f526e2ed10340aa
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Apr 8 10:27:51 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Apr 8 12:34:54 2025 +0200

    restore CharacterProperties::createFontDescriptorFromPropertySet
    
    because we will use this again
    
    Change-Id: Idb7dccf9ee2f41ed99929f4ee9588b5e1b30dc8e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183839
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/chart2/source/inc/CharacterProperties.hxx 
b/chart2/source/inc/CharacterProperties.hxx
index 04ce6840babc..be3f1f989165 100644
--- a/chart2/source/inc/CharacterProperties.hxx
+++ b/chart2/source/inc/CharacterProperties.hxx
@@ -125,6 +125,9 @@ namespace CharacterProperties
     void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap );
 
     bool IsCharacterPropertyHandle( sal_Int32 nHandle );
+
+    css::awt::FontDescriptor createFontDescriptorFromPropertySet(
+        const css::uno::Reference< css::beans::XMultiPropertySet > & 
xMultiPropSet );
 }
 
 } //  namespace chart
diff --git a/chart2/source/tools/CharacterProperties.cxx 
b/chart2/source/tools/CharacterProperties.cxx
index ce7b214fa691..4bb0cbda2591 100644
--- a/chart2/source/tools/CharacterProperties.cxx
+++ b/chart2/source/tools/CharacterProperties.cxx
@@ -418,6 +418,45 @@ bool CharacterProperties::IsCharacterPropertyHandle( 
sal_Int32 nHandle )
              nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
 }
 
+awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet(
+    const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet )
+{
+    awt::FontDescriptor aResult;
+    // Note: keep this sorted!
+    uno::Sequence< OUString > aPropNameSeq{
+        u"CharFontCharSet"_ustr,   // CharSet
+        u"CharFontFamily"_ustr,    // Family
+        u"CharFontName"_ustr,      // Name
+        u"CharFontPitch"_ustr,     // Pitch
+        u"CharFontStyleName"_ustr, // StyleName
+        u"CharHeight"_ustr,        // Height
+        u"CharPosture"_ustr,       // Slant
+        u"CharStrikeout"_ustr,     // Strikeout
+        u"CharUnderline"_ustr,     // Underline
+        u"CharWeight"_ustr,        // Weight
+        u"CharWordMode"_ustr};     // WordLineMode
+    uno::Sequence< uno::Any > aValues( xMultiPropSet->getPropertyValues( 
aPropNameSeq ));
+
+    sal_Int32 i=0;
+    // Note keep this sorted according to the list above (comments are the 
fieldnames)
+    aValues[ i++ ]  >>= aResult.CharSet;
+    aValues[ i++ ]  >>= aResult.Family;
+    aValues[ i++ ]  >>= aResult.Name;
+    aValues[ i++ ]  >>= aResult.Pitch;
+    aValues[ i++ ]  >>= aResult.StyleName;
+    float fCharHeight = 0;
+    aValues[ i++ ]  >>= fCharHeight;
+    aResult.Height = static_cast< sal_Int16 >( fCharHeight );
+    aValues[ i++ ]  >>= aResult.Slant;
+    aValues[ i++ ]  >>= aResult.Strikeout;
+    aValues[ i++ ]  >>= aResult.Underline;
+    aValues[ i++ ]  >>= aResult.Weight;
+    aValues[ i++ ]  >>= aResult.WordLineMode;
+    OSL_ASSERT( i == aValues.getLength());
+
+    return aResult;
+}
+
 } //  namespace chart
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to