filter/Configuration_filter.mk                                                 
     |    4 +
 
filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu
 |   30 ++++++++++
 filter/source/config/fragments/filters/draw_apng_Export.xcu                    
     |   30 ++++++++++
 filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu          
     |   27 +++++++++
 
filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu 
    |   29 +++++++++
 include/vcl/graphicfilter.hxx                                                  
     |    1 
 svx/source/xoutdev/_xoutbmp.cxx                                                
     |    4 +
 vcl/source/filter/graphicfilter.cxx                                            
     |   10 +++
 8 files changed, 134 insertions(+), 1 deletion(-)

New commits:
commit 01230c5c499d3f9c010b88e0b5ee9649cbe80190
Author:     Paris Oplopoios <paris.oplopo...@collabora.com>
AuthorDate: Sun Aug 20 23:04:41 2023 +0300
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Sun Aug 27 08:29:39 2023 +0200

    Add APNG export option in File -> Export
    
    A separate filter was made to allow for the option of exporting a still
    image instead if the user wants to
    
    Change-Id: I8140c834990e592ee579425d6cd18ae764128576
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155878
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 939234b1dc15..bd3d3486234e 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -726,6 +726,7 @@ $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_typ
 ))
 
 $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_filters.xcu,filter/source/config/fragments/filters,\
+       APNG___Animated_Portable_Network_Graphic \
        BMP___MS_Windows \
        DXF___AutoCAD_Interchange \
        EMF___MS_Windows_Metafile \
@@ -757,6 +758,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f
        draw_PCD_Photo_CD_Base \
        draw_PCD_Photo_CD_Base16 \
        draw_PCD_Photo_CD_Base4 \
+       draw_apng_Export \
        draw_bmp_Export \
        draw_emf_Export \
        draw_emz_Export \
