Kaydet (Commit) 2ec293ab authored tarafından Balazs Varga's avatar Balazs Varga Kaydeden (comit) László Németh

tdf#124796 Fix chart primary Y axis scaling

Re-scale the primary Y axis if the secondary axis
is deleted and the dataseries still attached to the
secondary axis.

Change-Id: I6e7958766d23a74569ce8529ddf1bdafa89f1870
Reviewed-on: https://gerrit.libreoffice.org/71302
Tested-by: Jenkins
Reviewed-by: 's avatarLászló Németh <nemeth@numbertext.org>
üst 92d7f55c
......@@ -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);
}
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment