summaryrefslogtreecommitdiff
path: root/include/oox
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-02 11:43:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-05 07:35:01 +0100
commit61d79dd740958186c4a4344e18eaeb5b2c139c91 (patch)
treeabea71a038352572871ea1fb2a9c40d2f196ddd6 /include/oox
parent04c9cb68dffa2af15661cc35bc61032b036ed2cd (diff)
use more Color in oox
Change-Id: I8fdc6742de5af9101e246411e7208650bae2c4c7 Reviewed-on: https://gerrit.libreoffice.org/50617 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/oox')
-rw-r--r--include/oox/drawingml/clrscheme.hxx9
-rw-r--r--include/oox/drawingml/color.hxx10
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx5
-rw-r--r--include/oox/export/drawingml.hxx8
-rw-r--r--include/oox/helper/graphichelper.hxx8
-rw-r--r--include/oox/helper/helper.hxx11
-rw-r--r--include/oox/helper/propertyset.hxx3
-rw-r--r--include/oox/ole/olehelper.hxx3
-rw-r--r--include/oox/ppt/pptimport.hxx2
-rw-r--r--include/oox/vml/vmlformatting.hxx4
10 files changed, 38 insertions, 25 deletions
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.