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

New commits:
commit aa79f08a2ef5b9390b7e9ad91b3fe2da200bfe32
Author:     Markus Mohrhard <markus.mohrh...@googlemail.com>
AuthorDate: Mon Jul 16 00:38:58 2018 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Mon Jul 16 18:00:56 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.mohrh...@googlemail.com>
    (cherry picked from commit 952cbfd2de0801081665a8ff05600eb7ea1cf82f)
    Reviewed-on: https://gerrit.libreoffice.org/57473
    Reviewed-by: Eike Rathke <er...@redhat.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>{} );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to