diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-05-30 21:11:28 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-06-04 18:27:45 +0200 |
commit | cc6db9f418cae422a4733163f85801c5a14f47c8 (patch) | |
tree | e86f98db456c0f5f1be50b246005c0c2cba7629b /cui | |
parent | f2b270e79016097077bd49c0ae4ac2b8762dc91b (diff) |
sw: border and background theme color support for multiple props.
This adds support for theme colors for multiple properties that
are stored in SvxBoxItem and SvxBrushItem / XFillColorItem. For
those items the ComplexColor member variable was introduced.
The UNO properties for the colors are added.
The properties with the added support includes paragraph border
and background + styles, page border and background, frame border
and background + styles.
The ThemeColorChanges has been extended to support changing the
colors for those propertes.
Color picker and tab pages have been fixed so they pass or set
the theme color properties to the items.
Change-Id: Id27272f5c4a448703a62a759d829e8a9540066e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152397
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/tabpages/border.cxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/chardlg.cxx | 34 | ||||
-rw-r--r-- | cui/source/tabpages/tpcolor.cxx | 32 |
3 files changed, 32 insertions, 38 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 9b94bc0eb28a..549ab533410a 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -1234,8 +1234,8 @@ IMPL_LINK_NOARG(SvxBorderTabPage, SelSdwHdl_Impl, ValueSet*, void) IMPL_LINK(SvxBorderTabPage, SelColHdl_Impl, ColorListBox&, rColorBox, void) { - Color aColor = rColorBox.GetSelectEntryColor(); - m_aFrameSel.SetColorToSelection(aColor); + NamedColor aNamedColor = rColorBox.GetSelectedEntry(); + m_aFrameSel.SetColorToSelection(aNamedColor.m_aColor, aNamedColor.getComplexColor()); } IMPL_LINK_NOARG(SvxBorderTabPage, ModifyWidthLBHdl_Impl, weld::ComboBox&, void) diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx index 7a8788728b46..ace220bcc5c0 100644 --- a/cui/source/tabpages/chardlg.cxx +++ b/cui/source/tabpages/chardlg.cxx @@ -2095,21 +2095,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 ) ) @@ -2129,21 +2134,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 ) ) diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 056afe822e7a..8df09ff09823 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -242,24 +242,12 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet ) sColorName = m_xValSetColorList->GetItemText( m_xValSetColorList->GetSelectedItemId() ); else sColorName = "#" + m_aCurrentColor.m_aColor.AsRGBHexString().toAsciiUpperCase(); - maPaletteManager.AddRecentColor( m_aCurrentColor.m_aColor, sColorName ); - XFillColorItem aColorItem( sColorName, m_aCurrentColor.m_aColor ); - model::ThemeColorType eType = model::convertToThemeColorType(m_aCurrentColor.m_nThemeIndex); - if (eType != model::ThemeColorType::Unknown) - { - aColorItem.getComplexColor().setSchemeColor(eType); - } - aColorItem.getComplexColor().clearTransformations(); - if (m_aCurrentColor.m_nLumMod != 10000) - { - aColorItem.getComplexColor().addTransformation({model::TransformationType::LumMod, m_aCurrentColor.m_nLumMod}); - } - if (m_aCurrentColor.m_nLumOff != 0) - { - aColorItem.getComplexColor().addTransformation({model::TransformationType::LumOff, m_aCurrentColor.m_nLumOff}); - } - rSet->Put( aColorItem ); - rSet->Put( XFillStyleItem( drawing::FillStyle_SOLID ) ); + + maPaletteManager.AddRecentColor(m_aCurrentColor.m_aColor, sColorName); + XFillColorItem aColorItem(sColorName, m_aCurrentColor.m_aColor); + aColorItem.setComplexColor(m_aCurrentColor.getComplexColor()); + rSet->Put(aColorItem); + rSet->Put(XFillStyleItem(drawing::FillStyle_SOLID)); return true; } @@ -513,14 +501,10 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void) m_aCtlPreviewNew.SetAttributes( aXFillAttr.GetItemSet() ); m_aCtlPreviewNew.Invalidate(); - bool bThemePaletteSelected = false; - if (pValSet == m_xValSetColorList.get()) - { - bThemePaletteSelected = maPaletteManager.IsThemePaletteSelected(); - } NamedColor aNamedColor; aNamedColor.m_aColor = aColor; - if (bThemePaletteSelected) + + if (pValSet == m_xValSetColorList.get() && maPaletteManager.IsThemePaletteSelected()) { sal_uInt16 nThemeIndex; sal_uInt16 nEffectIndex; |