Author: alg
Date: Wed Jan 23 17:06:22 2013
New Revision: 1437574

URL: http://svn.apache.org/viewvc?rev=1437574&view=rev
Log:
#121532# unified getting the blended selection color

Modified:
    openoffice/trunk/main/sc/source/ui/view/gridwin.cxx
    openoffice/trunk/main/svtools/inc/svtools/optionsdrawinglayer.hxx
    openoffice/trunk/main/svtools/source/config/optionsdrawinglayer.cxx
    openoffice/trunk/main/sw/source/core/crsr/viscrs.cxx

Modified: openoffice/trunk/main/sc/source/ui/view/gridwin.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/view/gridwin.cxx?rev=1437574&r1=1437573&r2=1437574&view=diff
==============================================================================
--- openoffice/trunk/main/sc/source/ui/view/gridwin.cxx (original)
+++ openoffice/trunk/main/sc/source/ui/view/gridwin.cxx Wed Jan 23 17:06:22 2013
@@ -5344,25 +5344,9 @@ void ScGridWindow::UpdateSelectionOverla
                                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());
-                       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);
-            }
+            // get the system's hilight color
+            const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+            const Color aHighlight(aSvtOptionsDrawinglayer.getHilightColor());
 
                        sdr::overlay::OverlayObject* pOverlay = new 
sdr::overlay::OverlaySelection(
                                sdr::overlay::OVERLAY_TRANSPARENT, 

Modified: openoffice/trunk/main/svtools/inc/svtools/optionsdrawinglayer.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svtools/inc/svtools/optionsdrawinglayer.hxx?rev=1437574&r1=1437573&r2=1437574&view=diff
==============================================================================
--- openoffice/trunk/main/svtools/inc/svtools/optionsdrawinglayer.hxx (original)
+++ openoffice/trunk/main/svtools/inc/svtools/optionsdrawinglayer.hxx Wed Jan 
23 17:06:22 2013
@@ -188,6 +188,11 @@ class SVT_DLLPUBLIC SvtOptionsDrawinglay
                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 );
                void            SetSelectionMaximumLuminancePercent( sal_uInt16 
nPercent );

Modified: openoffice/trunk/main/svtools/source/config/optionsdrawinglayer.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/svtools/source/config/optionsdrawinglayer.cxx?rev=1437574&r1=1437573&r2=1437574&view=diff
==============================================================================
--- openoffice/trunk/main/svtools/source/config/optionsdrawinglayer.cxx 
(original)
+++ openoffice/trunk/main/svtools/source/config/optionsdrawinglayer.cxx Wed Jan 
23 17:06:22 2013
@@ -1667,6 +1667,27 @@ sal_uInt16 SvtOptionsDrawinglayer::GetSe
        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;
+}
+
 void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 
nPercent )
 {
     MutexGuard aGuard( GetOwnStaticMutex() );

Modified: openoffice/trunk/main/sw/source/core/crsr/viscrs.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/viscrs.cxx?rev=1437574&r1=1437573&r2=1437574&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/viscrs.cxx (original)
+++ openoffice/trunk/main/sw/source/core/crsr/viscrs.cxx Wed Jan 23 17:06:22 
2013
@@ -591,26 +591,9 @@ void SwSelPaintRects::Show()
 
                        if(pTargetOverlay)
                        {
-                // #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
-                const OutputDevice *pOut = Application::GetDefaultDevice();
-                           Color 
aHighlight(pOut->GetSettings().GetStyleSettings().GetHighlightColor());
-                           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);
-                }
+                // get the system's hilight color
+                const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+                const Color 
aHighlight(aSvtOptionsDrawinglayer.getHilightColor());
 
                                // create correct selection
                                mpCursorOverlay = new 
sdr::overlay::OverlaySelection(


Reply via email to