summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/source/core/graphichelper.cxx6
-rw-r--r--svx/source/gallery2/galtheme.cxx1
-rw-r--r--svx/source/xml/xmlgrhlp.cxx1
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx2
4 files changed, 10 insertions, 0 deletions
diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index f98d1ac0a63d..f62b5db08eaa 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -122,6 +122,9 @@ void GraphicHelper::GetPreferredExtension( OUString& rExtension, const Graphic&
case GfxLinkType::NativePdf:
aExtension = "pdf";
break;
+ case GfxLinkType::NativeWebp:
+ aExtension = "webp";
+ break;
default:
break;
}
@@ -163,6 +166,9 @@ OUString GraphicHelper::GetImageType(const Graphic& rGraphic)
case GfxLinkType::NativeBmp:
aGraphicTypeString = SvxResId(STR_IMAGE_BMP);
break;
+ case GfxLinkType::NativeWebp:
+ aGraphicTypeString = SvxResId(STR_IMAGE_WEBP);
+ break;
default:
break;
}
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index dff3696b8cd8..4a9d10e609ff 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -407,6 +407,7 @@ bool GalleryTheme::InsertGraphic(const Graphic& rGraphic, sal_uInt32 nInsertPos)
case GfxLinkType::NativeMet: nExportFormat = ConvertDataFormat::MET; break;
case GfxLinkType::NativePct: nExportFormat = ConvertDataFormat::PCT; break;
case GfxLinkType::NativeSvg: nExportFormat = ConvertDataFormat::SVG; break;
+ case GfxLinkType::NativeWebp: nExportFormat = ConvertDataFormat::WEBP; break;
default:
break;
}
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 0604f0f95d8e..b95130a8a658 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -690,6 +690,7 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X
break;
}
case GfxLinkType::NativePdf: aExtension = ".pdf"; break;
+ case GfxLinkType::NativeWebp: aExtension = ".webp"; break;
default:
aExtension = ".grf";
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 8eaec8e5a5fc..cb690df32623 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -34,6 +34,7 @@ constexpr OUStringLiteral FORMAT_BMP = u"bmp";
constexpr OUStringLiteral FORMAT_GIF = u"gif";
constexpr OUStringLiteral FORMAT_JPG = u"jpg";
constexpr OUStringLiteral FORMAT_PNG = u"png";
+constexpr OUStringLiteral FORMAT_WEBP = u"webp";
using namespace com::sun::star;
@@ -182,6 +183,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
case GfxLinkType::NativeJpg: aExt = FORMAT_JPG; break;
case GfxLinkType::NativePng: aExt = FORMAT_PNG; break;
+ case GfxLinkType::NativeWebp: aExt = FORMAT_WEBP; break;
default:
break;