sc export chart as graphic: handle PDF

Desktop / LibreOffice - Miklos Vajna [collabora.com] - 4 January 2022 18:02 UTC

The context menu for Calc charts would call into GraphicFilter::ExportGraphic(), which has explicit code for e.g. SVG, but not for PDF. The graphic exporter to PDF is only meant to work with images backed with PDF data, not with all shapes.

Fix the problem by explicitly handling PDF in GraphicHelper::SaveShapeAsGraphic() in svx/, and invoking the normal PDF export in that case. Continue to fall back to XGraphicExportFilter for other formats.

This requires passing down the current document from sc/.

Change-Id: Ia5f78bffa1d26989bb0ad3ed265b922e609f076f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127969

77d2bbaa18e0 sc export chart as graphic: handle PDF
include/svx/graphichelper.hxx | 12 +++++-
sc/source/ui/drawfunc/chartsh.cxx | 9 +++-
svx/CppunitTest_svx_core.mk | 48 ++++++++++++++++++++++
svx/Module_svx.mk | 1 +
svx/qa/unit/core.cxx | 84 ++++++++++++++++++++++++++++++++++++++
svx/qa/unit/data/chart.ods | Bin 0 -> 19734 bytes
svx/source/core/graphichelper.cxx | 80 ++++++++++++++++++++++++++----------
7 files changed, 211 insertions(+), 23 deletions(-)

Upstream: cgit.freedesktop.org


  • Share