tdf#150622 allow use of selection color for frame in HighContrast mode
Change-Id: I0a45051c9ba8bbfe785689103c6af6285a282345
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141261
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/svx/sdr/overlay/overlayobject.hxx b/include/svx/sdr/overlay/overlayobject.hxx
index d4ef566..294ceb3 100644
--- a/include/svx/sdr/overlay/overlayobject.hxx
+++ b/include/svx/sdr/overlay/overlayobject.hxx
@@ -109,6 +109,11 @@ namespace sdr::overlay
// it is switched to false
bool mbAllowsAntiAliase : 1;
// Flag to control if this OverlayObject is allowed to ignore the
// DrawMode settings which force use of colors to High Contrast fg/bg
// Default is false.
bool mbOverruleDrawModeSettings : 1;
// set changed flag. Call after change, since the old range is invalidated
// and then the new one is calculated and invalidated, too. This will only
// work after the change.
@@ -142,6 +147,9 @@ namespace sdr::overlay
// read access to AntiAliase flag
bool allowsAntiAliase() const { return mbAllowsAntiAliase; }
// read access to DrawModeSettings flag
bool overrulesDrawModeSettings() const { return mbOverruleDrawModeSettings; }
// read access to baseRange. This may trigger createBaseRange() if
// object is changed.
const basegfx::B2DRange& getBaseRange() const;
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index 3cbd821..3d501b81 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -47,6 +47,12 @@ namespace sdr::overlay
const AntialiasingFlags nOriginalAA(rDestinationDevice.GetAntialiasing());
const bool bIsAntiAliasing(SvtOptionsDrawinglayer::IsAntiAliasing());
// tdf#150622 for High Contrast we typically force colors to a single pair Fore/Back,
// but it seems reasonable to allow overlays to use the selection color
// taken from the system High Contrast settings
const DrawModeFlags nOriginalDrawMode(rDestinationDevice.GetDrawMode());
const DrawModeFlags nForceSettings = DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill |
DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient;
// create processor
std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice(
@@ -75,7 +81,20 @@ namespace sdr::overlay
rDestinationDevice.SetAntialiasing(nOriginalAA & ~AntialiasingFlags::Enable);
}
const bool bOverrulesDrawModeSettings = rCandidate.overrulesDrawModeSettings();
if (bOverrulesDrawModeSettings)
{
// overrule DrawMode settings
rDestinationDevice.SetDrawMode(nOriginalDrawMode & ~nForceSettings);
}
pProcessor->process(rSequence);
if (bOverrulesDrawModeSettings)
{
// restore DrawMode settings
rDestinationDevice.SetDrawMode(nOriginalDrawMode);
}
}
}
}
diff --git a/svx/source/sdr/overlay/overlayobject.cxx b/svx/source/sdr/overlay/overlayobject.cxx
index 4fd2279..6aab4f8 100644
--- a/svx/source/sdr/overlay/overlayobject.cxx
+++ b/svx/source/sdr/overlay/overlayobject.cxx
@@ -90,7 +90,8 @@ namespace sdr::overlay
mbIsVisible(true),
mbIsHittable(true),
mbAllowsAnimation(false),
mbAllowsAntiAliase(true)
mbAllowsAntiAliase(true),
mbOverruleDrawModeSettings(false)
{
}
diff --git a/svx/source/sdr/overlay/overlayrectangle.cxx b/svx/source/sdr/overlay/overlayrectangle.cxx
index 617c6d4..ce9c11b 100644
--- a/svx/source/sdr/overlay/overlayrectangle.cxx
+++ b/svx/source/sdr/overlay/overlayrectangle.cxx
@@ -81,6 +81,8 @@ namespace sdr::overlay
// set AllowsAnimation flag to mark this object as animation capable
mbAllowsAnimation = bAnimate;
// allow use of selection color even in HighContrast mode
mbOverruleDrawModeSettings = true;
}
void OverlayRectangle::Trigger(sal_uInt32 nTime)
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 78e8ac0..9f3552f 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -531,6 +531,8 @@ TextEditFrameOverlayObject::TextEditFrameOverlayObject(
, mrTextEditOverlayObject(rTextEditOverlayObject)
{
allowAntiAliase(rTextEditOverlayObject.allowsAntiAliase());
// allow use of selection color even in HighContrast mode
mbOverruleDrawModeSettings = true;
}
TextEditFrameOverlayObject::~TextEditFrameOverlayObject()