summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authormerttumer <mert.tumer@collabora.com>2019-02-13 17:59:30 +0300
committerMert Tümer <mert.tumer@collabora.com>2019-03-18 13:03:28 +0100
commitdd3d5f7c15ab701c57d29f5c60e1164a0834ca00 (patch)
tree864df826048945221e82e48ead358ad9443122e2 /desktop/source
parente8d8b8270ba1ec2d49ad43b70287e60cb18a3e61 (diff)
Added tiled watermark export option for pdf
Change-Id: I3f28ad64c13dd4bc1b2862e86d2190e46a0ced46 Signed-off-by: merttumer <mert.tumer@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/67779 Tested-by: Jenkins
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/lib/init.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4662fb616c6e..bc5c9b74beba 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1905,6 +1905,25 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
OUString aFilterOptions = getUString(pFilterOptions);
+ // Check if watermark for pdf is passed by filteroptions..
+ // It is not a real filter option so it must be filtered out.
+ OUString watermarkText;
+ int aIndex = -1;
+ if ((aIndex = aFilterOptions.indexOf(",Watermark=")) >= 0)
+ {
+ int bIndex = aFilterOptions.indexOf("WATERMARKEND");
+ watermarkText = aFilterOptions.copy(aIndex+11, bIndex-(aIndex+11));
+ if(aIndex > 0)
+ {
+ OUString temp = aFilterOptions.copy(0, aIndex);
+ aFilterOptions = temp + aFilterOptions.copy(bIndex+12);
+ }
+ else
+ {
+ aFilterOptions.clear();
+ }
+ }
+
// '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
@@ -1930,6 +1949,13 @@ 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())
+ {
+ uno::Sequence< beans::PropertyValue > aFilterData( 1 );
+ aFilterData[ 0 ].Name = "TiledWatermark";
+ aFilterData[ 0 ].Value <<= watermarkText;
+ aSaveMediaDescriptor["FilterData"] <<= aFilterData;
+ }
// add interaction handler too
if (gImpl)