[Libreoffice-commits] core.git: chart2/qa chart2/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Mar 31 07:00:36 UTC 2017


 chart2/qa/extras/chart2export.cxx                                    |   15 +++++++
 chart2/qa/extras/chart2import.cxx                                    |   20 ++++++++++
 chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx          |    2 -
 chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx |    2 -
 chart2/source/controller/dialogs/res_LegendPosition.cxx              |    6 +--
 chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx        |    6 +--
 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx   |    2 -
 chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx      |    2 -
 chart2/source/model/main/DataPointProperties.cxx                     |    2 -
 chart2/source/tools/RelativePositionHelper.cxx                       |    8 ++--
 chart2/source/view/main/ChartItemPool.cxx                            |    2 -
 chart2/source/view/main/OpenGLRender.cxx                             |   12 +++---
 chart2/source/view/main/OpenGLRender.hxx                             |    3 +
 chart2/source/view/main/VLegend.cxx                                  |    2 -
 14 files changed, 60 insertions(+), 24 deletions(-)

New commits:
commit 8cd5002959c27e2e271d3897886a2ef504e41ff6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 30 16:27:50 2017 +0200

    use actual UNO enums in chart2
    
    Change-Id: I05d4eed55f5deba4b1802389d1ba94582d30550f
    Reviewed-on: https://gerrit.libreoffice.org/35917
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 5975c7a3cfa2..eae08be7cf96 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -177,6 +177,21 @@ protected:
 
 };
 
+namespace com { namespace sun { namespace star { namespace drawing {
+
+std::ostream& operator<<(std::ostream& rStrm, FillStyle n)
+{
+    rStrm << (int) n;
+    return rStrm;
+}
+std::ostream& operator<<(std::ostream& rStrm, LineStyle n)
+{
+    rStrm << (int) n;
+    return rStrm;
+}
+
+} } } }
+
 namespace {
 
 struct CheckForChartName
diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 871b41bc5376..ec82f813de56 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -154,6 +154,26 @@ private:
 
 };
 
