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

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Mar 30 08:11:10 PDT 2014


 chart2/qa/extras/chart2export.cxx               |   11 +++++++++++
 chart2/qa/extras/data/ods/smoothedLines.ods     |binary
 chart2/source/view/main/ShapeFactory.cxx        |    2 +-
 oox/source/drawingml/chart/seriescontext.cxx    |   15 +++++++++------
 oox/source/drawingml/chart/typegroupcontext.cxx |    5 +++--
 oox/source/export/chartexport.cxx               |   11 +++++------
 6 files changed, 29 insertions(+), 15 deletions(-)

New commits:
commit 6162ce7feb89d2f973ce1077b76ca691f00df1ac
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Mar 30 15:26:42 2014 +0200

    set first position and then size, fdo#75075
    
    Change-Id: Ica8a82619f492bd30929ce88198f621f7a1f88a2

diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 1652673..989337f 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -2067,8 +2067,8 @@ uno::Reference< drawing::XShape > ShapeFactory::createRectangle(
         else
             xTarget->add(xShape);
 
-        xShape->setSize( rSize );
         xShape->setPosition( rPosition );
+        xShape->setSize( rSize );
         uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY_THROW );
         PropertyMapper::setMultiProperties( rPropNames, rPropValues, xPropSet );
     }
commit 8ac95ba6904d68f746e44f276c4297c345182cbf
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Mar 30 00:31:37 2014 +0100

    add test for fdo#74619
    
    Change-Id: I94ed07b730b976f32ce8572f1ccefa96be0a6e77

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 7697bab..8e0a4f9 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -54,6 +54,7 @@ public:
     void testPieChartRotation();
     void testEmbeddingsOleObjectGrabBag();
     void testGapWidthXLSX();
+    void testSmoothedLines();
 
     CPPUNIT_TEST_SUITE(Chart2ExportTest);
     CPPUNIT_TEST(test);
@@ -80,6 +81,7 @@ public:
     CPPUNIT_TEST(testPieChartRotation);
     CPPUNIT_TEST(testEmbeddingsOleObjectGrabBag);
     CPPUNIT_TEST(testGapWidthXLSX);
+    CPPUNIT_TEST(testSmoothedLines);
     CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -554,6 +556,7 @@ void Chart2ExportTest::testUpDownBars()
     assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:upDownBars");
 }
 
+<<<<<<< HEAD
 void Chart2ExportTest::testDoughnutChart()
 {
     load("/chart2/qa/extras/data/docx/", "doughnutChart.docx");
@@ -772,6 +775,14 @@ void Chart2ExportTest::testGapWidthXLSX()
     checkSheetForGapWidthAndOverlap(xChartDoc, 50, 30);
 }
 
