[Libreoffice-commits] core.git: include/oox oox/inc oox/source sc/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 06:35:30 UTC 2018


 include/oox/drawingml/clrscheme.hxx               |    9 
 include/oox/drawingml/color.hxx                   |   10 -
 include/oox/drawingml/shapepropertymap.hxx        |    5 
 include/oox/export/drawingml.hxx                  |    8 
 include/oox/helper/graphichelper.hxx              |    8 
 include/oox/helper/helper.hxx                     |   11 -
 include/oox/helper/propertyset.hxx                |    3 
 include/oox/ole/olehelper.hxx                     |    3 
 include/oox/ppt/pptimport.hxx                     |    2 
 include/oox/vml/vmlformatting.hxx                 |    4 
 oox/inc/drawingml/fillproperties.hxx              |    2 
 oox/inc/drawingml/lineproperties.hxx              |    2 
 oox/inc/drawingml/shape3dproperties.hxx           |    4 
 oox/source/drawingml/chart/objectformatter.cxx    |   22 +-
 oox/source/drawingml/chart/seriesconverter.cxx    |    2 
 oox/source/drawingml/chart/typegroupconverter.cxx |    2 
 oox/source/drawingml/clrscheme.cxx                |    8 
 oox/source/drawingml/color.cxx                    |  211 +++++++++++-----------
 oox/source/drawingml/fillproperties.cxx           |   36 +--
 oox/source/drawingml/lineproperties.cxx           |    2 
 oox/source/drawingml/shape.cxx                    |    6 
 oox/source/drawingml/shape3dproperties.cxx        |    4 
 oox/source/drawingml/table/tablecell.cxx          |    8 
 oox/source/export/ColorPropertySet.cxx            |    2 
 oox/source/export/ColorPropertySet.hxx            |    7 
 oox/source/export/chartexport.cxx                 |    2 
 oox/source/export/drawingml.cxx                   |   60 +++---
 oox/source/export/shapes.cxx                      |    8 
 oox/source/helper/graphichelper.cxx               |   66 +++---
 oox/source/ole/olehelper.cxx                      |    6 
 oox/source/ppt/pptimport.cxx                      |   10 -
 oox/source/ppt/presentationfragmenthandler.cxx    |    2 
 oox/source/ppt/slidepersist.cxx                   |    2 
 oox/source/ppt/timenodelistcontext.cxx            |    4 
 oox/source/shape/ShapeFilterBase.cxx              |    8 
 oox/source/shape/ShapeFilterBase.hxx              |    2 
 oox/source/vml/vmlformatting.cxx                  |    6 
 sc/source/filter/inc/stylesbuffer.hxx             |    6 
 sc/source/filter/oox/condformatbuffer.cxx         |    3 
 sc/source/filter/oox/drawingfragment.cxx          |    6 
 sc/source/filter/oox/stylesbuffer.cxx             |   42 ++--
 sc/source/filter/oox/themebuffer.cxx              |    8 
 sc/source/filter/oox/viewsettings.cxx             |    2 
 sc/source/filter/oox/worksheetsettings.cxx        |    2 
 44 files changed, 322 insertions(+), 304 deletions(-)

New commits:
commit 61d79dd740958186c4a4344e18eaeb5b2c139c91
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Mar 2 11:43:46 2018 +0200

    use more Color in oox
    
    Change-Id: I8fdc6742de5af9101e246411e7208650bae2c4c7
    Reviewed-on: https://gerrit.libreoffice.org/50617
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx
index ccf918d7ba74..b37b6659a443 100644
--- a/include/oox/drawingml/clrscheme.hxx
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -29,6 +29,7 @@
 #include <oox/dllapi.h>
 #include <sal/types.h>
 #include <rtl/ustring.hxx>
+#include <tools/color.hxx>
 
 namespace oox { namespace drawingml {
 
@@ -78,15 +79,15 @@ typedef std::shared_ptr< ClrMap > ClrMapPtr;
 
 class OOX_DLLPUBLIC ClrScheme
 {
-    std::vector< std::pair<sal_Int32, sal_Int32> > maClrScheme;
+    std::vector< std::pair<sal_Int32, ::Color> > maClrScheme;
 
 public:
 
-    bool     getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const;
-    void     setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor );
+    bool     getColor( sal_Int32 nSchemeClrToken, ::Color& rColor ) const;
+    void     setColor( sal_Int32 nSchemeClrToken, ::Color nColor );
 
     bool     getColorByIndex(size_t nIndex,
-            sal_Int32& rColor) const;
+            ::Color& rColor) const;
 };
 
 typedef std::shared_ptr< ClrScheme > ClrSchemePtr;
diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 2ba97d49cf36..94d9050c5b42 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -28,6 +28,7 @@
 #include <oox/dllapi.h>
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
+#include <tools/color.hxx>
 
 namespace oox { class GraphicHelper; }
 
@@ -41,14 +42,15 @@ public:
     Color();
 
     /** Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error. */
-    static sal_Int32    getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
+    static ::Color      getDmlPresetColor( sal_Int32 nToken, ::Color nDefaultRgb );
     /** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */
-    static sal_Int32    getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
+    static ::Color      getVmlPresetColor( sal_Int32 nToken, ::Color nDefaultRgb );
 
     /** Sets the color to unused state. */
     void                setUnused();
     /** Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element. */
     void                setSrgbClr( sal_Int32 nRgb );
+    void                setSrgbClr( ::Color nRgb );
     /** Sets the percentual RGB values from the a:scrgbClr element. */
     void                setScrgbClr( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB );
     /** Sets the HSL values from the a:hslClr element. */
@@ -84,7 +86,7 @@ public:
     bool                isPlaceHolder() const { return meMode == COLOR_PH; }
     /** Returns the final RGB color value.
         @param nPhClr  Actual color for the phClr placeholder color used in theme style lists. */
-    sal_Int32           getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+    ::Color             getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr = API_RGB_TRANSPARENT ) const;
 
     /** Returns true, if the color is transparent. */
     bool                hasTransparency() const;
@@ -103,7 +105,7 @@ public:
 
 private:
     /** Internal helper for getColor(). */
-    void                setResolvedRgb( sal_Int32 nRgb ) const;
+    void                setResolvedRgb( ::Color nRgb ) const;
 
     /** Converts the color components to RGB values. */
     void                toRgb() const;
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
index 86dbd569ebc7..8ba077ea3d27 100644
--- a/include/oox/drawingml/shapepropertymap.hxx
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -29,6 +29,7 @@
 #include <oox/helper/propertymap.hxx>
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
+#include <tools/color.hxx>
 
 namespace oox { class ModelObjectHelper; }
 
@@ -125,6 +126,10 @@ public:
     {
         return setAnyProperty(ePropId, css::uno::Any(rValue));
     }
+    bool setProperty(ShapeProperty ePropId, const ::Color& rValue)
+    {
+        return setAnyProperty(ePropId, css::uno::makeAny(rValue));
+    }
 
     using PropertyMap::setAnyProperty;
     using PropertyMap::setProperty;
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index d868eb89f365..bd445df24fd8 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -169,14 +169,14 @@ public:
     /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship
     OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false);
 
-    void WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT );
+    void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
     void WriteColor( const OUString& sColorSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations );
     void WriteColorTransformations( const css::uno::Sequence< css::beans::PropertyValue >& aTransformations );
-    void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor );
+    void WriteGradientStop( sal_uInt16 nStop, ::Color nColor );
     void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, bool bLineStart );
     void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID );
 
-    void WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT );
+    void WriteSolidFill( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
     void WriteSolidFill( const OUString& sSchemeName, const css::uno::Sequence< css::beans::PropertyValue >& aTransformations );
     void WriteSolidFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
     void WriteGradientFill( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet );
@@ -266,7 +266,7 @@ public:
 
     static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, css::awt::FontDescriptor& rFontDesc );
 
-    static sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
+    static ::Color ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
 
     static const char* GetAlignment( css::style::ParagraphAdjust nAlignment );
 
diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
index 9eb77ee60318..2127d3ec57f4 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -73,11 +73,11 @@ public:
     // System colors and predefined colors ------------------------------------
 
     /** Returns a system color specified by the passed XML token identifier. */
-    sal_Int32           getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb = API_RGB_TRANSPARENT ) const;
+    ::Color            getSystemColor( sal_Int32 nToken, ::Color nDefaultRgb = API_RGB_TRANSPARENT ) const;
     /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
-    virtual sal_Int32   getSchemeColor( sal_Int32 nToken ) const;
+    virtual ::Color    getSchemeColor( sal_Int32 nToken ) const;
     /** Derived classes may implement to resolve a palette index to an RGB color. */
-    virtual sal_Int32   getPaletteColor( sal_Int32 nPaletteIdx ) const;
+    virtual ::Color    getPaletteColor( sal_Int32 nPaletteIdx ) const;
 
     virtual sal_Int32 getDefaultChartAreaFillStyle() const;
 
@@ -164,7 +164,7 @@ private:
     css::uno::Reference< css::graphic::XGraphicProvider2 > mxGraphicProvider;
     css::uno::Reference< css::awt::XUnitConversion > mxUnitConversion;
     css::awt::DeviceInfo maDeviceInfo; ///< Current output device info.
-    ::std::map< sal_Int32, sal_Int32 >  maSystemPalette;  ///< Maps system colors (XML tokens) to RGB color values.
+    ::std::map< sal_Int32, ::Color >  maSystemPalette;  ///< Maps system colors (XML tokens) to RGB color values.
     StorageRef          mxStorage;                  ///< Storage containing embedded graphics.
     mutable GraphicObjectDeque maGraphicObjects;    ///< Caches all created graphic objects to keep them alive.
     mutable EmbeddedGraphicMap maEmbeddedGraphics;  ///< Maps all embedded graphics by their storage path.
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 0729a27aaf64..a0c79e0bc6f7 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -32,6 +32,7 @@
 #include <rtl/textenc.h>
 #include <sal/macros.h>
 #include <sal/types.h>
