summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-11-06 15:50:32 +0100
committerLászló Németh <nemeth@numbertext.org>2019-11-08 13:19:47 +0100
commitf6437b3a98256cd2782164fedefbc109bf5ab114 (patch)
tree5b434a82578cc09d2ede9eb99a8c435f80d05b94 /oox
parent37e3573bb5739c94890c18ed11b4f4cc8a4df67f (diff)
tdf#128618 OOXML chart export: deleted automatic title returns on save
If there is no main title and/or subtitle, write out autoTitleDeleted with a true value. Regression from the commit 96a29c12a9d8734c9d2a812f38fc6654b5df9c48 (tdf#101322 Chart OOXML Export: fix missing subtitle) Change-Id: I0094014fc4da4cb66d31e4249f916452d00758c7 Reviewed-on: https://gerrit.libreoffice.org/82142 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx47
1 files changed, 25 insertions, 22 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 040014912b32..aeb2c8012674 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -917,7 +917,7 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC
// get Properties of ChartDocument
bool bHasMainTitle = false;
- bool bHasSubTitle = false;
+ OUString aSubTitle;
bool bHasLegend = false;
Reference< beans::XPropertySet > xDocPropSet( xChartDoc, uno::UNO_QUERY );
if( xDocPropSet.is())
@@ -926,8 +926,6 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC
{
Any aAny( xDocPropSet->getPropertyValue("HasMainTitle"));
aAny >>= bHasMainTitle;
- aAny = xDocPropSet->getPropertyValue("HasSubTitle");
- aAny >>= bHasSubTitle;
aAny = xDocPropSet->getPropertyValue("HasLegend");
aAny >>= bHasLegend;
}
@@ -937,33 +935,38 @@ void ChartExport::exportChart( const Reference< css::chart::XChartDocument >& xC
}
} // if( xDocPropSet.is())
- // chart element
+ Reference< beans::XPropertySet > xPropSubTitle( xChartDoc->getSubTitle(), UNO_QUERY );
+ if( xPropSubTitle.is())
+ {
+ try
+ {
+ xPropSubTitle->getPropertyValue("String") >>= aSubTitle;
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ }
+ }
+ // chart element
FSHelperPtr pFS = GetFS();
pFS->startElement(FSNS(XML_c, XML_chart));
// titles
- if( bHasMainTitle || bHasSubTitle )
+ if( bHasMainTitle )
{
- OUString aSubText;
- Reference< drawing::XShape > xShape;
- if( bHasSubTitle )
- {
- xShape = xChartDoc->getSubTitle();
- if( bHasMainTitle )
- {
- // if we have a title and a subtitle too, we need only the subtitle text
- Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
- if( xPropSet.is() )
- xPropSet->getPropertyValue("String") >>= aSubText;
- }
- }
- if( bHasMainTitle )
- xShape = xChartDoc->getTitle();
-
- exportTitle( xShape, !aSubText.isEmpty() ? &aSubText : nullptr );
+ exportTitle( xChartDoc->getTitle(), !aSubTitle.isEmpty() ? &aSubTitle : nullptr );
pFS->singleElement(FSNS(XML_c, XML_autoTitleDeleted), XML_val, "0");
}
+ else if( !aSubTitle.isEmpty() )
+ {
+ exportTitle( xChartDoc->getSubTitle(), nullptr );
+ pFS->singleElement(FSNS(XML_c, XML_autoTitleDeleted), XML_val, "0");
+ }
+ else
+ {
+ pFS->singleElement(FSNS(XML_c, XML_autoTitleDeleted), XML_val, "1");
+ }
+
InitPlotArea( );
if( mbIs3DChart )
{