[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 4 commits - filter/CppunitTest_filter_met_test.mk filter/CppunitTest_filter_pict_test.mk filter/CppunitTest_filter_tga_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
Sun Feb 14 14:28:50 UTC 2021


 filter/CppunitTest_filter_met_test.mk                                |   39 ---
 filter/CppunitTest_filter_pict_test.mk                               |   50 ----
 filter/CppunitTest_filter_tga_test.mk                                |   38 ---
 filter/Library_gie.mk                                                |    6 
 filter/Module_filter.mk                                              |    5 
 filter/source/config/fragments/internalgraphicfilters/met_Import.xcu |   21 -
 filter/source/config/fragments/internalgraphicfilters/pct_Import.xcu |   21 -
 filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu |   21 -
 filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu |   21 -
 filter/source/config/fragments/internalgraphicfilters/tga_Import.xcu |   21 -
 filter/source/graphicfilter/ipict/ipict.hxx                          |   26 --
 include/vcl/graphicfilter.hxx                                        |   10 
 solenv/clang-format/excludelist                                      |   24 -
 vcl/CppunitTest_vcl_filters_test.mk                                  |   10 
 vcl/Library_vcl.mk                                                   |    6 
 vcl/inc/filter/MetReader.hxx                                         |   26 ++
 vcl/inc/filter/PcxReader.hxx                                         |   26 ++
 vcl/inc/filter/PictReader.hxx                                        |   33 ++
 vcl/inc/filter/RasReader.hxx                                         |   26 ++
 vcl/inc/filter/TgaReader.hxx                                         |   26 ++
 vcl/qa/cppunit/graphicfilter/filters-met-test.cxx                    |   16 -
 vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx                    |   16 -
 vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx                   |   22 -
 vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx                    |   16 -
 vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx                    |   17 -
 vcl/source/filter/FilterConfigCache.cxx                              |   17 -
 vcl/source/filter/graphicfilter.cxx                                  |  124 ++++++----
 vcl/source/filter/imet/ios2met.cxx                                   |    4 
 vcl/source/filter/ipcx/ipcx.cxx                                      |    4 
 vcl/source/filter/ipict/ipict.cxx                                    |   12 
 vcl/source/filter/iras/iras.cxx                                      |    4 
 vcl/source/filter/itga/itga.cxx                                      |    4 
 vcl/workben/fftester.cxx                                             |   60 ----
 vcl/workben/metfuzzer.cxx                                            |    5 
 vcl/workben/pctfuzzer.cxx                                            |    5 
 vcl/workben/pcxfuzzer.cxx                                            |    5 
 vcl/workben/rasfuzzer.cxx                                            |    5 
 vcl/workben/tgafuzzer.cxx                                            |    5 
 38 files changed, 372 insertions(+), 425 deletions(-)

New commits:
commit 8f3ec38dfe52c51de4188bbc73d8afbff4e8a5eb
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Feb 14 23:20:28 2021 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sun Feb 14 23:20:28 2021 +0900

    Move RAS and PCX reader from filter module into VCL
    
    Change-Id: Id846abf257b598489a59ebf9b62b19840a950322

diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index 73120a524ac3..54a1e1fb00db 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -52,8 +52,6 @@ $(eval $(call gb_Library_add_exception_objects,gie,\
     filter/source/graphicfilter/egif/egif \
     filter/source/graphicfilter/eps/eps \
     filter/source/graphicfilter/egif/giflzwc \
-    filter/source/graphicfilter/ipcx/ipcx \
-    filter/source/graphicfilter/iras/iras \
     filter/source/graphicfilter/ieps/ieps \
     filter/source/graphicfilter/ipsd/ipsd \
     filter/source/graphicfilter/ipbm/ipbm \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 36ba307c12fb..548e6f27c690 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -58,10 +58,8 @@ $(eval $(call gb_Module_add_check_targets,filter,\
     CppunitTest_filter_dxf_test \
     CppunitTest_filter_eps_test \
     CppunitTest_filter_pcd_test \
-    CppunitTest_filter_pcx_test \
     CppunitTest_filter_ppm_test \
     CppunitTest_filter_psd_test \
-    CppunitTest_filter_ras_test \
     CppunitTest_filter_svg \
 ))
 endif
diff --git a/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu
index 4f8eb67340e4..da49344d4e60 100644
--- a/filter/source/config/fragments/internalgraphicfilters/pcx_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/pcx_Import.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="pcx_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>pcx_Zsoft_Paintbrush</value></prop>
-        <prop oor:name="FormatName"><value>ipx</value></prop>
-        <prop oor:name="RealFilterName"><value>PCX - Zsoft Paintbrush</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PCX - Zsoft Paintbrush</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="pcx_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>pcx_Zsoft_Paintbrush</value></prop>
+    <prop oor:name="FormatName"><value>SVPCX</value></prop>
+    <prop oor:name="RealFilterName"><value>PCX - Zsoft Paintbrush</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PCX - Zsoft Paintbrush</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu
index 95108022b03a..7e9a3b2bbc07 100644
--- a/filter/source/config/fragments/internalgraphicfilters/ras_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/ras_Import.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="ras_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
-        <prop oor:name="FormatName"><value>ira</value></prop>
-        <prop oor:name="RealFilterName"><value>RAS - Sun Rasterfile</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">RAS - Sun Raster Image</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="ras_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>ras_Sun_Rasterfile</value></prop>
+    <prop oor:name="FormatName"><value>SVRAS</value></prop>
+    <prop oor:name="RealFilterName"><value>RAS - Sun Rasterfile</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">RAS - Sun Raster Image</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index ee233ec33d38..27855d9ab752 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -81,6 +81,8 @@ namespace o3tl
 #define IMP_TGA                 "SVTGA"
 #define IMP_PICT                "SVPICT"
 #define IMP_MET                 "SVMET"
+#define IMP_RAS                 "SVRAS"
+#define IMP_PCX                 "SVPCX"
 #define EXP_BMP                 "SVBMP"
 #define EXP_SVMETAFILE          "SVMETAFILE"
 #define EXP_WMF                 "SVWMF"
@@ -351,6 +353,8 @@ public:
     ErrCode readTGA(SvStream & rStream, Graphic & rGraphic);
     ErrCode readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
     ErrCode readMET(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+    ErrCode readRAS(SvStream & rStream, Graphic & rGraphic);
+    ErrCode readPCX(SvStream & rStream, Graphic & rGraphic);
 
 private:
     OUString        aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 26e85a04bb64..25582176f3ed 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3893,10 +3893,8 @@ filter/inc/strings.hxx
 filter/qa/cppunit/filters-dxf-test.cxx
 filter/qa/cppunit/filters-eps-test.cxx
 filter/qa/cppunit/filters-pcd-test.cxx
-filter/qa/cppunit/filters-pcx-test.cxx
 filter/qa/cppunit/filters-ppm-test.cxx
 filter/qa/cppunit/filters-psd-test.cxx
-filter/qa/cppunit/filters-ras-test.cxx
 filter/qa/cppunit/msfilter-test.cxx
 filter/qa/cppunit/priority-test.cxx
 filter/qa/cppunit/xslt-test.cxx
@@ -3966,9 +3964,7 @@ filter/source/graphicfilter/idxf/idxf.cxx
 filter/source/graphicfilter/ieps/ieps.cxx
 filter/source/graphicfilter/ipbm/ipbm.cxx
 filter/source/graphicfilter/ipcd/ipcd.cxx
-filter/source/graphicfilter/ipcx/ipcx.cxx
 filter/source/graphicfilter/ipsd/ipsd.cxx
-filter/source/graphicfilter/iras/iras.cxx
 filter/source/msfilter/countryid.cxx
 filter/source/msfilter/dffpropset.cxx
 filter/source/msfilter/escherex.cxx
@@ -14816,10 +14812,12 @@ vcl/qa/cppunit/dndtest.cxx
 vcl/qa/cppunit/errorhandler.cxx
 vcl/qa/cppunit/font.cxx
 vcl/qa/cppunit/fontmetric.cxx
+vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx
-vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
-vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
 vcl/qa/cppunit/lifecycle.cxx
 vcl/qa/cppunit/svm/svmtest.cxx
 vcl/qa/cppunit/timer.cxx
@@ -14929,9 +14927,11 @@ 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/ipcx/ipcx.cxx
 vcl/source/filter/ipict/ipict.cxx
 vcl/source/filter/ipict/shape.cxx
 vcl/source/filter/ipict/shape.hxx
+vcl/source/filter/iras/iras.cxx
 vcl/source/filter/ixbm/xbmread.cxx
 vcl/source/filter/ixpm/rgbtable.hxx
 vcl/source/filter/ixpm/xpmread.cxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index b643a2580791..87a5da8e9284 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -10,11 +10,13 @@
 $(eval $(call gb_CppunitTest_CppunitTest,vcl_filters_test))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
+    vcl/qa/cppunit/graphicfilter/filters-met-test \
+    vcl/qa/cppunit/graphicfilter/filters-pcx-test \
+    vcl/qa/cppunit/graphicfilter/filters-pict-test \
+    vcl/qa/cppunit/graphicfilter/filters-ras-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-pict-test \
-    vcl/qa/cppunit/graphicfilter/filters-met-test \
 ))
 
 $(eval $(call gb_CppunitTest_set_include,vcl_filters_test,\
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 1bfcb5999967..81dae94cf21f 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -438,10 +438,12 @@ $(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/ipcx/ipcx \
     vcl/source/filter/ipict/ipict \
     vcl/source/filter/ipict/shape \
     vcl/source/filter/ipdf/pdfread \
     vcl/source/filter/ipdf/pdfdocument \
+    vcl/source/filter/iras/iras \
     vcl/source/filter/itga/itga \
     vcl/source/filter/itiff/ccidecom \
     vcl/source/filter/itiff/itiff \
diff --git a/vcl/inc/filter/PcxReader.hxx b/vcl/inc/filter/PcxReader.hxx
new file mode 100644
index 000000000000..73e182c62895
--- /dev/null
+++ b/vcl/inc/filter/PcxReader.hxx
@@ -0,0 +1,26 @@
+/* -*- 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 ImportPcxGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/filter/RasReader.hxx b/vcl/inc/filter/RasReader.hxx
new file mode 100644
index 000000000000..ea658cb317c0
--- /dev/null
+++ b/vcl/inc/filter/RasReader.hxx
@@ -0,0 +1,26 @@
+/* -*- 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 ImportRasGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/pcx/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/.gitignore
diff --git a/filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-1.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-1.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-1.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-1.pcx
diff --git a/filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-2.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-2.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-2.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-2.pcx
diff --git a/filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-3.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-3.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/CVE-2007-3741-3.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2007-3741-3.pcx
diff --git a/filter/qa/cppunit/data/pcx/fail/CVE-2008-1097-1.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2008-1097-1.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/CVE-2008-1097-1.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/CVE-2008-1097-1.pcx
diff --git a/filter/qa/cppunit/data/pcx/fail/hang-1.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/fail/hang-1.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/fail/hang-1.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/fail/hang-1.pcx
diff --git a/filter/qa/cppunit/data/pcx/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcx/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcx/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcx/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/pcx/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pcx/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pcx/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pcx/pass/.gitignore
diff --git a/filter/qa/cppunit/data/pcx/pass/rhbz469075-1.pcx b/vcl/qa/cppunit/graphicfilter/data/pcx/pass/rhbz469075-1.pcx
similarity index 100%
rename from filter/qa/cppunit/data/pcx/pass/rhbz469075-1.pcx
rename to vcl/qa/cppunit/graphicfilter/data/pcx/pass/rhbz469075-1.pcx
diff --git a/filter/qa/cppunit/data/ras/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ras/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/.gitignore
diff --git a/filter/qa/cppunit/data/ras/fail/CVE-2007-2356-1.ras b/vcl/qa/cppunit/graphicfilter/data/ras/fail/CVE-2007-2356-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/CVE-2007-2356-1.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/CVE-2007-2356-1.ras
diff --git a/filter/qa/cppunit/data/ras/fail/CVE-2008-1097-1.ras b/vcl/qa/cppunit/graphicfilter/data/ras/fail/CVE-2008-1097-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/CVE-2008-1097-1.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/CVE-2008-1097-1.ras
diff --git a/filter/qa/cppunit/data/ras/fail/crash-1.ras b/vcl/qa/cppunit/graphicfilter/data/ras/fail/crash-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/crash-1.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/crash-1.ras
diff --git a/filter/qa/cppunit/data/ras/fail/hang-1.ras b/vcl/qa/cppunit/graphicfilter/data/ras/fail/hang-1.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/fail/hang-1.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/fail/hang-1.ras
diff --git a/filter/qa/cppunit/data/ras/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ras/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ras/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ras/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/ras/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ras/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ras/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ras/pass/.gitignore
diff --git a/filter/qa/cppunit/data/ras/pass/marbles.ras b/vcl/qa/cppunit/graphicfilter/data/ras/pass/marbles.ras
similarity index 100%
rename from filter/qa/cppunit/data/ras/pass/marbles.ras
rename to vcl/qa/cppunit/graphicfilter/data/ras/pass/marbles.ras
diff --git a/filter/qa/cppunit/filters-pcx-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
similarity index 80%
rename from filter/qa/cppunit/filters-pcx-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
index 3a28e24626fa..d070131e1974 100644
--- a/filter/qa/cppunit/filters-pcx-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
@@ -12,15 +12,9 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
+#include <filter/PcxReader.hxx>
 
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        ipxGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
-
-using namespace ::com::sun::star;
+using namespace css;
 
 /* Implementation of Filters test */
 
@@ -51,17 +45,15 @@ bool PcxFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return ipxGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportPcxGraphic(aFileStream, aGraphic);
 }
 
 void PcxFilterTest::testCVEs()
 {
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/pcx/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/pcx/"));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(PcxFilterTest);
 
-CPPUNIT_PLUGIN_IMPLEMENT();
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/filters-ras-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx
similarity index 80%
rename from filter/qa/cppunit/filters-ras-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx
index 2f3b678e4e0a..f7ab8f3e0c2a 100644
--- a/filter/qa/cppunit/filters-ras-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx
@@ -12,15 +12,9 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
+#include <filter/RasReader.hxx>
 
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        iraGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
-
-using namespace ::com::sun::star;
+using namespace css;
 
 /* Implementation of Filters test */
 
@@ -51,17 +45,15 @@ bool RasFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return iraGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportRasGraphic(aFileStream, aGraphic);
 }
 
 void RasFilterTest::testCVEs()
 {
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/ras/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/ras/"));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(RasFilterTest);
 
-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 a004e693641d..c9f236ec45bc 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -43,7 +43,7 @@ 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, nullptr
+    IMP_TGA, IMP_PICT, IMP_MET, IMP_RAS, IMP_PCX, nullptr
 };
 
 const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -235,12 +235,11 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
     "pct","1","SVPICT",
     "pcd","1","icd",
     "psd","1","ipd",
-    "pcx","1","ipx",
+    "pcx","1","SVPCX",
     "pbm","1","ipb",
     "pgm","1","ipb",
     "ppm","1","ipb",
-    "ras","1","ira",
-    "ras","2","era",
+    "ras","1","SVRAS",
     "svm","1","SVMETAFILE",
     "svm","2","SVMETAFILE",
     "tga","1","SVTGA",
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 5365a89e181b..158327bb1c57 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -52,6 +52,8 @@
 #include <filter/TgaReader.hxx>
 #include <filter/PictReader.hxx>
 #include <filter/MetReader.hxx>
+#include <filter/RasReader.hxx>
+#include <filter/PcxReader.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/awt/Size.hpp>
@@ -647,8 +649,6 @@ extern "C" bool idxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterCo
 extern "C" bool ipbGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipdGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipsGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool ipxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool iraGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 
 #endif
 
@@ -667,10 +667,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipdGraphicImport"));
         else if (maFormatName == "ips")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipsGraphicImport"));
-        else if (maFormatName == "ipx")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipxGraphicImport"));
-        else if (maFormatName == "ira")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("iraGraphicImport"));
  #else
         if (maFormatName ==  "icd")
             mpfnImport = icdGraphicImport;
@@ -682,10 +678,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = ipdGraphicImport;
         else if (maFormatName ==  "ips")
             mpfnImport = ipsGraphicImport;
-        else if (maFormatName ==  "ipx")
-            mpfnImport = ipxGraphicImport;
-        else if (maFormatName ==  "ira")
-            mpfnImport = iraGraphicImport;
  #endif
     }
 
@@ -1421,7 +1413,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"ips", u"ipx", u"ira",
+        u"icd", u"idx", u"ipb", u"ipd", u"ips",
     };
 
     // Load library for each filter.
@@ -1735,6 +1727,22 @@ ErrCode GraphicFilter::readMET(SvStream & rStream, Graphic & rGraphic, GfxLinkTy
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
+ErrCode GraphicFilter::readRAS(SvStream & rStream, Graphic & rGraphic)
+{
+    if (ImportRasGraphic(rStream, rGraphic))
+        return ERRCODE_NONE;
+    else
+        return ERRCODE_GRFILTER_FILTERERROR;
+}
+
+ErrCode GraphicFilter::readPCX(SvStream & rStream, Graphic & rGraphic)
+{
+    if (ImportPcxGraphic(rStream, rGraphic))
+        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*/,
@@ -1860,6 +1868,14 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
         {
             nStatus = readMET(rIStream, rGraphic, eLinkType);
         }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_RAS))
+        {
+            nStatus = readRAS(rIStream, rGraphic);
+        }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_PCX))
+        {
+            nStatus = readPCX(rIStream, rGraphic);
+        }
         else
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/vcl/source/filter/ipcx/ipcx.cxx
similarity index 99%
rename from filter/source/graphicfilter/ipcx/ipcx.cxx
rename to vcl/source/filter/ipcx/ipcx.cxx
index 67cbc947fefc..413ba95f4256 100644
--- a/filter/source/graphicfilter/ipcx/ipcx.cxx
+++ b/vcl/source/filter/ipcx/ipcx.cxx
@@ -22,6 +22,7 @@
 #include <vcl/graph.hxx>
 #include <vcl/BitmapTools.hxx>
 #include <tools/stream.hxx>
