[Libreoffice-commits] core.git: desktop/source filter/Configuration_filter.mk filter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Dec 14 23:20:47 UTC 2018


 desktop/source/lib/init.cxx                                |   18 +++++--
 filter/Configuration_filter.mk                             |    2 
 filter/source/config/fragments/filters/calc_svg_Export.xcu |   30 +++++++++++++
 filter/source/svg/svgexport.cxx                            |   20 ++++----
 filter/source/svg/svgfilter.cxx                            |   18 +++----
 filter/source/svg/svgfilter.hxx                            |   18 +++----
 6 files changed, 72 insertions(+), 34 deletions(-)

New commits:
commit 870d30c62bb5f579dfa4e6fb2e32dd796159f3b3
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Dec 14 22:06:35 2018 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sat Dec 15 00:20:21 2018 +0100

    lok: Implement SVG export for Calc (SelectionOnly mode)
    
    Change-Id: Ic305e5305890fd1efa3a3130e5216f9c672870e5
    Reviewed-on: https://gerrit.libreoffice.org/65175
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e9675be766f6..0537d3808d61 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2619,13 +2619,19 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu
         uno::Reference<io::XOutputStream> xOut = new utl::OOutputStreamWrapper(aOutStream);
 
         utl::MediaDescriptor aMediaDescriptor;
-        if (doc_getDocumentType(pThis) == LOK_DOCTYPE_PRESENTATION)
-        {
-            aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export");
-        }
-        else if(doc_getDocumentType(pThis) == LOK_DOCTYPE_TEXT)
+        switch (doc_getDocumentType(pThis))
         {
-            aMediaDescriptor["FilterName"] <<= OUString("writer_svg_Export");
+            case LOK_DOCTYPE_PRESENTATION:
+                aMediaDescriptor["FilterName"] <<= OUString("impress_svg_Export");
+                break;
+            case LOK_DOCTYPE_TEXT:
+                aMediaDescriptor["FilterName"] <<= OUString("writer_svg_Export");
+                break;
+            case LOK_DOCTYPE_SPREADSHEET:
+                aMediaDescriptor["FilterName"] <<= OUString("calc_svg_Export");
+                break;
+            default:
+                SAL_WARN("lok", "Failed to render shape selection: Document type is not supported");
         }
         aMediaDescriptor["SelectionOnly"] <<= true;
         aMediaDescriptor["OutputStream"] <<= xOut;
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index b56e0ae39bc8..97023325c94e 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -802,11 +802,13 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writergraphics
 # fcfg_calcgraphics
 $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_calcgraphics_types.xcu,filter/source/config/fragments/types,\
 	png_Portable_Network_Graphic \
+	svg_Scalable_Vector_Graphics \
 ))
 
 $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calcgraphics_filters.xcu,filter/source/config/fragments/filters,\
 	calc_jpg_Export \
 	calc_png_Export \
+	calc_svg_Export \
 ))
 
 # fcfg_internalgraphics
diff --git a/filter/source/config/fragments/filters/calc_svg_Export.xcu b/filter/source/config/fragments/filters/calc_svg_Export.xcu
new file mode 100644
index 000000000000..703ce82e9778
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_svg_Export.xcu
@@ -0,0 +1,30 @@
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+    <node oor:name="calc_svg_Export" oor:op="replace">
+        <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER INTERNAL NOTINFILEDIALOG</value></prop>
+        <prop oor:name="UIComponent"/>
+        <prop oor:name="FilterService"><value>com.sun.star.comp.Draw.SVGFilter</value></prop>
+        <prop oor:name="UserData"><value></value></prop>
+        <prop oor:name="UIName">
+            <value xml:lang="en-US">SVG - Scalable Vector Graphics</value>
+        </prop>
+        <prop oor:name="FileFormatVersion"><value>0</value></prop>
+        <prop oor:name="Type"><value>svg_Scalable_Vector_Graphics</value></prop>
+        <prop oor:name="TemplateName"/>
+        <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+    </node>
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 729fd2e29c2c..2dd294fba105 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -531,13 +531,13 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
         }
     }
 
