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

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Apr 24 19:16:42 PDT 2015


 chart2/qa/extras/chart2export.cxx                       |   30 ++
 chart2/qa/extras/chart2import.cxx                       |    2 
 chart2/qa/extras/charttest.hxx                          |    6 
 chart2/qa/extras/data/xlsx/plot_area_manual_layout.xlsx |binary
 include/oox/export/chartexport.hxx                      |  113 ++++----
 oox/source/export/chartexport.cxx                       |  203 +++++++++++-----
 6 files changed, 235 insertions(+), 119 deletions(-)

New commits:
commit 967b8c33225ae2aab5733639f0713a84cb1971da
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 25 04:13:05 2015 +0200

    add test for plotArea manualLayout, tdf#90851
    
    Change-Id: I18ac4e702a7ef4a2d9dbb4ba7d0ece1e69c7e379

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 00bec71..2535dcb 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -91,6 +91,7 @@ public:
     void testBubble3DXLSX();
     void testNoMarkerXLSX();
     void testTitleManualLayoutXLSX();
+    void testPlotAreaManualLayoutXLSX();
 
     CPPUNIT_TEST_SUITE(Chart2ExportTest);
     CPPUNIT_TEST(testErrorBarXLSX);
@@ -146,6 +147,7 @@ public:
     CPPUNIT_TEST(testBubble3DXLSX);
     CPPUNIT_TEST(testNoMarkerXLSX);
     CPPUNIT_TEST(testTitleManualLayoutXLSX);
+    CPPUNIT_TEST(testPlotAreaManualLayoutXLSX);
     CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -1338,6 +1340,34 @@ void Chart2ExportTest::testTitleManualLayoutXLSX()
     assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:bodyPr", "rot", "1200000");
 }
 
+void Chart2ExportTest::testPlotAreaManualLayoutXLSX()
+{
+    load("/chart2/qa/extras/data/xlsx/", "plot_area_manual_layout.xlsx");
+    xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:xMode", "val", "edge");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:yMode", "val", "edge");
+
+    OUString aXVal = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:x", "val");
+    double nX = aXVal.toDouble();
+    CPPUNIT_ASSERT(nX > 0 && nX < 1);
+
+    OUString aYVal = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:y", "val");
+    double nY = aYVal.toDouble();
+    CPPUNIT_ASSERT(nY > 0 && nY < 1);
+    CPPUNIT_ASSERT(nX != nY);
+
+    OUString aWVal = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:w", "val");
+    double nW = aWVal.toDouble();
+    CPPUNIT_ASSERT(nW > 0 && nW < 1);
+
+    OUString aHVal = getXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:layout/c:manualLayout/c:h", "val");
+    double nH = aHVal.toDouble();
+    CPPUNIT_ASSERT(nH > 0 && nH < 1);
+    CPPUNIT_ASSERT(nH != nW);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/xlsx/plot_area_manual_layout.xlsx b/chart2/qa/extras/data/xlsx/plot_area_manual_layout.xlsx
new file mode 100644
index 0000000..f0bc588
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/plot_area_manual_layout.xlsx differ
commit 8ccb2c0ed7e15329cf44fa82feb0435d42c891f9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 25 03:51:01 2015 +0200

    and in the chart tests
    
    Change-Id: I1ed69bb1c09982e8d0964a700da9b22b66af82f8

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 71588c1..9150b30 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -637,7 +637,7 @@ void Chart2ImportTest::testTransparentBackground(OUString const & filename)
     Reference< beans::XPropertySet > xPropSet( xChart2Doc->getArea(), uno::UNO_QUERY);
     CPPUNIT_ASSERT_MESSAGE("failed to get Area", xPropSet.is());
 
-    com::sun::star::drawing::FillStyle aStyle;
+    css::drawing::FillStyle aStyle;
     xPropSet -> getPropertyValue("FillStyle") >>= aStyle;
 
     CPPUNIT_ASSERT_MESSAGE("Background needs to be with solid fill style", aStyle == 1);
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx
index e640118..6e7be74 100644
--- a/chart2/qa/extras/charttest.hxx
+++ b/chart2/qa/extras/charttest.hxx
@@ -64,8 +64,8 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/make_shared.hpp>
 
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
+using namespace css;
+using namespace css::uno;
 
 class ChartTest : public test::BootstrapFixture, public unotest::MacrosTest
 {
@@ -152,7 +152,7 @@ void ChartTest::setUp()
 {
     test::BootstrapFixture::setUp();
 
-    mxDesktop.set( com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ) );
+    mxDesktop.set( css::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) ) );
 }
 
 void ChartTest::tearDown()