+#include <tools/color.hxx>
 
 namespace oox {
 
@@ -69,11 +70,11 @@ const sal_uInt8 WINDOWS_CHARSET_EASTERN     = 238;
 const sal_uInt8 WINDOWS_CHARSET_OEM         = 255;
 
 
-const sal_Int32 API_RGB_TRANSPARENT         = -1;       ///< Transparent color for API calls.
-const sal_uInt32 UNSIGNED_RGB_TRANSPARENT         = static_cast<sal_uInt32>(-1);       ///< Transparent color for unsigned int32 places.
-const sal_Int32 API_RGB_BLACK               = 0x000000;  ///< Black color for API calls.
-const sal_Int32 API_RGB_GRAY                = 0x808080;  ///< Gray color for API calls.
-const sal_Int32 API_RGB_WHITE               = 0xFFFFFF;  ///< White color for API calls.
+const ::Color API_RGB_TRANSPARENT         (0xffffffff); ///< Transparent color for API calls.
+const sal_uInt32 UNSIGNED_RGB_TRANSPARENT = static_cast<sal_uInt32>(-1); ///< Transparent color for unsigned int32 places.
+const ::Color API_RGB_BLACK               (0x000000);  ///< Black color for API calls.
+const ::Color API_RGB_GRAY                (0x808080);  ///< Gray color for API calls.
+const ::Color API_RGB_WHITE               (0xFFFFFF);  ///< White color for API calls.
 
 const sal_Int16 API_LINE_SOLID              = 0;
 const sal_Int16 API_LINE_DOTTED             = 1;
diff --git a/include/oox/helper/propertyset.hxx b/include/oox/helper/propertyset.hxx
index 39dbf8583e6a..11d044e5ff3a 100644
--- a/include/oox/helper/propertyset.hxx
+++ b/include/oox/helper/propertyset.hxx
@@ -26,6 +26,7 @@
 #include <oox/dllapi.h>
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
+#include <tools/color.hxx>
 
 namespace com { namespace sun { namespace star {
     namespace beans { class XMultiPropertySet; }
@@ -106,6 +107,8 @@ public:
     template< typename Type >
     bool         setProperty( sal_Int32 nPropId, const Type& rValue )
                             { return setAnyProperty( nPropId, css::uno::Any( rValue ) ); }
+    bool         setProperty( sal_Int32 nPropId, ::Color rValue )
+                            { return setAnyProperty( nPropId, css::uno::makeAny( rValue ) ); }
 
     /** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface.
         @param rPropNames  The property names. MUST be ordered alphabetically.
diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx
index 1a34748f79ee..16e5535a3bb3 100644
--- a/include/oox/ole/olehelper.hxx
+++ b/include/oox/ole/olehelper.hxx
@@ -102,7 +102,7 @@ namespace OleHelper
             True = OLE default color type is treated as BGR color.
             False = OLE default color type is treated as palette color.
      */
-    OOX_DLLPUBLIC sal_Int32    decodeOleColor(
+    OOX_DLLPUBLIC ::Color decodeOleColor(
                             const GraphicHelper& rGraphicHelper,
                             sal_uInt32 nOleColor,
                             bool bDefaultColorBgr );
@@ -110,6 +110,7 @@ namespace OleHelper
     /** Returns the OLE color from the passed UNO RGB color.
      */
     OOX_DLLPUBLIC sal_uInt32   encodeOleColor( sal_Int32 nRgbColor );
+    inline sal_uInt32          encodeOleColor( Color nRgbColor ) { return encodeOleColor(sal_Int32(nRgbColor)); }
 
     /** Imports a GUID from the passed binary stream and returns its string
         representation (in uppercase characters).
diff --git a/include/oox/ppt/pptimport.hxx b/include/oox/ppt/pptimport.hxx
index 24fa59621cc1..49b801b5179c 100644
--- a/include/oox/ppt/pptimport.hxx
+++ b/include/oox/ppt/pptimport.hxx
@@ -76,7 +76,7 @@ public:
 
     virtual sal_Bool SAL_CALL filter( const css::uno::Sequence<   css::beans::PropertyValue >& rDescriptor ) override;
 
-    sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+    ::Color getSchemeColor( sal_Int32 nToken ) const;
 
 #if OSL_DEBUG_LEVEL > 0
     static XmlFilterBase* mpDebugFilterBase;
diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx
index 1c589897ebcc..50e91c1bea92 100644
--- a/include/oox/vml/vmlformatting.hxx
+++ b/include/oox/vml/vmlformatting.hxx
@@ -153,8 +153,8 @@ namespace ConversionHelper
                             const GraphicHelper& rGraphicHelper,
                             const OptValue< OUString >& roVmlColor,
                             const OptValue< double >& roVmlOpacity,
-                            sal_Int32 nDefaultRgb,
-                            sal_Int32 nPrimaryRgb = API_RGB_TRANSPARENT );
+                            ::Color nDefaultRgb,
+                            ::Color nPrimaryRgb = API_RGB_TRANSPARENT );
 
     /** Converts VML path string into point and flag vectors.
 
diff --git a/oox/inc/drawingml/fillproperties.hxx b/oox/inc/drawingml/fillproperties.hxx
index affd8e1602eb..7fe1a3f6033d 100644
--- a/oox/inc/drawingml/fillproperties.hxx
+++ b/oox/inc/drawingml/fillproperties.hxx
@@ -147,7 +147,7 @@ struct OOX_DLLPUBLIC FillProperties
                             ShapePropertyMap& rPropMap,
                             const GraphicHelper& rGraphicHelper,
                             sal_Int32 nShapeRotation = 0,
-                            sal_Int32 nPhClr = API_RGB_TRANSPARENT,
+                            ::Color nPhClr = API_RGB_TRANSPARENT,
                             bool bFlipH = false,
                             bool bFlipV = false ) const;
 };
diff --git a/oox/inc/drawingml/lineproperties.hxx b/oox/inc/drawingml/lineproperties.hxx
index 1c5320e25841..512c1aba5fe6 100644
--- a/oox/inc/drawingml/lineproperties.hxx
+++ b/oox/inc/drawingml/lineproperties.hxx
@@ -70,7 +70,7 @@ struct OOX_DLLPUBLIC LineProperties
     void                pushToPropMap(
                             ShapePropertyMap& rPropMap,
                             const GraphicHelper& rGraphicHelper,
-                            sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+                            ::Color nPhClr = API_RGB_TRANSPARENT ) const;
 
     /** Calculates the line style attribute from the internal state of the object */
     css::drawing::LineStyle  getLineStyle() const;
diff --git a/oox/inc/drawingml/shape3dproperties.hxx b/oox/inc/drawingml/shape3dproperties.hxx
index e0fe9a9f0ac5..e44d0468eeca 100644
--- a/oox/inc/drawingml/shape3dproperties.hxx
+++ b/oox/inc/drawingml/shape3dproperties.hxx
@@ -78,10 +78,10 @@ struct Shape3DProperties
     css::uno::Sequence< css::beans::PropertyValue > getCameraAttributes();
     css::uno::Sequence< css::beans::PropertyValue > getLightRigAttributes();
     css::uno::Sequence< css::beans::PropertyValue > getShape3DAttributes(
-            const GraphicHelper& rGraphicHelper, sal_Int32 rPhClr );
+            const GraphicHelper& rGraphicHelper, ::Color rPhClr );
     static css::uno::Sequence< css::beans::PropertyValue > getBevelAttributes( BevelProperties rProps );
     static css::uno::Sequence< css::beans::PropertyValue > getColorAttributes(
-            const Color& rColor, const GraphicHelper& rGraphicHelper, sal_Int32 rPhClr );
+            const Color& rColor, const GraphicHelper& rGraphicHelper, ::Color rPhClr );
 };
 
 
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 8d49c0d01fef..5b5f67b39d5b 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -578,17 +578,17 @@ public:
 
 protected:
     /** Returns the placeholder color which may depend on the passed series index. */
-    sal_Int32           getPhColor( sal_Int32 nSeriesIdx ) const;
+    ::Color         getPhColor( sal_Int32 nSeriesIdx ) const;
 
 private:
     /** Resolves and returns the scheme color with the passed transformation. */
-    sal_Int32           getSchemeColor( sal_Int32 nColorToken, sal_Int32 nModToken, sal_Int32 nModValue ) const;
+    ::Color         getSchemeColor( sal_Int32 nColorToken, sal_Int32 nModToken, sal_Int32 nModValue ) const;
 
 protected:
-    typedef ::std::vector< sal_Int32 > ColorPatternVec;
+    typedef ::std::vector< ::Color > ColorPatternVec;
 
     ObjectFormatterData& mrData;            /// Shared formatter data.
-    sal_Int32           mnPhClr;            /// RGB placeholder color for themed style.
+    ::Color             mnPhClr;            /// RGB placeholder color for themed style.
     ColorPatternVec     maColorPattern;     /// Different cycling colors for data series.
 };
 
@@ -718,7 +718,7 @@ struct ObjectFormatterData
 
 DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry ) :
     mrData( rData ),
-    mnPhClr( -1 )
+    mnPhClr( 0xffffffff )
 {
     if( pAutoFormatEntry )
     {
@@ -740,13 +740,13 @@ DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const Auto
 
 DetailFormatterBase::DetailFormatterBase( ObjectFormatterData& rData, const AutoTextEntry* pAutoTextEntry ) :
     mrData( rData ),
-    mnPhClr( -1 )
+    mnPhClr( 0xffffffff )
 {
     if( pAutoTextEntry && (pAutoTextEntry->mnColorToken != XML_TOKEN_INVALID) )
         mnPhClr = getSchemeColor( pAutoTextEntry->mnColorToken, XML_TOKEN_INVALID, 0 );
 }
 
-sal_Int32 DetailFormatterBase::getPhColor( sal_Int32 nSeriesIdx ) const
+::Color DetailFormatterBase::getPhColor( sal_Int32 nSeriesIdx ) const
 {
     if( maColorPattern.empty() || (mrData.mnMaxSeriesIdx < 0) || (nSeriesIdx < 0) )
         return mnPhClr;
@@ -782,7 +782,7 @@ sal_Int32 DetailFormatterBase::getPhColor( sal_Int32 nSeriesIdx ) const
             step 5:  42% -> Cycle #4 has 42% tint of accent colors 1...6
             step 6:  70% -> Not used.
      */
-    sal_Int32 nPhClr = maColorPattern[ static_cast< size_t >( nSeriesIdx % maColorPattern.size() ) ];
+    ::Color nPhClr = maColorPattern[ static_cast< size_t >( nSeriesIdx % maColorPattern.size() ) ];
     size_t nCycleIdx = static_cast< size_t >( nSeriesIdx / maColorPattern.size() );
     size_t nMaxCycleIdx = static_cast< size_t >( mrData.mnMaxSeriesIdx / maColorPattern.size() );
     double fShadeTint = static_cast< double >( nCycleIdx + 1 ) / (nMaxCycleIdx + 2) * 1.4 - 0.7;
@@ -797,7 +797,7 @@ sal_Int32 DetailFormatterBase::getPhColor( sal_Int32 nSeriesIdx ) const
     return nPhClr;
 }
 
-sal_Int32 DetailFormatterBase::getSchemeColor( sal_Int32 nColorToken, sal_Int32 nModToken, sal_Int32 nModValue ) const
+::Color DetailFormatterBase::getSchemeColor( sal_Int32 nColorToken, sal_Int32 nModToken, sal_Int32 nModValue ) const
 {
     Color aColor;
     aColor.setSchemeClr( nColorToken );
@@ -882,8 +882,8 @@ TextFormatter::TextFormatter( ObjectFormatterData& rData, const AutoTextEntry* p
         if( const Theme* pTheme = mrData.mrFilter.getCurrentTheme() )
             if( const TextCharacterProperties* pTextProps = pTheme->getFontStyle( pAutoTextEntry->mnThemedFont ) )
                 *mxAutoText = *pTextProps;
-        sal_Int32 nTextColor = getPhColor( -1 );
-        if( nTextColor >= 0 ) {
+        ::Color nTextColor = getPhColor( -1 );
+        if( sal_Int32(nTextColor) >= 0 ) {
             mxAutoText->maFillProperties.maFillColor.setSrgbClr( nTextColor );
             mxAutoText->maFillProperties.moFillType.set(XML_solidFill);
         }
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index c27771256a80..ac5977d115da 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -222,7 +222,7 @@ void importBorderProperties( PropertySet& rPropSet, Shape& rShape, const Graphic
         rPropSet.setProperty(PROP_LabelBorderStyle, uno::makeAny(drawing::LineStyle_SOLID));
     }
     const Color& aColor = rLP.maLineFill.maFillColor;
-    sal_Int32 nColor = aColor.getColor(rGraphicHelper);
+    ::Color nColor = aColor.getColor(rGraphicHelper);
     rPropSet.setProperty(PROP_LabelBorderColor, uno::makeAny(nColor));
 }
 
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index fc14b34d0753..66de768d8d8a 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -478,7 +478,7 @@ void TypeGroupConverter::convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSym
         if(xShapeProps.is())
         {
             Color aFillColor = xShapeProps->getFillProperties().maFillColor;
-            aSymbol.FillColor = aFillColor.getColor(getFilter().getGraphicHelper());
+            aSymbol.FillColor = sal_Int32(aFillColor.getColor(getFilter().getGraphicHelper()));
             rPropSet.setProperty(PROP_Color, aSymbol.FillColor);
         }
 
diff --git a/oox/source/drawingml/clrscheme.cxx b/oox/source/drawingml/clrscheme.cxx
index 0c6517abfbc3..8e2272f0039b 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -52,7 +52,7 @@ struct find_by_token
     {
     }
 
-    bool operator()(const std::pair<sal_Int32, sal_Int32>& r)
+    bool operator()(const std::pair<sal_Int32, ::Color>& r)
     {
         return r.first == m_token;
     }
@@ -61,7 +61,7 @@ private:
     sal_Int32 m_token;
 };
 
-bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const
+bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, ::Color& rColor ) const
 {
     OSL_ASSERT((nSchemeClrToken & sal_Int32(0xFFFF0000))==0);
     switch( nSchemeClrToken )
@@ -80,7 +80,7 @@ bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const
     return aIter != maClrScheme.end();
 }
 
-void ClrScheme::setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor )
+void ClrScheme::setColor( sal_Int32 nSchemeClrToken, ::Color nColor )
 {
     const auto aIter = std::find_if(maClrScheme.begin(), maClrScheme.end(), find_by_token(nSchemeClrToken) );
     if ( aIter != maClrScheme.end() )
@@ -89,7 +89,7 @@ void ClrScheme::setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor )
         maClrScheme.emplace_back(nSchemeClrToken, nColor);
 }
 
