[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - vcl/inc vcl/qa vcl/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 16 04:05:01 UTC 2021


Rebased ref, commits from common ancestor:
commit 2462796087b365d1ab715bcf3c4943444ab4e612
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Feb 16 10:35:11 2021 +0900
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Tue Feb 16 10:37:35 2021 +0900

    vcl: move def. of peekGraphicFormat into GraphicFormatDetector
    
    Change-Id: I3b89009324f21b54ccf00f16eb47f9967a6b4e1f

diff --git a/vcl/inc/graphic/GraphicFormatDetector.hxx b/vcl/inc/graphic/GraphicFormatDetector.hxx
index b38561f790c3..f2f0393caeee 100644
--- a/vcl/inc/graphic/GraphicFormatDetector.hxx
+++ b/vcl/inc/graphic/GraphicFormatDetector.hxx
@@ -23,10 +23,19 @@
 #include <tools/stream.hxx>
 #include <vector>
 
-VCL_DLLPUBLIC bool peekGraphicFormat(SvStream& rStream, OUString& rFormatExtension, bool bTest);
-
 namespace vcl
 {
+/***
+ * This function is has two modes:
+ * - determine the file format when bTest = false
+ *   returns true, success
+ *   out rFormatExtension - on success: file format string
+ * - verify file format when bTest = true
+ *   returns false, if file type can't be verified
+ *           true, if the format is verified or the format is not known
+ */
+VCL_DLLPUBLIC bool peekGraphicFormat(SvStream& rStream, OUString& rFormatExtension, bool bTest);
+
 class VCL_DLLPUBLIC GraphicFormatDetector
 {
 public:
diff --git a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx
index 1fb2fe0cb4ee..264a0e8cd48d 100644
--- a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx
+++ b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx
@@ -83,7 +83,7 @@ void GraphicFormatDetectorTest::testDetectMET()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("MET"), rFormatExtension);
 }
 
@@ -98,7 +98,7 @@ void GraphicFormatDetectorTest::testDetectBMP()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("BMP"), rFormatExtension);
 }
 
@@ -113,7 +113,7 @@ void GraphicFormatDetectorTest::testDetectWMF()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("WMF"), rFormatExtension);
 }
 
@@ -128,7 +128,7 @@ void GraphicFormatDetectorTest::testDetectPCX()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("PCX"), rFormatExtension);
 }
 
@@ -143,7 +143,7 @@ void GraphicFormatDetectorTest::testDetectJPG()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("JPG"), rFormatExtension);
 }
 
@@ -158,7 +158,7 @@ void GraphicFormatDetectorTest::testDetectPNG()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("PNG"), rFormatExtension);
 }
 
@@ -173,7 +173,7 @@ void GraphicFormatDetectorTest::testDetectGIF()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("GIF"), rFormatExtension);
 }
 
@@ -188,7 +188,7 @@ void GraphicFormatDetectorTest::testDetectPSD()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("PSD"), rFormatExtension);
 }
 
@@ -203,7 +203,7 @@ void GraphicFormatDetectorTest::testDetectTGA()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension("TGA"); // detection is based on extension only
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("TGA"), rFormatExtension);
 }
 
@@ -218,7 +218,7 @@ void GraphicFormatDetectorTest::testDetectTIF()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("TIF"), rFormatExtension);
 }
 
@@ -233,7 +233,7 @@ void GraphicFormatDetectorTest::testDetectXBM()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("XBM"), rFormatExtension);
 }
 
@@ -248,7 +248,7 @@ void GraphicFormatDetectorTest::testDetectXPM()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("XPM"), rFormatExtension);
 }
 
@@ -263,7 +263,7 @@ void GraphicFormatDetectorTest::testDetectSVG()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("SVG"), rFormatExtension);
 }
 
@@ -278,7 +278,7 @@ void GraphicFormatDetectorTest::testDetectSVGZ()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("SVG"), rFormatExtension);
 }
 
@@ -293,7 +293,7 @@ void GraphicFormatDetectorTest::testDetectPDF()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("PDF"), rFormatExtension);
 }
 