+#include <filter/PcxReader.hxx>
 
 class FilterConfigItem;
 
@@ -398,8 +399,7 @@ void PCXReader::ImplReadPalette( unsigned int nCol )
 
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-ipxGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportPcxGraphic(SvStream & rStream, Graphic & rGraphic)
 {
     PCXReader aPCXReader(rStream);
     bool bRetValue = aPCXReader.ReadPCX(rGraphic);
diff --git a/filter/source/graphicfilter/iras/iras.cxx b/vcl/source/filter/iras/iras.cxx
similarity index 99%
rename from filter/source/graphicfilter/iras/iras.cxx
rename to vcl/source/filter/iras/iras.cxx
index 5205d6253e22..415e3224d6fb 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/vcl/source/filter/iras/iras.cxx
@@ -22,6 +22,7 @@
 #include <vcl/BitmapTools.hxx>
 #include <sal/log.hxx>
 #include <tools/stream.hxx>
+#include <filter/RasReader.hxx>
 
 class FilterConfigItem;
 
@@ -394,8 +395,7 @@ sal_uInt8 RASReader::ImplGetByte()
 
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-iraGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportRasGraphic( SvStream & rStream, Graphic & rGraphic)
 {
     bool bRet = false;
 
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index a3f5d1d3d4f7..893565e457d3 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -46,6 +46,8 @@
 #include <filter/TgaReader.hxx>
 #include <filter/PictReader.hxx>
 #include <filter/MetReader.hxx>
+#include <filter/RasReader.hxx>
+#include <filter/PcxReader.hxx>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
 #include <tools/stream.hxx>
@@ -249,33 +251,15 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         }
         else if (strcmp(argv[2], "pcx") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("ipxGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportPcxGraphic(aFileStream, aGraphic));
         }
         else if (strcmp(argv[2], "ras") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("iraGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportRasGraphic(aFileStream, aGraphic));
         }
         else if (strcmp(argv[2], "tga") == 0)
         {
diff --git a/vcl/workben/pcxfuzzer.cxx b/vcl/workben/pcxfuzzer.cxx
index e2b72fb7e765..2785cf4c4eec 100644
--- a/vcl/workben/pcxfuzzer.cxx
+++ b/vcl/workben/pcxfuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/PcxReader.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 ipxGraphicImport(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)ipxGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportPcxGraphic(aStream, aGraphic);
     return 0;
 }
 
diff --git a/vcl/workben/rasfuzzer.cxx b/vcl/workben/rasfuzzer.cxx
index 734180b5998b..84678eace5be 100644
--- a/vcl/workben/rasfuzzer.cxx
+++ b/vcl/workben/rasfuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/RasReader.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 iraGraphicImport(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)iraGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportRasGraphic(aStream, aGraphic);
     return 0;
 }
 
commit b4812ee3dbc4f8ba8fcfb2d2604dcae5eb73e130
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Feb 14 22:45:04 2021 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sun Feb 14 22:51:13 2021 +0900

    Move MET reader from filter module into VCL
    
    Change-Id: I478ef775bc73349094f88012ceb57b1712a27f55

diff --git a/filter/CppunitTest_filter_met_test.mk b/filter/CppunitTest_filter_met_test.mk
deleted file mode 100644
index 6bf756f2a671..000000000000
--- a/filter/CppunitTest_filter_met_test.mk
+++ /dev/null
@@ -1,39 +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_met_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_met_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_met_test, \
-    filter/qa/cppunit/filters-met-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_met_test, \
-    gie \
-	sal \
-	test \
-	tl \
-	unotest \
-	vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_met_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_met_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_met_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_met_test,\
-    configmgr/source/configmgr \
-    i18npool/util/i18npool \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_met_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index 4f383a0770bd..73120a524ac3 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -57,7 +57,6 @@ $(eval $(call gb_Library_add_exception_objects,gie,\
     filter/source/graphicfilter/ieps/ieps \
     filter/source/graphicfilter/ipsd/ipsd \
     filter/source/graphicfilter/ipbm/ipbm \
-    filter/source/graphicfilter/ios2met/ios2met \
     filter/source/graphicfilter/idxf/dxf2mtf \
     filter/source/graphicfilter/idxf/dxfblkrd \
     filter/source/graphicfilter/idxf/dxfentrd \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 18481a33c0e1..36ba307c12fb 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -57,7 +57,6 @@ ifneq ($(DISABLE_CVE_TESTS),TRUE)
 $(eval $(call gb_Module_add_check_targets,filter,\
     CppunitTest_filter_dxf_test \
     CppunitTest_filter_eps_test \
-    CppunitTest_filter_met_test \
     CppunitTest_filter_pcd_test \
     CppunitTest_filter_pcx_test \
     CppunitTest_filter_ppm_test \
diff --git a/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu
index c13a17f952db..8e6aa1b9ea7a 100644
--- a/filter/source/config/fragments/internalgraphicfilters/met_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/met_Import.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="met_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
-        <prop oor:name="FormatName"><value>ime</value></prop>
-        <prop oor:name="RealFilterName"><value>MET - OS/2 Metafile</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">MET - OS/2 Metafile</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="met_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>met_OS2_Metafile</value></prop>
+    <prop oor:name="FormatName"><value>SVMET</value></prop>
+    <prop oor:name="RealFilterName"><value>MET - OS/2 Metafile</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">MET - OS/2 Metafile</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index a12550d57b74..ee233ec33d38 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -80,6 +80,7 @@ namespace o3tl
 #define IMP_TIFF                "SVTIFF"
 #define IMP_TGA                 "SVTGA"
 #define IMP_PICT                "SVPICT"
+#define IMP_MET                 "SVMET"
 #define EXP_BMP                 "SVBMP"
 #define EXP_SVMETAFILE          "SVMETAFILE"
 #define EXP_WMF                 "SVWMF"
@@ -349,6 +350,7 @@ public:
     ErrCode readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, OUString aFilterName);
     ErrCode readTGA(SvStream & rStream, Graphic & rGraphic);
     ErrCode readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
+    ErrCode readMET(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
 
 private:
     OUString        aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index f158f433dbd7..26e85a04bb64 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3892,7 +3892,6 @@ external/unixODBC/inc/odbc/sqlucode.h
 filter/inc/strings.hxx
 filter/qa/cppunit/filters-dxf-test.cxx
 filter/qa/cppunit/filters-eps-test.cxx
-filter/qa/cppunit/filters-met-test.cxx
 filter/qa/cppunit/filters-pcd-test.cxx
 filter/qa/cppunit/filters-pcx-test.cxx
 filter/qa/cppunit/filters-ppm-test.cxx
@@ -3965,7 +3964,6 @@ filter/source/graphicfilter/idxf/dxfvec.cxx
 filter/source/graphicfilter/idxf/dxfvec.hxx
 filter/source/graphicfilter/idxf/idxf.cxx
 filter/source/graphicfilter/ieps/ieps.cxx
-filter/source/graphicfilter/ios2met/ios2met.cxx
 filter/source/graphicfilter/ipbm/ipbm.cxx
 filter/source/graphicfilter/ipcd/ipcd.cxx
 filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -14821,6 +14819,7 @@ vcl/qa/cppunit/fontmetric.cxx
 vcl/qa/cppunit/graphicfilter/filters-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
 vcl/qa/cppunit/lifecycle.cxx
 vcl/qa/cppunit/svm/svmtest.cxx
 vcl/qa/cppunit/timer.cxx
@@ -14929,6 +14928,7 @@ vcl/source/filter/etiff/etiff.cxx
 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/ipict/ipict.cxx
 vcl/source/filter/ipict/shape.cxx
 vcl/source/filter/ipict/shape.hxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index 3d958cc7f7ad..b643a2580791 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
     vcl/qa/cppunit/graphicfilter/filters-tiff-test \
     vcl/qa/cppunit/graphicfilter/filters-tga-test \
     vcl/qa/cppunit/graphicfilter/filters-pict-test \
+    vcl/qa/cppunit/graphicfilter/filters-met-test \
 ))
 
 $(eval $(call gb_CppunitTest_set_include,vcl_filters_test,\
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 47b7b393e750..1bfcb5999967 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -437,11 +437,12 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/filter/GraphicFormatDetector \
     vcl/source/filter/igif/decode \
     vcl/source/filter/igif/gifread \
-    vcl/source/filter/itga/itga \
+    vcl/source/filter/imet/ios2met \
     vcl/source/filter/ipict/ipict \
     vcl/source/filter/ipict/shape \
     vcl/source/filter/ipdf/pdfread \
     vcl/source/filter/ipdf/pdfdocument \
+    vcl/source/filter/itga/itga \
     vcl/source/filter/itiff/ccidecom \
     vcl/source/filter/itiff/itiff \
     vcl/source/filter/itiff/lzwdecom \
diff --git a/vcl/inc/filter/MetReader.hxx b/vcl/inc/filter/MetReader.hxx
new file mode 100644
index 000000000000..6855cf7a3fc9
--- /dev/null
+++ b/vcl/inc/filter/MetReader.hxx
@@ -0,0 +1,26 @@
+/* -*- 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 ImportMetGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/met/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/met/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/.gitignore
diff --git a/filter/qa/cppunit/data/met/fail/afl-divide-zero-1.met b/vcl/qa/cppunit/graphicfilter/data/met/fail/afl-divide-zero-1.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/afl-divide-zero-1.met
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/afl-divide-zero-1.met
diff --git a/filter/qa/cppunit/data/met/fail/crash-1.met b/vcl/qa/cppunit/graphicfilter/data/met/fail/crash-1.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/crash-1.met
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/crash-1.met
diff --git a/filter/qa/cppunit/data/met/fail/hang-1.met b/vcl/qa/cppunit/graphicfilter/data/met/fail/hang-1.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/hang-1.met
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/hang-1.met
diff --git a/filter/qa/cppunit/data/met/fail/hang-2.met b/vcl/qa/cppunit/graphicfilter/data/met/fail/hang-2.met
similarity index 100%
rename from filter/qa/cppunit/data/met/fail/hang-2.met
rename to vcl/qa/cppunit/graphicfilter/data/met/fail/hang-2.met
diff --git a/filter/qa/cppunit/data/met/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/met/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/met/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/met/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/met/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/met/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/met/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/met/pass/.gitignore
diff --git a/filter/qa/cppunit/data/met/pass/hang-3.met b/vcl/qa/cppunit/graphicfilter/data/met/pass/hang-3.met
similarity index 100%
rename from filter/qa/cppunit/data/met/pass/hang-3.met
rename to vcl/qa/cppunit/graphicfilter/data/met/pass/hang-3.met
diff --git a/filter/qa/cppunit/data/met/pass/sample.met b/vcl/qa/cppunit/graphicfilter/data/met/pass/sample.met
similarity index 100%
rename from filter/qa/cppunit/data/met/pass/sample.met
rename to vcl/qa/cppunit/graphicfilter/data/met/pass/sample.met
diff --git a/filter/qa/cppunit/filters-met-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
similarity index 80%
rename from filter/qa/cppunit/filters-met-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
index e850a06a37df..ff00920ed326 100644
--- a/filter/qa/cppunit/filters-met-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
@@ -12,15 +12,9 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
+#include <filter/MetReader.hxx>
 
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        imeGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
-
-using namespace ::com::sun::star;
+using namespace css;
 
 /* Implementation of Filters test */
 
@@ -51,17 +45,15 @@ bool MetFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return imeGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportMetGraphic(aFileStream, aGraphic);
 }
 
 void MetFilterTest::testCVEs()
 {
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/met/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/met/"));
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(MetFilterTest);
 
-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 6f9dd9bc13f6..a004e693641d 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -43,7 +43,7 @@ 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, nullptr
+    IMP_TGA, IMP_PICT, IMP_MET, nullptr
 };
 
 const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -229,7 +229,7 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
     "jpg","2","SVEJPEG",
     "mov","1","SVMOV",
     "mov","2","SVMOV",
-    "met","1","ime",
+    "met","1","SVMET",
     "png","1","SVIPNG",
     "png","2","SVEPNG",
     "pct","1","SVPICT",
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 210742388bd7..5365a89e181b 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -51,6 +51,7 @@
 #include <filter/TiffWriter.hxx>
 #include <filter/TgaReader.hxx>
 #include <filter/PictReader.hxx>
+#include <filter/MetReader.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/awt/Size.hpp>
@@ -643,7 +644,6 @@ ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const
 
 extern "C" bool icdGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool idxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool imeGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipbGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipdGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipsGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
@@ -661,8 +661,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("icdGraphicImport"));
         else if (maFormatName == "idx")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("idxGraphicImport"));
-        else if (maFormatName == "ime")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("imeGraphicImport"));
         else if (maFormatName == "ipb")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipbGraphicImport"));
         else if (maFormatName == "ipd")
@@ -678,8 +676,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = icdGraphicImport;
         else if (maFormatName ==  "idx")
             mpfnImport = idxGraphicImport;
-        else if (maFormatName ==  "ime")
-            mpfnImport = imeGraphicImport;
         else if (maFormatName ==  "ipb")
             mpfnImport = ipbGraphicImport;
         else if (maFormatName ==  "ipd")
@@ -1328,6 +1324,10 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
         {
             eLinkType = GfxLinkType::NativePct;
         }
+        else if (aFilterName == IMP_MET)
+        {
+            eLinkType = GfxLinkType::NativeMet;
+        }
         else
         {
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
@@ -1360,9 +1360,6 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
                 OUString aShortName;
                 if (nFormat != GRFILTER_FORMAT_DONTKNOW)
                     aShortName = GetImportFormatShortName(nFormat).toAsciiUpperCase();
-
-                if( aShortName.startsWith(MET_SHORTNAME))
-                    eLinkType = GfxLinkType::NativeMet;
             }
         }
     }