commit 8536af3439a94787e8f785da30776b83942fb82e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 25 03:49:31 2015 +0200

    do the same in the source file
    
    Change-Id: I087d5da6280d889e1e155559edf9c70c5c5ffaba

diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 76d9ec8..e0f8745 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -94,26 +94,26 @@
 
 #include <rtl/math.hxx>
 
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::drawing;
+using namespace css;
+using namespace css::uno;
+using namespace css::drawing;
 using namespace ::oox::core;
-using ::com::sun::star::beans::PropertyState;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::beans::XPropertySet;
-using ::com::sun::star::beans::XPropertyState;
-using ::com::sun::star::container::XEnumeration;
-using ::com::sun::star::container::XEnumerationAccess;
-using ::com::sun::star::container::XIndexAccess;
-using ::com::sun::star::container::XNamed;
-using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::sheet::XFormulaParser;
-using ::com::sun::star::sheet::XFormulaTokens;
+using css::beans::PropertyState;
+using css::beans::PropertyValue;
+using css::beans::XPropertySet;
+using css::beans::XPropertyState;
+using css::container::XEnumeration;
+using css::container::XEnumerationAccess;
+using css::container::XIndexAccess;
+using css::container::XNamed;
+using css::io::XOutputStream;
+using css::table::CellAddress;
+using css::sheet::XFormulaParser;
+using css::sheet::XFormulaTokens;
 using ::oox::core::XmlFilterBase;
 using ::sax_fastparser::FSHelperPtr;
 
