Blob Blame History Raw
From 60f544a37be5431e603c22da10d827537afcc90d Mon Sep 17 00:00:00 2001
From: Jan Holesovsky <kendy@collabora.com>
Date: Fri, 16 Oct 2015 17:02:13 +0200
Subject: [PATCH 217/398] lok svg export: Default to exporting all slides, use
 the interactive SVG.

The slides to export can be tweaked via a "PagePos" parameter.

Change-Id: I66f19521bd8f699710eefafb29f54036d7e604c3
(cherry picked from commit e0769daf7b4335024733fa43b26cd0ef0b03108f)
---
 filter/source/svg/svgexport.cxx |  3 ++-
 filter/source/svg/svgfilter.cxx | 32 +++++++++++++++-----------------
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 5201e9730467..03d25389f27b 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -29,6 +29,7 @@
 #include <com/sun/star/util/MeasureUnit.hpp>
 #include <com/sun/star/xml/sax/Writer.hpp>
 
+#include <comphelper/lok.hxx>
 #include <rtl/bootstrap.hxx>
 #include <svtools/miscopt.hxx>
 #include <svx/unopage.hxx>
@@ -716,7 +717,7 @@ bool SVGFilter::implExportDocument()
     SvtMiscOptions aMiscOptions;
     const bool bExperimentalMode = aMiscOptions.IsExperimentalMode();
 
-    mbSinglePage = (nLastPage == 0) || !bExperimentalMode;
+    mbSinglePage = ((nLastPage == 0) || !bExperimentalMode) && !comphelper::LibreOfficeKit::isActive();
     mnVisiblePage = -1;
 
     const Reference< XPropertySet >             xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index e44c37d9136f..0f268c221fa7 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -20,6 +20,7 @@
 
 #include <cstdio>
 
+#include <comphelper/lok.hxx>
 #include <comphelper/servicedecl.hxx>
 #include <uno/environment.h>
 #include <com/sun/star/drawing/XDrawPage.hpp>
@@ -105,15 +106,24 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
     {
         // #i124608# detext selection
         bool bSelectionOnly = false;
-        bool bGotSelection(false);
+        bool bGotSelection = false;
 
-        // #i124608# extract Single selection wanted from dialog return values
-        for ( sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++ )
+        // when using LibreOfficeKit, default to exporting everything (-1)
+        bool bPageProvided = comphelper::LibreOfficeKit::isActive();
+        sal_Int32 nPageToExport = -1;
+
+        for (sal_Int32 nInd = 0; nInd < rDescriptor.getLength(); nInd++)
         {
-            if ( rDescriptor[nInd].Name == "SelectionOnly" )
+            if (rDescriptor[nInd].Name == "SelectionOnly")
             {
+                // #i124608# extract single selection wanted from dialog return values
                 rDescriptor[nInd].Value >>= bSelectionOnly;
             }
+            else if (rDescriptor[nInd].Name == "PagePos")
+            {
+                rDescriptor[nInd].Value >>= nPageToExport;
+                bPageProvided = true;
+            }
         }
 
         uno::Reference< frame::XDesktop2 >                           xDesktop(frame::Desktop::create(mxContext));
@@ -122,7 +132,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
         uno::Reference<frame::XController >                          xController(xFrame->getController(),
                                                                                      uno::UNO_QUERY_THROW);
 
-        if( !mSelectedPages.hasElements() )
+        if (!bPageProvided)
         {
             uno::Reference<drawing::XDrawView >                          xDrawView(xController,
                                                                                    uno::UNO_QUERY_THROW);
@@ -188,18 +198,6 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
          */
         if( !mSelectedPages.hasElements() )
         {
-            sal_Int32            nLength = rDescriptor.getLength();
-            const PropertyValue* pValue = rDescriptor.getConstArray();
-            sal_Int32            nPageToExport = -1;
-
-            for ( sal_Int32 i = 0 ; i < nLength; ++i)
-            {
-                if ( pValue[ i ].Name == "PagePos" )
-                {
-                    pValue[ i ].Value >>= nPageToExport;
-                }
-            }
-
             uno::Reference< drawing::XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, uno::UNO_QUERY );
             uno::Reference< drawing::XDrawPagesSupplier >   xDrawPagesSupplier( mxSrcDoc, uno::UNO_QUERY );
 
-- 
2.12.0