@@ -1424,7 +1421,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"ime", u"ipb", u"ipd", u"ips", u"ipx", u"ira",
+        u"icd", u"idx", u"ipb", u"ipd", u"ips", u"ipx", u"ira",
     };
 
     // Load library for each filter.
@@ -1727,6 +1724,17 @@ ErrCode GraphicFilter::readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkT
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
+ErrCode GraphicFilter::readMET(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType)
+{
+    if (ImportMetGraphic(rStream, rGraphic))
+    {
+        rLinkType = GfxLinkType::NativeMet;
+        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*/,
@@ -1848,6 +1856,10 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
         {
             nStatus = readPICT(rIStream, rGraphic, eLinkType);
         }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_MET))
+        {
+            nStatus = readMET(rIStream, rGraphic, eLinkType);
+        }
         else
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
@@ -1888,15 +1900,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
                 }
                 if( !(*pFunc)( rIStream, rGraphic, pFilterConfigItem.get() ) )
                     nStatus = ERRCODE_GRFILTER_FORMATERROR;
-                else
-                {
-                    // try to set link type if format matches
-                    if( nFormat != GRFILTER_FORMAT_DONTKNOW )
-                    {
-                        if( aShortName.startsWith( MET_SHORTNAME ) )
-                            eLinkType = GfxLinkType::NativeMet;
-                    }
-                }
             }
         }
     }
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/vcl/source/filter/imet/ios2met.cxx
similarity index 99%
rename from filter/source/graphicfilter/ios2met/ios2met.cxx
rename to vcl/source/filter/imet/ios2met.cxx
index f17565ebd715..1d0b83ba1fb3 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/vcl/source/filter/imet/ios2met.cxx
@@ -28,6 +28,7 @@
 #include <vcl/virdev.hxx>
 #include <vcl/lineinfo.hxx>
 #include <vcl/gdimtf.hxx>
