Kaydet (Commit) 6c9b376b authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Caolán McNamara

Resolves: #i121532# unified getting the blended selection color

(cherry picked from commit dd4bed5d)

Conflicts:
	svtools/inc/svtools/optionsdrawinglayer.hxx
	svtools/source/config/optionsdrawinglayer.cxx
	sw/source/core/crsr/viscrs.cxx

Change-Id: I21167b58a9b81f5fa15c7def5fb4b6023f91f32b
üst 0061af79
......@@ -151,6 +151,11 @@ class SVT_DLLPUBLIC SvtOptionsDrawinglayer
sal_uInt16 GetTransparentSelectionPercent() const;
sal_uInt16 GetSelectionMaximumLuminancePercent() const;
// get system hilight color, limited to the maximum allowed luminance
// (defined in GetSelectionMaximumLuminancePercent() in SvtOptionsDrawinglayer,
// combined with Application::GetSettings().GetStyleSettings().GetHighlightColor())
Color getHilightColor() const;
void SetTransparentSelection( sal_Bool bState );
void SetTransparentSelectionPercent( sal_uInt16 nPercent );
......
......@@ -5542,25 +5542,9 @@ void ScGridWindow::UpdateSelectionOverlay()
aRanges.push_back(aRB);
}
// #i97672# get the system's hilight color and limit it to the maximum
// allowed luminance. This is needed to react on too bright hilight colors
// which would otherwise vive a bad visualisation
Color aHighlight(GetSettings().GetStyleSettings().GetHighlightColor());
// get the system's hilight color
const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
const basegfx::BColor aSelection(aHighlight.getBColor());
const double fLuminance(aSelection.luminance());
const double fMaxLum(aSvtOptionsDrawinglayer.GetSelectionMaximumLuminancePercent() / 100.0);
if(fLuminance > fMaxLum)
{
const double fFactor(fMaxLum / fLuminance);
const basegfx::BColor aNewSelection(
aSelection.getRed() * fFactor,
aSelection.getGreen() * fFactor,
aSelection.getBlue() * fFactor);
aHighlight = Color(aNewSelection);
}
const Color aHighlight(aSvtOptionsDrawinglayer.getHilightColor());
sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
sdr::overlay::OVERLAY_TRANSPARENT,
......
......@@ -1229,6 +1229,27 @@ sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const
return aRetval;
}
Color SvtOptionsDrawinglayer::getHilightColor() const
{
Color aRetval(Application::GetSettings().GetStyleSettings().GetHighlightColor());
const basegfx::BColor aSelection(aRetval.getBColor());
const double fLuminance(aSelection.luminance());
const double fMaxLum(GetSelectionMaximumLuminancePercent() / 100.0);
if(fLuminance > fMaxLum)
{
const double fFactor(fMaxLum / fLuminance);
const basegfx::BColor aNewSelection(
aSelection.getRed() * fFactor,
aSelection.getGreen() * fFactor,
aSelection.getBlue() * fFactor);
aRetval = Color(aNewSelection);
}
return aRetval;
}
namespace
{
class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{};
......
......@@ -266,26 +266,9 @@ void SwSelPaintRects::Show()
if (xTargetOverlay.is())
{
// #i97672# get the system's highlight color and limit it to the
// maximum allowed luminance. This is needed to react on too bright
// highlight colors which would otherwise vive a bad visualisation.
const OutputDevice *pOut = Application::GetDefaultDevice();
Color aHighlight(pOut->GetSettings().GetStyleSettings().GetHighlightColor());
// get the system's hilight color
const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
const basegfx::BColor aSelection(aHighlight.getBColor());
const double fLuminance(aSelection.luminance());
const double fMaxLum(aSvtOptionsDrawinglayer.GetSelectionMaximumLuminancePercent() / 100.0);
if(fLuminance > fMaxLum)
{
const double fFactor(fMaxLum / fLuminance);
const basegfx::BColor aNewSelection(
aSelection.getRed() * fFactor,
aSelection.getGreen() * fFactor,
aSelection.getBlue() * fFactor);
aHighlight = Color(aNewSelection);
}
const Color aHighlight(aSvtOptionsDrawinglayer.getHilightColor());
// create correct selection
mpCursorOverlay = new sdr::overlay::OverlaySelection(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment