oox/source/drawingml/color.cxx           |   36 +++++++++++++++++++------------
 sc/source/ui/theme/ThemeColorChanger.cxx |   36 +++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 13 deletions(-)

New commits:
commit 95d199e3d1a04a469e1d22896ffd967c7a06c3f0
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jun 23 13:49:24 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sun Jun 25 17:35:50 2023 +0200

    sc: ThemeColorChanger - change theme color for borders
    
    Change-Id: Id6b08ad48b496d2f1138aeea8d024a5f61bee633
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153500
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sc/source/ui/theme/ThemeColorChanger.cxx 
b/sc/source/ui/theme/ThemeColorChanger.cxx
index 2211aa67b554..a245f7b0c1c0 100644
--- a/sc/source/ui/theme/ThemeColorChanger.cxx
+++ b/sc/source/ui/theme/ThemeColorChanger.cxx
@@ -16,6 +16,8 @@
 #include <docmodel/theme/Theme.hxx>
 #include <editeng/colritem.hxx>
 #include <editeng/brushitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/borderline.hxx>
 
 #include <stlpool.hxx>
 #include <stlsheet.hxx>
@@ -35,6 +37,26 @@ ThemeColorChanger::~ThemeColorChanger() = default;
 
 namespace
 {
+bool changeBorderLine(editeng::SvxBorderLine* pBorderLine, model::ColorSet 
const& rColorSet)
+{
+    if (!pBorderLine)
+        return false;
+
+    model::ComplexColor const& rComplexColor = pBorderLine->getComplexColor();
+    if (rComplexColor.meType == model::ColorType::Scheme)
+    {
+        auto eThemeType = rComplexColor.meSchemeType;
+
+        if (eThemeType != model::ThemeColorType::Unknown)
+        {
+            Color aColor = rColorSet.resolveColor(rComplexColor);
+            pBorderLine->SetColor(aColor);
+            return true;
+        }
+    }
+    return false;
+}
+
 void changeCellItems(SfxItemSet& rItemSet, model::ColorSet const& rColorSet)
 {
     const SfxPoolItem* pItem = nullptr;
@@ -75,6 +97,20 @@ void changeCellItems(SfxItemSet& rItemSet, model::ColorSet 
const& rColorSet)
             }
         }
     }
+    if (rItemSet.HasItem(ATTR_BORDER, &pItem))
+    {
+        auto const* pBoxItem = static_cast<const SvxBoxItem*>(pItem);
+        SvxBoxItem rNewItem(*pBoxItem);
+        bool bChanged = false;
+
+        bChanged = changeBorderLine(rNewItem.GetBottom(), rColorSet) || 
bChanged;
+        bChanged = changeBorderLine(rNewItem.GetTop(), rColorSet) || bChanged;
+        bChanged = changeBorderLine(rNewItem.GetLeft(), rColorSet) || bChanged;
+        bChanged = changeBorderLine(rNewItem.GetRight(), rColorSet) || 
bChanged;
+
+        if (bChanged)
+            rItemSet.Put(rNewItem);
+    }
 }
 } // end anonymous ns
 
commit 163ad701b61af6888bb9fbaaf2d8a49054f9a846
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jun 23 21:58:22 2023 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sun Jun 25 17:35:40 2023 +0200

    oox: map color transforms direct to create model::Transform
    
    Change-Id: I82382f8d0936e90218fefe889ea5bfdd04c3e82b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153507
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 4d2ee2afbbce..b653458300f4 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -840,21 +840,31 @@ model::ComplexColor Color::createComplexColor(const 
GraphicHelper& /*rGraphicHel
         return aNewComplexColor;
     }
 
-    if (getLumMod() != 10000)
-        aNewComplexColor.addTransformation({model::TransformationType::LumMod, 
getLumMod()});
-
-    if (getLumOff() != 0)
-        aNewComplexColor.addTransformation({model::TransformationType::LumOff, 
getLumOff()});
-
-    if (getTintOrShade() > 0)
-    {
-        aNewComplexColor.addTransformation({model::TransformationType::Tint, 
getTintOrShade()});
-    }
-    else if (getTintOrShade() < 0)
+    for(auto const& aTransform : maTransforms)
     {
-        sal_Int16 nShade = o3tl::narrowing<sal_Int16>(-getTintOrShade());
-        aNewComplexColor.addTransformation({model::TransformationType::Shade, 
nShade});
+        sal_Int16 nValue = sal_Int16(aTransform.mnValue / 10);
+
+        switch(aTransform.mnToken)
+        {
+            case XML_lumMod:
+                if (nValue != 10'000)
+                    
aNewComplexColor.addTransformation({model::TransformationType::LumMod, nValue});
+                break;
+            case XML_lumOff:
+                if (nValue != 0)
+                    
aNewComplexColor.addTransformation({model::TransformationType::LumOff, nValue});
+                break;
+            case XML_tint:
+                if (nValue != 0)
+                    
aNewComplexColor.addTransformation({model::TransformationType::Tint, nValue});
+                break;
+            case XML_shade:
+                if (nValue != 0)
+                    
aNewComplexColor.addTransformation({model::TransformationType::Shade, nValue});
+                break;
+        }
     }
+
     return aNewComplexColor;
 }
 

Reply via email to