+namespace com { namespace sun { namespace star { namespace drawing {
+
+std::ostream& operator<<(std::ostream& rStrm, FillStyle n)
+{
+    rStrm << (int) n;
+    return rStrm;
+}
+
+} } } }
+
+namespace com { namespace sun { namespace star { namespace chart2 {
+
+std::ostream& operator<<(std::ostream& rStrm, CurveStyle n)
+{
+    rStrm << (int) n;
+    return rStrm;
+}
+
+} } } }
+
 // error bar import
 // split method up into smaller chunks for more detailed tests
 void Chart2ImportTest::Fdo60083()
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 96f4f01360fa..b62f1705acd4 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -1183,7 +1183,7 @@ void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, con
     css::chart::ChartDataRowSource eChartDataRowSource = css::chart::ChartDataRowSource_ROWS;
     if( ! (rOuterValue >>= eChartDataRowSource) )
     {
-        sal_Int32 nNew = css::chart::ChartDataRowSource_ROWS;
+        sal_Int32 nNew = (sal_Int32)css::chart::ChartDataRowSource_ROWS;
         if( !(rOuterValue >>= nNew) )
             throw lang::IllegalArgumentException( "Property DataRowSource requires css::chart::ChartDataRowSource value", nullptr, 0 );
         else
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
index f7ef66fbd572..1336709da311 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -279,7 +279,7 @@ Any WrappedSplineTypeProperty::convertOuterToInnerValue( const Any& rOuterValue
             aInnerValue = chart2::CurveStyle_STEP_CENTER_Y;
             break;
         default:
-            SAL_WARN_IF(chart2::CurveStyle_LINES != 0, "chart2", "Unknown line style");
+            SAL_WARN_IF(nOuterValue != 0, "chart2", "Unknown line style");
             aInnerValue = chart2::CurveStyle_LINES;
     }
 
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx
index 23b89af61ef9..0589039c5eb3 100644
--- a/chart2/source/controller/dialogs/res_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx
@@ -182,7 +182,7 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
     const SfxPoolItem* pPoolItem = nullptr;
     if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, true, &pPoolItem ) == SfxItemState::SET )
     {
-        sal_Int32 nLegendPosition = static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
+        chart2::LegendPosition nLegendPosition = (chart2::LegendPosition) static_cast<const SfxInt32Item*>(pPoolItem)->GetValue();
         switch( nLegendPosition )
         {
             case chart2::LegendPosition_LINE_START:
@@ -211,7 +211,7 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
 
 void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
 {
-    sal_Int32 nLegendPosition = chart2::LegendPosition_CUSTOM;
+    chart2::LegendPosition nLegendPosition = chart2::LegendPosition_CUSTOM;
     if( m_pRbtLeft->IsChecked() )
         nLegendPosition = chart2::LegendPosition_LINE_START;
     else if( m_pRbtTop->IsChecked() )
@@ -220,7 +220,7 @@ void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
         nLegendPosition = chart2::LegendPosition_LINE_END;
     else if( m_pRbtBottom->IsChecked() )
         nLegendPosition = chart2::LegendPosition_PAGE_END;
-    rOutAttrs.Put(SfxInt32Item(SCHATTR_LEGEND_POS, nLegendPosition ));
+    rOutAttrs.Put( SfxInt32Item(SCHATTR_LEGEND_POS, (sal_Int32)nLegendPosition ) );
 
     rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, m_pCbxShow == nullptr || m_pCbxShow->IsChecked()) );
 }
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
index 1bbb029ef294..15af577c6f72 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -339,7 +339,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
         {
             css::chart::ChartAxisPosition eAxisPos( css::chart::ChartAxisPosition_ZERO );
             GetPropertySet()->getPropertyValue( "CrossoverPosition" ) >>= eAxisPos;
-            rOutItemSet.Put( SfxInt32Item( nWhichId, eAxisPos ) );
+            rOutItemSet.Put( SfxInt32Item( nWhichId, (sal_Int32)eAxisPos ) );
         }
         break;
 
@@ -372,7 +372,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
         {
             css::chart::ChartAxisLabelPosition ePos( css::chart::ChartAxisLabelPosition_NEAR_AXIS );
             GetPropertySet()->getPropertyValue( "LabelPosition" ) >>= ePos;
-            rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) );
+            rOutItemSet.Put( SfxInt32Item( nWhichId, (sal_Int32)ePos ) );
         }
         break;
 
@@ -380,7 +380,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
         {
             css::chart::ChartAxisMarkPosition ePos( css::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
             GetPropertySet()->getPropertyValue( "MarkPosition" ) >>= ePos;
-            rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) );
+            rOutItemSet.Put( SfxInt32Item( nWhichId, (sal_Int32)ePos ) );
         }
         break;
 
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index fcd6c3f60dae..8f42dba588f6 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -86,7 +86,7 @@ sal_Int32 lcl_getSymbolStyleForSymbol( const chart2::Symbol & rSymbol )
 
         case chart2::SymbolStyle_POLYGON:
             // to avoid warning
-        case chart2::SymbolStyle_MAKE_FIXED_SIZE:
+        case chart2::SymbolStyle::SymbolStyle_MAKE_FIXED_SIZE:
             // nothing
             break;
     }
diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
index 8d2d25150e48..130e74834f00 100644
--- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx
@@ -179,7 +179,7 @@ void LegendItemConverter::FillSpecialItem(
         {
             chart2::LegendPosition eLegendPos( chart2::LegendPosition_LINE_END );
             GetPropertySet()->getPropertyValue( "AnchorPosition" ) >>= eLegendPos;
-            rOutItemSet.Put( SfxInt32Item(SCHATTR_LEGEND_POS, eLegendPos ) );
+            rOutItemSet.Put( SfxInt32Item(SCHATTR_LEGEND_POS, (sal_Int32)eLegendPos ) );
         }
         break;
    }
diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx
index 6d34a139fba1..18b4fe49f85a 100644
--- a/chart2/source/model/main/DataPointProperties.cxx
+++ b/chart2/source/model/main/DataPointProperties.cxx
@@ -538,7 +538,7 @@ void DataPointProperties::AddDefaultsToMap(
 
     PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DATAPOINT_TEXT_WORD_WRAP, false );
     PropertyHelper::setPropertyValueDefault< OUString >( rOutMap, PROP_DATAPOINT_LABEL_SEPARATOR, " " );
-    PropertyHelper::setPropertyValueDefault<sal_Int32>(rOutMap, PROP_DATAPOINT_LABEL_BORDER_STYLE, drawing::LineStyle_NONE);
+    PropertyHelper::setPropertyValueDefault<sal_Int32>(rOutMap, PROP_DATAPOINT_LABEL_BORDER_STYLE, (sal_Int32)drawing::LineStyle_NONE);
     PropertyHelper::setEmptyPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_COLOR);
     PropertyHelper::setPropertyValueDefault<sal_Int32>(rOutMap, PROP_DATAPOINT_LABEL_BORDER_WIDTH, 0);
     PropertyHelper::setPropertyValueDefault(rOutMap, PROP_DATAPOINT_LABEL_BORDER_DASH, drawing::LineDash());
diff --git a/chart2/source/tools/RelativePositionHelper.cxx b/chart2/source/tools/RelativePositionHelper.cxx
index 185dc2400097..a205d75d6448 100644
--- a/chart2/source/tools/RelativePositionHelper.cxx
+++ b/chart2/source/tools/RelativePositionHelper.cxx
@@ -70,7 +70,7 @@ chart2::RelativePosition RelativePositionHelper::getReanchoredPosition(
                 nShiftHalfWidths  -= 2;
                 nShiftHalfHeights -= 2;
                 break;
-            case drawing::Alignment_MAKE_FIXED_SIZE:
+            case drawing::Alignment::Alignment_MAKE_FIXED_SIZE:
                 break;
         }
 
@@ -107,7 +107,7 @@ chart2::RelativePosition RelativePositionHelper::getReanchoredPosition(
                 nShiftHalfWidths  += 2;
                 nShiftHalfHeights += 2;
                 break;
-            case drawing::Alignment_MAKE_FIXED_SIZE:
+            case drawing::Alignment::Alignment_MAKE_FIXED_SIZE:
                 break;
         }
 
@@ -277,7 +277,7 @@ bool RelativePositionHelper::centerGrow(
         case drawing::Alignment_BOTTOM_RIGHT:
             aPos.Primary += fShiftAmountX;
             break;
-        case drawing::Alignment_MAKE_FIXED_SIZE:
+        case drawing::Alignment::Alignment_MAKE_FIXED_SIZE:
             break;
     }
 
@@ -299,7 +299,7 @@ bool RelativePositionHelper::centerGrow(
         case drawing::Alignment_BOTTOM_RIGHT:
             aPos.Secondary += fShiftAmountY;
             break;
-        case drawing::Alignment_MAKE_FIXED_SIZE:
+        case drawing::Alignment::Alignment_MAKE_FIXED_SIZE:
             break;
     }
 
diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 213d12fec963..22a99d8b8f87 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -58,7 +58,7 @@ ChartItemPool::ChartItemPool():
     rPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_SOURCE - SCHATTR_START] = new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE);
 
     //legend
