summaryrefslogtreecommitdiff
path: root/filter/source
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-01-13 15:59:49 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-01-31 10:44:29 +0100
commit60eaa424c5e213f31227008e1ed66a646491a360 (patch)
tree7f1a2ff9e73367502d63bb84a528d855ccff17a6 /filter/source
parentb7d5ff4bbf41094b6579ae26023fbd686b060ce9 (diff)
support for the WebP image format (tdf#114532)
This commit implements a WebP reader and writer for both lossless and lossy WebP, export dialog options for selecting lossless/lossy and quality for lossy, and various internal support for the format. Since writing WebP to e.g. ODT documents would make those images unreadable by previous versions with no WebP support, support for that is explicitly disabled in GraphicFilter, to be enabled somewhen later. Change-Id: I9b10f6da6faa78a0bb74415a92e9f163c14685f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128920 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'filter/source')
-rw-r--r--filter/source/config/cache/typedetection.cxx1
-rw-r--r--filter/source/config/fragments/filters/WEBP___WebP.xcu30
-rw-r--r--filter/source/config/fragments/filters/calc_webp_Export.xcu20
-rw-r--r--filter/source/config/fragments/filters/draw_webp_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/impress_webp_Export.xcu30
-rw-r--r--filter/source/config/fragments/filters/writer_web_webp_Export.xcu21
-rw-r--r--filter/source/config/fragments/filters/writer_webp_Export.xcu30
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu27
-rw-r--r--filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu27
-rw-r--r--filter/source/config/fragments/types/webp_WebP.xcu29
10 files changed, 245 insertions, 0 deletions
diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx
index ac4d9aed9f2a..b91ac31566af 100644
--- a/filter/source/config/cache/typedetection.cxx
+++ b/filter/source/config/cache/typedetection.cxx
@@ -232,6 +232,7 @@ int getFlatTypeRank(const OUString& rType)
"pcd_Photo_CD_Base",
"pcd_Photo_CD_Base4",
"pcd_Photo_CD_Base16",
+ "webp_WebP",
"impress_CGM_Computer_Graphics_Metafile", // There is binary and ascii variants ?
"draw_WordPerfect_Graphics",
"draw_Visio_Document",
diff --git a/filter/source/config/fragments/filters/WEBP___WebP.xcu b/filter/source/config/fragments/filters/WEBP___WebP.xcu
new file mode 100644
index 000000000000..9c650e3de42e
--- /dev/null
+++ b/filter/source/config/fragments/filters/WEBP___WebP.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="WEBP - WebP" 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">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</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/calc_webp_Export.xcu b/filter/source/config/fragments/filters/calc_webp_Export.xcu
new file mode 100644
index 000000000000..a6e5d18a3347
--- /dev/null
+++ b/filter/source/config/fragments/filters/calc_webp_Export.xcu
@@ -0,0 +1,20 @@
+<!--
+ * 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/.
+-->
+ <node oor:name="calc_webp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER SUPPORTSSELECTION</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.GraphicExportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/draw_webp_Export.xcu b/filter/source/config/fragments/filters/draw_webp_Export.xcu
new file mode 100644
index 000000000000..e6da69197a61
--- /dev/null
+++ b/filter/source/config/fragments/filters/draw_webp_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_webp_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">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</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/impress_webp_Export.xcu b/filter/source/config/fragments/filters/impress_webp_Export.xcu
new file mode 100644
index 000000000000..00284a272cba
--- /dev/null
+++ b/filter/source/config/fragments/filters/impress_webp_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="impress_webp_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">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_web_webp_Export.xcu b/filter/source/config/fragments/filters/writer_web_webp_Export.xcu
new file mode 100644
index 000000000000..5273bb72228b
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_web_webp_Export.xcu
@@ -0,0 +1,21 @@
+<!--
+ * 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/.
+ *
+-->
+ <node oor:name="writer_web_webp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.GraphicExportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/filters/writer_webp_Export.xcu b/filter/source/config/fragments/filters/writer_webp_Export.xcu
new file mode 100644
index 000000000000..ceb56a8c035f
--- /dev/null
+++ b/filter/source/config/fragments/filters/writer_webp_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="writer_webp_Export" oor:op="replace">
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ <prop oor:name="UIComponent"><value>com.sun.star.svtools.SvFilterOptionsDialog</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.GraphicExportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="TemplateName"/>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu
new file mode 100644
index 000000000000..70ff15429734
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/webp_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="webp_Export" oor:op="replace" >
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="FormatName"><value>SVEWEBP</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">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu
new file mode 100644
index 000000000000..cdce5c9e4047
--- /dev/null
+++ b/filter/source/config/fragments/internalgraphicfilters/webp_Import.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="webp_Import" oor:op="replace" >
+ <prop oor:name="Type"><value>webp_WebP</value></prop>
+ <prop oor:name="FormatName"><value>SVIWEBP</value></prop>
+ <prop oor:name="RealFilterName"><value>WEBP - WebP</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UIName">
+ <value xml:lang="en-US">WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="Flags"><value>IMPORT</value></prop>
+ </node>
diff --git a/filter/source/config/fragments/types/webp_WebP.xcu b/filter/source/config/fragments/types/webp_WebP.xcu
new file mode 100644
index 000000000000..e58984fbedc7
--- /dev/null
+++ b/filter/source/config/fragments/types/webp_WebP.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="webp_WebP" 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>webp</value></prop>
+ <prop oor:name="MediaType"><value>image/webp</value></prop>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"><value>WEBP - WebP</value></prop>
+ <prop oor:name="UIName">
+ <value>WEBP - WebP Image</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>