diff options
Diffstat (limited to 'cui/source/tabpages/chardlg.cxx')
-rw-r--r-- | cui/source/tabpages/chardlg.cxx | 515 |
1 files changed, 276 insertions, 239 deletions
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index a4cc33265a18..cd6965375003 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -23,7 +23,8 @@ #include <sfx2/objsh.hxx> #include <svx/svxids.hrc> #include <svtools/unitconv.hxx> -#include <svl/languageoptions.hxx> +#include <svl/cjkoptions.hxx> +#include <svl/ctloptions.hxx> #include <chardlg.hxx> #include <editeng/fontitem.hxx> #include <editeng/postitem.hxx> @@ -40,10 +41,11 @@ #include <editeng/kernitem.hxx> #include <editeng/flstitem.hxx> #include <editeng/autokernitem.hxx> +#include <editeng/nhypitem.hxx> #include <editeng/colritem.hxx> #include <dialmgr.hxx> #include <sfx2/htmlmode.hxx> -#include <cui/cuicharmap.hxx> +#include <svx/cuicharmap.hxx> #include "chardlg.h" #include <editeng/emphasismarkitem.hxx> #include <editeng/charreliefitem.hxx> @@ -56,74 +58,48 @@ #include <twolines.hrc> #include <svl/intitem.hxx> #include <svx/flagsdef.hxx> +#include <FontFeatures.hxx> #include <FontFeaturesDialog.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> #include <o3tl/unit_conversion.hxx> +#include <o3tl/string_view.hxx> using namespace ::com::sun::star; // static ---------------------------------------------------------------- -const sal_uInt16 SvxCharNamePage::pNameRanges[] = -{ - SID_ATTR_CHAR_FONT, - SID_ATTR_CHAR_WEIGHT, - SID_ATTR_CHAR_FONTHEIGHT, - SID_ATTR_CHAR_FONTHEIGHT, - SID_ATTR_CHAR_COLOR, - SID_ATTR_CHAR_COLOR, - SID_ATTR_CHAR_LANGUAGE, - SID_ATTR_CHAR_LANGUAGE, - SID_ATTR_CHAR_CJK_FONT, - SID_ATTR_CHAR_CJK_WEIGHT, - SID_ATTR_CHAR_CTL_FONT, - SID_ATTR_CHAR_CTL_WEIGHT, - 0 -}; - -const sal_uInt16 SvxCharEffectsPage::pEffectsRanges[] = -{ - SID_ATTR_CHAR_SHADOWED, - SID_ATTR_CHAR_UNDERLINE, - SID_ATTR_CHAR_COLOR, - SID_ATTR_CHAR_COLOR, - SID_ATTR_CHAR_CASEMAP, - SID_ATTR_CHAR_CASEMAP, - SID_ATTR_FLASH, - SID_ATTR_FLASH, - SID_ATTR_CHAR_EMPHASISMARK, - SID_ATTR_CHAR_EMPHASISMARK, - SID_ATTR_CHAR_RELIEF, - SID_ATTR_CHAR_RELIEF, - SID_ATTR_CHAR_HIDDEN, - SID_ATTR_CHAR_HIDDEN, - SID_ATTR_CHAR_OVERLINE, - SID_ATTR_CHAR_OVERLINE, - 0 -}; - -const sal_uInt16 SvxCharPositionPage::pPositionRanges[] = -{ - SID_ATTR_CHAR_KERNING, - SID_ATTR_CHAR_KERNING, - SID_ATTR_CHAR_ESCAPEMENT, - SID_ATTR_CHAR_ESCAPEMENT, - SID_ATTR_CHAR_AUTOKERN, - SID_ATTR_CHAR_AUTOKERN, - SID_ATTR_CHAR_ROTATED, - SID_ATTR_CHAR_SCALEWIDTH, - SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, - SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, - 0 -}; - -const sal_uInt16 SvxCharTwoLinesPage::pTwoLinesRanges[] = -{ - SID_ATTR_CHAR_TWO_LINES, - SID_ATTR_CHAR_TWO_LINES, - 0 -}; +const WhichRangesContainer SvxCharNamePage::pNameRanges(svl::Items< + SID_ATTR_CHAR_FONT, SID_ATTR_CHAR_WEIGHT, + SID_ATTR_CHAR_FONTHEIGHT, SID_ATTR_CHAR_FONTHEIGHT, + SID_ATTR_CHAR_COLOR, SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_LANGUAGE, SID_ATTR_CHAR_LANGUAGE, + SID_ATTR_CHAR_CJK_FONT, SID_ATTR_CHAR_CJK_WEIGHT, + SID_ATTR_CHAR_CTL_FONT, SID_ATTR_CHAR_CTL_WEIGHT +>); + +const WhichRangesContainer SvxCharEffectsPage::pEffectsRanges(svl::Items< + SID_ATTR_CHAR_SHADOWED, SID_ATTR_CHAR_UNDERLINE, + SID_ATTR_CHAR_COLOR, SID_ATTR_CHAR_COLOR, + SID_ATTR_CHAR_CASEMAP, SID_ATTR_CHAR_CASEMAP, + SID_ATTR_FLASH, SID_ATTR_FLASH, + SID_ATTR_CHAR_EMPHASISMARK, SID_ATTR_CHAR_EMPHASISMARK, + SID_ATTR_CHAR_RELIEF, SID_ATTR_CHAR_RELIEF, + SID_ATTR_CHAR_HIDDEN, SID_ATTR_CHAR_HIDDEN, + SID_ATTR_CHAR_OVERLINE, SID_ATTR_CHAR_OVERLINE +>); + +const WhichRangesContainer SvxCharPositionPage::pPositionRanges(svl::Items< + SID_ATTR_CHAR_KERNING, SID_ATTR_CHAR_KERNING, + SID_ATTR_CHAR_ESCAPEMENT, SID_ATTR_CHAR_ESCAPEMENT, + SID_ATTR_CHAR_AUTOKERN, SID_ATTR_CHAR_AUTOKERN, + SID_ATTR_CHAR_ROTATED, SID_ATTR_CHAR_SCALEWIDTH, + SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE +>); + +const WhichRangesContainer SvxCharTwoLinesPage::pTwoLinesRanges(svl::Items< + SID_ATTR_CHAR_TWO_LINES, SID_ATTR_CHAR_TWO_LINES +>); // C-Function ------------------------------------------------------------ @@ -157,7 +133,7 @@ inline SvxFont& SvxCharBasePage::GetPreviewCTLFont() return m_aPreviewWin.GetCTLFont(); } -SvxCharBasePage::SvxCharBasePage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet& rItemset) +SvxCharBasePage::SvxCharBasePage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet& rItemset) : SfxTabPage(pPage, pController, rUIXMLDescription, rID, &rItemset) , m_bPreviewBackgroundToCharacter( false ) { @@ -195,7 +171,7 @@ void SvxCharBasePage::SetPrevFontEscapement( sal_uInt8 nProp, sal_uInt8 nEscProp struct SvxCharNamePage_Impl { - Idle m_aUpdateIdle; + Idle m_aUpdateIdle { "cui SvxCharNamePage_Impl m_aUpdateIdle" }; OUString m_aNoStyleText; std::unique_ptr<FontList> m_pFontList; int m_nExtraEntryPos; @@ -215,83 +191,72 @@ struct SvxCharNamePage_Impl SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInSet) : SvxCharBasePage(pPage, pController, "cui/ui/charnamepage.ui", "CharNamePage", rInSet) , m_pImpl(new SvxCharNamePage_Impl) - , m_xEastFrame(m_xBuilder->weld_widget("asian")) - , m_xEastFontNameFT(m_xBuilder->weld_label("eastfontnameft")) - , m_xEastFontNameLB(m_xBuilder->weld_combo_box("eastfontnamelb")) - , m_xEastFontStyleFT(m_xBuilder->weld_label("eaststyleft")) - , m_xEastFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("eaststylelb"))) - , m_xEastFontSizeFT(m_xBuilder->weld_label("eastsizeft")) - , m_xEastFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("eastsizelb"))) - , m_xEastFontLanguageFT(m_xBuilder->weld_label("eastlangft")) - , m_xEastFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("eastlanglb"))) - , m_xEastFontTypeFT(m_xBuilder->weld_label("eastfontinfo")) - , m_xEastFontFeaturesButton(m_xBuilder->weld_button("east_features_button")) - , m_xCTLFrame(m_xBuilder->weld_widget("ctl")) - , m_xCTLFontNameFT(m_xBuilder->weld_label("ctlfontnameft")) - , m_xCTLFontNameLB(m_xBuilder->weld_combo_box("ctlfontnamelb")) - , m_xCTLFontStyleFT(m_xBuilder->weld_label("ctlstyleft")) - , m_xCTLFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("ctlstylelb"))) - , m_xCTLFontSizeFT(m_xBuilder->weld_label("ctlsizeft")) - , m_xCTLFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("ctlsizelb"))) - , m_xCTLFontLanguageFT(m_xBuilder->weld_label("ctllangft")) - , m_xCTLFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("ctllanglb"))) - , m_xCTLFontTypeFT(m_xBuilder->weld_label("ctlfontinfo")) - , m_xCTLFontFeaturesButton(m_xBuilder->weld_button("ctl_features_button")) + // Western + , m_xWestern(m_xBuilder->weld_notebook("nbWestern")) + , m_xWestFontNameFT(m_xBuilder->weld_label("lbWestFontname")) + , m_xWestFontStyleFT(m_xBuilder->weld_label("lbWestStyle")) + , m_xWestFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("cbWestStyle"))) + , m_xWestFontSizeFT(m_xBuilder->weld_label("lbWestSize")) + , m_xWestFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("cbWestSize"))) + , m_xWestFontLanguageFT(m_xBuilder->weld_label("lbWestLanguage")) + , m_xWestFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("cbWestLanguage"))) + , m_xWestFontFeaturesButton(m_xBuilder->weld_button("btnWestFeatures")) + , m_xWestFontTypeFT(m_xBuilder->weld_label("lbWestFontinfo")) + , m_xCJK_CTL(m_xBuilder->weld_notebook("nbCJKCTL")) + // CJK + , m_xEastFontNameFT(m_xBuilder->weld_label("lbCJKFontname")) + , m_xEastFontStyleFT(m_xBuilder->weld_label("lbCJKStyle")) + , m_xEastFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("cbCJKStyle"))) + , m_xEastFontSizeFT(m_xBuilder->weld_label("lbCJKSize")) + , m_xEastFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("cbCJKSize"))) + , m_xEastFontLanguageFT(m_xBuilder->weld_label("lbCJKLanguage")) + , m_xEastFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("cbCJKLanguage"))) + , m_xEastFontFeaturesButton(m_xBuilder->weld_button("btnCJKFeatures")) + , m_xEastFontTypeFT(m_xBuilder->weld_label("lbCJKFontinfo")) + // CTL + , m_xCTLFontNameFT(m_xBuilder->weld_label("lbCTLFontname")) + // tree + , m_xCTLFontStyleFT(m_xBuilder->weld_label("lbCTLStyle")) + , m_xCTLFontStyleLB(new FontStyleBox(m_xBuilder->weld_combo_box("cbCTLStyle"))) + , m_xCTLFontSizeFT(m_xBuilder->weld_label("lbCTLSize")) + , m_xCTLFontSizeLB(new FontSizeBox(m_xBuilder->weld_combo_box("cbCTLSize"))) + , m_xCTLFontLanguageFT(m_xBuilder->weld_label("lbCTLLanguage")) + , m_xCTLFontLanguageLB(new SvxLanguageBox(m_xBuilder->weld_combo_box("cbCTLLanguage"))) + , m_xCTLFontFeaturesButton(m_xBuilder->weld_button("btnCTLFeatures")) + , m_xCTLFontTypeFT(m_xBuilder->weld_label("lbCTLFontinfo")) + + , m_xVDev(*Application::GetDefaultDevice(), DeviceFormat::WITH_ALPHA) { m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin)); #ifdef IOS m_xPreviewWin->hide(); #endif - m_pImpl->m_aNoStyleText = CuiResId( RID_SVXSTR_CHARNAME_NOSTYLE ); - - SvtLanguageOptions aLanguageOptions; - bool bShowCJK = aLanguageOptions.IsCJKFontEnabled(); - bool bShowCTL = aLanguageOptions.IsCTLFontEnabled(); - bool bShowNonWestern = bShowCJK || bShowCTL; + m_pImpl->m_aNoStyleText = CuiResId( RID_CUISTR_CHARNAME_NOSTYLE ); - if (bShowNonWestern) - { - m_xWestFrame = m_xBuilder->weld_widget("western"); - m_xWestFontNameFT = m_xBuilder->weld_label("westfontnameft-cjk"); - m_xWestFontNameLB = m_xBuilder->weld_combo_box("westfontnamelb-cjk"); - m_xWestFontStyleFT = m_xBuilder->weld_label("weststyleft-cjk"); - m_xWestFontSizeFT = m_xBuilder->weld_label("westsizeft-cjk"); + std::unique_ptr<weld::EntryTreeView> xWestFontName = m_xBuilder->weld_entry_tree_view("gdWestern", "edWestFontName", "trWestFontName"); + std::unique_ptr<weld::EntryTreeView> xCJKFontName = m_xBuilder->weld_entry_tree_view("gdCJK", "edCJKFontName", "trCJKFontName"); + std::unique_ptr<weld::EntryTreeView> xCTLFontName = m_xBuilder->weld_entry_tree_view("gdCTL", "edCTLFontName", "trCTLFontName"); - m_xWestFontStyleLB.reset(new FontStyleBox(m_xBuilder->weld_combo_box("weststylelb-cjk"))); - m_xWestFontSizeLB.reset(new FontSizeBox(m_xBuilder->weld_combo_box("westsizelb-cjk"))); + // 7 lines in the treeview + xWestFontName->set_height_request_by_rows(7); + xCJKFontName->set_height_request_by_rows(7); + xCTLFontName->set_height_request_by_rows(7); - m_xWestFontLanguageFT = m_xBuilder->weld_label("westlangft-cjk"); - m_xWestFontLanguageLB.reset(new SvxLanguageBox(m_xBuilder->weld_combo_box("westlanglb-cjk"))); - m_xWestFontTypeFT = m_xBuilder->weld_label("westfontinfo-cjk"); + m_xWestFontNameLB = std::move(xWestFontName); + m_xEastFontNameLB = std::move(xCJKFontName); + m_xCTLFontNameLB = std::move(xCTLFontName); - m_xWestFontFeaturesButton = m_xBuilder->weld_button("west_features_button-cjk"); - } - else + bool bShowCJK = SvtCJKOptions::IsCJKFontEnabled(); + bool bShowCTL = SvtCTLOptions::IsCTLFontEnabled(); + bool bShowNonWestern = bShowCJK || bShowCTL; + if (!bShowNonWestern) { - m_xWestFrame = m_xBuilder->weld_widget("simple"); - m_xWestFontNameFT = m_xBuilder->weld_label("westfontnameft-nocjk"); - m_xWestFontStyleFT = m_xBuilder->weld_label("weststyleft-nocjk"); - m_xWestFontSizeFT = m_xBuilder->weld_label("westsizeft-nocjk"); - - m_xWestFontLanguageFT = m_xBuilder->weld_label("westlangft-nocjk"); - m_xWestFontLanguageLB.reset(new SvxLanguageBox(m_xBuilder->weld_combo_box("westlanglb-nocjk"))); - m_xWestFontTypeFT = m_xBuilder->weld_label("westfontinfo-nocjk"); - - m_xWestFontFeaturesButton = m_xBuilder->weld_button("west_features_button-nocjk"); - - std::unique_ptr<weld::EntryTreeView> xWestFontNameLB = m_xBuilder->weld_entry_tree_view("namegrid", "westfontname-nocjk", "westfontnamelb-nocjk"); - std::unique_ptr<weld::EntryTreeView> xWestFontStyleLB = m_xBuilder->weld_entry_tree_view("stylegrid", "weststyle-nocjk", "weststylelb-nocjk"); - std::unique_ptr<weld::EntryTreeView> xWestFontSizeLB = m_xBuilder->weld_entry_tree_view("sizegrid", "westsize-nocjk", "westsizelb-nocjk"); - - // 7 lines in the treeview - xWestFontNameLB->set_height_request_by_rows(7); - xWestFontStyleLB->set_height_request_by_rows(7); - xWestFontSizeLB->set_height_request_by_rows(7); - - m_xWestFontNameLB = std::move(xWestFontNameLB); - m_xWestFontStyleLB.reset(new FontStyleBox(std::move(xWestFontStyleLB))); - m_xWestFontSizeLB.reset(new FontSizeBox(std::move(xWestFontSizeLB))); + m_xCJK_CTL->hide(); + m_xWestern->set_show_tabs(false); //hide single tab in case of Western only } + else if (!bShowCJK) m_xCJK_CTL->remove_page("nbCJK"); + else if (!bShowCTL) m_xCJK_CTL->remove_page("nbCTL"); + //In MacOSX the standard dialogs name font-name, font-style as //Family, Typeface @@ -300,33 +265,34 @@ SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController* //In Windows the standard dialogs name font-name, font-style as //Font, Style #ifdef _WIN32 - OUString sFontFamilyString(CuiResId(RID_SVXSTR_CHARNAME_FONT)); + OUString sFontFamilyString(CuiResId(RID_CUISTR_CHARNAME_FONT)); #else - OUString sFontFamilyString(CuiResId(RID_SVXSTR_CHARNAME_FAMILY)); + OUString sFontFamilyString(CuiResId(RID_CUISTR_CHARNAME_FAMILY)); #endif m_xWestFontNameFT->set_label(sFontFamilyString); - m_xEastFontNameFT->set_label(sFontFamilyString); m_xCTLFontNameFT->set_label(sFontFamilyString); + m_xEastFontNameFT->set_label(sFontFamilyString); #ifdef MACOSX - OUString sFontStyleString(CuiResId(RID_SVXSTR_CHARNAME_TYPEFACE)); + OUString sFontStyleString(CuiResId(RID_CUISTR_CHARNAME_TYPEFACE)); #else - OUString sFontStyleString(CuiResId(RID_SVXSTR_CHARNAME_STYLE)); + OUString sFontStyleString(CuiResId(RID_CUISTR_CHARNAME_STYLE)); #endif m_xWestFontStyleFT->set_label(sFontStyleString); m_xEastFontStyleFT->set_label(sFontStyleString); m_xCTLFontStyleFT->set_label(sFontStyleString); - m_xWestFrame->show(); - m_xEastFrame->set_visible(bShowCJK); - m_xCTLFrame->set_visible(bShowCTL); - m_xWestFontLanguageLB->SetLanguageList(SvxLanguageListFlags::WESTERN, true, false, true, true, - LANGUAGE_SYSTEM, css::i18n::ScriptType::LATIN); + LANGUAGE_SYSTEM, css::i18n::ScriptType::LATIN); m_xEastFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CJK, true, false, true, true, - LANGUAGE_SYSTEM, css::i18n::ScriptType::ASIAN); + LANGUAGE_SYSTEM, css::i18n::ScriptType::ASIAN); m_xCTLFontLanguageLB->SetLanguageList(SvxLanguageListFlags::CTL, true, false, true, true, - LANGUAGE_SYSTEM, css::i18n::ScriptType::COMPLEX); + LANGUAGE_SYSTEM, css::i18n::ScriptType::COMPLEX); + int nVisibleChars = 15; + // read-only combobox / HasEntry asserts on set_width_char() + m_xWestFontLanguageLB->set_width_chars(nVisibleChars); + m_xEastFontLanguageLB->set_width_chars(nVisibleChars); + m_xCTLFontLanguageLB->set_width_chars(nVisibleChars); Initialize(); } @@ -378,10 +344,8 @@ const FontList* SvxCharNamePage::GetFontList() const { if ( !m_pImpl->m_pFontList ) { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - /* #110771# SvxFontListItem::GetFontList can return NULL */ - if ( pDocSh ) + if (SfxObjectShell* pDocSh = SfxObjectShell::Current()) { const SfxPoolItem* pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ); if ( pItem != nullptr ) @@ -506,6 +470,35 @@ void SvxCharNamePage::UpdatePreview_Impl() m_aPreviewWin.Invalidate(); } +void SvxCharNamePage::EnableFeatureButton(const weld::Widget& rNameBox) +{ + OUString sFontName; + weld::Button* pButton= nullptr; + if (m_xWestFontNameLB.get() == &rNameBox) + { + sFontName = m_xWestFontNameLB->get_active_text(); + pButton= m_xWestFontFeaturesButton.get(); + } + else if (m_xEastFontNameLB.get() == &rNameBox) + { + sFontName = m_xEastFontNameLB->get_active_text(); + pButton=m_xEastFontFeaturesButton.get(); + } + else if (m_xCTLFontNameLB.get() == &rNameBox) + { + sFontName = m_xCTLFontNameLB->get_active_text(); + pButton= m_xCTLFontFeaturesButton.get(); + } + else + { + SAL_WARN( "cui.tabpages", "invalid font name box" ); + return; + } + + bool bEnable = !getFontFeatureList(sFontName, *m_xVDev).empty(); + + pButton->set_sensitive(bEnable); +} void SvxCharNamePage::FillStyleBox_Impl(const weld::Widget& rNameBox) { @@ -558,27 +551,19 @@ void SvxCharNamePage::FillSizeBox_Impl(const weld::Widget& rNameBox) const FontList* pFontList = GetFontList(); DBG_ASSERT( pFontList, "no fontlist" ); - FontStyleBox* pStyleBox = nullptr; FontSizeBox* pSizeBox = nullptr; - OUString sFontName; if (m_xWestFontNameLB.get() == &rNameBox) { - pStyleBox = m_xWestFontStyleLB.get(); pSizeBox = m_xWestFontSizeLB.get(); - sFontName = m_xWestFontNameLB->get_active_text(); } else if (m_xEastFontNameLB.get() == &rNameBox) { - pStyleBox = m_xEastFontStyleLB.get(); pSizeBox = m_xEastFontSizeLB.get(); - sFontName = m_xEastFontNameLB->get_active_text(); } else if (m_xCTLFontNameLB.get() == &rNameBox) { - pStyleBox = m_xCTLFontStyleLB.get(); pSizeBox = m_xCTLFontSizeLB.get(); - sFontName = m_xCTLFontNameLB->get_active_text(); } else { @@ -586,8 +571,7 @@ void SvxCharNamePage::FillSizeBox_Impl(const weld::Widget& rNameBox) return; } - FontMetric _aFontMetric(pFontList->Get(sFontName, pStyleBox->get_active_text())); - pSizeBox->Fill( &_aFontMetric, pFontList ); + pSizeBox->Fill( pFontList ); } namespace @@ -695,7 +679,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp eItalic = rItem.GetValue(); bStyle = true; } - bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::DONTCARE); + bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::INVALID); switch ( eLangGrp ) { @@ -712,7 +696,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp } else bStyle = false; - bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::DONTCARE); + bStyleAvailable = bStyleAvailable && (eState >= SfxItemState::INVALID); // currently chosen font if ( bStyle && pFontItem ) @@ -808,7 +792,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp pLangBox->set_active_id(eLangType); break; } - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: break; } @@ -828,6 +812,8 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp break; } + EnableFeatureButton(*pNameBox); + // save these settings pNameBox->save_value(); pStyleBox->save_value(); @@ -1074,31 +1060,40 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp case Asian : nSlot = SID_ATTR_CHAR_CJK_LANGUAGE; break; case Ctl : nSlot = SID_ATTR_CHAR_CTL_LANGUAGE; break; } - nWhich = GetWhich( nSlot ); - pOld = GetOldItem( rSet, nSlot ); // For language list boxes acting as ComboBox, check for, add and select an // edited entry. - if (pLangBox == m_xWestFontLanguageLB.get()) + switch (pLangBox->GetEditedAndValid()) { - switch (pLangBox->GetEditedAndValid()) - { - case SvxLanguageBox::EditedAndValid::No: - ; // nothing to do - break; - case SvxLanguageBox::EditedAndValid::Valid: + case SvxLanguageBox::EditedAndValid::No: + ; // nothing to do + break; + case SvxLanguageBox::EditedAndValid::Valid: + { + SvxLanguageBox* ppBoxes[3] + = {m_xWestFontLanguageLB.get(), m_xEastFontLanguageLB.get(), m_xCTLFontLanguageLB.get()}; + SvxLanguageBox* pBox = pLangBox->SaveEditedAsEntry(ppBoxes); + if (pBox != pLangBox) { - const int nPos = pLangBox->SaveEditedAsEntry(); - if (nPos != -1) - pLangBox->set_active(nPos); + // Get item from corresponding slot. + if (pBox == m_xWestFontLanguageLB.get()) + nSlot = SID_ATTR_CHAR_LANGUAGE; + else if (pBox == m_xEastFontLanguageLB.get()) + nSlot = SID_ATTR_CHAR_CJK_LANGUAGE; + else if (pBox == m_xCTLFontLanguageLB.get()) + nSlot = SID_ATTR_CHAR_CTL_LANGUAGE; + pLangBox = pBox; } - break; - case SvxLanguageBox::EditedAndValid::Invalid: - pLangBox->set_active_id(pLangBox->get_saved_active_id()); - break; - } + } + break; + case SvxLanguageBox::EditedAndValid::Invalid: + pLangBox->set_active_id(pLangBox->get_saved_active_id()); + break; } + nWhich = GetWhich( nSlot ); + pOld = GetOldItem( rSet, nSlot ); + int nLangPos = pLangBox->get_active(); LanguageType eLangType = pLangBox->get_active_id(); @@ -1173,6 +1168,7 @@ void SvxCharNamePage::FontModifyHdl_Impl(const weld::Widget& rNameBox) { FillStyleBox_Impl(rNameBox); FillSizeBox_Impl(rNameBox); + EnableFeatureButton(rNameBox); } } @@ -1365,14 +1361,16 @@ void SvxCharEffectsPage::Initialize() SetExchangeSupport(); // HTML-Mode - const SfxPoolItem* pItem; - SfxObjectShell* pShell; - if ( SfxItemState::SET == GetItemSet().GetItemState( SID_HTML_MODE, false, &pItem ) || - ( nullptr != ( pShell = SfxObjectShell::Current() ) && - nullptr != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) ) + const SfxUInt16Item* pHtmlModeItem = GetItemSet().GetItemIfSet( SID_HTML_MODE, false ); + if ( !pHtmlModeItem) + { + if (SfxObjectShell* pShell = SfxObjectShell::Current()) + pHtmlModeItem = pShell->GetItem( SID_HTML_MODE ); + } + if (pHtmlModeItem) { - m_nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); - if ( ( m_nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON ) + sal_uInt16 nHtmlMode = pHtmlModeItem->GetValue(); + if ( ( nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON ) { //!!! hide some controls please } @@ -1409,7 +1407,7 @@ void SvxCharEffectsPage::Initialize() m_xOutlineBtn->connect_toggled(LINK(this, SvxCharEffectsPage, OutlineBtnClickHdl)); m_xShadowBtn->connect_toggled(LINK(this, SvxCharEffectsPage, ShadowBtnClickHdl)); - if ( !SvtLanguageOptions().IsAsianTypographyEnabled() ) + if ( !SvtCJKOptions::IsAsianTypographyEnabled() ) { m_xEmphasisFT->hide(); m_xEmphasisLB->hide(); @@ -1524,7 +1522,7 @@ void SvxCharEffectsPage::ResetColor_Impl( const SfxItemSet& rSet ) m_xFontColorLB->set_sensitive(false); break; - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: //Related: tdf#106080 if there is no font color, then allow "none" //as a color so the listbox can display that state. EnableNoneFontColor(); @@ -1574,28 +1572,31 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet ) sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR ); const SfxItemSet& rOldSet = GetItemSet(); - Color aSelectedColor; + NamedColor aSelectedColor; bool bChanged = m_bNewFontColor; if (bChanged) { - aSelectedColor = m_xFontColorLB->GetSelectEntryColor(); + aSelectedColor = m_xFontColorLB->GetSelectedEntryThemedColor(); if (m_xFontTransparencyMtr->get_value_changed_from_saved()) { double fTransparency = m_xFontTransparencyMtr->get_value(FieldUnit::PERCENT) * 255.0 / 100; - aSelectedColor.SetAlpha(255 - static_cast<sal_uInt8>(basegfx::fround(fTransparency))); + aSelectedColor.m_aColor.SetAlpha(255 - static_cast<sal_uInt8>(basegfx::fround(fTransparency))); } if (m_bOrigFontColor) - bChanged = aSelectedColor != m_aOrigFontColor; - if (m_bEnableNoneFontColor && bChanged && aSelectedColor == COL_NONE_COLOR) + bChanged = aSelectedColor.m_aColor != m_aOrigFontColor; + if (m_bEnableNoneFontColor && bChanged && aSelectedColor.m_aColor == COL_NONE_COLOR) bChanged = false; } if (bChanged) - rSet.Put( SvxColorItem( aSelectedColor, nWhich ) ); + { + SvxColorItem aItem(aSelectedColor.m_aColor, aSelectedColor.getComplexColor(), nWhich); + rSet.Put(aItem); + } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) rSet.InvalidateItem(nWhich); @@ -1688,9 +1689,9 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xUnderlineLB->set_active( 0 ); SfxItemState eState = rSet->GetItemState( nWhich ); - if ( eState >= SfxItemState::DONTCARE ) + if ( eState >= SfxItemState::INVALID ) { - if ( eState == SfxItemState::DONTCARE ) + if ( eState == SfxItemState::INVALID ) m_xUnderlineLB->set_active(-1); else { @@ -1728,9 +1729,9 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xOverlineLB->set_active( 0 ); eState = rSet->GetItemState( nWhich ); - if ( eState >= SfxItemState::DONTCARE ) + if ( eState >= SfxItemState::INVALID ) { - if ( eState == SfxItemState::DONTCARE ) + if ( eState == SfxItemState::INVALID ) m_xOverlineLB->set_active(-1); else { @@ -1768,9 +1769,9 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xStrikeoutLB->set_active( 0 ); eState = rSet->GetItemState( nWhich ); - if ( eState >= SfxItemState::DONTCARE ) + if ( eState >= SfxItemState::INVALID ) { - if ( eState == SfxItemState::DONTCARE ) + if ( eState == SfxItemState::INVALID ) m_xStrikeoutLB->set_active(-1); else { @@ -1808,7 +1809,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xIndividualWordsBtn->set_sensitive(false); break; - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: m_aIndividualWordsState.bTriStateEnabled = true; m_xIndividualWordsBtn->set_state( TRISTATE_INDET ); break; @@ -1850,7 +1851,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) if (nPos != -1) m_xPositionLB->set_active(nPos); } - else if ( eState == SfxItemState::DONTCARE ) + else if ( eState == SfxItemState::INVALID ) m_xEmphasisLB->set_active(-1); else if ( eState == SfxItemState::UNKNOWN ) { @@ -1885,7 +1886,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xEffectsLB->set_sensitive(false); break; - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: m_xEffectsLB->set_active(-1); break; @@ -1914,7 +1915,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xReliefLB->set_sensitive(false); break; - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: m_xReliefLB->set_active(-1); break; @@ -1943,7 +1944,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xOutlineBtn->set_sensitive(false); break; - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: m_aOutlineState.bTriStateEnabled = true; m_xOutlineBtn->set_state(TRISTATE_INDET); break; @@ -1974,7 +1975,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xShadowBtn->set_sensitive(false); break; - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: m_aShadowState.bTriStateEnabled = true; m_xShadowBtn->set_state( TRISTATE_INDET ); break; @@ -2005,7 +2006,7 @@ void SvxCharEffectsPage::Reset( const SfxItemSet* rSet ) m_xHiddenBtn->set_sensitive(false); break; - case SfxItemState::DONTCARE: + case SfxItemState::INVALID: m_aHiddenState.bTriStateEnabled = true; m_xHiddenBtn->set_state(TRISTATE_INDET); break; @@ -2082,21 +2083,26 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) //! item-state in the 'rOldSet' will be invalid. In this case //! changing the underline style will be allowed if a style is //! selected in the listbox. - bool bAllowChg = nPos != -1 && + bool bAllowChange = nPos != -1 && SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich ); const SvxUnderlineItem& rItem = *static_cast<const SvxUnderlineItem*>(pOld); - if ( rItem.GetValue() == eUnder && - ( LINESTYLE_NONE == eUnder || rItem.GetColor() == m_xUnderlineColorLB->GetSelectEntryColor() ) && - ! bAllowChg ) + if (rItem.GetValue() == eUnder && + (LINESTYLE_NONE == eUnder || (rItem.GetColor() == m_xUnderlineColorLB->GetSelectEntryColor() && + rItem.getComplexColor() == m_xUnderlineColorLB->GetSelectedEntry().getComplexColor())) && + !bAllowChange) + { bChanged = false; + } } if ( bChanged ) { SvxUnderlineItem aNewItem( eUnder, nWhich ); - aNewItem.SetColor( m_xUnderlineColorLB->GetSelectEntryColor() ); - rSet->Put( aNewItem ); + auto aNamedColor = m_xUnderlineColorLB->GetSelectedEntry(); + aNewItem.SetColor(aNamedColor.m_aColor); + aNewItem.setComplexColor(aNamedColor.getComplexColor()); + rSet->Put(aNewItem); bModified = true; } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) @@ -2116,21 +2122,26 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) //! item-state in the 'rOldSet' will be invalid. In this case //! changing the underline style will be allowed if a style is //! selected in the listbox. - bool bAllowChg = nPos != -1 && + bool bAllowChange = nPos != -1 && SfxItemState::DEFAULT > rOldSet.GetItemState( nWhich ); const SvxOverlineItem& rItem = *static_cast<const SvxOverlineItem*>(pOld); - if ( rItem.GetValue() == eOver && - ( LINESTYLE_NONE == eOver || rItem.GetColor() == m_xOverlineColorLB->GetSelectEntryColor() ) && - ! bAllowChg ) + if (rItem.GetValue() == eOver && + (LINESTYLE_NONE == eOver || (rItem.GetColor() == m_xOverlineColorLB->GetSelectEntryColor() && + rItem.getComplexColor() == m_xOverlineColorLB->GetSelectedEntry().getComplexColor())) && + !bAllowChange) + { bChanged = false; + } } if ( bChanged ) { SvxOverlineItem aNewItem( eOver, nWhich ); - aNewItem.SetColor( m_xOverlineColorLB->GetSelectEntryColor() ); - rSet->Put( aNewItem ); + auto aNamedColor = m_xOverlineColorLB->GetSelectedEntry(); + aNewItem.SetColor(aNamedColor.m_aColor); + aNewItem.setComplexColor(aNamedColor.getComplexColor()); + rSet->Put(aNewItem); bModified = true; } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) @@ -2212,7 +2223,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) if ( pOld ) { - if( rOldSet.GetItemState( nWhich ) != SfxItemState::DONTCARE ) + if( rOldSet.GetItemState( nWhich ) != SfxItemState::INVALID ) { const SvxEmphasisMarkItem& rItem = *static_cast<const SvxEmphasisMarkItem*>(pOld); if ( rItem.GetEmphasisMark() == eMark ) @@ -2220,7 +2231,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) } } - if (rOldSet.GetItemState( nWhich ) == SfxItemState::DONTCARE && + if (rOldSet.GetItemState( nWhich ) == SfxItemState::INVALID && m_xEmphasisLB->get_saved_value() == sMarkPos && m_xPositionLB->get_saved_value() == sPosPos) { bChanged = false; @@ -2228,7 +2239,7 @@ bool SvxCharEffectsPage::FillItemSet( SfxItemSet* rSet ) if (bChanged) { - rSet->Put( SvxEmphasisMarkItem( eMark, nWhich ) ); + rSet->Put( SvxEmphasisMarkItem( eMark, TypedWhichId<SvxEmphasisMarkItem>(nWhich) ) ); bModified = true; } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) @@ -2379,10 +2390,7 @@ void SvxCharEffectsPage::PageCreated(const SfxAllItemSet& aSet) if (pDisableCtlItem) DisableControls(pDisableCtlItem->GetValue()); - if (!pFlagItem) - return; - - sal_uInt32 nFlags=pFlagItem->GetValue(); + sal_uInt32 nFlags = pFlagItem ? pFlagItem->GetValue() : 0; if ( ( nFlags & SVX_PREVIEW_CHARACTER ) == SVX_PREVIEW_CHARACTER ) // the writer uses SID_ATTR_BRUSH as font background m_bPreviewBackgroundToCharacter = true; @@ -2422,6 +2430,7 @@ SvxCharPositionPage::SvxCharPositionPage(weld::Container* pPage, weld::DialogCon , m_xScaleWidthMF(m_xBuilder->weld_metric_spin_button("scalewidthsb", FieldUnit::PERCENT)) , m_xKerningMF(m_xBuilder->weld_metric_spin_button("kerningsb", FieldUnit::POINT)) , m_xPairKerningBtn(m_xBuilder->weld_check_button("pairkerning")) + , m_xNoHyphenationBtn(m_xBuilder->weld_check_button("nohyphenation")) { m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin)); #ifdef IOS @@ -2575,7 +2584,8 @@ IMPL_LINK_NOARG(SvxCharPositionPage, FitToLineHdl_Impl, weld::Toggleable&, void) IMPL_LINK_NOARG(SvxCharPositionPage, KerningModifyHdl_Impl, weld::MetricSpinButton&, void) { tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_value(FieldUnit::POINT)); - nVal = OutputDevice::LogicToLogic( nVal, MapUnit::MapPoint, MapUnit::MapTwip ); + nVal = o3tl::convert(nVal, o3tl::Length::pt, o3tl::Length::twip); + tools::Long nKern = static_cast<short>(m_xKerningMF->denormalize(nVal)); SvxFont& rFont = GetPreviewFont(); @@ -2636,10 +2646,10 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) if ( !sUser.isEmpty() ) { sal_Int32 nIdx {0}; - m_nSuperEsc = static_cast<short>(sUser.getToken( 0, ';', nIdx ).toInt32()); - m_nSubEsc = static_cast<short>(sUser.getToken( 0, ';', nIdx ).toInt32()); - m_nSuperProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx ).toInt32()); - m_nSubProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx ).toInt32()); + m_nSuperEsc = static_cast<short>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx ))); + m_nSubEsc = static_cast<short>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx ))); + m_nSuperProp = static_cast<sal_uInt8>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx ))); + m_nSubProp = static_cast<sal_uInt8>(o3tl::toInt32(o3tl::getToken(sUser, 0, ';', nIdx ))); m_xHighLowMF->set_max(MAX_ESC_POS, FieldUnit::PERCENT); @@ -2740,6 +2750,8 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) m_xHighPosBtn->set_active(false); m_xNormalPosBtn->set_active(false); m_xLowPosBtn->set_active(false); + + m_xHighLowRB->set_active(true); } // set BspFont @@ -2761,10 +2773,13 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) rCJKFont.SetFixKerning( static_cast<short>(nKern) ); rCTLFont.SetFixKerning( static_cast<short>(nKern) ); - //the attribute value must be displayed also if it's above the maximum allowed value + //the attribute value must be displayed also if it's above/below the maximum allowed value tools::Long nVal = static_cast<tools::Long>(m_xKerningMF->get_max(FieldUnit::POINT)); if(nVal < nKerning) m_xKerningMF->set_max(nKerning, FieldUnit::POINT); + nVal = static_cast<tools::Long>(m_xKerningMF->get_min(FieldUnit::POINT)); + if (nVal > nKerning) + m_xKerningMF->set_min(nKerning, FieldUnit::POINT); m_xKerningMF->set_value(nKerning, FieldUnit::POINT); } else @@ -2781,6 +2796,16 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) else m_xPairKerningBtn->set_active(false); + // No hyphenation + nWhich = GetWhich( sal_uInt16(19) ); // number borrowed from RES_CHRATR_NOHYPHEN + if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT ) + { + const SvxNoHyphenItem& rItem = static_cast<const SvxNoHyphenItem&>(rSet->Get( nWhich )); + m_xNoHyphenationBtn->set_active(rItem.GetValue()); + } + else + m_xNoHyphenationBtn->set_active(false); + // Scale Width nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT ) @@ -2792,9 +2817,8 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) else m_xScaleWidthMF->set_value(100, FieldUnit::PERCENT); - nWhich = GetWhich( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ); - if ( rSet->GetItemState( nWhich ) >= SfxItemState::DEFAULT ) - m_nScaleWidthItemSetVal = static_cast<const SfxUInt16Item&>( rSet->Get( nWhich )).GetValue(); + if ( rSet->GetItemState( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) >= SfxItemState::DEFAULT ) + m_nScaleWidthItemSetVal = rSet->Get( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ).GetValue(); // Rotation nWhich = GetWhich( SID_ATTR_CHAR_ROTATED ); @@ -2828,7 +2852,7 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) } else { - if( eState == SfxItemState::DONTCARE ) + if( eState == SfxItemState::INVALID ) { m_x0degRB->set_active(false); m_x90degRB->set_active(false); @@ -2842,8 +2866,8 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet ) m_xFitToLineCB->set_sensitive(!m_x0degRB->get_active()); // is this value set? - if( SfxItemState::UNKNOWN == rSet->GetItemState( GetWhich( - SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ) )) + if( SfxItemState::UNKNOWN == rSet->GetItemState( + SID_ATTR_CHAR_WIDTH_FIT_TO_LINE )) m_xFitToLineCB->hide(); } ChangesApplied(); @@ -2862,6 +2886,7 @@ void SvxCharPositionPage::ChangesApplied() m_xScaleWidthMF->save_value(); m_xKerningMF->save_value(); m_xPairKerningBtn->save_state(); + m_xNoHyphenationBtn->save_state(); } bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) @@ -2951,11 +2976,23 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) rSet->InvalidateItem(nWhich); + // No hyphenation + + nWhich = GetWhich( sal_uInt16(19) ); // number borrowed from RES_CHRATR_NOHYPHEN + + if (m_xNoHyphenationBtn->get_state_changed_from_saved()) + { + rSet->Put( SvxNoHyphenItem( m_xNoHyphenationBtn->get_active(), nWhich ) ); + bModified = true; + } + else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) + rSet->InvalidateItem(nWhich); + // Scale Width nWhich = GetWhich( SID_ATTR_CHAR_SCALEWIDTH ); if (m_xScaleWidthMF->get_value_changed_from_saved()) { - rSet->Put(SvxCharScaleWidthItem(static_cast<sal_uInt16>(m_xScaleWidthMF->get_value(FieldUnit::PERCENT)), nWhich)); + rSet->Put(SvxCharScaleWidthItem(static_cast<sal_uInt16>(m_xScaleWidthMF->get_value(FieldUnit::PERCENT)), TypedWhichId<SvxCharScaleWidthItem>(nWhich))); bModified = true; } else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) ) @@ -2968,7 +3005,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) m_x270degRB->get_state_changed_from_saved() || m_xFitToLineCB->get_state_changed_from_saved() ) { - SvxCharRotateItem aItem( 0_deg10, m_xFitToLineCB->get_active(), nWhich ); + SvxCharRotateItem aItem( 0_deg10, m_xFitToLineCB->get_active(), TypedWhichId<SvxCharRotateItem>(nWhich) ); if (m_x90degRB->get_active()) aItem.SetBottomToTop(); else if (m_x270degRB->get_active()) @@ -2985,7 +3022,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet ) void SvxCharPositionPage::FillUserData() { - static const OUStringLiteral cTok( u";" ); + static constexpr OUString cTok( u";"_ustr ); OUString sUser = OUString::number( m_nSuperEsc ) + cTok + OUString::number( m_nSubEsc ) + cTok + @@ -3017,9 +3054,9 @@ SvxCharTwoLinesPage::SvxCharTwoLinesPage(weld::Container* pPage, weld::DialogCon , m_xStartBracketLB(m_xBuilder->weld_tree_view("startbracket")) , m_xEndBracketLB(m_xBuilder->weld_tree_view("endbracket")) { - for (size_t i = 0; i < SAL_N_ELEMENTS(TWOLINE_OPEN); ++i) + for (size_t i = 0; i < std::size(TWOLINE_OPEN); ++i) m_xStartBracketLB->append(OUString::number(TWOLINE_OPEN[i].second), CuiResId(TWOLINE_OPEN[i].first)); - for (size_t i = 0; i < SAL_N_ELEMENTS(TWOLINE_CLOSE); ++i) + for (size_t i = 0; i < std::size(TWOLINE_CLOSE); ++i) m_xEndBracketLB->append(OUString::number(TWOLINE_CLOSE[i].second), CuiResId(TWOLINE_CLOSE[i].first)); m_xPreviewWin.reset(new weld::CustomWeld(*m_xBuilder, "preview", m_aPreviewWin)); @@ -3153,7 +3190,7 @@ void SvxCharTwoLinesPage::Reset( const SfxItemSet* rSet ) sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_TWO_LINES ); SfxItemState eState = rSet->GetItemState( nWhich ); - if ( eState >= SfxItemState::DONTCARE ) + if ( eState >= SfxItemState::INVALID ) { const SvxTwoLinesItem& rItem = static_cast<const SvxTwoLinesItem&>(rSet->Get( nWhich )); m_xTwoLinesBtn->set_active(rItem.GetValue()); |