+#include <filter/MetReader.hxx>
 
 #include <math.h>
 #include <memory>
@@ -2786,8 +2787,7 @@ void OS2METReader::ReadOS2MET( SvStream & rStreamOS2MET, GDIMetaFile & rGDIMetaF
 
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-imeGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportMetGraphic(SvStream & rStream, Graphic & rGraphic)
 {
     OS2METReader    aOS2METReader;
     GDIMetaFile     aMTF;
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 443456299434..a3f5d1d3d4f7 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -45,6 +45,7 @@
 #include <filter/TiffReader.hxx>
 #include <filter/TgaReader.hxx>
 #include <filter/PictReader.hxx>
+#include <filter/MetReader.hxx>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
 #include <tools/stream.hxx>
@@ -191,18 +192,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         }
         else if (strcmp(argv[2], "met") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("imeGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportMetGraphic(aFileStream, aGraphic));
         }
         else if ((strcmp(argv[2], "pbm") == 0) || strcmp(argv[2], "ppm") == 0)
         {
diff --git a/vcl/workben/metfuzzer.cxx b/vcl/workben/metfuzzer.cxx
index fd506432996e..acaaf9d1b3da 100644
--- a/vcl/workben/metfuzzer.cxx
+++ b/vcl/workben/metfuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/MetReader.hxx>
 
 #include <config_features.h>
 #include <osl/detail/component-mapping.h>
@@ -48,8 +49,6 @@ extern "C" void* lo_get_custom_widget_func(const char*)
     return nullptr;
 }
 
-extern "C" bool imeGraphicImport(SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem);
-
 extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
     TypicalFuzzerInitialize(argc, argv);
@@ -60,7 +59,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)imeGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportMetGraphic(aStream, aGraphic);
     return 0;
 }
 
