[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 2 commits - filter/source

Jan Holesovsky kendy at collabora.com
Fri Oct 16 08:14:36 PDT 2015


 filter/source/svg/svgexport.cxx |    3 -
 filter/source/svg/svgfilter.cxx |   91 ++++++++++++++++++----------------------
 2 files changed, 45 insertions(+), 49 deletions(-)

New commits:
commit a170f8ca8a96afc59652b6e983c84cace67d4e12
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Oct 16 17:02:13 2015 +0200

    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)

diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 794c713..5bf04d3 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>
@@ -698,7 +699,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 5889762..395bff8 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,22 +106,31 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
     {
         // #i124608# detect 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));
         uno::Reference<frame::XFrame> xFrame(xDesktop->getCurrentFrame(), uno::UNO_QUERY_THROW);
         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);
             uno::Reference<drawing::framework::XControllerManager> xManager(xController, uno::UNO_QUERY_THROW);
@@ -184,18 +194,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 );
 
commit 58f036a2b36e8dd515ca7a2169ac7eb5315b3cc6
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Oct 16 16:21:48 2015 +0200

    svg export: Some whitespace cleanup, fix typos.
    
    Change-Id: I0de8b5229a83d2ed1ccecbd5608c94881b9baad3
    (cherry picked from commit 2cb172582a034dccc40be16f73b369e772c97ecb)

diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index e44c37d..5889762 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -103,7 +103,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
 #ifndef DISABLE_EXPORT
     else if( mxSrcDoc.is() )
     {
-        // #i124608# detext selection
+        // #i124608# detect selection
         bool bSelectionOnly = false;
         bool bGotSelection(false);
 
@@ -116,18 +116,14 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
             }
         }
 
-        uno::Reference< frame::XDesktop2 >                           xDesktop(frame::Desktop::create(mxContext));
-        uno::Reference< frame::XFrame >                              xFrame(xDesktop->getCurrentFrame(),
-                                                                            uno::UNO_QUERY_THROW);
-        uno::Reference<frame::XController >                          xController(xFrame->getController(),
-                                                                                     uno::UNO_QUERY_THROW);
+        uno::Reference<frame::XDesktop2> xDesktop(frame::Desktop::create(mxContext));
+        uno::Reference<frame::XFrame> xFrame(xDesktop->getCurrentFrame(), uno::UNO_QUERY_THROW);
+        uno::Reference<frame::XController > xController(xFrame->getController(), uno::UNO_QUERY_THROW);
 
         if( !mSelectedPages.hasElements() )
         {
-            uno::Reference<drawing::XDrawView >                          xDrawView(xController,
-                                                                                   uno::UNO_QUERY_THROW);
-            uno::Reference<drawing::framework::XControllerManager>       xManager(xController,
-                                                                                  uno::UNO_QUERY_THROW);
+            uno::Reference<drawing::XDrawView> xDrawView(xController, uno::UNO_QUERY_THROW);
+            uno::Reference<drawing::framework::XControllerManager> xManager(xController, uno::UNO_QUERY_THROW);
             uno::Reference<drawing::framework::XConfigurationController> xConfigController(xManager->getConfigurationController());
 
             // which view configuration are we in?
@@ -177,7 +173,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
 
             if( !mSelectedPages.hasElements() )
             {
-                // apparently failed to glean selection - fallback to current page
+                // apparently failed to clean selection - fallback to current page
                 mSelectedPages.realloc( 1 );
                 mSelectedPages[0] = xDrawView->getCurrentPage();
             }
@@ -255,30 +251,31 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
             // may be useful; it may have happened by error)
             bRet = false;
         }
-        else {
-        /*
-         *  We get all master page that are targeted by at least one draw page.
-         *  The master page are put in an unordered set.
-         */
-        ObjectSet aMasterPageTargetSet;
-        for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i )
+        else
         {
-            uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( mSelectedPages[i], uno::UNO_QUERY );
-            if( xMasterPageTarget.is() )
+            /*
+             *  We get all master page that are targeted by at least one draw page.
+             *  The master page are put in an unordered set.
+             */
+            ObjectSet aMasterPageTargetSet;
+            for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i )
             {
-                aMasterPageTargetSet.insert( xMasterPageTarget->getMasterPage() );
+                uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( mSelectedPages[i], uno::UNO_QUERY );
+                if( xMasterPageTarget.is() )
+                {
+                    aMasterPageTargetSet.insert( xMasterPageTarget->getMasterPage() );
+                }
+            }
+            // Later we move them to a uno::Sequence so we can get them by index
+            mMasterPageTargets.realloc( aMasterPageTargetSet.size() );
+            ObjectSet::const_iterator aElem = aMasterPageTargetSet.begin();
+            for( sal_Int32 i = 0; aElem != aMasterPageTargetSet.end(); ++aElem, ++i)
+            {
+                uno::Reference< drawing::XDrawPage > xMasterPage( *aElem,  uno::UNO_QUERY );
+                mMasterPageTargets[i] = xMasterPage;
             }
-        }
-        // Later we move them to a uno::Sequence so we can get them by index
-        mMasterPageTargets.realloc( aMasterPageTargetSet.size() );
-        ObjectSet::const_iterator aElem = aMasterPageTargetSet.begin();
-        for( sal_Int32 i = 0; aElem != aMasterPageTargetSet.end(); ++aElem, ++i)
-        {
-            uno::Reference< drawing::XDrawPage > xMasterPage( *aElem,  uno::UNO_QUERY );
-            mMasterPageTargets[i] = xMasterPage;
-        }
 
-        bRet = implExport( rDescriptor );
+            bRet = implExport( rDescriptor );
         }
     }
 #endif


More information about the Libreoffice-commits mailing list