[Libreoffice-commits] core.git: Branch 'feature/themesupport2' - 2 commits - include/editeng include/oox oox/source svx/source

Sarper Akdemir (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 19 22:01:00 UTC 2021


 include/editeng/unoprnms.hxx                     |    2 ++
 include/editeng/unotext.hxx                      |    4 +++-
 include/oox/drawingml/color.hxx                  |    2 ++
 oox/source/drawingml/color.cxx                   |   18 ++++++++++++++++++
 oox/source/drawingml/textcharacterproperties.cxx |    2 ++
 oox/source/token/properties.txt                  |    2 ++
 svx/source/unodraw/unoprov.cxx                   |    4 +++-
 7 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit 30bdd12fc3f8966911ea886b71f28ae26e853227
Author:     Sarper Akdemir <sarper.akdemir at collabora.com>
AuthorDate: Fri Aug 20 00:45:55 2021 +0300
Commit:     Sarper Akdemir <sarper.akdemir at collabora.com>
CommitDate: Fri Aug 20 00:45:55 2021 +0300

    implement initial pptx theme color import
    
    Change-Id: Ic3a46c2d01c8f8be73f22d2af41aa11a9bb3267d

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 59f417cfac52..f213dba9a973 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -98,6 +98,8 @@ public:
 
     /** Returns the scheme name from the a:schemeClr element for interoperability purposes */
     const OUString&     getSchemeName() const { return msSchemeName; }
+    sal_Int16           getSchemeIndex() const;
+
     /** Returns the unaltered list of transformations for interoperability purposes */
     const css::uno::Sequence< css::beans::PropertyValue >& getTransformations() const { return maInteropTransformations;}
 
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 1cd5d2ebaed7..2b3e73f0801e 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -660,6 +660,24 @@ sal_Int16 Color::getTransparency() const
     return sal_Int16(std::round( (1.0 * (MAX_PERCENT - mnAlpha)) / PER_PERCENT) );
 }
 
+sal_Int16 Color::getSchemeIndex() const
+{
+    // costly string comparison to see even if it works..
+    if(msSchemeName == "dk1") return 0;
+    else if(msSchemeName == "lt1") return 1;
+    else if(msSchemeName == "dk2") return 2;
+    else if(msSchemeName == "lt2") return 3;
+    else if(msSchemeName == "accent1") return 4;
+    else if(msSchemeName == "accent2") return 5;
+    else if(msSchemeName == "accent3") return 6;
+    else if(msSchemeName == "accent4") return 7;
+    else if(msSchemeName == "accent5") return 8;
+    else if(msSchemeName == "accent6") return 9;
+    else if(msSchemeName == "hlink") return 10;
+    else if(msSchemeName == "folHlink") return 11;
+    else return -1;
+}
+
 // private --------------------------------------------------------------------
 
 void Color::setResolvedRgb( ::Color nRgb ) const
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 4eb5acaffb56..9cbc331d05fa 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -111,6 +111,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
     {
         Color aColor = maFillProperties.getBestSolidColor();
         rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper()));
