summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-07-16 00:38:58 +0200
committerEike Rathke <erack@redhat.com>2018-07-16 18:00:56 +0200
commitaa79f08a2ef5b9390b7e9ad91b3fe2da200bfe32 (patch)
tree1873ec0c94f6cb5e9a35bb6e5b7a218a7ae08d88
parent4cf90e58fe2319a2017e51499817d0866829bd28 (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> (cherry picked from commit 952cbfd2de0801081665a8ff05600eb7ea1cf82f) Reviewed-on: https://gerrit.libreoffice.org/57473 Reviewed-by: Eike Rathke <erack@redhat.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>{} );