[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jul 16 00:58:12 UTC 2018


 sc/source/core/data/docpool.cxx |   33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

New commits:
commit 952cbfd2de0801081665a8ff05600eb7ea1cf82f
Author:     Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Mon Jul 16 00:38:58 2018 +0200
Commit:     Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Jul 16 02:57:51 2018 +0200

    related tdf#113646, keep cjk, ctl font items in sync
    
    If the default style and default pool items are no longer in sync,
    our script detection assumes that any style without an explicitly
    set font has script type CTL or CJK.
    
    Use the same selection idea for both cases and at the same time
    use the *_SPREADSHEET font items for the default pool items.
    
    Change-Id: I6a5bb14a3fabab11627ad52b9e79554fdcedac89
    Reviewed-on: https://gerrit.libreoffice.org/57470
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index 587f666116ad..4b12fb9e1442 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -74,10 +74,24 @@
 #include <globstr.hrc>
 #include <scresid.hxx>
 #include <document.hxx>
+#include <scmod.hxx>
 #include <sc.hrc>
 
 // ATTR_FONT_TWOLINES (not used) was changed to ATTR_USERDEF (not saved in binary format) in 641c
 
+namespace {
+
+SvxFontItem* getDefaultFontItem(LanguageType eLang, DefaultFontType nFontType, sal_uInt16 nItemId)
+{
+    vcl::Font aDefFont = OutputDevice::GetDefaultFont( nFontType, eLang, GetDefaultFontFlags::OnlyOne );
+    SvxFontItem* pNewItem = new SvxFontItem( aDefFont.GetFamilyType(), aDefFont.GetFamilyName(), aDefFont.GetStyleName(),
+            aDefFont.GetPitch(), aDefFont.GetCharSet(), nItemId );
+
+    return pNewItem;
+}
+
+}
+
 static SfxItemInfo const  aItemInfos[] =
 {
     { SID_ATTR_CHAR_FONT,           true },    // ATTR_FONT
@@ -179,18 +193,15 @@ ScDocumentPool::ScDocumentPool()
     mvPoolDefaults(ATTR_ENDINDEX-ATTR_STARTINDEX+1),
     mnCurrentMaxKey(0)
 {
+
+    LanguageType nDefLang, nCjkLang, nCtlLang;
+    bool bAutoSpell;
+    ScModule::GetSpellSettings( nDefLang, nCjkLang, nCtlLang, bAutoSpell );
+
     //  latin font from GetDefaultFonts is not used, DEFAULTFONT_LATIN_SPREADSHEET instead
-    vcl::Font aStdFont = OutputDevice::GetDefaultFont( DefaultFontType::LATIN_SPREADSHEET, LANGUAGE_ENGLISH_US,
-                                                    GetDefaultFontFlags::OnlyOne );
-    SvxFontItem* pStdFont = new SvxFontItem( aStdFont.GetFamilyType(),
-                                            aStdFont.GetFamilyName(), aStdFont.GetStyleName(),
-                                            aStdFont.GetPitch(), aStdFont.GetCharSet(),
-                                            ATTR_FONT );
-
-    SvxFontItem* pCjkFont = new SvxFontItem( ATTR_CJK_FONT );
-    SvxFontItem* pCtlFont = new SvxFontItem( ATTR_CTL_FONT );
-    SvxFontItem aDummy( ATTR_FONT );
-    GetDefaultFonts( aDummy, *pCjkFont, *pCtlFont );
+    SvxFontItem* pStdFont = getDefaultFontItem(nDefLang, DefaultFontType::LATIN_SPREADSHEET, ATTR_FONT);
+    SvxFontItem* pCjkFont = getDefaultFontItem(nCjkLang, DefaultFontType::CJK_SPREADSHEET, ATTR_CJK_FONT);
+    SvxFontItem* pCtlFont = getDefaultFontItem(nCtlLang, DefaultFontType::CTL_SPREADSHEET, ATTR_CTL_FONT);
 
     SvxBoxInfoItem* pGlobalBorderInnerAttr = new SvxBoxInfoItem( ATTR_BORDER_INNER );
     auto pSet = o3tl::make_unique<SfxItemSet>( *this, svl::Items<ATTR_PATTERN_START, ATTR_PATTERN_END>{} );


More information about the Libreoffice-commits mailing list