diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-10-30 08:41:54 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-10-30 14:26:49 +0100 |
commit | 24d4540088f7b45716e87db3fcf0817518d61fe1 (patch) | |
tree | 8de2a2609ac5b2b920dfd21c630bb766fec7b0b9 /filter | |
parent | e5675d7e03de5962af8828663529a780ca31dd5b (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/pdf/pdfexport.cxx | 30 |
1 files changed, 28 insertions, 2 deletions
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<PropertyValue> oMathTitleRow; + std::optional<PropertyValue> oMathFormulaText; + std::optional<PropertyValue> oMathBorder; + std::optional<PropertyValue> oMathPrintFormat; + std::optional<PropertyValue> 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<PropertyValue> aRenderOptionsVector{ comphelper::makePropertyValue("RenderDevice", uno::Reference<awt::XDevice>(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() ) |