summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-07-16 00:38:58 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-07-16 02:57:51 +0200
commit952cbfd2de0801081665a8ff05600eb7ea1cf82f (patch)
tree3e42c1c00eff5b384b8e831bda3ca59bba6c8d85
parentd61228c84c1b52c6a876a8348625a1ebb7f44adf (diff)
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@googlemail.com>
-rw-r--r--sc/source/core/data/docpool.cxx33
1 files changed, 22 insertions, 11 deletions
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>{} );