-bool ClrScheme::getColorByIndex(size_t nIndex, sal_Int32& rColor) const
+bool ClrScheme::getColorByIndex(size_t nIndex, ::Color& rColor) const
 {
     if (nIndex >= maClrScheme.size())
         return false;
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index ad27220d565b..ec4a18008719 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -35,7 +35,7 @@ namespace {
 /** Global storage for predefined color values used in OOXML file formats. */
 struct PresetColorsPool
 {
-    typedef ::std::vector< sal_Int32 > ColorVector;
+    typedef ::std::vector< ::Color > ColorVector;
 
     ColorVector         maDmlColors;        /// Predefined colors in DrawingML, indexed by XML token.
     ColorVector         maVmlColors;        /// Predefined colors in VML, indexed by XML token.
@@ -48,93 +48,93 @@ PresetColorsPool::PresetColorsPool() :
     maVmlColors( static_cast< size_t >( XML_TOKEN_COUNT ), API_RGB_TRANSPARENT )
 {
     // predefined colors in DrawingML (map XML token identifiers to RGB values)
-    static const std::pair<sal_Int32, sal_Int32> spnDmlColors[] =
+    static const std::pair<sal_Int32, ::Color> spnDmlColors[] =
     {
-        {XML_aliceBlue,         0xF0F8FF},    {XML_antiqueWhite,      0xFAEBD7},
-        {XML_aqua,              0x00FFFF},    {XML_aquamarine,        0x7FFFD4},
-        {XML_azure,             0xF0FFFF},    {XML_beige,             0xF5F5DC},
-        {XML_bisque,            0xFFE4C4},    {XML_black,             0x000000},
-        {XML_blanchedAlmond,    0xFFEBCD},    {XML_blue,              0x0000FF},
-        {XML_blueViolet,        0x8A2BE2},    {XML_brown,             0xA52A2A},
-        {XML_burlyWood,         0xDEB887},    {XML_cadetBlue,         0x5F9EA0},
-        {XML_chartreuse,        0x7FFF00},    {XML_chocolate,         0xD2691E},
-        {XML_coral,             0xFF7F50},    {XML_cornflowerBlue,    0x6495ED},
-        {XML_cornsilk,          0xFFF8DC},    {XML_crimson,           0xDC143C},
-        {XML_cyan,              0x00FFFF},    {XML_deepPink,          0xFF1493},
-        {XML_deepSkyBlue,       0x00BFFF},    {XML_dimGray,           0x696969},
-        {XML_dkBlue,            0x00008B},    {XML_dkCyan,            0x008B8B},
-        {XML_dkGoldenrod,       0xB8860B},    {XML_dkGray,            0xA9A9A9},
-        {XML_dkGreen,           0x006400},    {XML_dkKhaki,           0xBDB76B},
-        {XML_dkMagenta,         0x8B008B},    {XML_dkOliveGreen,      0x556B2F},
-        {XML_dkOrange,          0xFF8C00},    {XML_dkOrchid,          0x9932CC},
-        {XML_dkRed,             0x8B0000},    {XML_dkSalmon,          0xE9967A},
-        {XML_dkSeaGreen,        0x8FBC8B},    {XML_dkSlateBlue,       0x483D8B},
-        {XML_dkSlateGray,       0x2F4F4F},    {XML_dkTurquoise,       0x00CED1},
-        {XML_dkViolet,          0x9400D3},    {XML_dodgerBlue,        0x1E90FF},
-        {XML_firebrick,         0xB22222},    {XML_floralWhite,       0xFFFAF0},
-        {XML_forestGreen,       0x228B22},    {XML_fuchsia,           0xFF00FF},
-        {XML_gainsboro,         0xDCDCDC},    {XML_ghostWhite,        0xF8F8FF},
-        {XML_gold,              0xFFD700},    {XML_goldenrod,         0xDAA520},
-        {XML_gray,              0x808080},    {XML_green,             0x008000},
-        {XML_greenYellow,       0xADFF2F},    {XML_honeydew,          0xF0FFF0},
-        {XML_hotPink,           0xFF69B4},    {XML_indianRed,         0xCD5C5C},
-        {XML_indigo,            0x4B0082},    {XML_ivory,             0xFFFFF0},
-        {XML_khaki,             0xF0E68C},    {XML_lavender,          0xE6E6FA},
-        {XML_lavenderBlush,     0xFFF0F5},    {XML_lawnGreen,         0x7CFC00},
-        {XML_lemonChiffon,      0xFFFACD},    {XML_lime,              0x00FF00},
-        {XML_limeGreen,         0x32CD32},    {XML_linen,             0xFAF0E6},
-        {XML_ltBlue,            0xADD8E6},    {XML_ltCoral,           0xF08080},
-        {XML_ltCyan,            0xE0FFFF},    {XML_ltGoldenrodYellow, 0xFAFA78},
-        {XML_ltGray,            0xD3D3D3},    {XML_ltGreen,           0x90EE90},
-        {XML_ltPink,            0xFFB6C1},    {XML_ltSalmon,          0xFFA07A},
-        {XML_ltSeaGreen,        0x20B2AA},    {XML_ltSkyBlue,         0x87CEFA},
-        {XML_ltSlateGray,       0x778899},    {XML_ltSteelBlue,       0xB0C4DE},
-        {XML_ltYellow,          0xFFFFE0},    {XML_magenta,           0xFF00FF},
-        {XML_maroon,            0x800000},    {XML_medAquamarine,     0x66CDAA},
-        {XML_medBlue,           0x0000CD},    {XML_medOrchid,         0xBA55D3},
-        {XML_medPurple,         0x9370DB},    {XML_medSeaGreen,       0x3CB371},
-        {XML_medSlateBlue,      0x7B68EE},    {XML_medSpringGreen,    0x00FA9A},
-        {XML_medTurquoise,      0x48D1CC},    {XML_medVioletRed,      0xC71585},
-        {XML_midnightBlue,      0x191970},    {XML_mintCream,         0xF5FFFA},
-        {XML_mistyRose,         0xFFE4E1},    {XML_moccasin,          0xFFE4B5},
-        {XML_navajoWhite,       0xFFDEAD},    {XML_navy,              0x000080},
-        {XML_oldLace,           0xFDF5E6},    {XML_olive,             0x808000},
-        {XML_oliveDrab,         0x6B8E23},    {XML_orange,            0xFFA500},
-        {XML_orangeRed,         0xFF4500},    {XML_orchid,            0xDA70D6},
-        {XML_paleGoldenrod,     0xEEE8AA},    {XML_paleGreen,         0x98FB98},
-        {XML_paleTurquoise,     0xAFEEEE},    {XML_paleVioletRed,     0xDB7093},
-        {XML_papayaWhip,        0xFFEFD5},    {XML_peachPuff,         0xFFDAB9},
-        {XML_peru,              0xCD853F},    {XML_pink,              0xFFC0CB},
-        {XML_plum,              0xDDA0DD},    {XML_powderBlue,        0xB0E0E6},
-        {XML_purple,            0x800080},    {XML_red,               0xFF0000},
-        {XML_rosyBrown,         0xBC8F8F},    {XML_royalBlue,         0x4169E1},
-        {XML_saddleBrown,       0x8B4513},    {XML_salmon,            0xFA8072},
-        {XML_sandyBrown,        0xF4A460},    {XML_seaGreen,          0x2E8B57},
-        {XML_seaShell,          0xFFF5EE},    {XML_sienna,            0xA0522D},
-        {XML_silver,            0xC0C0C0},    {XML_skyBlue,           0x87CEEB},
-        {XML_slateBlue,         0x6A5ACD},    {XML_slateGray,         0x708090},
-        {XML_snow,              0xFFFAFA},    {XML_springGreen,       0x00FF7F},
-        {XML_steelBlue,         0x4682B4},    {XML_tan,               0xD2B48C},
-        {XML_teal,              0x008080},    {XML_thistle,           0xD8BFD8},
-        {XML_tomato,            0xFF6347},    {XML_turquoise,         0x40E0D0},
-        {XML_violet,            0xEE82EE},    {XML_wheat,             0xF5DEB3},
-        {XML_white,             0xFFFFFF},    {XML_whiteSmoke,        0xF5F5F5},
-        {XML_yellow,            0xFFFF00},    {XML_yellowGreen,       0x9ACD32}
+        {XML_aliceBlue,         ::Color(0xF0F8FF)},    {XML_antiqueWhite,      ::Color(0xFAEBD7)},
+        {XML_aqua,              ::Color(0x00FFFF)},    {XML_aquamarine,        ::Color(0x7FFFD4)},
+        {XML_azure,             ::Color(0xF0FFFF)},    {XML_beige,             ::Color(0xF5F5DC)},
+        {XML_bisque,            ::Color(0xFFE4C4)},    {XML_black,             ::Color(0x000000)},
+        {XML_blanchedAlmond,    ::Color(0xFFEBCD)},    {XML_blue,              ::Color(0x0000FF)},
+        {XML_blueViolet,        ::Color(0x8A2BE2)},    {XML_brown,             ::Color(0xA52A2A)},
+        {XML_burlyWood,         ::Color(0xDEB887)},    {XML_cadetBlue,         ::Color(0x5F9EA0)},
+        {XML_chartreuse,        ::Color(0x7FFF00)},    {XML_chocolate,         ::Color(0xD2691E)},
+        {XML_coral,             ::Color(0xFF7F50)},    {XML_cornflowerBlue,    ::Color(0x6495ED)},
+        {XML_cornsilk,          ::Color(0xFFF8DC)},    {XML_crimson,           ::Color(0xDC143C)},
+        {XML_cyan,              ::Color(0x00FFFF)},    {XML_deepPink,          ::Color(0xFF1493)},
+        {XML_deepSkyBlue,       ::Color(0x00BFFF)},    {XML_dimGray,           ::Color(0x696969)},
+        {XML_dkBlue,            ::Color(0x00008B)},    {XML_dkCyan,            ::Color(0x008B8B)},
+        {XML_dkGoldenrod,       ::Color(0xB8860B)},    {XML_dkGray,            ::Color(0xA9A9A9)},
+        {XML_dkGreen,           ::Color(0x006400)},    {XML_dkKhaki,           ::Color(0xBDB76B)},
+        {XML_dkMagenta,         ::Color(0x8B008B)},    {XML_dkOliveGreen,      ::Color(0x556B2F)},
+        {XML_dkOrange,          ::Color(0xFF8C00)},    {XML_dkOrchid,          ::Color(0x9932CC)},
+        {XML_dkRed,             ::Color(0x8B0000)},    {XML_dkSalmon,          ::Color(0xE9967A)},
+        {XML_dkSeaGreen,        ::Color(0x8FBC8B)},    {XML_dkSlateBlue,       ::Color(0x483D8B)},
+        {XML_dkSlateGray,       ::Color(0x2F4F4F)},    {XML_dkTurquoise,       ::Color(0x00CED1)},
+        {XML_dkViolet,          ::Color(0x9400D3)},    {XML_dodgerBlue,        ::Color(0x1E90FF)},
+        {XML_firebrick,         ::Color(0xB22222)},    {XML_floralWhite,       ::Color(0xFFFAF0)},
+        {XML_forestGreen,       ::Color(0x228B22)},    {XML_fuchsia,           ::Color(0xFF00FF)},
+        {XML_gainsboro,         ::Color(0xDCDCDC)},    {XML_ghostWhite,        ::Color(0xF8F8FF)},
+        {XML_gold,              ::Color(0xFFD700)},    {XML_goldenrod,         ::Color(0xDAA520)},
+        {XML_gray,              ::Color(0x808080)},    {XML_green,             ::Color(0x008000)},
+        {XML_greenYellow,       ::Color(0xADFF2F)},    {XML_honeydew,          ::Color(0xF0FFF0)},
+        {XML_hotPink,           ::Color(0xFF69B4)},    {XML_indianRed,         ::Color(0xCD5C5C)},
+        {XML_indigo,            ::Color(0x4B0082)},    {XML_ivory,             ::Color(0xFFFFF0)},
+        {XML_khaki,             ::Color(0xF0E68C)},    {XML_lavender,          ::Color(0xE6E6FA)},
+        {XML_lavenderBlush,     ::Color(0xFFF0F5)},    {XML_lawnGreen,         ::Color(0x7CFC00)},
+        {XML_lemonChiffon,      ::Color(0xFFFACD)},    {XML_lime,              ::Color(0x00FF00)},
+        {XML_limeGreen,         ::Color(0x32CD32)},    {XML_linen,             ::Color(0xFAF0E6)},
+        {XML_ltBlue,            ::Color(0xADD8E6)},    {XML_ltCoral,           ::Color(0xF08080)},
+        {XML_ltCyan,            ::Color(0xE0FFFF)},    {XML_ltGoldenrodYellow, ::Color(0xFAFA78)},
+        {XML_ltGray,            ::Color(0xD3D3D3)},    {XML_ltGreen,           ::Color(0x90EE90)},
+        {XML_ltPink,            ::Color(0xFFB6C1)},    {XML_ltSalmon,          ::Color(0xFFA07A)},
+        {XML_ltSeaGreen,        ::Color(0x20B2AA)},    {XML_ltSkyBlue,         ::Color(0x87CEFA)},
+        {XML_ltSlateGray,       ::Color(0x778899)},    {XML_ltSteelBlue,       ::Color(0xB0C4DE)},
+        {XML_ltYellow,          ::Color(0xFFFFE0)},    {XML_magenta,           ::Color(0xFF00FF)},
+        {XML_maroon,            ::Color(0x800000)},    {XML_medAquamarine,     ::Color(0x66CDAA)},
+        {XML_medBlue,           ::Color(0x0000CD)},    {XML_medOrchid,         ::Color(0xBA55D3)},
+        {XML_medPurple,         ::Color(0x9370DB)},    {XML_medSeaGreen,       ::Color(0x3CB371)},
+        {XML_medSlateBlue,      ::Color(0x7B68EE)},    {XML_medSpringGreen,    ::Color(0x00FA9A)},
+        {XML_medTurquoise,      ::Color(0x48D1CC)},    {XML_medVioletRed,      ::Color(0xC71585)},
+        {XML_midnightBlue,      ::Color(0x191970)},    {XML_mintCream,         ::Color(0xF5FFFA)},
+        {XML_mistyRose,         ::Color(0xFFE4E1)},    {XML_moccasin,          ::Color(0xFFE4B5)},
+        {XML_navajoWhite,       ::Color(0xFFDEAD)},    {XML_navy,              ::Color(0x000080)},
+        {XML_oldLace,           ::Color(0xFDF5E6)},    {XML_olive,             ::Color(0x808000)},
+        {XML_oliveDrab,         ::Color(0x6B8E23)},    {XML_orange,            ::Color(0xFFA500)},
+        {XML_orangeRed,         ::Color(0xFF4500)},    {XML_orchid,            ::Color(0xDA70D6)},
+        {XML_paleGoldenrod,     ::Color(0xEEE8AA)},    {XML_paleGreen,         ::Color(0x98FB98)},
+        {XML_paleTurquoise,     ::Color(0xAFEEEE)},    {XML_paleVioletRed,     ::Color(0xDB7093)},
+        {XML_papayaWhip,        ::Color(0xFFEFD5)},    {XML_peachPuff,         ::Color(0xFFDAB9)},
+        {XML_peru,              ::Color(0xCD853F)},    {XML_pink,              ::Color(0xFFC0CB)},
+        {XML_plum,              ::Color(0xDDA0DD)},    {XML_powderBlue,        ::Color(0xB0E0E6)},
+        {XML_purple,            ::Color(0x800080)},    {XML_red,               ::Color(0xFF0000)},
+        {XML_rosyBrown,         ::Color(0xBC8F8F)},    {XML_royalBlue,         ::Color(0x4169E1)},
+        {XML_saddleBrown,       ::Color(0x8B4513)},    {XML_salmon,            ::Color(0xFA8072)},
+        {XML_sandyBrown,        ::Color(0xF4A460)},    {XML_seaGreen,          ::Color(0x2E8B57)},
+        {XML_seaShell,          ::Color(0xFFF5EE)},    {XML_sienna,            ::Color(0xA0522D)},
+        {XML_silver,            ::Color(0xC0C0C0)},    {XML_skyBlue,           ::Color(0x87CEEB)},
+        {XML_slateBlue,         ::Color(0x6A5ACD)},    {XML_slateGray,         ::Color(0x708090)},
+        {XML_snow,              ::Color(0xFFFAFA)},    {XML_springGreen,       ::Color(0x00FF7F)},
+        {XML_steelBlue,         ::Color(0x4682B4)},    {XML_tan,               ::Color(0xD2B48C)},
+        {XML_teal,              ::Color(0x008080)},    {XML_thistle,           ::Color(0xD8BFD8)},
+        {XML_tomato,            ::Color(0xFF6347)},    {XML_turquoise,         ::Color(0x40E0D0)},
+        {XML_violet,            ::Color(0xEE82EE)},    {XML_wheat,             ::Color(0xF5DEB3)},
+        {XML_white,             ::Color(0xFFFFFF)},    {XML_whiteSmoke,        ::Color(0xF5F5F5)},
+        {XML_yellow,            ::Color(0xFFFF00)},    {XML_yellowGreen,       ::Color(0x9ACD32)}
     };
     for(auto const& nEntry : spnDmlColors)
         maDmlColors[ static_cast< size_t >(nEntry.first) ] = nEntry.second;
 
     // predefined colors in VML (map XML token identifiers to RGB values)
-    static const std::pair<sal_Int32, sal_Int32> spnVmlColors[] =
+    static const std::pair<sal_Int32, ::Color> spnVmlColors[] =
     {
-        {XML_aqua,              0x00FFFF},    {XML_black,             0x000000},
-        {XML_blue,              0x0000FF},    {XML_fuchsia,           0xFF00FF},
-        {XML_gray,              0x808080},    {XML_green,             0x008000},
-        {XML_lime,              0x00FF00},    {XML_maroon,            0x800000},
-        {XML_navy,              0x000080},    {XML_olive,             0x808000},
-        {XML_purple,            0x800080},    {XML_red,               0xFF0000},
-        {XML_silver,            0xC0C0C0},    {XML_teal,              0x008080},
-        {XML_white,             0xFFFFFF},    {XML_yellow,            0xFFFF00}
+        {XML_aqua,              ::Color(0x00FFFF)},    {XML_black,             ::Color(0x000000)},
+        {XML_blue,              ::Color(0x0000FF)},    {XML_fuchsia,           ::Color(0xFF00FF)},
+        {XML_gray,              ::Color(0x808080)},    {XML_green,             ::Color(0x008000)},
+        {XML_lime,              ::Color(0x00FF00)},    {XML_maroon,            ::Color(0x800000)},
+        {XML_navy,              ::Color(0x000080)},    {XML_olive,             ::Color(0x808000)},
+        {XML_purple,            ::Color(0x800080)},    {XML_red,               ::Color(0xFF0000)},
+        {XML_silver,            ::Color(0xC0C0C0)},    {XML_teal,              ::Color(0x008080)},
+        {XML_white,             ::Color(0xFFFFFF)},    {XML_yellow,            ::Color(0xFFFF00)}
     };
     for(auto const& nEntry : spnVmlColors)
         maVmlColors[ static_cast< size_t >(nEntry.first) ] = nEntry.second;
@@ -145,11 +145,11 @@ struct StaticPresetColorsPool : public ::rtl::Static< PresetColorsPool, StaticPr
 const double DEC_GAMMA          = 2.3;
 const double INC_GAMMA          = 1.0 / DEC_GAMMA;
 
-inline void lclRgbToRgbComponents( sal_Int32& ornR, sal_Int32& ornG, sal_Int32& ornB, sal_Int32 nRgb )
+inline void lclRgbToRgbComponents( sal_Int32& ornR, sal_Int32& ornG, sal_Int32& ornB, ::Color nRgb )
 {
-    ornR = (nRgb >> 16) & 0xFF;
-    ornG = (nRgb >> 8) & 0xFF;
-    ornB = nRgb & 0xFF;
+    ornR = nRgb.GetRed();
+    ornG = nRgb.GetGreen();
+    ornB = nRgb.GetBlue();
 }
 
 inline sal_Int32 lclRgbComponentsToRgb( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB )
@@ -202,22 +202,22 @@ Color::Color() :
 {
 }
 
-sal_Int32 Color::getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
+::Color Color::getDmlPresetColor( sal_Int32 nToken, ::Color nDefaultRgb )
 {
     /*  Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
         able to catch the existing vector entries without corresponding XML
         token identifier. */
-    sal_Int32 nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maDmlColors, nToken, API_RGB_TRANSPARENT );
-    return (nRgbValue >= 0) ? nRgbValue : nDefaultRgb;
+    ::Color nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maDmlColors, nToken, API_RGB_TRANSPARENT );
+    return (sal_Int32(nRgbValue) >= 0) ? nRgbValue : nDefaultRgb;
 }
 
-sal_Int32 Color::getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb )
+::Color Color::getVmlPresetColor( sal_Int32 nToken, ::Color nDefaultRgb )
 {
     /*  Do not pass nDefaultRgb to ContainerHelper::getVectorElement(), to be
         able to catch the existing vector entries without corresponding XML
         token identifier. */
-    sal_Int32 nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maVmlColors, nToken, API_RGB_TRANSPARENT );
-    return (nRgbValue >= 0) ? nRgbValue : nDefaultRgb;
+    ::Color nRgbValue = ContainerHelper::getVectorElement( StaticPresetColorsPool::get().maVmlColors, nToken, API_RGB_TRANSPARENT );
+    return (sal_Int32(nRgbValue) >= 0) ? nRgbValue : nDefaultRgb;
 }
 
 void Color::setUnused()
