diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 41f7ae0296bd..06d1fb647829 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -26,6 +26,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -35,13 +39,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -1455,6 +1457,11 @@ void SvxNumOptionsTabPage::Reset( const SfxItemSet* rSet ) InitControls(); bModified = false; + const SvxLanguageItem* pLangItem = rSet->GetItemIfSet(SID_ATTR_CHAR_LANGUAGE, true); + if (!pLangItem) + pLangItem = rSet->GetItemIfSet(EE_CHAR_LANGUAGE, true); + if (pLangItem) + m_aPreviewWIN.SetLanguage(pLangItem->GetLanguage()); } void SvxNumOptionsTabPage::InitControls() diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index f9f6a64993a0..eb7d108eb4bb 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -1034,7 +1034,7 @@ void SvxNumRule::SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt) } } -OUString SvxNumRule::MakeNumString( const SvxNodeNum& rNum ) const +OUString SvxNumRule::MakeNumString(const SvxNodeNum& rNum, LanguageType aLang) const { OUStringBuffer aStr; if( SVX_NO_NUM > rNum.GetLevel() && !( SVX_NO_NUMLEVEL & rNum.GetLevel() ) ) @@ -1071,8 +1071,8 @@ OUString SvxNumRule::MakeNumString( const SvxNodeNum& rNum ) const { if(SVX_NUM_BITMAP != rNFmt.GetNumberingType()) { - const LanguageTag& rLang = Application::GetSettings().GetLanguageTag(); - aStr.append(rNFmt.GetNumStr( rNum.GetLevelVal()[ i ], rLang.getLocale(), rMyNFmt.GetIsLegal() )); + css::lang::Locale aLocale(LanguageTag::convertToLocale(aLang)); + aStr.append(rNFmt.GetNumStr(rNum.GetLevelVal()[ i ], aLocale, rMyNFmt.GetIsLegal())); } else bDot = false; diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx index b859c0e68150..267e1e0b795c 100644 --- a/include/editeng/numitem.hxx +++ b/include/editeng/numitem.hxx @@ -308,7 +308,7 @@ public: SvxNumRuleFlags GetFeatureFlags() const {return nFeatureFlags;} void SetFeatureFlag( SvxNumRuleFlags nFlag, bool bSet = true ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; } - OUString MakeNumString( const SvxNodeNum& ) const; + OUString MakeNumString(const SvxNodeNum&, LanguageType eLang) const; SvxNumRuleType GetNumRuleType() const { return eNumberingType; } diff --git a/include/svx/numberingpreview.hxx b/include/svx/numberingpreview.hxx index 5bec89aa40aa..7205796249e0 100644 --- a/include/svx/numberingpreview.hxx +++ b/include/svx/numberingpreview.hxx @@ -11,6 +11,7 @@ #include #include #include +#include /// Provides the preview to show how looks bullet or numbering format before the apply. class SVXCORE_DLLPUBLIC SvxNumberingPreview final : public weld::CustomWidgetController @@ -19,12 +20,14 @@ class SVXCORE_DLLPUBLIC SvxNumberingPreview final : public weld::CustomWidgetCon vcl::Font m_aStdFont; bool m_bPosition; sal_uInt16 m_nActLevel; + LanguageType m_eLang; virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override; public: SvxNumberingPreview(); + void SetLanguage(LanguageType eLang) { m_eLang = eLang; } void SetNumRule(const SvxNumRule* pNum) { diff --git a/svx/source/dialog/pagenumberlistbox.cxx b/svx/source/dialog/pagenumberlistbox.cxx index 839160b14d66..842621b7362d 100644 --- a/svx/source/dialog/pagenumberlistbox.cxx +++ b/svx/source/dialog/pagenumberlistbox.cxx @@ -18,7 +18,9 @@ */ #include +#include #include +#include #include #include #include @@ -30,7 +32,7 @@ #include #include #include - +#include #include SvxPageNumberListBox::SvxPageNumberListBox(std::unique_ptr pControl) @@ -63,6 +65,7 @@ SvxNumberingPreview::SvxNumberingPreview() : m_pActNum(nullptr) , m_bPosition(false) , m_nActLevel(SAL_MAX_UINT16) + , m_eLang(LANGUAGE_NONE) { } @@ -159,8 +162,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, tools::Long nYStep = (aSize.Height() - 6) / (m_pActNum->GetLevelCount() > 1 ? m_pActNum->GetLevelCount() : 5); - m_aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, - MsLangId::getConfiguredSystemLanguage(), + m_aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, m_eLang, GetDefaultFontFlags::OnlyOne); m_aStdFont.SetColor(aTextColor); m_aStdFont.SetFillColor(aBackColor); @@ -245,7 +247,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, aNum.SetLevel(nLevel); if (m_pActNum->IsContinuousNumbering()) aNum.GetLevelVal()[nLevel] = nPreNum; - OUString aText(m_pActNum->MakeNumString(aNum)); + OUString aText(m_pActNum->MakeNumString(aNum, m_eLang)); vcl::Font aSaveFont = pVDev->GetFont(); vcl::Font aColorFont(aSaveFont); Color aTmpBulletColor = rFmt.GetBulletColor(); @@ -401,7 +403,7 @@ void SvxNumberingPreview::Paint(vcl::RenderContext& rRenderContext, aNum.SetLevel(nLevel); if (m_pActNum->IsContinuousNumbering()) aNum.GetLevelVal()[nLevel] = nPreNum; - OUString aText(m_pActNum->MakeNumString(aNum)); + OUString aText(m_pActNum->MakeNumString(aNum, m_eLang)); tools::Long nY = nYStart; nY -= (pVDev->GetTextHeight() - nTextHeight - pVDev->GetFontMetric().GetDescent()); diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index e42690a37a96..c8eb31576fa9 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -432,6 +432,11 @@ void SwNumPositionTabPage::Reset( const SfxItemSet* rSet ) ShowControlsDependingOnPosAndSpaceMode(); InitControls(); m_bModified = false; + const SvxLanguageItem* pLangItem = rSet->GetItemIfSet(SID_ATTR_CHAR_LANGUAGE, true); + if (!pLangItem) + pLangItem = rSet->GetItemIfSet(EE_CHAR_LANGUAGE, true); + if (pLangItem) + m_aPreviewWIN.SetLanguage(pLangItem->GetLanguage()); } void SwNumPositionTabPage::InitPosAndSpaceMode() diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index d7bd6f7ff5f3..02463d917d2c 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -913,7 +913,7 @@ void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Re const tools::Long nXStep = aSize.Width() / (3 * MAXLEVEL * ((MAXLEVEL < 10) ? 2 : 1)); const tools::Long nYStep = (aSize.Height() - 6)/ MAXLEVEL; tools::Long nYStart = 4; - m_aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, GetAppLanguage(), + m_aStdFont = OutputDevice::GetDefaultFont(DefaultFontType::UI_SANS, m_eLang, GetDefaultFontFlags::OnlyOne, &rRenderContext); if (svtools::ColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor == COL_AUTO) @@ -981,7 +981,7 @@ void NumberingPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Re pVDev->SetFont(m_aStdFont); if(m_pActNum->IsContinusNum()) aNumVector[nLevel] = nPreNum; - OUString aText(m_pActNum->MakeNumString( aNumVector )); + OUString aText(m_pActNum->MakeNumString(aNumVector, true, 255, false, nullptr, m_eLang)); pVDev->DrawText( Point(nNumberXPos, nYStart), aText ); nBulletWidth = pVDev->GetTextWidth(aText); nPreNum++; diff --git a/sw/source/uibase/inc/numprevw.hxx b/sw/source/uibase/inc/numprevw.hxx index 38fc2dbf28bb..f2c4fb04eca8 100644 --- a/sw/source/uibase/inc/numprevw.hxx +++ b/sw/source/uibase/inc/numprevw.hxx @@ -22,6 +22,8 @@ #include #include +#include +#include class SwNumRule; @@ -29,10 +31,11 @@ class NumberingPreview final : public weld::CustomWidgetController { const SwNumRule* m_pActNum; vcl::Font m_aStdFont; - tools::Long m_nPageWidth; + tools::Long m_nPageWidth; const UIName* m_pOutlineNames; bool m_bPosition; sal_uInt16 m_nActLevel; + LanguageType m_eLang; private: virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; @@ -44,6 +47,7 @@ public: , m_pOutlineNames(nullptr) , m_bPosition(false) , m_nActLevel(USHRT_MAX) + , m_eLang(LANGUAGE_NONE) { } @@ -60,6 +64,7 @@ public: void SetPositionMode() { m_bPosition = true;} void SetLevel(sal_uInt16 nSet) {m_nActLevel = nSet;} + void SetLanguage(LanguageType eLang) { m_eLang = eLang; } }; #endif diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx index 31f589c688a3..f6f7a679530d 100644 --- a/sw/source/uibase/shells/txtnum.cxx +++ b/sw/source/uibase/shells/txtnum.cxx @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include #include #include @@ -119,7 +122,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) case FN_NUMBER_BULLETS: case SID_OUTLINE_BULLET: { - SfxItemSetFixed aSet( GetPool() ); SwDocShell* pDocSh = GetView().GetDocShell(); const bool bHtml = dynamic_cast( pDocSh ) != nullptr; @@ -186,6 +189,9 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET,false )); + LanguageType eLang = GetShell().GetCurLang(); + aSet.Put(SvxLanguageItem(eLang, EE_CHAR_LANGUAGE)); + // Before the dialogue of the HTML mode will be dropped at the Docshell. pDocSh->PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(pDocSh)));