[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 31 commits - basic/qa basic/source compilerplugins/clang config_host.mk.in configure.ac dbaccess/source dbaccess/uiconfig desktop/source drawinglayer/CppunitTest_drawinglayer_border.mk drawinglayer/inc drawinglayer/Library_drawinglayercore.mk drawinglayer/Library_drawinglayer.mk drawinglayer/Module_drawinglayer.mk drawinglayer/source emfio/CppunitTest_emfio_emf.mk emfio/Library_emfio.mk filter/Library_gie.mk filter/Library_pdffilter.mk filter/Library_svgfilter.mk filter/Module_filter.mk filter/source helpcontent2 include/basegfx include/drawinglayer include/o3tl include/svx include/vcl o3tl/qa officecfg/registry Repository.mk sc/CppunitTest_sc_parallelism.mk sc/CppunitTest_sc_ucalc.mk sc/inc sc/Library_sc.mk sc/qa sc/sdi sc/source sc/uiconfig sd/CppunitTest_sd_uimpress.mk sd/Library_sd.mk sd/qa sd/source sfx2/Library_sfx.mk solenv/clang-format solenv/gbuild svgio/CppunitTest_svgio.mk svgio/Library_svgio.mk svx/CppunitTest_svx_uni t.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/qa svx/source svx/uiconfig sw/CppunitTest_sw_ooxmlexport5.mk sw/CppunitTest_sw_ooxmlimport2.mk sw/CppunitTest_sw_uwriter.mk sw/CppunitTest_sw_ww8export2.mk sw/Library_sw.mk sw/Library_swui.mk sw/qa sw/sdi sw/source sw/uiconfig translations vcl/commonfuzzer.mk vcl/CppunitTest_vcl_graphic_test.mk vcl/inc vcl/Library_vcl.mk vcl/qa vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 18 03:16:57 UTC 2021
Rebased ref, commits from common ancestor:
commit a5150752835f196a075a87f4cd5083eb99c95da6
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: Thu Feb 18 12:16:09 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 4a2117b6f5b9..69aa225eb108 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" ) )
{
commit 44d4dc3e80c57125704b1b1fab5679b8c00c4bc6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Feb 16 09:16:55 2021 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Feb 18 12:16:08 2021 +0900
vcl: condense the description and rename the peek format function
remove "Imp" from ImpPeekGraphicFormat function name and condense
the description of the function.
Change-Id: Ie7cc42645318c0035f082ae68087ca3c7077d365
diff --git a/vcl/inc/graphic/GraphicFormatDetector.hxx b/vcl/inc/graphic/GraphicFormatDetector.hxx
index e914ee64a3ca..b38561f790c3 100644
--- a/vcl/inc/graphic/GraphicFormatDetector.hxx
+++ b/vcl/inc/graphic/GraphicFormatDetector.hxx
@@ -23,7 +23,7 @@
#include <tools/stream.hxx>
#include <vector>
-VCL_DLLPUBLIC bool ImpPeekGraphicFormat(SvStream& rStream, OUString& rFormatExtension, bool bTest);
+VCL_DLLPUBLIC bool peekGraphicFormat(SvStream& rStream, OUString& rFormatExtension, bool bTest);
namespace vcl
{
diff --git a/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx b/vcl/qa/cppunit/GraphicFormatDetectorTest.cxx
index f4f4698b28a9..1fb2fe0cb4ee 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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(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(ImpPeekGraphicFormat(aFileStream, rFormatExtension, false));
+ CPPUNIT_ASSERT(peekGraphicFormat(aFileStream, rFormatExtension, false));
CPPUNIT_ASSERT_EQUAL(OUString("EPS"), rFormatExtension);
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 782fa735da8a..7ee49825cda1 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -181,34 +181,17 @@ bool isPCT(SvStream& rStream, sal_uLong nStreamPos, sal_uLong nStreamLen)
return false;
}
-/*************************************************************************
- *
- * ImpPeekGraphicFormat()
- *
- * Description:
- * This function is two-fold:
- * 1.) Start reading file, determine the file format:
- * Input parameters:
- * rPath - file path
- * rFormatExtension - content matter
- * bTest - set false
- * Output parameters:
- * Return value - true if success
- * rFormatExtension - on success: normal file extension in capitals
- * 2.) Start reading file, verify file format
- * Input parameters:
- * rPath - file path
- * rFormatExtension - normal file extension in capitals
- * bTest - set true
- * Output parameters:
- * Return value - false, if cannot verify the file type
- * passed to the function
- * true, when the format is PROBABLY verified or
- * WHEN THE FORMAT IS NOT KNOWN!
- *
- *************************************************************************/
-
-bool ImpPeekGraphicFormat( SvStream& rStream, OUString& rFormatExtension, bool bTest )
+/***
+ * 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())
@@ -468,7 +451,7 @@ ErrCode GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream& rSt
if( rFormat == GRFILTER_FORMAT_DONTKNOW )
{
OUString aFormatExt;
- if( ImpPeekGraphicFormat( rStream, aFormatExt, false ) )
+ if( peekGraphicFormat( rStream, aFormatExt, false ) )
{
rFormat = pConfig->GetImportFormatNumberForExtension( aFormatExt );
if( rFormat != GRFILTER_FORMAT_DONTKNOW )
@@ -488,7 +471,7 @@ ErrCode GraphicFilter::ImpTestOrFindFormat( const OUString& rPath, SvStream& rSt
{
OUString aTmpStr( pConfig->GetImportFormatExtension( rFormat ) );
aTmpStr = aTmpStr.toAsciiUpperCase();
- if( !ImpPeekGraphicFormat( rStream, aTmpStr, true ) )
+ if( !peekGraphicFormat( rStream, aTmpStr, true ) )
return ERRCODE_GRFILTER_FORMATERROR;
if ( pConfig->GetImportFormatExtension( rFormat ).equalsIgnoreAsciiCase( "pcd" ) )
{
commit 70d83c6109b751f2331626d8e1812e3277159b08
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Feb 15 17:49:34 2021 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Feb 18 12:16:08 2021 +0900
vcl: clean-up code used for loading of external graphic filters
All graphic filters have been moved into vcl, so there is no need
to load an external library that contained graphic filters, so
this code can be removed.
Change-Id: Iac4f8dd78464e142f50837a55edd2d25720b8c13
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx
index 411d44a5801d..482b8fed2ca0 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -55,39 +55,18 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL
IMP_EPS, EXP_EPS, nullptr
};
-const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
-{
- nullptr
-};
-
void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
{
- bIsPixelFormat = bIsInternalFilter = false;
+ bIsPixelFormat = false;
sFilterName = rUserDataEntry;
const char** pPtr;
- for ( pPtr = InternalPixelFilterNameList; *pPtr && !bIsInternalFilter; pPtr++ )
+ for ( pPtr = InternalPixelFilterNameList; *pPtr; pPtr++ )
{
if ( sFilterName.equalsIgnoreAsciiCaseAscii( *pPtr ) )
{
- bIsInternalFilter = true;
bIsPixelFormat = true;
}
}
- for ( pPtr = InternalVectorFilterNameList; *pPtr && !bIsInternalFilter; pPtr++ )
- {
- if ( sFilterName.equalsIgnoreAsciiCaseAscii( *pPtr ) )
- bIsInternalFilter = true;
- }
- if ( !bIsInternalFilter )
- {
- for ( pPtr = ExternalPixelFilterNameList; *pPtr && !bIsPixelFormat; pPtr++ )
- {
- if ( sFilterName.equalsIgnoreAsciiCaseAscii( *pPtr ) )
- bIsPixelFormat = true;
- }
- sExternalFilterName = sFilterName;
- sFilterName = SVLIBRARY("gie");
- }
}
OUString FilterConfigCache::FilterConfigCacheEntry::GetShortName()
@@ -400,21 +379,6 @@ OUString FilterConfigCache::GetImportFilterTypeName( sal_uInt16 nFormat )
return OUString();
}
-OUString FilterConfigCache::GetExternalFilterName(sal_uInt16 nFormat, bool bExport)
-{
- if (bExport)
- {
- if (nFormat < aExport.size())
- return aExport[nFormat].sExternalFilterName;
- }
- else
- {
- if (nFormat < aImport.size())
- return aImport[nFormat].sExternalFilterName;
- }
- return OUString();
-}
-
OUString FilterConfigCache::GetImportWildcard(sal_uInt16 nFormat, sal_Int32 nEntry)
{
OUString aWildcard( GetImportFormatExtension( nFormat, nEntry ) );
@@ -423,11 +387,6 @@ OUString FilterConfigCache::GetImportWildcard(sal_uInt16 nFormat, sal_Int32 nEnt
return aWildcard;
}
-bool FilterConfigCache::IsImportInternalFilter( sal_uInt16 nFormat )
-{
- return (nFormat < aImport.size()) && aImport[ nFormat ].bIsInternalFilter;
-}
-
OUString FilterConfigCache::GetExportFilterName( sal_uInt16 nFormat )
{
if( nFormat < aExport.size() )
@@ -526,11 +485,6 @@ OUString FilterConfigCache::GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEn
return aWildcard;
}
-bool FilterConfigCache::IsExportInternalFilter( sal_uInt16 nFormat )
-{
- return (nFormat < aExport.size()) && aExport[ nFormat ].bIsInternalFilter;
-}
-
bool FilterConfigCache::IsExportPixelFormat( sal_uInt16 nFormat )
{
return (nFormat < aExport.size()) && aExport[ nFormat ].bIsPixelFormat;
diff --git a/vcl/source/filter/FilterConfigCache.hxx b/vcl/source/filter/FilterConfigCache.hxx
index 4860bbc6f38b..e6b0258bf803 100644
--- a/vcl/source/filter/FilterConfigCache.hxx
+++ b/vcl/source/filter/FilterConfigCache.hxx
@@ -32,7 +32,6 @@ class FilterConfigCache
OUString sType;
std::vector< OUString > lExtensionList;
OUString sUIName;
- OUString sExternalFilterName;
OUString sMediaType;
OUString sFilterType;
@@ -41,7 +40,6 @@ class FilterConfigCache
// user data
OUString sFilterName;
- bool bIsInternalFilter : 1;
bool bIsPixelFormat : 1;
void CreateFilterName( const OUString& rUserDataEntry );
@@ -49,7 +47,6 @@ class FilterConfigCache
static const char* InternalPixelFilterNameList[];
static const char* InternalVectorFilterNameList[];
- static const char* ExternalPixelFilterNameList[];
};
@@ -77,7 +74,6 @@ public:
OUString GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry );
OUString GetImportFilterType( sal_uInt16 nFormat );
OUString GetImportFilterTypeName( sal_uInt16 nFormat );
- OUString GetExternalFilterName(sal_uInt16 nFormat, bool bExport);
bool IsImportInternalFilter( sal_uInt16 nFormat );
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 6b6408076e80..782fa735da8a 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -599,122 +599,6 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r
return aGraphic;
}
-static OUString ImpCreateFullFilterPath( const OUString& rPath, std::u16string_view rFilterName )
-{
- OUString aPathURL;
-
- ::osl::FileBase::getFileURLFromSystemPath( rPath, aPathURL );
- aPathURL += "/";
-
- OUString aSystemPath;
- ::osl::FileBase::getSystemPathFromFileURL( aPathURL, aSystemPath );
- aSystemPath += rFilterName;
-
- return aSystemPath;
-}
-
-namespace {
-
-class ImpFilterLibCache;
-
-struct ImpFilterLibCacheEntry
-{
- ImpFilterLibCacheEntry* mpNext;
-#ifndef DISABLE_DYNLOADING
- osl::Module maLibrary;
-#endif
- OUString maFiltername;
- OUString maFormatName;
-
- ImpFilterLibCacheEntry(const OUString& rPathname, const OUString& rFiltername, const OUString& rFormatName);
- bool operator==( std::u16string_view rFiltername ) const { return maFiltername == rFiltername; }
-};
-
-}
-
-ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const OUString& rFiltername, const OUString& rFormatName ) :
- mpNext ( nullptr ),
-#ifndef DISABLE_DYNLOADING
- maLibrary ( rPathname ),
-#endif
- maFiltername ( rFiltername ),
- maFormatName ( rFormatName )
-{
-#ifdef DISABLE_DYNLOADING
- (void) rPathname;
-#endif
-}
-
-namespace {
-
-class ImpFilterLibCache
-{
- ImpFilterLibCacheEntry* mpFirst;
- ImpFilterLibCacheEntry* mpLast;
-
-public:
- ImpFilterLibCache();
- ~ImpFilterLibCache();
-
- ImpFilterLibCacheEntry* GetFilter( const OUString& rFilterPath, const OUString& rFiltername, const OUString& rFormatName );
-};
-
-}
-
-ImpFilterLibCache::ImpFilterLibCache() :
- mpFirst ( nullptr ),
- mpLast ( nullptr )
-{
-}
-
-ImpFilterLibCache::~ImpFilterLibCache()
-{
- ImpFilterLibCacheEntry* pEntry = mpFirst;
- while( pEntry )
- {
- ImpFilterLibCacheEntry* pNext = pEntry->mpNext;
- delete pEntry;
- pEntry = pNext;
- }
-}
-
-ImpFilterLibCacheEntry* ImpFilterLibCache::GetFilter(const OUString& rFilterPath, const OUString& rFilterName, const OUString& rFormatName)
-{
- ImpFilterLibCacheEntry* pEntry = mpFirst;
-
- while( pEntry )
- {
- if( *pEntry == rFilterName && pEntry->maFormatName == rFormatName )
- break;
- else
- pEntry = pEntry->mpNext;
- }
- if( !pEntry )
- {
- OUString aPhysicalName( ImpCreateFullFilterPath( rFilterPath, rFilterName ) );
- pEntry = new ImpFilterLibCacheEntry(aPhysicalName, rFilterName, rFormatName );
-#ifndef DISABLE_DYNLOADING
- if ( pEntry->maLibrary.is() )
-#endif
- {
- if( !mpFirst )
- mpFirst = mpLast = pEntry;
- else
- mpLast = mpLast->mpNext = pEntry;
- }
-#ifndef DISABLE_DYNLOADING
- else
- {
- delete pEntry;
- pEntry = nullptr;
- }
-#endif
- }
- return pEntry;
-};
-
-namespace { struct Cache : public rtl::Static<ImpFilterLibCache, Cache> {}; }
-
GraphicFilter::GraphicFilter( bool bConfig )
: bUseConfig(bConfig)
{
@@ -1140,13 +1024,11 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
nStreamLength = sizeLimit;
OUString aFilterName = pConfig->GetImportFilterName(nFormat);
- OUString aExternalFilterName = pConfig->GetExternalFilterName(nFormat, false);
std::unique_ptr<sal_uInt8[]> pGraphicContent;
sal_Int32 nGraphicContentSize = 0;
// read graphic
- if (pConfig->IsImportInternalFilter(nFormat))
{
if (aFilterName.equalsIgnoreAsciiCase(IMP_GIF))
{
@@ -1285,23 +1167,6 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
nStatus = ERRCODE_GRFILTER_FILTERERROR;
}
}
- else
- {
- ImpFilterLibCacheEntry* pFilter = nullptr;
-
- if (!aFilterPath.isEmpty())
- {
- // find first filter in filter paths
- ImpFilterLibCache &rCache = Cache::get();
- sal_Int32 nIdx{0};
- do {
- pFilter = rCache.GetFilter(aFilterPath.getToken(0, ';', nIdx), aFilterName, aExternalFilterName);
- } while (nIdx>=0 && pFilter==nullptr);
- }
-
- if( !pFilter )
- nStatus = ERRCODE_GRFILTER_FILTERERROR;
- }
if (nStatus == ERRCODE_NONE && eLinkType != GfxLinkType::NONE)
{
@@ -1719,7 +1584,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
WmfExternal const *pExtHeader )
{
OUString aFilterName;
- OUString aExternalFilterName;
sal_uLong nStreamBegin;
ErrCode nStatus;
GfxLinkType eLinkType = GfxLinkType::NONE;
@@ -1761,7 +1625,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
*pDeterminedFormat = nFormat;
aFilterName = pConfig->GetImportFilterName( nFormat );
- aExternalFilterName = pConfig->GetExternalFilterName(nFormat, false);
}
else
{
@@ -1772,7 +1635,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
}
// read graphic
- if ( pConfig->IsImportInternalFilter( nFormat ) )
{
if (aFilterName.equalsIgnoreAsciiCase(IMP_GIF))
{
@@ -1869,23 +1731,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
else
nStatus = ERRCODE_GRFILTER_FILTERERROR;
}
- else
- {
- ImpFilterLibCacheEntry* pFilter = nullptr;
-
- if (!aFilterPath.isEmpty())
- {
- // find first filter in filter paths
- ImpFilterLibCache &rCache = Cache::get();
- sal_Int32 nIdx{0};
- do {
- pFilter = rCache.GetFilter(aFilterPath.getToken(0, ';', nIdx), aFilterName, aExternalFilterName);
- } while (nIdx>=0 && pFilter==nullptr);
- }
-
- if( !pFilter )
- nStatus = ERRCODE_GRFILTER_FILTERERROR;
- }
if( nStatus == ERRCODE_NONE && ( eLinkType != GfxLinkType::NONE ) && !rGraphic.GetReaderContext() && !bLinkSet )
{
@@ -2021,7 +1866,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
nStatus = ERRCODE_GRFILTER_IOERROR;
if( ERRCODE_NONE == nStatus )
{
- if ( pConfig->IsExportInternalFilter( nFormat ) )
{
if( aFilterName.equalsIgnoreAsciiCase( EXP_BMP ) )
{
commit cc1a3c7357bc304d7a5967593fc02ea1a739be1d
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Jan 2 20:52:36 2021 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Thu Feb 18 12:16:07 2021 +0900
make BasePrimitive2D easier extensible with VisitingParameters
BasePrimitive2D virtual methods get2DDecomposition and getB2DRange
are used in many subclasses of BasePrimitive2D. If we want to
extend the parameters that we want to pass to those classes (and
we will need to in the future changes) we need to change all the
subclasses too. So this commit intoduces VisitingParameters class,
which holds the parameters that we want to pass, which avoids the
need to extend the BasePrimitive2D API.
The only member of VisitingParameters is ViewInformation2D, which
was previously a parameter for both methods.
Change-Id: I39afc28707f1511aafce4e8a84dbc45b84fc8cd5
diff --git a/drawinglayer/inc/primitive2d/cropprimitive2d.hxx b/drawinglayer/inc/primitive2d/cropprimitive2d.hxx
index 86297687ad5f..b0135ffb25e7 100644
--- a/drawinglayer/inc/primitive2d/cropprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/cropprimitive2d.hxx
@@ -82,7 +82,7 @@ namespace drawinglayer::primitive2d
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
/// local decomposition
- virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const override;
/// provide unique ID
virtual sal_uInt32 getPrimitive2DID() const override;
diff --git a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
index 45a21f67dab8..1c4234719c05 100644
--- a/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/texteffectprimitive2d.hxx
@@ -57,9 +57,8 @@ private:
basegfx::B2DHomMatrix maLastObjectToViewTransformation;
/// create local decomposition
- virtual void
- create2DDecomposition(Primitive2DContainer& rContainer,
- const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer,
+ VisitingParameters const& rParameters) const override;
public:
/// constructor
@@ -80,16 +79,14 @@ public:
by a fixed discrete unit, thus the contained geometry needs only once be asked for its
own basegfx::B2DRange
*/
- virtual basegfx::B2DRange
- getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual basegfx::B2DRange getB2DRange(VisitingParameters const& rParameters) const override;
/// provide unique ID
virtual sal_uInt32 getPrimitive2DID() const override;
/// Override standard getDecomposition to be view-dependent here
- virtual void
- get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
- const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
+ VisitingParameters const& rParameters) const override;
};
} // end of namespace primitive2d::drawinglayer
diff --git a/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx b/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx
index c84deefd8547..d8feee52e9ba 100644
--- a/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/textlineprimitive2d.hxx
@@ -41,7 +41,7 @@ namespace drawinglayer::primitive2d
basegfx::BColor maLineColor;
/// local decomposition.
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const override;
public:
/// constructor
diff --git a/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx b/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx
index 1843d5ef9f11..d1652f1ea1bf 100644
--- a/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/textstrikeoutprimitive2d.hxx
@@ -68,7 +68,7 @@ namespace drawinglayer::primitive2d
css::lang::Locale maLocale;
/// local decomposition.
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const override;
public:
/// constructor
@@ -105,7 +105,7 @@ namespace drawinglayer::primitive2d
TextStrikeout meTextStrikeout;
/// local decomposition.
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const override;
public:
/// constructor
diff --git a/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx b/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx
index c92006b36db3..85754a28c255 100644
--- a/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx
+++ b/drawinglayer/inc/primitive2d/wallpaperprimitive2d.hxx
@@ -47,7 +47,7 @@ namespace drawinglayer::primitive2d
WallpaperStyle meWallpaperStyle;
/// create local decomposition
- virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const override;
public:
/// constructor
@@ -65,7 +65,7 @@ namespace drawinglayer::primitive2d
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
/// get B2Drange
- virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual basegfx::B2DRange getB2DRange(VisitingParameters const & rParameters) const override;
/// provide unique ID
virtual sal_uInt32 getPrimitive2DID() const override;
diff --git a/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
index aa48a965e692..7b588f2de0dc 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
@@ -48,8 +48,8 @@ bool PolyPolygonColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive)
return false;
}
-basegfx::B2DRange PolyPolygonColorPrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange
+PolyPolygonColorPrimitive2D::getB2DRange(VisitingParameters const& /*rParameters*/) const
{
// return range
return basegfx::utils::getRange(getB2DPolyPolygon());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx
index 076436b40655..f49d813a79a9 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx
@@ -28,7 +28,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonGradientPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitingParameters const& /*rParameters*/) const
{
if (!getFillGradient().isDefault())
{
diff --git a/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
index c857ba5c8e3d..1582393f54b5 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
@@ -31,7 +31,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonGraphicPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitingParameters const& /*rParameters*/) const
{
if (getFillGraphic().isDefault())
return;
diff --git a/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx
index e4c73f9191a5..db602d7f3606 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx
@@ -28,7 +28,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonHairlinePrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitingParameters const& /*rParameters*/) const
{
const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
const sal_uInt32 nCount(aPolyPolygon.count());
@@ -65,8 +65,8 @@ bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitiv
return false;
}
-basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange
+PolyPolygonHairlinePrimitive2D::getB2DRange(VisitingParameters const& /*rParameters*/) const
{
// return range
return basegfx::utils::getRange(getB2DPolyPolygon());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx
index ad85c02f22c1..268abc1113ba 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx
@@ -28,7 +28,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonHatchPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitingParameters const& /*rParameters*/) const
{
if (!getFillHatch().isDefault())
{
diff --git a/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx
index b545ec9465fa..dfd4a8abafc7 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx
@@ -28,7 +28,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonMarkerPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitingParameters const& /*rParameters*/) const
{
const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
const sal_uInt32 nCount(aPolyPolygon.count());
@@ -71,8 +71,8 @@ bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive)
return false;
}
-basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange
+PolyPolygonMarkerPrimitive2D::getB2DRange(VisitingParameters const& /*rParameters*/) const
{
// return range
return basegfx::utils::getRange(getB2DPolyPolygon());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
index 7be684c2f71e..6e098d6c2a9c 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
@@ -31,7 +31,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonSelectionPrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitingParameters const& /*rParameters*/) const
{
if (getTransparence() >= 1.0 || !getB2DPolyPolygon().count())
return;
@@ -97,8 +97,8 @@ bool PolyPolygonSelectionPrimitive2D::operator==(const BasePrimitive2D& rPrimiti
return false;
}
-basegfx::B2DRange PolyPolygonSelectionPrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange
+PolyPolygonSelectionPrimitive2D::getB2DRange(VisitingParameters const& rParameters) const
{
basegfx::B2DRange aRetval(basegfx::utils::getRange(getB2DPolyPolygon()));
@@ -106,7 +106,8 @@ basegfx::B2DRange PolyPolygonSelectionPrimitive2D::getB2DRange(
{
// get the current DiscreteUnit (not sure if getDiscreteUnit() is updated here, better go safe way)
const double fDiscreteUnit(
- (rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0))
+ (rParameters.getViewInformation().getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(1.0, 0.0))
.getLength());
aRetval.grow(fDiscreteUnit * getDiscreteGrow());
diff --git a/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx
index 53abec1138c3..2e1f93b7e208 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx
@@ -28,7 +28,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
void PolyPolygonStrokePrimitive2D::create2DDecomposition(
- Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ Primitive2DContainer& rContainer, VisitingParameters const& /*rParameters*/) const
{
const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
const sal_uInt32 nCount(aPolyPolygon.count());
@@ -77,8 +77,8 @@ bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive)
return false;
}
-basegfx::B2DRange PolyPolygonStrokePrimitive2D::getB2DRange(
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange
+PolyPolygonStrokePrimitive2D::getB2DRange(VisitingParameters const& /*rParameters*/) const
{
// get range of it (subdivided)
basegfx::B2DRange aRetval(basegfx::utils::getRange(getB2DPolyPolygon()));
diff --git a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
index 3ae4a9b3e3c4..d4998c442ce8 100644
--- a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
+++ b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
@@ -48,8 +48,7 @@ Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert) const
}
// get B2DRange from a given Primitive2DSequence
-basegfx::B2DRange
-Primitive2DContainer::getB2DRange(const geometry::ViewInformation2D& aViewInformation) const
+basegfx::B2DRange Primitive2DContainer::getB2DRange(VisitingParameters const& rParameters) const
{
basegfx::B2DRange aRetval;
@@ -59,7 +58,7 @@ Primitive2DContainer::getB2DRange(const geometry::ViewInformation2D& aViewInform
for (sal_Int32 a(0); a < nCount; a++)
{
- aRetval.expand(getB2DRangeFromPrimitive2DReference((*this)[a], aViewInformation));
+ aRetval.expand(getB2DRangeFromPrimitive2DReference((*this)[a], rParameters));
}
}
diff --git a/drawinglayer/source/primitive2d/Tools.cxx b/drawinglayer/source/primitive2d/Tools.cxx
index 7db3a94c8d04..2da6d80e82e9 100644
--- a/drawinglayer/source/primitive2d/Tools.cxx
+++ b/drawinglayer/source/primitive2d/Tools.cxx
@@ -28,9 +28,8 @@ using namespace css;
namespace drawinglayer::primitive2d
{
// get B2DRange from a given Primitive2DReference
-basegfx::B2DRange
-getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
- const geometry::ViewInformation2D& aViewInformation)
+basegfx::B2DRange getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
+ VisitingParameters const& rParameters)
{
basegfx::B2DRange aRetval;
@@ -42,13 +41,13 @@ getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
if (pCandidate)
{
// use it if possible
- aRetval.expand(pCandidate->getB2DRange(aViewInformation));
+ aRetval.expand(pCandidate->getB2DRange(rParameters));
}
else
{
// use UNO API call instead
const uno::Sequence<beans::PropertyValue>& rViewParameters(
- aViewInformation.getViewInformationSequence());
+ rParameters.getViewInformation().getViewInformationSequence());
aRetval.expand(basegfx::unotools::b2DRectangleFromRealRectangle2D(
rCandidate->getRange(rViewParameters)));
}
diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index d2c8d4a6571a..aa2bf7506161 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -62,12 +62,12 @@ namespace drawinglayer::primitive2d
return false;
}
- void AnimatedSwitchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void AnimatedSwitchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
if(getChildren().empty())
return;
- const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ const double fState(getAnimationEntry().getStateAtTime(rParameters.getViewInformation().getViewTime()));
const sal_uInt32 nLen(getChildren().size());
sal_uInt32 nIndex(basegfx::fround(fState * static_cast<double>(nLen)));
@@ -95,11 +95,11 @@ namespace drawinglayer::primitive2d
{
}
- void AnimatedBlinkPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void AnimatedBlinkPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
if(!getChildren().empty())
{
- const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ const double fState(getAnimationEntry().getStateAtTime(rParameters.getViewInformation().getViewTime()));
if(fState < 0.5)
{
@@ -133,13 +133,13 @@ namespace drawinglayer::primitive2d
}
}
- void AnimatedInterpolatePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void AnimatedInterpolatePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
const sal_uInt32 nSize(maMatrixStack.size());
if(nSize)
{
- double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ double fState(getAnimationEntry().getStateAtTime(rParameters.getViewInformation().getViewTime()));
if(fState < 0.0)
{
diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
index ba0f47193b49..d8f7be330310 100644
--- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
@@ -30,8 +30,10 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void BackgroundColorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void BackgroundColorPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const
{
+ auto const & rViewInformation = rParameters.getViewInformation();
+
if(!rViewInformation.getViewport().isEmpty())
{
const basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(rViewInformation.getViewport()));
@@ -61,17 +63,17 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange BackgroundColorPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange BackgroundColorPrimitive2D::getB2DRange(VisitingParameters const & rParameters) const
{
// always as big as the view
- return rViewInformation.getViewport();
+ return rParameters.getViewInformation().getViewport();
}
- void BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
- if(!getBuffered2DDecomposition().empty() && (maLastViewport != rViewInformation.getViewport()))
+ if(!getBuffered2DDecomposition().empty() && (maLastViewport != rParameters.getViewInformation().getViewport()))
{
// conditions of last local decomposition have changed, delete
const_cast< BackgroundColorPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer());
@@ -80,11 +82,11 @@ namespace drawinglayer::primitive2d
if(getBuffered2DDecomposition().empty())
{
// remember ViewRange
- const_cast< BackgroundColorPrimitive2D* >(this)->maLastViewport = rViewInformation.getViewport();
+ const_cast< BackgroundColorPrimitive2D* >(this)->maLastViewport = rParameters.getViewInformation().getViewport();
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 752bc3063a3b..b809574116cd 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -48,55 +48,59 @@ namespace
class B2DRangeVisitor : public Primitive2DDecompositionVisitor
{
public:
- const geometry::ViewInformation2D& mrViewInformation;
+ VisitingParameters const& mrParameters;
basegfx::B2DRange maRetval;
- B2DRangeVisitor(const geometry::ViewInformation2D& rViewInformation)
- : mrViewInformation(rViewInformation)
+
+ B2DRangeVisitor(VisitingParameters const& rParameters)
+ : mrParameters(rParameters)
{
}
- virtual void append(const Primitive2DReference& r) override
+
+ virtual void append(const Primitive2DReference& rReference) override
{
- maRetval.expand(getB2DRangeFromPrimitive2DReference(r, mrViewInformation));
+ maRetval.expand(getB2DRangeFromPrimitive2DReference(rReference, mrParameters));
}
- virtual void append(const Primitive2DContainer& r) override
+
+ virtual void append(const Primitive2DContainer& rReference) override
{
- maRetval.expand(r.getB2DRange(mrViewInformation));
+ maRetval.expand(rReference.getB2DRange(mrParameters));
}
- virtual void append(Primitive2DContainer&& r) override
+
+ virtual void append(Primitive2DContainer&& rReference) override
{
- maRetval.expand(r.getB2DRange(mrViewInformation));
+ maRetval.expand(rReference.getB2DRange(mrParameters));
}
};
}
-basegfx::B2DRange
-BasePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange BasePrimitive2D::getB2DRange(VisitingParameters const& rParameters) const
{
- B2DRangeVisitor aVisitor(rViewInformation);
- get2DDecomposition(aVisitor, rViewInformation);
+ B2DRangeVisitor aVisitor(rParameters);
+ get2DDecomposition(aVisitor, rParameters);
return aVisitor.maRetval;
}
-void BasePrimitive2D::get2DDecomposition(
- Primitive2DDecompositionVisitor& /*rVisitor*/,
- const geometry::ViewInformation2D& /*rViewInformation*/) const
+void BasePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& /*rVisitor*/,
+ VisitingParameters const& /*rParameters*/) const
{
}
css::uno::Sequence<::css::uno::Reference<::css::graphic::XPrimitive2D>> SAL_CALL
BasePrimitive2D::getDecomposition(const uno::Sequence<beans::PropertyValue>& rViewParameters)
{
- const geometry::ViewInformation2D aViewInformation(rViewParameters);
Primitive2DContainer aContainer;
- get2DDecomposition(aContainer, aViewInformation);
+ geometry::ViewInformation2D aViewInformation2D(rViewParameters);
+ VisitingParameters aParameters(aViewInformation2D);
+ get2DDecomposition(aContainer, aParameters);
return comphelper::containerToSequence(aContainer);
}
css::geometry::RealRectangle2D SAL_CALL
BasePrimitive2D::getRange(const uno::Sequence<beans::PropertyValue>& rViewParameters)
{
- const geometry::ViewInformation2D aViewInformation(rViewParameters);
- return basegfx::unotools::rectangle2DFromB2DRectangle(getB2DRange(aViewInformation));
+ geometry::ViewInformation2D aViewInformation2D(rViewParameters);
+ VisitingParameters aParameters(aViewInformation2D);
+ return basegfx::unotools::rectangle2DFromB2DRectangle(getB2DRange(aParameters));
}
sal_Int64 SAL_CALL BasePrimitive2D::estimateUsage()
@@ -111,17 +115,16 @@ BufferedDecompositionPrimitive2D::BufferedDecompositionPrimitive2D()
}
void BufferedDecompositionPrimitive2D::get2DDecomposition(
- Primitive2DDecompositionVisitor& rVisitor,
- const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const& rParameters) const
{
::osl::MutexGuard aGuard(m_aMutex);
if (getBuffered2DDecomposition().empty())
{
Primitive2DContainer aNewSequence;
- create2DDecomposition(aNewSequence, rViewInformation);
- const_cast<BufferedDecompositionPrimitive2D*>(this)->setBuffered2DDecomposition(
- aNewSequence);
+ create2DDecomposition(aNewSequence, rParameters);
+ auto* pMutableThis = const_cast<BufferedDecompositionPrimitive2D*>(this);
+ pMutableThis->setBuffered2DDecomposition(aNewSequence);
}
rVisitor.append(getBuffered2DDecomposition());
diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
index f495d531d8ff..74e7fb0c68a9 100644
--- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
@@ -45,8 +45,7 @@ bool BitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
return false;
}
-basegfx::B2DRange
-BitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange BitmapPrimitive2D::getB2DRange(VisitingParameters const& /*rParameters*/) const
{
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
aRetval.transform(maTransform);
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index b264e2c028af..ce6572831234 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -112,7 +112,7 @@ namespace drawinglayer::primitive2d
return fRetval;
}
- void BorderLinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void BorderLinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & /*rParameters*/) const
{
if (getStart().equal(getEnd()) || getBorderLines().empty())
return;
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 3f20baa1351f..1d947661054b 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -75,11 +75,13 @@ namespace drawinglayer::primitive2d
}
}
- Primitive2DReference ControlPrimitive2D::createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const
+ Primitive2DReference ControlPrimitive2D::createBitmapDecomposition(VisitingParameters const & rParameters) const
{
Primitive2DReference xRetval;
const uno::Reference< awt::XControl >& rXControl(getXControl());
+ auto const & rViewInformation = rParameters.getViewInformation();
+
if(rXControl.is())
{
uno::Reference< awt::XWindow > xControlWindow(rXControl, uno::UNO_QUERY);
@@ -236,11 +238,11 @@ namespace drawinglayer::primitive2d
return xRetval;
}
- void ControlPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void ControlPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const
{
// try to create a bitmap decomposition. If that fails for some reason,
// at least create a replacement decomposition.
- Primitive2DReference xReference(createBitmapDecomposition(rViewInformation));
+ Primitive2DReference xReference(createBitmapDecomposition(rParameters));
if(!xReference.is())
{
@@ -320,7 +322,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange ControlPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange ControlPrimitive2D::getB2DRange(VisitingParameters const & /*rParameters*/) const
{
// simply derivate from unit range
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
@@ -328,12 +330,12 @@ namespace drawinglayer::primitive2d
return aRetval;
}
- void ControlPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void ControlPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
// this primitive is view-dependent related to the scaling. If scaling has changed,
// destroy existing decomposition. To detect change, use size of unit size in view coordinates
::osl::MutexGuard aGuard( m_aMutex );
- const basegfx::B2DVector aNewScaling(rViewInformation.getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
+ const basegfx::B2DVector aNewScaling(rParameters.getViewInformation().getObjectToViewTransformation() * basegfx::B2DVector(1.0, 1.0));
if(!getBuffered2DDecomposition().empty())
{
@@ -351,7 +353,7 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/cropprimitive2d.cxx b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
index 2d780ac2645c..6ddfe46b7980 100644
--- a/drawinglayer/source/primitive2d/cropprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
@@ -63,7 +63,7 @@ namespace drawinglayer::primitive2d
return false;
}
- void CropPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void CropPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & /*rParameters*/) const
{
if(getChildren().empty())
return;
diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
index 17d6f2301a43..f33a638077c0 100644
--- a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
@@ -25,7 +25,7 @@
namespace drawinglayer::primitive2d
{
- void DiscreteBitmapPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void DiscreteBitmapPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & /*rParameters*/) const
{
// use getViewTransformation() and getObjectTransformation() from
// ObjectAndViewTransformationDependentPrimitive2D to create a BitmapPrimitive2D
diff --git a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
index 3100db147345..d80f895f1b6b 100644
--- a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
@@ -157,7 +157,7 @@ namespace drawinglayer::primitive2d
namespace drawinglayer::primitive2d
{
- void DiscreteShadowPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void DiscreteShadowPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & /*rParameters*/) const
{
Primitive2DContainer xRetval;
@@ -284,7 +284,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange DiscreteShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange DiscreteShadowPrimitive2D::getB2DRange(VisitingParameters const & rParameters) const
{
if(getDiscreteShadow().getBitmapEx().IsEmpty())
{
@@ -298,7 +298,7 @@ namespace drawinglayer::primitive2d
aRetval.transform(getTransform());
// extract discrete shadow size and grow
- const basegfx::B2DVector aScale(rViewInformation.getViewTransformation() * basegfx::B2DVector(1.0, 1.0));
+ const basegfx::B2DVector aScale(rParameters.getViewInformation().getViewTransformation() * basegfx::B2DVector(1.0, 1.0));
const sal_Int32 nQuarter((getDiscreteShadow().getBitmapEx().GetSizePixel().Width() - 3) >> 2);
const double fGrowX((1.0 / aScale.getX()) * nQuarter);
const double fGrowY((1.0 / aScale.getY()) * nQuarter);
diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
index e38afeb4d612..c7fbaace2d16 100644
--- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
@@ -60,10 +60,10 @@ namespace drawinglayer::primitive2d
return !maShadowPrimitives.empty();
}
- void Embedded3DPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void Embedded3DPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const
{
// use info to create a yellow 2d rectangle, similar to empty 3d scenes and/or groups
- const basegfx::B2DRange aLocal2DRange(getB2DRange(rViewInformation));
+ const basegfx::B2DRange aLocal2DRange(getB2DRange(rParameters));
const basegfx::B2DPolygon aOutline(basegfx::utils::createPolygonFromRect(aLocal2DRange));
const basegfx::BColor aYellow(1.0, 1.0, 0.0);
rContainer.push_back(new PolygonHairlinePrimitive2D(aOutline, aYellow));
@@ -107,7 +107,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange Embedded3DPrimitive2D::getB2DRange(VisitingParameters const & rParameters) const
{
if(maB2DRange.isEmpty())
{
@@ -125,7 +125,7 @@ namespace drawinglayer::primitive2d
// taken into account
if(impGetShadow3D())
{
- const basegfx::B2DRange aShadow2DRange(maShadowPrimitives.getB2DRange(rViewInformation));
+ const basegfx::B2DRange aShadow2DRange(maShadowPrimitives.getB2DRange(rParameters));
if(!aShadow2DRange.isEmpty())
{
diff --git a/drawinglayer/source/primitive2d/epsprimitive2d.cxx b/drawinglayer/source/primitive2d/epsprimitive2d.cxx
index b519547c00d7..f5bb98e4171d 100644
--- a/drawinglayer/source/primitive2d/epsprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/epsprimitive2d.cxx
@@ -23,7 +23,7 @@
namespace drawinglayer::primitive2d
{
- void EpsPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void EpsPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & /*rParameters*/) const
{
const GDIMetaFile& rSubstituteContent = getMetaFile();
@@ -65,7 +65,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange EpsPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange EpsPrimitive2D::getB2DRange(VisitingParameters const & /*rParameters*/) const
{
// use own implementation to quickly answer the getB2DRange question.
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
index fba740e833c5..0851223505ab 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -269,7 +269,7 @@ namespace drawinglayer::primitive2d
}
}
- void FillGradientPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void FillGradientPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & /*rParameters*/) const
{
// default creates overlapping fill which works with AntiAliasing and without.
// The non-overlapping version does not create single filled polygons, but
@@ -319,7 +319,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange FillGradientPrimitive2D::getB2DRange(VisitingParameters const & /*rParameters*/) const
{
// return the geometrically visible area
return getOutputRange();
diff --git a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
index ee67bd305810..bf346c83a43d 100644
--- a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
@@ -33,7 +33,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void FillGraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void FillGraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & /*rParameters*/) const
{
const attribute::FillGraphicAttribute& rAttribute = getFillGraphic();
@@ -112,7 +112,7 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange FillGraphicPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange FillGraphicPrimitive2D::getB2DRange(VisitingParameters const & /*rParameters*/) const
{
// return range of it
basegfx::B2DPolygon aPolygon(basegfx::utils::createUnitPolygon());
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index 9c4ef03bfba3..3802354e0c95 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -32,7 +32,7 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void FillHatchPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void FillHatchPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & /*rParameters*/) const
{
if(getFillHatch().isDefault())
return;
@@ -167,13 +167,13 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+ basegfx::B2DRange FillHatchPrimitive2D::getB2DRange(VisitingParameters const & /*rParameters*/) const
{
// return the geometrically visible area
return getOutputRange();
}
- void FillHatchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void FillHatchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance());
@@ -181,12 +181,12 @@ namespace drawinglayer::primitive2d
if(bAdaptDistance)
{
// behave view-dependent
- DiscreteMetricDependentPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ DiscreteMetricDependentPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
else
{
// behave view-independent
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
}
diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index f6dfab2b3c45..83c9aa223044 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -45,10 +45,9 @@ bool GlowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
return false;
}
-basegfx::B2DRange
-GlowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+basegfx::B2DRange GlowPrimitive2D::getB2DRange(VisitingParameters const& rParameters) const
{
- basegfx::B2DRange aRetval(GroupPrimitive2D::getB2DRange(rViewInformation));
+ basegfx::B2DRange aRetval(GroupPrimitive2D::getB2DRange(rParameters));
// We need additional space for the glow from all sides
aRetval.grow(getGlowRadius());
return aRetval;
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index 8805d99e49db..f25d70372163 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -31,7 +31,7 @@
namespace drawinglayer::primitive2d
{
void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
- const geometry::ViewInformation2D&) const
+ VisitingParameters const& /*rParameters*/) const
{
if (0 == getGraphicAttr().GetAlpha())
{
@@ -204,8 +204,7 @@ bool GraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
return false;
}
-basegfx::B2DRange
-GraphicPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
+basegfx::B2DRange GraphicPrimitive2D::getB2DRange(VisitingParameters const& /*rParameters*/) const
{
basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
aRetval.transform(getTransform());
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 9c441dc0d876..858668d9e1b9 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -351,7 +351,7 @@ namespace drawinglayer::primitive2d
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
/// override to deliver the correct expected frame dependent of timing
- virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
+ virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & /*rParameters*/) const override;
};
}
@@ -422,13 +422,13 @@ namespace drawinglayer::primitive2d
&& maGraphic == pCompare->maGraphic);
}
- void AnimatedGraphicPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void AnimatedGraphicPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
if (!isValidData())
return;
Primitive2DReference aRetval;
- const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ const double fState(getAnimationEntry().getStateAtTime(rParameters.getViewInformation().getViewTime()));
const sal_uInt32 nLen(maAnimation.Count());
sal_uInt32 nIndex(basegfx::fround(fState * static_cast<double>(nLen)));
diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
index e1d0841678e2..1d553d542a75 100644
--- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
@@ -30,8 +30,10 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void GridPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void GridPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const
{
+ auto const & rViewInformation = rParameters.getViewInformation();
+
if(!(!rViewInformation.getViewport().isEmpty() && getWidth() > 0.0 && getHeight() > 0.0))
return;
@@ -294,25 +296,27 @@ namespace drawinglayer::primitive2d
return false;
}
- basegfx::B2DRange GridPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
+ basegfx::B2DRange GridPrimitive2D::getB2DRange(VisitingParameters const & rParameters) const
{
// get object's range
basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
aUnitRange.transform(getTransform());
// intersect with visible part
- aUnitRange.intersect(rViewInformation.getViewport());
+ aUnitRange.intersect(rParameters.getViewInformation().getViewport());
return aUnitRange;
}
- void GridPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void GridPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
+ auto const & rViewInformation = rParameters.getViewInformation();
if(!getBuffered2DDecomposition().empty())
{
- if(maLastViewport != rViewInformation.getViewport() || maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
+ if( maLastViewport != rViewInformation.getViewport() ||
+ maLastObjectToViewTransformation != rViewInformation.getObjectToViewTransformation())
{
// conditions of last local decomposition have changed, delete
const_cast< GridPrimitive2D* >(this)->setBuffered2DDecomposition(Primitive2DContainer());
@@ -327,7 +331,7 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/groupprimitive2d.cxx b/drawinglayer/source/primitive2d/groupprimitive2d.cxx
index 63f21f842b2b..73392f1449aa 100644
--- a/drawinglayer/source/primitive2d/groupprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/groupprimitive2d.cxx
@@ -49,7 +49,7 @@ namespace drawinglayer::primitive2d
}
/// default: just return children, so all renderers not supporting group will use its content
- void GroupPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& /*rViewInformation*/) const
+ void GroupPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & /*rParameters*/) const
{
getChildren(rVisitor);
}
diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
index 86c3b88ca6d5..405bd5afa112 100644
--- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
@@ -30,8 +30,10 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
- void HelplinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
+ void HelplinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, VisitingParameters const & rParameters) const
{
+ auto const & rViewInformation = rParameters.getViewInformation();
+
if(rViewInformation.getViewport().isEmpty() || getDirection().equalZero())
return;
@@ -159,9 +161,10 @@ namespace drawinglayer::primitive2d
return false;
}
- void HelplinePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
+ void HelplinePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, VisitingParameters const & rParameters) const
{
::osl::MutexGuard aGuard( m_aMutex );
+ auto const & rViewInformation = rParameters.getViewInformation();
if(!getBuffered2DDecomposition().empty())
{
@@ -180,7 +183,7 @@ namespace drawinglayer::primitive2d
}
// use parent implementation
- BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
+ BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rParameters);
}
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list