[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - 2 commits - sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Apr 12 11:56:34 UTC 2016


 sc/source/filter/oox/condformatbuffer.cxx |   31 +++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

New commits:
commit 883326c3e175a53a567a32806f77489c8f942d40
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 9 08:16:01 2016 +0200

    use the better color import method also for databars, tdf#98554
    
    Ideally we would move some of the magic here into the ThemeBuffer class
    but this requires a lot more test cases.
    
    Change-Id: I29adadda6b40cd1863ad3d68554acf7f27c57900
    Reviewed-on: https://gerrit.libreoffice.org/23945
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index da8dad6..98f654f 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -275,27 +275,9 @@ DataBarRule::DataBarRule( const CondFormat& rFormat ):
 
 void DataBarRule::importColor( const AttributeList& rAttribs )
 {
-    sal_uInt32 nColor = 0;
-    if( rAttribs.hasAttribute( XML_rgb ) )
-        nColor = rAttribs.getUnsignedHex( XML_rgb, UNSIGNED_RGB_TRANSPARENT );
-    else if( rAttribs.hasAttribute( XML_theme ) )
-    {
-        sal_uInt32 nThemeIndex = rAttribs.getUnsigned( XML_theme, 0 );
-        nColor = getTheme().getColorByIndex( nThemeIndex );
-    }
-
-    ::Color aColor;
-    double nTint = rAttribs.getDouble(XML_tint, 0.0);
-    if (nTint != 0.0)
-    {
-        oox::drawingml::Color aDMColor;
-        aDMColor.setSrgbClr(nColor);
-        aDMColor.addExcelTintTransformation(nTint);
-        nColor = aDMColor.getColor(getBaseFilter().getGraphicHelper());
-        aColor = ::Color(nColor);
-    }
-    else
-        aColor = ARgbToARgbComponents( nColor );
+    ThemeBuffer& rThemeBuffer = getTheme();
+    GraphicHelper& rGraphicHelper = getBaseFilter().getGraphicHelper();
+    ::Color aColor = importOOXColor(rAttribs, rThemeBuffer, rGraphicHelper);
 
     mxFormat->maPositiveColor = aColor;
 }
commit 8cb85d3605451739f09eb1733faefce26f894cef
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 9 07:51:31 2016 +0200

    work around Excel theme color bug, tdf#98554
    
    Change-Id: Id0cd37b37394a0759ee6ffccafd8def719c14312
    (cherry picked from commit 5639909d59b158708305ce3b2e6afe3760032e84)
    Reviewed-on: https://gerrit.libreoffice.org/23944
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 4ab87ed..da8dad6 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -182,14 +182,17 @@ namespace {
     {
         sal_uInt32 nThemeIndex = rAttribs.getUnsigned( XML_theme, 0 );
 
-        // looks like an Excel bug
+        // Excel has a bug in the mapping of index 0, 1, 2 and 3.
         if (nThemeIndex == 0)
             nThemeIndex = 1;
         else if (nThemeIndex == 1)
             nThemeIndex = 0;
+        else if (nThemeIndex == 2)
+            nThemeIndex = 3;
+        else if (nThemeIndex == 3)
+            nThemeIndex = 2;
 
         nColor = rThemeBuffer.getColorByIndex( nThemeIndex );
-
     }
 
     ::Color aColor;


More information about the Libreoffice-commits mailing list