-namespace cssc = com::sun::star::chart;
+namespace cssc = css::chart;
 
 namespace oox { namespace drawingml {
 
@@ -484,12 +484,12 @@ OUString ChartExport::parseFormula( const OUString& rRange )
         Reference< XPropertySet > xParserProps( xParser, uno::UNO_QUERY );
         if( xParserProps.is() )
         {
-            xParserProps->setPropertyValue("FormulaConvention", uno::makeAny(::com::sun::star::sheet::AddressConvention::OOO) );
+            xParserProps->setPropertyValue("FormulaConvention", uno::makeAny(css::sheet::AddressConvention::OOO) );
         }
         uno::Sequence<sheet::FormulaToken> aTokens = xParser->parseFormula( rRange, CellAddress( 0, 0, 0 ) );
         if( xParserProps.is() )
         {
-            xParserProps->setPropertyValue("FormulaConvention", uno::makeAny(::com::sun::star::sheet::AddressConvention::XL_OOX) );
+            xParserProps->setPropertyValue("FormulaConvention", uno::makeAny(css::sheet::AddressConvention::XL_OOX) );
         }
         aResult = xParser->printFormula( aTokens, CellAddress( 0, 0, 0 ) );
     }
@@ -673,7 +673,7 @@ void ChartExport::ExportContent()
 
 void ChartExport::_ExportContent()
 {
-    Reference< ::com::sun::star::chart::XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
+    Reference< css::chart::XChartDocument > xChartDoc( getModel(), uno::UNO_QUERY );
     if( xChartDoc.is())
     {
         // determine if data comes from the outside
@@ -732,7 +732,7 @@ void ChartExport::_ExportContent()
     }
 }
 
-void ChartExport::exportChartSpace( Reference< ::com::sun::star::chart::XChartDocument > rChartDoc,
+void ChartExport::exportChartSpace( Reference< css::chart::XChartDocument > rChartDoc,
                                       bool bIncludeTable )
 {
     FSHelperPtr pFS = GetFS();
@@ -771,7 +771,7 @@ void ChartExport::exportChartSpace( Reference< ::com::sun::star::chart::XChartDo
     pFS->endElement( FSNS( XML_c, XML_chartSpace ) );
 }
 
-void ChartExport::exportExternalData( Reference< ::com::sun::star::chart::XChartDocument > rChartDoc )
+void ChartExport::exportExternalData( Reference< css::chart::XChartDocument > rChartDoc )
 {
     // Embedded external data is grab bagged for docx file hence adding export part of
     // external data for docx files only.
@@ -822,7 +822,7 @@ void ChartExport::exportExternalData( Reference< ::com::sun::star::chart::XChart
     }
 }
 
-void ChartExport::exportChart( Reference< ::com::sun::star::chart::XChartDocument > rChartDoc )
+void ChartExport::exportChart( Reference< css::chart::XChartDocument > rChartDoc )
 {
     Reference< chart2::XChartDocument > xNewDoc( rChartDoc, uno::UNO_QUERY );
     mxDiagram.set( rChartDoc->getDiagram() );
@@ -948,7 +948,7 @@ void ChartExport::exportMissingValueTreatment(uno::Reference<beans::XPropertySet
             FSEND);
 }
 
-void ChartExport::exportLegend( Reference< ::com::sun::star::chart::XChartDocument > rChartDoc )
+void ChartExport::exportLegend( Reference< css::chart::XChartDocument > rChartDoc )
 {
     FSHelperPtr pFS = GetFS();
     pFS->startElement( FSNS( XML_c, XML_legend ),
@@ -958,7 +958,7 @@ void ChartExport::exportLegend( Reference< ::com::sun::star::chart::XChartDocume
     if( xProp.is() )
     {
         // position
-        ::com::sun::star::chart::ChartLegendPosition aLegendPos = ::com::sun::star::chart::ChartLegendPosition_NONE;
+        css::chart::ChartLegendPosition aLegendPos = css::chart::ChartLegendPosition_NONE;
         try
         {
             Any aAny( xProp->getPropertyValue(
@@ -973,20 +973,20 @@ void ChartExport::exportLegend( Reference< ::com::sun::star::chart::XChartDocume
         const char* strPos = NULL;
         switch( aLegendPos )
         {
-            case ::com::sun::star::chart::ChartLegendPosition_LEFT:
+            case css::chart::ChartLegendPosition_LEFT:
                 strPos = "l";
                 break;
-            case ::com::sun::star::chart::ChartLegendPosition_RIGHT:
+            case css::chart::ChartLegendPosition_RIGHT:
                 strPos = "r";
                 break;
-            case ::com::sun::star::chart::ChartLegendPosition_TOP:
+            case css::chart::ChartLegendPosition_TOP:
                 strPos = "t";
                 break;
-            case ::com::sun::star::chart::ChartLegendPosition_BOTTOM:
+            case css::chart::ChartLegendPosition_BOTTOM:
                 strPos = "b";
                 break;
-            case ::com::sun::star::chart::ChartLegendPosition_NONE:
-            case ::com::sun::star::chart::ChartLegendPosition_MAKE_FIXED_SIZE:
+            case css::chart::ChartLegendPosition_NONE:
+            case css::chart::ChartLegendPosition_MAKE_FIXED_SIZE:
                 // nothing
                 break;
         }
@@ -1262,7 +1262,7 @@ void ChartExport::exportPlotArea( )
      * Export the Plot area Shape Properties
      * eg: Fill and Outline
      */
-    Reference< ::com::sun::star::chart::X3DDisplay > xWallFloorSupplier( mxDiagram, uno::UNO_QUERY );
+    Reference< css::chart::X3DDisplay > xWallFloorSupplier( mxDiagram, uno::UNO_QUERY );
     if( xWallFloorSupplier.is() )
     {
         Reference< beans::XPropertySet > xWallPropSet( xWallFloorSupplier->getWall(), uno::UNO_QUERY );
@@ -1529,7 +1529,7 @@ void ChartExport::exportBarChart( Reference< chart2::XChartType > xChartType )
     if( mbIs3DChart )
     {
         // Shape
-        namespace cssc = ::com::sun::star::chart;
+        namespace cssc = css::chart;
         sal_Int32 nGeom3d = cssc::ChartSolidType::RECTANGULAR_SOLID;
         if( xPropSet.is() && GetProperty( xPropSet, "SolidType") )
             mAny >>= nGeom3d;
@@ -1625,7 +1625,7 @@ void ChartExport::exportLineChart( Reference< chart2::XChartType > xChartType )
     exportSeries( xChartType, nAttachedAxis );
 
     // show marker?
-    sal_Int32 nSymbolType = ::com::sun::star::chart::ChartSymbolType::NONE;
+    sal_Int32 nSymbolType = css::chart::ChartSymbolType::NONE;
     Reference< XPropertySet > xPropSet( mxDiagram , uno::UNO_QUERY);
     if( GetProperty( xPropSet, "SymbolType" ) )
         mAny >>= nSymbolType;
@@ -1634,7 +1634,7 @@ void ChartExport::exportLineChart( Reference< chart2::XChartType > xChartType )
     {
         exportHiLowLines();
         exportUpDownBars(xChartType);
-        const char* marker = nSymbolType == ::com::sun::star::chart::ChartSymbolType::NONE? "0":"1";
+        const char* marker = nSymbolType == css::chart::ChartSymbolType::NONE? "0":"1";
         pFS->singleElement( FSNS( XML_c, XML_marker ),
                 XML_val, marker,
                 FSEND );
@@ -1707,7 +1707,7 @@ void ChartExport::exportScatterChart( Reference< chart2::XChartType > xChartType
             FSEND );
     // TODO:scatterStyle
 
-    sal_Int32 nSymbolType = ::com::sun::star::chart::ChartSymbolType::NONE;
+    sal_Int32 nSymbolType = css::chart::ChartSymbolType::NONE;
     Reference< XPropertySet > xPropSet( mxDiagram , uno::UNO_QUERY);
     if( GetProperty( xPropSet, "SymbolType" ) )
         mAny >>= nSymbolType;
@@ -1743,7 +1743,7 @@ void ChartExport::exportStockChart( Reference< chart2::XChartType > xChartType )
     sal_Int32 nAttachedAxis = AXIS_PRIMARY_Y;
     exportSeries( xChartType, nAttachedAxis );
     // export stock properties
-    Reference< ::com::sun::star::chart::XStatisticDisplay > xStockPropProvider( mxDiagram, uno::UNO_QUERY );
+    Reference< css::chart::XStatisticDisplay > xStockPropProvider( mxDiagram, uno::UNO_QUERY );
     if( xStockPropProvider.is())
     {
         exportHiLowLines();
@@ -1759,7 +1759,7 @@ void ChartExport::exportHiLowLines()
 {
     FSHelperPtr pFS = GetFS();
     // export the chart property
-    Reference< ::com::sun::star::chart::XStatisticDisplay > xChartPropProvider( mxDiagram, uno::UNO_QUERY );
+    Reference< css::chart::XStatisticDisplay > xChartPropProvider( mxDiagram, uno::UNO_QUERY );
 
     if (!xChartPropProvider.is())
         return;
@@ -1781,7 +1781,7 @@ void ChartExport::exportUpDownBars( Reference< chart2::XChartType > xChartType)
 
     FSHelperPtr pFS = GetFS();
     // export the chart property
-    Reference< ::com::sun::star::chart::XStatisticDisplay > xChartPropProvider( mxDiagram, uno::UNO_QUERY );
+    Reference< css::chart::XStatisticDisplay > xChartPropProvider( mxDiagram, uno::UNO_QUERY );
     if(xChartPropProvider.is())
     {
         //  updownbar
@@ -1926,7 +1926,7 @@ void ChartExport::exportSeries( Reference< chart2::XChartType > xChartType, sal_
                         if( GetProperty( xPropSet, "Axis") )
                         {
                             mAny >>= nAttachedAxis;
-                            if( nAttachedAxis == ::com::sun::star::chart::ChartAxisAssign::SECONDARY_Y )
+                            if( nAttachedAxis == css::chart::ChartAxisAssign::SECONDARY_Y )
                                 nAttachedAxis = AXIS_SECONDARY_Y;
                             else
                                 nAttachedAxis = AXIS_PRIMARY_Y;
@@ -2365,7 +2365,7 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
     {
         case AXIS_PRIMARY_X:
         {
-            Reference< ::com::sun::star::chart::XAxisXSupplier > xAxisXSupp( mxDiagram, uno::UNO_QUERY );
+            Reference< css::chart::XAxisXSupplier > xAxisXSupp( mxDiagram, uno::UNO_QUERY );
             if( xAxisXSupp.is())
                 xAxisProp = xAxisXSupp->getXAxis();
             if( bHasXAxisTitle )
@@ -2387,7 +2387,7 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
         }
         case AXIS_PRIMARY_Y:
         {
-            Reference< ::com::sun::star::chart::XAxisYSupplier > xAxisYSupp( mxDiagram, uno::UNO_QUERY );
+            Reference< css::chart::XAxisYSupplier > xAxisYSupp( mxDiagram, uno::UNO_QUERY );
             if( xAxisYSupp.is())
                 xAxisProp = xAxisYSupp->getYAxis();
             if( bHasYAxisTitle )
@@ -2404,7 +2404,7 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
         }
         case AXIS_PRIMARY_Z:
         {
-            Reference< ::com::sun::star::chart::XAxisZSupplier > xAxisZSupp( mxDiagram, uno::UNO_QUERY );
+            Reference< css::chart::XAxisZSupplier > xAxisZSupp( mxDiagram, uno::UNO_QUERY );
             if( xAxisZSupp.is())
                 xAxisProp = xAxisZSupp->getZAxis();
             if( bHasZAxisTitle )
@@ -2426,12 +2426,12 @@ void ChartExport::exportAxis(const AxisIdPair& rAxisIdPair)
         }
         case AXIS_SECONDARY_Y:
         {
-            Reference< ::com::sun::star::chart::XTwoAxisYSupplier > xAxisTwoYSupp( mxDiagram, uno::UNO_QUERY );
+            Reference< css::chart::XTwoAxisYSupplier > xAxisTwoYSupp( mxDiagram, uno::UNO_QUERY );
             if( xAxisTwoYSupp.is())
                 xAxisProp = xAxisTwoYSupp->getSecondaryYAxis();
             if( bHasSecondaryYAxisTitle )
             {
-                Reference< ::com::sun::star::chart::XSecondAxisTitleSupplier > xAxisSupp( mxDiagram, uno::UNO_QUERY );
+                Reference< css::chart::XSecondAxisTitleSupplier > xAxisSupp( mxDiagram, uno::UNO_QUERY );
                 xAxisTitle.set( xAxisSupp->getSecondYAxisTitle(), uno::UNO_QUERY );
             }
 
@@ -2576,8 +2576,8 @@ void ChartExport::_exportAxis(
     if(GetProperty( xAxisProp, "Marks" ) )
     {
         mAny >>= nValue;
-        bool bInner = nValue & ::com::sun::star::chart::ChartAxisMarks::INNER;
-        bool bOuter = nValue & ::com::sun::star::chart::ChartAxisMarks::OUTER;
+        bool bInner = nValue & css::chart::ChartAxisMarks::INNER;
+        bool bOuter = nValue & css::chart::ChartAxisMarks::OUTER;
         const char* majorTickMark = NULL;
         if( bInner && bOuter )
             majorTickMark = "cross";
@@ -2595,8 +2595,8 @@ void ChartExport::_exportAxis(
     if(GetProperty( xAxisProp, "HelpMarks" ) )
     {
         mAny >>= nValue;
-        bool bInner = nValue & ::com::sun::star::chart::ChartAxisMarks::INNER;
-        bool bOuter = nValue & ::com::sun::star::chart::ChartAxisMarks::OUTER;
+        bool bInner = nValue & css::chart::ChartAxisMarks::INNER;
+        bool bOuter = nValue & css::chart::ChartAxisMarks::OUTER;
         const char* minorTickMark = NULL;
         if( bInner && bOuter )
             minorTickMark = "cross";
@@ -2617,18 +2617,18 @@ void ChartExport::_exportAxis(
         mAny >>= bDisplayLabel;
     if( bDisplayLabel && (GetProperty( xAxisProp, "LabelPosition" ) ) )
     {
-        ::com::sun::star::chart::ChartAxisLabelPosition eLabelPosition = ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS;
+        css::chart::ChartAxisLabelPosition eLabelPosition = css::chart::ChartAxisLabelPosition_NEAR_AXIS;
         mAny >>= eLabelPosition;
         switch( eLabelPosition )
         {
-            case ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS:
-            case ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE:
+            case css::chart::ChartAxisLabelPosition_NEAR_AXIS:
+            case css::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE:
                 sTickLblPos = "nextTo";
                 break;
-            case ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START:
+            case css::chart::ChartAxisLabelPosition_OUTSIDE_START:
                 sTickLblPos = "low";
                 break;
-            case ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END:
+            case css::chart::ChartAxisLabelPosition_OUTSIDE_END:
                 sTickLblPos = "high";
                 break;
             default:
@@ -2656,17 +2656,17 @@ void ChartExport::_exportAxis(
     const char* sCrosses = NULL;
     if(GetProperty( xAxisProp, "CrossoverPosition" ) )
     {
-        ::com::sun::star::chart::ChartAxisPosition ePosition( ::com::sun::star::chart::ChartAxisPosition_ZERO );
+        css::chart::ChartAxisPosition ePosition( css::chart::ChartAxisPosition_ZERO );
         mAny >>= ePosition;
         switch( ePosition )
         {
-            case ::com::sun::star::chart::ChartAxisPosition_START:
+            case css::chart::ChartAxisPosition_START:
                 sCrosses = "min";
                 break;
-            case ::com::sun::star::chart::ChartAxisPosition_END:
+            case css::chart::ChartAxisPosition_END:
                 sCrosses = "max";
                 break;
-            case ::com::sun::star::chart::ChartAxisPosition_ZERO:
+            case css::chart::ChartAxisPosition_ZERO:
                 sCrosses = "autoZero";
                 break;
             default:
commit 720c787e117771cc8fc940085a2d7b1c81b1f151
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 25 03:47:09 2015 +0200

    replace com::sun::star with css in chart ooxml export
    
    Change-Id: Ia508cecc0a06fd1af5adca9756dce394337260fc

diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index 98ca528..2a3ff80 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -85,17 +85,17 @@ public:
 private:
     sal_Int32           mnXmlNamespace;
     sal_Int32           mnSeriesCount;
-    ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
-    com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
-    com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram;
+    css::uno::Reference< css::frame::XModel > mxChartModel;
+    css::uno::Reference< css::chart::XDiagram > mxDiagram;
+    css::uno::Reference< css::chart2::XDiagram > mxNewDiagram;
 
     // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
     bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
     OUString msChartAddress;
-    ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
+    css::uno::Sequence< sal_Int32 > maSequenceMapping;
 
-    //::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
-    ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > mxCategoriesValues;
+    //css::uno::Reference< css::drawing::XShapes > mxAdditionalShapes;
+    css::uno::Reference< css::chart2::data::XDataSequence > mxCategoriesValues;
 
     AxisVector          maAxes;
     bool                mbHasZAxis;
@@ -110,61 +110,61 @@ private:
     void InitPlotArea();
 
     void _ExportContent();
-    void exportChartSpace( com::sun::star::uno::Reference<
-                           com::sun::star::chart::XChartDocument > rChartDoc,
+    void exportChartSpace( css::uno::Reference<
+                           css::chart::XChartDocument > rChartDoc,
                            bool bIncludeTable );
-    void exportChart( com::sun::star::uno::Reference<
-                          com::sun::star::chart::XChartDocument > rChartDoc );
-    void exportExternalData( com::sun::star::uno::Reference<
-                              com::sun::star::chart::XChartDocument > rChartDoc );
-    void exportLegend( com::sun::star::uno::Reference<
-                          com::sun::star::chart::XChartDocument > rChartDoc );
-    void exportTitle( com::sun::star::uno::Reference<
-                          ::com::sun::star::drawing::XShape > xShape );
+    void exportChart( css::uno::Reference<
+                          css::chart::XChartDocument > rChartDoc );
+    void exportExternalData( css::uno::Reference<
+                              css::chart::XChartDocument > rChartDoc );
+    void exportLegend( css::uno::Reference<
+                          css::chart::XChartDocument > rChartDoc );
+    void exportTitle( css::uno::Reference<
+                          css::drawing::XShape > xShape );
     void exportPlotArea( );
-    void exportPlotAreaShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet  );
-    void exportFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
-    void exportGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
-    void exportBitmapFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+    void exportPlotAreaShapeProps( css::uno::Reference< css::beans::XPropertySet > xPropSet  );
+    void exportFill( css::uno::Reference< css::beans::XPropertySet > xPropSet );
+    void exportGradientFill( css::uno::Reference< css::beans::XPropertySet > xPropSet );
+    void exportBitmapFill( css::uno::Reference< css::beans::XPropertySet > xPropSet );
     void exportDataTable( );
 
-    void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
-    void exportSurfaceChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+    void exportAreaChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportBarChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportBubbleChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportDoughnutChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportLineChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportPieChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportRadarChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportScatterChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportStockChart( css::uno::Reference< css::chart2::XChartType > xChartType );
+    void exportSurfaceChart( css::uno::Reference< css::chart2::XChartType > xChartType );
     void exportHiLowLines();
-    void exportUpDownBars(com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+    void exportUpDownBars(css::uno::Reference< css::chart2::XChartType > xChartType );
 
-    void exportSeries( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis );
+    void exportSeries( css::uno::Reference< css::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis );
     void exportCandleStickSeries(
-        const ::com::sun::star::uno::Sequence<
-            ::com::sun::star::uno::Reference<
-                ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
+        const css::uno::Sequence<
+            css::uno::Reference<
+                css::chart2::XDataSeries > > & aSeriesSeq,
         bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis );
     void exportSeriesText(
-        const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
+        const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
     void exportSeriesCategory(
-        const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
+        const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq );
     void exportSeriesValues(
-        const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
-    void exportShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+        const css::uno::Reference< css::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
+    void exportShapeProps( css::uno::Reference< css::beans::XPropertySet > xPropSet );
     void exportDataPoints(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
+        const css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties,
         sal_Int32 nSeriesLength );
     void exportDataLabels( const css::uno::Reference<css::chart2::XDataSeries>& xSeries, sal_Int32 nSeriesLength, sal_Int32 eChartType );
     void exportGrouping( bool isBar = false );
-    void exportTrendlines( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > xSeries );
-    void exportMarker( ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > xSeries );
+    void exportTrendlines( css::uno::Reference< css::chart2::XDataSeries > xSeries );
+    void exportMarker( css::uno::Reference< css::chart2::XDataSeries > xSeries );
     void exportSmooth();
     void exportFirstSliceAng();
 
-    void exportErrorBar(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xErrorBarProps,
+    void exportErrorBar(css::uno::Reference< css::beans::XPropertySet > xErrorBarProps,
             bool bYError);
 
     void exportManualLayout(const css::chart2::RelativePosition& rPos, const css::chart2::RelativeSize& rSize);
@@ -172,10 +172,10 @@ private:
     void exportAxes( );
     void exportAxis(const AxisIdPair& rAxisIdPair);
     void _exportAxis(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid,
+        const css::uno::Reference< css::beans::XPropertySet >& xAxisProp,
+        const css::uno::Reference< css::drawing::XShape >& xAxisTitle,
+        const css::uno::Reference< css::beans::XPropertySet >& xMajorGrid,
+        const css::uno::Reference< css::beans::XPropertySet >& xMinorGrid,
         sal_Int32 nAxisType,
         const char* sAxisPos,
         const AxisIdPair& rAxisIdPair );
@@ -183,25 +183,25 @@ private:
     void exportView3D();
     bool isDeep3dChart();
 
-    void exportMissingValueTreatment(com::sun::star::uno::Reference<
-            com::sun::star::beans::XPropertySet> xPropSet);
+    void exportMissingValueTreatment(css::uno::Reference<
+            css::beans::XPropertySet> xPropSet);
 
     OUString getNumberFormatCode(sal_Int32 nKey) const;
 
 public:
 
-    ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+    ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, css::uno::Reference< css::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
     virtual ~ChartExport() {}
 
     sal_Int32           GetChartID( );
-    ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; }
+    css::uno::Reference< css::frame::XModel > getModel(){ return mxChartModel; }
 
-    ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount );
+    ChartExport& WriteChartObj( const css::uno::Reference< css::drawing::XShape >& xShape, sal_Int32 nChartCount );
 
     void ExportContent();
     void InitRangeSegmentationProperties(
-        const ::com::sun::star::uno::Reference<
-            ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+        const css::uno::Reference<
+            css::chart2::XChartDocument > & xChartDoc );
 };
 
 }}
commit 7dc420b1099f05c90be436d88381f4040ef05532
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 25 03:44:58 2015 +0200

    correct handling for manualLayout with differen anchor, tdf#90851
    
    Change-Id: I6ec242b955e1f5623041cc8f8779b6c2be0f126c

diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 58a5329..76d9ec8 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1288,20 +1288,60 @@ void ChartExport::exportManualLayout(const css::chart2::RelativePosition& rPos,
             XML_val, "edge",
             FSEND);
 
+    double x = rPos.Primary;
+    double y = rPos.Secondary;
+    double w = rSize.Primary;
+    double h = rSize.Secondary;
+    switch (rPos.Anchor)
+    {
+        case drawing::Alignment_LEFT:
+            y -= (h/2);
+        break;
+        case drawing::Alignment_TOP_LEFT:
+        break;
+        case drawing::Alignment_BOTTOM_LEFT:
+            y -= h;
+        break;
+        case drawing::Alignment_TOP:
+            x -= (w/2);
+        break;
+        case drawing::Alignment_CENTER:
+            x -= (w/2);
+            y -= (h/2);
+        break;
+        case drawing::Alignment_BOTTOM:
+            x -= (w/2);
+            y -= h;
+        break;
+        case drawing::Alignment_TOP_RIGHT:
+            x -= w;
+        break;
+        case drawing::Alignment_BOTTOM_RIGHT:
+            x -= w;
+            y -= h;
+        break;
+        case drawing::Alignment_RIGHT:
+            y -= (h/2);
+            x -= w;
+        break;
+        default:
+            SAL_WARN("oox.chart", "unhandled alignment case for manual layout export");
+    }
+
     pFS->singleElement(FSNS(XML_c, XML_x),
-            XML_val, IS(rPos.Primary),
+            XML_val, IS(x),
             FSEND);
 
     pFS->singleElement(FSNS(XML_c, XML_y),
-            XML_val, IS(rPos.Secondary),
+            XML_val, IS(y),
             FSEND);
 
     pFS->singleElement(FSNS(XML_c, XML_w),
-            XML_val, IS(rSize.Primary),
+            XML_val, IS(w),
             FSEND);
 
     pFS->singleElement(FSNS(XML_c, XML_h),
-            XML_val, IS(rSize.Secondary),
+            XML_val, IS(h),
             FSEND);
 
     pFS->endElement(FSNS(XML_c, XML_manualLayout));
commit 983396013539ab4643df43afa72a5d14472f9ea8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Apr 25 03:33:45 2015 +0200

    first part for manualLayout plot area support, tdf#90851
    
    still some positioning problems. Most likely we need to handle
    chart2::RelativePosition::Anchor for correct positioning.
    
    Change-Id: Iecd0ced684203d2c11aab3c55e04f8c7f699779a

diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index 8ac7fe6..98ca528 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -27,6 +27,9 @@
 #include <sax/fshelper.hxx>
 #include <vcl/mapmod.hxx>
 
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart2/RelativeSize.hpp>
+
 namespace com { namespace sun { namespace star {
     namespace chart {
         class XDiagram;
@@ -164,6 +167,8 @@ private:
     void exportErrorBar(com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xErrorBarProps,
             bool bYError);
 
+    void exportManualLayout(const css::chart2::RelativePosition& rPos, const css::chart2::RelativeSize& rSize);
+
     void exportAxes( );
     void exportAxis(const AxisIdPair& rAxisIdPair);
     void _exportAxis(
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 72ed205..58a5329 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -49,7 +49,6 @@
 
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/chart2/XDiagram.hpp>
-#include <com/sun/star/chart2/RelativePosition.hpp>
 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
 #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
@@ -1155,9 +1154,19 @@ void ChartExport::exportPlotArea( )
     FSHelperPtr pFS = GetFS();
     pFS->startElement( FSNS( XML_c, XML_plotArea ),
             FSEND );
-    // layout
-    pFS->singleElement( FSNS( XML_c, XML_layout ),
-            FSEND );
+
+    Reference<beans::XPropertySet> xWall(mxNewDiagram, uno::UNO_QUERY);
+    if( xWall.is() )
+    {
+        uno::Any aAny = xWall->getPropertyValue("RelativePosition");
+        if (aAny.hasValue())
+        {
+            chart2::RelativePosition aPos = aAny.get<chart2::RelativePosition>();
+            aAny = xWall->getPropertyValue("RelativeSize");
+            chart2::RelativeSize aSize = aAny.get<chart2::RelativeSize>();
+            exportManualLayout(aPos, aSize);
+        }
+    }
 
     // chart type
     Sequence< Reference< chart2::XCoordinateSystem > >
@@ -1267,6 +1276,38 @@ void ChartExport::exportPlotArea( )
 
 }
 
+void ChartExport::exportManualLayout(const css::chart2::RelativePosition& rPos, const css::chart2::RelativeSize& rSize)
+{
+    FSHelperPtr pFS = GetFS();
+    pFS->startElement(FSNS(XML_c, XML_layout), FSEND);
+    pFS->startElement(FSNS(XML_c, XML_manualLayout), FSEND);
+    pFS->singleElement(FSNS(XML_c, XML_xMode),
+            XML_val, "edge",
+            FSEND);
+    pFS->singleElement(FSNS(XML_c, XML_yMode),
+            XML_val, "edge",
+            FSEND);
+
+    pFS->singleElement(FSNS(XML_c, XML_x),
+            XML_val, IS(rPos.Primary),
+            FSEND);
+
+    pFS->singleElement(FSNS(XML_c, XML_y),
+            XML_val, IS(rPos.Secondary),
+            FSEND);
+
+    pFS->singleElement(FSNS(XML_c, XML_w),
+            XML_val, IS(rSize.Primary),
+            FSEND);
+
+    pFS->singleElement(FSNS(XML_c, XML_h),
+            XML_val, IS(rSize.Secondary),
+            FSEND);
+
+    pFS->endElement(FSNS(XML_c, XML_manualLayout));
+    pFS->endElement(FSNS(XML_c, XML_layout));
+}
+
 void ChartExport::exportPlotAreaShapeProps( Reference< XPropertySet > xPropSet )
 {
     FSHelperPtr pFS = GetFS();


More information about the Libreoffice-commits mailing list