commit 19386aa00a5a415954583f596315ecd13cfdc464
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Feb 14 22:26:00 2021 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sun Feb 14 22:26:00 2021 +0900

    Move PICT reader from filter module into VCL
    
    Change-Id: I6d3a28769ff3bffa3970a4ab6ab2384bb0aebbca

diff --git a/filter/CppunitTest_filter_pict_test.mk b/filter/CppunitTest_filter_pict_test.mk
deleted file mode 100644
index 431166e6e3cd..000000000000
--- a/filter/CppunitTest_filter_pict_test.mk
+++ /dev/null
@@ -1,50 +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_pict_test))
-
-$(eval $(call gb_CppunitTest_use_externals,filter_pict_test,\
-	boost_headers \
-	libxml2 \
-))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_pict_test, \
-    filter/qa/cppunit/filters-pict-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_pict_test, \
-	cppu \
-	comphelper \
-	basegfx \
-	sal \
-	salhelper \
-	test \
-	tk \
-	tl \
-	utl \
-	unotest \
-	vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_library_objects,filter_pict_test, \
-    gie \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_pict_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_pict_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_pict_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_pict_test,\
-    configmgr/source/configmgr \
-    i18npool/util/i18npool \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_pict_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index be60d68e3de7..4f383a0770bd 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -52,8 +52,6 @@ $(eval $(call gb_Library_add_exception_objects,gie,\
     filter/source/graphicfilter/egif/egif \
     filter/source/graphicfilter/eps/eps \
     filter/source/graphicfilter/egif/giflzwc \
-    filter/source/graphicfilter/ipict/ipict \
-    filter/source/graphicfilter/ipict/shape \
     filter/source/graphicfilter/ipcx/ipcx \
     filter/source/graphicfilter/iras/iras \
     filter/source/graphicfilter/ieps/ieps \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index a998c65b60ab..18481a33c0e1 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -60,7 +60,6 @@ $(eval $(call gb_Module_add_check_targets,filter,\
     CppunitTest_filter_met_test \
     CppunitTest_filter_pcd_test \
     CppunitTest_filter_pcx_test \
-    CppunitTest_filter_pict_test \
     CppunitTest_filter_ppm_test \
     CppunitTest_filter_psd_test \
     CppunitTest_filter_ras_test \
diff --git a/filter/source/config/fragments/internalgraphicfilters/pct_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pct_Import.xcu
index 63048f9b4eb2..974bb330066b 100644
--- a/filter/source/config/fragments/internalgraphicfilters/pct_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/pct_Import.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="pct_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>pct_Mac_Pict</value></prop>
-        <prop oor:name="FormatName"><value>ipt</value></prop>
-        <prop oor:name="RealFilterName"><value>PCT - Mac Pict</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PCT - Mac Pict</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="pct_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>pct_Mac_Pict</value></prop>
+    <prop oor:name="FormatName"><value>SVPICT</value></prop>
+    <prop oor:name="RealFilterName"><value>PCT - Mac Pict</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PCT - Mac Pict</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/filter/source/graphicfilter/ipict/ipict.hxx b/filter/source/graphicfilter/ipict/ipict.hxx
deleted file mode 100644
index 31ffdac0a81e..000000000000
--- a/filter/source/graphicfilter/ipict/ipict.hxx
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- 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/.
- */
-
-#ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IPICT_HXX
-#define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IPICT_HXX
-
-#include <sal/config.h>
-
-class GDIMetaFile;
-class SvStream;
-
-namespace pict
-{
-/// Function to access PictReader::ReadPict for unit testing.
-void ReadPictFile(SvStream& rStreamPict, GDIMetaFile& rGDIMetaFile);
-}
-
-#endif // INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IPICT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 8fa96d95766d..a12550d57b74 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -79,6 +79,7 @@ namespace o3tl
 #define IMP_PDF                 "SVIPDF"
 #define IMP_TIFF                "SVTIFF"
 #define IMP_TGA                 "SVTGA"
+#define IMP_PICT                "SVPICT"
 #define EXP_BMP                 "SVBMP"
 #define EXP_SVMETAFILE          "SVMETAFILE"
 #define EXP_WMF                 "SVWMF"
@@ -347,6 +348,7 @@ public:
     ErrCode readTIFF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
     ErrCode readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, OUString aFilterName);
     ErrCode readTGA(SvStream & rStream, Graphic & rGraphic);
+    ErrCode readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
 
 private:
     OUString        aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index c350a923e646..f158f433dbd7 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3895,7 +3895,6 @@ filter/qa/cppunit/filters-eps-test.cxx
 filter/qa/cppunit/filters-met-test.cxx
 filter/qa/cppunit/filters-pcd-test.cxx
 filter/qa/cppunit/filters-pcx-test.cxx
-filter/qa/cppunit/filters-pict-test.cxx
 filter/qa/cppunit/filters-ppm-test.cxx
 filter/qa/cppunit/filters-psd-test.cxx
 filter/qa/cppunit/filters-ras-test.cxx
@@ -3970,9 +3969,6 @@ filter/source/graphicfilter/ios2met/ios2met.cxx
 filter/source/graphicfilter/ipbm/ipbm.cxx
 filter/source/graphicfilter/ipcd/ipcd.cxx
 filter/source/graphicfilter/ipcx/ipcx.cxx
-filter/source/graphicfilter/ipict/ipict.cxx
-filter/source/graphicfilter/ipict/shape.cxx
-filter/source/graphicfilter/ipict/shape.hxx
 filter/source/graphicfilter/ipsd/ipsd.cxx
 filter/source/graphicfilter/iras/iras.cxx
 filter/source/msfilter/countryid.cxx
@@ -14824,6 +14820,7 @@ vcl/qa/cppunit/font.cxx
 vcl/qa/cppunit/fontmetric.cxx
 vcl/qa/cppunit/graphicfilter/filters-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
 vcl/qa/cppunit/lifecycle.cxx
 vcl/qa/cppunit/svm/svmtest.cxx
 vcl/qa/cppunit/timer.cxx
@@ -14932,6 +14929,9 @@ vcl/source/filter/etiff/etiff.cxx
 vcl/source/filter/igif/decode.cxx
 vcl/source/filter/igif/decode.hxx
 vcl/source/filter/igif/gifread.cxx
+vcl/source/filter/ipict/ipict.cxx
+vcl/source/filter/ipict/shape.cxx
+vcl/source/filter/ipict/shape.hxx
 vcl/source/filter/ixbm/xbmread.cxx
 vcl/source/filter/ixpm/rgbtable.hxx
 vcl/source/filter/ixpm/xpmread.cxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index bd4131f3983e..3d958cc7f7ad 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -13,6 +13,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-pict-test \
 ))
 
 $(eval $(call gb_CppunitTest_set_include,vcl_filters_test,\
@@ -26,7 +27,10 @@ $(eval $(call gb_CppunitTest_add_defs,vcl_filters_test,\
 ))
 endif
 
-$(eval $(call gb_CppunitTest_use_external,vcl_filters_test,boost_headers))
+$(eval $(call gb_CppunitTest_use_externals,vcl_filters_test,\
+	boost_headers \
+	libxml2 \
+))
 
 $(eval $(call gb_CppunitTest_use_libraries,vcl_filters_test, \
 	comphelper \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index c5803e46eb08..47b7b393e750 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -438,6 +438,8 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/filter/igif/decode \
     vcl/source/filter/igif/gifread \
     vcl/source/filter/itga/itga \
+    vcl/source/filter/ipict/ipict \
+    vcl/source/filter/ipict/shape \
     vcl/source/filter/ipdf/pdfread \
     vcl/source/filter/ipdf/pdfdocument \
     vcl/source/filter/itiff/ccidecom \
diff --git a/vcl/inc/filter/PictReader.hxx b/vcl/inc/filter/PictReader.hxx
new file mode 100644
index 000000000000..fa3fb09a006b
--- /dev/null
+++ b/vcl/inc/filter/PictReader.hxx
@@ -0,0 +1,33 @@
+/* -*- 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 <sal/config.h>
+
+class GDIMetaFile;
+class SvStream;
+
+VCL_DLLPUBLIC bool ImportPictGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/// Function to access PictReader::ReadPict for unit testing.
+VCL_DLLPUBLIC void ReadPictFile(SvStream& rStreamPict, GDIMetaFile& rGDIMetaFile);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/pict/clipping-problem.pct b/vcl/qa/cppunit/graphicfilter/data/pict/clipping-problem.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/clipping-problem.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/clipping-problem.pct
diff --git a/filter/qa/cppunit/data/pict/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pict/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pict/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pict/fail/.gitignore
diff --git a/filter/qa/cppunit/data/pict/fail/CVE-2008-1097-1.pct b/vcl/qa/cppunit/graphicfilter/data/pict/fail/CVE-2008-1097-1.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/fail/CVE-2008-1097-1.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/fail/CVE-2008-1097-1.pct
diff --git a/filter/qa/cppunit/data/pict/fail/CVE-2012-0277-1.pct b/vcl/qa/cppunit/graphicfilter/data/pict/fail/CVE-2012-0277-1.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/fail/CVE-2012-0277-1.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/fail/CVE-2012-0277-1.pct
diff --git a/filter/qa/cppunit/data/pict/fail/CVE-2013-2577-1.pct b/vcl/qa/cppunit/graphicfilter/data/pict/fail/CVE-2013-2577-1.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/fail/CVE-2013-2577-1.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/fail/CVE-2013-2577-1.pct
diff --git a/filter/qa/cppunit/data/pict/fail/EDB-19332-1.pct b/vcl/qa/cppunit/graphicfilter/data/pict/fail/EDB-19332-1.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/fail/EDB-19332-1.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/fail/EDB-19332-1.pct
diff --git a/filter/qa/cppunit/data/pict/fail/exception-1.pct b/vcl/qa/cppunit/graphicfilter/data/pict/fail/exception-1.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/fail/exception-1.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/fail/exception-1.pct
diff --git a/filter/qa/cppunit/data/pict/fail/hang-1.pct b/vcl/qa/cppunit/graphicfilter/data/pict/fail/hang-1.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/fail/hang-1.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/fail/hang-1.pct
diff --git a/filter/qa/cppunit/data/pict/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pict/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pict/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pict/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/pict/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pict/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pict/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pict/pass/.gitignore
diff --git a/filter/qa/cppunit/data/pict/pass/ooo25876-2.pct b/vcl/qa/cppunit/graphicfilter/data/pict/pass/ooo25876-2.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/pass/ooo25876-2.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/pass/ooo25876-2.pct
diff --git a/filter/qa/cppunit/data/pict/pass/tdf92789.pct b/vcl/qa/cppunit/graphicfilter/data/pict/pass/tdf92789.pct
similarity index 100%
rename from filter/qa/cppunit/data/pict/pass/tdf92789.pct
rename to vcl/qa/cppunit/graphicfilter/data/pict/pass/tdf92789.pct
diff --git a/filter/qa/cppunit/filters-pict-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
similarity index 83%
rename from filter/qa/cppunit/filters-pict-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
index b4f0432441db..a24f2d324d97 100644
--- a/filter/qa/cppunit/filters-pict-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
@@ -16,14 +16,7 @@
 #include <vcl/graph.hxx>
 #include <vcl/metaactiontypes.hxx>
 
-#include "../../source/graphicfilter/ipict/ipict.hxx"
-
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        iptGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
+#include <filter/PictReader.hxx>
 
 using namespace ::com::sun::star;
 
@@ -43,7 +36,7 @@ public:
 
     OUString pictURL()
     {
-        return m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/pict/");
+        return m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/pict/");
     }
 
     /**
@@ -65,20 +58,21 @@ bool PictFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return iptGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportPictGraphic(aFileStream, aGraphic);
 }
 
 void PictFilterTest::testCVEs()
 {
-    testDir(OUString(),
-        pictURL());
+#ifndef DISABLE_CVE_TESTS
+    testDir(OUString(), pictURL());
+#endif
 }
 
 void PictFilterTest::testDontClipTooMuch()
 {
     SvFileStream aFileStream(pictURL() + "clipping-problem.pct", StreamMode::READ);
     GDIMetaFile aGDIMetaFile;
-    pict::ReadPictFile(aFileStream, aGDIMetaFile);
+    ReadPictFile(aFileStream, aGDIMetaFile);
 
     MetafileXmlDump dumper;
     dumper.filterAllActionTypes();
@@ -95,6 +89,4 @@ void PictFilterTest::testDontClipTooMuch()
 
 CPPUNIT_TEST_SUITE_REGISTRATION(PictFilterTest);
 
-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 05ba4eeefe8e..6f9dd9bc13f6 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -43,7 +43,7 @@ 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, nullptr
+    IMP_TGA, IMP_PICT, nullptr
 };
 
 const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -232,8 +232,7 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
     "met","1","ime",
     "png","1","SVIPNG",
     "png","2","SVEPNG",
-    "pct","1","ipt",
-    "pct","2","ept",
+    "pct","1","SVPICT",
     "pcd","1","icd",
     "psd","1","ipd",
     "pcx","1","ipx",
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 3546539b8787..210742388bd7 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -50,6 +50,7 @@
 #include <filter/TiffReader.hxx>
 #include <filter/TiffWriter.hxx>
 #include <filter/TgaReader.hxx>
+#include <filter/PictReader.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/awt/Size.hpp>
@@ -646,7 +647,6 @@ extern "C" bool imeGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterCo
 extern "C" bool ipbGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipdGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipsGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool iptGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool iraGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 
@@ -669,8 +669,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipdGraphicImport"));
         else if (maFormatName == "ips")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipsGraphicImport"));
-        else if (maFormatName == "ipt")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("iptGraphicImport"));
         else if (maFormatName == "ipx")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipxGraphicImport"));
         else if (maFormatName == "ira")
@@ -688,8 +686,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = ipdGraphicImport;
         else if (maFormatName ==  "ips")
             mpfnImport = ipsGraphicImport;
-        else if (maFormatName ==  "ipt")
-            mpfnImport = iptGraphicImport;
         else if (maFormatName ==  "ipx")
             mpfnImport = ipxGraphicImport;
         else if (maFormatName ==  "ira")
@@ -1328,6 +1324,10 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
         {
             eLinkType = GfxLinkType::NativeTif;
         }
+        else if (aFilterName == IMP_PICT)
+        {
+            eLinkType = GfxLinkType::NativePct;
+        }
         else
         {
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
@@ -1363,8 +1363,6 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
 
                 if( aShortName.startsWith(MET_SHORTNAME))
                     eLinkType = GfxLinkType::NativeMet;
-                else if( aShortName.startsWith(PCT_SHORTNAME))
-                    eLinkType = GfxLinkType::NativePct;
             }
         }
     }
@@ -1426,7 +1424,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"ime", u"ipb", u"ipd", u"ips", u"ipt", u"ipx", u"ira",
+        u"icd", u"idx", u"ime", u"ipb", u"ipd", u"ips", u"ipx", u"ira",
     };
 
     // Load library for each filter.
@@ -1718,6 +1716,17 @@ ErrCode GraphicFilter::readTGA(SvStream & rStream, Graphic & rGraphic)
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
+ErrCode GraphicFilter::readPICT(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType)
+{
+    if (ImportPictGraphic(rStream, rGraphic))
+    {
+        rLinkType = GfxLinkType::NativePct;
+        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*/,
@@ -1835,6 +1844,10 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
         {
             nStatus = readTGA(rIStream, rGraphic);
         }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_PICT))
+        {
+            nStatus = readPICT(rIStream, rGraphic, eLinkType);
+        }
         else
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
@@ -1880,12 +1893,8 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
                     // try to set link type if format matches
                     if( nFormat != GRFILTER_FORMAT_DONTKNOW )
                     {
-                        if( aShortName.startsWith( TIF_SHORTNAME ) )
-                            eLinkType = GfxLinkType::NativeTif;
-                        else if( aShortName.startsWith( MET_SHORTNAME ) )
+                        if( aShortName.startsWith( MET_SHORTNAME ) )
                             eLinkType = GfxLinkType::NativeMet;
-                        else if( aShortName.startsWith( PCT_SHORTNAME ) )
-                            eLinkType = GfxLinkType::NativePct;
                     }
                 }
             }
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/vcl/source/filter/ipict/ipict.cxx
similarity index 99%
rename from filter/source/graphicfilter/ipict/ipict.cxx
rename to vcl/source/filter/ipict/ipict.cxx
index 43b872f09558..8787e2632c3b 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/vcl/source/filter/ipict/ipict.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <filter/PictReader.hxx>
 #include <string.h>
 #include <osl/thread.h>
 #include <sal/log.hxx>
@@ -28,8 +29,6 @@
 #include <tools/stream.hxx>
 #include <vcl/virdev.hxx>
 #include <math.h>
-
-#include "ipict.hxx"
 #include "shape.hxx"
 #include <memory>
 
@@ -1985,25 +1984,20 @@ void PictReader::ReadPict( SvStream & rStreamPict, GDIMetaFile & rGDIMetaFile )
     }
 }
 