+void Chart2ExportTest::testSmoothedLines()
+{
+    load("/chart2/qa/extras/data/ods/", "smoothedLines.ods");
+    xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:ser[1]/c:smooth", "val", "0");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/ods/smoothedLines.ods b/chart2/qa/extras/data/ods/smoothedLines.ods
new file mode 100644
index 0000000..725827e
Binary files /dev/null and b/chart2/qa/extras/data/ods/smoothedLines.ods differ
commit 51a84b701d93a608ecee2451b8b286b6870cebc3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Mar 30 00:30:40 2014 +0100

    enable smoothed property export for line charts, fdo#74619
    
    Change-Id: I1b9796411a6f688f2bc7c53212fb4245c55ab3e1

diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 2b5f9ce..54733ea 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1822,7 +1822,8 @@ void ChartExport::exportSeries( Reference< chart2::XChartType > xChartType, sal_
                         exportSeriesValues( xValuesSeq, nYValueType );
                     }
 
-                    if( eChartType == chart::TYPEID_SCATTER )
+                    if( eChartType == chart::TYPEID_SCATTER
+                            || eChartType == chart::TYPEID_LINE )
                         exportSmooth();
 
                     pFS->endElement( FSNS( XML_c, XML_ser ) );
commit 6d34f1cd928ad444cf9941bd8bc01652c84b67d4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Mar 30 00:19:41 2014 +0100

    adapt smooth import to OOXML and not to MSO 2007
    
    Change-Id: Id1dc62a89e2858f81dc9b6eb8a5f3d9996ba85ec

diff --git a/oox/source/drawingml/chart/seriescontext.cxx b/oox/source/drawingml/chart/seriescontext.cxx
index 4bf61e5..fde2952 100644
--- a/oox/source/drawingml/chart/seriescontext.cxx
+++ b/oox/source/drawingml/chart/seriescontext.cxx
@@ -582,8 +582,9 @@ ContextHandlerRef LineSeriesContext::onCreateContext( sal_Int32 nElement, const
                 case C_TOKEN( marker ):
                     return this;
                 case C_TOKEN( smooth ):
-                    // default is 'false', not 'true' as specified
-                    mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
+                    // TODO: fix for MSO 2007 behavior
+                    // MSO 2007 writes false by default and not true
+                    mrModel.mbSmooth = rAttribs.getBool( XML_val, true );
                     return 0;
                 case C_TOKEN( trendline ):
                     return new TrendlineContext( *this, mrModel.maTrendlines.create() );
@@ -657,8 +658,9 @@ ContextHandlerRef RadarSeriesContext::onCreateContext( sal_Int32 nElement, const
                 case C_TOKEN( marker ):
                     return this;
                 case C_TOKEN( smooth ):
-                    // default is 'false', not 'true' as specified
-                    mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
+                    // TODO: fix for MSO 2007 behavior
+                    // MSO 2007 writes false by default and not true
+                    mrModel.mbSmooth = rAttribs.getBool( XML_val, true );
                     return 0;
                 case C_TOKEN( val ):
                     return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
@@ -695,8 +697,9 @@ ContextHandlerRef ScatterSeriesContext::onCreateContext( sal_Int32 nElement, con
                 case C_TOKEN( marker ):
                     return this;
                 case C_TOKEN( smooth ):
-                    // default is 'false', not 'true' as specified
-                    mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
+                    // TODO: fix for MSO 2007 behavior
+                    // MSO 2007 writes false by default and not true
+                    mrModel.mbSmooth = rAttribs.getBool( XML_val, true );
                     return 0;
                 case C_TOKEN( trendline ):
                     return new TrendlineContext( *this, mrModel.maTrendlines.create() );
diff --git a/oox/source/drawingml/chart/typegroupcontext.cxx b/oox/source/drawingml/chart/typegroupcontext.cxx
index 8b7b7fb..22107e9 100644
--- a/oox/source/drawingml/chart/typegroupcontext.cxx
+++ b/oox/source/drawingml/chart/typegroupcontext.cxx
@@ -232,8 +232,9 @@ ContextHandlerRef LineTypeGroupContext::onCreateContext( sal_Int32 nElement, con
         case C_TOKEN( ser ):
             return new LineSeriesContext( *this, mrModel.maSeries.create() );
         case C_TOKEN( smooth ):
-            // default is 'false', not 'true' as specified
-            mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
+            // TODO: fix for MSO 2007 behavior
+            // MSO 2007 writes false by default and not true
+            mrModel.mbSmooth = rAttribs.getBool( XML_val, true );
             return 0;
         case C_TOKEN( upDownBars ):
             return new UpDownBarsContext( *this, mrModel.mxUpDownBars.create() );
commit 3170fa8f681c26eaba1832a2131ca30a20b18875
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 29 18:45:09 2014 +0100

    export smooth property correctly to OOXML, fdo#74619
    
    MSO 2007 and later have different behavior for the default value.
    Be explicit and always export the element.
    
    Change-Id: Ic8cad67db8c882d3642a6662bf710be2088335b7

diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index b38f308..2b5f9ce 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -3021,12 +3021,10 @@ void ChartExport::exportSmooth()
     sal_Int32 nSplineType = 0;
     if( GetProperty( xPropSet, "SplineType" ) )
         mAny >>= nSplineType;
-    if( nSplineType != 0 )
-    {
-        pFS->singleElement( FSNS( XML_c, XML_smooth ),
-            XML_val, "1",
+    const char* pVal = nSplineType != 0 ? "1" : "0";
+    pFS->singleElement( FSNS( XML_c, XML_smooth ),
+            XML_val, pVal,
             FSEND );
-    }
 }
 
 void ChartExport::exportFirstSliceAng( )


More information about the Libreoffice-commits mailing list