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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 15 02:38:32 UTC 2021


 filter/CppunitTest_filter_dxf_test.mk                                |   39 -------
 filter/CppunitTest_filter_ppm_test.mk                                |   38 -------
 filter/Library_gie.mk                                                |    9 -
 filter/Module_filter.mk                                              |    2 
 filter/source/config/fragments/internalgraphicfilters/dxf_Import.xcu |   21 ++--
 filter/source/config/fragments/internalgraphicfilters/pbm_Import.xcu |   21 ++--
 filter/source/config/fragments/internalgraphicfilters/pgm_Import.xcu |   21 ++--
 filter/source/config/fragments/internalgraphicfilters/ppm_Import.xcu |   21 ++--
 include/vcl/graphicfilter.hxx                                        |    5 +
 solenv/clang-format/excludelist                                      |   36 +++----
 vcl/CppunitTest_vcl_filters_test.mk                                  |    2 
 vcl/Library_vcl.mk                                                   |    9 +
 vcl/inc/filter/DxfReader.hxx                                         |   26 +++++
 vcl/inc/filter/PbmReader.hxx                                         |   26 +++++
 vcl/qa/cppunit/graphicfilter/filters-dxf-test.cxx                    |   18 +--
 vcl/qa/cppunit/graphicfilter/filters-ppm-test.cxx                    |   18 +--
 vcl/source/filter/FilterConfigCache.cxx                              |   13 +-
 vcl/source/filter/graphicfilter.cxx                                  |   50 +++++-----
 vcl/source/filter/idxf/idxf.cxx                                      |    6 -
 vcl/source/filter/ipbm/ipbm.cxx                                      |    4 
 vcl/workben/dxffuzzer.cxx                                            |    5 -
 vcl/workben/fftester.cxx                                             |   26 +----
 vcl/workben/ppmfuzzer.cxx                                            |    5 -
 23 files changed, 188 insertions(+), 233 deletions(-)

New commits:
commit fa017e3789c1979b77a44c95a753969f01baa8e5
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Feb 15 11:35:38 2021 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Feb 15 11:35:38 2021 +0900

    Move DXF reader from filter module into VCL
    
    Change-Id: If1a933256401c1a971f581d1b389ca06fd77eaae