@@ -225,11 +225,16 @@ void Color::setUnused()
     meMode = COLOR_UNUSED;
 }
 
+void Color::setSrgbClr( ::Color nRgb )
+{
+    setSrgbClr(sal_Int32(nRgb));
+}
+
 void Color::setSrgbClr( sal_Int32 nRgb )
 {
     OSL_ENSURE( (0 <= nRgb) && (nRgb <= 0xFFFFFF), "Color::setSrgbClr - invalid RGB value" );
     meMode = COLOR_RGB;
-    lclRgbToRgbComponents( mnC1, mnC2, mnC3, nRgb );
+    lclRgbToRgbComponents( mnC1, mnC2, mnC3, ::Color(nRgb) );
 }
 
 void Color::setScrgbClr( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB )
@@ -256,9 +261,9 @@ void Color::setHslClr( sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum )
 
 void Color::setPrstClr( sal_Int32 nToken )
 {
-    sal_Int32 nRgbValue = getDmlPresetColor( nToken, API_RGB_TRANSPARENT );
-    OSL_ENSURE( nRgbValue >= 0, "Color::setPrstClr - invalid preset color token" );
-    if( nRgbValue >= 0 )
+    ::Color nRgbValue = getDmlPresetColor( nToken, API_RGB_TRANSPARENT );
+    OSL_ENSURE( sal_Int32(nRgbValue) >= 0, "Color::setPrstClr - invalid preset color token" );
+    if( sal_Int32(nRgbValue) >= 0 )
         setSrgbClr( nRgbValue );
 }
 
@@ -430,7 +435,7 @@ void Color::clearTransparence()
     mnAlpha = MAX_PERCENT;
 }
 
-sal_Int32 Color::getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr ) const
+::Color Color::getColor( const GraphicHelper& rGraphicHelper, ::Color nPhClr ) const
 {
     const sal_Int32 nTempC1 = mnC1;
     const sal_Int32 nTempC2 = mnC2;
@@ -439,7 +444,7 @@ sal_Int32 Color::getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr
 
     switch( meMode )
     {
-        case COLOR_UNUSED:  mnC1 = API_RGB_TRANSPARENT; break;
+        case COLOR_UNUSED:  mnC1 = sal_Int32(API_RGB_TRANSPARENT); break;
 
         case COLOR_RGB:     break;  // nothing to do
         case COLOR_CRGB:    break;  // nothing to do
@@ -447,10 +452,10 @@ sal_Int32 Color::getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr
 
         case COLOR_SCHEME:  setResolvedRgb( rGraphicHelper.getSchemeColor( mnC1 ) );        break;
         case COLOR_PALETTE: setResolvedRgb( rGraphicHelper.getPaletteColor( mnC1 ) );       break;
-        case COLOR_SYSTEM:  setResolvedRgb( rGraphicHelper.getSystemColor( mnC1, mnC2 ) );  break;
+        case COLOR_SYSTEM:  setResolvedRgb( rGraphicHelper.getSystemColor( mnC1, ::Color(mnC2) ) );  break;
         case COLOR_PH:      setResolvedRgb( nPhClr );                                       break;
 
-        case COLOR_FINAL:   return mnC1;
+        case COLOR_FINAL:   return ::Color(mnC1);
     }
 
     // if color is UNUSED or turns to UNUSED in setResolvedRgb, do not perform transformations
@@ -580,7 +585,7 @@ sal_Int32 Color::getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr
     }
     else // if( meMode != COLOR_UNUSED )
     {
-        mnC1 = API_RGB_TRANSPARENT;
+        mnC1 = sal_Int32(API_RGB_TRANSPARENT);
     }
 
     sal_Int32 nRet = mnC1;
@@ -599,7 +604,7 @@ sal_Int32 Color::getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr
     }
     if( meMode == COLOR_FINAL )
         maTransforms.clear();
-    return nRet;
+    return ::Color(nRet);
 }
 
 bool Color::hasTransparency() const
@@ -614,9 +619,9 @@ sal_Int16 Color::getTransparency() const
 
 // private --------------------------------------------------------------------
 
