[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - filter/CppunitTest_filter_pcd_test.mk filter/Library_gie.mk filter/Module_filter.mk filter/qa filter/source include/vcl solenv/clang-format vcl/CppunitTest_vcl_filters_test.mk vcl/inc vcl/Library_vcl.mk vcl/qa vcl/source vcl/workben

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 15 01:24:25 UTC 2021


 filter/CppunitTest_filter_pcd_test.mk                                       |   38 --------
 filter/Library_gie.mk                                                       |    1 
 filter/Module_filter.mk                                                     |    1 
 filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.xcu   |   21 ++--
 filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.xcu |   21 ++--
 filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.xcu  |   21 ++--
 include/vcl/graphicfilter.hxx                                               |    2 
 solenv/clang-format/excludelist                                             |    4 
 vcl/CppunitTest_vcl_filters_test.mk                                         |    1 
 vcl/Library_vcl.mk                                                          |    1 
 vcl/inc/filter/PcdReader.hxx                                                |   28 ++++++
 vcl/qa/cppunit/graphicfilter/filters-pcd-test.cxx                           |   18 +---
 vcl/source/filter/FilterConfigCache.cxx                                     |    7 -
 vcl/source/filter/graphicfilter.cxx                                         |   44 +++++-----
 vcl/source/filter/ipcd/ipcd.cxx                                             |    4 
 vcl/workben/fftester.cxx                                                    |   12 --
 vcl/workben/pcdfuzzer.cxx                                                   |    5 -
 17 files changed, 107 insertions(+), 122 deletions(-)

New commits:
commit c4f8bd737e2014c69b8bc0f85fae8fdc36a8a1b7
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Feb 15 10:23:27 2021 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Feb 15 10:23:27 2021 +0900

    Move PCD reader from filter module into VCL
    
    Change-Id: Icd23d1343f5231c09dd8197943ca472f4b573bfc

diff --git a/filter/CppunitTest_filter_pcd_test.mk b/filter/CppunitTest_filter_pcd_test.mk
deleted file mode 100644
index 3741d5c9bf5a..000000000000
--- a/filter/CppunitTest_filter_pcd_test.mk
+++ /dev/null
@@ -1,38 +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/.
-#
-
-$(eval $(call gb_CppunitTest_CppunitTest,filter_pcd_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_pcd_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_pcd_test, \
-    filter/qa/cppunit/filters-pcd-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_pcd_test, \
-    gie \
-	sal \
-	test \
-	tl \
-	unotest \
-	vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_pcd_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_pcd_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_pcd_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_pcd_test,\
-    configmgr/source/configmgr \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_pcd_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index 29e7b131fae4..d5ab8b8169a5 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -60,7 +60,6 @@ $(eval $(call gb_Library_add_exception_objects,gie,\
     filter/source/graphicfilter/idxf/dxftblrd \
     filter/source/graphicfilter/idxf/dxfvec \
     filter/source/graphicfilter/idxf/idxf \
-    filter/source/graphicfilter/ipcd/ipcd \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 82eade49ffa1..678c882dce88 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Module_add_check_targets,filter,\
 ifneq ($(DISABLE_CVE_TESTS),TRUE)
 $(eval $(call gb_Module_add_check_targets,filter,\
     CppunitTest_filter_dxf_test \
-    CppunitTest_filter_pcd_test \
     CppunitTest_filter_ppm_test \
     CppunitTest_filter_svg \
 ))
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.xcu b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.xcu
index c5a0094b86e4..29c7b846ddae 100644
--- a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base.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="pcd_Import_Base" oor:op="replace"  >
-        <prop oor:name="Type"><value>pcd_Photo_CD_Base</value></prop>
-        <prop oor:name="FormatName"><value>icd</value></prop>
-        <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PCD - Kodak Photo CD (768x512)</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="pcd_Import_Base" oor:op="replace"  >
+    <prop oor:name="Type"><value>pcd_Photo_CD_Base</value></prop>
+    <prop oor:name="FormatName"><value>SVPCD</value></prop>
+    <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PCD - Kodak Photo CD (768x512)</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.xcu b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.xcu
index 27a471a2c75f..b61fde810697 100644
--- a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base16.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="pcd_Import_Base16" oor:op="replace"  >
-        <prop oor:name="Type"><value>pcd_Photo_CD_Base16</value></prop>
-        <prop oor:name="FormatName"><value>icd</value></prop>
-        <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base16</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PCD - Kodak Photo CD (192x128)</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="pcd_Import_Base16" oor:op="replace"  >
+    <prop oor:name="Type"><value>pcd_Photo_CD_Base16</value></prop>
+    <prop oor:name="FormatName"><value>SVPCD</value></prop>
+    <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base16</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PCD - Kodak Photo CD (192x128)</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.xcu b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.xcu
index ba5f536b9a45..15d51918a09b 100644
--- a/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/pcd_Import_Base4.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="pcd_Import_Base4" oor:op="replace"  >
-        <prop oor:name="Type"><value>pcd_Photo_CD_Base4</value></prop>
-        <prop oor:name="FormatName"><value>icd</value></prop>
-        <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base4</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PCD - Kodak Photo CD (384x256)</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="pcd_Import_Base4" oor:op="replace"  >
+    <prop oor:name="Type"><value>pcd_Photo_CD_Base4</value></prop>
+    <prop oor:name="FormatName"><value>SVPCD</value></prop>
+    <prop oor:name="RealFilterName"><value>draw_PCD_Photo_CD_Base4</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PCD - Kodak Photo CD (384x256)</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 67d3beafe592..478e1c00a47a 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -85,6 +85,7 @@ namespace o3tl
 #define IMP_PCX                 "SVPCX"
 #define IMP_EPS                 "SVIEPS"
 #define IMP_PSD                 "SVPSD"
+#define IMP_PCD                 "SVPCD"
 #define EXP_BMP                 "SVBMP"
 #define EXP_SVMETAFILE          "SVMETAFILE"
 #define EXP_WMF                 "SVWMF"
@@ -360,6 +361,7 @@ public:
     ErrCode readPCX(SvStream & rStream, Graphic & rGraphic);
     ErrCode readEPS(SvStream & rStream, Graphic & rGraphic);
     ErrCode readPSD(SvStream & rStream, Graphic & rGraphic);
+    ErrCode readPCD(SvStream & rStream, Graphic & rGraphic);
 
 private:
     OUString        aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index ad2fd2c6c8be..b7118132d5c2 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3891,7 +3891,6 @@ external/unixODBC/inc/odbc/sqltypes.h
 external/unixODBC/inc/odbc/sqlucode.h
 filter/inc/strings.hxx
 filter/qa/cppunit/filters-dxf-test.cxx
-filter/qa/cppunit/filters-pcd-test.cxx
 filter/qa/cppunit/filters-ppm-test.cxx
 filter/qa/cppunit/msfilter-test.cxx
 filter/qa/cppunit/priority-test.cxx
@@ -3959,7 +3958,6 @@ filter/source/graphicfilter/idxf/dxfvec.cxx
 filter/source/graphicfilter/idxf/dxfvec.hxx
 filter/source/graphicfilter/idxf/idxf.cxx
 filter/source/graphicfilter/ipbm/ipbm.cxx
-filter/source/graphicfilter/ipcd/ipcd.cxx
 filter/source/msfilter/countryid.cxx
 filter/source/msfilter/dffpropset.cxx
 filter/source/msfilter/escherex.cxx
@@ -14809,6 +14807,7 @@ vcl/qa/cppunit/font.cxx
 vcl/qa/cppunit/fontmetric.cxx
 vcl/qa/cppunit/graphicfilter/filters-eps-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-pcd-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-psd-test.cxx
@@ -14926,6 +14925,7 @@ vcl/source/filter/igif/decode.cxx
 vcl/source/filter/igif/decode.hxx
 vcl/source/filter/igif/gifread.cxx
 vcl/source/filter/imet/ios2met.cxx
+vcl/source/filter/ipcd/ipcd.cxx
 vcl/source/filter/ipcx/ipcx.cxx
 vcl/source/filter/ipict/ipict.cxx
 vcl/source/filter/ipsd/ipsd.cxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index a62e3b109927..8ebc4c7c1ae0 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_CppunitTest_CppunitTest,vcl_filters_test))
 $(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
     vcl/qa/cppunit/graphicfilter/filters-eps-test \
     vcl/qa/cppunit/graphicfilter/filters-met-test \
+    vcl/qa/cppunit/graphicfilter/filters-pcd-test \
     vcl/qa/cppunit/graphicfilter/filters-pcx-test \
     vcl/qa/cppunit/graphicfilter/filters-pict-test \
     vcl/qa/cppunit/graphicfilter/filters-psd-test \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 6d73b8850f55..34b7f0697436 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -440,6 +440,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/filter/igif/decode \
     vcl/source/filter/igif/gifread \
     vcl/source/filter/imet/ios2met \
+    vcl/source/filter/ipcd/ipcd \
     vcl/source/filter/ipcx/ipcx \
     vcl/source/filter/ipict/ipict \
     vcl/source/filter/ipsd/ipsd \
diff --git a/vcl/inc/filter/PcdReader.hxx b/vcl/inc/filter/PcdReader.hxx
new file mode 100644
index 000000000000..216a14b89040
--- /dev/null
+++ b/vcl/inc/filter/PcdReader.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 ImportPcdGraphic(SvStream& rStream, Graphic& rGraphic,
+                                    FilterConfigItem* pFilterConfigItem);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/pcd/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcd/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcd/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcd/fail/.gitignore
diff --git a/filter/qa/cppunit/data/pcd/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcd/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcd/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcd/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/pcd/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcd/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcd/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcd/pass/.gitignore
diff --git a/filter/qa/cppunit/data/pcd/pass/blank-square.pcd b/vcl/qa/cppunit/graphicfilter/data/pcd/pass/blank-square.pcd
similarity index 100%
rename from filter/qa/cppunit/data/pcd/pass/blank-square.pcd
rename to vcl/qa/cppunit/graphicfilter/data/pcd/pass/blank-square.pcd
diff --git a/filter/qa/cppunit/filters-pcd-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-pcd-test.cxx
similarity index 80%
rename from filter/qa/cppunit/filters-pcd-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-pcd-test.cxx
index dc32e33469e7..bd100c8f2090 100644
--- a/filter/qa/cppunit/filters-pcd-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-pcd-test.cxx
@@ -12,15 +12,9 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
+#include <filter/PcdReader.hxx>
 
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        icdGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
-
-using namespace ::com::sun::star;
+using namespace css;
 
 /* Implementation of Filters test */
 
@@ -51,17 +45,17 @@ bool PcdFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return icdGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportPcdGraphic(aFileStream, aGraphic, nullptr);
 }
 
 void PcdFilterTest::testCVEs()
 {
+#ifndef DISABLE_CVE_TESTS
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/pcd/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/pcd/"));
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(PcdFilterTest);
 
-CPPUNIT_PLUGIN_IMPLEMENT();
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx
index e3752a24a7c6..9e5a1a236955 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -43,7 +43,8 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameLi
 {
     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, nullptr
+    IMP_TGA, IMP_PICT, IMP_MET, IMP_RAS, IMP_PCX, IMP_PSD,
+    IMP_PCD, nullptr
 };
 
 const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -55,7 +56,7 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL
 
 const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
 {
-    "egi", "icd", "ipb", "epb", "epg",
+    "egi", "ipb", "epb", "epg",
     "epp", nullptr
 };
 
@@ -234,7 +235,7 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
     "png","1","SVIPNG",
     "png","2","SVEPNG",
     "pct","1","SVPICT",
-    "pcd","1","icd",
+    "pcd","1","SVPCD",
     "psd","1","SVPSD",
     "pcx","1","SVPCX",
     "pbm","1","ipb",
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 5ebff94f173c..4d567e43565a 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -57,6 +57,7 @@
 #include <filter/EpsReader.hxx>
 #include <filter/EpsWriter.hxx>
 #include <filter/PsdReader.hxx>
+#include <filter/PcdReader.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/awt/Size.hpp>
@@ -647,7 +648,6 @@ ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const
 
 #ifdef DISABLE_DYNLOADING
 
-extern "C" bool icdGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool idxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipbGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 
@@ -658,16 +658,12 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
     if( !mpfnImport )
     {
 #ifndef DISABLE_DYNLOADING
-        if (maFormatName == "icd")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("icdGraphicImport"));
-        else if (maFormatName == "idx")
+        if (maFormatName == "idx")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("idxGraphicImport"));
         else if (maFormatName == "ipb")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipbGraphicImport"));
  #else
-        if (maFormatName ==  "icd")
-            mpfnImport = icdGraphicImport;
-        else if (maFormatName ==  "idx")
+        if (maFormatName ==  "idx")
             mpfnImport = idxGraphicImport;
         else if (maFormatName ==  "ipb")
             mpfnImport = ipbGraphicImport;
@@ -1405,7 +1401,7 @@ void GraphicFilter::preload()
     sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFilterPath, ';');
     ImpFilterLibCache& rCache = Cache::get();
     static const std::initializer_list<std::u16string_view> aFilterNames = {
-        u"icd", u"idx", u"ipb", u"ipd"
+        u"idx", u"ipb", u"ipd"
     };
 
     // Load library for each filter.
@@ -1751,6 +1747,21 @@ ErrCode GraphicFilter::readPSD(SvStream & rStream, Graphic & rGraphic)
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
+ErrCode GraphicFilter::readPCD(SvStream & rStream, Graphic & rGraphic)
+{
+    std::unique_ptr<FilterConfigItem> pFilterConfigItem;
+    if (!utl::ConfigManager::IsFuzzing())
+    {
+        OUString aFilterConfigPath( "Office.Common/Filter/Graphic/Import/PCD" );
+        pFilterConfigItem = std::make_unique<FilterConfigItem>(aFilterConfigPath);
+    }
+
+    if (ImportPcdGraphic(rStream, rGraphic, pFilterConfigItem.get()))
+        return ERRCODE_NONE;
+    else
+        return ERRCODE_GRFILTER_FILTERERROR;
+}
+
 ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath, SvStream& rIStream,
                                      sal_uInt16 nFormat, sal_uInt16* pDeterminedFormat, GraphicFilterImportFlags nImportFlags,
                                      const css::uno::Sequence< css::beans::PropertyValue >* /*pFilterData*/,
@@ -1892,6 +1903,10 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
         {
             nStatus = readPSD(rIStream, rGraphic);
         }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_PCD))