-namespace pict {
-
 void ReadPictFile(SvStream &rStreamPict, GDIMetaFile& rGDIMetaFile)
 {
     PictReader aPictReader;
     aPictReader.ReadPict(rStreamPict, rGDIMetaFile);
 }
 
-}
-
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-iptGraphicImport( SvStream& rIStm, Graphic & rGraphic, FilterConfigItem* )
+bool ImportPictGraphic( SvStream& rIStm, Graphic & rGraphic)
 {
     GDIMetaFile aMTF;
     bool        bRet = false;
 
-    pict::ReadPictFile( rIStm, aMTF );
+    ReadPictFile(rIStm, aMTF);
 
     if ( !rIStm.GetError() )
     {
diff --git a/filter/source/graphicfilter/ipict/shape.cxx b/vcl/source/filter/ipict/shape.cxx
similarity index 100%
rename from filter/source/graphicfilter/ipict/shape.cxx
rename to vcl/source/filter/ipict/shape.cxx
diff --git a/filter/source/graphicfilter/ipict/shape.hxx b/vcl/source/filter/ipict/shape.hxx
similarity index 100%
rename from filter/source/graphicfilter/ipict/shape.hxx
rename to vcl/source/filter/ipict/shape.hxx
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index f2e0d51b0c74..443456299434 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -44,6 +44,7 @@
 #include <fltcall.hxx>
 #include <filter/TiffReader.hxx>
 #include <filter/TgaReader.hxx>
+#include <filter/PictReader.hxx>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
 #include <tools/stream.hxx>
@@ -250,18 +251,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         }
         else if (strcmp(argv[2], "pct") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("iptGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportPictGraphic(aFileStream, aGraphic));
         }
         else if (strcmp(argv[2], "pcx") == 0)
         {
diff --git a/vcl/workben/pctfuzzer.cxx b/vcl/workben/pctfuzzer.cxx
index a916920c4b9f..db1ad0c90c30 100644
--- a/vcl/workben/pctfuzzer.cxx
+++ b/vcl/workben/pctfuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/PictReader.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 iptGraphicImport(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)iptGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportPictGraphic(aStream, aGraphic);
     return 0;
 }
 
commit c2795e0c7a25a4d5948d4b4bdd4e59af5281ed55
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Feb 14 21:29:45 2021 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sun Feb 14 21:29:45 2021 +0900

    Move TGA reader from filter module into VCL
    
    Change-Id: I0fea5d6e75c6bfd05ea91ed7b92aaacfcc5ec177

diff --git a/filter/CppunitTest_filter_tga_test.mk b/filter/CppunitTest_filter_tga_test.mk
deleted file mode 100644
index 33ae034c0e30..000000000000
--- a/filter/CppunitTest_filter_tga_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_tga_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_tga_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_tga_test, \
-    filter/qa/cppunit/filters-tga-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_tga_test, \
-    gie \
-	sal \
-	test \
-	tl \
-	unotest \
-	vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_tga_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_tga_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_tga_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_tga_test,\
-    configmgr/source/configmgr \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_tga_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index 8c0cbd46b9b9..be60d68e3de7 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Library_add_exception_objects,gie,\
     filter/source/graphicfilter/ipict/shape \
     filter/source/graphicfilter/ipcx/ipcx \
     filter/source/graphicfilter/iras/iras \
-    filter/source/graphicfilter/itga/itga \
     filter/source/graphicfilter/ieps/ieps \
     filter/source/graphicfilter/ipsd/ipsd \
     filter/source/graphicfilter/ipbm/ipbm \
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 898ac710db8a..a998c65b60ab 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -64,7 +64,6 @@ $(eval $(call gb_Module_add_check_targets,filter,\
     CppunitTest_filter_ppm_test \
     CppunitTest_filter_psd_test \
     CppunitTest_filter_ras_test \
-    CppunitTest_filter_tga_test \
     CppunitTest_filter_svg \
 ))
 endif
diff --git a/filter/source/config/fragments/internalgraphicfilters/tga_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/tga_Import.xcu
index 7ea4d49ec624..922cdefbf1ab 100644
--- a/filter/source/config/fragments/internalgraphicfilters/tga_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/tga_Import.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="tga_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>tga_Truevision_TARGA</value></prop>
-        <prop oor:name="FormatName"><value>itg</value></prop>
-        <prop oor:name="RealFilterName"><value>TGA - Truevision TARGA</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">TGA - Truevision Targa</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="tga_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>tga_Truevision_TARGA</value></prop>
+    <prop oor:name="FormatName"><value>SVTGA</value></prop>
+    <prop oor:name="RealFilterName"><value>TGA - Truevision TARGA</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">TGA - Truevision Targa</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 1943e60cdd53..8fa96d95766d 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -78,6 +78,7 @@ namespace o3tl
 #define IMP_SVG                 "SVISVG"
 #define IMP_PDF                 "SVIPDF"
 #define IMP_TIFF                "SVTIFF"
+#define IMP_TGA                 "SVTGA"
 #define EXP_BMP                 "SVBMP"
 #define EXP_SVMETAFILE          "SVMETAFILE"
 #define EXP_WMF                 "SVWMF"
@@ -345,6 +346,7 @@ public:
     ErrCode readPDF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
     ErrCode readTIFF(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType);
     ErrCode readWithTypeSerializer(SvStream & rStream, Graphic & rGraphic, GfxLinkType & rLinkType, OUString aFilterName);
+    ErrCode readTGA(SvStream & rStream, Graphic & rGraphic);
 
 private:
     OUString        aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index edd2eb530360..c350a923e646 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3899,7 +3899,6 @@ filter/qa/cppunit/filters-pict-test.cxx
 filter/qa/cppunit/filters-ppm-test.cxx
 filter/qa/cppunit/filters-psd-test.cxx
 filter/qa/cppunit/filters-ras-test.cxx
-filter/qa/cppunit/filters-tga-test.cxx
 filter/qa/cppunit/msfilter-test.cxx
 filter/qa/cppunit/priority-test.cxx
 filter/qa/cppunit/xslt-test.cxx
@@ -3976,7 +3975,6 @@ filter/source/graphicfilter/ipict/shape.cxx
 filter/source/graphicfilter/ipict/shape.hxx
 filter/source/graphicfilter/ipsd/ipsd.cxx
 filter/source/graphicfilter/iras/iras.cxx
-filter/source/graphicfilter/itga/itga.cxx
 filter/source/msfilter/countryid.cxx
 filter/source/msfilter/dffpropset.cxx
 filter/source/msfilter/escherex.cxx
@@ -14825,6 +14823,7 @@ vcl/qa/cppunit/errorhandler.cxx
 vcl/qa/cppunit/font.cxx
 vcl/qa/cppunit/fontmetric.cxx
 vcl/qa/cppunit/graphicfilter/filters-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx
 vcl/qa/cppunit/lifecycle.cxx
 vcl/qa/cppunit/svm/svmtest.cxx
 vcl/qa/cppunit/timer.cxx
@@ -14936,6 +14935,7 @@ vcl/source/filter/igif/gifread.cxx
 vcl/source/filter/ixbm/xbmread.cxx
 vcl/source/filter/ixpm/rgbtable.hxx
 vcl/source/filter/ixpm/xpmread.cxx
+vcl/source/filter/itga/itga.cxx
 vcl/source/filter/itiff/ccidecom.cxx
 vcl/source/filter/itiff/ccidecom.hxx
 vcl/source/filter/itiff/itiff.cxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index 70667a04417b..bd4131f3983e 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-test \
     vcl/qa/cppunit/graphicfilter/filters-tiff-test \
+    vcl/qa/cppunit/graphicfilter/filters-tga-test \
 ))
 
 $(eval $(call gb_CppunitTest_set_include,vcl_filters_test,\
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index a37024038435..c5803e46eb08 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -437,6 +437,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/filter/GraphicFormatDetector \
     vcl/source/filter/igif/decode \
     vcl/source/filter/igif/gifread \
+    vcl/source/filter/itga/itga \
     vcl/source/filter/ipdf/pdfread \
     vcl/source/filter/ipdf/pdfdocument \
     vcl/source/filter/itiff/ccidecom \
diff --git a/vcl/inc/filter/TgaReader.hxx b/vcl/inc/filter/TgaReader.hxx
new file mode 100644
index 000000000000..34f75648717c
--- /dev/null
+++ b/vcl/inc/filter/TgaReader.hxx
@@ -0,0 +1,26 @@
+/* -*- 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 ImportTgaGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/tga/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/tga/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/tga/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/tga/fail/.gitignore
diff --git a/filter/qa/cppunit/data/tga/fail/CVE-2012-3755-1.tga b/vcl/qa/cppunit/graphicfilter/data/tga/fail/CVE-2012-3755-1.tga
similarity index 100%
rename from filter/qa/cppunit/data/tga/fail/CVE-2012-3755-1.tga
rename to vcl/qa/cppunit/graphicfilter/data/tga/fail/CVE-2012-3755-1.tga
diff --git a/filter/qa/cppunit/data/tga/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/tga/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/tga/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/tga/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/tga/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/tga/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/tga/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/tga/pass/.gitignore
diff --git a/filter/qa/cppunit/data/tga/pass/fdo14924-5.tga b/vcl/qa/cppunit/graphicfilter/data/tga/pass/fdo14924-5.tga
similarity index 100%
rename from filter/qa/cppunit/data/tga/pass/fdo14924-5.tga
rename to vcl/qa/cppunit/graphicfilter/data/tga/pass/fdo14924-5.tga
diff --git a/filter/qa/cppunit/data/tga/pass/fdo14924-6.tga b/vcl/qa/cppunit/graphicfilter/data/tga/pass/fdo14924-6.tga
similarity index 100%
rename from filter/qa/cppunit/data/tga/pass/fdo14924-6.tga
rename to vcl/qa/cppunit/graphicfilter/data/tga/pass/fdo14924-6.tga
diff --git a/filter/qa/cppunit/filters-tga-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx
similarity index 81%
rename from filter/qa/cppunit/filters-tga-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx
index c87216803120..d0611aa56ce9 100644
--- a/filter/qa/cppunit/filters-tga-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-tga-test.cxx
@@ -12,13 +12,7 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
-
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        itgGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
+#include <filter/TgaReader.hxx>
 
 using namespace ::com::sun::star;
 
@@ -51,17 +45,16 @@ bool TgaFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return itgGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportTgaGraphic(aFileStream, aGraphic);
 }
 
 void TgaFilterTest::testCVEs()
 {
-    testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/tga/"));
+#ifndef DISABLE_CVE_TESTS
+    testDir(OUString(), m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/tga/"));
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(TgaFilterTest);
 
-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 020d77c3d298..05ba4eeefe8e 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -42,7 +42,8 @@ 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, nullptr
+    EXP_BMP, EXP_JPEG, EXP_PNG, IMP_MOV, IMP_TIFF, EXP_TIFF,
+    IMP_TGA, nullptr
 };
 
 const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -54,7 +55,7 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL
 const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
 {
     "egi", "icd", "ipd", "ipx", "ipb", "epb", "epg",
-    "epp", "ira", "era", "itg", "exp", nullptr
+    "epp", "ira", "era", "exp", nullptr
 };
 
 void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
@@ -243,7 +244,7 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
     "ras","2","era",
     "svm","1","SVMETAFILE",
     "svm","2","SVMETAFILE",
-    "tga","1","itg",
+    "tga","1","SVTGA",
     "tif","1","SVTIFF",
     "tif","2","SVTIFF",
     "emf","1","SVEMF",
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 3a2e38ec5b11..3546539b8787 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -49,6 +49,7 @@
 #include "ixpm/xpmread.hxx"
 #include <filter/TiffReader.hxx>
 #include <filter/TiffWriter.hxx>
+#include <filter/TgaReader.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/awt/Size.hpp>
@@ -648,7 +649,6 @@ extern "C" bool ipsGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterCo
 extern "C" bool iptGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool ipxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 extern "C" bool iraGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool itgGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 
 #endif
 
@@ -675,8 +675,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipxGraphicImport"));
         else if (maFormatName == "ira")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("iraGraphicImport"));
-        else if (maFormatName == "itg")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("itgGraphicImport"));
  #else
         if (maFormatName ==  "icd")
             mpfnImport = icdGraphicImport;
@@ -696,8 +694,6 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
             mpfnImport = ipxGraphicImport;
         else if (maFormatName ==  "ira")
             mpfnImport = iraGraphicImport;
-        else if (maFormatName ==  "itg")
-            mpfnImport = itgGraphicImport;
  #endif
     }
 
@@ -1430,7 +1426,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"ime", u"ipb", u"ipd", u"ips", u"ipt", u"ipx", u"ira", u"itg",
+        u"icd", u"idx", u"ime", u"ipb", u"ipd", u"ips", u"ipt", u"ipx", u"ira",
     };
 
     // Load library for each filter.
@@ -1714,6 +1710,14 @@ ErrCode GraphicFilter::readWithTypeSerializer(SvStream & rStream, Graphic & rGra
     return aReturnCode;
 }
 
+ErrCode GraphicFilter::readTGA(SvStream & rStream, Graphic & rGraphic)
+{
+    if (ImportTgaGraphic(rStream, rGraphic))
+        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*/,
@@ -1827,6 +1831,10 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
         {
             nStatus = readTIFF(rIStream, rGraphic, eLinkType);
         }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_TGA) )
