From 24d4540088f7b45716e87db3fcf0817518d61fe1 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 30 Oct 2023 08:41:54 +0300 Subject: Allow passing Math-specific options to PDF export The options present in the Math' Print dialog: * Contents: - Title; - Formula text; - Borders; * Size: - Original size; - Fit to page; - Scaling N% were previously not handled in math_pdf_Export. This change makes them handled, similar to handling of other modules' options. The final handling of them happens in SmDocShell::Impl_Print. TitleRow (boolean; default = true) FormulaText (boolean; default = true) Border (boolean; default = true) PrintFormat (long: 0 - original size; 1 - fit to page; 2 - scaling to PrintScale; default = 0) PrintScale (unsigned short; default = 100) They are also available in command line, as implemented in commit 0c3b8792b712e939d2ad524d554f96616b4844be (PDF export: allow setting filter data keys from the cmdline, 2022-01-24), using JSON syntax. TODO: make these options available in Math' PDF export dialog. Change-Id: I4fcc609e943823a5325a4840988a96c9d5ab3223 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158637 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- filter/source/pdf/pdfexport.cxx | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'filter/source/pdf/pdfexport.cxx') diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index a8f3cda62224..7d07f8182bdc 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -450,7 +450,11 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& OUString aOpenPassword, aPermissionPassword; Reference< beans::XMaterialHolder > xEnc; Sequence< beans::NamedValue > aPreparedPermissionPassword; - + std::optional oMathTitleRow; + std::optional oMathFormulaText; + std::optional oMathBorder; + std::optional oMathPrintFormat; + std::optional oMathPrintScale; // getting the string for the creator OUString aCreator; @@ -674,6 +678,17 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& // Redaction & bitmap related stuff else if ( rProp.Name == "IsRedactMode" ) rProp.Value >>= mbIsRedactMode; + // Math-specific render options + else if (rProp.Name == "TitleRow") + oMathTitleRow = rProp; + else if (rProp.Name == "FormulaText") + oMathFormulaText = rProp; + else if (rProp.Name == "Border") + oMathBorder = rProp; + else if (rProp.Name == "PrintFormat") + oMathPrintFormat = rProp; + else if (rProp.Name == "PrintScale") + oMathPrintScale = rProp; } if (!aSignCertificate.is() && !aSignCertificateSubjectName.isEmpty()) @@ -981,7 +996,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& aPDFExtOutDevData.SetIsReduceImageResolution( mbReduceImageResolution ); aPDFExtOutDevData.SetIsExportNamedDestinations( bExportBmkToDest ); - Sequence< PropertyValue > aRenderOptions{ + std::vector aRenderOptionsVector{ comphelper::makePropertyValue("RenderDevice", uno::Reference(xDevice)), comphelper::makePropertyValue("ExportNotesPages", false), comphelper::makePropertyValue("IsFirstPage", true), @@ -992,6 +1007,17 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& comphelper::makePropertyValue("SinglePageSheets", bSinglePageSheets), comphelper::makePropertyValue("ExportNotesInMargin", bExportNotesInMargin) }; + if (oMathTitleRow) + aRenderOptionsVector.push_back(*oMathTitleRow); + if (oMathFormulaText) + aRenderOptionsVector.push_back(*oMathFormulaText); + if (oMathBorder) + aRenderOptionsVector.push_back(*oMathBorder); + if (oMathPrintFormat) + aRenderOptionsVector.push_back(*oMathPrintFormat); + if (oMathPrintScale) + aRenderOptionsVector.push_back(*oMathPrintScale); + Sequence aRenderOptions = comphelper::containerToSequence(aRenderOptionsVector); Any& rExportNotesValue = aRenderOptions.getArray()[ 1 ].Value; if( !aPageRange.isEmpty() || !aSelection.hasValue() ) -- cgit