+        {
+            nStatus = readPCD(rIStream, rGraphic);
+        }
         else
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
@@ -1919,18 +1934,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
                 nStatus = ERRCODE_GRFILTER_FILTERERROR;
             else
             {
-                std::unique_ptr<FilterConfigItem> pFilterConfigItem;
-                OUString aShortName;
-                if( nFormat != GRFILTER_FORMAT_DONTKNOW )
-                {
-                    aShortName = GetImportFormatShortName( nFormat ).toAsciiUpperCase();
-                    if (aShortName == "PCD" && !utl::ConfigManager::IsFuzzing())
-                    {
-                        OUString aFilterConfigPath( "Office.Common/Filter/Graphic/Import/PCD" );
-                        pFilterConfigItem = std::make_unique<FilterConfigItem>( aFilterConfigPath );
-                    }
-                }
-                if( !(*pFunc)( rIStream, rGraphic, pFilterConfigItem.get() ) )
+                if( !(*pFunc)( rIStream, rGraphic, nullptr ) )
                     nStatus = ERRCODE_GRFILTER_FORMATERROR;
             }
         }
diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/vcl/source/filter/ipcd/ipcd.cxx
similarity index 98%
rename from filter/source/graphicfilter/ipcd/ipcd.cxx
rename to vcl/source/filter/ipcd/ipcd.cxx
index b2b585606286..5072e2ab4354 100644
--- a/filter/source/graphicfilter/ipcd/ipcd.cxx
+++ b/vcl/source/filter/ipcd/ipcd.cxx
@@ -22,6 +22,7 @@
 #include <vcl/BitmapTools.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
