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

Bartosz Kosiorek gang65 at poczta.onet.pl
Tue Nov 28 18:48:35 UTC 2017


 sc/source/filter/oox/stylesbuffer.cxx |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 3278c8f9bb040cddd15d9e7eb4991d0447cbc964
Author: Bartosz Kosiorek <gang65 at poczta.onet.pl>
Date:   Sat Nov 25 09:51:58 2017 +0100

    tdf#113271 Fix order of color's attributes import.
    
    The order of import color is very important in case of more than one color attributes was provided.
    This order (theme -> rgb -> indexed -> auto) is not documented
    and was gathered experimentally based on MS Excel 2013.
    
    Information about <fonts>:
    https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.fonts(v=office.14).aspx
    
    Information about font:
    https://msdn.microsoft.com/en-us/library/ff531892(v=office.12).aspx
    https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.font(v=office.14).aspx
    
    More information about color class:
    https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.color(v=office.14).aspx
    https://msdn.microsoft.com/en-us/library/ff532831(v=office.12).aspx
    
    Example:
    With indexed auto, colour, rgb and them,
    <color auto="1" theme="1" rgb="FFFFFF" indexed="62" />
    
    The priority is as follows:
    1. theme
    2. rgb
    3. indexed
    4. auto
    
    Change-Id: I7bb5ab7d7b7a52091f0130fd6f21bac44eca7408
    Reviewed-on: https://gerrit.libreoffice.org/45278
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 25fca16c643e..2711df0ad34f 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -266,14 +266,16 @@ void Color::setIndexed( sal_Int32 nPaletteIdx, double fTint )
 
 void Color::importColor( const AttributeList& rAttribs )
 {
-    if( rAttribs.getBool( XML_auto, false ) )
-        setAuto();
+    // tdf#113271 The order of import color is very important in case of more than one color attributes was provided.
+    // This order (theme -> rgb -> indexed -> auto) is not documented and was gathered experimentally based on MS Excel 2013.
+    if( rAttribs.hasAttribute( XML_theme ) )
+        setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( XML_tint, 0.0 ) );
     else if( rAttribs.hasAttribute( XML_rgb ) )
         setRgb( rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ), rAttribs.getDouble( XML_tint, 0.0 ) );
-    else if( rAttribs.hasAttribute( XML_theme ) )
-        setTheme( rAttribs.getInteger( XML_theme, -1 ), rAttribs.getDouble( XML_tint, 0.0 ) );
     else if( rAttribs.hasAttribute( XML_indexed ) )
         setIndexed( rAttribs.getInteger( XML_indexed, -1 ), rAttribs.getDouble( XML_tint, 0.0 ) );
+    else if( rAttribs.getBool( XML_auto, false ) )
+        setAuto();
     else
     {
         OSL_FAIL( "Color::importColor - unknown color type" );


More information about the Libreoffice-commits mailing list