[Libreoffice-commits] core.git: Branch 'feature/themesupport' - 4 commits - svx/source sw/source writerfilter/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed Sep 23 05:25:09 PDT 2015


 svx/source/styles/ColorSets.cxx                  |   40 +++++++++++------------
 sw/source/uibase/sidebar/ThemePanel.cxx          |    4 +-
 writerfilter/source/dmapper/DomainMapper.cxx     |    2 -
 writerfilter/source/dmapper/TDefTableHandler.cxx |   10 ++---
 4 files changed, 28 insertions(+), 28 deletions(-)

New commits:
commit eb176615afd85fdebcecfe3ad6dacad7d585c9d7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 23 13:38:38 2015 +0200

    adjust the conversion from theme color type to the color set index
    
    Change-Id: I8c54c8935de8acc3e2b302e10327aa2488f9ac85

diff --git a/writerfilter/source/dmapper/TDefTableHandler.cxx b/writerfilter/source/dmapper/TDefTableHandler.cxx
index c3c0ce0..0f0e20f 100644
--- a/writerfilter/source/dmapper/TDefTableHandler.cxx
+++ b/writerfilter/source/dmapper/TDefTableHandler.cxx
@@ -301,15 +301,15 @@ sal_Int16 TDefTableHandler::getThemeColorTypeIndex(sal_Int32 nType)
         case NS_ooxml::LN_Value_St_ThemeColor_followedHyperlink:
                 return 11;
         case NS_ooxml::LN_Value_St_ThemeColor_none:
-                return 12;
+                return -1;
         case NS_ooxml::LN_Value_St_ThemeColor_background1:
-                return 13;
+                return 0;
         case NS_ooxml::LN_Value_St_ThemeColor_text1:
-                return 14;
+                return 1;
         case NS_ooxml::LN_Value_St_ThemeColor_background2:
-                return 15;
+                return 2;
         case NS_ooxml::LN_Value_St_ThemeColor_text2:
-                return 16;
+                return 3;
         default:
                 break;
     }
commit a93a923614ae7c1f957c81084deb0516ae5bf8bc
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 23 13:37:43 2015 +0200

    convert tint value from ooxml to the value we support
    
    Change-Id: I5a79ca434be16f9dccc5aa6118a7efbf4544f0b1

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index a98f5e1..a059e3e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -882,7 +882,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         case NS_ooxml::LN_CT_Color_themeTint:
             if (m_pImpl->GetTopContext())
             {
-                m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_TINT_OR_SHADE, uno::makeAny(sal_Int16(nIntValue * 10000 / 256)));
+                m_pImpl->GetTopContext()->Insert(PROP_CHAR_COLOR_TINT_OR_SHADE, uno::makeAny(sal_Int16((256 - nIntValue) * 10000 / 256)));
             }
             m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "themeTint", OUString::number(nIntValue, 16));
         break;
commit e828a781285d843c95a2c374bc38aa10c3aab146
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 23 13:35:56 2015 +0200

    check that the color index is valid
    
    Change-Id: Id5c7c83f50e1611af12f3b25e6c9a335a8353ba0

diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx
index 14c4436..a6db69e 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -257,9 +257,9 @@ void changeFont(SwFormat* pFormat, SwDocStyleSheet* pStyle, FontSet& rFontSet)
 void changeColor(SwTextFormatColl* pCollection, svx::ColorSet& rColorSet, StyleRedefinition* /*pRedefinition*/)
 {
     SvxColorItem aColorItem(pCollection->GetColor());
-    if (aColorItem.GetThemeIndex() >= 0)
+    sal_Int16 nIndex = aColorItem.GetThemeIndex();
+    if (nIndex >= 0 && nIndex < 12)
     {
-        sal_Int16 nIndex = aColorItem.GetThemeIndex();
         Color aColor = Color(rColorSet.getColor(nIndex));
         aColor.ApplyTintOrShade(aColorItem.GetTintOrShade());
         aColorItem.SetValue(aColor);
commit fcec4caa3d32ce76339ef8916f0d2c1e09b9600a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Sep 23 13:33:59 2015 +0200

    swap text and background colors in colorsets
    
    Change-Id: I1e1da85d6c58e3ed5ab4c44c2ab0ae7c3b080251

diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 819790a..73c1637 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -31,10 +31,10 @@ void ColorSets::init()
 {
     {
         ColorSet aColorSet("Breeze");
-        aColorSet.add(0,  0x232629);
-        aColorSet.add(1,  0xFCFCFC);
-        aColorSet.add(2,  0x31363B);
-        aColorSet.add(3,  0xEFF0F1);
+        aColorSet.add(0,  0xFCFCFC);
+        aColorSet.add(1,  0x232629);
+        aColorSet.add(2,  0xEFF0F1);
+        aColorSet.add(3,  0x31363B);
         aColorSet.add(4,  0xDA4453);
         aColorSet.add(5,  0xF47750);
         aColorSet.add(6,  0xFDBC4B);
@@ -47,10 +47,10 @@ void ColorSets::init()
     }
     {
         ColorSet aColorSet("Tango");
-        aColorSet.add(0,  0x000000);
-        aColorSet.add(1,  0xFFFFFF);
-        aColorSet.add(2,  0x2E3436);
-        aColorSet.add(3,  0xBABDB6);
+        aColorSet.add(0,  0xFFFFFF);
+        aColorSet.add(1,  0x000000);
+        aColorSet.add(2,  0xBABDB6);
+        aColorSet.add(3,  0x2E3436);
         aColorSet.add(4,  0x3465A4);
         aColorSet.add(5,  0x73D216);
         aColorSet.add(6,  0xF57900);
@@ -63,10 +63,10 @@ void ColorSets::init()
     }
     {
         ColorSet aColorSet("Material Blue");
-        aColorSet.add(0,  0x212121);
-        aColorSet.add(1,  0xFFFFFF);
-        aColorSet.add(2,  0x37474F);
-        aColorSet.add(3,  0xECEFF1);
+        aColorSet.add(0,  0xFFFFFF);
+        aColorSet.add(1,  0x212121);
+        aColorSet.add(2,  0xECEFF1);
+        aColorSet.add(3,  0x37474F);
         aColorSet.add(4,  0x7986CB);
         aColorSet.add(5,  0x303F9F);
         aColorSet.add(6,  0x64B5F6);
@@ -79,10 +79,10 @@ void ColorSets::init()
     }
     {
         ColorSet aColorSet("Material Red");
-        aColorSet.add(0,  0x212121);
-        aColorSet.add(1,  0xFFFFFF);
-        aColorSet.add(2,  0x424242);
-        aColorSet.add(3,  0xF5F5F5);
+        aColorSet.add(0,  0xFFFFFF);
+        aColorSet.add(1,  0x212121);
+        aColorSet.add(2,  0xF5F5F5);
+        aColorSet.add(3,  0x424242);
         aColorSet.add(4,  0xFF9800);
         aColorSet.add(5,  0xFF6D00);
         aColorSet.add(6,  0xFF5722);
@@ -95,10 +95,10 @@ void ColorSets::init()
     }
     {
         ColorSet aColorSet("Material Green");
-        aColorSet.add(0,  0x212121);
-        aColorSet.add(1,  0xFFFFFF);
-        aColorSet.add(2,  0x424242);
-        aColorSet.add(3,  0xF5F5F5);
+        aColorSet.add(0,  0xFFFFFF);
+        aColorSet.add(1,  0x212121);
+        aColorSet.add(2,  0xF5F5F5);
+        aColorSet.add(3,  0x424242);
         aColorSet.add(4,  0x009688);
         aColorSet.add(5,  0x00bfa5);
         aColorSet.add(6,  0x4caf50);


More information about the Libreoffice-commits mailing list