-void Color::setResolvedRgb( sal_Int32 nRgb ) const
+void Color::setResolvedRgb( ::Color nRgb ) const
 {
-    meMode = (nRgb < 0) ? COLOR_UNUSED : COLOR_RGB;
+    meMode = (sal_Int32(nRgb) < 0) ? COLOR_UNUSED : COLOR_RGB;
     lclRgbToRgbComponents( mnC1, mnC2, mnC3, nRgb );
 }
 
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 5ecdb5a9ba1e..7f6a7044a386 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -60,16 +60,16 @@ namespace drawingml {
 namespace {
 
 Reference< XGraphic > lclCheckAndApplyDuotoneTransform( const BlipFillProperties& aBlipProps, Reference< XGraphic > const & xGraphic,
-                                                        const GraphicHelper& rGraphicHelper, const sal_Int32 nPhClr )
+                                                        const GraphicHelper& rGraphicHelper, const ::Color nPhClr )
 {
     if( aBlipProps.maDuotoneColors[0].isUsed() && aBlipProps.maDuotoneColors[1].isUsed() )
     {
-        sal_Int32 nColor1 = aBlipProps.maDuotoneColors[0].getColor( rGraphicHelper, nPhClr );
-        sal_Int32 nColor2 = aBlipProps.maDuotoneColors[1].getColor( rGraphicHelper, nPhClr );
+        ::Color nColor1 = aBlipProps.maDuotoneColors[0].getColor( rGraphicHelper, nPhClr );
+        ::Color nColor2 = aBlipProps.maDuotoneColors[1].getColor( rGraphicHelper, nPhClr );
         try
         {
             Reference< XGraphicTransformer > xTransformer( aBlipProps.mxGraphic, UNO_QUERY_THROW );
-            return xTransformer->applyDuotone( xGraphic, nColor1, nColor2 );
+            return xTransformer->applyDuotone( xGraphic, sal_Int32(nColor1), sal_Int32(nColor2) );
         }
         catch( Exception& )
         {
@@ -79,18 +79,18 @@ Reference< XGraphic > lclCheckAndApplyDuotoneTransform( const BlipFillProperties
 }
 
 Reference< XGraphic > lclCheckAndApplyChangeColorTransform( const BlipFillProperties &aBlipProps, Reference< XGraphic >  const & xGraphic,
-                                                            const GraphicHelper& rGraphicHelper, const sal_Int32 nPhClr )
+                                                            const GraphicHelper& rGraphicHelper, const ::Color nPhClr )
 {
     if( aBlipProps.maColorChangeFrom.isUsed() && aBlipProps.maColorChangeTo.isUsed() )
     {
-        sal_Int32 nFromColor = aBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );
-        sal_Int32 nToColor = aBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr );
+        ::Color nFromColor = aBlipProps.maColorChangeFrom.getColor( rGraphicHelper, nPhClr );
+        ::Color nToColor = aBlipProps.maColorChangeTo.getColor( rGraphicHelper, nPhClr );
         if ( (nFromColor != nToColor) || aBlipProps.maColorChangeTo.hasTransparency() ) try
         {
             sal_Int16 nToTransparence = aBlipProps.maColorChangeTo.getTransparency();
             sal_Int8 nToAlpha = static_cast< sal_Int8 >( (100 - nToTransparence) * 2.55 );
             Reference< XGraphicTransformer > xTransformer( aBlipProps.mxGraphic, UNO_QUERY_THROW );
-            return xTransformer->colorChange( xGraphic, nFromColor, 9, nToColor, nToAlpha );
+            return xTransformer->colorChange( xGraphic, sal_Int32(nFromColor), 9, sal_Int32(nToColor), nToAlpha );
         }
         catch( Exception& )
         {
@@ -244,10 +244,10 @@ Color FillProperties::getBestSolidColor() const
 }
 
 /// Maps the hatch token to drawing::Hatch.
-static drawing::Hatch createHatch( sal_Int32 nHatchToken, sal_Int32 nColor )
+static drawing::Hatch createHatch( sal_Int32 nHatchToken, ::Color nColor )
 {
     drawing::Hatch aHatch;
-    aHatch.Color = nColor;
+    aHatch.Color = sal_Int32(nColor);
 
     // best-effort mapping; we do not support all the styles in core
     switch ( nHatchToken )
@@ -312,7 +312,7 @@ static drawing::Hatch createHatch( sal_Int32 nHatchToken, sal_Int32 nColor )
 }
 
 void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
-        const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, sal_Int32 nPhClr,
+        const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, ::Color nPhClr,
         bool bFlipH, bool bFlipV ) const
 {
     if( moFillType.has() )
@@ -349,8 +349,8 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                     // Old code, values in aGradient overwritten in many cases by newer code below
                     if( maGradientProps.maGradientStops.size() > 1 )
                     {
-                        aGradient.StartColor = maGradientProps.maGradientStops.begin()->second.getColor( rGraphicHelper, nPhClr );
-                        aGradient.EndColor = maGradientProps.maGradientStops.rbegin()->second.getColor( rGraphicHelper, nPhClr );
+                        aGradient.StartColor = sal_Int32(maGradientProps.maGradientStops.begin()->second.getColor( rGraphicHelper, nPhClr ));
+                        aGradient.EndColor = sal_Int32(maGradientProps.maGradientStops.rbegin()->second.getColor( rGraphicHelper, nPhClr ));
                         if( maGradientProps.maGradientStops.rbegin()->second.hasTransparency() )
                             nEndTrans = maGradientProps.maGradientStops.rbegin()->second.getTransparency()*255/100;
                         if( maGradientProps.maGradientStops.begin()->second.hasTransparency() )
@@ -444,7 +444,7 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                              ++p)
                             SAL_INFO("oox.drawingml.gradient", "  " << std::distance(aGradientStops.begin(), p) << ": " <<
                                      p->first << ": " <<
-                                     std::hex << p->second.getColor( rGraphicHelper, nPhClr ) << std::dec <<
+                                     std::hex << sal_Int32(p->second.getColor( rGraphicHelper, nPhClr )) << std::dec <<
                                      "@" << (100-p->second.getTransparency()) << "%");
 
                         // Now estimate the simple LO style gradient (only two stops, at n% and 100%, where n ==
@@ -562,13 +562,13 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
                             aEndColor = std::next(aWidestSegmentStart)->second;
                         }
 
-                        SAL_INFO("oox.drawingml.gradient", "start color: " << std::hex << aStartColor.getColor( rGraphicHelper, nPhClr ) << std::dec <<
+                        SAL_INFO("oox.drawingml.gradient", "start color: " << std::hex << sal_Int32(aStartColor.getColor( rGraphicHelper, nPhClr )) << std::dec <<
                                  "@" << (100-aStartColor.getTransparency()) << "%"
-                                 ", end color: " << std::hex << aEndColor.getColor( rGraphicHelper, nPhClr ) << std::dec <<
+                                 ", end color: " << std::hex << sal_Int32(aEndColor.getColor( rGraphicHelper, nPhClr )) << std::dec <<
                                  "@" << (100-aEndColor.getTransparency()) << "%");
 
-                        aGradient.StartColor = aStartColor.getColor( rGraphicHelper, nPhClr );
-                        aGradient.EndColor = aEndColor.getColor( rGraphicHelper, nPhClr );
+                        aGradient.StartColor = sal_Int32(aStartColor.getColor( rGraphicHelper, nPhClr ));
+                        aGradient.EndColor = sal_Int32(aEndColor.getColor( rGraphicHelper, nPhClr ));
 
                         if( aStartColor.hasTransparency() )
                             nStartTrans = aStartColor.getTransparency()*255/100;
diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx
index 573155be1f29..25bbbcd25f1e 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -368,7 +368,7 @@ void LineProperties::assignUsed( const LineProperties& rSourceProps )
 }
 
 void LineProperties::pushToPropMap( ShapePropertyMap& rPropMap,
-        const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr ) const
+        const GraphicHelper& rGraphicHelper, ::Color nPhClr ) const
 {
     // line fill type must exist, otherwise ignore other properties
     if( maLineFill.moFillType.has() )
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index c1944ee7743a..6d83c68e3df2 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -692,8 +692,8 @@ Reference< XShape > const & Shape::createAndInsert(
 
         const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();
 
-        sal_Int32 nLinePhClr = -1;
-        sal_Int32 nFillPhClr = -1;
+        ::Color nLinePhClr(0xffffffff);
+        ::Color nFillPhClr(0xffffffff);
         // TODO: use ph color when applying effect properties
         //sal_Int32 nEffectPhClr = -1;
 
@@ -1170,7 +1170,7 @@ Reference< XShape > const & Shape::createAndInsert(
             // character color on the shape, then.
             if(const ShapeStyleRef* pFontRef = getShapeStyleRef(XML_fontRef))
             {
-                sal_Int32 nCharColor = pFontRef->maPhClr.getColor(rGraphicHelper);
+                ::Color nCharColor = pFontRef->maPhClr.getColor(rGraphicHelper);
                 aPropertySet.setAnyProperty(PROP_CharColor, uno::makeAny(nCharColor));
             }
         }
diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx
index c54e3b5b94ab..09cbff171006 100644
--- a/oox/source/drawingml/shape3dproperties.cxx
+++ b/oox/source/drawingml/shape3dproperties.cxx
@@ -319,7 +319,7 @@ css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getBevelAttri
 }
 
 css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getColorAttributes(
-        const Color& rColor, const GraphicHelper& rGraphicHelper, sal_Int32 rPhClr )
+        const Color& rColor, const GraphicHelper& rGraphicHelper, ::Color rPhClr )
 {
     css::uno::Sequence<css::beans::PropertyValue> aSeq(2);
     const OUString& sColorScheme = rColor.getSchemeName();
@@ -343,7 +343,7 @@ css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getColorAttri
 }
 
 css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getShape3DAttributes(
-        const GraphicHelper& rGraphicHelper, sal_Int32 rPhClr )
+        const GraphicHelper& rGraphicHelper, ::Color rPhClr )
 {
     css::uno::Sequence<css::beans::PropertyValue> aSeq(8);
     sal_Int32 nSize = 0;
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index c8cef8384435..3dc40ceafab9 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -77,7 +77,7 @@ void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
     if ( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ))
     {
         Color aColor = rLineProperties.maLineFill.getBestSolidColor();
-        aBorderLine.Color = aColor.getColor( rFilterBase.getGraphicHelper() );
+        aBorderLine.Color = sal_Int32(aColor.getColor( rFilterBase.getGraphicHelper() ));
         aBorderLine.OuterLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
         aBorderLine.InnerLineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 4 );
         aBorderLine.LineWidth = static_cast< sal_Int16 >( GetCoordinate( rLineProperties.moLineWidth.get( 0 ) ) / 2 );
@@ -148,7 +148,7 @@ void applyBorder( const ::oox::core::XmlFilterBase& rFilterBase, TableStylePart&
         if (const Theme* pTheme = rFilterBase.getCurrentTheme())
         {
             rLineProperties.assignUsed( *pTheme->getLineStyle(rLineStyleRef.mnThemedIdx) );
-            sal_Int32 nPhClr = rLineStyleRef.maPhClr.getColor( rFilterBase.getGraphicHelper() );
+            ::Color nPhClr = rLineStyleRef.maPhClr.getColor( rFilterBase.getGraphicHelper() );
             rLineProperties.maLineFill.maFillColor.setSrgbClr( nPhClr );
         }
     }
@@ -175,7 +175,7 @@ void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase,
         if (pTheme && rFillStyleRef.mnThemedIdx != 0 )
         {
             rFillProperties.assignUsed( *pTheme->getFillStyle( rFillStyleRef.mnThemedIdx ) );
-            sal_Int32 nPhClr = rFillStyleRef.maPhClr.getColor( rFilterBase.getGraphicHelper() );
+            ::Color nPhClr = rFillStyleRef.maPhClr.getColor( rFilterBase.getGraphicHelper() );
             rFillProperties.maFillColor.setSrgbClr( nPhClr );
         }
     }
@@ -429,7 +429,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, cons
     ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() );
 
     Color aBgColor;
-    sal_Int32 nPhClr = API_RGB_TRANSPARENT;
+    ::Color nPhClr = API_RGB_TRANSPARENT;
     std::shared_ptr< ::oox::drawingml::FillProperties >& rBackgroundFillPropertiesPtr( rTable.getBackgroundFillProperties() );
     ::oox::drawingml::ShapeStyleRef& rBackgroundFillStyle( rTable.getBackgroundFillStyleRef() );
     if (rBackgroundFillPropertiesPtr.get())
diff --git a/oox/source/export/ColorPropertySet.cxx b/oox/source/export/ColorPropertySet.cxx
index c55ca4936c82..af70f58c1066 100644
--- a/oox/source/export/ColorPropertySet.cxx
+++ b/oox/source/export/ColorPropertySet.cxx
@@ -83,7 +83,7 @@ namespace oox
 namespace drawingml
 {
 
-ColorPropertySet::ColorPropertySet( sal_Int32 nColor, bool bFillColor /* = true */ ) :
+ColorPropertySet::ColorPropertySet( ::Color nColor, bool bFillColor /* = true */ ) :
         // note: length of FillColor and LineColor is 9
         m_aColorPropName( (bFillColor ? "FillColor" : "LineColor"), 9, RTL_TEXTENCODING_ASCII_US ),
         m_nColor( nColor ),
diff --git a/oox/source/export/ColorPropertySet.hxx b/oox/source/export/ColorPropertySet.hxx
index 39bc41f22b6f..e1734422ac8c 100644
--- a/oox/source/export/ColorPropertySet.hxx
+++ b/oox/source/export/ColorPropertySet.hxx
@@ -23,6 +23,7 @@
 // FIXME? this file is identical to xmloff/source/chart/ColorPropertySet.hxx
 
 #include <cppuhelper/implbase.hxx>
+#include <tools/color.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/XPropertyState.hpp>
@@ -38,7 +39,7 @@ class ColorPropertySet : public ::cppu::WeakImplHelper<
 {
 public:
     // if bFillColor == false, the color is a LineColor
-    explicit ColorPropertySet( sal_Int32 nColor, bool bFillColor = true );
+    explicit ColorPropertySet( ::Color nColor, bool bFillColor = true );
     virtual ~ColorPropertySet() override;
 
 protected:
@@ -75,9 +76,9 @@ protected:
 private:
     css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;
     OUString         m_aColorPropName;
-    sal_Int32        m_nColor;
+    ::Color          m_nColor;
     bool             m_bIsFillColor;
-    sal_Int32        m_nDefaultColor;
+    ::Color          m_nDefaultColor;
 };
 
 } //  namespace chart
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 424d479b0090..207aa722333f 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3583,7 +3583,7 @@ void ChartExport::exportMarker(const Reference< chart2::XDataSeries >& xSeries)
             pFS->singleElement(FSNS(XML_a, XML_noFill), FSEND);
         }
         else
-            WriteSolidFill(aColor);
+            WriteSolidFill(::Color(aColor));
 
         pFS->endElement( FSNS( XML_c, XML_spPr ) );
     }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e055ca52a87a..093ed3c4ec24 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -178,10 +178,10 @@ bool DrawingML::GetPropertyAndState( const Reference< XPropertySet >& rXProperty
     return false;
 }
 
-void DrawingML::WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha )
+void DrawingML::WriteColor( ::Color nColor, sal_Int32 nAlpha )
 {
     // Transparency is a separate element.
-    OString sColor = OString::number(  nColor & 0x00FFFFFF, 16 );
+    OString sColor = OString::number(  sal_uInt32(nColor) & 0x00FFFFFF, 16 );
     if( sColor.getLength() < 6 )
     {
         OStringBuffer sBuf( "0" );
@@ -245,7 +245,7 @@ void DrawingML::WriteColorTransformations( const Sequence< PropertyValue >& aTra
     }
 }
 
-void DrawingML::WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha )
+void DrawingML::WriteSolidFill( ::Color nColor, sal_Int32 nAlpha )
 {
     mpFS->startElementNS( XML_a, XML_solidFill, FSEND );
     WriteColor( nColor, nAlpha );
@@ -300,7 +300,7 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
     if ( nFillColor != nOriginalColor )
     {
         // the user has set a different color for the shape
-        WriteSolidFill( nFillColor & 0xffffff, nAlpha );
+        WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha );
     }
     else if ( !sColorFillScheme.isEmpty() )
     {
@@ -320,18 +320,18 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
         }
         if ( nFillColor != nThemeColor )
             // the shape contains a theme but it wasn't being used
