desktop/source/lib/init.cxx | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-)
New commits: commit 48f278705aa1d0e35317dae6c1c8b13f839a14a1 Author: Muhammet Kara <muhammet.k...@collabora.com> AuthorDate: Mon Oct 7 22:08:56 2019 +0300 Commit: Muhammet Kara <muhammet.k...@collabora.com> CommitDate: Fri Oct 11 10:56:09 2019 +0200 Add FullSheetPreview support for convert-to endpoint of online Change-Id: I31e4f3cbcf0cf49c5446d9460bd42965ce756c0d Reviewed-on: https://gerrit.libreoffice.org/80397 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Muhammet Kara <muhammet.k...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/80461 Tested-by: Jenkins diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 63fd3109788f..4fb369ac997c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2169,7 +2169,7 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha // Check if watermark for pdf is passed by filteroptions... // It is not a real filter option so it must be filtered out. - OUString watermarkText; + OUString watermarkText, sFullSheetPreview; int aIndex = -1; if ((aIndex = aFilterOptions.indexOf(",Watermark=")) >= 0) { @@ -2180,6 +2180,18 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha aFilterOptions = temp + aFilterOptions.copy(bIndex+12); } + aIndex = -1; + if ((aIndex = aFilterOptions.indexOf(",FullSheetPreview=")) >= 0) + { + int bIndex = aFilterOptions.indexOf("FULLSHEETPREVEND"); + sFullSheetPreview = aFilterOptions.copy(aIndex+18, bIndex-(aIndex+18)); + + OUString temp = aFilterOptions.copy(0, aIndex); + aFilterOptions = temp + aFilterOptions.copy(bIndex+16); + } + + bool bFullSheetPreview = sFullSheetPreview == "true"; + // 'TakeOwnership' == this is a 'real' SaveAs (that is, the document // gets a new name). When this is not provided, the meaning of // saveAs() is more like save-a-copy, which allows saving to any @@ -2205,11 +2217,25 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha auto aFilteredOptionSeq = comphelper::containerToSequence<OUString>(aFilteredOptionVec); aFilterOptions = comphelper::string::convertCommaSeparated(aFilteredOptionSeq); aSaveMediaDescriptor[MediaDescriptor::PROP_FILTEROPTIONS()] <<= aFilterOptions; - if(!watermarkText.isEmpty()) + + if(!watermarkText.isEmpty() || bFullSheetPreview) { - uno::Sequence< beans::PropertyValue > aFilterData( 1 ); - aFilterData[ 0 ].Name = "TiledWatermark"; - aFilterData[ 0 ].Value <<= watermarkText; + uno::Sequence< beans::PropertyValue > aFilterData( static_cast<int>(bFullSheetPreview) + static_cast<int>(!watermarkText.isEmpty()) ); + + if (!watermarkText.isEmpty()) + { + aFilterData[ 0 ].Name = "TiledWatermark"; + aFilterData[ 0 ].Value <<= watermarkText; + } + + if (bFullSheetPreview) + { + int nOptIndex = static_cast<int>(!watermarkText.isEmpty()); + + aFilterData[ nOptIndex ].Name = "SinglePageSheets"; + aFilterData[ nOptIndex ].Value <<= true; + } + aSaveMediaDescriptor["FilterData"] <<= aFilterData; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits