diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-04-16 02:55:53 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-04-16 02:55:53 +0200 |
commit | 915303a7903bac1e9a940370e69651dd48d08a01 (patch) | |
tree | bc92cb64621040bc9ecb83d711032eecf995dc3b | |
parent | 5e239836009390a5f2b4ee4d6dfd42b6032f7cc4 (diff) |
fix werror problem around sal_uInt32 vs sal_Int32
Change-Id: Ifab0f5ad300882b1a014f6420094e5db503105e3
-rw-r--r-- | include/oox/helper/attributelist.hxx | 8 | ||||
-rw-r--r-- | include/oox/helper/helper.hxx | 1 | ||||
-rw-r--r-- | oox/source/helper/attributelist.cxx | 17 | ||||
-rw-r--r-- | sc/source/filter/inc/condformatbuffer.hxx | 2 | ||||
-rw-r--r-- | sc/source/filter/oox/condformatbuffer.cxx | 8 |
5 files changed, 31 insertions, 5 deletions
diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx index 90059fb3700e..38bdf34a1f95 100644 --- a/include/oox/helper/attributelist.hxx +++ b/include/oox/helper/attributelist.hxx @@ -59,6 +59,9 @@ public: /** Returns the 32-bit signed integer value from the passed string (hexadecimal). */ static sal_Int32 decodeIntegerHex( const OUString& rValue ); + + /** Returns the 32-bit unsigned integer value from the passed string (hexadecimal). */ + static sal_uInt32 decodeUnsignedHex( const OUString& rValue ); }; @@ -109,6 +112,9 @@ public: /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal). */ OptValue< sal_Int32 > getIntegerHex( sal_Int32 nAttrToken ) const; + /** Returns the 32-bit unsigned integer value of the specified attribute (hexadecimal). */ + OptValue< sal_uInt32 > getUnsignedHex( sal_Int32 nAttrToken ) const; + /** Returns the boolean value of the specified attribute. */ OptValue< bool > getBool( sal_Int32 nAttrToken ) const; @@ -152,6 +158,8 @@ public: or the passed default value if the attribute is missing or not convertible. */ sal_Int32 getIntegerHex( sal_Int32 nAttrToken, sal_Int32 nDefault ) const; + sal_uInt32 getUnsignedHex( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const; + /** Returns the boolean value of the specified attribute, or the passed default value if the attribute is missing or not convertible to bool. */ bool getBool( sal_Int32 nAttrToken, bool bDefault ) const; diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx index b19337df8873..9585cc138616 100644 --- a/include/oox/helper/helper.hxx +++ b/include/oox/helper/helper.hxx @@ -77,6 +77,7 @@ 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. diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx index 3360c203c830..da8e2b3f1b32 100644 --- a/oox/source/helper/attributelist.cxx +++ b/oox/source/helper/attributelist.cxx @@ -105,6 +105,11 @@ sal_Int32 AttributeConversion::decodeIntegerHex( const OUString& rValue ) // cast, but that will have a ripple effect } +sal_uInt32 AttributeConversion::decodeUnsignedHex( const OUString& rValue ) +{ + return rValue.toUInt32( 16 ); +} + AttributeList::AttributeList( const Reference< XFastAttributeList >& rxAttribs ) : mxAttribs( rxAttribs ), mpAttribList( NULL ) @@ -186,6 +191,13 @@ OptValue< sal_Int32 > AttributeList::getIntegerHex( sal_Int32 nAttrToken ) const return OptValue< sal_Int32 >( bValid, bValid ? AttributeConversion::decodeIntegerHex( aValue ) : 0 ); } +OptValue< sal_uInt32 > AttributeList::getUnsignedHex( sal_Int32 nAttrToken ) const +{ + OUString aValue = mxAttribs->getOptionalValue( nAttrToken ); + bool bValid = !aValue.isEmpty(); + return OptValue< sal_uInt32 >( bValid, bValid ? AttributeConversion::decodeUnsignedHex( aValue ) : 0 ); +} + OptValue< bool > AttributeList::getBool( sal_Int32 nAttrToken ) const { const char *pAttr; @@ -296,6 +308,11 @@ sal_Int32 AttributeList::getIntegerHex( sal_Int32 nAttrToken, sal_Int32 nDefault return getIntegerHex( nAttrToken ).get( nDefault ); } +sal_uInt32 AttributeList::getUnsignedHex( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const +{ + return getIntegerHex( nAttrToken ).get( nDefault ); +} + bool AttributeList::getBool( sal_Int32 nAttrToken, bool bDefault ) const { return getBool( nAttrToken ).get( bDefault ); diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index 31ae39ab0295..18523d8675d7 100644 --- a/sc/source/filter/inc/condformatbuffer.hxx +++ b/sc/source/filter/inc/condformatbuffer.hxx @@ -219,7 +219,7 @@ private: struct ExCfRuleModel { - ExCfRuleModel() : mbGradient( false ), mnAxisColor( API_RGB_TRANSPARENT ), mnNegativeColor( API_RGB_TRANSPARENT ), mbIsLower( true ) {} + ExCfRuleModel() : mbGradient( false ), mnAxisColor( UNSIGNED_RGB_TRANSPARENT ), mnNegativeColor( UNSIGNED_RGB_TRANSPARENT ), mbIsLower( true ) {} // DataBar bool mbGradient; OUString maAxisPosition; diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 7e0a0f5a1194..08ea8005d322 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -177,7 +177,7 @@ void ColorScaleRule::importColor( const AttributeList& rAttribs ) { sal_uInt32 nColor = 0; if( rAttribs.hasAttribute( XML_rgb ) ) - nColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ); + nColor = rAttribs.getUnsignedHex( XML_rgb, UNSIGNED_RGB_TRANSPARENT ); else if( rAttribs.hasAttribute( XML_theme ) ) { sal_uInt32 nThemeIndex = rAttribs.getUnsigned( XML_theme, 0 ); @@ -254,7 +254,7 @@ void DataBarRule::importColor( const AttributeList& rAttribs ) { sal_uInt32 nColor = 0; if( rAttribs.hasAttribute( XML_rgb ) ) - nColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ); + nColor = rAttribs.getUnsignedHex( XML_rgb, UNSIGNED_RGB_TRANSPARENT ); else if( rAttribs.hasAttribute( XML_theme ) ) { sal_uInt32 nThemeIndex = rAttribs.getUnsigned( XML_theme, 0 ); @@ -1194,13 +1194,13 @@ void ExtCfRule::importDataBar( const AttributeList& rAttribs ) void ExtCfRule::importNegativeFillColor( const AttributeList& rAttribs ) { mnRuleType = NEGATIVEFILLCOLOR; - maModel.mnNegativeColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ); + maModel.mnNegativeColor = rAttribs.getUnsignedHex( XML_rgb, UNSIGNED_RGB_TRANSPARENT ); } void ExtCfRule::importAxisColor( const AttributeList& rAttribs ) { mnRuleType = AXISCOLOR; - maModel.mnAxisColor = rAttribs.getIntegerHex( XML_rgb, API_RGB_TRANSPARENT ); + maModel.mnAxisColor = rAttribs.getUnsignedHex( XML_rgb, UNSIGNED_RGB_TRANSPARENT ); } void ExtCfRule::importCfvo( const AttributeList& rAttribs ) |