Makefile.fetch | 1 RepositoryExternal.mk | 51 + bin/lo-all-static-libs | 1 config_host.mk.in | 3 configure.ac | 6 download.lst | 2 external/Module_external.mk | 1 external/libwebp/ExternalProject_libwebp.mk | 52 + external/libwebp/Makefile | 7 external/libwebp/Makefile.vc.patch | 145 ++++ external/libwebp/Module_libwebp.mk | 17 external/libwebp/README | 1 external/libwebp/UnpackedTarball_libwebp.mk | 20 filter/Configuration_filter.mk | 13 filter/qa/complex/filter/detection/typeDetection/files.csv | 1 filter/source/config/cache/typedetection.cxx | 1 filter/source/config/fragments/filters/WEBP___WebP.xcu | 30 filter/source/config/fragments/filters/calc_webp_Export.xcu | 20 filter/source/config/fragments/filters/draw_webp_Export.xcu | 30 filter/source/config/fragments/filters/impress_webp_Export.xcu | 30 filter/source/config/fragments/filters/writer_web_webp_Export.xcu | 21 filter/source/config/fragments/filters/writer_webp_Export.xcu | 30 filter/source/config/fragments/internalgraphicfilters/webp_Export.xcu | 27 filter/source/config/fragments/internalgraphicfilters/webp_Import.xcu | 27 filter/source/config/fragments/types/webp_WebP.xcu | 29 icon-themes/breeze/res/sx03223.png |binary icon-themes/breeze_dark/res/sx03223.png |binary icon-themes/breeze_dark_svg/res/sx03223.svg | 1 icon-themes/breeze_svg/res/sx03223.svg | 1 include/sal/log-areas.dox | 1 include/svl/inettype.hxx | 2 include/svtools/imagemgr.hxx | 1 include/svx/strings.hrc | 1 include/vcl/gfxlink.hxx | 5 include/vcl/graphicfilter.hxx | 6 include/vcl/print.hxx | 3 include/vcl/salctype.hxx | 3 instsetoo_native/CustomTarget_install.mk | 2 officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs | 2 postprocess/CustomTarget_signing.mk | 2 postprocess/signing/signing.pl | 3 readlicense_oo/license/license.xml | 31 scp2/source/draw/registryitem_draw.scp | 1 sd/source/ui/view/DocumentRenderer.cxx | 20 setup_native/source/packinfo/spellchecker_selection.txt | 2 solenv/bin/modules/installer/windows/msp.pm | 2 solenv/sanitizers/ui/svt.suppr | 2 svtools/inc/bitmaps.hlst | 2 svtools/source/filter/exportdialog.cxx | 53 + svtools/source/filter/exportdialog.hxx | 9 svtools/source/misc/imagemgr.cxx | 5 svtools/uiconfig/ui/graphicexport.ui | 36 - svx/source/core/graphichelper.cxx | 6 svx/source/gallery2/galtheme.cxx | 1 svx/source/xml/xmlgrhlp.cxx | 1 svx/source/xoutdev/_xoutbmp.cxx | 2 vcl/CppunitTest_vcl_filters_test.mk | 1 vcl/Executable_webpfuzzer.mk | 45 + vcl/Library_vcl.mk | 3 vcl/Module_vcl.mk | 1 vcl/inc/filter/WebpReader.hxx | 28 vcl/inc/filter/WebpWriter.hxx | 29 vcl/inc/graphic/GraphicFormatDetector.hxx | 1 vcl/inc/graphic/UnoGraphicDescriptor.hxx | 1 vcl/inc/printdlg.hxx | 1 vcl/qa/cppunit/GraphicDescriptorTest.cxx | 16 vcl/qa/cppunit/GraphicFormatDetectorTest.cxx | 17 vcl/qa/cppunit/GraphicTest.cxx | 12 vcl/qa/cppunit/data/TypeDetectionExample.webp |binary vcl/qa/cppunit/graphicfilter/data/webp/alpha_lossless.webp |binary vcl/qa/cppunit/graphicfilter/data/webp/alpha_lossy.webp |binary vcl/qa/cppunit/graphicfilter/data/webp/noalpha_lossless.webp |binary vcl/qa/cppunit/graphicfilter/data/webp/noalpha_lossy.webp |binary vcl/qa/cppunit/graphicfilter/filters-test.cxx | 2 vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx | 203 ++++++ vcl/source/filter/FilterConfigCache.cxx | 8 vcl/source/filter/GraphicFormatDetector.cxx | 22 vcl/source/filter/graphicfilter.cxx | 53 + vcl/source/filter/graphicfilter2.cxx | 33 + vcl/source/filter/webp/reader.cxx | 318 ++++++++++ vcl/source/filter/webp/writer.cxx | 206 ++++++ vcl/source/gdi/gfxlink.cxx | 1 vcl/source/gdi/print.cxx | 5 vcl/source/graphic/UnoGraphicDescriptor.cxx | 2 vcl/source/window/printdlg.cxx | 33 - vcl/workben/fftester.cxx | 7 vcl/workben/webpfuzzer.cxx | 48 + vcl/workben/webpfuzzer.options | 2 88 files changed, 1817 insertions(+), 53 deletions(-)
New commits: commit 0658247f4735c638b970812a4da455f19506131c Author: Andras Timar <[email protected]> AuthorDate: Mon Jun 7 09:00:47 2021 +0200 Commit: Andras Timar <[email protected]> CommitDate: Tue Mar 15 12:58:39 2022 +0100 no MinimumWidth of Sidebar for MIMO Change-Id: I66fc17b1d791e06debe95248a8952986171a4596 diff --git a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs index 53ad678e3574..bba468194a85 100644 --- a/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs @@ -255,7 +255,7 @@ <desc>Enables the calculation of the sidebar's minimum width based on the size of all decks. If false, the user has full control over the sidebar width.</desc> </info> - <value>true</value> + <value>false</value> </prop> </group> <group oor:name="Content"> commit 55d4f8a4a7c5b35e360e534ce46f6b8c3fbed42b Author: Andras Timar <[email protected]> AuthorDate: Tue May 25 10:16:03 2021 +0200 Commit: Andras Timar <[email protected]> CommitDate: Tue Mar 15 12:57:38 2022 +0100 Dictionary list required by MIMO Change-Id: Idefb9480460ae4ba946d7171811fde432c3c0927 diff --git a/setup_native/source/packinfo/spellchecker_selection.txt b/setup_native/source/packinfo/spellchecker_selection.txt index 02037dacac64..348365e6b0d7 100644 --- a/setup_native/source/packinfo/spellchecker_selection.txt +++ b/setup_native/source/packinfo/spellchecker_selection.txt @@ -46,7 +46,7 @@ en-ZA = "en,es,fr" eo = "eo" es = "es,an,ca,fr,gl,oc,pt-PT" et = "et" -fr = "fr,es" +fr = "de,en,eo,es,fr,it,pt-PT" gd = "gd" gl = "gl,pt-PT,es" gu = "gu" commit fe8d4d6e17a0ebdf8c980bcfad454fe195c6055d Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Nov 10 14:34:39 2021 +0200 Commit: Andras Timar <[email protected]> CommitDate: Tue Mar 15 12:47:45 2022 +0100 tdf#145354: Revert "tdf#91362: Use document paper size for printing slides" Reverting it has been suggested a couple of times over the years, for instance in https://bugs.documentfoundation.org/show_bug.cgi?id=91362#c23 and in https://bugs.documentfoundation.org/show_bug.cgi?id=145354#c41 . The paper size for a presentation document is typically just made-up dimensions with no connection to any actual paper size. (Or transparency size.) What matters is the aspect ratio. This reverts commit 57991f885e60d04e93bf5004d4fdceee7d29f3d8 Change-Id: I5099039f5fdb836694f2b100fb28093584e8294b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125111 Tested-by: Aron Budea <[email protected]> Reviewed-by: Aron Budea <[email protected]> diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 20f75eea71d3..7430602139e3 100644 --- a/sd/source/ui/view/DocumentRenderer.cxx +++ b/sd/source/ui/view/DocumentRenderer.cxx @@ -153,7 +153,7 @@ namespace { return nQuality; } - bool IsPaperSize() const + bool IsPageSize() const { return GetBoolValue("PageOptions", sal_Int32(1)); } @@ -173,10 +173,10 @@ namespace { return GetBoolValue("PrintProspect", false); } - bool IsPrinterPreferred() const + bool IsPrinterPreferred(DocumentType eDocType) const { - return IsTilePage() || IsPaperSize() || IsBooklet() || - IsNotes() || IsHandout() || IsOutline(); + bool bIsDraw = eDocType == DocumentType::Draw; + return IsTilePage() || IsPageSize() || IsBooklet() || (!bIsDraw && !IsNotes()); } bool IsPrintExcluded() const @@ -1374,7 +1374,7 @@ private: // Draw and Notes should usually abide by their specified paper size Size aPaperSize; - if (!mpOptions->IsPrinterPreferred()) + if (!mpOptions->IsPrinterPreferred(pDocument->GetDocumentType())) { aPaperSize.setWidth(rInfo.maPageSize.Width()); aPaperSize.setHeight(rInfo.maPageSize.Height()); @@ -1387,7 +1387,7 @@ private: maPrintSize = awt::Size(aPaperSize.Width(), aPaperSize.Height()); - if (mpOptions->IsPrinterPreferred()) + if (mpOptions->IsPrinterPreferred(pDocument->GetDocumentType())) { if( (rInfo.meOrientation == Orientation::Landscape && (aPaperSize.Width() < aPaperSize.Height())) @@ -1448,7 +1448,7 @@ private: aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( ::tools::Time( ::tools::Time::SYSTEM ), false ); // Draw and Notes should usually use specified paper size when printing - if (!mpOptions->IsPrinterPreferred()) + if (!mpOptions->IsPrinterPreferred(mrBase.GetDocShell()->GetDocumentType())) { aInfo.maPrintSize = mrBase.GetDocument()->GetSdPage(0, PageKind::Standard)->GetSize(); maPrintSize = awt::Size(aInfo.maPrintSize.Width(), @@ -1770,7 +1770,7 @@ private: OSL_ASSERT(pDocument != nullptr); SdPage& rHandoutPage (*pDocument->GetSdPage(0, PageKind::Handout)); - const bool bScalePage (mpOptions->IsPaperSize()); + const bool bScalePage (mpOptions->IsPageSize()); sal_uInt16 nPaperBin; if ( ! mpOptions->IsPaperBin()) @@ -1930,7 +1930,7 @@ private: // is it possible that the page size changed? const Size aPageSize = pPage->GetSize(); - if (mpOptions->IsPrinterPreferred()) + if (mpOptions->IsPageSize()) { const double fHorz (static_cast<double>(rInfo.maPrintSize.Width()) / aPageSize.Width()); const double fVert (static_cast<double>(rInfo.maPrintSize.Height()) / aPageSize.Height()); @@ -2159,7 +2159,7 @@ private: // (without the unprintable borders). // 3. Split the page into parts of the size of the // printable area. - const bool bScalePage (mpOptions->IsPaperSize()); + const bool bScalePage (mpOptions->IsPageSize()); const bool bCutPage (mpOptions->IsCutPage()); MapMode aMap (rInfo.maMap); if ( (bScalePage || bCutPage) && CheckForFrontBackPages( nPageIndex ) ) commit 22cb76ff45f3f4c9937167bfd12e03c04dba24b0 Author: Tor Lillqvist <[email protected]> AuthorDate: Tue Nov 9 13:37:33 2021 +0200 Commit: Andras Timar <[email protected]> CommitDate: Tue Mar 15 12:47:40 2022 +0100 tdf#145354: Don't let an arbitrary paper size match any other arbitrary size Don't preselect whatever random paper size the printer driver offers last if the document is asking for some other random paper size. Change-Id: I57af245f28f0d61541da698844f2527be5ec004e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124911 Tested-by: Jenkins Reviewed-by: Tor Lillqvist <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124926 Tested-by: Andras Timar <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 6ced03f53799..b2116e9e78e8 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -864,6 +864,7 @@ void PrintDialog::setPaperSizes() VclPtr<Printer> aPrt( maPController->getPrinter() ); mePaper = aPrt->GetPaper(); + Size aSizeOfPaper = aPrt->GetSizeOfPaper(); if ( isPrintToFile() ) { @@ -902,8 +903,9 @@ void PrintDialog::setPaperSizes() mxPaperSizeBox->append_text(aPaperName); - if ( ePaper == mePaper ) - mxPaperSizeBox->set_active( nPaper ); + if ( (ePaper != PAPER_USER && ePaper == mePaper) || + (ePaper == PAPER_USER && aInfo.sloppyEqual( PaperInfo(aSizeOfPaper.getWidth(), aSizeOfPaper.getHeight())) ) ) + mxPaperSizeBox->set_active( nPaper ); } mxPaperSizeBox->set_sensitive( true ); commit 093db6cfb8a34658dfb3f56af5c63d2473494d28 Author: Tor Lillqvist <[email protected]> AuthorDate: Tue Nov 9 13:16:29 2021 +0200 Commit: Andras Timar <[email protected]> CommitDate: Tue Mar 15 12:47:35 2022 +0100 Add Printer::GetSizeOfPaper() with semantics to match GetPaper() Will be used in follow-up commits. Change-Id: I18b167a217a4f82d8b6605e2ba14f1ddc6e98324 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124910 Reviewed-by: Tor Lillqvist <[email protected]> Tested-by: Tor Lillqvist <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124925 Tested-by: Andras Timar <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index d96e6d7e87ac..c4310c3b5372 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -301,7 +301,10 @@ public: sal_uInt16 GetPaperBin() const; void SetPaper( Paper ePaper ); bool SetPaperSizeUser( const Size& rSize ); + /** @return The paper format of the printer's current "jobsetup". Note that if PAPER_USER the actual size can be anything. */ Paper GetPaper() const; + /** @return Size of the paper of the printer's current "jobsetup". */ + Size GetSizeOfPaper() const; static OUString GetPaperName( Paper ePaper ); /** @return Number of available paper formats */ diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 652bc00c58be..25e7d00b8f63 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1560,6 +1560,11 @@ Paper Printer::GetPaper() const return maJobSetup.ImplGetConstData().GetPaperFormat(); } +Size Printer::GetSizeOfPaper() const +{ + return Size(maJobSetup.ImplGetConstData().GetPaperWidth(), maJobSetup.ImplGetConstData().GetPaperHeight()); +} + sal_uInt16 Printer::GetPaperBinCount() const { if ( IsDisplayPrinter() ) commit 75a8645319f2d48a4daf100b5a99caef29338569 Author: Tor Lillqvist <[email protected]> AuthorDate: Wed Nov 3 14:58:45 2021 +0200 Commit: Andras Timar <[email protected]> CommitDate: Tue Mar 15 12:47:30 2022 +0100 tdf#145354: Don't claim random paper sizes from the system are "User Defined" For instance, the driver for my printer (or maybe Windows itself, no idea where the list of sizes comes from originally) says it supports 215 x 345 mm. Which apparently is an obscure paper size called "India Legal". It is confusing if the Print dialog claims that it is "User Defined" when I have never even heard of such a size, and the document does not specify it either. Change-Id: I44196fd21fd83a94d255ebb909e5d63e35c5d1e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124649 Reviewed-by: Tor Lillqvist <[email protected]> Tested-by: Tor Lillqvist <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124924 Tested-by: Andras Timar <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 7d918d931ba1..6ced03f53799 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * @@ -891,7 +891,14 @@ void PrintDialog::setPaperSizes() OUString aWidth( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); OUString aHeight( rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ) ); OUString aUnit = eUnit == MapUnit::MapMM ? OUString("mm") : OUString("in"); - OUString aPaperName = Printer::GetPaperName( ePaper ) + " " + aWidth + aUnit + " x " + aHeight + aUnit; + OUString aPaperName; + + // Paper sizes that we don't know of but the system printer driver lists are not "User + // Defined". Displaying them as such is just confusing. + if (ePaper != PAPER_USER) + aPaperName = Printer::GetPaperName( ePaper ) + " "; + + aPaperName += aWidth + aUnit + " x " + aHeight + aUnit; mxPaperSizeBox->append_text(aPaperName); commit 28b19ef4c95d7c742a7f002283558ea1f72c9021 Author: Tor Lillqvist <[email protected]> AuthorDate: Tue Nov 2 20:16:31 2021 +0200 Commit: Andras Timar <[email protected]> CommitDate: Tue Mar 15 12:47:19 2022 +0100 tdf#145354: Ensure displayed paper name matches displayed paper dimensions I could not reproduce it now but at least in some slightly older version of LibreOffice, it could happen that at the top of the print preview image was displayed "143 mm (A4)" which is silly, as neither side of an A4 paper is 143 mm. Look up the matching paper size from the dimensions displayed. Use the "sloppy" match function to allow for sub-millimeter rounding errors. Change-Id: I6320798061246101c6fc78baf841b71b32b25833 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124635 Tested-by: Andras Timar <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index e4d42f4bb7c7..a403d07f5206 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -65,7 +65,6 @@ namespace vcl virtual void Resize() override; void setPreview( const GDIMetaFile&, const Size& i_rPaperSize, - std::u16string_view i_rPaperName, const OUString& i_rNoPageString, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, bool i_bGreyscale diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 251ce6002535..7d918d931ba1 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -211,7 +211,6 @@ bool PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt ) void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview, const Size& i_rOrigSize, - std::u16string_view i_rPaperName, const OUString& i_rReplacement, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, @@ -237,14 +236,21 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi Size aLogicPaperSize(OutputDevice::LogicToLogic(i_rOrigSize, MapMode(MapUnit::Map100thMM), MapMode(eUnit))); OUString aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) ); OUStringBuffer aBuf; - aBuf.append( aNumText + " " ); + aBuf.append( aNumText ) + .append( u' ' ); aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" ); - if( !i_rPaperName.empty() ) + + // Look up the paper name from the dimensions + PaperInfo aPaperInfoFromSize(i_rOrigSize.getWidth(), i_rOrigSize.getHeight()); + aPaperInfoFromSize.doSloppyFit(); + + if (aPaperInfoFromSize.getPaper() != PAPER_USER) { aBuf.append( " (" ); - aBuf.append( i_rPaperName ); + aBuf.append( Printer::GetPaperName(aPaperInfoFromSize.getPaper()) ); aBuf.append( ')' ); } + maHorzText = aBuf.makeStringAndClear(); aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ); @@ -948,7 +954,6 @@ void PrintDialog::preparePreview( bool i_bMayUseCache ) if ( !hasPreview() ) { mxPreview->setPreview( aMtf, aCurPageSize, - Printer::GetPaperName( mePaper ), maNoPreviewStr, aPrt->GetDPIX(), aPrt->GetDPIY(), aPrt->GetPrinterOptions().IsConvertToGreyscales() @@ -984,7 +989,6 @@ void PrintDialog::preparePreview( bool i_bMayUseCache ) } mxPreview->setPreview( aMtf, aCurPageSize, - Printer::GetPaperName( mePaper ), nPages > 0 ? OUString() : maNoPageStr, aPrt->GetDPIX(), aPrt->GetDPIY(), aPrt->GetPrinterOptions().IsConvertToGreyscales() commit 62de78f08bf07b24889c357eb8a31fc5472baff3 Author: Luboš Luňák <[email protected]> AuthorDate: Thu Jan 13 15:59:49 2022 +0100 Commit: Andras Timar <[email protected]> CommitDate: Tue Mar 15 12:31:50 2022 +0100 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 <[email protected]> diff --git a/Makefile.fetch b/Makefile.fetch index 3c5b7ed1ee01..78f6887ee748 100644 --- a/Makefile.fetch +++ b/Makefile.fetch @@ -162,6 +162,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S $(call fetch_Optional,LIBNUMBERTEXT,LIBNUMBERTEXT_TARBALL) \ $(call fetch_Optional,LIBPNG,LIBPNG_TARBALL) \ $(call fetch_Optional,LIBTOMMATH,LIBTOMMATH_TARBALL) \ + $(call fetch_Optional,LIBWEBP,LIBWEBP_TARBALL) \ $(call fetch_Optional,LIBXML2,LIBXML_TARBALL) \ $(call fetch_Optional,XMLSEC,XMLSEC_TARBALL) \ $(call fetch_Optional,LIBXSLT,LIBXSLT_TARBALL) \ diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index d64fb8ffd57a..b43773812ef4 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -2725,6 +2725,57 @@ endef endif # !SYSTEM_LIBPNG +ifneq ($(SYSTEM_LIBWEBP),) + +define gb_LinkTarget__use_libwebp +$(call gb_LinkTarget_set_include,$(1),\ + $$(INCLUDE) \ + $(LIBWEBP_CFLAGS) \ +) + +$(call gb_LinkTarget_add_libs,$(1),\ + $(LIBWEBP_LIBS) \ +) + +endef + +gb_ExternalProject__use_libwebp := + +else # !SYSTEM_LIBWEBP + +define gb_LinkTarget__use_libwebp +$(call gb_LinkTarget_set_include,$(1),\ + $(LIBWEBP_CFLAGS) \ + $$(INCLUDE) \ +) + +$(call gb_LinkTarget_set_include,$(1),\ + -I$(call gb_UnpackedTarball_get_dir,libwebp)/src \ + $$(INCLUDE) \ +) +ifeq ($(OS),WNT) +$(call gb_LinkTarget_add_libs,$(1),\ + $(call gb_UnpackedTarball_get_dir,libwebp)/output/lib/libwebp$(gb_StaticLibrary_PLAINEXT) \ +) +else +$(call gb_LinkTarget_add_libs,$(1),\ + -L$(call gb_UnpackedTarball_get_dir,libwebp)/src/.libs -lwebp \ +) +endif +$(call gb_LinkTarget_use_external_project,$(1),libwebp) + +endef + +define gb_ExternalProject__use_libwebp +$(call gb_ExternalProject_use_external_project,$(1),\ + libwebp \ +) + +endef + +endif # !SYSTEM_LIBWEBP + + ifneq ($(SYSTEM_CURL),) define gb_LinkTarget__use_curl diff --git a/bin/lo-all-static-libs b/bin/lo-all-static-libs index d89dd8eca296..455861da5a73 100755 --- a/bin/lo-all-static-libs +++ b/bin/lo-all-static-libs @@ -124,6 +124,7 @@ echo $INSTDIR/$LIBO_LIB_FOLDER/lib*.a \ $WORKDIR/UnpackedTarball/liborcus/src/*/.libs/*.a \ $WORKDIR/UnpackedTarball/librevenge/src/*/.libs/*.a \ $WORKDIR/UnpackedTarball/libvisio/src/lib/.libs/*.a \ + $WORKDIR/UnpackedTarball/libwebp/src/.libs/*.a \ $WORKDIR/UnpackedTarball/libwp?/src/lib/.libs/*.a \ $WORKDIR/UnpackedTarball/raptor/src/.libs/*.a \ $WORKDIR/UnpackedTarball/rasqal/src/.libs/*.a \ diff --git a/config_host.mk.in b/config_host.mk.in index 0fe4fd84cd41..6f03532edcff 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -392,6 +392,8 @@ export LIBSERIALIZER_JAR=@LIBSERIALIZER_JAR@ export LIBTOMMATH_CFLAGS=@LIBTOMMATH_CFLAGS@ export LIBTOMMATH_LIBS=@LIBTOMMATH_LIBS@ export LIBTOOL=@LIBTOOL@ +export LIBWEBP_CFLAGS=$(gb_SPACE)@LIBWEBP_CFLAGS@ +export LIBWEBP_LIBS=$(gb_SPACE)@LIBWEBP_LIBS@ export LIBXML_CFLAGS=$(gb_SPACE)@LIBXML_CFLAGS@ export LIBXML_JAR=@LIBXML_JAR@ export LIBXML_LIBS=$(gb_SPACE)@LIBXML_LIBS@ @@ -607,6 +609,7 @@ export SYSTEM_LIBNUMBERTEXT_DATA=@SYSTEM_LIBNUMBERTEXT_DATA@ export SYSTEM_LIBORCUS=@SYSTEM_LIBORCUS@ export SYSTEM_LIBPNG=@SYSTEM_LIBPNG@ export SYSTEM_LIBTOMMATH=@SYSTEM_LIBTOMMATH@ +export SYSTEM_LIBWEBP=@SYSTEM_LIBWEBP@ export SYSTEM_LIBXML=@SYSTEM_LIBXML@ export SYSTEM_LIBXML_FOR_BUILD=@SYSTEM_LIBXML_FOR_BUILD@ export SYSTEM_LIBXSLT=@SYSTEM_LIBXSLT@ diff --git a/configure.ac b/configure.ac index 6b2246b4ccde..93ac137b1017 100644 --- a/configure.ac +++ b/configure.ac @@ -13237,6 +13237,12 @@ dnl =================================================================== libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng],["-I${WORKDIR}/UnpackedTarball/libpng"],["-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"]) +dnl =================================================================== +dnl Test whether to build libwebp or rely on the system version +dnl =================================================================== + +libo_CHECK_SYSTEM_MODULE([libwebp],[LIBWEBP],[libwebp]) + dnl =================================================================== dnl Check for runtime JVM search path dnl =================================================================== diff --git a/download.lst b/download.lst index 9751f7d1c45c..2545a0d80160 100644 --- a/download.lst +++ b/download.lst @@ -164,6 +164,8 @@ export LIBNUMBERTEXT_SHA256SUM := 17b8249cb89ae11ae15a85612d2665626c0e0e3e56b356 export LIBNUMBERTEXT_TARBALL := libnumbertext-1.0.7.tar.xz export LIBTOMMATH_SHA256SUM := 083daa92d8ee6f4af96a6143b12d7fc8fe1a547e14f862304f7281f8f7347483 export LIBTOMMATH_TARBALL := ltm-1.0.zip +export LIBWEBP_SHA256SUM := 808b98d2f5b84e9b27fdef6c5372dac769c3bda4502febbfa5031bd3c4d7d018 +export LIBWEBP_TARBALL := libwebp-1.2.1.tar.gz export XMLSEC_SHA256SUM := e383702853236004e5b08e424b8afe9b53fe9f31aaa7a5382f39d9533eb7c043 export XMLSEC_TARBALL := xmlsec1-1.2.32.tar.gz export LIBXML_SHA256SUM := 276130602d12fe484ecc03447ee5e759d0465558fbc9d6bd144e3745306ebf0e diff --git a/external/Module_external.mk b/external/Module_external.mk index 4566d825301c..2a6d57feefef 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -63,6 +63,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,LIBLANGTAG,liblangtag) \ $(call gb_Helper_optional,LIBNUMBERTEXT,libnumbertext) \ $(call gb_Helper_optional,LIBPNG,libpng) \ + $(call gb_Helper_optional,LIBWEBP,libwebp) \ $(call gb_Helper_optional,LIBXML2,libxml2) \ $(call gb_Helper_optional,LIBXSLT,libxslt) \ $(call gb_Helper_optional,LPSOLVE,lpsolve) \ diff --git a/external/libwebp/ExternalProject_libwebp.mk b/external/libwebp/ExternalProject_libwebp.mk new file mode 100644 index 000000000000..beb7a39e7b64 --- /dev/null +++ b/external/libwebp/ExternalProject_libwebp.mk @@ -0,0 +1,52 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_ExternalProject_ExternalProject,libwebp)) + +$(eval $(call gb_ExternalProject_register_targets,libwebp,\ + build \ +)) + +ifeq ($(COM),MSC) +$(eval $(call gb_ExternalProject_use_nmake,libwebp,build)) + +$(call gb_ExternalProject_get_state_target,libwebp,build): + $(call gb_Trace_StartRange,libwebp,EXTERNAL) + $(call gb_ExternalProject_run,build,\ + nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output \ + ) + $(call gb_Trace_EndRange,libwebp,EXTERNAL) +else +$(eval $(call gb_ExternalProject_use_autoconf,libwebp,build)) + +$(call gb_ExternalProject_get_state_target,libwebp,build) : + $(call gb_Trace_StartRange,libwebp,EXTERNAL) + $(call gb_ExternalProject_run,build,\ + export PKG_CONFIG="" \ + && MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \ + --enable-static \ + --with-pic \ + --disable-shared \ + --disable-gl \ + --disable-sdl \ + --disable-png \ + --disable-jpeg \ + --disable-tiff \ + --disable-gif \ + --disable-wic \ + $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \ + CXXFLAGS="$(gb_CXXFLAGS) $(if $(ENABLE_OPTIMIZED),$(gb_COMPILEROPTFLAGS),$(gb_COMPILERNOOPTFLAGS))" \ + CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \ + $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ + && $(MAKE) \ + ) + $(call gb_Trace_EndRange,libwebp,EXTERNAL) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/libwebp/Makefile b/external/libwebp/Makefile new file mode 100644 index 000000000000..e4968cf85fb6 --- /dev/null +++ b/external/libwebp/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/libwebp/Makefile.vc.patch b/external/libwebp/Makefile.vc.patch new file mode 100644 index 000000000000..653998319b82 --- /dev/null +++ b/external/libwebp/Makefile.vc.patch @@ -0,0 +1,145 @@ +--- Makefile.vc.sav 2021-07-30 00:55:37.000000000 +0200 ++++ Makefile.vc 2022-01-25 17:35:30.206117700 +0100 +@@ -7,11 +7,11 @@ + LIBWEBPDEMUX_BASENAME = libwebpdemux + + !IFNDEF ARCH +-!IF ! [ cl 2>&1 | find "x86" > NUL ] ++!IF ! [ $(CC) 2>&1 | grep -q "x86" > NUL ] + ARCH = x86 +-!ELSE IF ! [ cl 2>&1 | find "x64" > NUL ] ++!ELSE IF ! [ $(CC) 2>&1 | grep -q "x64" > NUL ] + ARCH = x64 +-!ELSE IF ! [ cl 2>&1 | find "ARM" > NUL ] ++!ELSE IF ! [ $(CC) 2>&1 | grep -q "ARM" > NUL ] + ARCH = ARM + !ELSE + !ERROR Unable to auto-detect toolchain architecture! \ +@@ -27,8 +27,8 @@ + ## Nothing more to do below this line! + + NOLOGO = /nologo +-CCNODBG = cl.exe $(NOLOGO) /O2 /DNDEBUG +-CCDEBUG = cl.exe $(NOLOGO) /Od /Zi /D_DEBUG /RTC1 ++CCNODBG = $(CC) $(NOLOGO) /O2 /DNDEBUG ++CCDEBUG = $(CC) $(NOLOGO) /Od /Zi /D_DEBUG /RTC1 + CFLAGS = /I. /Isrc $(NOLOGO) /W3 /EHsc /c + CFLAGS = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN + LDFLAGS = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /DYNAMICBASE +@@ -67,7 +67,7 @@ + RTLIB = /MD + RTLIBD = /MDd + !ENDIF +-DIRBASE = $(OUTDIR)\$(CFG)\$(ARCH) ++DIRBASE = $(OUTDIR) + DIROBJ = $(DIRBASE)\obj + DIRLIB = $(DIRBASE)\lib + DIRINC = $(DIRBASE)\include +@@ -86,10 +86,10 @@ + + # Target configuration + !IF "$(CFG)" == "release-static" +-CC = $(CCNODBG) ++CC_ = $(CCNODBG) + STATICLIBBUILD = TRUE + !ELSE IF "$(CFG)" == "debug-static" +-CC = $(CCDEBUG) ++CC_ = $(CCDEBUG) + RTLIB = $(RTLIBD) + STATICLIBBUILD = TRUE + LIBWEBPDECODER_BASENAME = $(LIBWEBPDECODER_BASENAME)_debug +@@ -97,11 +97,11 @@ + LIBWEBPMUX_BASENAME = $(LIBWEBPMUX_BASENAME)_debug + LIBWEBPDEMUX_BASENAME = $(LIBWEBPDEMUX_BASENAME)_debug + !ELSE IF "$(CFG)" == "release-dynamic" +-CC = $(CCNODBG) ++CC_ = $(CCNODBG) + RC = $(RCNODBG) + DLLBUILD = TRUE + !ELSE IF "$(CFG)" == "debug-dynamic" +-CC = $(CCDEBUG) ++CC_ = $(CCDEBUG) + RC = $(RCDEBUG) + RTLIB = $(RTLIBD) + DLLBUILD = TRUE +@@ -112,7 +112,7 @@ + !ENDIF + + !IF "$(STATICLIBBUILD)" == "TRUE" +-CC = $(CC) $(RTLIB) ++CC_ = $(CC_) $(RTLIB) + CFGSET = TRUE + LIBWEBPDECODER = $(DIRLIB)\$(LIBWEBPDECODER_BASENAME).lib + LIBWEBP = $(DIRLIB)\$(LIBWEBP_BASENAME).lib +@@ -120,7 +120,7 @@ + LIBWEBPDEMUX = $(DIRLIB)\$(LIBWEBPDEMUX_BASENAME).lib + !ELSE IF "$(DLLBUILD)" == "TRUE" + DLLINC = webp_dll.h +-CC = $(CC) /I$(DIROBJ) /FI$(DLLINC) $(RTLIB) /DWEBP_DLL ++CC_ = $(CC_) /I$(DIROBJ) /FI$(DLLINC) $(RTLIB) /DWEBP_DLL + LIBWEBPDECODER = $(DIRLIB)\$(LIBWEBPDECODER_BASENAME)_dll.lib + LIBWEBP = $(DIRLIB)\$(LIBWEBP_BASENAME)_dll.lib + LIBWEBPMUX = $(DIRLIB)\$(LIBWEBPMUX_BASENAME)_dll.lib +@@ -421,7 +421,7 @@ + $(DIROBJ)\$(DLLINC) + + {$(DIROBJ)}.c{$(DIROBJ)}.obj: +- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$@ $< ++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$@ $< + + {src}.rc{$(DIROBJ)}.res: + $(RC) /fo$@ $< +@@ -461,39 +461,39 @@ + # File-specific flag builds. Note batch rules take precedence over wildcards, + # so for now name each file individually. + $(DIROBJ)\examples\anim_diff.obj: examples\anim_diff.c +- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ ++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ + /Fo$(DIROBJ)\examples\ examples\$(@B).c + $(DIROBJ)\examples\anim_dump.obj: examples\anim_dump.c +- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ ++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ + /Fo$(DIROBJ)\examples\ examples\$(@B).c + $(DIROBJ)\examples\anim_util.obj: examples\anim_util.c +- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ ++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ + /Fo$(DIROBJ)\examples\ examples\$(@B).c + $(DIROBJ)\examples\gif2webp.obj: examples\gif2webp.c +- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ ++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ + /Fo$(DIROBJ)\examples\ examples\$(@B).c + $(DIROBJ)\examples\gifdec.obj: examples\gifdec.c +- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ ++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \ + /Fo$(DIROBJ)\examples\ examples\$(@B).c + # Batch rules + {examples}.c{$(DIROBJ)\examples}.obj:: +- $(CC) $(CFLAGS) /Fd$(DIROBJ)\examples\ /Fo$(DIROBJ)\examples\ $< ++ $(CC_) $(CFLAGS) /Fd$(DIROBJ)\examples\ /Fo$(DIROBJ)\examples\ $< + {extras}.c{$(DIROBJ)\extras}.obj:: +- $(CC) $(CFLAGS) /Fd$(DIROBJ)\extras\ /Fo$(DIROBJ)\extras\ $< ++ $(CC_) $(CFLAGS) /Fd$(DIROBJ)\extras\ /Fo$(DIROBJ)\extras\ $< + {imageio}.c{$(DIROBJ)\imageio}.obj:: +- $(CC) $(CFLAGS) /Fd$(DIROBJ)\imageio\ /Fo$(DIROBJ)\imageio\ $< ++ $(CC_) $(CFLAGS) /Fd$(DIROBJ)\imageio\ /Fo$(DIROBJ)\imageio\ $< + {src\dec}.c{$(DIROBJ)\dec}.obj:: +- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dec\ $< ++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dec\ $< + {src\demux}.c{$(DIROBJ)\demux}.obj:: +- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\demux\ $< ++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\demux\ $< + {src\dsp}.c{$(DIROBJ)\dsp}.obj:: +- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dsp\ $< ++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dsp\ $< + {src\enc}.c{$(DIROBJ)\enc}.obj:: +- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\enc\ $< ++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\enc\ $< + {src\mux}.c{$(DIROBJ)\mux}.obj:: +- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\mux\ $< ++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\mux\ $< + {src\utils}.c{$(DIROBJ)\utils}.obj:: +- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\utils\ $< ++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\utils\ $< + + LNKLIBS = ole32.lib windowscodecs.lib shlwapi.lib + !IF "$(UNICODE)" == "1" diff --git a/external/libwebp/Module_libwebp.mk b/external/libwebp/Module_libwebp.mk new file mode 100644 index 000000000000..b89056ac3d35 --- /dev/null +++ b/external/libwebp/Module_libwebp.mk @@ -0,0 +1,17 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_Module_Module,libwebp)) + +$(eval $(call gb_Module_add_targets,libwebp,\ + ExternalProject_libwebp \ + UnpackedTarball_libwebp \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/libwebp/README b/external/libwebp/README new file mode 100644 index 000000000000..1308c278baca --- /dev/null +++ b/external/libwebp/README @@ -0,0 +1 @@ +libwebp is a library to encode and decode images in WebP format, from [https://developers.google.com/speed/webp/] diff --git a/external/libwebp/UnpackedTarball_libwebp.mk b/external/libwebp/UnpackedTarball_libwebp.mk new file mode 100644 index 000000000000..67f797157717 --- /dev/null +++ b/external/libwebp/UnpackedTarball_libwebp.mk @@ -0,0 +1,20 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# 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/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,libwebp)) + +$(eval $(call gb_UnpackedTarball_set_tarball,libwebp,$(LIBWEBP_TARBALL))) + +$(eval $(call gb_UnpackedTarball_set_patchlevel,libwebp,0)) + +$(eval $(call gb_UnpackedTarball_add_patches,libwebp,\ + external/libwebp/Makefile.vc.patch \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk index d53afa704fc9..efe7b10988dc 100644 --- a/filter/Configuration_filter.mk +++ b/filter/Configuration_filter.mk @@ -440,6 +440,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_web_filters.xc writer_web_pdf_Export\ writer_web_png_Export\ writer_web_jpg_Export\ + writer_web_webp_Export\ writerweb8_writer_template\ writerweb8_writer \ )) @@ -713,6 +714,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_drawgraphics_typ svm_StarView_Metafile \ tga_Truevision_TARGA \ tif_Tag_Image_File \ + webp_WebP \ wmf_MS_Windows_Metafile \ xbm_X_Consortium \ xpm_XPM \ @@ -740,6 +742,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f SVM___StarView_Metafile \ TGA___Truevision_TARGA \ TIF___Tag_Image_File \ + WEBP___WebP \ WMF___MS_Windows_Metafile \ XBM___X_Consortium \ XPM \ @@ -755,6 +758,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_drawgraphics_f draw_png_Export \ draw_svg_Export \ draw_tif_Export \ + draw_webp_Export \ draw_wmf_Export \ )) @@ -779,6 +783,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_impressgraphics_ svm_StarView_Metafile \ tif_Tag_Image_File \ wmf_MS_Windows_Metafile \ + webp_WebP \ xpm_XPM \ )) @@ -793,6 +798,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impressgraphic impress_png_Export \ impress_svg_Export \ impress_tif_Export \ + impress_webp_Export \ impress_wmf_Export \ )) @@ -807,6 +813,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_writergraphics writer_jpg_Export \ writer_png_Export \ writer_svg_Export \ + writer_webp_Export \ )) # fcfg_calcgraphics @@ -819,6 +826,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_calcgraphics_f calc_jpg_Export \ calc_png_Export \ calc_svg_Export \ + calc_webp_Export \ )) # fcfg_internalgraphics @@ -846,6 +854,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_internalgraphics svm_StarView_Metafile \ tga_Truevision_TARGA \ tif_Tag_Image_File \ + webp_WebP \ wmf_MS_Windows_Metafile \ xbm_X_Consortium \ xpm_XPM \ @@ -885,11 +894,13 @@ $(eval $(call filter_Configuration_add_internal_filters,fcfg_langpack,fcfg_inter tga_Import \ tif_Export \ tif_Import \ + webp_Export \ + webp_Import \ wmf_Export \ wmf_Import \ xbm_Import \ xpm_Import \ - mov_Import \ + mov_Import \ )) # fcfg_xslt diff --git a/filter/qa/complex/filter/detection/typeDetection/files.csv b/filter/qa/complex/filter/detection/typeDetection/files.csv index b882ea1179ca..8e558590b4e7 100644 --- a/filter/qa/complex/filter/detection/typeDetection/files.csv +++ b/filter/qa/complex/filter/detection/typeDetection/files.csv @@ -111,6 +111,7 @@ ppm;Graphics/pic.ppm;ppm_Portable_Pixelmap;ppm_Portable_Pixelmap ras;Graphics/pic.ras;ras_Sun_Rasterfile;ras_Sun_Rasterfile svm;Graphics/pic.svm;svm_StarView_Metafile;svm_StarView_Metafile:generic_Text tif;Graphics/pic.tif;tif_Tag_Image_File;tif_Tag_Image_File:generic_Text +webp;Graphics/pic.webp;webp_WebP;webp_WebP wmf;Graphics/pic.wmf;wmf_MS_Windows_Metafile;wmf_MS_Windows_Metafile:generic_Text diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 6679a5c8973d..17ac88069110 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> diff --git a/icon-themes/breeze/res/sx03223.png b/icon-themes/breeze/res/sx03223.png new file mode 100644 index 000000000000..82e6f7b14f31 Binary files /dev/null and b/icon-themes/breeze/res/sx03223.png differ diff --git a/icon-themes/breeze_dark/res/sx03223.png b/icon-themes/breeze_dark/res/sx03223.png new file mode 100644 index 000000000000..82e6f7b14f31 Binary files /dev/null and b/icon-themes/breeze_dark/res/sx03223.png differ diff --git a/icon-themes/breeze_dark_svg/res/sx03223.svg b/icon-themes/breeze_dark_svg/res/sx03223.svg new file mode 100644 index 000000000000..576860153fb7 --- /dev/null +++ b/icon-themes/breeze_dark_svg/res/sx03223.svg @@ -0,0 +1 @@ +<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m2 2v8.992188l-1 1v.007812h1v2h12v-2.998047h1v-.009765l-1-1.0000005v-7.9921875zm1 1h10v5.9921875l-3.9941406-3.9921875h-.0058594v.0019531h-.0058594l-2.4960937 2.4921875-.4941407-.4941406h-.0039062-.0039062l-2.9960938 2.9941406zm2 1c-.554 0-1 .446-1 1s.446 1 1 1 1-.446 1-1-.446-1-1-1zm4 2.4101562 4 3.9980468v.591797h-2.992188l-2.8007808-2.796875zm-3 2 .5.5 2.0898438 2.0898438h-5.1816407zm-3 3.5898438h6.5898438l.0019531.001953h1.4082031v-.001953h2v1h-10z" fill="#4e9b06"/></svg> \ No newline at end of file diff --git a/icon-themes/breeze_svg/res/sx03223.svg b/icon-themes/breeze_svg/res/sx03223.svg new file mode 100644 index 000000000000..576860153fb7 --- /dev/null +++ b/icon-themes/breeze_svg/res/sx03223.svg @@ -0,0 +1 @@ +<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="m2 2v8.992188l-1 1v.007812h1v2h12v-2.998047h1v-.009765l-1-1.0000005v-7.9921875zm1 1h10v5.9921875l-3.9941406-3.9921875h-.0058594v.0019531h-.0058594l-2.4960937 2.4921875-.4941407-.4941406h-.0039062-.0039062l-2.9960938 2.9941406zm2 1c-.554 0-1 .446-1 1s.446 1 1 1 1-.446 1-1-.446-1-1-1zm4 2.4101562 4 3.9980468v.591797h-2.992188l-2.8007808-2.796875zm-3 2 .5.5 2.0898438 2.0898438h-5.1816407zm-3 3.5898438h6.5898438l.0019531.001953h1.4082031v-.001953h2v1h-10z" fill="#4e9b06"/></svg> \ No newline at end of file diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index b9c5945e8c1f..9afdacfc2998 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -467,6 +467,7 @@ certain functionality. @li @c vcl.emf - EMF/EMF+ processing @li @c vcl.eventtesting @li @c vcl.filter +@li @c vcl.filter.webp @li @c vcl.fonts - font-specific code @li @c vcl.fonts.detail @li @c vcl.gdi - the GDI part of VCL, devices, bitmaps, etc. diff --git a/include/svl/inettype.hxx b/include/svl/inettype.hxx index 9bea57d26da0..806c5a3e4383 100644 --- a/include/svl/inettype.hxx +++ b/include/svl/inettype.hxx @@ -82,6 +82,7 @@ #define CONTENT_TYPE_STR_IMAGE_PNG "image/png" #define CONTENT_TYPE_STR_IMAGE_TIFF "image/tiff" #define CONTENT_TYPE_STR_IMAGE_BMP "image/x-MS-bmp" +#define CONTENT_TYPE_STR_IMAGE_WEBP "image/webp" #define CONTENT_TYPE_STR_INET_MSG_RFC822 "message/rfc822" #define CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE "multipart/alternative" #define CONTENT_TYPE_STR_INET_MULTI_DIGEST "multipart/digest" @@ -149,6 +150,7 @@ enum INetContentType CONTENT_TYPE_IMAGE_PNG, CONTENT_TYPE_IMAGE_TIFF, CONTENT_TYPE_IMAGE_BMP, + CONTENT_TYPE_IMAGE_WEBP, CONTENT_TYPE_TEXT_HTML, CONTENT_TYPE_TEXT_PLAIN, CONTENT_TYPE_TEXT_URL, diff --git a/include/svtools/imagemgr.hxx b/include/svtools/imagemgr.hxx index 6abe56b08bb0..a2b48247f4d2 100644 --- a/include/svtools/imagemgr.hxx +++ b/include/svtools/imagemgr.hxx @@ -37,6 +37,7 @@ enum class SvImageId { GIF = START + 61, HTML = START + 63, JPG = START + 64, + WEBP = START + 65, Math = START + 68, MathTemplate = START + 69, File = START + 74, diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc index c1bbf42205f8..4a2602c8536a 100644 --- a/include/svx/strings.hrc +++ b/include/svx/strings.hrc @@ -1399,6 +1399,7 @@ #define STR_IMAGE_PCT NC_("STR_IMAGE_PCT", "PCT image") #define STR_IMAGE_SVG NC_("STR_IMAGE_SVG", "SVG image") #define STR_IMAGE_BMP NC_("STR_IMAGE_BMP", "BMP image") +#define STR_IMAGE_WEBP NC_("STR_IMAGE_WEBP", "WebP image") #define STR_IMAGE_UNKNOWN NC_("STR_IMAGE_UNKNOWN", "Unknown") #define STR_SWITCH NC_("STR_SWITCH", "Switch") diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx index 790589e68225..c802e56da3ca 100644 --- a/include/vcl/gfxlink.hxx +++ b/include/vcl/gfxlink.hxx @@ -47,12 +47,13 @@ enum class GfxLinkType NativeSvg = 9, NativeMov = 10, NativeBmp = 11, - NativePdf = 12, // If a new type is added, make sure to change NativeLast too + NativePdf = 12, + NativeWebp = 13, // If a new type is added, make sure to change NativeLast too // Alias for when the first native type starts and last native // type ends. NativeFirst = NativeGif, - NativeLast = NativePdf, + NativeLast = NativeWebp, }; class Graphic; diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index d153c9d97648..f0255ee0f11d 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -89,6 +89,7 @@ namespace o3tl #define IMP_PCD "SVPCD" #define IMP_PBM "SVPBM" #define IMP_DXF "SVDXF" +#define IMP_WEBP "SVIWEBP" #define EXP_BMP "SVBMP" #define EXP_SVMETAFILE "SVMETAFILE" @@ -101,6 +102,7 @@ namespace o3tl #define EXP_TIFF "SVTIFF" #define EXP_EPS "SVEEPS" #define EXP_GIF "SVEGIF" +#define EXP_WEBP "SVEWEBP" #define BMP_SHORTNAME u"BMP" @@ -115,6 +117,7 @@ namespace o3tl #define EMF_SHORTNAME u"EMF" #define SVG_SHORTNAME u"SVG" #define PDF_SHORTNAME u"PDF" +#define WEBP_SHORTNAME u"WEBP" // Info class for all supported file formats @@ -137,6 +140,7 @@ enum class GraphicFileFormat TGA = 0x000e, PSD = 0x000f, EPS = 0x0010, + WEBP = 0x0011, DXF = 0x00f1, MET = 0x00f2, PCT = 0x00f3, @@ -184,6 +188,7 @@ class VCL_DLLPUBLIC GraphicDescriptor final bool ImpDetectTGA( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectPSD( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectEPS( SvStream& rStm, bool bExtendedInfo ); + bool ImpDetectWEBP( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectDXF( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectMET( SvStream& rStm, bool bExtendedInfo ); bool ImpDetectPCT( SvStream& rStm, bool bExtendedInfo ); @@ -382,6 +387,7 @@ public: static ErrCode readPCD(SvStream & rStream, Graphic & rGraphic); static ErrCode readPBM(SvStream & rStream, Graphic & rGraphic); static ErrCode readDXF(SvStream & rStream, Graphic & rGraphic); + static ErrCode readWEBP(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType); private: OUString aFilterPath; diff --git a/include/vcl/salctype.hxx b/include/vcl/salctype.hxx index 409fc5a79993..71f256b1986e 100644 --- a/include/vcl/salctype.hxx +++ b/include/vcl/salctype.hxx @@ -37,7 +37,8 @@ enum class ConvertDataFormat TIF, WMF, EMF, - SVG + SVG, + WEBP }; class SvStream; diff --git a/readlicense_oo/license/license.xml b/readlicense_oo/license/license.xml index 02a91d7c1daf..abb527d02b98 100644 --- a/readlicense_oo/license/license.xml +++ b/readlicense_oo/license/license.xml @@ -1135,6 +1135,37 @@ glennrp at users.sourceforge.net<br /> February 3, 2011 </p> </div> + <div class="LIBWEBP"> + <h2>libwebp</h2> + <p>The following software may be included in this product: libwebp. Use of any of this software is governed by + the terms of the license below:</p> + <p>Copyright (c) 2010, Google Inc. All rights reserved.</p> + <p>Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met:</p> + <ol> + <li>Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer.</li> + <li>Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution.</li> + <li>Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission.</li> + </ol> + <p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p> + </div> <div class="PAGEMAKER"> <h2>libpagemaker</h2> <p>The following software may be included in this product: libpagemaker. Use of any of this software is governed diff --git a/scp2/source/draw/registryitem_draw.scp b/scp2/source/draw/registryitem_draw.scp index 93cadcaa1ca5..79440c00653b 100644 --- a/scp2/source/draw/registryitem_draw.scp +++ b/scp2/source/draw/registryitem_draw.scp @@ -1092,6 +1092,7 @@ CONDITIONAL_REGISTER_DOC_EXTENSION( Tiff, gid_Module_Prg_Draw_Other_Reg, tiff, CONDITIONAL_REGISTER_DOC_EXTENSION( Xbm, gid_Module_Prg_Draw_Other_Reg, xbm, XBM, X_BITMAP, 5, sdraw.exe, open, Draw ) CONDITIONAL_REGISTER_DOC_EXTENSION( Xpm, gid_Module_Prg_Draw_Other_Reg, xpm, XPM, X_PIXMAP, 5, sdraw.exe, open, Draw ) CONDITIONAL_REGISTER_DOC_EXTENSION( PCD, gid_Module_Prg_Draw_Other_Reg, pcd, PCD, KODAK_PHOTO_CD_IMAGE, 5, sdraw.exe, open, Draw ) +CONDITIONAL_REGISTER_DOC_EXTENSION( Webp, gid_Module_Prg_Draw_Other_Reg, webp, WEBP, WEBP, 5, sdraw.exe, open, Draw ) // registering ms-visio URI scheme handler CONDITIONAL_REGISTER_URI_HANDLER( ms-visio, ms_visio, gid_Module_Prg_Draw_MSO_Reg, SELECT_VISIO ) diff --git a/solenv/sanitizers/ui/svt.suppr b/solenv/sanitizers/ui/svt.suppr index 40c22f896163..188bd9ea0289 100644 --- a/solenv/sanitizers/ui/svt.suppr +++ b/solenv/sanitizers/ui/svt.suppr @@ -1,6 +1,6 @@ svtools/uiconfig/ui/checkboxcontrol.ui://GtkCheckButton[@id='checkbox'] button-no-label svtools/uiconfig/ui/editcontrol.ui://GtkEntry[@id='entry'] no-labelled-by -svtools/uiconfig/ui/graphicexport.ui://GtkScale[@id='compressionjpgsb'] no-labelled-by +svtools/uiconfig/ui/graphicexport.ui://GtkScale[@id='compressionjpgwebpsb'] no-labelled-by svtools/uiconfig/ui/graphicexport.ui://GtkScale[@id='compressionpngsb'] no-labelled-by svtools/uiconfig/ui/graphicexport.ui://GtkLabel[@id='estsizeft'] orphan-label svtools/uiconfig/ui/placeedit.ui://GtkButton[@id='repositoriesRefresh'] button-no-label diff --git a/svtools/inc/bitmaps.hlst b/svtools/inc/bitmaps.hlst index 35332e05ede0..c9c5bd88dc50 100644 --- a/svtools/inc/bitmaps.hlst +++ b/svtools/inc/bitmaps.hlst @@ -39,6 +39,7 @@ #define BMP_MET_SC "res/sx03218.png" #define BMP_PNG_SC "res/sx03219.png" #define BMP_SVM_SC "res/sx03222.png" +#define BMP_WEBP_SC "res/sx03223.png" #define BMP_GLOBAL_DOC_SC "res/sx03226.png" #define BMP_DRAW_SC "res/sx03227.png" #define BMP_DRAWTEMPLATE_SC "res/sx03228.png" @@ -85,6 +86,7 @@ #define BMP_MET_LC "res/lx03218.png" #define BMP_PNG_LC "res/lx03219.png" #define BMP_SVM_LC "res/lx03222.png" +#define BMP_WEBP_LC "res/lx03223.png" #define BMP_GLOBAL_DOC_LC "res/lx03226.png" #define BMP_DRAW_LC "res/lx03227.png" #define BMP_DRAWTEMPLATE_LC "res/lx03228.png" diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 5accd1482cd1..4aa5ff416635 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -56,6 +56,7 @@ #define FORMAT_EMF 13 #define FORMAT_EPS 14 #define FORMAT_SVG 16 +#define FORMAT_WEBP 17 #define UNIT_DEFAULT -1 #define UNIT_INCH 0 @@ -88,6 +89,8 @@ static sal_Int16 GetFilterFormat(std::u16string_view rExt) nFormat = FORMAT_EPS; else if ( rExt == u"SVG" ) nFormat = FORMAT_SVG; + else if ( rExt == u"WEBP" ) + nFormat = FORMAT_WEBP; return nFormat; } @@ -292,6 +295,15 @@ uno::Sequence< beans::PropertyValue > ExportDialog::GetFilterData( bool bUpdateC pFilterOptions->WriteInt32("CompressionMode", nCheck); } break; + + case FORMAT_WEBP : + { + assert(mpSbCompression); + pFilterOptions->WriteInt32("Quality", static_cast<sal_Int32>(mpSbCompression->get_value())); + pFilterOptions->WriteBool("Lossless", mxCbLossless->get_active()); + } + break; + } uno::Sequence< beans::PropertyValue > aRet( pFilterOptions->GetFilterData() ); @@ -584,12 +596,13 @@ ExportDialog::ExportDialog(FltCallDialogParameter& rPara, , mxLbResolution(m_xBuilder->weld_combo_box("resolutionlb")) , mxColorDepth(m_xBuilder->weld_widget("colordepth")) , mxLbColorDepth(m_xBuilder->weld_combo_box("colordepthlb")) - , mxJPGQuality(m_xBuilder->weld_widget("jpgquality")) + , mxJPGWEBPQuality(m_xBuilder->weld_widget("jpgwebpquality")) , mxPNGCompression(m_xBuilder->weld_widget("pngcompression")) , mxSbPngCompression(m_xBuilder->weld_scale("compressionpngsb")) , mxNfPngCompression(m_xBuilder->weld_spin_button("compressionpngnf")) - , mxSbJpgCompression(m_xBuilder->weld_scale("compressionjpgsb")) - , mxNfJpgCompression(m_xBuilder->weld_spin_button("compressionjpgnf")) + , mxSbJpgWebpCompression(m_xBuilder->weld_scale("compressionjpgwebpsb")) + , mxNfJpgWebpCompression(m_xBuilder->weld_spin_button("compressionjpgwebpnf")) + , mxCbLossless(m_xBuilder->weld_check_button("losslesscb")) , mxMode(m_xBuilder->weld_widget("mode")) , mxCbInterlaced(m_xBuilder->weld_check_button("interlacedcb")) , mxBMPCompression(m_xBuilder->weld_widget("bmpcompression")) @@ -683,6 +696,8 @@ ExportDialog::ExportDialog(FltCallDialogParameter& rPara, mxCbInterlaced->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) ); + mxCbLossless->connect_toggled( LINK( this, ExportDialog, UpdateHdlLossless ) ); + mxCbSaveTransparency->connect_toggled( LINK( this, ExportDialog, UpdateHdl ) ); mxModifyDimension->connect_toggled( LINK( this, ExportDialog, UpdateLock ) ); @@ -763,15 +778,16 @@ void ExportDialog::createFilterOptions() mxColorDepth->show(); // Quality - mxJPGQuality->show(); + mxJPGWEBPQuality->show(); sal_Int32 nQuality = mpFilterOptionsItem->ReadInt32("Quality", 75); if ((nQuality < 1 ) || (nQuality > 100)) nQuality = 75; - mpSbCompression = mxSbJpgCompression.get(); - mpNfCompression = mxNfJpgCompression.get(); + mpSbCompression = mxSbJpgWebpCompression.get(); + mpNfCompression = mxNfJpgWebpCompression.get(); mpSbCompression->set_range(1, 100); mpNfCompression->set_range(1, 100); mpNfCompression->set_value(nQuality); + mxCbLossless->hide(); // only for WebP } break; case FORMAT_PNG : @@ -854,6 +870,24 @@ void ExportDialog::createFilterOptions() mxRbEPSCompressionNone->set_active( nCompr != 1 ); } break; + case FORMAT_WEBP : + { + // Quality + mxJPGWEBPQuality->show(); + sal_Int32 nQuality = mpFilterOptionsItem->ReadInt32("Quality", 75); + if ((nQuality < 1 ) || (nQuality > 100)) + nQuality = 75; + mpSbCompression = mxSbJpgWebpCompression.get(); + mpNfCompression = mxNfJpgWebpCompression.get(); + mpSbCompression->set_range(1, 100); + mpNfCompression->set_range(1, 100); + mpNfCompression->set_value(nQuality); + + // Lossless + mxCbLossless->set_active(mpFilterOptionsItem->ReadBool("Lossless", true)); + UpdateHdlLossless(*mxCbLossless); + } + break; } } @@ -997,6 +1031,13 @@ IMPL_LINK_NOARG(ExportDialog, UpdateHdl, weld::Toggleable&, void) updateControls(); } +IMPL_LINK_NOARG(ExportDialog, UpdateHdlLossless, weld::Toggleable&, void) +{ + mpSbCompression->set_sensitive(!mxCbLossless->get_active()); + mpNfCompression->set_sensitive(!mxCbLossless->get_active()); + updateControls(); +} + IMPL_LINK_NOARG(ExportDialog, UpdateLock, weld::Toggleable&, void) { if (mxModifyResolution->get_active()) diff --git a/svtools/source/filter/exportdialog.hxx b/svtools/source/filter/exportdialog.hxx index 28953ee0224c..1c7c63953a16 100644 --- a/svtools/source/filter/exportdialog.hxx +++ b/svtools/source/filter/exportdialog.hxx @@ -104,14 +104,16 @@ private: std::unique_ptr<weld::Widget> mxColorDepth; std::unique_ptr<weld::ComboBox> mxLbColorDepth; - std::unique_ptr<weld::Widget> mxJPGQuality; + std::unique_ptr<weld::Widget> mxJPGWEBPQuality; std::unique_ptr<weld::Widget> mxPNGCompression; std::unique_ptr<weld::Scale> mxSbPngCompression; std::unique_ptr<weld::SpinButton> mxNfPngCompression; - std::unique_ptr<weld::Scale> mxSbJpgCompression; - std::unique_ptr<weld::SpinButton> mxNfJpgCompression; + std::unique_ptr<weld::Scale> mxSbJpgWebpCompression; + std::unique_ptr<weld::SpinButton> mxNfJpgWebpCompression; + + std::unique_ptr<weld::CheckButton> mxCbLossless; std::unique_ptr<weld::Widget> mxMode; std::unique_ptr<weld::CheckButton> mxCbInterlaced; @@ -152,6 +154,7 @@ private: DECL_LINK(UpdateHdlMtfSizeY, weld::SpinButton&, void); DECL_LINK(UpdateHdlNfResolution, weld::SpinButton&, void); DECL_LINK(SbCompressionUpdateHdl, weld::Scale&, void); + DECL_LINK(UpdateHdlLossless, weld::Toggleable&, void); DECL_LINK(OK, weld::Button&, void); diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index ff7fe554d869..5b9c92f0650f 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -153,6 +153,7 @@ SvtExtensionResIdMapping_Impl const ExtensionMap_Impl[] = { "url", false, STR_DESCRIPTION_LINK, SvImageId::NONE }, { "vor", false, STR_DESCRIPTION_SOFFICE_TEMPLATE_DOC, SvImageId::WriterTemplate }, { "vxd", true, STR_DESCRIPTION_SYSFILE, SvImageId::NONE }, + { "webp", true, STR_DESCRIPTION_GRAPHIC_DOC, SvImageId::WEBP }, { "wmf", true, STR_DESCRIPTION_GRAPHIC_DOC, SvImageId::WMF }, { "xls", false, STR_DESCRIPTION_EXCEL_DOC, SvImageId::Calc }, { "xlt", false, STR_DESCRIPTION_EXCEL_TEMPLATE_DOC, SvImageId::CalcTemplate }, @@ -568,6 +569,8 @@ static OUString GetImageNameFromList_Impl( SvImageId nImageId, vcl::ImageType eI return BMP_TEXTFILE_LC; case SvImageId::TIFF: return BMP_TIFF_LC; + case SvImageId::WEBP: + return BMP_WEBP_LC; case SvImageId::WMF: return BMP_WMF_LC; case SvImageId::Writer: @@ -667,6 +670,8 @@ static OUString GetImageNameFromList_Impl( SvImageId nImageId, vcl::ImageType eI return BMP_TEXTFILE_SC; case SvImageId::TIFF: return BMP_TIFF_SC; + case SvImageId::WEBP: + return BMP_WEBP_SC; case SvImageId::WMF: return BMP_WMF_SC; case SvImageId::Writer: diff --git a/svtools/uiconfig/ui/graphicexport.ui b/svtools/uiconfig/ui/graphicexport.ui index 8c5042b18932..509f0bed0af5 100644 --- a/svtools/uiconfig/ui/graphicexport.ui +++ b/svtools/uiconfig/ui/graphicexport.ui @@ -369,12 +369,12 @@ </packing> </child> <child> - <object class="GtkFrame" id="jpgquality"> + <object class="GtkFrame" id="jpgwebpquality"> <property name="can-focus">False</property> <property name="label-xalign">0</property> <property name="shadow-type">none</property> <child> - <!-- n-columns=2 n-rows=1 --> + <!-- n-columns=2 n-rows=2 --> <object class="GtkGrid" id="grid2"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -382,7 +382,27 @@ <property name="margin-top">6</property> <property name="column-spacing">6</property> <child> - <object class="GtkSpinButton" id="compressionjpgnf"> + <object class="GtkCheckButton" id="losslesscb"> + <property name="label" translatable="yes" context="graphicexport|losslesscb">Lossless</property> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="receives-default">False</property> + <property name="use-underline">True</property> + <property name="active">True</property> + <property name="draw-indicator">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="losslesscb-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="graphicexport|extended_tip|losslesscb">Lossless images do not lose quality but result in larger files.</property> + </object> + </child> + </object> + <packing> + <property name="left-attach">0</property> + <property name="top-attach">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="compressionjpgwebpnf"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="activates-default">True</property> @@ -390,18 +410,18 @@ <property name="truncate-multiline">True</property> <property name="adjustment">adjustment1</property> <child internal-child="accessible"> - <object class="AtkObject" id="compressionjpgnf-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="graphicexport|extended_tip|compressionjpgnf">Sets the quality for the export. Choose from a low quality with minimal file size, up to a high quality and big file size</property> + <object class="AtkObject" id="compressionjpgwebpnf-atkobject"> + <property name="AtkObject::accessible-description" translatable="yes" context="graphicexport|extended_tip|compressionjpgwebpnf">Sets the quality for the export. Choose from a low quality with minimal file size, up to a high quality and big file size.</property> </object> </child> </object> <packing> <property name="left-attach">1</property> - <property name="top-attach">0</property> + <property name="top-attach">1</property> </packing> </child> <child> - <object class="GtkScale" id="compressionjpgsb"> + <object class="GtkScale" id="compressionjpgwebpsb"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="valign">center</property> @@ -411,7 +431,7 @@ </object> <packing> <property name="left-attach">0</property> - <property name="top-attach">0</property> + <property name="top-attach">1</property> </packing> </child> </object> diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx index 997644b6260a..ae31bb0d8f37 100644 --- a/svx/source/core/graphichelper.cxx +++ b/svx/source/core/graphichelper.cxx @@ -117,6 +117,9 @@ void GraphicHelper::GetPreferredExtension( OUString& rExtension, const Graphic& case GfxLinkType::NativePdf: aExtension = "pdf"; break; + case GfxLinkType::NativeWebp: + aExtension = "webp"; + break; default: break; } @@ -158,6 +161,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 b911b880339a..cdcf23401175 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -695,6 +695,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 ef2b31716a2f..c5099ea25291 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -34,6 +34,7 @@ #define FORMAT_GIF u"gif" #define FORMAT_JPG u"jpg" #define FORMAT_PNG u"png" +#define FORMAT_WEBP u"webp" using namespace com::sun::star; @@ -177,6 +178,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; diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk index ab5108f51b1c..f9f8e40cca98 100644 --- a/vcl/CppunitTest_vcl_filters_test.mk +++ b/vcl/CppunitTest_vcl_filters_test.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \ vcl/qa/cppunit/graphicfilter/filters-test \ vcl/qa/cppunit/graphicfilter/filters-tiff-test \ vcl/qa/cppunit/graphicfilter/filters-tga-test \ + vcl/qa/cppunit/graphicfilter/filters-webp-test \ )) $(eval $(call gb_CppunitTest_set_include,vcl_filters_test,\ diff --git a/vcl/Executable_webpfuzzer.mk b/vcl/Executable_webpfuzzer.mk new file mode 100644 index 000000000000..3851fbe52cd1 --- /dev/null +++ b/vcl/Executable_webpfuzzer.mk @@ -0,0 +1,45 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# +# 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/. +# + +include $(SRCDIR)/vcl/commonfuzzer.mk + +$(eval $(call gb_Executable_Executable,webpfuzzer)) + +$(eval $(call gb_Executable_use_api,webpfuzzer,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_Executable_use_externals,webpfuzzer,\ + $(fuzzer_externals) \ +)) + +$(eval $(call gb_Executable_set_include,webpfuzzer,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ +)) + +$(eval $(call gb_Executable_use_libraries,webpfuzzer,\ + $(fuzzer_core_libraries) \ +)) + +$(eval $(call gb_Executable_use_static_libraries,webpfuzzer,\ + $(fuzzer_statics) \ +)) + +$(eval $(call gb_Executable_add_exception_objects,webpfuzzer,\ + vcl/workben/webpfuzzer \ +)) + +$(eval $(call gb_Executable_add_libs,webpfuzzer,\ + $(LIB_FUZZING_ENGINE) \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index aed3ce9603da..3043f992badc 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -89,6 +89,7 @@ $(eval $(call gb_Library_use_externals,vcl,\ libeot \ libjpeg \ libpng \ + libwebp \ mdds_headers \ $(if $(filter PDFIUM,$(BUILD_TYPE)),pdfium) \ )) @@ -459,6 +460,8 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/filter/wmf/wmfwr \ vcl/source/filter/png/PngImageReader \ vcl/source/filter/png/pngwrite \ + vcl/source/filter/webp/reader \ + vcl/source/filter/webp/writer \ vcl/source/font/Feature \ vcl/source/font/FeatureCollector \ vcl/source/font/FeatureParser \ diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 4a3eec15c119..9eccd27c8ebe 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -185,6 +185,7 @@ $(eval $(call gb_Module_add_targets,vcl,\ Executable_mtpfuzzer \ Executable_htmlfuzzer \ Executable_sftfuzzer \ + Executable_webpfuzzer \ )) endif diff --git a/vcl/inc/filter/WebpReader.hxx b/vcl/inc/filter/WebpReader.hxx new file mode 100644 index 000000000000..fd8cc4894a26 --- /dev/null +++ b/vcl/inc/filter/WebpReader.hxx @@ -0,0 +1,28 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#pragma once + +#include <vcl/graph.hxx> + +VCL_DLLPUBLIC bool ImportWebpGraphic(SvStream& rStream, Graphic& rGraphic); + +bool ReadWebpInfo(SvStream& rStream, Size& pixelSize, sal_uInt16& bitsPerPixel, bool& hasAlpha); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/filter/WebpWriter.hxx b/vcl/inc/filter/WebpWriter.hxx new file mode 100644 index 000000000000..d3b6431c63ff --- /dev/null +++ b/vcl/inc/filter/WebpWriter.hxx @@ -0,0 +1,29 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#pragma once + +#include <tools/stream.hxx> +#include <vcl/graph.hxx> +#include <vcl/FilterConfigItem.hxx> + +VCL_DLLPUBLIC bool ExportWebpGraphic(SvStream& rStream, const Graphic& rGraphic, + FilterConfigItem* pFilterConfigItem); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/graphic/GraphicFormatDetector.hxx b/vcl/inc/graphic/GraphicFormatDetector.hxx index f2f0393caeee..34a8b16a2c5d 100644 --- a/vcl/inc/graphic/GraphicFormatDetector.hxx +++ b/vcl/inc/graphic/GraphicFormatDetector.hxx @@ -77,6 +77,7 @@ public: bool checkTGA(); bool checkMOV(); bool checkPDF(); + bool checkWEBP(); }; } diff --git a/vcl/inc/graphic/UnoGraphicDescriptor.hxx b/vcl/inc/graphic/UnoGraphicDescriptor.hxx index 3387545f5103..537242e3775f 100644 --- a/vcl/inc/graphic/UnoGraphicDescriptor.hxx +++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx @@ -51,6 +51,7 @@ #define MIMETYPE_EMF "image/x-emf" #define MIMETYPE_SVG "image/svg+xml" #define MIMETYPE_PDF "application/pdf" +#define MIMETYPE_WEBP "image/webp" #define MIMETYPE_VCLGRAPHIC "image/x-vclgraphic" namespace comphelper { class PropertySetInfo; } diff --git a/vcl/qa/cppunit/GraphicDescriptorTest.cxx b/vcl/qa/cppunit/GraphicDescriptorTest.cxx index 652393ae9b63..865202cedbf5 100644 --- a/vcl/qa/cppunit/GraphicDescriptorTest.cxx +++ b/vcl/qa/cppunit/GraphicDescriptorTest.cxx @@ -34,6 +34,7 @@ class GraphicDescriptorTest : public test::BootstrapFixtureBase void testDetectGIF(); void testDetectTIF(); void testDetectBMP(); + void testDetectWEBP(); CPPUNIT_TEST_SUITE(GraphicDescriptorTest); CPPUNIT_TEST(testDetectPNG); @@ -41,6 +42,7 @@ class GraphicDescriptorTest : public test::BootstrapFixtureBase CPPUNIT_TEST(testDetectGIF); CPPUNIT_TEST(testDetectTIF); CPPUNIT_TEST(testDetectBMP); + CPPUNIT_TEST(testDetectWEBP); CPPUNIT_TEST_SUITE_END(); }; @@ -138,6 +140,20 @@ void GraphicDescriptorTest::testDetectBMP() CPPUNIT_ASSERT_EQUAL(MapUnit::MapMM, aGraphic.GetPrefMapMode().GetMapUnit()); } +void GraphicDescriptorTest::testDetectWEBP() +{ + SvMemoryStream aStream; + createBitmapAndExportForType(aStream, u"webp"); + + GraphicDescriptor aDescriptor(aStream, nullptr); + aDescriptor.Detect(true); + + CPPUNIT_ASSERT_EQUAL(GraphicFileFormat::WEBP, aDescriptor.GetFileFormat()); + + CPPUNIT_ASSERT_EQUAL(tools::Long(100), aDescriptor.GetSizePixel().Width()); + CPPUNIT_ASSERT_EQUAL(tools::Long(100), aDescriptor.GetSizePixel().Height()); +} + } // namespace CPPUNIT_TEST_SUITE_REGISTRATION(GraphicDescriptorTest); diff --git a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx index 264a0e8cd48d..4c16bfc82e1b 100644 --- a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx +++ b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx @@ -47,6 +47,7 @@ class GraphicFormatDetectorTest : public test::BootstrapFixtureBase void testDetectSVGZ(); void testDetectPDF(); void testDetectEPS(); + void testDetectWEBP(); void testMatchArray(); void testCheckArrayForMatchingStrings(); @@ -67,6 +68,7 @@ class GraphicFormatDetectorTest : public test::BootstrapFixtureBase CPPUNIT_TEST(testDetectSVGZ); CPPUNIT_TEST(testDetectPDF); CPPUNIT_TEST(testDetectEPS); + CPPUNIT_TEST(testDetectWEBP); CPPUNIT_TEST(testMatchArray); CPPUNIT_TEST(testCheckArrayForMatchingStrings); CPPUNIT_TEST_SUITE_END(); @@ -312,6 +314,21 @@ void GraphicFormatDetectorTest::testDetectEPS() CPPUNIT_ASSERT_EQUAL(OUString("EPS"), rFormatExtension); } +void GraphicFormatDetectorTest::testDetectWEBP() +{ + SvFileStream aFileStream(getFullUrl(u"TypeDetectionExample.webp"), StreamMode::READ); + vcl::GraphicFormatDetector aDetector(aFileStream, "WEBP"); + + CPPUNIT_ASSERT(aDetector.detect()); + CPPUNIT_ASSERT(aDetector.checkWEBP()); + + aFileStream.Seek(aDetector.mnStreamPosition); + + OUString rFormatExtension; + CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false)); + CPPUNIT_ASSERT_EQUAL(OUString("WEBP"), rFormatExtension); +} + void GraphicFormatDetectorTest::testMatchArray() { std::string aString("<?xml version=\"1.0\" standalone=\"no\"?>\n" diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index e9af574aa5a4..afd79e63b414 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -81,6 +81,7 @@ private: void testLoadXPM(); void testLoadPCX(); void testLoadEPS(); + void testLoadWEBP(); void testAvailableThreaded(); @@ -118,6 +119,7 @@ private: CPPUNIT_TEST(testLoadXPM); CPPUNIT_TEST(testLoadPCX); CPPUNIT_TEST(testLoadEPS); + CPPUNIT_TEST(testLoadWEBP); CPPUNIT_TEST(testAvailableThreaded); @@ -305,7 +307,7 @@ void GraphicTest::testUnloadedGraphic() void GraphicTest::testUnloadedGraphicLoading() { - const OUString aFormats[] = { "png", "gif", "jpg", "tif" }; + const OUString aFormats[] = { "png", "gif", "jpg", "tif", "webp" }; for (OUString const& sFormat : aFormats) { @@ -1311,6 +1313,14 @@ void GraphicTest::testLoadEPS() CPPUNIT_ASSERT_EQUAL(GraphicType::GdiMetafile, aGraphic.GetType()); } +void GraphicTest::testLoadWEBP() +{ + Graphic aGraphic = loadGraphic(u"TypeDetectionExample.webp"); + CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType()); + CPPUNIT_ASSERT_EQUAL(tools::Long(10), aGraphic.GetSizePixel().Width()); + CPPUNIT_ASSERT_EQUAL(tools::Long(10), aGraphic.GetSizePixel().Height()); +} + void GraphicTest::testAvailableThreaded() { Graphic jpgGraphic1 = importUnloadedGraphic(u"TypeDetectionExample.jpg"); diff --git a/vcl/qa/cppunit/data/TypeDetectionExample.webp b/vcl/qa/cppunit/data/TypeDetectionExample.webp new file mode 100644 index 000000000000..e85ae121637b Binary files /dev/null and b/vcl/qa/cppunit/data/TypeDetectionExample.webp differ diff --git a/vcl/qa/cppunit/graphicfilter/data/webp/alpha_lossless.webp b/vcl/qa/cppunit/graphicfilter/data/webp/alpha_lossless.webp new file mode 100644 index 000000000000..abb67cc5f4b6 Binary files /dev/null and b/vcl/qa/cppunit/graphicfilter/data/webp/alpha_lossless.webp differ diff --git a/vcl/qa/cppunit/graphicfilter/data/webp/alpha_lossy.webp b/vcl/qa/cppunit/graphicfilter/data/webp/alpha_lossy.webp new file mode 100644 index 000000000000..c587b1bb22c0 Binary files /dev/null and b/vcl/qa/cppunit/graphicfilter/data/webp/alpha_lossy.webp differ diff --git a/vcl/qa/cppunit/graphicfilter/data/webp/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/webp/fail/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/vcl/qa/cppunit/graphicfilter/data/webp/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/webp/indeterminate/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/vcl/qa/cppunit/graphicfilter/data/webp/noalpha_lossless.webp b/vcl/qa/cppunit/graphicfilter/data/webp/noalpha_lossless.webp new file mode 100644 index 000000000000..b22ebc3b28bb Binary files /dev/null and b/vcl/qa/cppunit/graphicfilter/data/webp/noalpha_lossless.webp differ diff --git a/vcl/qa/cppunit/graphicfilter/data/webp/noalpha_lossy.webp b/vcl/qa/cppunit/graphicfilter/data/webp/noalpha_lossy.webp new file mode 100644 index 000000000000..c118febb0e9a Binary files /dev/null and b/vcl/qa/cppunit/graphicfilter/data/webp/noalpha_lossy.webp differ diff --git a/vcl/qa/cppunit/graphicfilter/data/webp/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/webp/pass/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index ad5c1be8e8a4..4eb0a674bdd0 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -146,6 +146,8 @@ void VclFiltersTest::testExportImport() checkExportImport(u"bmp"); fprintf(stderr, "Check ExportImport TIF\n"); checkExportImport(u"tif"); + fprintf(stderr, "Check ExportImport WEBP\n"); + checkExportImport(u"webp"); } void VclFiltersTest::testCVEs() diff --git a/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx new file mode 100644 index 000000000000..90528199c0ba --- /dev/null +++ b/vcl/qa/cppunit/graphicfilter/filters-webp-test.cxx @@ -0,0 +1,203 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#include <unotest/filters-test.hxx> +#include <test/bootstrapfixture.hxx> +#include <vcl/FilterConfigItem.hxx> +#include <bitmap/BitmapWriteAccess.hxx> +#include <tools/stream.hxx> +#include <vcl/graph.hxx> +#include <vcl/graphicfilter.hxx> +#include <graphic/GraphicFormatDetector.hxx> +#include <filter/WebpReader.hxx> +#include <comphelper/propertyvalue.hxx> + +using namespace css; + +/* Implementation of Filters test */ + +class WebpFilterTest : public test::FiltersTest, public test::BootstrapFixture +{ +public: + WebpFilterTest() + : BootstrapFixture(true, false) + { + } + + virtual bool load(const OUString&, const OUString& rURL, const OUString&, SfxFilterFlags, + SotClipboardFormatId, unsigned int) override; + + /** + * Ensure CVEs remain unbroken + */ + void testCVEs(); + + void testRoundtripLossless(); + void testRoundtripLossy(); + void testReadAlphaLossless(); + void testReadAlphaLossy(); + void testReadNoAlphaLossless(); + void testReadNoAlphaLossy(); + + CPPUNIT_TEST_SUITE(WebpFilterTest); + CPPUNIT_TEST(testCVEs); + CPPUNIT_TEST(testRoundtripLossless); + CPPUNIT_TEST(testRoundtripLossy); + CPPUNIT_TEST(testReadAlphaLossless); + CPPUNIT_TEST(testReadAlphaLossy); + CPPUNIT_TEST(testReadNoAlphaLossless); + CPPUNIT_TEST(testReadNoAlphaLossy); + CPPUNIT_TEST_SUITE_END(); + +private: + void testRoundtrip(bool lossy); + void testRead(bool lossy, bool alpha); +}; + +bool WebpFilterTest::load(const OUString&, const OUString& rURL, const OUString&, SfxFilterFlags, + SotClipboardFormatId, unsigned int) +{ + SvFileStream aFileStream(rURL, StreamMode::READ); + Graphic aGraphic; + return ImportWebpGraphic(aFileStream, aGraphic); +} + +void WebpFilterTest::testCVEs() +{ +#ifndef DISABLE_CVE_TESTS + testDir(OUString(), m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/webp/")); +#endif +} + +void WebpFilterTest::testRoundtripLossless() { testRoundtrip(false); } + +void WebpFilterTest::testRoundtripLossy() { testRoundtrip(true); } + +void WebpFilterTest::testRoundtrip(bool lossy) +{ + // Do not use just 2x2, lossy saving would change colors. + Bitmap aBitmap(Size(20, 20), vcl::PixelFormat::N24_BPP); + AlphaMask aAlpha(Size(20, 20)); + { + BitmapScopedWriteAccess pAccess(aBitmap); + pAccess->SetFillColor(COL_WHITE); + pAccess->FillRect(tools::Rectangle(Point(0, 0), Size(10, 10))); + pAccess->SetFillColor(COL_BLACK); + pAccess->FillRect(tools::Rectangle(Point(10, 0), Size(10, 10))); + pAccess->SetFillColor(COL_LIGHTRED); + pAccess->FillRect(tools::Rectangle(Point(0, 10), Size(10, 10))); + pAccess->SetFillColor(COL_BLUE); + pAccess->FillRect(tools::Rectangle(Point(10, 10), Size(10, 10))); + AlphaScopedWriteAccess pAccessAlpha(aAlpha); + pAccessAlpha->SetFillColor(BitmapColor(0)); // opaque + pAccessAlpha->FillRect(tools::Rectangle(Point(0, 0), Size(10, 10))); + pAccessAlpha->FillRect(tools::Rectangle(Point(10, 0), Size(10, 10))); + pAccessAlpha->FillRect(tools::Rectangle(Point(0, 10), Size(10, 10))); + pAccessAlpha->SetFillColor(BitmapColor(64, 64, 64)); + pAccessAlpha->FillRect(tools::Rectangle(Point(10, 10), Size(10, 10))); + } + BitmapEx aBitmapEx(aBitmap, aAlpha); + + SvMemoryStream aStream; + GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); + sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName(u"webp"); + css::uno::Sequence<css::beans::PropertyValue> aFilterData{ + comphelper::makePropertyValue("Lossless", !lossy), + comphelper::makePropertyValue("Quality", sal_Int32(100)) + }; + rFilter.ExportGraphic(Graphic(aBitmapEx), "none", aStream, nFilterFormat, &aFilterData); + aStream.Seek(STREAM_SEEK_TO_BEGIN); + ... etc. - the rest is truncated