-    rPoolDefaults[SCHATTR_LEGEND_POS               - SCHATTR_START] = new SfxInt32Item(SCHATTR_LEGEND_POS, css::chart2::LegendPosition_LINE_END );
+    rPoolDefaults[SCHATTR_LEGEND_POS               - SCHATTR_START] = new SfxInt32Item(SCHATTR_LEGEND_POS, (sal_Int32)css::chart2::LegendPosition_LINE_END );
     rPoolDefaults[SCHATTR_LEGEND_SHOW              - SCHATTR_START] = new SfxBoolItem(SCHATTR_LEGEND_SHOW, true);
 
     //text
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 91a3763ae640..ac22c3e26707 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -578,7 +578,7 @@ int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill)
                 m_fZStep += Z_STEP;
                 glUniformMatrix4fv(m_BackgroundMatrixID, 1, GL_FALSE, &m_MVP[0][0]);
             }
-            SetBackGroundColor(COL_BLACK, COL_BLACK, 255);
+            SetBackGroundColor(COL_BLACK, COL_BLACK, css::drawing::FillStyle_SOLID);
 
             glBindBuffer(GL_ARRAY_BUFFER, m_ColorBuffer);
             glBufferData(GL_ARRAY_BUFFER, sizeof(m_BackgroundColor), m_BackgroundColor, GL_STATIC_DRAW);
@@ -861,7 +861,7 @@ int OpenGLRender::RenderArea2DShape()
     return 0;
 }
 
-void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 fillStyle)
+void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, css::drawing::FillStyle fillStyle)
 {
     sal_uInt8 r = (color1 & 0x00FF0000) >> 16;
     sal_uInt8 g = (color1 & 0x0000FF00) >> 8;
@@ -870,12 +870,12 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_
     m_BackgroundColor[0] = (float)r / 255.0f;
     m_BackgroundColor[1] = (float)g / 255.0f;
     m_BackgroundColor[2] = (float)b / 255.0f;
-    m_BackgroundColor[3] = fillStyle ? 1.0 : 0.0;
+    m_BackgroundColor[3] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0;
 
     m_BackgroundColor[4] = (float)r / 255.0f;
     m_BackgroundColor[5] = (float)g / 255.0f;
     m_BackgroundColor[6] = (float)b / 255.0f;
-    m_BackgroundColor[7] = fillStyle ? 1.0 : 0.0;
+    m_BackgroundColor[7] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0;
 
     r = (color2 & 0x00FF0000) >> 16;
     g = (color2 & 0x0000FF00) >> 8;
@@ -884,12 +884,12 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_
     m_BackgroundColor[8] = (float)r / 255.0f;
     m_BackgroundColor[9] = (float)g / 255.0f;
     m_BackgroundColor[10] = (float)b / 255.0f;
-    m_BackgroundColor[11] = fillStyle ? 1.0 : 0.0;
+    m_BackgroundColor[11] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0;
 
     m_BackgroundColor[12] = (float)r / 255.0f;
     m_BackgroundColor[13] = (float)g / 255.0f;
     m_BackgroundColor[14] = (float)b / 255.0f;
-    m_BackgroundColor[15] = fillStyle ? 1.0 : 0.0;
+    m_BackgroundColor[15] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0;
     SAL_INFO("chart2.opengl", "color1 = " << color1 << ", color2 = " << color2);
 
 }
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 0487008d0e9f..86f830bea933 100644
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -12,6 +12,7 @@
 
 #include <vcl/bitmapex.hxx>
 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
 #include <vcl/font.hxx>
 #include <vcl/opengl/OpenGLContext.hxx>
@@ -106,7 +107,7 @@ public:
     void renderDebug();
 #endif
 
-    void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha);
+    void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, css::drawing::FillStyle fillstyle);
 
 private:
 #if 0
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 5cddb573af95..698f7fcc9400 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -653,7 +653,7 @@ chart2::RelativePosition lcl_getDefaultPosition( LegendPosition ePos, const awt:
 
         case LegendPosition_CUSTOM:
             // to avoid warning
-        case LegendPosition_MAKE_FIXED_SIZE:
+        case LegendPosition::LegendPosition_MAKE_FIXED_SIZE:
             // nothing to be set
             break;
     }


More information about the Libreoffice-commits mailing list