[Libreoffice-commits] core.git: xmloff/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Mar 6 10:50:38 UTC 2018


 xmloff/source/chart/ColorPropertySet.hxx       |    5 +++--
 xmloff/source/draw/XMLGraphicsDefaultStyle.cxx |    6 +++---
 xmloff/source/style/TransGradientStyle.cxx     |    8 ++++----
 xmloff/source/style/shadwhdl.cxx               |    7 ++-----
 xmloff/source/style/xmlnumfi.cxx               |    2 +-
 xmloff/source/style/xmlnumi.cxx                |    9 +++++----
 6 files changed, 18 insertions(+), 19 deletions(-)

New commits:
commit f02b1ba18deeab9744c5fe25162f5853d69b438e
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Mar 6 10:34:00 2018 +0200

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

diff --git a/xmloff/source/chart/ColorPropertySet.hxx b/xmloff/source/chart/ColorPropertySet.hxx
index 785f7f9482e6..772aa002ef46 100644
--- a/xmloff/source/chart/ColorPropertySet.hxx
+++ b/xmloff/source/chart/ColorPropertySet.hxx
@@ -20,6 +20,7 @@
 #define XMLOFF_COLORPROPERTYSET_HXX
 
 #include <cppuhelper/implbase.hxx>
+#include <tools/color.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/XPropertyState.hpp>
@@ -71,8 +72,8 @@ protected:
 private:
     css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;
     OUString  m_aColorPropName;
-    sal_Int32        m_nColor;
-    sal_Int32        m_nDefaultColor;
+    Color     m_nColor;
+    Color     m_nDefaultColor;
 };
 
 } //  namespace chart
diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
index 51c83ba96505..7c35e6258580 100644
--- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
+++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
@@ -152,11 +152,11 @@ void XMLGraphicsDefaultStyle::SetDefaults()
         if (std::none_of(GetProperties().begin(), GetProperties().end(),
                          XMLPropertyByIndex(nStrokeIndex)))
         {
-            sal_Int32 const nStroke(
+            Color const nStroke(
                     bIsAOO4 ? Color(128, 128, 128) : COL_BLACK);
             xDefaults->setPropertyValue("LineColor", makeAny(nStroke));
         }
-        sal_Int32 const nFillColor( bIsAOO4
+        Color const nFillColor( bIsAOO4
             ? Color(0xCF, 0xE7, 0xF5) : Color(153, 204, 255));
         sal_Int32 const nFillIndex(
             pImpPrMap->GetEntryIndex(XML_NAMESPACE_DRAW, "fill-color", 0));
@@ -172,7 +172,7 @@ void XMLGraphicsDefaultStyle::SetDefaults()
             if (std::none_of(GetProperties().begin(), GetProperties().end(),
                              XMLPropertyByIndex(nFill2Index)))
             {
-                xDefaults->setPropertyValue("FillColor2", makeAny(nFillColor));
+                xDefaults->setPropertyValue("FillColor2", makeAny(sal_Int32(nFillColor)));
             }
         }
     }
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
index c5e424fb5ed7..622e2af57366 100644
--- a/xmloff/source/style/TransGradientStyle.cxx
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -151,7 +151,7 @@ void XMLTransGradientStyleImport::importXML(
                     ( (100 - aStartTransparency) * 255 ) / 100 );
 
                 Color aColor( n, n, n );
-                aGradient.StartColor = static_cast<sal_Int32>( aColor.GetColor() );
+                aGradient.StartColor = static_cast<sal_Int32>( aColor );
             }
             break;
         case XML_TOK_GRADIENT_END:
@@ -163,7 +163,7 @@ void XMLTransGradientStyleImport::importXML(
                     ( (100 - aEndTransparency) * 255 ) / 100 );
 
                 Color aColor( n, n, n );
-                aGradient.EndColor = static_cast<sal_Int32>( aColor.GetColor() );
+                aGradient.EndColor = static_cast<sal_Int32>( aColor );
             }
             break;
         case XML_TOK_GRADIENT_ANGLE:
