diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-04-25 03:33:45 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-04-25 04:13:37 +0200 |
commit | 983396013539ab4643df43afa72a5d14472f9ea8 (patch) | |
tree | 9267e0dc67757cd80650c3be781a8c67bdd3b61f /oox | |
parent | daa28969374f628a8cb265fcb28a73daabcb7236 (diff) |
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
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/chartexport.cxx | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 72ed205e695b..58a532932d8f 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(); |