diff --git a/filter/CppunitTest_filter_dxf_test.mk b/filter/CppunitTest_filter_dxf_test.mk
deleted file mode 100644
index 4a10c1845cef..000000000000
--- a/filter/CppunitTest_filter_dxf_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_dxf_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_dxf_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_dxf_test, \
-    filter/qa/cppunit/filters-dxf-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_dxf_test, \
-	gie \
-	sal \
-	test \
-	tl \
-	unotest \
-	vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_dxf_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_dxf_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_dxf_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_dxf_test,\
-    configmgr/source/configmgr \
-    i18npool/util/i18npool \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_dxf_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index e04eb08fda7f..b40da250a183 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -51,14 +51,6 @@ $(eval $(call gb_Library_use_libraries,gie,\
 $(eval $(call gb_Library_add_exception_objects,gie,\
     filter/source/graphicfilter/egif/egif \
     filter/source/graphicfilter/egif/giflzwc \
-    filter/source/graphicfilter/idxf/dxf2mtf \
-    filter/source/graphicfilter/idxf/dxfblkrd \
-    filter/source/graphicfilter/idxf/dxfentrd \
-    filter/source/graphicfilter/idxf/dxfgrprd \
-    filter/source/graphicfilter/idxf/dxfreprd \
-    filter/source/graphicfilter/idxf/dxftblrd \
-    filter/source/graphicfilter/idxf/dxfvec \
-    filter/source/graphicfilter/idxf/idxf \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index 607a5fc46d0c..2fb2e4c0c8e3 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -55,7 +55,6 @@ $(eval $(call gb_Module_add_check_targets,filter,\
 
 ifneq ($(DISABLE_CVE_TESTS),TRUE)
 $(eval $(call gb_Module_add_check_targets,filter,\
-    CppunitTest_filter_dxf_test \
     CppunitTest_filter_svg \
 ))
 endif
diff --git a/filter/source/config/fragments/internalgraphicfilters/dxf_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/dxf_Import.xcu
index 1ab3279bd809..d4ce34e28b1e 100644
--- a/filter/source/config/fragments/internalgraphicfilters/dxf_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/dxf_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="dxf_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>dxf_AutoCAD_Interchange</value></prop>
-        <prop oor:name="FormatName"><value>idx</value></prop>
-        <prop oor:name="RealFilterName"><value>DXF - AutoCAD Interchange</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">DXF - AutoCAD Interchange Format</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="dxf_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>dxf_AutoCAD_Interchange</value></prop>
+    <prop oor:name="FormatName"><value>SVDXF</value></prop>
+    <prop oor:name="RealFilterName"><value>DXF - AutoCAD Interchange</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">DXF - AutoCAD Interchange Format</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 73b8e932fbd6..5caf1be42c21 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -87,6 +87,8 @@ namespace o3tl
 #define IMP_PSD                 "SVPSD"
 #define IMP_PCD                 "SVPCD"
 #define IMP_PBM                 "SVPBM"
+#define IMP_DXF                 "SVDXF"
+
 #define EXP_BMP                 "SVBMP"
 #define EXP_SVMETAFILE          "SVMETAFILE"
 #define EXP_WMF                 "SVWMF"
@@ -364,6 +366,7 @@ public:
     ErrCode readPSD(SvStream & rStream, Graphic & rGraphic);
     ErrCode readPCD(SvStream & rStream, Graphic & rGraphic);
     ErrCode readPBM(SvStream & rStream, Graphic & rGraphic);
+    ErrCode readDXF(SvStream & rStream, Graphic & rGraphic);
 
 private:
     OUString        aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 4cd0fd50c95e..81284432553b 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3890,7 +3890,6 @@ external/unixODBC/inc/odbc/sqlext.h
 external/unixODBC/inc/odbc/sqltypes.h
 external/unixODBC/inc/odbc/sqlucode.h
 filter/inc/strings.hxx
-filter/qa/cppunit/filters-dxf-test.cxx
 filter/qa/cppunit/msfilter-test.cxx
 filter/qa/cppunit/priority-test.cxx
 filter/qa/cppunit/xslt-test.cxx
@@ -3941,21 +3940,6 @@ filter/source/graphicfilter/icgm/classx.cxx
 filter/source/graphicfilter/icgm/elements.cxx
 filter/source/graphicfilter/icgm/elements.hxx
 filter/source/graphicfilter/icgm/outact.hxx
-filter/source/graphicfilter/idxf/dxf2mtf.cxx
-filter/source/graphicfilter/idxf/dxf2mtf.hxx
-filter/source/graphicfilter/idxf/dxfblkrd.cxx
-filter/source/graphicfilter/idxf/dxfblkrd.hxx
-filter/source/graphicfilter/idxf/dxfentrd.cxx
-filter/source/graphicfilter/idxf/dxfentrd.hxx
-filter/source/graphicfilter/idxf/dxfgrprd.cxx
-filter/source/graphicfilter/idxf/dxfgrprd.hxx
-filter/source/graphicfilter/idxf/dxfreprd.cxx
-filter/source/graphicfilter/idxf/dxfreprd.hxx
-filter/source/graphicfilter/idxf/dxftblrd.cxx
-filter/source/graphicfilter/idxf/dxftblrd.hxx
-filter/source/graphicfilter/idxf/dxfvec.cxx
-filter/source/graphicfilter/idxf/dxfvec.hxx
-filter/source/graphicfilter/idxf/idxf.cxx
 filter/source/msfilter/countryid.cxx
 filter/source/msfilter/dffpropset.cxx
 filter/source/msfilter/escherex.cxx
@@ -14803,6 +14787,7 @@ 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-dxf-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-eps-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-pcd-test.cxx
@@ -14919,6 +14904,21 @@ vcl/source/filter/graphicfilter.cxx
 vcl/source/filter/graphicfilter2.cxx
 vcl/source/filter/eps/eps.cxx
 vcl/source/filter/etiff/etiff.cxx
+vcl/source/filter/idxf/dxf2mtf.cxx
+vcl/source/filter/idxf/dxf2mtf.hxx
+vcl/source/filter/idxf/dxfblkrd.cxx
+vcl/source/filter/idxf/dxfblkrd.hxx
+vcl/source/filter/idxf/dxfentrd.cxx
+vcl/source/filter/idxf/dxfentrd.hxx
+vcl/source/filter/idxf/dxfgrprd.cxx
+vcl/source/filter/idxf/dxfgrprd.hxx
+vcl/source/filter/idxf/dxfreprd.cxx
+vcl/source/filter/idxf/dxfreprd.hxx
+vcl/source/filter/idxf/dxftblrd.cxx
+vcl/source/filter/idxf/dxftblrd.hxx
+vcl/source/filter/idxf/dxfvec.cxx
+vcl/source/filter/idxf/dxfvec.hxx
+vcl/source/filter/idxf/idxf.cxx
 vcl/source/filter/ieps/ieps.cxx
 vcl/source/filter/igif/decode.cxx
 vcl/source/filter/igif/decode.hxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index ccb427dddd6c..ab5108f51b1c 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -10,6 +10,7 @@
 $(eval $(call gb_CppunitTest_CppunitTest,vcl_filters_test))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
+    vcl/qa/cppunit/graphicfilter/filters-dxf-test \
     vcl/qa/cppunit/graphicfilter/filters-eps-test \
     vcl/qa/cppunit/graphicfilter/filters-met-test \
     vcl/qa/cppunit/graphicfilter/filters-pcd-test \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 581e50aec36f..bea21fee0867 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -436,6 +436,14 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/filter/GraphicNativeTransform \
     vcl/source/filter/GraphicNativeMetadata \
     vcl/source/filter/GraphicFormatDetector \
+    vcl/source/filter/idxf/dxf2mtf \
+    vcl/source/filter/idxf/dxfblkrd \
+    vcl/source/filter/idxf/dxfentrd \
+    vcl/source/filter/idxf/dxfgrprd \
+    vcl/source/filter/idxf/dxfreprd \
+    vcl/source/filter/idxf/dxftblrd \
+    vcl/source/filter/idxf/dxfvec \
+    vcl/source/filter/idxf/idxf \
     vcl/source/filter/ieps/ieps \
     vcl/source/filter/igif/decode \
     vcl/source/filter/igif/gifread \
diff --git a/vcl/inc/filter/DxfReader.hxx b/vcl/inc/filter/DxfReader.hxx
new file mode 100644
index 000000000000..f1e89bf4b115
--- /dev/null
+++ b/vcl/inc/filter/DxfReader.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 ImportDxfGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/dxf/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/dxf/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/dxf/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/dxf/fail/.gitignore
diff --git a/filter/qa/cppunit/data/dxf/fail/CVE-2010-1681-1.dxf b/vcl/qa/cppunit/graphicfilter/data/dxf/fail/CVE-2010-1681-1.dxf
similarity index 100%
rename from filter/qa/cppunit/data/dxf/fail/CVE-2010-1681-1.dxf
rename to vcl/qa/cppunit/graphicfilter/data/dxf/fail/CVE-2010-1681-1.dxf
diff --git a/filter/qa/cppunit/data/dxf/fail/hang-1.dxf b/vcl/qa/cppunit/graphicfilter/data/dxf/fail/hang-1.dxf
similarity index 100%
rename from filter/qa/cppunit/data/dxf/fail/hang-1.dxf
rename to vcl/qa/cppunit/graphicfilter/data/dxf/fail/hang-1.dxf
diff --git a/filter/qa/cppunit/data/dxf/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/dxf/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/dxf/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/dxf/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/dxf/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/dxf/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/dxf/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/dxf/pass/.gitignore
diff --git a/filter/qa/cppunit/data/dxf/pass/bigangle-1.dxf b/vcl/qa/cppunit/graphicfilter/data/dxf/pass/bigangle-1.dxf
similarity index 100%
rename from filter/qa/cppunit/data/dxf/pass/bigangle-1.dxf
rename to vcl/qa/cppunit/graphicfilter/data/dxf/pass/bigangle-1.dxf
diff --git a/filter/qa/cppunit/data/dxf/pass/loop-1.dxf b/vcl/qa/cppunit/graphicfilter/data/dxf/pass/loop-1.dxf
similarity index 100%
rename from filter/qa/cppunit/data/dxf/pass/loop-1.dxf
rename to vcl/qa/cppunit/graphicfilter/data/dxf/pass/loop-1.dxf
diff --git a/filter/qa/cppunit/data/dxf/pass/loop-2.dxf b/vcl/qa/cppunit/graphicfilter/data/dxf/pass/loop-2.dxf
similarity index 100%
rename from filter/qa/cppunit/data/dxf/pass/loop-2.dxf
rename to vcl/qa/cppunit/graphicfilter/data/dxf/pass/loop-2.dxf
diff --git a/filter/qa/cppunit/data/dxf/pass/pyramid.dxf b/vcl/qa/cppunit/graphicfilter/data/dxf/pass/pyramid.dxf
similarity index 100%
rename from filter/qa/cppunit/data/dxf/pass/pyramid.dxf
rename to vcl/qa/cppunit/graphicfilter/data/dxf/pass/pyramid.dxf
diff --git a/filter/qa/cppunit/filters-dxf-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-dxf-test.cxx
similarity index 80%
rename from filter/qa/cppunit/filters-dxf-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-dxf-test.cxx
index 2dddac45d026..7a133500826a 100644
--- a/filter/qa/cppunit/filters-dxf-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-dxf-test.cxx
@@ -12,15 +12,9 @@
 #include <vcl/FilterConfigItem.hxx>
 #include <tools/stream.hxx>
 #include <vcl/graph.hxx>
+#include <filter/DxfReader.hxx>
 
-extern "C"
-{
-    SAL_DLLPUBLIC_EXPORT bool SAL_CALL
-        idxGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
-
-using namespace ::com::sun::star;
+using namespace css;
 
 /* Implementation of Filters test */
 
@@ -51,17 +45,17 @@ bool DxfFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return idxGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportDxfGraphic(aFileStream, aGraphic);
 }
 
 void DxfFilterTest::testCVEs()
 {
+#ifndef DISABLE_CVE_TESTS
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/dxf/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/dxf/"));
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(DxfFilterTest);
 
-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 0f19f717f2c8..d8ab4d44e0a8 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -44,7 +44,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, IMP_RAS, IMP_PCX, IMP_PSD,
-    IMP_PCD, IMP_PBM, nullptr
+    IMP_PCD, IMP_PBM, IMP_DXF, nullptr
 };
 
 const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -221,7 +221,7 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
 {
     "bmp","1","SVBMP",
     "bmp","2","SVBMP",
-    "dxf","1","idx",
+    "dxf","1","SVDXF",
     "eps","1","SVIEPS",
     "eps","2","SVEEPS",
     "gif","1","SVIGIF",
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index f76ede5dc840..c9b84de7db0c 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -59,6 +59,7 @@
 #include <filter/PsdReader.hxx>
 #include <filter/PcdReader.hxx>
 #include <filter/PbmReader.hxx>
+#include <filter/DxfReader.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/awt/Size.hpp>
@@ -647,26 +648,9 @@ ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const
 #endif
 }
 
-#ifdef DISABLE_DYNLOADING
-
-extern "C" bool idxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-
-#endif
-
 PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
 {
-    if( !mpfnImport )
-    {
-#ifndef DISABLE_DYNLOADING
-        if (maFormatName == "idx")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("idxGraphicImport"));
- #else
-        if (maFormatName ==  "idx")
-            mpfnImport = idxGraphicImport;
- #endif
-    }
-
-    return mpfnImport;
+    return nullptr;
 }
 
 namespace {
@@ -1766,6 +1750,14 @@ ErrCode GraphicFilter::readPBM(SvStream & rStream, Graphic & rGraphic)
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
+ErrCode GraphicFilter::readDXF(SvStream & rStream, Graphic & rGraphic)
+{
+    if (ImportDxfGraphic(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*/,
@@ -1915,6 +1907,10 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
         {
             nStatus = readPBM(rIStream, rGraphic);
         }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_DXF))
+        {
+            nStatus = readDXF(rIStream, rGraphic);
+        }
         else
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.cxx b/vcl/source/filter/idxf/dxf2mtf.cxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxf2mtf.cxx
rename to vcl/source/filter/idxf/dxf2mtf.cxx
diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx b/vcl/source/filter/idxf/dxf2mtf.hxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxf2mtf.hxx
rename to vcl/source/filter/idxf/dxf2mtf.hxx
diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.cxx b/vcl/source/filter/idxf/dxfblkrd.cxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfblkrd.cxx
rename to vcl/source/filter/idxf/dxfblkrd.cxx
diff --git a/filter/source/graphicfilter/idxf/dxfblkrd.hxx b/vcl/source/filter/idxf/dxfblkrd.hxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfblkrd.hxx
rename to vcl/source/filter/idxf/dxfblkrd.hxx
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.cxx b/vcl/source/filter/idxf/dxfentrd.cxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfentrd.cxx
rename to vcl/source/filter/idxf/dxfentrd.cxx
diff --git a/filter/source/graphicfilter/idxf/dxfentrd.hxx b/vcl/source/filter/idxf/dxfentrd.hxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfentrd.hxx
rename to vcl/source/filter/idxf/dxfentrd.hxx
diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.cxx b/vcl/source/filter/idxf/dxfgrprd.cxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfgrprd.cxx
rename to vcl/source/filter/idxf/dxfgrprd.cxx
diff --git a/filter/source/graphicfilter/idxf/dxfgrprd.hxx b/vcl/source/filter/idxf/dxfgrprd.hxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfgrprd.hxx
rename to vcl/source/filter/idxf/dxfgrprd.hxx
diff --git a/filter/source/graphicfilter/idxf/dxfreprd.cxx b/vcl/source/filter/idxf/dxfreprd.cxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfreprd.cxx
rename to vcl/source/filter/idxf/dxfreprd.cxx
diff --git a/filter/source/graphicfilter/idxf/dxfreprd.hxx b/vcl/source/filter/idxf/dxfreprd.hxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfreprd.hxx
rename to vcl/source/filter/idxf/dxfreprd.hxx
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.cxx b/vcl/source/filter/idxf/dxftblrd.cxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxftblrd.cxx
rename to vcl/source/filter/idxf/dxftblrd.cxx
diff --git a/filter/source/graphicfilter/idxf/dxftblrd.hxx b/vcl/source/filter/idxf/dxftblrd.hxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxftblrd.hxx
rename to vcl/source/filter/idxf/dxftblrd.hxx
diff --git a/filter/source/graphicfilter/idxf/dxfvec.cxx b/vcl/source/filter/idxf/dxfvec.cxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfvec.cxx
rename to vcl/source/filter/idxf/dxfvec.cxx
diff --git a/filter/source/graphicfilter/idxf/dxfvec.hxx b/vcl/source/filter/idxf/dxfvec.hxx
similarity index 100%
rename from filter/source/graphicfilter/idxf/dxfvec.hxx
rename to vcl/source/filter/idxf/dxfvec.hxx
diff --git a/filter/source/graphicfilter/idxf/idxf.cxx b/vcl/source/filter/idxf/idxf.cxx
similarity index 90%
rename from filter/source/graphicfilter/idxf/idxf.cxx
rename to vcl/source/filter/idxf/idxf.cxx
index ad75d6b5e1c3..26d42b10cbe4 100644
--- a/filter/source/graphicfilter/idxf/idxf.cxx
+++ b/vcl/source/filter/idxf/idxf.cxx
@@ -18,16 +18,14 @@
  */
 
 
+#include <filter/DxfReader.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/graph.hxx>
 #include "dxf2mtf.hxx"
 
-class FilterConfigItem;
-
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-idxGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportDxfGraphic(SvStream & rStream, Graphic & rGraphic)
 {
     DXFRepresentation aDXF;
     DXF2GDIMetaFile aConverter;
diff --git a/vcl/workben/dxffuzzer.cxx b/vcl/workben/dxffuzzer.cxx
index 6ca526a1d8cf..8768072c93fb 100644
--- a/vcl/workben/dxffuzzer.cxx
+++ b/vcl/workben/dxffuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/DxfReader.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 idxGraphicImport(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)idxGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportDxfGraphic(aStream, aGraphic);
     return 0;
 }
 
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 45deeee37169..5dafd12be683 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -52,6 +52,7 @@
 #include <filter/PsdReader.hxx>
 #include <filter/PcdReader.hxx>
 #include <filter/PbmReader.hxx>
+#include <filter/DxfReader.hxx>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
 #include <tools/stream.hxx>
@@ -165,7 +166,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
             SvFileStream aFileStream(out, StreamMode::READ);
             ReadGDIMetaFile(aFileStream, aGDIMetaFile);
         }
-#ifndef DISABLE_DYNLOADING
         else if (strcmp(argv[2], "pcd") == 0)
         {
             Graphic aGraphic;
@@ -174,18 +174,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         }
         else if (strcmp(argv[2], "dxf") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("idxGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportDxfGraphic(aFileStream, aGraphic));
         }
         else if (strcmp(argv[2], "met") == 0)
         {
@@ -241,6 +232,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
             SvFileStream aFileStream(out, StreamMode::READ);
             ret = static_cast<int>(ImportTiffGraphicImport(aFileStream, aGraphic));
         }
+#ifndef DISABLE_DYNLOADING
         else if ((strcmp(argv[2], "doc") == 0) || (strcmp(argv[2], "ww8") == 0))
         {
             static FFilterCall pfnImport(nullptr);
commit 10a5be2a455b748cc8e09d452f8a7783e6b39809
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Feb 15 10:47:14 2021 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Feb 15 10:47:43 2021 +0900

    Move PBM,PPM reader from filter module into VCL
    
    Change-Id: I1ce998575f8d204045fabea184e80e71308a16b8

diff --git a/filter/CppunitTest_filter_ppm_test.mk b/filter/CppunitTest_filter_ppm_test.mk
deleted file mode 100644
index 273db952300d..000000000000
--- a/filter/CppunitTest_filter_ppm_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_ppm_test))
-
-$(eval $(call gb_CppunitTest_use_external,filter_ppm_test,boost_headers))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,filter_ppm_test, \
-    filter/qa/cppunit/filters-ppm-test \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,filter_ppm_test, \
-    gie \
-	sal \
-	test \
-	tl \
-	unotest \
-	vcl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,filter_ppm_test))
-
-$(eval $(call gb_CppunitTest_use_ure,filter_ppm_test))
-$(eval $(call gb_CppunitTest_use_vcl,filter_ppm_test))
-
-$(eval $(call gb_CppunitTest_use_components,filter_ppm_test,\
-    configmgr/source/configmgr \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,filter_ppm_test))
-
-# vim: set noet sw=4 ts=4:
diff --git a/filter/Library_gie.mk b/filter/Library_gie.mk
index d5ab8b8169a5..e04eb08fda7f 100644
--- a/filter/Library_gie.mk
+++ b/filter/Library_gie.mk
@@ -51,7 +51,6 @@ $(eval $(call gb_Library_use_libraries,gie,\
 $(eval $(call gb_Library_add_exception_objects,gie,\
     filter/source/graphicfilter/egif/egif \
     filter/source/graphicfilter/egif/giflzwc \
-    filter/source/graphicfilter/ipbm/ipbm \
     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 678c882dce88..607a5fc46d0c 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -56,7 +56,6 @@ $(eval $(call gb_Module_add_check_targets,filter,\
 ifneq ($(DISABLE_CVE_TESTS),TRUE)
 $(eval $(call gb_Module_add_check_targets,filter,\
     CppunitTest_filter_dxf_test \
-    CppunitTest_filter_ppm_test \
     CppunitTest_filter_svg \
 ))
 endif
diff --git a/filter/source/config/fragments/internalgraphicfilters/pbm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pbm_Import.xcu
index 49db4b3c7eb4..0e7f0b9402b5 100644
--- a/filter/source/config/fragments/internalgraphicfilters/pbm_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/pbm_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="pbm_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop>
-        <prop oor:name="FormatName"><value>ipb</value></prop>
-        <prop oor:name="RealFilterName"><value>PBM - Portable Bitmap</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PBM - Portable Bitmap</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="pbm_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>pbm_Portable_Bitmap</value></prop>
+    <prop oor:name="FormatName"><value>SVPBM</value></prop>
+    <prop oor:name="RealFilterName"><value>PBM - Portable Bitmap</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PBM - Portable Bitmap</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/pgm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/pgm_Import.xcu
index 2e1d4bb27f68..0356e69543f5 100644
--- a/filter/source/config/fragments/internalgraphicfilters/pgm_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/pgm_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="pgm_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop>
-        <prop oor:name="FormatName"><value>ipb</value></prop>
-        <prop oor:name="RealFilterName"><value>PGM - Portable Graymap</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PGM - Portable Graymap</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="pgm_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>pgm_Portable_Graymap</value></prop>
+    <prop oor:name="FormatName"><value>SVPBM</value></prop>
+    <prop oor:name="RealFilterName"><value>PGM - Portable Graymap</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PGM - Portable Graymap</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/filter/source/config/fragments/internalgraphicfilters/ppm_Import.xcu b/filter/source/config/fragments/internalgraphicfilters/ppm_Import.xcu
index c2213e24f8bc..03134558c806 100644
--- a/filter/source/config/fragments/internalgraphicfilters/ppm_Import.xcu
+++ b/filter/source/config/fragments/internalgraphicfilters/ppm_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="ppm_Import" oor:op="replace"  >
-        <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop>
-        <prop oor:name="FormatName"><value>ipb</value></prop>
-        <prop oor:name="RealFilterName"><value>PPM - Portable Pixelmap</value></prop>
-        <prop oor:name="UIComponent"/>
-        <prop oor:name="UIName">
-            <value xml:lang="en-US">PPM - Portable Pixelmap</value>
-        </prop>
-        <prop oor:name="Flags"><value>IMPORT</value></prop>
-    </node>
+
+<node oor:name="ppm_Import" oor:op="replace"  >
+    <prop oor:name="Type"><value>ppm_Portable_Pixelmap</value></prop>
+    <prop oor:name="FormatName"><value>SVPBM</value></prop>
+    <prop oor:name="RealFilterName"><value>PPM - Portable Pixelmap</value></prop>
+    <prop oor:name="UIComponent"/>
+    <prop oor:name="UIName">
+        <value xml:lang="en-US">PPM - Portable Pixelmap</value>
+    </prop>
+    <prop oor:name="Flags"><value>IMPORT</value></prop>
+</node>
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 478e1c00a47a..73b8e932fbd6 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -86,6 +86,7 @@ namespace o3tl
 #define IMP_EPS                 "SVIEPS"
 #define IMP_PSD                 "SVPSD"
 #define IMP_PCD                 "SVPCD"
+#define IMP_PBM                 "SVPBM"
 #define EXP_BMP                 "SVBMP"
 #define EXP_SVMETAFILE          "SVMETAFILE"
 #define EXP_WMF                 "SVWMF"
@@ -362,6 +363,7 @@ public:
     ErrCode readEPS(SvStream & rStream, Graphic & rGraphic);
     ErrCode readPSD(SvStream & rStream, Graphic & rGraphic);
     ErrCode readPCD(SvStream & rStream, Graphic & rGraphic);
+    ErrCode readPBM(SvStream & rStream, Graphic & rGraphic);
 
 private:
     OUString        aFilterPath;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index b7118132d5c2..4cd0fd50c95e 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -3891,7 +3891,6 @@ external/unixODBC/inc/odbc/sqltypes.h
 external/unixODBC/inc/odbc/sqlucode.h
 filter/inc/strings.hxx
 filter/qa/cppunit/filters-dxf-test.cxx
-filter/qa/cppunit/filters-ppm-test.cxx
 filter/qa/cppunit/msfilter-test.cxx
 filter/qa/cppunit/priority-test.cxx
 filter/qa/cppunit/xslt-test.cxx
@@ -3957,7 +3956,6 @@ filter/source/graphicfilter/idxf/dxftblrd.hxx
 filter/source/graphicfilter/idxf/dxfvec.cxx
 filter/source/graphicfilter/idxf/dxfvec.hxx
 filter/source/graphicfilter/idxf/idxf.cxx
-filter/source/graphicfilter/ipbm/ipbm.cxx
 filter/source/msfilter/countryid.cxx
 filter/source/msfilter/dffpropset.cxx
 filter/source/msfilter/escherex.cxx
@@ -14810,6 +14808,7 @@ vcl/qa/cppunit/graphicfilter/filters-met-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-pcd-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-pcx-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx
+vcl/qa/cppunit/graphicfilter/filters-ppm-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-psd-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-ras-test.cxx
 vcl/qa/cppunit/graphicfilter/filters-test.cxx
@@ -14925,6 +14924,7 @@ vcl/source/filter/igif/decode.cxx
 vcl/source/filter/igif/decode.hxx
 vcl/source/filter/igif/gifread.cxx
 vcl/source/filter/imet/ios2met.cxx
+vcl/source/filter/ipbm/ipbm.cxx
 vcl/source/filter/ipcd/ipcd.cxx
 vcl/source/filter/ipcx/ipcx.cxx
 vcl/source/filter/ipict/ipict.cxx
diff --git a/vcl/CppunitTest_vcl_filters_test.mk b/vcl/CppunitTest_vcl_filters_test.mk
index 8ebc4c7c1ae0..ccb427dddd6c 100644
--- a/vcl/CppunitTest_vcl_filters_test.mk
+++ b/vcl/CppunitTest_vcl_filters_test.mk
@@ -15,6 +15,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_filters_test, \
     vcl/qa/cppunit/graphicfilter/filters-pcd-test \
     vcl/qa/cppunit/graphicfilter/filters-pcx-test \
     vcl/qa/cppunit/graphicfilter/filters-pict-test \
+    vcl/qa/cppunit/graphicfilter/filters-ppm-test \
     vcl/qa/cppunit/graphicfilter/filters-psd-test \
     vcl/qa/cppunit/graphicfilter/filters-ras-test \
     vcl/qa/cppunit/graphicfilter/filters-test \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 34b7f0697436..581e50aec36f 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -440,6 +440,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/filter/igif/decode \
     vcl/source/filter/igif/gifread \
     vcl/source/filter/imet/ios2met \
+    vcl/source/filter/ipbm/ipbm \
     vcl/source/filter/ipcd/ipcd \
     vcl/source/filter/ipcx/ipcx \
     vcl/source/filter/ipict/ipict \
diff --git a/vcl/inc/filter/PbmReader.hxx b/vcl/inc/filter/PbmReader.hxx
new file mode 100644
index 000000000000..5fe4d8a295ef
--- /dev/null
+++ b/vcl/inc/filter/PbmReader.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 ImportPbmGraphic(SvStream& rStream, Graphic& rGraphic);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/qa/cppunit/data/pbm/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pbm/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pbm/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pbm/fail/.gitignore
diff --git a/filter/qa/cppunit/data/pbm/fail/crash-1.pbm b/vcl/qa/cppunit/graphicfilter/data/pbm/fail/crash-1.pbm
similarity index 100%
rename from filter/qa/cppunit/data/pbm/fail/crash-1.pbm
rename to vcl/qa/cppunit/graphicfilter/data/pbm/fail/crash-1.pbm
diff --git a/filter/qa/cppunit/data/pbm/fail/hang-1.pbm b/vcl/qa/cppunit/graphicfilter/data/pbm/fail/hang-1.pbm
similarity index 100%
rename from filter/qa/cppunit/data/pbm/fail/hang-1.pbm
rename to vcl/qa/cppunit/graphicfilter/data/pbm/fail/hang-1.pbm
diff --git a/filter/qa/cppunit/data/pbm/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pbm/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pbm/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pbm/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/pbm/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/pbm/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/pbm/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/pbm/pass/.gitignore
diff --git a/filter/qa/cppunit/data/pbm/pass/rhbz160429-1.pbm b/vcl/qa/cppunit/graphicfilter/data/pbm/pass/rhbz160429-1.pbm
similarity index 100%
rename from filter/qa/cppunit/data/pbm/pass/rhbz160429-1.pbm
rename to vcl/qa/cppunit/graphicfilter/data/pbm/pass/rhbz160429-1.pbm
diff --git a/filter/qa/cppunit/data/ppm/fail/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ppm/fail/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ppm/fail/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ppm/fail/.gitignore
diff --git a/filter/qa/cppunit/data/ppm/fail/CVE-2008-1097-1.ppm b/vcl/qa/cppunit/graphicfilter/data/ppm/fail/CVE-2008-1097-1.ppm
similarity index 100%
rename from filter/qa/cppunit/data/ppm/fail/CVE-2008-1097-1.ppm
rename to vcl/qa/cppunit/graphicfilter/data/ppm/fail/CVE-2008-1097-1.ppm
diff --git a/filter/qa/cppunit/data/ppm/indeterminate/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ppm/indeterminate/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ppm/indeterminate/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ppm/indeterminate/.gitignore
diff --git a/filter/qa/cppunit/data/ppm/pass/.gitignore b/vcl/qa/cppunit/graphicfilter/data/ppm/pass/.gitignore
similarity index 100%
rename from filter/qa/cppunit/data/ppm/pass/.gitignore
rename to vcl/qa/cppunit/graphicfilter/data/ppm/pass/.gitignore
diff --git a/filter/qa/cppunit/data/ppm/pass/fdo19811-2.ppm b/vcl/qa/cppunit/graphicfilter/data/ppm/pass/fdo19811-2.ppm
similarity index 100%
rename from filter/qa/cppunit/data/ppm/pass/fdo19811-2.ppm
rename to vcl/qa/cppunit/graphicfilter/data/ppm/pass/fdo19811-2.ppm
diff --git a/filter/qa/cppunit/filters-ppm-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-ppm-test.cxx
similarity index 79%
rename from filter/qa/cppunit/filters-ppm-test.cxx
rename to vcl/qa/cppunit/graphicfilter/filters-ppm-test.cxx
index 43ae966a0c57..c9c93a687d93 100644
--- a/filter/qa/cppunit/filters-ppm-test.cxx
+++ b/vcl/qa/cppunit/graphicfilter/filters-ppm-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
-        ipbGraphicImport(SvStream & rStream, Graphic & rGraphic,
-        FilterConfigItem*);
-}
+#include <filter/PbmReader.hxx>
 
 using namespace ::com::sun::star;
 
@@ -51,20 +45,20 @@ bool PpmFilterTest::load(const OUString &,
 {
     SvFileStream aFileStream(rURL, StreamMode::READ);
     Graphic aGraphic;
-    return ipbGraphicImport(aFileStream, aGraphic, nullptr);
+    return ImportPbmGraphic(aFileStream, aGraphic);
 }
 
 void PpmFilterTest::testCVEs()
 {
+#ifndef DISABLE_CVE_TESTS
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/ppm/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/ppm/"));
 
     testDir(OUString(),
-        m_directories.getURLFromSrc(u"/filter/qa/cppunit/data/pbm/"));
+        m_directories.getURLFromSrc(u"/vcl/qa/cppunit/graphicfilter/data/pbm/"));
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(PpmFilterTest);
 
-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 9e5a1a236955..0f19f717f2c8 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -44,7 +44,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, IMP_RAS, IMP_PCX, IMP_PSD,
-    IMP_PCD, nullptr
+    IMP_PCD, IMP_PBM, nullptr
 };
 
 const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameList[] =
@@ -56,8 +56,7 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL
 
 const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
 {
-    "egi", "ipb", "epb", "epg",
-    "epp", nullptr
+    "egi", "epb", "epg", "epp", nullptr
 };
 
 void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
@@ -238,9 +237,9 @@ const char* FilterConfigCache::InternalFilterListForSvxLight[] =
     "pcd","1","SVPCD",
     "psd","1","SVPSD",
     "pcx","1","SVPCX",
-    "pbm","1","ipb",
-    "pgm","1","ipb",
-    "ppm","1","ipb",
+    "pbm","1","SVPBM",
+    "pgm","1","SVPBM",
+    "ppm","1","SVPBM",
     "ras","1","SVRAS",
     "svm","1","SVMETAFILE",
     "svm","2","SVMETAFILE",
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 4d567e43565a..f76ede5dc840 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -58,6 +58,7 @@
 #include <filter/EpsWriter.hxx>
 #include <filter/PsdReader.hxx>
 #include <filter/PcdReader.hxx>
+#include <filter/PbmReader.hxx>
 #include <osl/module.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/awt/Size.hpp>
@@ -649,7 +650,6 @@ ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const
 #ifdef DISABLE_DYNLOADING
 
 extern "C" bool idxGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
-extern "C" bool ipbGraphicImport( SvStream& rStream, Graphic& rGraphic, FilterConfigItem* pConfigItem );
 
 #endif
 
@@ -660,13 +660,9 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
 #ifndef DISABLE_DYNLOADING
         if (maFormatName == "idx")
             mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("idxGraphicImport"));
-        else if (maFormatName == "ipb")
-            mpfnImport = reinterpret_cast<PFilterCall>(maLibrary.getFunctionSymbol("ipbGraphicImport"));
  #else
         if (maFormatName ==  "idx")
             mpfnImport = idxGraphicImport;
-        else if (maFormatName ==  "ipb")
-            mpfnImport = ipbGraphicImport;
  #endif
     }
 
@@ -1762,6 +1758,14 @@ ErrCode GraphicFilter::readPCD(SvStream & rStream, Graphic & rGraphic)
         return ERRCODE_GRFILTER_FILTERERROR;
 }
 
+ErrCode GraphicFilter::readPBM(SvStream & rStream, Graphic & rGraphic)
+{
+    if (ImportPbmGraphic(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*/,
@@ -1907,6 +1911,10 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
         {
             nStatus = readPCD(rIStream, rGraphic);
         }
+        else if (aFilterName.equalsIgnoreAsciiCase(IMP_PBM))
+        {
+            nStatus = readPBM(rIStream, rGraphic);
+        }
         else
             nStatus = ERRCODE_GRFILTER_FILTERERROR;
     }
diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/vcl/source/filter/ipbm/ipbm.cxx
similarity index 99%
rename from filter/source/graphicfilter/ipbm/ipbm.cxx
rename to vcl/source/filter/ipbm/ipbm.cxx
index 4c12c18523fd..7794e611ef4c 100644
--- a/filter/source/graphicfilter/ipbm/ipbm.cxx
+++ b/vcl/source/filter/ipbm/ipbm.cxx
@@ -23,6 +23,7 @@
 #include <vcl/graph.hxx>
 #include <vcl/BitmapTools.hxx>
 #include <tools/stream.hxx>
+#include <filter/PbmReader.hxx>
 
 //============================ PBMReader ==================================
 
@@ -530,8 +531,7 @@ bool PBMReader::ImplReadBody()
 
 //================== GraphicImport - the exported function ================
 
-extern "C" SAL_DLLPUBLIC_EXPORT bool
-ipbGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
+bool ImportPbmGraphic( SvStream & rStream, Graphic & rGraphic)
 {
     PBMReader aPBMReader(rStream);
 
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index 02dc6d90eb21..45deeee37169 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -51,6 +51,7 @@
 #include <filter/EpsReader.hxx>
 #include <filter/PsdReader.hxx>
 #include <filter/PcdReader.hxx>
+#include <filter/PbmReader.hxx>
 #include <osl/file.hxx>
 #include <osl/module.hxx>
 #include <tools/stream.hxx>
@@ -194,18 +195,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         }
         else if ((strcmp(argv[2], "pbm") == 0) || strcmp(argv[2], "ppm") == 0)
         {
-            static PFilterCall pfnImport(nullptr);
-            if (!pfnImport)
-            {
-                osl::Module aLibrary;
-                aLibrary.loadRelative(&thisModule, "libgielo.so");
-                pfnImport = reinterpret_cast<PFilterCall>(
-                    aLibrary.getFunctionSymbol("ipbGraphicImport"));
-                aLibrary.release();
-            }
             Graphic aGraphic;
             SvFileStream aFileStream(out, StreamMode::READ);
-            ret = static_cast<int>((*pfnImport)(aFileStream, aGraphic, nullptr));
+            ret = static_cast<int>(ImportPbmGraphic(aFileStream, aGraphic));
         }
         else if (strcmp(argv[2], "psd") == 0)
         {
diff --git a/vcl/workben/ppmfuzzer.cxx b/vcl/workben/ppmfuzzer.cxx
index 854d457c5503..9595fa3aa747 100644
--- a/vcl/workben/ppmfuzzer.cxx
+++ b/vcl/workben/ppmfuzzer.cxx
@@ -10,6 +10,7 @@
 #include <tools/stream.hxx>
 #include <vcl/FilterConfigItem.hxx>
 #include "commonfuzzer.hxx"
+#include <filter/PbmReader.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 ipbGraphicImport(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)ipbGraphicImport(aStream, aGraphic, nullptr);
+    (void)ImportPbmGraphic(aStream, aGraphic);
     return 0;
 }
 


More information about the Libreoffice-commits mailing list