[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - desktop/source

Muhammet Kara (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 8 13:18:35 UTC 2019


 desktop/source/lib/init.cxx |   36 +++++++++++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 5 deletions(-)

New commits:
commit 673726fd8b24bd9e5ae0eeb697703b4e7aa29b24
Author:     Muhammet Kara <muhammet.kara at collabora.com>
AuthorDate: Mon Oct 7 22:08:56 2019 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Tue Oct 8 15:17:46 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 <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 017152e77352..1707cad91d5c 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)
         {
@@ -2186,6 +2186,18 @@ static int doc_saveAs(LibreOfficeKitDocument* pThis, const char* sUrl, const cha
             }
         }
 
+        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" ? true : false;
+
         // '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
@@ -2211,11 +2223,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( bFullSheetPreview + !watermarkText.isEmpty() );
+
+            if (!watermarkText.isEmpty())
+            {
+                aFilterData[ 0 ].Name = "TiledWatermark";
+                aFilterData[ 0 ].Value <<= watermarkText;
+            }
+
+            if (bFullSheetPreview)
+            {
+                int nOptIndex = !watermarkText.isEmpty();
+
+                aFilterData[ nOptIndex ].Name = "SinglePageSheets";
+                aFilterData[ nOptIndex ].Value <<= true;
+            }
+
             aSaveMediaDescriptor["FilterData"] <<= aFilterData;
         }
 


More information about the Libreoffice-commits mailing list