-            WriteSolidFill( nFillColor & 0xffffff, nAlpha );
+            WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha );
         // in case the shape used the style color and the user didn't change it,
         // we must not write a <a: solidFill> tag.
     }
     else
     {
         // the shape had a custom color and the user didn't change it
-        WriteSolidFill( nFillColor & 0xffffff, nAlpha );
+        WriteSolidFill( ::Color(nFillColor & 0xffffff), nAlpha );
     }
 }
 
-void DrawingML::WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor )
+void DrawingML::WriteGradientStop( sal_uInt16 nStop, ::Color nColor )
 {
     mpFS->startElementNS( XML_a, XML_gs,
                           XML_pos, I32S( nStop * 1000 ),
@@ -340,11 +340,11 @@ void DrawingML::WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor )
     mpFS->endElementNS( XML_a, XML_gs );
 }
 
-sal_uInt32 DrawingML::ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity )
+::Color DrawingML::ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity )
 {
-    return ( ( ( nColor & 0xff ) * nIntensity ) / 100 )
+    return ::Color(( ( ( nColor & 0xff ) * nIntensity ) / 100 )
         | ( ( ( ( ( nColor & 0xff00 ) >> 8 ) * nIntensity ) / 100 ) << 8 )
-        | ( ( ( ( ( nColor & 0xff0000 ) >> 8 ) * nIntensity ) / 100 ) << 8 );
+        | ( ( ( ( ( nColor & 0xff0000 ) >> 8 ) * nIntensity ) / 100 ) << 8 ));
 }
 
 bool DrawingML::EqualGradients( awt::Gradient aGradient1, awt::Gradient aGradient2 )