@@ -308,7 +308,7 @@ void GraphicFormatDetectorTest::testDetectEPS()
     aFileStream.Seek(aDetector.mnStreamPosition);
 
     OUString rFormatExtension;
-    CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
+    CPPUNIT_ASSERT(vcl::peekGraphicFormat(aFileStream, rFormatExtension, false));
     CPPUNIT_ASSERT_EQUAL(OUString("EPS"), rFormatExtension);
 }
 
diff --git a/vcl/source/filter/GraphicFormatDetector.cxx b/vcl/source/filter/GraphicFormatDetector.cxx
index e5a1eb5f9a79..3ef78d475f59 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -28,6 +28,255 @@
 
 namespace vcl
 {
+bool peekGraphicFormat(SvStream& rStream, OUString& rFormatExtension, bool bTest)
+{
+    vcl::GraphicFormatDetector aDetector(rStream, rFormatExtension);
+    if (!aDetector.detect())
+        return false;
+
+    // The following variable is used when bTest == true. It remains false
+    // if the format (rFormatExtension) has not yet been set.
+    bool bSomethingTested = false;
+
+    // Now the different formats are checked. The order *does* matter. e.g. a MET file
+    // could also go through the BMP test, however, a BMP file can hardly go through the MET test.
+    // So MET should be tested prior to BMP. However, theoretically a BMP file could conceivably
+    // go through the MET test. These problems are of course not only in MET and BMP.
+    // Therefore, in the case of a format check (bTest == true)  we only test *exactly* this
+    // format. Everything else could have fatal consequences, for example if the user says it is
+    // a BMP file (and it is a BMP) file, and the file would go through the MET test ...
+
+    if (!bTest || rFormatExtension.startsWith("MET"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkMET())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("BMP"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkBMP())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("WMF") || rFormatExtension.startsWith("EMF"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkWMForEMF())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("PCX"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkPCX())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("TIF"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkTIF())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("GIF"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkGIF())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("PNG"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkPNG())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("JPG"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkJPG())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("SVM"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkSVM())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("PCD"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkPCD())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("PSD"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkPSD())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("EPS"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkEPS())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("DXF"))
+    {
+        if (aDetector.checkDXF())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("PCT"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkPCT())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("PBM") || rFormatExtension.startsWith("PGM")
+        || rFormatExtension.startsWith("PPM"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkPBMorPGMorPPM())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("RAS"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkRAS())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest)
+    {
+        bSomethingTested = true;
+        if (aDetector.checkXPM())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+    else if (rFormatExtension.startsWith("XPM"))
+    {
+        return true;
+    }
+
+    if (!bTest)
+    {
+        if (aDetector.checkXBM())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+    else if (rFormatExtension.startsWith("XBM"))
+    {
+        return true;
+    }
+
+    if (!bTest)
+    {
+        if (aDetector.checkSVG())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+    else if (rFormatExtension.startsWith("SVG"))
+    {
+        return true;
+    }
+
+    if (!bTest || rFormatExtension.startsWith("TGA"))
+    {
+        bSomethingTested = true;
+        if (aDetector.checkTGA())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("MOV"))
+    {
+        if (aDetector.checkMOV())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    if (!bTest || rFormatExtension.startsWith("PDF"))
+    {
+        if (aDetector.checkPDF())
+        {
+            rFormatExtension = aDetector.msDetectedFormat;
+            return true;
+        }
+    }
+
+    return bTest && !bSomethingTested;
+}
+
 namespace
 {
 bool isPCT(SvStream& rStream, sal_uLong nStreamPos, sal_uLong nStreamLen)
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 7ee49825cda1..62ea4fcf081c 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -181,277 +181,13 @@ bool isPCT(SvStream& rStream, sal_uLong nStreamPos, sal_uLong nStreamLen)
     return false;
 }
 
-/***
- * This function is has two modes:
- * - determine the file format when bTest = false
- *   returns true, success
- *   out rFormatExtension - on success: file format string
- * - verify file format when bTest = true
- *   returns false, if file type can't be verified
- *           true, if the format is PROBABLY verified
- *                 or WHEN THE FORMAT IS NOT KNOWN!
- */
-bool peekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, bool bTest )
-{
-    vcl::GraphicFormatDetector aDetector(rStream, rFormatExtension);
-    if (!aDetector.detect())
-        return false;
-
-    // The following variable is used when bTest == true. It remains false
-    // if the format (rFormatExtension) has not yet been set.
-    bool bSomethingTested = false;
-
-    // Now the different formats are checked. The order *does* matter. e.g. a MET file
-    // could also go through the BMP test, however, a BMP file can hardly go through the MET test.
-    // So MET should be tested prior to BMP. However, theoretically a BMP file could conceivably
-    // go through the MET test. These problems are of course not only in MET and BMP.
-    // Therefore, in the case of a format check (bTest == true)  we only test *exactly* this
-    // format. Everything else could have fatal consequences, for example if the user says it is
-    // a BMP file (and it is a BMP) file, and the file would go through the MET test ...
-
-    if (!bTest || rFormatExtension.startsWith("MET"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkMET())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("BMP"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkBMP())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest ||
-        rFormatExtension.startsWith("WMF") ||
-        rFormatExtension.startsWith("EMF"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkWMForEMF())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("PCX"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkPCX())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("TIF"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkTIF())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("GIF"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkGIF())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("PNG"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkPNG())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("JPG"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkJPG())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("SVM"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkSVM())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("PCD"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkPCD())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("PSD"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkPSD())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("EPS"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkEPS())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("DXF"))
-    {
-        if (aDetector.checkDXF())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("PCT"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkPCT())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest ||
-        rFormatExtension.startsWith("PBM") ||
-        rFormatExtension.startsWith("PGM") ||
-        rFormatExtension.startsWith("PPM"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkPBMorPGMorPPM())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("RAS"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkRAS())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest)
-    {
-        bSomethingTested = true;
-        if (aDetector.checkXPM())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-
-    }
-    else if (rFormatExtension.startsWith("XPM"))
-    {
-        return true;
-    }
-
-    if (!bTest)
-    {
-        if (aDetector.checkXBM())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-    else if (rFormatExtension.startsWith("XBM"))
-    {
-        return true;
-    }
-
-    if (!bTest)
-    {
-        if (aDetector.checkSVG())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-    else if (rFormatExtension.startsWith("SVG"))
-    {
-        return true;
-    }
-
-    if (!bTest || rFormatExtension.startsWith("TGA"))
-    {
-        bSomethingTested = true;
-        if (aDetector.checkTGA())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("MOV"))
-    {
-        if (aDetector.checkMOV())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    if (!bTest || rFormatExtension.startsWith("PDF"))
-    {
-        if (aDetector.checkPDF())
-        {
-            rFormatExtension = aDetector.msDetectedFormat;
-            return true;
-        }
-    }
-
-    return bTest && !bSomethingTested;
-}
-
 ErrCode GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream& rStream, sal_uInt16& rFormat )
 {
     // determine or check the filter/format by reading into it
     if( rFormat == GRFILTER_FORMAT_DONTKNOW )
     {
         OUString aFormatExt;
-        if( peekGraphicFormat( rStream, aFormatExt, false ) )
+        if (vcl::peekGraphicFormat(rStream, aFormatExt, false))
         {
             rFormat = pConfig->GetImportFormatNumberForExtension( aFormatExt );
             if( rFormat != GRFILTER_FORMAT_DONTKNOW )
@@ -471,7 +207,7 @@ ErrCode GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream& rSt
     {
         OUString aTmpStr( pConfig->GetImportFormatExtension( rFormat ) );
         aTmpStr = aTmpStr.toAsciiUpperCase();
-        if( !peekGraphicFormat( rStream, aTmpStr, true ) )
+        if (!vcl::peekGraphicFormat(rStream, aTmpStr, true))
             return ERRCODE_GRFILTER_FORMATERROR;
         if ( pConfig->GetImportFormatExtension( rFormat ).equalsIgnoreAsciiCase( "pcd" ) )
         {


More information about the Libreoffice-commits mailing list