@@ -845,6 +847,7 @@ $(eval $(call 
filter_Configuration_add_filters,fcfg_langpack,fcfg_calcgraphics_f
 
 # fcfg_internalgraphics
 $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics_types.xcu,filter/source/config/fragments/types,\
+       apng_Animated_Portable_Network_Graphic \
        bmp_MS_Windows \
        dxf_AutoCAD_Interchange \
        emf_MS_Windows_Metafile \
@@ -878,6 +881,7 @@ $(eval $(call 
filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics
 ))
 
 $(eval $(call 
filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_internalgraphics_filters.xcu,filter/source/config/fragments/internalgraphicfilters,\
+       apng_Export \
        bmp_Export \
        bmp_Import \
        dxf_Import \
diff --git 
a/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu
 
b/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.xcu
new file mode 100644
index 000000000000..79c118c46d10
--- /dev/null
+++ 
b/filter/source/config/fragments/filters/APNG___Animated_Portable_Network_Graphic.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="APNG - Animated Portable Network Graphic" oor:op="replace">
+        <prop oor:name="Flags"><value>IMPORT ALIEN</value></prop>
+        <prop oor:name="UIComponent"/>
+        <prop oor:name="FilterService"/>
+        <prop oor:name="UserData"><value></value></prop>
+        <prop oor:name="UIName">
+            <value xml:lang="en-US">APNG - Animated Portable Network 
Graphics</value>
+        </prop>
+        <prop oor:name="FileFormatVersion"><value>0</value></prop>
+        <prop 
oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</value></prop>
+        <prop oor:name="TemplateName"/>
+        <prop 
oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+    </node>
diff --git a/filter/source/config/fragments/filters/draw_apng_Export.xcu 
b/filter/source/config/fragments/filters/draw_apng_Export.xcu
new file mode 100644
index 000000000000..f413ca74711a
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_apng_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="draw_apng_Export" oor:op="replace">
+        <prop oor:name="Flags"><value>EXPORT ALIEN 
SUPPORTSSELECTION</value></prop>
+        <prop 
oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+        <prop oor:name="FilterService"/>
+        <prop oor:name="UserData"><value></value></prop>
+        <prop oor:name="UIName">
+            <value xml:lang="en-US">APNG - Animated Portable Network 
Graphics</value>
+        </prop>
+        <prop oor:name="FileFormatVersion"><value>0</value></prop>
+        <prop 
oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</value></prop>
+        <prop oor:name="TemplateName"/>
+        <prop 
oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+    </node>
diff --git 
a/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu 
b/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu
new file mode 100644
index 000000000000..2bf240fa801a
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/apng_Export.xcu
@@ -0,0 +1,27 @@
+<!--
+ * 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="apng_Export" oor:op="replace"  >
+        <prop 
oor:name="Type"><value>apng_Animated_Portable_Network_Graphic</value></prop>
+        <prop oor:name="FormatName"><value>SVEAPNG</value></prop>
+        <prop oor:name="RealFilterName"/>
+        <prop 
oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+        <prop oor:name="UIName">
+            <value xml:lang="en-US">APNG - Animated Portable Network 
Graphics</value>
+        </prop>
+        <prop oor:name="Flags"><value>EXPORT</value></prop>
+    </node>
diff --git 
a/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu
 
b/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu
new file mode 100644
index 000000000000..b094e81e912d
--- /dev/null
+++ 
b/filter/source/config/fragments/types/apng_Animated_Portable_Network_Graphic.xcu
@@ -0,0 +1,29 @@
+<!--
+ * 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="apng_Animated_Portable_Network_Graphic" oor:op="replace" >
+        <prop 
oor:name="DetectService"><value>com.sun.star.comp.draw.FormatDetector</value></prop>
+        <prop oor:name="URLPattern"/>
+        <prop oor:name="Extensions"><value>apng</value></prop>
+        <prop oor:name="MediaType"><value>image/apng</value></prop>
+        <prop oor:name="Preferred"><value>false</value></prop>
+        <prop oor:name="PreferredFilter"><value>APNG - Animated Portable 
Network Graphic</value></prop>
+        <prop oor:name="UIName">
+            <value>APNG - Animated Portable Network Graphic</value>
+        </prop>
+        <prop oor:name="ClipboardFormat"/>
+    </node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index fd183b0e0bb3..e25e0cdde566 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -106,6 +106,7 @@ namespace o3tl
 #define EXP_SVGZ                "SVESVGZ"
 #define EXP_PDF                 "SVEPDF"
 #define EXP_PNG                 "SVEPNG"
+#define EXP_APNG                "SVEAPNG"
 #define EXP_TIFF                "SVTIFF"
 #define EXP_EPS                 "SVEEPS"
 #define EXP_GIF                 "SVEGIF"
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index e095f8e200f1..43cdf5ded05d 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -310,7 +310,9 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, 
OUString& rFileName,
         }
         else
         {
-            if( pMtfSize_100TH_MM && ( rGraphic.GetType() != 
GraphicType::Bitmap ) )
+            if (bAnimated)
+                aGraphic = rGraphic;
+            else if( pMtfSize_100TH_MM && ( rGraphic.GetType() != 
GraphicType::Bitmap ) )
             {
                 ScopedVclPtrInstance< VirtualDevice > pVDev;
                 const Size aSize(pVDev->LogicToPixel(*pMtfSize_100TH_MM, 
MapMode(MapUnit::Map100thMM)));
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index 83c091fa9ab3..e323418674c8 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1699,6 +1699,16 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, std::u16string_vi
                 if( rOStm.GetError() )
                     nStatus = ERRCODE_GRFILTER_IOERROR;
             }
+            else if ( aFilterName.equalsIgnoreAsciiCase( EXP_APNG ) )
+            {
+                vcl::PngImageWriter aPNGWriter( rOStm );
+                if ( pFilterData )
+                    aPNGWriter.setParameters( *pFilterData );
+                aPNGWriter.write( aGraphic );
+
+                if( rOStm.GetError() )
+                    nStatus = ERRCODE_GRFILTER_IOERROR;
+            }
             else if( aFilterName.equalsIgnoreAsciiCase( EXP_SVG ) || 
aFilterName.equalsIgnoreAsciiCase( EXP_SVGZ ) )
             {
                 bool bDone(false);

Reply via email to