diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-02-15 12:30:25 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-02-18 04:12:27 +0100 |
commit | 2270a58d7b25e683449c180576b7647f8d5256f4 (patch) | |
tree | ddc6c7b8ede3c0aa9430bfacd3fe09733e920eac | |
parent | tdf#105301: sc: Add UItest (diff) | |
download | core-2270a58d7b25e683449c180576b7647f8d5256f4.tar.gz core-2270a58d7b25e683449c180576b7647f8d5256f4.zip |
Move GIF writer from filter module into VCL
Change-Id: I8db3ca0f7953b44791bda47534220902931fab8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111023
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
19 files changed, 64 insertions, 135 deletions
diff --git a/Repository.mk b/Repository.mk index b207902fe1a5..930ae5bfdc94 100644 --- a/Repository.mk +++ b/Repository.mk @@ -369,7 +369,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ $(if $(filter DESKTOP,$(BUILD_TYPE)),helplinker) \ i18npool \ i18nsearch \ - gie \ hyphen \ icg \ $(if $(ENABLE_JAVA),jdbc) \ diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx index 95c8184009d7..c72ccc9dd488 100644 --- a/compilerplugins/clang/constparams.cxx +++ b/compilerplugins/clang/constparams.cxx @@ -189,9 +189,6 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl) || name.startswith("Read_F_") // UNO component entry points || name.endswith("component_getFactory") - || name == "egiGraphicExport" - || name == "etiGraphicExport" - || name == "epsGraphicExport" // callback for some external code? || name == "ScAddInAsyncCallBack" // used as function pointers diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk deleted file mode 100644 index b40da250a183..000000000000 --- a/filter/Library_gie.mk +++ /dev/null @@ -1,56 +0,0 @@ -# -*- 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/. -# -# 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 . -# - -$(eval $(call gb_Library_Library,gie)) - -$(eval $(call gb_Library_set_include,gie,\ - $$(INCLUDE) \ - -I$(SRCDIR)/filter/inc \ -)) - -$(eval $(call gb_Library_use_external,gie,boost_headers)) - -$(eval $(call gb_Library_use_sdk_api,gie)) - -$(eval $(call gb_Library_use_custom_headers,gie,\ - officecfg/registry \ -)) - -$(eval $(call gb_Library_use_common_precompiled_header,gie)) - -$(eval $(call gb_Library_use_libraries,gie,\ - basegfx \ - comphelper \ - i18nlangtag \ - svt \ - vcl \ - utl \ - tl \ - tk \ - cppu \ - sal \ - salhelper \ -)) - -$(eval $(call gb_Library_add_exception_objects,gie,\ - filter/source/graphicfilter/egif/egif \ - filter/source/graphicfilter/egif/giflzwc \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk index 2fb2e4c0c8e3..42a82bacf5c0 100644 --- a/filter/Module_filter.mk +++ b/filter/Module_filter.mk @@ -21,7 +21,6 @@ $(eval $(call gb_Module_Module,filter)) $(eval $(call gb_Module_add_targets,filter,\ Configuration_filter \ CustomTarget_svg \ - Library_gie \ Library_filterconfig \ Library_icg \ Library_msfilter \ diff --git a/filter/source/config/fragments/internalgraphicfilters/gif_Export.xcu b/filter/source/config/fragments/internalgraphicfilters/gif_Export.xcu index 7f021c1b9a7f..f55d1ba55385 100644 --- a/filter/source/config/fragments/internalgraphicfilters/gif_Export.xcu +++ b/filter/source/config/fragments/internalgraphicfilters/gif_Export.xcu @@ -15,13 +15,14 @@ * 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="gif_Export" oor:op="replace" > - <prop oor:name="Type"><value>gif_Graphics_Interchange</value></prop> - <prop oor:name="FormatName"><value>egi</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">GIF - Graphics Interchange Format</value> - </prop> - <prop oor:name="Flags"><value>EXPORT</value></prop> - </node> + +<node oor:name="gif_Export" oor:op="replace" > + <prop oor:name="Type"><value>gif_Graphics_Interchange</value></prop> + <prop oor:name="FormatName"><value>SVEGIF</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">GIF - Graphics Interchange Format</value> + </prop> + <prop oor:name="Flags"><value>EXPORT</value></prop> +</node> diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx index a116a5085619..b9de5bb85de5 100644 --- a/include/vcl/graphicfilter.hxx +++ b/include/vcl/graphicfilter.hxx @@ -100,6 +100,7 @@ namespace o3tl #define EXP_PNG "SVEPNG" #define EXP_TIFF "SVTIFF" #define EXP_EPS "SVEEPS" +#define EXP_GIF "SVEGIF" #define BMP_SHORTNAME u"BMP" diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 4b3e68b22373..bb574d63a478 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -3923,9 +3923,6 @@ filter/source/config/cache/typedetection.cxx filter/source/config/cache/typedetection.hxx filter/source/graphic/GraphicExportFilter.cxx filter/source/graphic/GraphicExportFilter.hxx -filter/source/graphicfilter/egif/egif.cxx -filter/source/graphicfilter/egif/giflzwc.cxx -filter/source/graphicfilter/egif/giflzwc.hxx filter/source/graphicfilter/icgm/actimpr.cxx filter/source/graphicfilter/icgm/bitmap.cxx filter/source/graphicfilter/icgm/bitmap.hxx @@ -14905,6 +14902,9 @@ vcl/source/filter/FilterConfigCache.hxx vcl/source/filter/FilterConfigItem.cxx vcl/source/filter/graphicfilter.cxx vcl/source/filter/graphicfilter2.cxx +vcl/source/filter/egif/egif.cxx +vcl/source/filter/egif/giflzwc.cxx +vcl/source/filter/egif/giflzwc.hxx vcl/source/filter/eps/eps.cxx vcl/source/filter/etiff/etiff.cxx vcl/source/filter/idxf/dxf2mtf.cxx diff --git a/sw/CppunitTest_sw_ooxmlexport5.mk b/sw/CppunitTest_sw_ooxmlexport5.mk index 408ea3e79ad8..71eea4a09b69 100644 --- a/sw/CppunitTest_sw_ooxmlexport5.mk +++ b/sw/CppunitTest_sw_ooxmlexport5.mk @@ -11,10 +11,6 @@ $(eval $(call sw_ooxmlexport_test,5)) -$(eval $(call gb_CppunitTest_use_libraries,sw_ooxmlexport5, \ - gie \ -)) - $(eval $(call gb_CppunitTest_use_uiconfigs,sw_ooxmlexport5, \ svt \ svx \ diff --git a/sw/CppunitTest_sw_ooxmlimport2.mk b/sw/CppunitTest_sw_ooxmlimport2.mk index 97fc1e7b1e6d..a7e718147b97 100644 --- a/sw/CppunitTest_sw_ooxmlimport2.mk +++ b/sw/CppunitTest_sw_ooxmlimport2.mk @@ -74,8 +74,4 @@ $(eval $(call gb_CppunitTest_use_rdb,sw_ooxmlimport2,services)) $(eval $(call gb_CppunitTest_use_configuration,sw_ooxmlimport2)) -# At least testTdf115094::Import (sw/qa/extras/ooxmlimport/ooxmlimport2.cxx) depends on TIFFReader -# from Library_gie, which is loaded dynamically in vcl/source/filter/graphicfilter.cxx: -$(call gb_CppunitTest_get_target,sw_ooxmlimport2): $(call gb_Library_get_target,gie) - # vim: set noet sw=4 ts=4: diff --git a/sw/CppunitTest_sw_ww8export2.mk b/sw/CppunitTest_sw_ww8export2.mk index 3737da6e8df7..0011658418f9 100644 --- a/sw/CppunitTest_sw_ww8export2.mk +++ b/sw/CppunitTest_sw_ww8export2.mk @@ -59,10 +59,6 @@ $(eval $(call gb_CppunitTest_use_rdb,sw_ww8export2,services)) $(eval $(call gb_CppunitTest_use_configuration,sw_ww8export2)) -# At least testTdf118133::Import_Export_Import (sw/qa/extras/ww8export/ww8export2.cxx) depends on -# TIFFReader from Library_gie, which is loaded dynamically in vcl/source/filter/graphicfilter.cxx: -$(call gb_CppunitTest_get_target,sw_ww8export2): $(call gb_Library_get_target,gie) - ifeq ($(OS),WNT) # gpgme-w32spawn.exe is needed in workdir/LinkTarget/Executable $(eval $(call gb_CppunitTest_use_packages,sw_ww8export2,\ diff --git a/vcl/CppunitTest_vcl_graphic_test.mk b/vcl/CppunitTest_vcl_graphic_test.mk index 9221fd474fdd..901714eb820f 100644 --- a/vcl/CppunitTest_vcl_graphic_test.mk +++ b/vcl/CppunitTest_vcl_graphic_test.mk @@ -53,7 +53,4 @@ $(eval $(call gb_CppunitTest_use_vcl,vcl_graphic_test)) $(eval $(call gb_CppunitTest_use_rdb,vcl_graphic_test,services)) $(eval $(call gb_CppunitTest_use_configuration,vcl_graphic_test)) -# we need to explicitly depend on Library_gie because it's dynamically loaded for .gif -$(call gb_CppunitTest_get_target,vcl_graphic_test) : $(call gb_Library_get_target,gie) - # vim: set noet sw=4 ts=4: diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 696112f34b03..10a4ef7ad48d 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -427,6 +427,8 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/components/dtranscomp \ vcl/source/components/factory \ vcl/source/components/fontident \ + vcl/source/filter/egif/egif \ + vcl/source/filter/egif/giflzwc \ vcl/source/filter/eps/eps \ vcl/source/filter/etiff/etiff \ vcl/source/filter/FilterConfigCache \ diff --git a/vcl/commonfuzzer.mk b/vcl/commonfuzzer.mk index 136c7759d1f1..bcabe85ce26c 100644 --- a/vcl/commonfuzzer.mk +++ b/vcl/commonfuzzer.mk @@ -98,7 +98,6 @@ fuzzer_core_libraries = \ chartcontroller \ chartcore \ sm \ - gie \ oox \ proxyfac \ reflection \ diff --git a/vcl/inc/filter/GifWriter.hxx b/vcl/inc/filter/GifWriter.hxx new file mode 100644 index 000000000000..6512c4bf6f2f --- /dev/null +++ b/vcl/inc/filter/GifWriter.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> +#include <vcl/FilterConfigItem.hxx> + +VCL_DLLPUBLIC bool ExportGifGraphic(SvStream& rStream, Graphic& rGraphic, + FilterConfigItem* pFilterConfigItem); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index d8ab4d44e0a8..411d44a5801d 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -41,10 +41,11 @@ using namespace ::com::sun::star::configuration ; const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] = { - IMP_BMP, IMP_GIF, IMP_PNG, IMP_JPEG, IMP_XBM, IMP_XPM, - EXP_BMP, EXP_JPEG, EXP_PNG, IMP_MOV, IMP_TIFF, EXP_TIFF, - IMP_TGA, IMP_PICT, IMP_MET, IMP_RAS, IMP_PCX, IMP_PSD, - IMP_PCD, IMP_PBM, IMP_DXF, nullptr + IMP_BMP, IMP_GIF, IMP_PNG, IMP_JPEG, IMP_TIFF, + IMP_XBM, IMP_XPM, IMP_TGA, IMP_PICT, IMP_MET, IMP_RAS, + IMP_PCX, IMP_MOV, IMP_PSD, IMP_PCD, IMP_PBM, IMP_DXF, + EXP_BMP, EXP_GIF, EXP_PNG, EXP_JPEG, EXP_TIFF, + nullptr }; const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] = @@ -56,7 +57,7 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] = { - "egi", "epb", "epg", "epp", nullptr + nullptr }; void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry ) @@ -225,7 +226,7 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] = "eps","1","SVIEPS", "eps","2","SVEEPS", "gif","1","SVIGIF", - "gif","2","egi", + "gif","2","SVEGIF", "jpg","1","SVIJPEG", "jpg","2","SVEJPEG", "mov","1","SVMOV", diff --git a/filter/source/graphicfilter/egif/egif.cxx b/vcl/source/filter/egif/egif.cxx index 7a70d337e6c5..bfd41d952b4c 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/vcl/source/filter/egif/egif.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/task/XStatusIndicator.hpp> #include "giflzwc.hxx" #include <memory> +#include <filter/GifWriter.hxx> namespace { @@ -539,8 +540,7 @@ void GIFWriter::WriteTerminator() } -extern "C" SAL_DLLPUBLIC_EXPORT bool -egiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem ) +bool ExportGifGraphic(SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem) { GIFWriter aWriter(rStream); return aWriter.WriteGIF(rGraphic, pConfigItem); diff --git a/filter/source/graphicfilter/egif/giflzwc.cxx b/vcl/source/filter/egif/giflzwc.cxx index 41c65d2da4c2..41c65d2da4c2 100644 --- a/filter/source/graphicfilter/egif/giflzwc.cxx +++ b/vcl/source/filter/egif/giflzwc.cxx diff --git a/filter/source/graphicfilter/egif/giflzwc.hxx b/vcl/source/filter/egif/giflzwc.hxx index 057710c85230..057710c85230 100644 --- a/filter/source/graphicfilter/egif/giflzwc.hxx +++ b/vcl/source/filter/egif/giflzwc.hxx diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index b6cf71d078f6..6b6408076e80 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -60,6 +60,7 @@ #include <filter/PcdReader.hxx> #include <filter/PbmReader.hxx> #include <filter/DxfReader.hxx> +#include <filter/GifWriter.hxx> #include <osl/module.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/awt/Size.hpp> @@ -1950,12 +1951,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const INetURLObje return nRetValue; } -#ifdef DISABLE_DYNLOADING - -extern "C" bool egiGraphicExport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem ); - -#endif - ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& rPath, SvStream& rOStm, sal_uInt16 nFormat, const css::uno::Sequence< css::beans::PropertyValue >* pFilterData ) { @@ -1983,7 +1978,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r FilterConfigItem aConfigItem( pFilterData ); OUString aFilterName( pConfig->GetExportFilterName( nFormat ) ); - OUString aExternalFilterName(pConfig->GetExternalFilterName(nFormat, true)); ErrCode nStatus = ERRCODE_NONE; GraphicType eType; Graphic aGraphic = ImpGetScaledGraphic( rGraphic, aConfigItem ); @@ -2045,7 +2039,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r if( rOStm.GetError() ) nStatus = ERRCODE_GRFILTER_IOERROR; } - if (aFilterName.equalsIgnoreAsciiCase(EXP_TIFF)) + else if (aFilterName.equalsIgnoreAsciiCase(EXP_TIFF)) { if (!ExportTiffGraphicImport(rOStm, aGraphic, &aConfigItem)) nStatus = ERRCODE_GRFILTER_FORMATERROR; @@ -2053,6 +2047,14 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r if( rOStm.GetError() ) nStatus = ERRCODE_GRFILTER_IOERROR; } + else if (aFilterName.equalsIgnoreAsciiCase(EXP_GIF)) + { + if (!ExportGifGraphic(rOStm, aGraphic, &aConfigItem)) + nStatus = ERRCODE_GRFILTER_FORMATERROR; + + if( rOStm.GetError() ) + nStatus = ERRCODE_GRFILTER_IOERROR; + } else if( aFilterName.equalsIgnoreAsciiCase( EXP_SVMETAFILE ) ) { sal_Int32 nVersion = aConfigItem.ReadInt32( "Version", 0 ) ; @@ -2278,35 +2280,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r else nStatus = ERRCODE_GRFILTER_FILTERERROR; } - else - { - sal_Int32 nIdx {aFilterPath.isEmpty() ? -1 : 0}; - while (nIdx>=0) - { -#ifndef DISABLE_DYNLOADING - OUString aPhysicalName( ImpCreateFullFilterPath( aFilterPath.getToken(0, ';', nIdx), aFilterName ) ); - osl::Module aLibrary( aPhysicalName ); - - PFilterCall pFunc = nullptr; - if (aExternalFilterName == "egi") - pFunc = reinterpret_cast<PFilterCall>(aLibrary.getFunctionSymbol("egiGraphicExport")); - // Execute dialog in DLL - #else - --nIdx; // Just one iteration - PFilterCall pFunc = NULL; - if (aExternalFilterName == "egi") - pFunc = egiGraphicExport; - #endif - if( pFunc ) - { - if ( !(*pFunc)( rOStm, aGraphic, &aConfigItem ) ) - nStatus = ERRCODE_GRFILTER_FORMATERROR; - break; - } - else - nStatus = ERRCODE_GRFILTER_FILTERERROR; - } - } } if( nStatus != ERRCODE_NONE ) { |