+#include <filter/PcdReader.hxx>
 
 //============================ PCDReader ==================================
 
@@ -353,8 +354,7 @@ void PCDReader::ReadImage()
 
 //================== GraphicImport - the exported Function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-icdGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pConfigItem )
+bool ImportPcdGraphic(SvStream & rStream, Graphic & rGraphic, FilterConfigItem* pConfigItem)
 {
     PCDReader aPCDReader(rStream);
     return aPCDReader.ReadPCD(rGraphic, pConfigItem);
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index fe030475e3f8..02dc6d90eb21 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -50,6 +50,7 @@
 #include <filter/PcxReader.hxx>
 #include <filter/EpsReader.hxx>
 #include <filter/PsdReader.hxx>
+#include <filter/PcdReader.hxx>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
 #include <tools/stream.hxx>
@@ -166,18 +167,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
 #ifndef DISABLE_DYNLOADING
         else if (strcmp(argv[2], "pcd") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("icdGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportPcdGraphic(aFileStream, aGraphic, nullptr));
         }
         else if (strcmp(argv[2], "dxf") == 0)
         {
diff --git a/vcl/workben/pcdfuzzer.cxx b/vcl/workben/pcdfuzzer.cxx
index ccd0367535be..86df131da1cc 100644
--- a/vcl/workben/pcdfuzzer.cxx
+++ b/vcl/workben/pcdfuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/PcdReader.hxx>
 
 #include <config_features.h>
 #include <osl/detail/component-mapping.h>
@@ -39,8 +40,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
     return nullptr;
 }
 
-extern "C" bool icdGraphicImport(SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem);
-
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
     TypicalFuzzerInitialize(argc, argv);
@@ -51,7 +50,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
 {
     SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
     Graphic aGraphic;
-    (void)icdGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportPcdGraphic(aStream, aGraphic, nullptr);
     return 0;
 }
 


More information about the Libreoffice-commits mailing list