diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-26 14:45:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-28 08:38:52 +0200 |
commit | d8fec570c21c5e45ba593ee96cc1ba5d45d77fc8 (patch) | |
tree | da5f5eed2c066325c409e64366b4569a54fb1791 | |
parent | 3808418e38fe9540a286ad48f1c3eaed2706f78c (diff) |
use officecfg for SvtCJKOptions
and remove some unused options
Change-Id: I487a233de4f7414012e5405f2c2e1f9c8b8fb4f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119554
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
55 files changed, 217 insertions, 572 deletions
diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index 4be4d1918bb4..a6e2c38c6aa1 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -339,8 +339,6 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, m_xDialog->set_title(pDialogParameter->getLocalizedName()); - SvtCJKOptions aCJKOptions; - switch (pDialogParameter->getObjectType()) { case OBJECTTYPE_TITLE: @@ -350,7 +348,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); AddTabPage("alignment", SchResId(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::Create); - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN); break; @@ -361,7 +359,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); AddTabPage("legendpos", SchResId(STR_PAGE_POSITION), SchLegendPosTabPage::Create); - if (aCJKOptions.IsAsianTypographyEnabled()) + if (SvtCJKOptions::IsAsianTypographyEnabled()) AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN); break; @@ -391,7 +389,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("datalabels", SchResId(STR_OBJECT_DATALABELS), DataLabelsTabPage::Create); AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN); break; @@ -410,7 +408,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, AddTabPage("numberformat", SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT); AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME); AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS); - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN); break; } diff --git a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx index c990161cf6c8..e5b422ceaf16 100644 --- a/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx +++ b/chart2/source/controller/dialogs/dlg_ShapeParagraph.cxx @@ -34,11 +34,9 @@ ShapeParagraphDialog::ShapeParagraphDialog(weld::Window* pParent, const SfxItemSet* pAttr) : SfxTabDialogController(pParent, "modules/schart/ui/paradialog.ui", "ParagraphDialog", pAttr) { - SvtCJKOptions aCJKOptions; - AddTabPage("labelTP_PARA_STD", RID_SVXPAGE_STD_PARAGRAPH); AddTabPage("labelTP_PARA_ALIGN", RID_SVXPAGE_ALIGN_PARAGRAPH ); - if (aCJKOptions.IsAsianTypographyEnabled()) + if (SvtCJKOptions::IsAsianTypographyEnabled()) { AddTabPage("labelTP_PARA_ASIAN", RID_SVXPAGE_PARA_ASIAN); } diff --git a/cui/source/dialogs/cuifmsearch.cxx b/cui/source/dialogs/cuifmsearch.cxx index 050dc31dc14b..d6e223dc0d19 100644 --- a/cui/source/dialogs/cuifmsearch.cxx +++ b/cui/source/dialogs/cuifmsearch.cxx @@ -47,15 +47,14 @@ void FmSearchDialog::initCommon( const Reference< XResultSet >& _rxCursor ) m_pSearchEngine->SetProgressHandler(LINK(this, FmSearchDialog, OnSearchProgress)); // some layout changes according to available CJK options - SvtCJKOptions aCJKOptions; - if (!aCJKOptions.IsJapaneseFindEnabled()) + if (!SvtCJKOptions::IsJapaneseFindEnabled()) { // hide the options for the japanese search m_pSoundsLikeCJK->hide(); m_pSoundsLikeCJKSettings->hide(); } - if (!aCJKOptions.IsCJKFontEnabled()) + if (!SvtCJKOptions::IsCJKFontEnabled()) { m_pHalfFullFormsCJK->hide(); @@ -442,7 +441,7 @@ IMPL_LINK(FmSearchDialog, OnCheckBoxToggled, weld::Toggleable&, rBox, void) bool bEnable = ( m_prbSearchForText->get_active() && !m_pSoundsLikeCJK->get_active() ) - || !SvtCJKOptions().IsJapaneseFindEnabled(); + || !SvtCJKOptions::IsJapaneseFindEnabled(); m_pcbCase->set_sensitive(bEnable); m_pHalfFullFormsCJK->set_sensitive(bEnable); @@ -536,7 +535,7 @@ void FmSearchDialog::EnableSearchForDependees(bool bEnable) bEnable = bEnable && bSearchingForText; - bool bEnableRedundants = !m_pSoundsLikeCJK->get_active() || !SvtCJKOptions().IsJapaneseFindEnabled(); + bool bEnableRedundants = !m_pSoundsLikeCJK->get_active() || !SvtCJKOptions::IsJapaneseFindEnabled(); m_pcmbSearchText->set_sensitive(bEnable); m_pftPosition->set_sensitive(bEnable && !m_pcbWildCard->get_active()); diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx index 384acbc1d566..d857f77c42df 100644 --- a/cui/source/dialogs/srchxtra.cxx +++ b/cui/source/dialogs/srchxtra.cxx @@ -49,10 +49,9 @@ SvxSearchFormatDialog::SvxSearchFormatDialog(weld::Window* pParent, const SfxIte AddTabPage("background", SvxBkgTabPage::Create, nullptr); // remove asian tabpages if necessary - SvtCJKOptions aCJKOptions; - if ( !aCJKOptions.IsDoubleLinesEnabled() ) + if ( !SvtCJKOptions::IsDoubleLinesEnabled() ) RemoveTabPage("asianlayout"); - if ( !aCJKOptions.IsAsianTypographyEnabled() ) + if ( !SvtCJKOptions::IsAsianTypographyEnabled() ) RemoveTabPage("labelTP_PARA_ASIAN"); } diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index ba3d77e88da5..b1c2ac5b4adc 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -987,7 +987,6 @@ void OfaViewTabPage::UpdateHardwareAccelStatus() struct LanguageConfig_Impl { - SvtCJKOptions aCJKLanguageOptions; SvtCTLOptions aCTLLanguageOptions; SvtSysLocaleOptions aSysLocaleOptions; SvtLinguConfig aLinguConfig; @@ -1186,10 +1185,10 @@ OfaLanguagesTabPage::OfaLanguagesTabPage(weld::Container* pPage, weld::DialogCon m_xAsianSupportCB->connect_toggled( aLink ); m_xCTLSupportCB->connect_toggled( aLink ); - m_bOldAsian = pLangConfig->aCJKLanguageOptions.IsAnyEnabled(); + m_bOldAsian = SvtCJKOptions::IsAnyEnabled(); m_xAsianSupportCB->set_active(m_bOldAsian); m_xAsianSupportCB->save_state(); - bool bReadonly = pLangConfig->aCJKLanguageOptions.IsReadOnly(SvtCJKOptions::E_ALL); + bool bReadonly = SvtCJKOptions::IsReadOnly(SvtCJKOptions::E_ALL); m_xAsianSupportCB->set_sensitive(!bReadonly); SupportHdl(*m_xAsianSupportCB); @@ -1235,7 +1234,6 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet ) // lock configuration broadcasters so that we can coordinate the notifications pLangConfig->aSysLocaleOptions.BlockBroadcasts( true ); pLangConfig->aCTLLanguageOptions.BlockBroadcasts( true ); - pLangConfig->aCJKLanguageOptions.BlockBroadcasts( true ); pLangConfig->aLinguConfig.BlockBroadcasts( true ); /* @@ -1425,7 +1423,7 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet ) if(m_xAsianSupportCB->get_state_changed_from_saved() ) { bool bChecked = m_xAsianSupportCB->get_active(); - pLangConfig->aCJKLanguageOptions.SetAll(bChecked); + SvtCJKOptions::SetAll(bChecked); //iterate over all bindings to invalidate vertical text direction const sal_uInt16 STATE_COUNT = 2; @@ -1464,7 +1462,6 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet ) // it seems that our code relies on the fact that before other changes like e.g. currency // are broadcasted locale changes have been done pLangConfig->aSysLocaleOptions.BlockBroadcasts( false ); - pLangConfig->aCJKLanguageOptions.BlockBroadcasts( false ); pLangConfig->aCTLLanguageOptions.BlockBroadcasts( false ); pLangConfig->aLinguConfig.BlockBroadcasts( false ); @@ -1672,7 +1669,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void) } // second check if CJK must be enabled // #103299# - if CJK support is not readonly - if(!pLangConfig->aCJKLanguageOptions.IsReadOnly(SvtCJKOptions::E_ALL)) + if(!SvtCJKOptions::IsReadOnly(SvtCJKOptions::E_ALL)) { bool bIsCJKFixed = bool(nType & SvtScriptType::ASIAN); lcl_checkLanguageCheckBox(*m_xAsianSupportCB, bIsCJKFixed, m_bOldAsian); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 14263c10a782..38cbe4952de5 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1418,7 +1418,6 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) } // Language options - SvtCJKOptions aCJKLanguageOptions; SvtCTLOptions aCTLLanguageOptions; if ( !lcl_isOptionHidden( SID_LANGUAGE_OPTIONS, aOptionsDlgOpt ) ) { @@ -1429,8 +1428,8 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nPageId = static_cast<sal_uInt16>(SID_LANGUAGE_OPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; - if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || aCJKLanguageOptions.IsJapaneseFindEnabled() ) && - ( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || aCJKLanguageOptions.IsAsianTypographyEnabled() ) && + if ( ( RID_SVXPAGE_JSEARCH_OPTIONS != nPageId || SvtCJKOptions::IsJapaneseFindEnabled() ) && + ( RID_SVXPAGE_ASIAN_LAYOUT != nPageId || SvtCJKOptions::IsAsianTypographyEnabled() ) && ( RID_SVXPAGE_OPTIONS_CTL != nPageId || aCTLLanguageOptions.IsCTLFontEnabled() ) ) AddTabPage(nPageId, CuiResId(SID_LANGUAGE_OPTIONS_RES[i].first), nGroup); } @@ -1461,7 +1460,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) nPageId = static_cast<sal_uInt16>(SID_SW_EDITOPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) continue; - if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || aCJKLanguageOptions.IsCJKFontEnabled() ) && + if ( ( RID_SW_TP_STD_FONT_CJK != nPageId || SvtCJKOptions::IsCJKFontEnabled() ) && ( RID_SW_TP_STD_FONT_CTL != nPageId || aCTLLanguageOptions.IsCTLFontEnabled() ) && ( RID_SW_TP_MAILCONFIG != nPageId || MailMergeCfg_Impl().IsEmailSupported() ) ) AddTabPage( nPageId, CuiResId(SID_SW_EDITOPTIONS_RES[i].first), nGroup ); diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index a49a115a13b5..a57abd2b949e 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -150,7 +150,7 @@ AlignmentTabPage::AlignmentTabPage(weld::Container* pPage, weld::DialogControlle m_xBtnShrink->connect_toggled(LINK(this, AlignmentTabPage, ShrinkClickHdl)); // Asian vertical mode - m_xCbAsianMode->set_visible(SvtCJKOptions().IsVerticalTextEnabled()); + m_xCbAsianMode->set_visible(SvtCJKOptions::IsVerticalTextEnabled()); m_xLbFrameDir->append(SvxFrameDirection::Horizontal_LR_TB, SvxResId(RID_SVXSTR_FRAMEDIR_LTR)); m_xLbFrameDir->append(SvxFrameDirection::Horizontal_RL_TB, SvxResId(RID_SVXSTR_FRAMEDIR_RTL)); diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 3eadffd81c65..e632a1b3be49 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -107,7 +107,7 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(weld::Window* pParent, const SfxItemSet* _pSet ) if( SvtCTLOptions().IsCTLFontEnabled() ) nLangList |= SvxLanguageListFlags::CTL; - if( SvtCJKOptions().IsCJKFontEnabled() ) + if( SvtCJKOptions::IsCJKFontEnabled() ) nLangList |= SvxLanguageListFlags::CJK; m_xLanguageLB->SetLanguageList( nLangList, true, true ); m_xLanguageLB->set_active_id( LANGUAGE_NONE ); diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 051ede05495e..c0794c0bec03 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -220,9 +220,8 @@ SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController* #endif m_pImpl->m_aNoStyleText = CuiResId( RID_SVXSTR_CHARNAME_NOSTYLE ); - SvtCJKOptions aCJKLanguageOptions; SvtCTLOptions aCTLLanguageOptions; - bool bShowCJK = aCJKLanguageOptions.IsCJKFontEnabled(); + bool bShowCJK = SvtCJKOptions::IsCJKFontEnabled(); bool bShowCTL = aCTLLanguageOptions.IsCTLFontEnabled(); bool bShowNonWestern = bShowCJK || bShowCTL; @@ -1418,7 +1417,7 @@ void SvxCharEffectsPage::Initialize() m_xOutlineBtn->connect_toggled(LINK(this, SvxCharEffectsPage, OutlineBtnClickHdl)); m_xShadowBtn->connect_toggled(LINK(this, SvxCharEffectsPage, ShadowBtnClickHdl)); - if ( !SvtCJKOptions().IsAsianTypographyEnabled() ) + if ( !SvtCJKOptions::IsAsianTypographyEnabled() ) { m_xEmphasisFT->hide(); m_xEmphasisLB->hide(); diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index f3d0bfe79987..29d8f85b918a 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -193,8 +193,7 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, weld::DialogController* SetExchangeSupport(); SvtCTLOptions aCTLLanguageOptions; - SvtCJKOptions aCJKLanguageOptions; - bool bCJK = aCJKLanguageOptions.IsAsianTypographyEnabled(); + bool bCJK = SvtCJKOptions::IsAsianTypographyEnabled(); bool bCTL = aCTLLanguageOptions.IsCTLFontEnabled(); bool bWeb = false; const SfxPoolItem* pItem; diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx index d91507c81208..6726da03961d 100644 --- a/cui/source/tabpages/paragrph.cxx +++ b/cui/source/tabpages/paragrph.cxx @@ -409,8 +409,7 @@ void SvxStdParagraphTabPage::Reset( const SfxItemSet* rSet ) bool bApplyCharUnit = GetApplyCharUnit( *rSet ); - SvtCJKOptions aCJKOptions; - if(aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit ) + if(SvtCJKOptions::IsAsianTypographyEnabled() && bApplyCharUnit ) eFUnit = FieldUnit::CHAR; m_xLeftIndent->SetFieldUnit(eFUnit); @@ -994,10 +993,9 @@ SvxParaAlignTabPage::SvxParaAlignTabPage(weld::Container* pPage, weld::DialogCon { SetExchangeSupport(); - SvtCJKOptions aCJKLanguageOptions; sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT; - if ( aCJKLanguageOptions.IsAsianTypographyEnabled() ) + if ( SvtCJKOptions::IsAsianTypographyEnabled() ) { m_xLeft->set_label(m_xLeftBottom->get_label()); m_xRight->set_label(m_xRightTop->get_label()); @@ -1326,8 +1324,7 @@ void SvxParaAlignTabPage::EnableJustifyExt() m_xLastLineFT->show(); m_xLastLineLB->show(); m_xExpandCB->show(); - SvtCJKOptions aCJKOptions; - if (aCJKOptions.IsAsianTypographyEnabled()) + if (SvtCJKOptions::IsAsianTypographyEnabled()) m_xSnapToGridCB->show(); } diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx index 762e3ab92baa..7a4beeb8437e 100644 --- a/cui/source/tabpages/tabstpge.cxx +++ b/cui/source/tabpages/tabstpge.cxx @@ -90,9 +90,8 @@ SvxTabulatorTabPage::SvxTabulatorTabPage(weld::Container* pPage, weld::DialogCon m_aCenterWin.SetTabStyle(sal_uInt16(RULER_TAB_CENTER|WB_HORZ)); m_aDezWin.SetTabStyle(sal_uInt16(RULER_TAB_DECIMAL|WB_HORZ)); //upper radiobuttons - SvtCJKOptions aCJKOptions; - m_xLeftTab = m_xBuilder->weld_radio_button(aCJKOptions.IsAsianTypographyEnabled() ? "radiobuttonST_LEFTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_LEFT"); - m_xRightTab = m_xBuilder->weld_radio_button(aCJKOptions.IsAsianTypographyEnabled() ? "radiobuttonST_RIGHTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_RIGHT"); + m_xLeftTab = m_xBuilder->weld_radio_button(SvtCJKOptions::IsAsianTypographyEnabled() ? "radiobuttonST_LEFTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_LEFT"); + m_xRightTab = m_xBuilder->weld_radio_button(SvtCJKOptions::IsAsianTypographyEnabled() ? "radiobuttonST_RIGHTTAB_ASIAN" : "radiobuttonBTN_TABTYPE_RIGHT"); m_xLeftTab->show(); m_xRightTab->show(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index bcfc1fd63c37..ade68fd5efc0 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1221,7 +1221,6 @@ struct ExecuteGlobals Reference < css::document::XDocumentEventListener > xGlobalBroadcaster; bool bRestartRequested; bool bUseSystemFileDialog; - std::unique_ptr<SvtCJKOptions> pCJKLanguageOptions; std::unique_ptr<SvtCTLOptions> pCTLLanguageOptions; std::unique_ptr<SvtPathOptions> pPathOptions; rtl::Reference< JVMloadThread > xJVMloadThread; @@ -1456,7 +1455,6 @@ int Desktop::Main() #endif // keep a language options instance... - pExecGlobals->pCJKLanguageOptions.reset( new SvtCJKOptions(true)); pExecGlobals->pCTLLanguageOptions.reset( new SvtCTLOptions(true)); css::document::DocumentEvent aEvent; @@ -1703,7 +1701,6 @@ int Desktop::doShutdown() // be sure that path/language options gets destroyed before // UCB is deinitialized - pExecGlobals->pCJKLanguageOptions.reset(); pExecGlobals->pCTLLanguageOptions.reset(); pExecGlobals->pPathOptions.reset(); diff --git a/include/svl/cjkoptions.hxx b/include/svl/cjkoptions.hxx index a371d74389ab..ba679006e8f5 100644 --- a/include/svl/cjkoptions.hxx +++ b/include/svl/cjkoptions.hxx @@ -16,54 +16,36 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SVL_CJKOPTIONS_HXX -#define INCLUDED_SVL_CJKOPTIONS_HXX +#pragma once #include <svl/svldllapi.h> #include <unotools/options.hxx> -#include <memory> -class SvtCJKOptions_Impl; - -// class SvtCJKOptions -------------------------------------------------- - -class SVL_DLLPUBLIC SvtCJKOptions final : public utl::detail::Options +namespace SvtCJKOptions { -private: - std::shared_ptr<SvtCJKOptions_Impl> pImpl; - -public: - enum EOption - { - E_CJKFONT, - E_VERTICALTEXT, - E_ASIANTYPOGRAPHY, - E_JAPANESEFIND, - E_RUBY, - E_CHANGECASEMAP, - E_DOUBLELINES, - E_EMPHASISMARKS, - E_VERTICALCALLOUT, - E_ALL // special one for IsAnyEnabled()/SetAll() functionality - }; - - // bDontLoad is for referencing purposes only - SvtCJKOptions(bool bDontLoad = false); - virtual ~SvtCJKOptions() override; - - bool IsCJKFontEnabled() const; - bool IsVerticalTextEnabled() const; - bool IsAsianTypographyEnabled() const; - bool IsJapaneseFindEnabled() const; - bool IsRubyEnabled() const; - bool IsChangeCaseMapEnabled() const; - bool IsDoubleLinesEnabled() const; - - void SetAll(bool bSet); - bool IsAnyEnabled() const; - bool IsReadOnly(EOption eOption) const; +enum EOption +{ + E_CJKFONT, + E_VERTICALTEXT, + E_ASIANTYPOGRAPHY, + E_JAPANESEFIND, + E_RUBY, + E_CHANGECASEMAP, + E_DOUBLELINES, + E_ALL // special one for IsAnyEnabled()/SetAll() functionality }; -#endif // INCLUDED_SVL_CJKOPTIONS_HXX +SVL_DLLPUBLIC bool IsCJKFontEnabled(); +SVL_DLLPUBLIC bool IsVerticalTextEnabled(); +SVL_DLLPUBLIC bool IsAsianTypographyEnabled(); +SVL_DLLPUBLIC bool IsJapaneseFindEnabled(); +SVL_DLLPUBLIC bool IsRubyEnabled(); +SVL_DLLPUBLIC bool IsChangeCaseMapEnabled(); +SVL_DLLPUBLIC bool IsDoubleLinesEnabled(); + +SVL_DLLPUBLIC void SetAll(bool bSet); +SVL_DLLPUBLIC bool IsAnyEnabled(); +SVL_DLLPUBLIC bool IsReadOnly(EOption eOption); +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/unotools/itemholderbase.hxx b/include/unotools/itemholderbase.hxx index 0815a4c20c32..5aca7107158a 100644 --- a/include/unotools/itemholderbase.hxx +++ b/include/unotools/itemholderbase.hxx @@ -33,7 +33,6 @@ enum class EItem { AccessibilityOptions , // 2 - CJKOptions , // 2 CmdOptions , ColorConfig , // 2 Compatibility , diff --git a/reportdesign/source/ui/dlg/dlgpage.cxx b/reportdesign/source/ui/dlg/dlgpage.cxx index 1cc0b4db7a4f..c4fb41c465b4 100644 --- a/reportdesign/source/ui/dlg/dlgpage.cxx +++ b/reportdesign/source/ui/dlg/dlgpage.cxx @@ -59,8 +59,7 @@ ORptPageDialog::ORptPageDialog(weld::Window* pParent, const SfxItemSet* pAttr, c else OSL_FAIL("Unknown page id"); - SvtCJKOptions aCJKOptions; - if ( !aCJKOptions.IsDoubleLinesEnabled() ) + if ( !SvtCJKOptions::IsDoubleLinesEnabled() ) RemoveTabPage("asianlayout"); } diff --git a/sc/source/ui/attrdlg/attrdlg.cxx b/sc/source/ui/attrdlg/attrdlg.cxx index f37a72461b86..4c761ef7b36f 100644 --- a/sc/source/ui/attrdlg/attrdlg.cxx +++ b/sc/source/ui/attrdlg/attrdlg.cxx @@ -46,8 +46,7 @@ ScAttrDlg::ScAttrDlg(weld::Window* pParent, const SfxItemSet* pCellAttrs) OSL_ENSURE(pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), "GetTabPageCreatorFunc fail!"); AddTabPage( "alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), nullptr ); - SvtCJKOptions aCJKOptions; - if (aCJKOptions.IsAsianTypographyEnabled()) + if (SvtCJKOptions::IsAsianTypographyEnabled()) { OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!"); AddTabPage( "asiantypography", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), nullptr ); diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 876817538a98..243be01e3f17 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -965,7 +965,7 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) } bool bDisableCTLFont = !SvtCTLOptions().IsCTLFontEnabled(); - bool bDisableVerticalText = !SvtCJKOptions().IsVerticalTextEnabled(); + bool bDisableVerticalText = !SvtCJKOptions::IsVerticalTextEnabled(); SdrView* pView = mrViewData.GetScDrawView(); SfxItemSet aAttrSet(pView->GetModel()->GetItemPool()); diff --git a/sc/source/ui/miscdlgs/textdlgs.cxx b/sc/source/ui/miscdlgs/textdlgs.cxx index 08251008255d..40a84a626a4f 100644 --- a/sc/source/ui/miscdlgs/textdlgs.cxx +++ b/sc/source/ui/miscdlgs/textdlgs.cxx @@ -72,8 +72,7 @@ ScParagraphDlg::ScParagraphDlg(weld::Window* pParent, const SfxItemSet* pAttr) { AddTabPage("labelTP_PARA_STD", RID_SVXPAGE_STD_PARAGRAPH); AddTabPage("labelTP_PARA_ALIGN", RID_SVXPAGE_ALIGN_PARAGRAPH); - SvtCJKOptions aCJKOptions; - if (aCJKOptions.IsAsianTypographyEnabled() ) + if (SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("labelTP_PARA_ASIAN", RID_SVXPAGE_PARA_ASIAN); else RemoveTabPage("labelTP_PARA_ASIAN"); diff --git a/sc/source/ui/styleui/styledlg.cxx b/sc/source/ui/styleui/styledlg.cxx index 12acb34463f8..892fe4ac2a95 100644 --- a/sc/source/ui/styleui/styledlg.cxx +++ b/sc/source/ui/styleui/styledlg.cxx @@ -61,12 +61,11 @@ ScStyleDlg::ScStyleDlg(weld::Window* pParent, } else // cell format styles { - SvtCJKOptions aCJKOptions; AddTabPage("numbers", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_NUMBERFORMAT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_NUMBERFORMAT )); AddTabPage("font", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_NAME )); AddTabPage("fonteffects", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_EFFECTS )); AddTabPage("alignment", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGNMENT ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_ALIGNMENT )); - if ( aCJKOptions.IsAsianTypographyEnabled() ) + if ( SvtCJKOptions::IsAsianTypographyEnabled() ) { AddTabPage("asiantypo", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN)); } diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 3a9a214050df..c7f2d58352f3 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -2749,7 +2749,7 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet ) } bool bDisableCTLFont = !SvtCTLOptions().IsCTLFontEnabled(); - bool bDisableVerticalText = !SvtCJKOptions().IsVerticalTextEnabled(); + bool bDisableVerticalText = !SvtCJKOptions::IsVerticalTextEnabled(); SfxWhichIter aIter( rSet ); sal_uInt16 nWhich = aIter.FirstWhich(); diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index 578f77edbf66..a096a766ea7d 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -428,7 +428,7 @@ void ScTabViewShell::GetDrawState(SfxItemSet &rSet) case SID_DRAW_TEXT_VERTICAL: case SID_DRAW_CAPTION_VERTICAL: - if ( !SvtCJKOptions().IsVerticalTextEnabled() ) + if ( !SvtCJKOptions::IsVerticalTextEnabled() ) rSet.DisableItem( nWhich ); else rSet.Put( SfxBoolItem( nWhich, nDrawSfxId == nWhich ) ); diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index f94d24ab1210..5bb739cca971 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -284,7 +284,6 @@ bool ScViewUtil::HasFiltered( const ScRange& rRange, const ScDocument& rDoc ) void ScViewUtil::HideDisabledSlot( SfxItemSet& rSet, SfxBindings& rBindings, sal_uInt16 nSlotId ) { - SvtCJKOptions aCJKOptions; SvtCTLOptions aCTLOptions; bool bEnabled = true; @@ -292,14 +291,14 @@ void ScViewUtil::HideDisabledSlot( SfxItemSet& rSet, SfxBindings& rBindings, sal { case SID_CHINESE_CONVERSION: case SID_HANGUL_HANJA_CONVERSION: - bEnabled = aCJKOptions.IsAnyEnabled(); + bEnabled = SvtCJKOptions::IsAnyEnabled(); break; case SID_TRANSLITERATE_HALFWIDTH: case SID_TRANSLITERATE_FULLWIDTH: case SID_TRANSLITERATE_HIRAGANA: case SID_TRANSLITERATE_KATAKANA: - bEnabled = aCJKOptions.IsChangeCaseMapEnabled(); + bEnabled = SvtCJKOptions::IsChangeCaseMapEnabled(); break; case SID_INSERT_RLM: diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index 989dd9493db5..41ab38cad0b1 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -181,7 +181,7 @@ LayoutToolbarMenu::LayoutToolbarMenu(SlideLayoutController* pControl, weld::Widg OSL_ASSERT(false); } - const bool bVerticalEnabled = SvtCJKOptions().IsVerticalTextEnabled(); + const bool bVerticalEnabled = SvtCJKOptions::IsVerticalTextEnabled(); mxLayoutSet1->SetSelectHdl( LINK( this, LayoutToolbarMenu, SelectValueSetHdl ) ); diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx index 35a5df67a2d5..2918fbb22c77 100644 --- a/sd/source/ui/dlg/paragr.cxx +++ b/sd/source/ui/dlg/paragr.cxx @@ -139,8 +139,7 @@ SdParagraphDlg::SdParagraphDlg(weld::Window* pParent, const SfxItemSet* pAttr) { AddTabPage( "labelTP_PARA_STD", RID_SVXPAGE_STD_PARAGRAPH); - SvtCJKOptions aCJKOptions; - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage( "labelTP_PARA_ASIAN", RID_SVXPAGE_PARA_ASIAN); else RemoveTabPage( "labelTP_PARA_ASIAN" ); diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx index 8271b39608ba..f922c7440c49 100644 --- a/sd/source/ui/dlg/prltempl.cxx +++ b/sd/source/ui/dlg/prltempl.cxx @@ -141,8 +141,7 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg(SfxObjectShell const * pDocSh, AddTabPage( "RID_SVXPAGE_ALIGN_PARAGRAPH", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_ALIGN_PARAGRAPH ), nullptr ); AddTabPage( "RID_SVXPAGE_BKG", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), nullptr); - SvtCJKOptions aCJKOptions; - if( !aCJKOptions.IsAsianTypographyEnabled() ) + if( !SvtCJKOptions::IsAsianTypographyEnabled() ) RemoveTabPage( "RID_SVXPAGE_PARA_ASIAN" ); if (bBackground) diff --git a/sd/source/ui/dlg/tabtempl.cxx b/sd/source/ui/dlg/tabtempl.cxx index a730fb91c8de..e5db39e68ed6 100644 --- a/sd/source/ui/dlg/tabtempl.cxx +++ b/sd/source/ui/dlg/tabtempl.cxx @@ -69,8 +69,7 @@ SdTabTemplateDlg::SdTabTemplateDlg(weld::Window* pParent, AddTabPage("connector", RID_SVXPAGE_CONNECTION); AddTabPage("alignment", RID_SVXPAGE_ALIGN_PARAGRAPH); AddTabPage("tabs", RID_SVXPAGE_TABULATOR); - SvtCJKOptions aCJKOptions; - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("asiantypo", RID_SVXPAGE_PARA_ASIAN); else RemoveTabPage("asiantypo"); diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index 5b343b64288a..886efb0f7acb 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -256,7 +256,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet) case SID_CHINESE_CONVERSION: case SID_HANGUL_HANJA_CONVERSION: { - rSet.Put(SfxVisibilityItem(nWhich, SvtCJKOptions().IsAnyEnabled())); + rSet.Put(SfxVisibilityItem(nWhich, SvtCJKOptions::IsAnyEnabled())); } break; case SID_LANGUAGE_STATUS: diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 4f4ee2ca59b5..0e2e8aae890f 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -497,7 +497,7 @@ SfxRequest LayoutMenu::CreateRequest ( void LayoutMenu::Fill() { - bool bVertical = SvtCJKOptions().IsVerticalTextEnabled(); + bool bVertical = SvtCJKOptions::IsVerticalTextEnabled(); SdDrawDocument* pDocument = mrBase.GetDocument(); bool bRightToLeft = (pDocument!=nullptr && pDocument->GetDefaultWritingMode() == WritingMode_RL_TB); diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 312e08f29521..01e5675a96c7 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -145,7 +145,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) sal_uInt16 nWhich = aIter.FirstWhich(); SfxItemSet aAttrSet( mpView->GetDoc().GetPool() ); bool bDisableParagraphTextDirection = !SvtCTLOptions().IsCTLFontEnabled(); - bool bDisableVerticalText = !SvtCJKOptions().IsVerticalTextEnabled(); + bool bDisableVerticalText = !SvtCJKOptions::IsVerticalTextEnabled(); mpView->GetAttributes( aAttrSet ); diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index 1f1263fd99bb..d9a1acf7ae99 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -332,7 +332,7 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) } ViewShell::GetMenuState(rSet); - bool bDisableVerticalText = !SvtCJKOptions().IsVerticalTextEnabled(); + bool bDisableVerticalText = !SvtCJKOptions::IsVerticalTextEnabled(); if ( bDisableVerticalText ) { diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 220fb33ab6bf..9b67f5d89dbd 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -206,8 +206,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) if ( !GetView()->GetTextEditOutliner() ) { - SvtCJKOptions aCJKOptions; - if( !aCJKOptions.IsChangeCaseMapEnabled() ) + if( !SvtCJKOptions::IsChangeCaseMapEnabled() ) { GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, false ); GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, false ); @@ -234,8 +233,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet) } else { - SvtCJKOptions aCJKOptions; - if( !aCJKOptions.IsChangeCaseMapEnabled() ) + if( !SvtCJKOptions::IsChangeCaseMapEnabled() ) { GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, false ); GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, false ); diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 7a423c0d96df..7a77c2a7275e 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -381,8 +381,7 @@ void OutlineViewShell::GetCtrlState(SfxItemSet &rSet) SfxItemState::DEFAULT == rSet.GetItemState(SID_TRANSLITERATE_KATAKANA)) ) return; - SvtCJKOptions aCJKOptions; - if( !aCJKOptions.IsChangeCaseMapEnabled() ) + if( !SvtCJKOptions::IsChangeCaseMapEnabled() ) { GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_HALFWIDTH, false ); GetViewFrame()->GetBindings().SetVisibleState( SID_TRANSLITERATE_FULLWIDTH, false ); diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx index 84c972875f3a..572794926a04 100644 --- a/svl/source/config/cjkoptions.cxx +++ b/svl/source/config/cjkoptions.cxx @@ -19,453 +19,169 @@ #include <svl/cjkoptions.hxx> -#include <o3tl/any.hxx> #include <svl/languageoptions.hxx> #include <i18nlangtag/lang.h> #include <i18nlangtag/languagetag.hxx> #include <unotools/configitem.hxx> #include <com/sun/star/uno/Any.h> #include <com/sun/star/uno/Sequence.hxx> -#include <osl/mutex.hxx> -#include <rtl/instance.hxx> #include <officecfg/System.hxx> - -#include "itemholder2.hxx" +#include <officecfg/Office/Common.hxx> +#include <mutex> using namespace ::com::sun::star::uno; -#define CFG_READONLY_DEFAULT false +static void SvtCJKOptions_Load(); -class SvtCJKOptions_Impl : public utl::ConfigItem +namespace SvtCJKOptions { - bool bIsLoaded; - bool bCJKFont; - bool bVerticalText; - bool bAsianTypography; - bool bJapaneseFind; - bool bRuby; - bool bChangeCaseMap; - bool bDoubleLines; - bool bEmphasisMarks; - bool bVerticalCallOut; - - bool bROCJKFont; - bool bROVerticalText; - bool bROAsianTypography; - bool bROJapaneseFind; - bool bRORuby; - bool bROChangeCaseMap; - bool bRODoubleLines; - bool bROEmphasisMarks; - bool bROVerticalCallOut; - - virtual void ImplCommit() override; - -public: - SvtCJKOptions_Impl(); - - virtual void Notify( const css::uno::Sequence< OUString >& rPropertyNames ) override; - void Load(); - - bool IsLoaded() const { return bIsLoaded; } - - bool IsCJKFontEnabled() const { return bCJKFont; } - bool IsVerticalTextEnabled() const { return bVerticalText; } - bool IsAsianTypographyEnabled() const { return bAsianTypography; } - bool IsJapaneseFindEnabled() const { return bJapaneseFind; } - bool IsRubyEnabled() const { return bRuby; } - bool IsChangeCaseMapEnabled() const { return bChangeCaseMap; } - bool IsDoubleLinesEnabled() const { return bDoubleLines; } - bool IsAnyEnabled() const { - return bCJKFont||bVerticalText||bAsianTypography||bJapaneseFind|| - bRuby||bChangeCaseMap||bDoubleLines||bEmphasisMarks||bVerticalCallOut; } - void SetAll(bool bSet); - bool IsReadOnly(SvtCJKOptions::EOption eOption) const; -}; - -namespace +bool IsCJKFontEnabled() { - struct PropertyNames - : public rtl::Static< Sequence<OUString>, PropertyNames > {}; + SvtCJKOptions_Load(); + return officecfg::Office::Common::I18N::CJK::CJKFont::get(); } -SvtCJKOptions_Impl::SvtCJKOptions_Impl() : - utl::ConfigItem("Office.Common/I18N/CJK"), - bIsLoaded(false), - bCJKFont(true), - bVerticalText(true), - bAsianTypography(true), - bJapaneseFind(true), - bRuby(true), - bChangeCaseMap(true), - bDoubleLines(true), - bEmphasisMarks(true), - bVerticalCallOut(true), - bROCJKFont(CFG_READONLY_DEFAULT), - bROVerticalText(CFG_READONLY_DEFAULT), - bROAsianTypography(CFG_READONLY_DEFAULT), - bROJapaneseFind(CFG_READONLY_DEFAULT), - bRORuby(CFG_READONLY_DEFAULT), - bROChangeCaseMap(CFG_READONLY_DEFAULT), - bRODoubleLines(CFG_READONLY_DEFAULT), - bROEmphasisMarks(CFG_READONLY_DEFAULT), - bROVerticalCallOut(CFG_READONLY_DEFAULT) +bool IsVerticalTextEnabled() { + SvtCJKOptions_Load(); + return officecfg::Office::Common::I18N::CJK::VerticalText::get(); } -void SvtCJKOptions_Impl::SetAll(bool bSet) +bool IsAsianTypographyEnabled() { - if ( - bROCJKFont || - bROVerticalText || - bROAsianTypography || - bROJapaneseFind || - bRORuby || - bROChangeCaseMap || - bRODoubleLines || - bROEmphasisMarks || - bROVerticalCallOut - ) - return; - - bCJKFont=bSet; - bVerticalText=bSet; - bAsianTypography=bSet; - bJapaneseFind=bSet; - bRuby=bSet; - bChangeCaseMap=bSet; - bDoubleLines=bSet; - bEmphasisMarks=bSet; - bVerticalCallOut=bSet; - - SetModified(); - Commit(); - NotifyListeners(ConfigurationHints::NONE); + SvtCJKOptions_Load(); + return officecfg::Office::Common::I18N::CJK::AsianTypography::get(); } -void SvtCJKOptions_Impl::Load() +bool IsJapaneseFindEnabled() { - Sequence<OUString> &rPropertyNames = PropertyNames::get(); - if(!rPropertyNames.hasElements()) - { - rPropertyNames.realloc(9); - OUString* pNames = rPropertyNames.getArray(); - - pNames[0] = "CJKFont"; - pNames[1] = "VerticalText"; - pNames[2] = "AsianTypography"; - pNames[3] = "JapaneseFind"; - pNames[4] = "Ruby"; - pNames[5] = "ChangeCaseMap"; - pNames[6] = "DoubleLines"; - pNames[7] = "EmphasisMarks"; - pNames[8] = "VerticalCallOut"; - - EnableNotification( rPropertyNames ); - } - Sequence< Any > aValues = GetProperties(rPropertyNames); - Sequence< sal_Bool > aROStates = GetReadOnlyStates(rPropertyNames); - const Any* pValues = aValues.getConstArray(); - const sal_Bool* pROStates = aROStates.getConstArray(); - assert(aValues.getLength() == rPropertyNames.getLength() && "GetProperties failed"); - assert(aROStates.getLength() == rPropertyNames.getLength() && "GetReadOnlyStates failed"); - if ( aValues.getLength() == rPropertyNames.getLength() && aROStates.getLength() == rPropertyNames.getLength() ) - { - for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ ) - { - if( pValues[nProp].hasValue() ) - { - bool bValue = *o3tl::doAccess<bool>(pValues[nProp]); - switch ( nProp ) - { - case 0: { bCJKFont = bValue; bROCJKFont = pROStates[nProp]; } break; - case 1: { bVerticalText = bValue; bROVerticalText = pROStates[nProp]; } break; - case 2: { bAsianTypography = bValue; bROAsianTypography = pROStates[nProp]; } break; - case 3: { bJapaneseFind = bValue; bROJapaneseFind = pROStates[nProp]; } break; - case 4: { bRuby = bValue; bRORuby = pROStates[nProp]; } break; - case 5: { bChangeCaseMap = bValue; bROChangeCaseMap = pROStates[nProp]; } break; - case 6: { bDoubleLines = bValue; bRODoubleLines = pROStates[nProp]; } break; - case 7: { bEmphasisMarks = bValue; bROEmphasisMarks = pROStates[nProp]; } break; - case 8: { bVerticalCallOut = bValue; bROVerticalCallOut = pROStates[nProp]; } break; - } - } - } - } - - if (!bCJKFont) - { - SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); - //system locale is CJK - bool bAutoEnableCJK = bool(nScriptType & SvtScriptType::ASIAN); - - if (!bAutoEnableCJK) - { - //windows secondary system locale is CJK - OUString sWin16SystemLocale = officecfg::System::L10N::SystemLocale::get(); - LanguageType eSystemLanguage = LANGUAGE_NONE; - if( !sWin16SystemLocale.isEmpty() ) - eSystemLanguage = LanguageTag::convertToLanguageTypeWithFallback( sWin16SystemLocale ); - if (eSystemLanguage != LANGUAGE_SYSTEM) - { - SvtScriptType nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); - bAutoEnableCJK = bool(nWinScript & SvtScriptType::ASIAN); - } - - //CJK keyboard is installed - if (!bAutoEnableCJK) - bAutoEnableCJK = SvtSystemLanguageOptions::isCJKKeyboardLayoutInstalled(); - } - - if (bAutoEnableCJK) - { - SetAll(true); - } - } - bIsLoaded = true; + SvtCJKOptions_Load(); + return officecfg::Office::Common::I18N::CJK::JapaneseFind::get(); } -void SvtCJKOptions_Impl::Notify( const Sequence< OUString >& ) +bool IsRubyEnabled() { - Load(); - NotifyListeners(ConfigurationHints::NONE); + SvtCJKOptions_Load(); + return officecfg::Office::Common::I18N::CJK::Ruby::get(); } -void SvtCJKOptions_Impl::ImplCommit() +bool IsChangeCaseMapEnabled() { - Sequence<OUString> &rPropertyNames = PropertyNames::get(); - OUString* pOrgNames = rPropertyNames.getArray(); - sal_Int32 nOrgCount = rPropertyNames.getLength(); - - Sequence< OUString > aNames(nOrgCount); - Sequence< Any > aValues(nOrgCount); - - OUString* pNames = aNames.getArray(); - Any* pValues = aValues.getArray(); - sal_Int32 nRealCount = 0; - - for(int nProp = 0; nProp < nOrgCount; nProp++) - { - switch(nProp) - { - case 0: - { - if (!bROCJKFont) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bCJKFont; - ++nRealCount; - } - } - break; - - case 1: - { - if (!bROVerticalText) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bVerticalText; - ++nRealCount; - } - } - break; - - case 2: - { - if (!bROAsianTypography) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bAsianTypography; - ++nRealCount; - } - } - break; - - case 3: - { - if (!bROJapaneseFind) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bJapaneseFind; - ++nRealCount; - } - } - break; - - case 4: - { - if (!bRORuby) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bRuby; - ++nRealCount; - } - } - break; - - case 5: - { - if (!bROChangeCaseMap) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bChangeCaseMap; - ++nRealCount; - } - } - break; - - case 6: - { - if (!bRODoubleLines) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bDoubleLines; - ++nRealCount; - } - } - break; - - case 7: - { - if (!bROEmphasisMarks) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bEmphasisMarks; - ++nRealCount; - } - } - break; - - case 8: - { - if (!bROVerticalCallOut) - { - pNames[nRealCount] = pOrgNames[nProp]; - pValues[nRealCount] <<= bVerticalCallOut; - ++nRealCount; - } - } - break; - } - } - aNames.realloc(nRealCount); - aValues.realloc(nRealCount); - PutProperties(aNames, aValues); + SvtCJKOptions_Load(); + return officecfg::Office::Common::I18N::CJK::ChangeCaseMap::get(); } -bool SvtCJKOptions_Impl::IsReadOnly(SvtCJKOptions::EOption eOption) const +bool IsDoubleLinesEnabled() { - bool bReadOnly = CFG_READONLY_DEFAULT; - switch(eOption) - { - case SvtCJKOptions::E_CJKFONT : bReadOnly = bROCJKFont; break; - case SvtCJKOptions::E_VERTICALTEXT : bReadOnly = bROVerticalText; break; - case SvtCJKOptions::E_ASIANTYPOGRAPHY : bReadOnly = bROAsianTypography; break; - case SvtCJKOptions::E_JAPANESEFIND : bReadOnly = bROJapaneseFind; break; - case SvtCJKOptions::E_RUBY : bReadOnly = bRORuby; break; - case SvtCJKOptions::E_CHANGECASEMAP : bReadOnly = bROChangeCaseMap; break; - case SvtCJKOptions::E_DOUBLELINES : bReadOnly = bRODoubleLines; break; - case SvtCJKOptions::E_EMPHASISMARKS : bReadOnly = bROEmphasisMarks; break; - case SvtCJKOptions::E_VERTICALCALLOUT : bReadOnly = bROVerticalCallOut; break; - case SvtCJKOptions::E_ALL : if (bROCJKFont || bROVerticalText || bROAsianTypography || bROJapaneseFind || bRORuby || bROChangeCaseMap || bRODoubleLines || bROEmphasisMarks || bROVerticalCallOut) - bReadOnly = true; - break; - } - return bReadOnly; + SvtCJKOptions_Load(); + return officecfg::Office::Common::I18N::CJK::DoubleLines::get(); } -namespace { - - // global - std::weak_ptr<SvtCJKOptions_Impl> g_pCJKOptions; - - struct theCJKOptionsMutex : public rtl::Static< ::osl::Mutex , theCJKOptionsMutex >{}; -} - -SvtCJKOptions::SvtCJKOptions(bool bDontLoad) -{ - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( theCJKOptionsMutex::get() ); - pImpl = g_pCJKOptions.lock(); - if ( !pImpl ) - { - pImpl = std::make_shared<SvtCJKOptions_Impl>(); - g_pCJKOptions = pImpl; - ItemHolder2::holdConfigItem(EItem::CJKOptions); - } - - if( !bDontLoad && !pImpl->IsLoaded()) - pImpl->Load(); -} - - -SvtCJKOptions::~SvtCJKOptions() +void SetAll(bool bSet) { - // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( theCJKOptionsMutex::get() ); + SvtCJKOptions_Load(); + if ( officecfg::Office::Common::I18N::CJK::CJKFont::isReadOnly() + || officecfg::Office::Common::I18N::CJK::VerticalText::isReadOnly() + || officecfg::Office::Common::I18N::CJK::AsianTypography::isReadOnly() + || officecfg::Office::Common::I18N::CJK::JapaneseFind::isReadOnly() + || officecfg::Office::Common::I18N::CJK::Ruby::isReadOnly() + || officecfg::Office::Common::I18N::CJK::ChangeCaseMap::isReadOnly() + || officecfg::Office::Common::I18N::CJK::DoubleLines::isReadOnly() ) + return; - // pImpl needs to be cleared before the mutex is dropped - pImpl.reset(); + std::shared_ptr<comphelper::ConfigurationChanges> xChanges(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::I18N::CJK::CJKFont::set(bSet, xChanges); + officecfg::Office::Common::I18N::CJK::VerticalText::set(bSet, xChanges); + officecfg::Office::Common::I18N::CJK::AsianTypography::set(bSet, xChanges); + officecfg::Office::Common::I18N::CJK::JapaneseFind::set(bSet, xChanges); + officecfg::Office::Common::I18N::CJK::Ruby::set(bSet, xChanges); + officecfg::Office::Common::I18N::CJK::ChangeCaseMap::set(bSet, xChanges); + officecfg::Office::Common::I18N::CJK::DoubleLines::set(bSet, xChanges); + xChanges->commit(); } -bool SvtCJKOptions::IsCJKFontEnabled() const +bool IsAnyEnabled() { - assert(pImpl->IsLoaded()); - return pImpl->IsCJKFontEnabled(); + SvtCJKOptions_Load(); + return IsCJKFontEnabled() || IsVerticalTextEnabled() || IsAsianTypographyEnabled() || IsJapaneseFindEnabled() || + IsRubyEnabled() || IsChangeCaseMapEnabled() || IsDoubleLinesEnabled() ; } -bool SvtCJKOptions::IsVerticalTextEnabled() const +bool IsReadOnly(EOption eOption) { - assert(pImpl->IsLoaded()); - return pImpl->IsVerticalTextEnabled(); + SvtCJKOptions_Load(); + switch (eOption) + { + case E_CJKFONT: return officecfg::Office::Common::I18N::CJK::CJKFont::isReadOnly(); + case E_VERTICALTEXT: return officecfg::Office::Common::I18N::CJK::VerticalText::isReadOnly(); + case E_ASIANTYPOGRAPHY: return officecfg::Office::Common::I18N::CJK::AsianTypography::isReadOnly(); + case E_JAPANESEFIND: return officecfg::Office::Common::I18N::CJK::JapaneseFind::isReadOnly(); + case E_RUBY: return officecfg::Office::Common::I18N::CJK::Ruby::isReadOnly(); + case E_CHANGECASEMAP: return officecfg::Office::Common::I18N::CJK::ChangeCaseMap::isReadOnly(); + case E_DOUBLELINES: return officecfg::Office::Common::I18N::CJK::DoubleLines::isReadOnly(); + case E_ALL: + return officecfg::Office::Common::I18N::CJK::CJKFont::isReadOnly() + || officecfg::Office::Common::I18N::CJK::VerticalText::isReadOnly() + || officecfg::Office::Common::I18N::CJK::AsianTypography::isReadOnly() + || officecfg::Office::Common::I18N::CJK::JapaneseFind::isReadOnly() + || officecfg::Office::Common::I18N::CJK::Ruby::isReadOnly() + || officecfg::Office::Common::I18N::CJK::ChangeCaseMap::isReadOnly() + || officecfg::Office::Common::I18N::CJK::DoubleLines::isReadOnly(); + default: + assert(false); + } + return false; } -bool SvtCJKOptions::IsAsianTypographyEnabled() const -{ - assert(pImpl->IsLoaded()); - return pImpl->IsAsianTypographyEnabled(); -} +} // namespace SvtCJKOptions -bool SvtCJKOptions::IsJapaneseFindEnabled() const -{ - assert(pImpl->IsLoaded()); - return pImpl->IsJapaneseFindEnabled(); -} -bool SvtCJKOptions::IsRubyEnabled() const -{ - assert(pImpl->IsLoaded()); - return pImpl->IsRubyEnabled(); -} +static std::once_flag gLoadFlag; -bool SvtCJKOptions::IsChangeCaseMapEnabled() const +static void SvtCJKOptions_Load() { - assert(pImpl->IsLoaded()); - return pImpl->IsChangeCaseMapEnabled(); -} + std::call_once(gLoadFlag, + []() + { + if (officecfg::Office::Common::I18N::CJK::CJKFont::get()) + return; -bool SvtCJKOptions::IsDoubleLinesEnabled() const -{ - assert(pImpl->IsLoaded()); - return pImpl->IsDoubleLinesEnabled(); -} + SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM); + //system locale is CJK + bool bAutoEnableCJK = bool(nScriptType & SvtScriptType::ASIAN); -void SvtCJKOptions::SetAll(bool bSet) -{ - assert(pImpl->IsLoaded()); - pImpl->SetAll(bSet); -} + if (!bAutoEnableCJK) + { + //windows secondary system locale is CJK + OUString sWin16SystemLocale = officecfg::System::L10N::SystemLocale::get(); + LanguageType eSystemLanguage = LANGUAGE_NONE; + if( !sWin16SystemLocale.isEmpty() ) + eSystemLanguage = LanguageTag::convertToLanguageTypeWithFallback( sWin16SystemLocale ); + if (eSystemLanguage != LANGUAGE_SYSTEM) + { + SvtScriptType nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage ); + bAutoEnableCJK = bool(nWinScript & SvtScriptType::ASIAN); + } -bool SvtCJKOptions::IsAnyEnabled() const -{ - assert(pImpl->IsLoaded()); - return pImpl->IsAnyEnabled(); -} + //CJK keyboard is installed + if (!bAutoEnableCJK) + bAutoEnableCJK = SvtSystemLanguageOptions::isCJKKeyboardLayoutInstalled(); + } -bool SvtCJKOptions::IsReadOnly(EOption eOption) const -{ - assert(pImpl->IsLoaded()); - return pImpl->IsReadOnly(eOption); + if (bAutoEnableCJK) + { + std::shared_ptr<comphelper::ConfigurationChanges> xChanges(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::I18N::CJK::CJKFont::set(true, xChanges); + officecfg::Office::Common::I18N::CJK::VerticalText::set(true, xChanges); + officecfg::Office::Common::I18N::CJK::AsianTypography::set(true, xChanges); + officecfg::Office::Common::I18N::CJK::JapaneseFind::set(true, xChanges); + officecfg::Office::Common::I18N::CJK::Ruby::set(true, xChanges); + officecfg::Office::Common::I18N::CJK::ChangeCaseMap::set(true, xChanges); + officecfg::Office::Common::I18N::CJK::DoubleLines::set(true, xChanges); + xChanges->commit(); + } + }); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx index 35e9e3da2550..6227ce390b45 100644 --- a/svl/source/config/itemholder2.cxx +++ b/svl/source/config/itemholder2.cxx @@ -106,10 +106,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem) { switch(rItem.eItem) { - case EItem::CJKOptions : - rItem.pItem.reset( new SvtCJKOptions() ); - break; - case EItem::CTLOptions : rItem.pItem.reset( new SvtCTLOptions() ); break; diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 8c3130a95c0f..33d54bee40e5 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -190,7 +190,7 @@ public: mbUseFontNameAsText(false), mbTextInited(false) { - m_bCJKEnabled = SvtCJKOptions().IsAnyEnabled(); + m_bCJKEnabled = SvtCJKOptions::IsAnyEnabled(); m_bCTLEnabled = SvtCTLOptions().IsCTLFontEnabled(); mxBackColor = svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; Invalidate100PercentFontWidth(); diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 28fa49e0ba8a..b266d04acd9f 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -427,14 +427,13 @@ void SvxSearchDialog::Construct_Impl() pImpl->aSelectionTimer.Start(); - SvtCJKOptions aCJKOptions; - if(!aCJKOptions.IsJapaneseFindEnabled()) + if(!SvtCJKOptions::IsJapaneseFindEnabled()) { m_xJapOptionsCB->set_active( false ); m_xJapOptionsCB->hide(); m_xJapOptionsBtn->hide(); } - if(!aCJKOptions.IsCJKFontEnabled()) + if(!SvtCJKOptions::IsCJKFontEnabled()) { m_xJapMatchFullHalfWidthCB->hide(); } @@ -693,7 +692,6 @@ void SvxSearchDialog::ShowOptionalControls_Impl() { DBG_ASSERT( pSearchItem, "no search item" ); - SvtCJKOptions aCJKOptions; SvtCTLOptions aCTLOptions; SvtModuleOptions::EFactory eFactory = getModule(rBindings); bool bDrawApp = eFactory == SvtModuleOptions::EFactory::DRAW; @@ -713,9 +711,9 @@ void SvxSearchDialog::ShowOptionalControls_Impl() m_xSelectionBtn->show(); m_xIncludeDiacritics->show(); m_xIncludeKashida->set_visible(aCTLOptions.IsCTLFontEnabled()); - m_xJapMatchFullHalfWidthCB->set_visible(aCJKOptions.IsCJKFontEnabled()); - m_xJapOptionsCB->set_visible(aCJKOptions.IsJapaneseFindEnabled()); - m_xJapOptionsBtn->set_visible(aCJKOptions.IsJapaneseFindEnabled()); + m_xJapMatchFullHalfWidthCB->set_visible(SvtCJKOptions::IsCJKFontEnabled()); + m_xJapOptionsCB->set_visible(SvtCJKOptions::IsJapaneseFindEnabled()); + m_xJapOptionsBtn->set_visible(SvtCJKOptions::IsJapaneseFindEnabled()); if (bWriter) { diff --git a/svx/source/form/fmtextcontroldialogs.cxx b/svx/source/form/fmtextcontroldialogs.cxx index 0c7c2a7de59c..c365becea715 100644 --- a/svx/source/form/fmtextcontroldialogs.cxx +++ b/svx/source/form/fmtextcontroldialogs.cxx @@ -66,8 +66,7 @@ namespace svx AddTabPage("labelTP_PARA_STD", RID_SVXPAGE_STD_PARAGRAPH); AddTabPage("labelTP_PARA_ALIGN", RID_SVXPAGE_ALIGN_PARAGRAPH); - SvtCJKOptions aCJKOptions; - if( aCJKOptions.IsAsianTypographyEnabled() ) + if( SvtCJKOptions::IsAsianTypographyEnabled() ) AddTabPage("labelTP_PARA_ASIAN", RID_SVXPAGE_PARA_ASIAN); else RemoveTabPage("labelTP_PARA_ASIAN"); diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx b/svx/source/sidebar/inspector/InspectorTextPanel.cxx index 57059958dfc9..3bcf30be9698 100644 --- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx +++ b/svx/source/sidebar/inspector/InspectorTextPanel.cxx @@ -60,7 +60,7 @@ InspectorTextPanel::InspectorTextPanel(weld::Widget* pParent) static bool GetPropertyValues(const OUString& rPropName, const uno::Any& rAny, OUString& rString) { // Hide Asian and Complex properties - if (!SvtCJKOptions().IsCJKFontEnabled() && rPropName.indexOf("Asian") != -1) + if (!SvtCJKOptions::IsCJKFontEnabled() && rPropName.indexOf("Asian") != -1) return false; if (!SvtCTLOptions().IsCTLFontEnabled() && rPropName.indexOf("Complex") != -1) return false; diff --git a/svx/source/tbxctrls/verttexttbxctrl.cxx b/svx/source/tbxctrls/verttexttbxctrl.cxx index fcc799283253..9e1eeffca214 100644 --- a/svx/source/tbxctrls/verttexttbxctrl.cxx +++ b/svx/source/tbxctrls/verttexttbxctrl.cxx @@ -100,8 +100,7 @@ void SAL_CALL SvxVertCTLTextTbxCtrl::statusChanged(const css::frame::FeatureStat bool bEnabled = false; if (rEvent.FeatureURL.Complete == ".uno:VerticalTextState") { - SvtCJKOptions aLangOptions; - bEnabled = m_bVisible && aLangOptions.IsVerticalTextEnabled(); + bEnabled = m_bVisible && SvtCJKOptions::IsVerticalTextEnabled(); } else if (rEvent.FeatureURL.Complete == ".uno:CTLFontState") { diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index 5ccd2a2d78d6..3daf6f29676c 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -171,7 +171,7 @@ SwPrintUIOptions::SwPrintUIOptions( } // check if either CJK or CTL is enabled - bool bRTL = SvtCJKOptions().IsCJKFontEnabled() || SvtCTLOptions().IsCTLFontEnabled(); + bool bRTL = SvtCJKOptions::IsCJKFontEnabled() || SvtCTLOptions().IsCTLFontEnabled(); // create sequence of print UI options // (5 options are not available for Writer-Web) diff --git a/sw/source/ui/chrdlg/chardlg.cxx b/sw/source/ui/chrdlg/chardlg.cxx index ab59691668b1..edd12254dd8b 100644 --- a/sw/source/ui/chrdlg/chardlg.cxx +++ b/sw/source/ui/chrdlg/chardlg.cxx @@ -84,8 +84,7 @@ SwCharDlg::SwCharDlg(weld::Window* pParent, SwView& rVw, const SfxItemSet& rCore } else { - SvtCJKOptions aCJKOptions; - if (!aCJKOptions.IsDoubleLinesEnabled()) + if (!SvtCJKOptions::IsDoubleLinesEnabled()) RemoveTabPage("asianlayout"); } diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx index 225c0472de9c..aef94f46111a 100644 --- a/sw/source/ui/chrdlg/pardlg.cxx +++ b/sw/source/ui/chrdlg/pardlg.cxx @@ -84,8 +84,7 @@ SwParaDlg::SwParaDlg(weld::Window *pParent, else RemoveTabPage("textflow"); - SvtCJKOptions aCJKOptions; - if(!bHtmlMode && aCJKOptions.IsAsianTypographyEnabled()) + if(!bHtmlMode && SvtCJKOptions::IsAsianTypographyEnabled()) { OSL_ENSURE(pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageCreatorFunc fail!"); OSL_ENSURE(pFact->GetTabPageRangesFunc(RID_SVXPAGE_PARA_ASIAN), "GetTabPageRangesFunc fail!"); diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 6d2aa0b40856..0d46719043d6 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -124,8 +124,7 @@ SwLoadOptPage::SwLoadOptPage(weld::Container* pPage, weld::DialogController* pCo m_xTabMF->hide(); } - SvtCJKOptions aCJKOptions; - if(!aCJKOptions.IsAsianTypographyEnabled()) + if(!SvtCJKOptions::IsAsianTypographyEnabled()) { m_xUseSquaredPageMode->hide(); m_xUseCharUnit->hide(); @@ -203,8 +202,7 @@ bool SwLoadOptPage::FillItemSet( SfxItemSet* rSet ) } bool bIsUseCharUnitFlag = m_xUseCharUnit->get_active(); - SvtCJKOptions aCJKOptions; - bIsUseCharUnitFlag = bIsUseCharUnitFlag && aCJKOptions.IsAsianTypographyEnabled(); + bIsUseCharUnitFlag = bIsUseCharUnitFlag && SvtCJKOptions::IsAsianTypographyEnabled(); if( (bIsUseCharUnitFlag ? 1 : 0) != m_xUseCharUnit->get_saved_state()) { rSet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bIsUseCharUnitFlag )); diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index dabbf26d13d6..de601d0a6b7f 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -129,8 +129,7 @@ SwContentOptPage::SwContentOptPage(weld::Container* pPage, weld::DialogControlle m_xMetricLB->hide(); } - SvtCJKOptions aCJKOptions; - if(!aCJKOptions.IsVerticalTextEnabled() ) + if(!SvtCJKOptions::IsVerticalTextEnabled() ) m_xVRulerRightCBox->hide(); m_xVRulerCBox->connect_toggled(LINK(this, SwContentOptPage, VertRulerHdl )); diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index 9052c6c4ae61..0bda8452a215 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -74,7 +74,7 @@ void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat& static_cast<double>(rDoc.nChar) / nCharsPerStandardizedPage); } - bool bShowCJK = (SvtCJKOptions().IsAnyEnabled() || rDoc.nAsianWord); + bool bShowCJK = (SvtCJKOptions::IsAnyEnabled() || rDoc.nAsianWord); bool bToggleCJK = m_xCurrentCjkcharsFT->get_visible() != bShowCJK; if (bToggleCJK) { @@ -121,7 +121,7 @@ SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* _pBindings, , m_xStandardizedPagesLabelFT(m_xBuilder->weld_label("standardizedpages")) , m_xStandardizedPagesLabelFT2(m_xBuilder->weld_label("standardizedpages2")) { - showCJK(SvtCJKOptions().IsAnyEnabled()); + showCJK(SvtCJKOptions::IsAnyEnabled()); showStandardizedPages(officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::get()); Initialize(pInfo); diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 2062b69bee45..6e797e45a5a4 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -102,8 +102,7 @@ SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent, AddTabPage("asianlayout", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_CHAR_TWOLINES )); AddTabPage("background", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BKG ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BKG )); AddTabPage("borders", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), pFact->GetTabPageRangesFunc( RID_SVXPAGE_BORDER )); - SvtCJKOptions aCJKOptions; - if(nHtmlMode & HTMLMODE_ON || !aCJKOptions.IsDoubleLinesEnabled()) + if(nHtmlMode & HTMLMODE_ON || !SvtCJKOptions::IsDoubleLinesEnabled()) RemoveTabPage("asianlayout"); } break; @@ -145,7 +144,6 @@ SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent, || nHtmlMode & HTMLMODE_ON ) RemoveTabPage("condition"); - SvtCJKOptions aCJKOptions; if(nHtmlMode & HTMLMODE_ON) { if (!SvxHtmlOptions::IsPrintLayoutExtension()) @@ -162,9 +160,9 @@ SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent, } else { - if(!aCJKOptions.IsAsianTypographyEnabled()) + if(!SvtCJKOptions::IsAsianTypographyEnabled()) RemoveTabPage("asiantypo"); - if(!aCJKOptions.IsDoubleLinesEnabled()) + if(!SvtCJKOptions::IsDoubleLinesEnabled()) RemoveTabPage("asianlayout"); } } @@ -184,8 +182,7 @@ SwTemplateDlgController::SwTemplateDlgController(weld::Window* pParent, AddTabPage("columns", SwColumnPage::Create, SwColumnPage::GetRanges ); AddTabPage("footnotes", SwFootNotePage::Create, SwFootNotePage::GetRanges ); AddTabPage("textgrid", SwTextGridPage::Create, SwTextGridPage::GetRanges ); - SvtCJKOptions aCJKOptions; - if(!aCJKOptions.IsAsianTypographyEnabled()) + if(!SvtCJKOptions::IsAsianTypographyEnabled()) RemoveTabPage("textgrid"); } else diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index a7f13e504b14..291ff0572e6c 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -170,7 +170,7 @@ SwIndexMarkPane::SwIndexMarkPane(const std::shared_ptr<weld::Dialog>& rDialog, w { m_xSyncED->show(); - if (SvtCJKOptions().IsCJKFontEnabled()) + if (SvtCJKOptions::IsCJKFontEnabled()) { uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 58c5d311357b..ae896be9a608 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -835,7 +835,6 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit) bool bHasWesternFontPrefix = false; bool bHasCJKFontPrefix = false; bool bHasCTLFontPrefix = false; - SvtCJKOptions aCJKOptions; SvtCTLOptions aCTLOptions; // Get currently used FillStyle and remember, also need the XFillFloatTransparenceItem @@ -913,7 +912,7 @@ OUString SwDocStyleSheet::GetDescription(MapUnit eUnit) case RES_CHRATR_CJK_LANGUAGE: case RES_CHRATR_CJK_POSTURE: case RES_CHRATR_CJK_WEIGHT: - if(aCJKOptions.IsCJKFontEnabled()) + if(SvtCJKOptions::IsCJKFontEnabled()) bIsDefault = true; if(!bHasCJKFontPrefix) { diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index c396d437fd0f..a8fd9ac8e448 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -309,12 +309,11 @@ void SwModule::ApplyUserCharUnit(bool bApplyChar, bool bWeb) } else { - SvtCJKOptions aCJKOptions; - if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eHScrollMetric == FieldUnit::CHAR )) + if ( !SvtCJKOptions::IsAsianTypographyEnabled() && ( eHScrollMetric == FieldUnit::CHAR )) eHScrollMetric = FieldUnit::INCH; else if ( eHScrollMetric == FieldUnit::CHAR ) eHScrollMetric = FieldUnit::CM; - if ( !aCJKOptions.IsAsianTypographyEnabled() && ( eVScrollMetric == FieldUnit::LINE )) + if ( !SvtCJKOptions::IsAsianTypographyEnabled() && ( eVScrollMetric == FieldUnit::LINE )) eVScrollMetric = FieldUnit::INCH; else if ( eVScrollMetric == FieldUnit::LINE ) eVScrollMetric = FieldUnit::CM; diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 8e95354f9026..2ee297ae4095 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1400,7 +1400,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) case SID_HANGUL_HANJA_CONVERSION: case SID_CHINESE_CONVERSION: { - if (!SvtCJKOptions().IsAnyEnabled()) + if (!SvtCJKOptions::IsAnyEnabled()) { rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, false ); rSet.DisableItem(nWhich); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 9eb7b9996696..cc21f3296927 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -849,7 +849,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_HANGUL_HANJA_CONVERSION: case SID_CHINESE_CONVERSION: { - if (!SvtCJKOptions().IsAnyEnabled()) + if (!SvtCJKOptions::IsAnyEnabled()) { GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false); rSet.DisableItem(nWhich); @@ -861,7 +861,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_TEXTDIRECTION_LEFT_TO_RIGHT: case SID_TEXTDIRECTION_TOP_TO_BOTTOM: - if (!SvtCJKOptions().IsVerticalTextEnabled()) + if (!SvtCJKOptions::IsVerticalTextEnabled()) { rSet.DisableItem(nSlotId); nSlotId = 0; @@ -926,8 +926,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet) case SID_TRANSLITERATE_HIRAGANA: case SID_TRANSLITERATE_KATAKANA: { - SvtCJKOptions aCJKOptions; - if (!aCJKOptions.IsChangeCaseMapEnabled()) + if (!SvtCJKOptions::IsChangeCaseMapEnabled()) { rSet.DisableItem(nWhich); GetView().GetViewFrame()->GetBindings().SetVisibleState(nWhich, false); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 0114119d1fc7..18fa9b846b62 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1964,8 +1964,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case SID_RUBY_DIALOG: { - SvtCJKOptions aCJKOptions; - if( !aCJKOptions.IsRubyEnabled() + if( !SvtCJKOptions::IsRubyEnabled() || rSh.CursorInsideInputField() ) { GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, false ); @@ -2024,8 +2023,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case SID_TRANSLITERATE_HIRAGANA: case SID_TRANSLITERATE_KATAKANA: { - SvtCJKOptions aCJKOptions; - if(!aCJKOptions.IsChangeCaseMapEnabled()) + if(!SvtCJKOptions::IsChangeCaseMapEnabled()) { GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, false ); rSet.DisableItem(nWhich); diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index a2b97c548b0b..643b5b58f230 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -410,8 +410,7 @@ void SwView::ExecSearch(SfxRequest& rReq) { aSet.MergeRange(RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_WEIGHT); } - SvtCJKOptions aCJKOpt; - if( aCJKOpt.IsAnyEnabled() ) + if( SvtCJKOptions::IsAnyEnabled() ) { aSet.MergeRange(RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_WEIGHT); aSet.MergeRange(RES_CHRATR_EMPHASIS_MARK, RES_CHRATR_TWO_LINES); diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 9e336a019ba9..c2e94cb85479 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -458,7 +458,7 @@ void SwView::GetState(SfxItemSet &rSet) case SID_HANGUL_HANJA_CONVERSION: case SID_CHINESE_CONVERSION: { - if (!SvtCJKOptions().IsAnyEnabled()) + if (!SvtCJKOptions::IsAnyEnabled()) { GetViewFrame()->GetBindings().SetVisibleState( nWhich, false ); rSet.DisableItem(nWhich); @@ -608,7 +608,7 @@ void SwView::GetDrawState(SfxItemSet &rSet) case SID_DRAW_TEXT_VERTICAL: case SID_DRAW_CAPTION_VERTICAL: - if ( bWeb || !SvtCJKOptions().IsVerticalTextEnabled() ) + if ( bWeb || !SvtCJKOptions::IsVerticalTextEnabled() ) rSet.DisableItem( nWhich ); else if (nWhich != SID_DRAW_TEXT_VERTICAL) //tdf#113171 |