+        {
+            nStatus = readTGA(rIStream, rGraphic);
+        }
         else
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/vcl/source/filter/itga/itga.cxx
similarity index 99%
rename from filter/source/graphicfilter/itga/itga.cxx
rename to vcl/source/filter/itga/itga.cxx
index 8c8af9d52cd8..e668839ebab7 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/vcl/source/filter/itga/itga.cxx
@@ -22,6 +22,7 @@
 #include <vcl/BitmapTools.hxx>
 #include <tools/stream.hxx>
 #include <memory>
+#include <filter/TgaReader.hxx>
 
 class FilterConfigItem;
 
@@ -780,8 +781,7 @@ bool TGAReader::ImplReadPalette()
 
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-itgGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportTgaGraphic(SvStream & rStream, Graphic & rGraphic)
 {
     TGAReader aTGAReader(rStream);
 
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 42c2447564e7..f2e0d51b0c74 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -43,6 +43,7 @@
 #include <vcl/wrkwin.hxx>
 #include <fltcall.hxx>
 #include <filter/TiffReader.hxx>
+#include <filter/TgaReader.hxx>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
 #include <tools/stream.hxx>
@@ -294,18 +295,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         }
         else if (strcmp(argv[2], "tga") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("itgGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportTgaGraphic(aFileStream, aGraphic));
         }
         else if (strcmp(argv[2], "tif") == 0)
         {
diff --git a/vcl/workben/tgafuzzer.cxx b/vcl/workben/tgafuzzer.cxx
index 47ba63b71da7..32b7fcb3d578 100644
--- a/vcl/workben/tgafuzzer.cxx
+++ b/vcl/workben/tgafuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/TgaReader.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 itgGraphicImport(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)itgGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportTgaGraphic(aStream, aGraphic);
     return 0;
 }
 


More information about the Libreoffice-commits mailing list