@@ -248,14 +248,14 @@ void XMLTransGradientStyleExport::exportXML(
                 Color aColor;
 
                 // Transparency start
-                aColor = aGradient.StartColor;
+                aColor = Color(aGradient.StartColor);
                 sal_Int32 aStartValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
                 ::sax::Converter::convertPercent( aOut, aStartValue );
                 aStrValue = aOut.makeStringAndClear();
                 rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_START, aStrValue );
 
                 // Transparency end
-                aColor = aGradient.EndColor;
+                aColor = Color(aGradient.EndColor);
                 sal_Int32 aEndValue = 100 - static_cast<sal_Int32>(((aColor.GetRed() + 1) * 100) / 255);
                 ::sax::Converter::convertPercent( aOut, aEndValue );
                 aStrValue = aOut.makeStringAndClear();
diff --git a/xmloff/source/style/shadwhdl.cxx b/xmloff/source/style/shadwhdl.cxx
index bccfab9e017d..b3c2739aa1db 100644
--- a/xmloff/source/style/shadwhdl.cxx
+++ b/xmloff/source/style/shadwhdl.cxx
@@ -63,12 +63,9 @@ bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue
         }
         else if( !bColorFound && aToken.startsWith("#") )
         {
-            sal_Int32 nColor(0);
-            bRet = ::sax::Converter::convertColor( nColor, aToken );
+            bRet = ::sax::Converter::convertColor( aColor, aToken );
             if( !bRet )
                 return false;
-
-            aColor = nColor;
             bColorFound = true;
         }
         else if( !bOffsetFound )
@@ -112,7 +109,7 @@ bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue
     if( bRet && ( bColorFound || bOffsetFound ) )
     {
         aShadow.IsTransparent = aColor.GetTransparency() > 0;
-        aShadow.Color = aColor.GetColor();
+        aShadow.Color = sal_Int32(aColor);
         bRet = true;
     }
 
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index 2e2905d6ffd0..037d38c2d15a 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -190,7 +190,7 @@ public:
 class SvXMLNumFmtPropContext : public SvXMLImportContext
 {
     SvXMLNumFormatContext&  rParent;
-    sal_Int32               m_nColor;
+    Color                   m_nColor;
     bool                    bColSet;
 
 public:
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 7c0a4665b611..42ccda81d3ea 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -37,6 +37,7 @@
 #include <osl/diagnose.h>
 
 #include <tools/fontenum.hxx>
+#include <tools/color.hxx>
 
 #include <sax/tools/converter.hxx>
 
@@ -174,7 +175,7 @@ class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext
     sal_Unicode         cBullet;
 
     sal_Int16           nRelSize;
-    sal_Int32           m_nColor;
+    Color               m_nColor;
 
     sal_Int16           ePosAndSpaceMode;
     sal_Int16           eLabelFollowedBy;
@@ -188,7 +189,7 @@ class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext
     bool            bHasColor : 1;
 
     void SetRelSize( sal_Int16 nRel ) { nRelSize = nRel; }
-    void SetColor( sal_Int32 nColor )
+    void SetColor( Color nColor )
         { m_nColor = nColor; bHasColor = true; }
     void SetSpaceBefore( sal_Int32 nSet ) { nSpaceBefore = nSet; }
     void SetMinLabelWidth( sal_Int32 nSet ) { nMinLabelWidth = nSet; }
@@ -738,14 +739,14 @@ SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
                 sal_Int32 nColor(0);
                 if (::sax::Converter::convertColor( nColor, rValue ))
                 {
-                    rListLevel.SetColor( nColor );
+                    rListLevel.SetColor( Color(nColor) );
                 }
             }
             break;
         case XML_TOK_STYLE_ATTRIBUTES_ATTR_WINDOW_FONT_COLOR:
             {
                 if( IsXMLToken( rValue, XML_TRUE ) )
-                    rListLevel.SetColor( sal_Int32(0xffffffff) );
+                    rListLevel.SetColor( Color(0xffffffff) );
             }
             break;
         case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_SIZE:


More information about the Libreoffice-commits mailing list