+        // set color theme index
+        rPropMap.setProperty(PROP_CharColorTheme, aColor.getSchemeIndex());
 
         if (aColor.hasTransparency())
         {
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 68b5e2d14af5..1b20bfe61828 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -54,6 +54,8 @@ CharBackColor
 CharCaseMap
 CharColor
 CharContoured
+CharColorTheme
+CharColorTintOrShade
 CharEscapement
 CharEscapementHeight
 CharFontCharSet
commit 2590a32ac0ca0f909a1d863dde60b57da97e57b5
Author:     Sarper Akdemir <sarper.akdemir at collabora.com>
AuthorDate: Wed Aug 18 16:04:37 2021 +0300
Commit:     Sarper Akdemir <sarper.akdemir at collabora.com>
CommitDate: Wed Aug 18 16:04:37 2021 +0300

    expose the SvxColorItem theme related uno for draw/impress
    
    Change-Id: I6d8dc19d5c2418aa61fed507cb2bb5b119d15acd

diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index c637521dcf2d..3c5011210d51 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -325,6 +325,8 @@
 #define UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX       "CharLocaleComplex"
 
 #define UNO_NAME_EDIT_CHAR_COLOR                "CharColor"
+#define UNO_NAME_EDIT_CHAR_COLOR_THEME          "CharColorTheme"
+#define UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE  "CharColorTintOrShade"
 #define UNO_NAME_EDIT_CHAR_TRANSPARENCE         "CharTransparence"
 #define UNO_NAME_EDIT_CHAR_CROSSEDOUT           "CharCrossedOut"
 #define UNO_NAME_EDIT_CHAR_STRIKEOUT            "CharStrikeout"
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index 0c09b4361edc..896130f6d257 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -85,8 +85,10 @@ struct SfxItemPropertyMapEntry;
     { u"" UNO_NAME_EDIT_CHAR_POSTURE,     EE_CHAR_ITALIC,     ::cppu::UnoType<css::awt::FontSlant>::get(),0, MID_POSTURE }, \
     { u"" UNO_NAME_EDIT_CHAR_WEIGHT,      EE_CHAR_WEIGHT,     cppu::UnoType<float>::get(),            0, MID_WEIGHT }, \
     { u"" UNO_NAME_EDIT_CHAR_LOCALE,      EE_CHAR_LANGUAGE,   ::cppu::UnoType<css::lang::Locale>::get(),0, MID_LANG_LOCALE }, \
-    { u"" UNO_NAME_EDIT_CHAR_COLOR,       EE_CHAR_COLOR,      ::cppu::UnoType<sal_Int32>::get(),        0, 0 }, \
+    { u"" UNO_NAME_EDIT_CHAR_COLOR,       EE_CHAR_COLOR,      ::cppu::UnoType<sal_Int32>::get(),        0, MID_COLOR_RGB }, \
     { u"" UNO_NAME_EDIT_CHAR_TRANSPARENCE,EE_CHAR_COLOR,      ::cppu::UnoType<sal_Int16>::get(),        0, MID_COLOR_ALPHA }, \
+    { u"" UNO_NAME_EDIT_CHAR_COLOR_THEME, EE_CHAR_COLOR,      ::cppu::UnoType<sal_Int16>::get(),        0, MID_COLOR_THEME_INDEX }, \
+    { u"" UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE, EE_CHAR_COLOR, ::cppu::UnoType<sal_Int16>::get(),     0, MID_COLOR_TINT_OR_SHADE }, \
     { u"CharBackColor",                EE_CHAR_BKGCOLOR,   ::cppu::UnoType<sal_Int32>::get(),        0, 0 }, \
     { u"CharBackTransparent",          EE_CHAR_BKGCOLOR,   ::cppu::UnoType<bool>::get(),             0, MID_GRAPHIC_TRANSPARENT }, \
     { u"" UNO_NAME_EDIT_CHAR_ESCAPEMENT,  EE_CHAR_ESCAPEMENT, ::cppu::UnoType<sal_Int16>::get(),        0, MID_ESC }, \
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx
index e90d980ebd89..f5564ef236d0 100644
--- a/svx/source/unodraw/unoprov.cxx
+++ b/svx/source/unodraw/unoprov.cxx
@@ -578,7 +578,9 @@ static SfxItemPropertyMapEntry const * ImplGetSvxControlShapePropertyMap()
         { u"" UNO_NAME_EDIT_CHAR_UNDERLINE,       0,  cppu::UnoType<sal_Int16>::get(),        0, 0 },
         { u"" UNO_NAME_EDIT_CHAR_STRIKEOUT,       0,  cppu::UnoType<sal_Int16>::get(),        0, 0},
         { u"" UNO_NAME_EDIT_CHAR_CASEMAP,         0,  cppu::UnoType<sal_Int16>::get(),        0, 0 },
-        { u"" UNO_NAME_EDIT_CHAR_COLOR,           0,  cppu::UnoType<sal_Int32>::get(),        0, 0 },
+        { u"" UNO_NAME_EDIT_CHAR_COLOR,           0,  cppu::UnoType<sal_Int32>::get(),        0, MID_COLOR_RGB },
+        { u"" UNO_NAME_EDIT_CHAR_COLOR_THEME,     0,  cppu::UnoType<sal_Int16>::get(),        0, MID_COLOR_THEME_INDEX },
+        { u"" UNO_NAME_EDIT_CHAR_COLOR_TINT_OR_SHADE, 0, cppu::UnoType<sal_Int16>::get(),     0, MID_COLOR_TINT_OR_SHADE },
         { u"CharBackColor",                    0,  cppu::UnoType<sal_Int32>::get(),        0, 0 },
         { u"CharBackTransparent",              0,  cppu::UnoType<bool>::get(),             0, 0 },
         { u"CharRelief",                       0,  cppu::UnoType<sal_Int16>::get(),        0, 0 },


More information about the Libreoffice-commits mailing list