summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-01-23 16:06:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-13 21:00:33 +0100
commit6c9b376b2dc9007f1cb48a189f3020a1b82937fd (patch)
tree347618eeddf60bc3444370c5eed392dd8d4ec814
parent0061af795047deb92c4b43ec191ad6ffd97d0b64 (diff)
Resolves: #i121532# unified getting the blended selection color
(cherry picked from commit dd4bed5d1151db2a45dbbfe9eff61875f8f4835d) Conflicts: svtools/inc/svtools/optionsdrawinglayer.hxx svtools/source/config/optionsdrawinglayer.cxx sw/source/core/crsr/viscrs.cxx Change-Id: I21167b58a9b81f5fa15c7def5fb4b6023f91f32b
-rw-r--r--include/svtools/optionsdrawinglayer.hxx5
-rw-r--r--sc/source/ui/view/gridwin.cxx20
-rw-r--r--svtools/source/config/optionsdrawinglayer.cxx21
-rw-r--r--sw/source/core/crsr/viscrs.cxx21
4 files changed, 30 insertions, 37 deletions
diff --git a/include/svtools/optionsdrawinglayer.hxx b/include/svtools/optionsdrawinglayer.hxx
index f2d493be21de..b51b086b99ca 100644
--- a/include/svtools/optionsdrawinglayer.hxx
+++ b/include/svtools/optionsdrawinglayer.hxx
@@ -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 );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 4a5c9b522947..244a7319ad3d 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -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,
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index 025a2bc4e92c..31a84c28e4e6 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -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>{};
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 7c2d1de09c98..dc52c9b21a40 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -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(