summaryrefslogtreecommitdiffstats
path: root/cui/source/tabpages/chardlg.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/tabpages/chardlg.cxx')
-rw-r--r--cui/source/tabpages/chardlg.cxx361
1 files changed, 193 insertions, 168 deletions
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index 86e29f9d16c0..cd6965375003 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -41,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>
@@ -62,6 +63,7 @@
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <o3tl/unit_conversion.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::com::sun::star;
@@ -131,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 )
{
@@ -189,28 +191,41 @@ 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_xLangNotebook(m_xBuilder->weld_notebook("notebook"))
- , 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_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"))
- , m_xVDev(*Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::DEFAULT)
+ // 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
@@ -218,54 +233,30 @@ SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController*
#endif
m_pImpl->m_aNoStyleText = CuiResId( RID_CUISTR_CHARNAME_NOSTYLE );
- SvtCTLOptions aCTLLanguageOptions;
- bool bShowCJK = SvtCJKOptions::IsCJKFontEnabled();
- bool bShowCTL = aCTLLanguageOptions.IsCTLFontEnabled();
- bool bShowNonWestern = bShowCJK || bShowCTL;
-
- 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
@@ -279,8 +270,8 @@ SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController*
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_CUISTR_CHARNAME_TYPEFACE));
@@ -291,18 +282,17 @@ SvxCharNamePage::SvxCharNamePage(weld::Container* pPage, weld::DialogController*
m_xEastFontStyleFT->set_label(sFontStyleString);
m_xCTLFontStyleFT->set_label(sFontStyleString);
- m_xWestFrame->show();
- if (!bShowCJK)
- m_xLangNotebook->remove_page("lbAsian");
- if (!bShowCTL)
- m_xLangNotebook->remove_page("lbComplex");
-
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();
}
@@ -354,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 )
@@ -691,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 )
{
@@ -708,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 )
@@ -804,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;
}
@@ -1072,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();
@@ -1364,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)
{
- m_nHtmlMode = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
- if ( ( m_nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON )
+ if (SfxObjectShell* pShell = SfxObjectShell::Current())
+ pHtmlModeItem = pShell->GetItem( SID_HTML_MODE );
+ }
+ if (pHtmlModeItem)
+ {
+ sal_uInt16 nHtmlMode = pHtmlModeItem->GetValue();
+ if ( ( nHtmlMode & HTMLMODE_ON ) == HTMLMODE_ON )
{
//!!! hide some controls please
}
@@ -1523,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();
@@ -1573,7 +1572,7 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
sal_uInt16 nWhich = GetWhich( SID_ATTR_CHAR_COLOR );
const SfxItemSet& rOldSet = GetItemSet();
- svx::NamedThemedColor aSelectedColor;
+ NamedColor aSelectedColor;
bool bChanged = m_bNewFontColor;
if (bChanged)
@@ -1595,16 +1594,7 @@ bool SvxCharEffectsPage::FillItemSetColor_Impl( SfxItemSet& rSet )
if (bChanged)
{
- SvxColorItem aItem( aSelectedColor.m_aColor, nWhich );
-
- if (aSelectedColor.m_nThemeIndex != -1)
- {
- // The color was picked from the theme palette, remember its index.
- aItem.SetThemeIndex(aSelectedColor.m_nThemeIndex);
- aItem.SetLumMod(aSelectedColor.m_nLumMod);
- aItem.SetLumOff(aSelectedColor.m_nLumOff);
- }
-
+ SvxColorItem aItem(aSelectedColor.m_aColor, aSelectedColor.getComplexColor(), nWhich);
rSet.Put(aItem);
}
else if ( SfxItemState::DEFAULT == rOldSet.GetItemState( nWhich, false ) )
@@ -1699,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
{
@@ -1739,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
{
@@ -1779,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
{
@@ -1819,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;
@@ -1861,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 )
{
@@ -1896,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;
@@ -1925,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;
@@ -1954,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;
@@ -1985,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;
@@ -2016,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;
@@ -2093,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 ) )
@@ -2127,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 ) )
@@ -2223,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 )
@@ -2231,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;
@@ -2239,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 ) )
@@ -2390,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;
@@ -2433,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
@@ -2648,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);
@@ -2752,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
@@ -2773,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
@@ -2793,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 )
@@ -2804,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 );
@@ -2840,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);
@@ -2854,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();
@@ -2874,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 )
@@ -2963,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 ) )
@@ -2980,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())
@@ -2997,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 +
@@ -3029,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));
@@ -3165,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());