-    if(mbWriterFilter)
-       return implExportWriter(xOStm);
+    if(mbWriterOrCalcFilter)
+       return implExportWriterOrCalc(xOStm);
 
-    return implExportImpressDraw(xOStm);
+    return implExportImpressOrDraw(xOStm);
 }
 
-bool SVGFilter::implExportImpressDraw( const Reference< XOutputStream >& rxOStm)
+bool SVGFilter::implExportImpressOrDraw( const Reference< XOutputStream >& rxOStm)
 {
     Reference< XComponentContext >        xContext( ::comphelper::getProcessComponentContext() ) ;
     bool                                  bRet = false;
@@ -629,7 +629,7 @@ bool SVGFilter::implExportImpressDraw( const Reference< XOutputStream >& rxOStm)
 }
 
 
-bool SVGFilter::implExportWriter( const Reference< XOutputStream >& rxOStm )
+bool SVGFilter::implExportWriterOrCalc( const Reference< XOutputStream >& rxOStm )
 {
     Reference< XComponentContext >        xContext( ::comphelper::getProcessComponentContext() ) ;
     bool                                  bRet = false;
@@ -773,10 +773,10 @@ bool SVGFilter::implExportDocument()
         }
     }
 
-    if(mbWriterFilter)
-        implExportDocumentHeaderWriter(nDocX, nDocY, nDocWidth, nDocHeight);
+    if(mbWriterOrCalcFilter)
+        implExportDocumentHeaderWriterOrCalc(nDocX, nDocY, nDocWidth, nDocHeight);
     else
-        implExportDocumentHeaderImpressDraw(nDocX, nDocY, nDocWidth, nDocHeight);
+        implExportDocumentHeaderImpressOrDraw(nDocX, nDocY, nDocWidth, nDocHeight);
 
 
     if( implLookForFirstVisiblePage() )  // OK! We found at least one visible page.
@@ -835,7 +835,7 @@ bool SVGFilter::implExportDocument()
     return bRet;
 }
 
-void SVGFilter::implExportDocumentHeaderImpressDraw(sal_Int32 nDocX, sal_Int32 nDocY,
+void SVGFilter::implExportDocumentHeaderImpressOrDraw(sal_Int32 nDocX, sal_Int32 nDocY,
                                                     sal_Int32 nDocWidth, sal_Int32 nDocHeight)
 {
     const Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
@@ -928,7 +928,7 @@ void SVGFilter::implExportDocumentHeaderImpressDraw(sal_Int32 nDocX, sal_Int32 n
     }
 }
 
-void SVGFilter::implExportDocumentHeaderWriter(sal_Int32 nDocX, sal_Int32 nDocY,
+void SVGFilter::implExportDocumentHeaderWriterOrCalc(sal_Int32 nDocX, sal_Int32 nDocY,
                                                sal_Int32 nDocWidth, sal_Int32 nDocHeight)
 {
     OUString aAttr;
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index 539891c8b5ae..3f3b0d2b8e00 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -88,7 +88,7 @@ SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) :
     mbExportShapeSelection(false),
     maFilterData(),
     mxDefaultPage(),
-    mbWriterFilter(false),
+    mbWriterOrCalcFilter(false),
     mpDefaultSdrPage( nullptr ),
     mpSdrModel( nullptr ),
     mbPresentation( false ),
@@ -107,10 +107,10 @@ SVGFilter::~SVGFilter()
 
 sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescriptor )
 {
-    mbWriterFilter = false;
+    mbWriterOrCalcFilter = false;
 
     if(mxDstDoc.is()) // Import works for Impress / draw only
-        return filterImpressDraw(rDescriptor);
+        return filterImpressOrDraw(rDescriptor);
 
     if(mxSrcDoc.is())
     {
@@ -120,20 +120,20 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
             {
                 OUString sFilterName;
                 rDescriptor[nInd].Value >>= sFilterName;
-                if(sFilterName == "writer_svg_Export")
+                if(sFilterName != "impress_svg_Export")
                 {
-                    mbWriterFilter = true;
-                    return filterWriter(rDescriptor);
+                    mbWriterOrCalcFilter = true;
+                    return filterWriterOrCalc(rDescriptor);
                 }
                 break;
             }
         }
-        return filterImpressDraw(rDescriptor);
+        return filterImpressOrDraw(rDescriptor);
     }
     return false;
 }
 
-bool SVGFilter::filterImpressDraw( const Sequence< PropertyValue >& rDescriptor )
+bool SVGFilter::filterImpressOrDraw( const Sequence< PropertyValue >& rDescriptor )
 {
     SolarMutexGuard aGuard;
     vcl::Window* pFocusWindow(Application::GetFocusWindow());
@@ -536,7 +536,7 @@ bool SVGFilter::filterImpressDraw( const Sequence< PropertyValue >& rDescriptor
     return bRet;
 }
 
-bool SVGFilter::filterWriter( const Sequence< PropertyValue >& rDescriptor )
+bool SVGFilter::filterWriterOrCalc( const Sequence< PropertyValue >& rDescriptor )
 {
     bool bSelectionOnly = false;
 
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index 5a70c3c63679..baaea0519537 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -211,7 +211,7 @@ private:
     Reference< css::drawing::XDrawPage > mxDefaultPage;
     std::vector< Reference< css::drawing::XDrawPage > > mSelectedPages;
 
-    bool                                mbWriterFilter;
+    bool                                mbWriterOrCalcFilter;
 
 
     /// Impress / draw only members
@@ -233,8 +233,8 @@ private:
 
     /// @throws css::uno::RuntimeException
     bool                            implExport( const Sequence< PropertyValue >& rDescriptor );
-    bool                            implExportImpressDraw( const Reference< XOutputStream >& rxOStm );
-    bool                            implExportWriter( const Reference< XOutputStream >& rxOStm );
+    bool                            implExportImpressOrDraw( const Reference< XOutputStream >& rxOStm );
+    bool                            implExportWriterOrCalc( const Reference< XOutputStream >& rxOStm );
     static Reference< XWriter >     implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
 
     void                            implGetPagePropSet( const Reference< css::drawing::XDrawPage > & rxPage );
@@ -246,10 +246,10 @@ private:
     void                            implGenerateScript();
 
     bool                            implExportDocument();
-    void                            implExportDocumentHeaderImpressDraw(sal_Int32 nDocX, sal_Int32 nDocY,
-                                                                        sal_Int32 nDocWidth, sal_Int32 nDocHeight);
-    void                            implExportDocumentHeaderWriter(sal_Int32 nDocX, sal_Int32 nDocY,
-                                                                   sal_Int32 nDocWidth, sal_Int32 nDocHeight);
+    void                            implExportDocumentHeaderImpressOrDraw(sal_Int32 nDocX, sal_Int32 nDocY,
+                                                                          sal_Int32 nDocWidth, sal_Int32 nDocHeight);
+    void                            implExportDocumentHeaderWriterOrCalc(sal_Int32 nDocX, sal_Int32 nDocY,
+                                                                         sal_Int32 nDocWidth, sal_Int32 nDocHeight);
     void                            implExportAnimations();
 
     bool                            implExportMasterPages( const std::vector< Reference< css::drawing::XDrawPage > >& rxPages,
@@ -281,8 +281,8 @@ private:
                                                                 const Reference< XPropertySetInfo > & rxPropSetInfo );
     DECL_LINK( CalcFieldHdl, EditFieldInfo*, void );
 
-    bool filterImpressDraw( const Sequence< PropertyValue >& rDescriptor );
-    bool filterWriter( const Sequence< PropertyValue >& rDescriptor );
+    bool filterImpressOrDraw( const Sequence< PropertyValue >& rDescriptor );
+    bool filterWriterOrCalc( const Sequence< PropertyValue >& rDescriptor );
 
 protected:
 


More information about the Libreoffice-commits mailing list