@@ -417,7 +417,7 @@ void DrawingML::WriteGrabBagGradientFill( const Sequence< PropertyValue >& aGrad
         OUString sSchemeClr;
         double nPos = 0;
         sal_Int16 nTransparency = 0;
-        sal_Int32 nRgbClr = 0;
+        ::Color nRgbClr;
         Sequence< PropertyValue > aTransformations;
         for( sal_Int32 j=0; j < aGradientStop.getLength(); ++j )
         {
@@ -577,7 +577,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
     GET( aLineStyle, LineStyle );
 
     sal_uInt32 nLineWidth = 0;
-    sal_uInt32 nColor = 0;
+    ::Color nColor;
     sal_Int32 nColorAlpha = MAX_PERCENT;
     bool bColorSet = false;
     const char* cap = nullptr;
@@ -588,8 +588,8 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
     // get InteropGrabBag and search the relevant attributes
     OUString sColorFillScheme;
 
-    sal_uInt32 nOriginalColor = 0;
-    sal_uInt32 nStyleColor = 0;
+    ::Color nOriginalColor;
+    ::Color nStyleColor;
     sal_uInt32 nStyleLineWidth = 0;
 
     Sequence<PropertyValue> aStyleProperties;
@@ -655,7 +655,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
         default:
             if ( GETA( LineColor ) )
             {
-                nColor = mAny.get<sal_uInt32>() & 0xffffff;
+                nColor = ::Color(mAny.get<sal_uInt32>() & 0xffffff);
                 bColorSet = true;
             }
             if ( GETA( LineTransparence ) )
@@ -1310,7 +1310,7 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs
         mpFS->startElementNS( XML_a , XML_pattFill, XML_prst, GetHatchPattern(rHatch), FSEND );
 
         mpFS->startElementNS( XML_a , XML_fgClr, FSEND );
-        WriteColor(rHatch.Color);
+        WriteColor(::Color(rHatch.Color));
         mpFS->endElementNS( XML_a , XML_fgClr );
 
         ::Color nColor = COL_WHITE;
@@ -1332,7 +1332,7 @@ void DrawingML::WritePattFill(const Reference<XPropertySet>& rXPropSet, const cs
         }
 
         mpFS->startElementNS( XML_a , XML_bgClr, FSEND );
-        WriteColor(sal_uInt32(nColor), nAlpha);
+        WriteColor(nColor, nAlpha);
         mpFS->endElementNS( XML_a , XML_bgClr );
 
         mpFS->endElementNS( XML_a , XML_pattFill );
@@ -1738,14 +1738,14 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
     // mso doesn't like text color to be placed after typeface
     if( CGETAD( CharColor ) )
     {
-        sal_uInt32 color = *o3tl::doAccess<sal_uInt32>(mAny);
-        SAL_INFO("oox.shape", "run color: " << color << " auto: " << sal_uInt32(COL_AUTO));
+        ::Color color( *o3tl::doAccess<sal_uInt32>(mAny) );
+        SAL_INFO("oox.shape", "run color: " << sal_uInt32(color) << " auto: " << sal_uInt32(COL_AUTO));
 
         // tdf#104219 In LibreOffice and MS Office, there are two types of colors:
         // Automatic and Fixed. OOXML is setting automatic color, by not providing color.
-        if( color != sal_uInt32(COL_AUTO) )
+        if( color != COL_AUTO )
         {
-            color &= 0xffffff;
+            color.SetTransparency(0);
             // TODO: special handle embossed/engraved
             WriteSolidFill( color );
         }
@@ -1753,9 +1753,9 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool
 
     if( ( underline != nullptr ) && CGETAD( CharUnderlineColor ) )
     {
-        sal_uInt32 color = *o3tl::doAccess<sal_uInt32>(mAny);
+        ::Color color = ::Color(*o3tl::doAccess<sal_uInt32>(mAny));
         // if color is automatic, then we shouldn't write information about color but to take color from character
-        if( color != sal_uInt32(COL_AUTO) )
+        if( color != COL_AUTO )
         {
             mpFS->startElementNS( XML_a, XML_uFill, FSEND);
             WriteSolidFill( color );
@@ -2078,7 +2078,7 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
     uno::Reference<graphic::XGraphic> xGraphic;
     sal_Int16 nBulletRelSize = 0;
     sal_Int16 nStartWith = 1;
-    sal_uInt32 nBulletColor = 0;
+    ::Color nBulletColor;
     bool bHasBulletColor = false;
     awt::Size aGraphicSize;
 
@@ -2105,7 +2105,7 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
         }
         else if(aPropName == "BulletColor")
         {
-            nBulletColor = *o3tl::doAccess<sal_uInt32>(pPropValue[i].Value);
+            nBulletColor = ::Color(*o3tl::doAccess<sal_uInt32>(pPropValue[i].Value));
             bHasBulletColor = true;
         }
         else if ( aPropName == "BulletChar" )
@@ -2196,9 +2196,9 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
     {
         if(bHasBulletColor)
         {
-               if (nBulletColor == sal_uInt32(COL_AUTO) )
+               if (nBulletColor == COL_AUTO )
                {
-                   nBulletColor = mbIsBackgroundDark ? 0xffffff : 0x000000;
+                   nBulletColor = ::Color(mbIsBackgroundDark ? 0xffffff : 0x000000);
                }
                mpFS->startElementNS( XML_a, XML_buClr, FSEND );
                WriteColor( nBulletColor );
@@ -3252,7 +3252,7 @@ void DrawingML::WriteShapeEffect( const OUString& sName, const Sequence< Propert
         nEffectToken = FSNS( XML_a, XML_blur );
 
     OUString sSchemeClr;
-    sal_uInt32 nRgbClr = 0;
+    ::Color nRgbClr;
     sal_Int32 nAlpha = MAX_PERCENT;
     Sequence< PropertyValue > aTransformations;
     sax_fastparser::FastAttributeList *aOuterShdwAttrList = FastSerializerHelper::createAttrList();
@@ -3754,7 +3754,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet )
     if( aExtrusionColorProps.getLength() > 0 )
     {
         OUString sSchemeClr;
-        sal_Int32 nColor(0);
+        ::Color nColor;
         sal_Int32 nTransparency(0);
         Sequence< PropertyValue > aColorTransformations;
         for( sal_Int32 i=0; i < aExtrusionColorProps.getLength(); ++i )
@@ -3780,7 +3780,7 @@ void DrawingML::WriteShape3DEffects( const Reference< XPropertySet >& xPropSet )
     if( aContourColorProps.getLength() > 0 )
     {
         OUString sSchemeClr;
-        sal_Int32 nColor(0);
+        ::Color nColor;
         sal_Int32 nTransparency(0);
         Sequence< PropertyValue > aColorTransformations;
         for( sal_Int32 i=0; i < aContourColorProps.getLength(); ++i )
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 83b9ae72aeeb..21ceaa11440c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1764,7 +1764,7 @@ void ShapeExport::WriteTableCellBorders(const Reference< XPropertySet>& xCellPro
     if(nLeftBorder > 0)
     {
         mpFS->startElementNS( XML_a, XML_lnL, XML_w, I32S(nLeftBorder), FSEND );
-        DrawingML::WriteSolidFill(aLeftBorderColor);
+        DrawingML::WriteSolidFill(::Color(aLeftBorderColor));
         mpFS->endElementNS( XML_a, XML_lnL );
     }
 
@@ -1778,7 +1778,7 @@ void ShapeExport::WriteTableCellBorders(const Reference< XPropertySet>& xCellPro
     if(nRightBorder > 0)
     {
         mpFS->startElementNS( XML_a, XML_lnR, XML_w, I32S(nRightBorder), FSEND);
-        DrawingML::WriteSolidFill(aRightBorderColor);
+        DrawingML::WriteSolidFill(::Color(aRightBorderColor));
         mpFS->endElementNS( XML_a, XML_lnR);
     }
 
@@ -1792,7 +1792,7 @@ void ShapeExport::WriteTableCellBorders(const Reference< XPropertySet>& xCellPro
     if(nTopBorder > 0)
     {
         mpFS->startElementNS( XML_a, XML_lnT, XML_w, I32S(nTopBorder), FSEND);
-        DrawingML::WriteSolidFill(aTopBorderColor);
+        DrawingML::WriteSolidFill(::Color(aTopBorderColor));
         mpFS->endElementNS( XML_a, XML_lnT);
     }
 
@@ -1806,7 +1806,7 @@ void ShapeExport::WriteTableCellBorders(const Reference< XPropertySet>& xCellPro
     if(nBottomBorder > 0)
     {
         mpFS->startElementNS( XML_a, XML_lnB, XML_w, I32S(nBottomBorder), FSEND);
-        DrawingML::WriteSolidFill(aBottomBorderColor);
+        DrawingML::WriteSolidFill(::Color(aBottomBorderColor));
         mpFS->endElementNS( XML_a, XML_lnB);
     }
 }
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index 01f5b5290f93..076cd4dbdc27 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -72,36 +72,36 @@ GraphicHelper::GraphicHelper( const Reference< XComponentContext >& rxContext, c
         mxGraphicProvider.set( graphic::GraphicProvider::create( mxContext ), uno::UNO_QUERY );
 
     //! TODO: get colors from system
-    maSystemPalette[ XML_3dDkShadow ]               = 0x716F64;
-    maSystemPalette[ XML_3dLight ]                  = 0xF1EFE2;
-    maSystemPalette[ XML_activeBorder ]             = 0xD4D0C8;
-    maSystemPalette[ XML_activeCaption ]            = 0x0054E3;
-    maSystemPalette[ XML_appWorkspace ]             = 0x808080;
-    maSystemPalette[ XML_background ]               = 0x004E98;
-    maSystemPalette[ XML_btnFace ]                  = 0xECE9D8;
-    maSystemPalette[ XML_btnHighlight ]             = 0xFFFFFF;
-    maSystemPalette[ XML_btnShadow ]                = 0xACA899;
-    maSystemPalette[ XML_btnText ]                  = 0x000000;
-    maSystemPalette[ XML_captionText ]              = 0xFFFFFF;
-    maSystemPalette[ XML_gradientActiveCaption ]    = 0x3D95FF;
-    maSystemPalette[ XML_gradientInactiveCaption ]  = 0xD8E4F8;
-    maSystemPalette[ XML_grayText ]                 = 0xACA899;
-    maSystemPalette[ XML_highlight ]                = 0x316AC5;
-    maSystemPalette[ XML_highlightText ]            = 0xFFFFFF;
-    maSystemPalette[ XML_hotLight ]                 = 0x000080;
-    maSystemPalette[ XML_inactiveBorder ]           = 0xD4D0C8;
-    maSystemPalette[ XML_inactiveCaption ]          = 0x7A96DF;
-    maSystemPalette[ XML_inactiveCaptionText ]      = 0xD8E4F8;
-    maSystemPalette[ XML_infoBk ]                   = 0xFFFFE1;
-    maSystemPalette[ XML_infoText ]                 = 0x000000;
-    maSystemPalette[ XML_menu ]                     = 0xFFFFFF;
-    maSystemPalette[ XML_menuBar ]                  = 0xECE9D8;
-    maSystemPalette[ XML_menuHighlight ]            = 0x316AC5;
-    maSystemPalette[ XML_menuText ]                 = 0x000000;
-    maSystemPalette[ XML_scrollBar ]                = 0xD4D0C8;
-    maSystemPalette[ XML_window ]                   = 0xFFFFFF;
-    maSystemPalette[ XML_windowFrame ]              = 0x000000;
-    maSystemPalette[ XML_windowText ]               = 0x000000;
+    maSystemPalette[ XML_3dDkShadow ]               = Color(0x716F64);
+    maSystemPalette[ XML_3dLight ]                  = Color(0xF1EFE2);
+    maSystemPalette[ XML_activeBorder ]             = Color(0xD4D0C8);
+    maSystemPalette[ XML_activeCaption ]            = Color(0x0054E3);
+    maSystemPalette[ XML_appWorkspace ]             = Color(0x808080);
+    maSystemPalette[ XML_background ]               = Color(0x004E98);
+    maSystemPalette[ XML_btnFace ]                  = Color(0xECE9D8);
+    maSystemPalette[ XML_btnHighlight ]             = Color(0xFFFFFF);
+    maSystemPalette[ XML_btnShadow ]                = Color(0xACA899);
+    maSystemPalette[ XML_btnText ]                  = Color(0x000000);
+    maSystemPalette[ XML_captionText ]              = Color(0xFFFFFF);
+    maSystemPalette[ XML_gradientActiveCaption ]    = Color(0x3D95FF);
+    maSystemPalette[ XML_gradientInactiveCaption ]  = Color(0xD8E4F8);
+    maSystemPalette[ XML_grayText ]                 = Color(0xACA899);
+    maSystemPalette[ XML_highlight ]                = Color(0x316AC5);
+    maSystemPalette[ XML_highlightText ]            = Color(0xFFFFFF);
+    maSystemPalette[ XML_hotLight ]                 = Color(0x000080);
+    maSystemPalette[ XML_inactiveBorder ]           = Color(0xD4D0C8);
+    maSystemPalette[ XML_inactiveCaption ]          = Color(0x7A96DF);
+    maSystemPalette[ XML_inactiveCaptionText ]      = Color(0xD8E4F8);
+    maSystemPalette[ XML_infoBk ]                   = Color(0xFFFFE1);
+    maSystemPalette[ XML_infoText ]                 = Color(0x000000);
+    maSystemPalette[ XML_menu ]                     = Color(0xFFFFFF);
+    maSystemPalette[ XML_menuBar ]                  = Color(0xECE9D8);
+    maSystemPalette[ XML_menuHighlight ]            = Color(0x316AC5);
+    maSystemPalette[ XML_menuText ]                 = Color(0x000000);
+    maSystemPalette[ XML_scrollBar ]                = Color(0xD4D0C8);
+    maSystemPalette[ XML_window ]                   = Color(0xFFFFFF);
+    maSystemPalette[ XML_windowFrame ]              = Color(0x000000);
+    maSystemPalette[ XML_windowText ]               = Color(0x000000);
 
     // if no target frame has been passed (e.g. OLE objects), try to fallback to the active frame
     // TODO: we need some mechanism to keep and pass the parent frame
@@ -142,18 +142,18 @@ GraphicHelper::~GraphicHelper()
 
 // System colors and predefined colors ----------------------------------------
 
-sal_Int32 GraphicHelper::getSystemColor( sal_Int32 nToken, sal_Int32 nDefaultRgb ) const
+::Color GraphicHelper::getSystemColor( sal_Int32 nToken, ::Color nDefaultRgb ) const
 {
     return ContainerHelper::getMapElement( maSystemPalette, nToken, nDefaultRgb );
 }
 
-sal_Int32 GraphicHelper::getSchemeColor( sal_Int32 /*nToken*/ ) const
+::Color GraphicHelper::getSchemeColor( sal_Int32 /*nToken*/ ) const
 {
     OSL_FAIL( "GraphicHelper::getSchemeColor - scheme colors not implemented" );
     return API_RGB_TRANSPARENT;
 }
 
-sal_Int32 GraphicHelper::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const
+::Color GraphicHelper::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const
 {
     OSL_FAIL( "GraphicHelper::getPaletteColor - palette colors not implemented" );
     return API_RGB_TRANSPARENT;
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index 27703ef6c537..135086113245 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -80,9 +80,9 @@ inline sal_uInt32 lclSwapRedBlue( sal_uInt32 nColor )
 }
 
 /** Returns the UNO RGB color from the passed encoded OLE BGR color. */
-inline sal_Int32 lclDecodeBgrColor( sal_uInt32 nOleColor )
+inline ::Color lclDecodeBgrColor( sal_uInt32 nOleColor )
 {
-    return static_cast< sal_Int32 >( lclSwapRedBlue( nOleColor ) & 0xFFFFFF );
+    return ::Color( lclSwapRedBlue( nOleColor ) & 0xFFFFFF );
 }
 
 const sal_uInt32 OLE_STDPIC_ID              = 0x0000746C;
@@ -213,7 +213,7 @@ StdFontInfo::StdFontInfo( const OUString& rName, sal_uInt32 nHeight ) :
 {
 }
 
-sal_Int32 OleHelper::decodeOleColor(
+::Color OleHelper::decodeOleColor(
         const GraphicHelper& rGraphicHelper, sal_uInt32 nOleColor, bool bDefaultColorBgr )
 {
     static const sal_Int32 spnSystemColors[] =
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index a4fda5c3fac4..d98551eb51b1 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -187,9 +187,9 @@ bool PowerPointImport::exportDocument() throw()
     return false;
 }
 
-sal_Int32 PowerPointImport::getSchemeColor( sal_Int32 nToken ) const
+::Color PowerPointImport::getSchemeColor( sal_Int32 nToken ) const
 {
-    sal_Int32 nColor = 0;
+    ::Color nColor;
     if ( mpActualSlidePersist )
     {
         bool bColorMapped = false;
@@ -285,8 +285,8 @@ class PptGraphicHelper : public GraphicHelper
 {
 public:
     explicit            PptGraphicHelper( const PowerPointImport& rFilter );
-    virtual sal_Int32   getSchemeColor( sal_Int32 nToken ) const override;
-    virtual sal_Int32 getDefaultChartAreaFillStyle() const override;
+    virtual ::Color     getSchemeColor( sal_Int32 nToken ) const override;
+    virtual sal_Int32   getDefaultChartAreaFillStyle() const override;
 private:
     const PowerPointImport& mrFilter;
 };
@@ -297,7 +297,7 @@ PptGraphicHelper::PptGraphicHelper( const PowerPointImport& rFilter ) :
 {
 }
 
-sal_Int32 PptGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
+::Color PptGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
 {
     return mrFilter.getSchemeColor( nToken );
 }
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index d68d3331c062..a874c73099b5 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -188,7 +188,7 @@ void PresentationFragmentHandler::saveThemeToGrabBag(oox::drawingml::ThemePtr pT
                 {
                     sal_uInt32 nToken = PredefinedClrTokens[static_cast<PredefinedClrSchemeId>(nId)];
                     const OUString& sName = PredefinedClrNames[static_cast<PredefinedClrSchemeId>(nId)];
-                    sal_Int32 nColor = 0;
+                    ::Color nColor;
 
                     rClrScheme.getColor(nToken, nColor);
                     const uno::Any& rColor = uno::makeAny(nColor);
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index feec4d416955..fa330a2bacf7 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -170,7 +170,7 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase )
 {
     if ( mpBackgroundPropertiesPtr )
     {
-        sal_Int32 nPhClr = maBackgroundColor.isUsed() ?
+        ::Color nPhClr = maBackgroundColor.isUsed() ?
             maBackgroundColor.getColor( rFilterBase.getGraphicHelper() ) : API_RGB_TRANSPARENT;
 
         oox::drawingml::ShapePropertyIds aPropertyIds = oox::drawingml::ShapePropertyInfo::DEFAULT.mrPropertyIds;
diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx
index 7c98cfd49340..fe2d9581243b 100644
--- a/oox/source/ppt/timenodelistcontext.cxx
+++ b/oox/source/ppt/timenodelistcontext.cxx
@@ -424,9 +424,9 @@ namespace oox { namespace ppt {
                     rProps[ NP_COLORINTERPOLATION ] <<= mnColorSpace == XML_hsl ? AnimationColorSpace::HSL : AnimationColorSpace::RGB;
                     const GraphicHelper& rGraphicHelper = getFilter().getGraphicHelper();
                     if( maToClr.isUsed() )
-                        mpNode->setTo( Any( maToClr.getColor( rGraphicHelper ) ) );
+                        mpNode->setTo( makeAny( maToClr.getColor( rGraphicHelper ) ) );
                     if( maFromClr.isUsed() )
-                        mpNode->setFrom( Any( maFromClr.getColor( rGraphicHelper ) ) );
+                        mpNode->setFrom( makeAny( maFromClr.getColor( rGraphicHelper ) ) );
                     if( mbHasByColor )
                         mpNode->setBy( m_byColor.get() );
                 }
diff --git a/oox/source/shape/ShapeFilterBase.cxx b/oox/source/shape/ShapeFilterBase.cxx
index 65886cb16ab7..6da4a5dfbe08 100644
--- a/oox/source/shape/ShapeFilterBase.cxx
+++ b/oox/source/shape/ShapeFilterBase.cxx
@@ -78,7 +78,7 @@ class ShapeGraphicHelper : public GraphicHelper
 {
 public:
     explicit            ShapeGraphicHelper( const ShapeFilterBase& rFilter );
-    virtual sal_Int32   getSchemeColor( sal_Int32 nToken ) const override;
+    virtual ::Color     getSchemeColor( sal_Int32 nToken ) const override;
 private:
     const ShapeFilterBase& mrFilter;
 };
@@ -89,7 +89,7 @@ ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase& rFilter ) :
 {
 }
 
-sal_Int32 ShapeGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
+::Color ShapeGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
 {
     return mrFilter.getSchemeColor( nToken );
 }
@@ -99,9 +99,9 @@ GraphicHelper* ShapeFilterBase::implCreateGraphicHelper() const
     return new ShapeGraphicHelper( *this );
 }
 
-sal_Int32 ShapeFilterBase::getSchemeColor( sal_Int32 nToken ) const
+::Color ShapeFilterBase::getSchemeColor( sal_Int32 nToken ) const
 {
-    sal_Int32 nColor = 0;
+    ::Color nColor;
 
     if (mpTheme.get())
         mpTheme->getClrScheme().getColor( nToken, nColor );
diff --git a/oox/source/shape/ShapeFilterBase.hxx b/oox/source/shape/ShapeFilterBase.hxx
index c20d5edfd189..86297cda7011 100644
--- a/oox/source/shape/ShapeFilterBase.hxx
+++ b/oox/source/shape/ShapeFilterBase.hxx
@@ -57,7 +57,7 @@ public:
     virtual bool importDocument() override { return true; }
     virtual bool exportDocument() override { return true; }
 
-    sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
+    ::Color getSchemeColor( sal_Int32 nToken ) const;
 
 private:
     virtual ::oox::ole::VbaProject* implCreateVbaProject() const override;
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index 5861ed88bbe3..061841408e48 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -205,7 +205,7 @@ sal_Int32 ConversionHelper::decodeMeasureToHmm( const GraphicHelper& rGraphicHel
 
 Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper,
         const OptValue< OUString >& roVmlColor, const OptValue< double >& roVmlOpacity,
-        sal_Int32 nDefaultRgb, sal_Int32 nPrimaryRgb )
+        ::Color nDefaultRgb, ::Color nPrimaryRgb )
 {
     Color aDmlColor;
 
@@ -247,7 +247,7 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper,
     /*  Predefined color names or system color names (resolve to RGB to detect
         valid color name). */
     sal_Int32 nColorToken = AttributeConversion::decodeToken( aColorName );
-    sal_Int32 nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
+    ::Color nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
     if( nRgbValue == API_RGB_TRANSPARENT )
         nRgbValue = rGraphicHelper.getSystemColor( nColorToken );
     if( nRgbValue != API_RGB_TRANSPARENT )
@@ -871,7 +871,7 @@ void ShadowModel::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelper&
     }
 
     table::ShadowFormat aFormat;
-    aFormat.Color = aColor.getColor(rGraphicHelper);
+    aFormat.Color = sal_Int32(aColor.getColor(rGraphicHelper));
     aFormat.Location = table::ShadowLocation_BOTTOM_RIGHT;
     // The width of the shadow is the average of the x and y values, see SwWW8ImplReader::MatchSdrItemsIntoFlySet().
     aFormat.ShadowWidth = ((nOffsetX + nOffsetY) / 2);
diff --git a/sc/source/filter/inc/stylesbuffer.hxx b/sc/source/filter/inc/stylesbuffer.hxx
index 66319f8b981d..04e8dc682d31 100644
--- a/sc/source/filter/inc/stylesbuffer.hxx
+++ b/sc/source/filter/inc/stylesbuffer.hxx
@@ -78,9 +78,9 @@ public:
     explicit            ExcelGraphicHelper( const WorkbookHelper& rHelper );
 
     /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */
-    virtual sal_Int32   getSchemeColor( sal_Int32 nToken ) const override;
+    virtual ::Color     getSchemeColor( sal_Int32 nToken ) const override;
     /** Derived classes may implement to resolve a palette index to an RGB color. */
-    virtual sal_Int32   getPaletteColor( sal_Int32 nPaletteIdx ) const override;
+    virtual ::Color     getPaletteColor( sal_Int32 nPaletteIdx ) const override;
 };
 
 class Color : public ::oox::drawingml::Color
@@ -194,7 +194,7 @@ struct ApiFontData
     ApiScriptFontName        maAsianFont;        /// Font name for east-asian scripts.
     ApiScriptFontName        maCmplxFont;        /// Font name for complex scripts.
     css::awt::FontDescriptor maDesc;             /// Font descriptor (height in twips, weight in %).
-    sal_Int32                mnColor;            /// Font color.
+    ::Color                  mnColor;            /// Font color.
     sal_Int16                mnEscapement;       /// Escapement style.
     sal_Int8                 mnEscapeHeight;     /// Escapement font height.
     bool                     mbOutline;          /// True = outlined characters.
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 55a57a4c710b..6b7a79761b7a 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -209,8 +209,7 @@ namespace {
         oox::drawingml::Color aDMColor;
         aDMColor.setSrgbClr(nColor);
         aDMColor.addExcelTintTransformation(nTint);
-        nColor = aDMColor.getColor(rGraphicHelper);
-        aColor = ::Color(nColor);
+        aColor = aDMColor.getColor(rGraphicHelper);
     }
     else
         aColor = ARgbToARgbComponents( nColor );
diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx
index 5500f160dd9e..8a9ddf098291 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -692,7 +692,7 @@ sal_uInt32 VmlDrawing::convertControlTextColor( const OUString& rTextColor ) con
     /*  Predefined color names or system color names (resolve to RGB to detect
         valid color name). */
     sal_Int32 nColorToken = AttributeConversion::decodeToken( rTextColor );
-    sal_Int32 nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
+    ::Color nRgbValue = Color::getVmlPresetColor( nColorToken, API_RGB_TRANSPARENT );
     if( nRgbValue == API_RGB_TRANSPARENT )
         nRgbValue = rGraphicHelper.getSystemColor( nColorToken );
     if( nRgbValue != API_RGB_TRANSPARENT )
@@ -750,9 +750,9 @@ void VmlDrawing::convertControlBackground( AxMorphDataModelBase& rAxModel, const
     if( bHasFill )
     {
         const GraphicHelper& rGraphicHelper = getBaseFilter().getGraphicHelper();
-        sal_Int32 nSysWindowColor = rGraphicHelper.getSystemColor( XML_window, API_RGB_WHITE );
+        ::Color nSysWindowColor = rGraphicHelper.getSystemColor( XML_window, API_RGB_WHITE );
         ::oox::drawingml::Color aColor = ::oox::vml::ConversionHelper::decodeColor( rGraphicHelper, rFillModel.moColor, rFillModel.moOpacity, nSysWindowColor );
-        sal_Int32 nRgbValue = aColor.getColor( rGraphicHelper );
+        ::Color nRgbValue = aColor.getColor( rGraphicHelper );
         rAxModel.mnBackColor = OleHelper::encodeOleColor( nRgbValue );
     }
 }
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 04d5c773d650..f2efe4380297 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -224,12 +224,12 @@ ExcelGraphicHelper::ExcelGraphicHelper( const WorkbookHelper& rHelper ) :
 {
 }
 
-sal_Int32 ExcelGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
+::Color ExcelGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
 {
     return getTheme().getColorByToken( nToken );
 }
 
-sal_Int32 ExcelGraphicHelper::getPaletteColor( sal_Int32 nPaletteIdx ) const
+::Color ExcelGraphicHelper::getPaletteColor( sal_Int32 nPaletteIdx ) const
 {
     return getStyles().getPaletteColor( nPaletteIdx );
 }
@@ -271,7 +271,7 @@ void Color::importColor( const AttributeList& rAttribs )
     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 ) );
+        setRgb( rAttribs.getIntegerHex( XML_rgb, sal_Int32(API_RGB_TRANSPARENT) ), 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 ) )
@@ -371,7 +371,7 @@ ColorPalette::ColorPalette( const WorkbookHelper& rHelper )
 
 void ColorPalette::importPaletteColor( const AttributeList& rAttribs )
 {
-    appendColor( rAttribs.getIntegerHex( XML_rgb, API_RGB_WHITE ) );
+    appendColor( rAttribs.getIntegerHex( XML_rgb, sal_Int32(API_RGB_WHITE) ) );
 }
 
 void ColorPalette::importPaletteColor( SequenceInputStream& rStrm )
@@ -382,7 +382,7 @@ void ColorPalette::importPaletteColor( SequenceInputStream& rStrm )
 
 sal_Int32 ColorPalette::getColor( sal_Int32 nPaletteIdx ) const
 {
-    sal_Int32 nColor = API_RGB_TRANSPARENT;
+    ::Color nColor = API_RGB_TRANSPARENT;
     if( const sal_Int32* pnPaletteColor = ContainerHelper::getVectorElement( maColors, nPaletteIdx ) )
     {
         nColor = *pnPaletteColor;
@@ -402,7 +402,7 @@ sal_Int32 ColorPalette::getColor( sal_Int32 nPaletteIdx ) const
         case OOX_COLOR_FONTAUTO:        nColor = API_RGB_TRANSPARENT;                                                   break;
         default:                        OSL_FAIL( "ColorPalette::getColor - unknown color index" );
     }
-    return nColor;
+    return sal_Int32(nColor);
 }
 
 void ColorPalette::appendColor( sal_Int32 nRGBValue )
@@ -1541,7 +1541,7 @@ bool Border::convertBorderLine( BorderLine2& rBorderLine, const BorderLineModel&
 {
     // Document: sc/qa/unit/data/README.cellborders
 
-    rBorderLine.Color = rModel.maColor.getColor( getBaseFilter().getGraphicHelper(), API_RGB_BLACK );
+    rBorderLine.Color = sal_Int32(rModel.maColor.getColor( getBaseFilter().getGraphicHelper(), API_RGB_BLACK ));
     switch( rModel.mnStyle )
     {
         case XML_dashDot:
@@ -1667,12 +1667,12 @@ inline sal_Int32 lclGetMixedColorComp( sal_Int32 nPatt, sal_Int32 nFill, sal_Int
     return ((nPatt - nFill) * nAlpha) / 0x80 + nFill;
 }
 
-sal_Int32 lclGetMixedColor( sal_Int32 nPattColor, sal_Int32 nFillColor, sal_Int32 nAlpha )
+::Color lclGetMixedColor( ::Color nPattColor, ::Color nFillColor, sal_Int32 nAlpha )
 {
-    return
-        (lclGetMixedColorComp( nPattColor & 0xFF0000, nFillColor & 0xFF0000, nAlpha ) & 0xFF0000) |
-        (lclGetMixedColorComp( nPattColor & 0x00FF00, nFillColor & 0x00FF00, nAlpha ) & 0x00FF00) |
-        (lclGetMixedColorComp( nPattColor & 0x0000FF, nFillColor & 0x0000FF, nAlpha ) & 0x0000FF);
+    return ::Color(
+        lclGetMixedColorComp( nPattColor.GetRed(), nFillColor.GetRed(), nAlpha ),
+        lclGetMixedColorComp( nPattColor.GetGreen(), nFillColor.GetGreen(), nAlpha ),
+        lclGetMixedColorComp( nPattColor.GetBlue(), nFillColor.GetBlue(), nAlpha ) );
 }
 
 } // namespace
@@ -1820,7 +1820,7 @@ void Fill::finalizeImport()
         maApiData.mbUsed = rModel.mbPatternUsed;
         if( rModel.mnPattern == XML_none )
         {
-            maApiData.mnColor = API_RGB_TRANSPARENT;
+            maApiData.mnColor = sal_Int32(API_RGB_TRANSPARENT);
             maApiData.mbTransparent = true;
         }
         else
@@ -1848,18 +1848,18 @@ void Fill::finalizeImport()
                 case XML_solid:             nAlpha = 0x80;  break;
             }
 
-            sal_Int32 nWinTextColor = rGraphicHelper.getSystemColor( XML_windowText );
-            sal_Int32 nWinColor = rGraphicHelper.getSystemColor( XML_window );
+            ::Color nWinTextColor = rGraphicHelper.getSystemColor( XML_windowText );
+            ::Color nWinColor = rGraphicHelper.getSystemColor( XML_window );
 
             if( !rModel.mbPattColorUsed )
                 rModel.maPatternColor.setAuto();
-            sal_Int32 nPattColor = rModel.maPatternColor.getColor( rGraphicHelper, nWinTextColor );
+            ::Color nPattColor = rModel.maPatternColor.getColor( rGraphicHelper, nWinTextColor );
 
             if( !rModel.mbFillColorUsed )
                 rModel.maFillColor.setAuto();
-            sal_Int32 nFillColor = rModel.maFillColor.getColor( rGraphicHelper, nWinColor );
+            ::Color nFillColor = rModel.maFillColor.getColor( rGraphicHelper, nWinColor );
 
-            maApiData.mnColor = lclGetMixedColor( nPattColor, nFillColor, nAlpha );
+            maApiData.mnColor = sal_Int32(lclGetMixedColor( nPattColor, nFillColor, nAlpha ));
             maApiData.mbTransparent = false;
         }
     }
@@ -1869,12 +1869,12 @@ void Fill::finalizeImport()
         maApiData.mbUsed = true;    // no support for differential attributes
         GradientFillModel::ColorMap::const_iterator aIt = rModel.maColors.begin();
         OSL_ENSURE( !aIt->second.isAuto(), "Fill::finalizeImport - automatic gradient color" );
-        maApiData.mnColor = aIt->second.getColor( rGraphicHelper, API_RGB_WHITE );
+        maApiData.mnColor = sal_Int32(aIt->second.getColor( rGraphicHelper, API_RGB_WHITE ));
         if( ++aIt != rModel.maColors.end() )
         {
             OSL_ENSURE( !aIt->second.isAuto(), "Fill::finalizeImport - automatic gradient color" );
-            sal_Int32 nEndColor = aIt->second.getColor( rGraphicHelper, API_RGB_WHITE );
-            maApiData.mnColor = lclGetMixedColor( maApiData.mnColor, nEndColor, 0x40 );
+            ::Color nEndColor = aIt->second.getColor( rGraphicHelper, API_RGB_WHITE );
+            maApiData.mnColor = sal_Int32(lclGetMixedColor( maApiData.mnColor, nEndColor, 0x40 ));
             maApiData.mbTransparent = false;
         }
     }
diff --git a/sc/source/filter/oox/themebuffer.cxx b/sc/source/filter/oox/themebuffer.cxx
index 67ce339d7bed..b72f9029c547 100644
--- a/sc/source/filter/oox/themebuffer.cxx
+++ b/sc/source/filter/oox/themebuffer.cxx
@@ -40,14 +40,14 @@ ThemeBuffer::~ThemeBuffer()
 
 sal_Int32 ThemeBuffer::getColorByToken( sal_Int32 nToken ) const
 {
-    sal_Int32 nColor = 0;
-    return getClrScheme().getColor( nToken, nColor ) ? nColor : API_RGB_TRANSPARENT;
+    ::Color nColor = 0;
+    return sal_Int32(getClrScheme().getColor( nToken, nColor ) ? nColor : API_RGB_TRANSPARENT);
 }
 
 sal_Int32 ThemeBuffer::getColorByIndex(size_t nIndex) const
 {
-    sal_Int32 nColor = 0;
-    return getClrScheme().getColorByIndex(nIndex, nColor) ? nColor : API_RGB_TRANSPARENT;
+    ::Color nColor = 0;
+    return sal_Int32(getClrScheme().getColorByIndex(nIndex, nColor) ? nColor : API_RGB_TRANSPARENT);
 }
 
 } // namespace xls
diff --git a/sc/source/filter/oox/viewsettings.cxx b/sc/source/filter/oox/viewsettings.cxx
index 54ae94886566..4f5f0f54554c 100644
--- a/sc/source/filter/oox/viewsettings.cxx
+++ b/sc/source/filter/oox/viewsettings.cxx
@@ -155,7 +155,7 @@ sal_Int32 SheetViewModel::getPageBreakZoom() const
 
 sal_Int32 SheetViewModel::getGridColor( const FilterBase& rFilter ) const
 {
-    return mbDefGridColor ? API_RGB_TRANSPARENT : maGridColor.getColor( rFilter.getGraphicHelper() );
+    return sal_Int32(mbDefGridColor ? API_RGB_TRANSPARENT : maGridColor.getColor( rFilter.getGraphicHelper() ));
 }
 
 const PaneSelectionModel* SheetViewModel::getActiveSelection() const
diff --git a/sc/source/filter/oox/worksheetsettings.cxx b/sc/source/filter/oox/worksheetsettings.cxx
index ea69be9f2bc8..f322f41c52e3 100644
--- a/sc/source/filter/oox/worksheetsettings.cxx
+++ b/sc/source/filter/oox/worksheetsettings.cxx
@@ -282,7 +282,7 @@ void WorksheetSettings::finalizeImport()
     // sheet tab color
     if( !maSheetSettings.maTabColor.isAuto() )
     {
-        sal_Int32 nColor = maSheetSettings.maTabColor.getColor( getBaseFilter().getGraphicHelper() );
+        ::Color nColor = maSheetSettings.maTabColor.getColor( getBaseFilter().getGraphicHelper() );
         aPropSet.setProperty( PROP_TabColor, nColor );
     }
 }


More information about the Libreoffice-commits mailing list