[Libreoffice-commits] core.git: 2 commits - chart2/qa include/oox oox/source sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Apr 15 18:02:28 PDT 2015


 chart2/qa/extras/chart2export.cxx         |   10 ++++++++++
 include/oox/helper/attributelist.hxx      |    8 ++++++++
 include/oox/helper/helper.hxx             |    1 +
 oox/source/helper/attributelist.cxx       |   17 +++++++++++++++++
 sc/source/filter/inc/condformatbuffer.hxx |    2 +-
 sc/source/filter/oox/condformatbuffer.cxx |    8 ++++----
 6 files changed, 41 insertions(+), 5 deletions(-)

New commits:
commit 915303a7903bac1e9a940370e69651dd48d08a01
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Apr 16 02:55:53 2015 +0200

    fix werror problem around sal_uInt32 vs sal_Int32
    
    Change-Id: Ifab0f5ad300882b1a014f6420094e5db503105e3

diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx
index 90059fb..38bdf34 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 b19337d..9585cc1 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 3360c20..da8e2b3 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 31ae39a..18523d8 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 7e0a0f5..08ea800 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 )
commit 5e239836009390a5f2b4ee4d6dfd42b6032f7cc4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Apr 16 02:55:40 2015 +0200

    add test for tdf#90533
    
    Change-Id: I3a045598d2883290bdc8fa09ea8377059249ad5f

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index b60c1e4..4014393 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -83,6 +83,7 @@ public:
     void testAutoTitleDelXLSX();
     void testDispBlanksAsXLSX();
     void testMarkerColorXLSX();
+    void testRoundedCornersXLSX();
 
     CPPUNIT_TEST_SUITE(Chart2ExportTest);
     CPPUNIT_TEST(test);
@@ -131,6 +132,7 @@ public:
     CPPUNIT_TEST(testAutoTitleDelXLSX);
     CPPUNIT_TEST(testDispBlanksAsXLSX);
     CPPUNIT_TEST(testMarkerColorXLSX);
+    CPPUNIT_TEST(testRoundedCornersXLSX);
     CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -1229,6 +1231,14 @@ void Chart2ExportTest::testMarkerColorXLSX()
     assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser/c:marker/c:spPr/a:solidFill/a:srgbClr", "val", "92d050");
 }
 
+void Chart2ExportTest::testRoundedCornersXLSX()
+{
+    load("/chart2/qa/extras/data/xlsx/", "markerColor.xlsx");
+    xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPath(pXmlDoc, "/c:chartSpace/c:roundedCorners", "val", "0");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list