summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/view/main/ChartView.cxx18
-rw-r--r--sw/qa/extras/layout/data/tdf124796.odtbin0 -> 14342 bytes
-rw-r--r--sw/qa/extras/layout/layout.cxx24
3 files changed, 40 insertions, 2 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 8b0548f909ee..d165ccb05251 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -441,6 +441,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
bool bConnectBars = false;
bool bGroupBarsPerAxis = true;
bool bIncludeHiddenCells = true;
+ bool bSecondaryYaxisVisible = true;
sal_Int32 nStartingAngle = 90;
sal_Int32 n3DRelativeHeight = 100;
try
@@ -479,7 +480,19 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
{
uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
VCoordinateSystem* pVCooSys = addCooSysToList(m_rVCooSysList,xCooSys,rChartModel);
-
+ // Let's check whether the secondary Y axis is visible
+ try
+ {
+ Reference< beans::XPropertySet > xAxisProp(xCooSys->getAxisByDimension(1, 1), uno::UNO_QUERY);
+ if (xAxisProp.is())
+ {
+ xAxisProp->getPropertyValue("Show") >>= bSecondaryYaxisVisible;
+ }
+ }
+ catch (const lang::IndexOutOfBoundsException& e)
+ {
+ SAL_WARN("chart2", "Exception caught. " << e);
+ }
//iterate through all chart types in the current coordinate system
uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
OSL_ASSERT( xChartTypeContainer.is());
@@ -563,7 +576,8 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
//ignore secondary axis for charttypes that do not support them
if( pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX &&
- !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ) )
+ ( !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ) ||
+ !bSecondaryYaxisVisible ) )
{
pSeries->setAttachedAxisIndex(MAIN_AXIS_INDEX);
}
diff --git a/sw/qa/extras/layout/data/tdf124796.odt b/sw/qa/extras/layout/data/tdf124796.odt
new file mode 100644
index 000000000000..2a8d2c816ad1
--- /dev/null
+++ b/sw/qa/extras/layout/data/tdf124796.odt
Binary files differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 91705c8e18d9..c17adf1bba92 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2340,6 +2340,30 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122800)
// This failed, if the textarray length of the first axis label not 22.
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf124796)
+{
+ SwDoc* pDoc = createDoc("tdf124796.odt");
+ SwDocShell* pShell = pDoc->GetDocShell();
+
+ // Dump the rendering of the first page as an XML file.
+ std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+ MetafileXmlDump dumper;
+ xmlDocPtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // This failed, if the minimum value of Y axis is not -10.
+ assertXPathContent(
+ pXmlDoc,
+ "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[5]/text",
+ "-10");
+
+ // This failed, if the maximum value of Y axis is not 15.
+ assertXPathContent(
+ pXmlDoc,
+ "/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/push[1]/push[1]/textarray[10]/text",
+ "15");
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf116925)
{
SwDoc* pDoc = createDoc("tdf116925.docx");