summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-22 12:24:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-22 15:20:00 +0200
commit804dac9222fdf6e423993ac348a43e52a8f74ba3 (patch)
treee3caf234d9cc92985f15270dcd39568fa5f17c2f /svx/source
parent6753b7fbba15e631e0b300cfa48cc2d5e859a88f (diff)
tdf#93756 show highlight color in style preview
Change-Id: Ibddd97f8829d824667657177c7311680707df4e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103167 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/styles/CommonStylePreviewRenderer.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx
index 9920903df469..cd3a311dfcb0 100644
--- a/svx/source/styles/CommonStylePreviewRenderer.cxx
+++ b/svx/source/styles/CommonStylePreviewRenderer.cxx
@@ -20,6 +20,7 @@
#include <svx/xdef.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xflclit.hxx>
+#include <editeng/brushitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/charreliefitem.hxx>
@@ -47,6 +48,7 @@ CommonStylePreviewRenderer::CommonStylePreviewRenderer(
: StylePreviewRenderer(rShell, rOutputDev, pStyle, nMaxHeight)
, m_pFont()
, maFontColor(COL_AUTO)
+ , maHighlightColor(COL_AUTO)
, maBackgroundColor(COL_AUTO)
, maPixelSize()
, maStyleName(mpStyle->GetName())
@@ -112,6 +114,10 @@ bool CommonStylePreviewRenderer::recalculate()
{
maFontColor = static_cast<const SvxColorItem*>(pItem)->GetValue();
}
+ if ((pItem = pItemSet->GetItem(SID_ATTR_BRUSH_CHAR)) != nullptr)
+ {
+ maHighlightColor = static_cast<const SvxBrushItem*>(pItem)->GetColor();
+ }
if (mpStyle->GetFamily() == SfxStyleFamily::Para)
{
@@ -188,9 +194,7 @@ bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, Rend
const OUString& rText = maStyleName;
// setup the device & draw
- vcl::Font aOldFont(mrOutputDev.GetFont());
- Color aOldColor(mrOutputDev.GetTextColor());
- Color aOldFillColor(mrOutputDev.GetFillColor());
+ mrOutputDev.Push(PushFlags::FONT | PushFlags::TEXTCOLOR | PushFlags::FILLCOLOR | PushFlags::TEXTFILLCOLOR);
if (maBackgroundColor != COL_AUTO)
{
@@ -199,12 +203,14 @@ bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, Rend
}
if (m_pFont)
- {
mrOutputDev.SetFont(*m_pFont);
- }
+
if (maFontColor != COL_AUTO)
mrOutputDev.SetTextColor(maFontColor);
+ if (maHighlightColor != COL_AUTO)
+ mrOutputDev.SetTextFillColor(maHighlightColor);
+
Size aPixelSize(m_pFont ? maPixelSize : mrOutputDev.GetFont().GetFontSize());
Point aFontDrawPosition = aRectangle.TopLeft();
@@ -216,9 +222,7 @@ bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, Rend
mrOutputDev.DrawText(aFontDrawPosition, rText);
- mrOutputDev.SetFillColor(aOldFillColor);
- mrOutputDev.SetTextColor(aOldColor);
- mrOutputDev.SetFont(aOldFont);
+ mrOutputDev.Pop();
return true;
}