summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-05-30 21:11:28 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-06-04 18:27:45 +0200
commitcc6db9f418cae422a4733163f85801c5a14f47c8 (patch)
treee86f98db456c0f5f1be50b246005c0c2cba7629b /svx
parentf2b270e79016097077bd49c0ae4ac2b8762dc91b (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 'svx')
-rw-r--r--svx/source/dialog/frmsel.cxx6
-rw-r--r--svx/source/unodraw/unobrushitemhelper.cxx15
2 files changed, 14 insertions, 7 deletions
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index fed0d59d0d6d..31dce82e0a84 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -1025,9 +1025,11 @@ void FrameSelector::SetStyleToSelection( tools::Long nWidth, SvxBorderLineStyle
mxImpl->SetBorderState( **aIt, FrameBorderState::Show );
}
-void FrameSelector::SetColorToSelection( const Color& rColor )
+void FrameSelector::SetColorToSelection(const Color& rColor, model::ComplexColor const& rComplexColor)
{
- mxImpl->maCurrStyle.SetColor( rColor );
+ mxImpl->maCurrStyle.SetColor(rColor);
+ mxImpl->maCurrStyle.setComplexColor(rComplexColor);
+
for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
mxImpl->SetBorderState( **aIt, FrameBorderState::Show );
}
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx
index 65d80cf282ca..ff475e8b7077 100644
--- a/svx/source/unodraw/unobrushitemhelper.cxx
+++ b/svx/source/unodraw/unobrushitemhelper.cxx
@@ -124,7 +124,9 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI
const Color aColor(rBrush.GetColor().GetRGBColor());
rToSet.Put(XFillStyleItem(drawing::FillStyle_SOLID));
- rToSet.Put(XFillColorItem(OUString(), aColor));
+ XFillColorItem aFillColorItem(OUString(), aColor);
+ aFillColorItem.setComplexColor(rBrush.getComplexColor());
+ rToSet.Put(aFillColorItem);
// #125189# nTransparency is in range [0..254], convert to [0..100] which is used in
// XFillTransparenceItem (caution with the range which is in an *item-specific* range)
@@ -141,10 +143,11 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI
// is needed when e.g. first transparency is set to 0xff and then a Graphic gets set.
// When not changing the FillStyle, the next getSvxBrushItemFromSourceSet *will* return
// to drawing::FillStyle_SOLID with the rescued color.
- const Color aColor(rBrush.GetColor().GetRGBColor());
+ const Color aColor = rBrush.GetColor().GetRGBColor();
rToSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
- rToSet.Put(XFillColorItem(OUString(), aColor));
+ XFillColorItem aFillColorItem(OUString(), aColor);
+ rToSet.Put(aFillColorItem);
}
}
@@ -169,7 +172,9 @@ static sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, b
static std::unique_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents, sal_uInt16 nBackgroundID)
{
- Color aFillColor(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents).GetColorValue());
+ auto const& rFillColorItem = rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents);
+ model::ComplexColor aFillComplexColor = rFillColorItem.getComplexColor();
+ Color aFillColor = rFillColorItem.GetColorValue();
// get evtl. mixed transparence
const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents));
@@ -184,7 +189,7 @@ static std::unique_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& r
aFillColor.SetAlpha(255 - aTargetTrans);
}
- return std::make_unique<SvxBrushItem>(aFillColor, nBackgroundID);
+ return std::make_unique<SvxBrushItem>(aFillColor, aFillComplexColor, nBackgroundID);
}
std::unique_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack)