include/oox/drawingml/color.hxx                  |    3 ++
 oox/source/drawingml/color.cxx                   |   24 +++++++++++++++++++++++
 oox/source/drawingml/fillproperties.cxx          |   16 +--------------
 oox/source/drawingml/textcharacterproperties.cxx |   15 --------------
 writerfilter/source/ooxml/model.xml              |   12 +++++------
 5 files changed, 36 insertions(+), 34 deletions(-)

New commits:
commit 92a7222b04f18644f6a58d1503ab0d29ca8b057c
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Sat Jun 10 22:22:17 2023 +0900
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jun 14 08:34:17 2023 +0200

    oox: fix theme data in model.xml to use a correct types
    
    Change-Id: Ifaa725d8a3e6c4cfefc92a6c5fcdb581610d3ce6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152832
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit 3a6d360b5e585b8e92cc0d58d5fbc497448e11fb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152990
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/writerfilter/source/ooxml/model.xml 
b/writerfilter/source/ooxml/model.xml
index 8082c433e89b..89a1d9f91425 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -10997,13 +10997,13 @@
           <ref name="ST_HexColor"/>
         </attribute>
         <attribute name="themeColor">
-          <data type="string"/>
+          <ref name="ST_ThemeColor"/>
         </attribute>
         <attribute name="themeTint">
-          <data type="string"/>
+          <ref name="ST_UcharHexNumber"/>
         </attribute>
         <attribute name="themeShade">
-          <data type="string"/>
+          <ref name="ST_UcharHexNumber"/>
         </attribute>
       </define>
       <define name="ST_TextEffect">
@@ -12591,13 +12591,13 @@
           <ref name="ST_HexColor"/>
         </attribute>
         <attribute name="themeColor">
-          <data type="string"/>
+          <ref name="ST_ThemeColor"/>
         </attribute>
         <attribute name="themeTint">
-          <data type="string"/>
+          <ref name="ST_UcharHexNumber"/>
         </attribute>
         <attribute name="themeShade">
-          <data type="string"/>
+          <ref name="ST_UcharHexNumber"/>
         </attribute>
         <element name="v:background">
           <ref name="BUILT_IN_ANY_TYPE"/>
commit b9aa62a714370b63ff93f55f1e599e4cad4c7eef
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jun 9 23:34:24 2023 +0900
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Jun 14 08:34:08 2023 +0200

    oox: remove code duplication and add getComplexColor to oox::Color
    
    Change-Id: I9cfbc851d4f303a5a8c92183f01cb5b6545b7984
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152800
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    (cherry picked from commit c1470e15bd0643be8d91aaf6a0d25c78867d0b3e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152969
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 75812c200c28..245e655d7c78 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -30,6 +30,7 @@
 #include <sal/types.h>
 #include <tools/color.hxx>
 #include <docmodel/theme/ThemeColorType.hxx>
+#include <docmodel/color/ComplexColor.hxx>
 
 namespace oox { class GraphicHelper; }
 
@@ -117,6 +118,8 @@ public:
     /// Compares this color with rOther.
     bool equals(const Color& rOther, const GraphicHelper& rGraphicHelper, 
::Color nPhClr) const;
 
+    model::ComplexColor getComplexColor() const;
+
 private:
     /** Internal helper for getColor(). */
     void                setResolvedRgb( ::Color nRgb ) const;
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 592d0734efc2..e9c645b99b7c 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -567,6 +567,30 @@ sal_Int16 Color::getLumOff() const
     return 0;
 }
 
+model::ComplexColor Color::getComplexColor() const
+{
+    model::ComplexColor aComplexColor;
+    
aComplexColor.setSchemeColor(model::convertToThemeColorType(getSchemeColorIndex()));
+
+    if (getTintOrShade() > 0)
+    {
+        aComplexColor.addTransformation({model::TransformationType::Tint, 
getTintOrShade()});
+    }
+    else if (getTintOrShade() < 0)
+    {
+        sal_Int16 nShade = o3tl::narrowing<sal_Int16>(-getTintOrShade());
+        aComplexColor.addTransformation({model::TransformationType::Shade, 
nShade});
+    }
+
+    if (getLumMod() != 10000)
+        aComplexColor.addTransformation({model::TransformationType::LumMod, 
getLumMod()});
+
+    if (getLumOff() != 0)
+        aComplexColor.addTransformation({model::TransformationType::LumOff, 
getLumOff()});
+
+    return aComplexColor;
+}
+
 ::Color Color::getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr ) 
const
 {
     const sal_Int32 nTempC1 = mnC1;
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index fe00d12cf078..0a2e53928076 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -430,24 +430,12 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
                 if (aFillColor == nPhClr)
                 {
                     
aComplexColor.setSchemeColor(model::convertToThemeColorType(nPhClrTheme));
-                    rPropMap.setProperty(PROP_FillComplexColor, 
model::color::createXComplexColor(aComplexColor));
                 }
                 else
                 {
-                    
aComplexColor.setSchemeColor(model::convertToThemeColorType(maFillColor.getSchemeColorIndex()));
-                    if (maFillColor.getLumMod() != 10000)
-                        
aComplexColor.addTransformation({model::TransformationType::LumMod, 
maFillColor.getLumMod()});
-                    if (maFillColor.getLumOff() != 0)
-                        
aComplexColor.addTransformation({model::TransformationType::LumOff, 
maFillColor.getLumOff()});
-                    if (maFillColor.getTintOrShade() > 0)
-                        
aComplexColor.addTransformation({model::TransformationType::Tint, 
maFillColor.getTintOrShade()});
-                    if (maFillColor.getTintOrShade() < 0)
-                    {
-                        sal_Int16 nShade = 
o3tl::narrowing<sal_Int16>(-maFillColor.getTintOrShade());
-                        
aComplexColor.addTransformation({model::TransformationType::Shade, nShade});
-                    }
-                    rPropMap.setProperty(PROP_FillComplexColor, 
model::color::createXComplexColor(aComplexColor));
+                    aComplexColor = maFillColor.getComplexColor();
                 }
+                rPropMap.setProperty(PROP_FillComplexColor, 
model::color::createXComplexColor(aComplexColor));
 
                 eFillStyle = FillStyle_SOLID;
             }
diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 7d3dda284680..0e1e2830a67f 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -136,20 +136,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
         rPropMap.setProperty(PROP_CharColor, 
aColor.getColor(rFilter.getGraphicHelper()));
 
         // set theme color
-        model::ComplexColor aComplexColor;
-        
aComplexColor.setSchemeColor(model::convertToThemeColorType(aColor.getSchemeColorIndex()));
-        if (aColor.getTintOrShade() > 0)
-            aComplexColor.addTransformation({model::TransformationType::Tint, 
aColor.getTintOrShade()});
-        if (aColor.getTintOrShade() < 0)
-        {
-            sal_Int16 nShade = 
o3tl::narrowing<sal_Int16>(-aColor.getTintOrShade());
-            aComplexColor.addTransformation({model::TransformationType::Shade, 
nShade});
-        }
-        if (aColor.getLumMod() != 10000)
-            
aComplexColor.addTransformation({model::TransformationType::LumMod, 
aColor.getLumMod()});
-        if (aColor.getLumOff() != 0)
-            
aComplexColor.addTransformation({model::TransformationType::LumOff, 
aColor.getLumOff()});
-
+        model::ComplexColor aComplexColor = aColor.getComplexColor();
         rPropMap.setProperty(PROP_CharComplexColor, 
model::color::createXComplexColor(aComplexColor));
         rPropMap.setProperty(PROP_CharContoured, bContoured);
 

Reply via email to