[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 142 commits - avmedia/inc basctl/source basegfx/source basegfx/test basic/source canvas/source chart2/qa chart2/source cli_ure/source compilerplugins/clang configure.ac cppcanvas/source cppu/source cui/source cui/uiconfig dbaccess/source desktop/qa desktop/source download.lst drawinglayer/CppunitTest_drawinglayer_border.mk drawinglayer/inc drawinglayer/Library_drawinglayercore.mk drawinglayer/Library_drawinglayer.mk drawinglayer/Module_drawinglayer.mk drawinglayer/source editeng/inc editeng/source emfio/CppunitTest_emfio_emf_test.mk emfio/Library_emfio.mk extensions/source external/clucene external/libetonyek external/liblangtag external/nss extras/CustomTarget_tplpresnt.mk extras/source filter/Configuration_filter.mk filter/Library_flash.mk filter/Library_svgfilter.mk filter/Module_filter.mk filter/qa filter/source filter/uiconfig filter/UIConfig_filter.mk formula/source fpicker/source framework/inc framework/qa framework/source helpcontent2 i18nlangtag/source icon-themes/sukapura icon-themes/sukapura_svg include/basegfx include/com include/drawinglayer include/editeng include/formula include/i18nlangtag include/IwyuFilter_include.yaml include/oox include/rtl include/sal include/sax include/sfx2 include/svtools include/svx include/tools include/vcl include/xmloff linguistic/source odk/examples officecfg/files.mk officecfg/registry oox/source postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk qadevOOo/tests readlicense_oo/license reportdesign/inc reportdesign/IwyuFilter_reportdesign.yaml reportdesign/source Repository.mk sax/CppunitTest_sax_parser.mk sax/qa sax/source sc/CppunitTest_sc_ucalc.mk sc/Library_sc.mk scp2/source sc/qa scripting/source sc/source sc/uiconfig sd/CppunitTest_sd_uimpress.mk sdext/source sd/Library_sd.mk sd/qa sd/res sd/source sfx2/inc sfx2/Library_sfx.mk sfx2/source slideshow/source solenv/bin solenv/clang-format solenv/flatpak-manifest.in solenv/inc solenv/sanitizers st armath/inc starmath/source svgio/CppunitTest_svgio.mk svgio/inc svgio/Library_svgio.mk svgio/source svl/source svtools/inc svtools/Library_svt.mk svtools/source svtools/uiconfig svtools/UIConfig_svt.mk svx/CppunitTest_svx_unit.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk svx/util sw/CppunitTest_sw_uibase_dochdl.mk sw/CppunitTest_sw_uwriter.mk sw/inc sw/Library_sw.mk sw/Library_swui.mk sw/Module_sw.mk sw/qa sw/source sw/uiconfig sysui/desktop toolkit/inc toolkit/source translations ucb/README uitest/writer_tests5 UnoControls/source unoxml/CppunitTest_unoxml_domtest.mk unoxml/inc unoxml/qa unoxml/source uui/source vbahelper/source vcl/commonfuzzer.mk vcl/CppunitTest_vcl_graphic_test.mk vcl/inc vcl/Library_vcl.mk vcl/osx vcl/qa vcl/skia vcl/source vcl/uiconfig vcl/unx vcl/win writerfilter/source xmloff/inc xmloff/source xmloff/util

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 26 05:38:30 UTC 2020


Rebased ref, commits from common ancestor:
commit 32c1978b18142d646428505f3877018ce5e0a4ec
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Apr 23 21:59:32 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 20:42:21 2020 +0200

    Graphic: cleanup private, public declarations, remove friend
    
    Friend GraphicObject doesn't seem to be needed anymore.
    
    Change-Id: I629ddaabf0c1802e986af42b457cd6322d2fd04d

diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index b304cfb7ac97..17fdd6336e2d 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -83,15 +83,12 @@ class Image;
 class VCL_DLLPUBLIC Graphic
 {
 private:
-
     std::shared_ptr<ImpGraphic> mxImpGraphic;
+    SAL_DLLPRIVATE void ImplTestRefCount();
 
 public:
-
-    SAL_DLLPRIVATE void ImplTestRefCount();
     SAL_DLLPRIVATE ImpGraphic* ImplGetImpGraphic() const { return mxImpGraphic.get(); }
 
-public:
                     Graphic();
                     Graphic( const GraphicExternalLink& rGraphicLink );
                     Graphic( const Graphic& rGraphic );
@@ -180,16 +177,11 @@ public:
 
     OString getUniqueID() const;
 
-public:
-
     std::shared_ptr<GraphicReader>& GetReaderContext();
     void                            SetReaderContext( const std::shared_ptr<GraphicReader> &pReader );
     void                            SetDummyContext(bool value);
     bool                            IsDummyContext() const;
-private:
-    friend class GraphicObject;
 
-public:
     void            SetGfxLink(const std::shared_ptr<GfxLink>& rGfxLink);
     std::shared_ptr<GfxLink> GetSharedGfxLink() const;
     GfxLink         GetGfxLink() const;
@@ -200,8 +192,6 @@ public:
     friend VCL_DLLPUBLIC void WriteGraphic(SvStream& rOStream, const Graphic& rGraphic);
     friend VCL_DLLPUBLIC void ReadGraphic(SvStream& rIStream, Graphic& rGraphic);
 
-public:
-
     const std::shared_ptr<VectorGraphicData>& getVectorGraphicData() const;
 
     /// Get the page number of the multi-page source this Graphic is rendered from.
commit 9e95e83c4190809df64b843d7a52939894166627
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Apr 23 16:22:26 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 20:42:21 2020 +0200

    vcl: add tests for GraphicNativeMetadata
    
    Test the rotation in JPEG metadata is what we expect.
    
    Change-Id: I5ee2d646a5257d5695c51f37fb6fe795dcb9af50

diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx
index 318fb724bf25..3dbd7ff8a7d2 100644
--- a/include/vcl/GraphicNativeMetadata.hxx
+++ b/include/vcl/GraphicNativeMetadata.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <vcl/graph.hxx>
+#include <tools/stream.hxx>
 
 class VCL_DLLPUBLIC GraphicNativeMetadata final
 {
@@ -30,6 +31,9 @@ public:
     ~GraphicNativeMetadata();
 
     bool read(Graphic const& rGraphic);
+    bool read(SvStream& rStream);
+
+    // counter-clock-wise rotation in permille
     sal_uInt16 getRotation() const { return mRotation; }
 };
 
diff --git a/vcl/CppunitTest_vcl_graphic_test.mk b/vcl/CppunitTest_vcl_graphic_test.mk
index 63dea32f9757..7b042f84d7da 100644
--- a/vcl/CppunitTest_vcl_graphic_test.mk
+++ b/vcl/CppunitTest_vcl_graphic_test.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_graphic_test, \
     vcl/qa/cppunit/GraphicTest \
     vcl/qa/cppunit/GraphicDescriptorTest \
     vcl/qa/cppunit/GraphicFormatDetectorTest \
+    vcl/qa/cppunit/GraphicNativeMetadataTest \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,vcl_graphic_test,\
diff --git a/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx b/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx
new file mode 100644
index 000000000000..4fde27f53354
--- /dev/null
+++ b/vcl/qa/cppunit/GraphicNativeMetadataTest.cxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <cppunit/TestAssert.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <unotest/bootstrapfixturebase.hxx>
+
+#include <vcl/GraphicNativeMetadata.hxx>
+#include <vcl/graphicfilter.hxx>
+#include <tools/stream.hxx>
+
+using namespace css;
+
+namespace
+{
+class GraphicNativeMetadataTest : public test::BootstrapFixtureBase
+{
+    OUString getFullUrl(const OUString& sFileName)
+    {
+        return m_directories.getURLFromSrc("/vcl/qa/cppunit/data/") + sFileName;
+    }
+
+    void testReadFromGraphic();
+    void testExifRotationJpeg();
+
+    CPPUNIT_TEST_SUITE(GraphicNativeMetadataTest);
+    CPPUNIT_TEST(testReadFromGraphic);
+    CPPUNIT_TEST(testExifRotationJpeg);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void GraphicNativeMetadataTest::testReadFromGraphic()
+{
+    SvFileStream aFileStream(getFullUrl("Exif1_180.jpg"), StreamMode::READ);
+    GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+
+    // don't load the grpahic, but try to get the metadata
+    Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aFileStream);
+
+    {
+        GraphicNativeMetadata aMetadata;
+        aMetadata.read(aFileStream);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(1800), aMetadata.getRotation());
+        // just the metadata shouldn't make the graphic available
+        CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+    }
+
+    // now load, and it should still work the same
+    {
+        aGraphic.makeAvailable();
+        CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
+
+        GraphicNativeMetadata aMetadata;
+        aMetadata.read(aFileStream);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(1800), aMetadata.getRotation());
+    }
+}
+
+void GraphicNativeMetadataTest::testExifRotationJpeg()
+{
+    {
+        // No rotation in metadata
+        SvFileStream aFileStream(getFullUrl("Exif1.jpg"), StreamMode::READ);
+        GraphicNativeMetadata aMetadata;
+        aMetadata.read(aFileStream);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(0), aMetadata.getRotation());
+    }
+    {
+        // Rotation 90 degree clock-wise = 270 degree counter-clock-wise
+        SvFileStream aFileStream(getFullUrl("Exif1_090CW.jpg"), StreamMode::READ);
+        GraphicNativeMetadata aMetadata;
+        aMetadata.read(aFileStream);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(2700), aMetadata.getRotation());
+    }
+    {
+        // Rotation 180 degree
+        SvFileStream aFileStream(getFullUrl("Exif1_180.jpg"), StreamMode::READ);
+        GraphicNativeMetadata aMetadata;
+        aMetadata.read(aFileStream);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(1800), aMetadata.getRotation());
+    }
+    {
+        // Rotation 270 degree clock-wise = 90 degree counter-clock-wise
+        SvFileStream aFileStream(getFullUrl("Exif1_270CW.jpg"), StreamMode::READ);
+        GraphicNativeMetadata aMetadata;
+        aMetadata.read(aFileStream);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(900), aMetadata.getRotation());
+    }
+}
+
+} // anonymous namespace
+
+CPPUNIT_TEST_SUITE_REGISTRATION(GraphicNativeMetadataTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qa/cppunit/data/Exif1.jpg b/vcl/qa/cppunit/data/Exif1.jpg
new file mode 100644
index 000000000000..e2aace2daafb
Binary files /dev/null and b/vcl/qa/cppunit/data/Exif1.jpg differ
diff --git a/vcl/qa/cppunit/data/Exif1_090CW.jpg b/vcl/qa/cppunit/data/Exif1_090CW.jpg
new file mode 100644
index 000000000000..dd13dba4c9e0
Binary files /dev/null and b/vcl/qa/cppunit/data/Exif1_090CW.jpg differ
diff --git a/vcl/qa/cppunit/data/Exif1_180.jpg b/vcl/qa/cppunit/data/Exif1_180.jpg
new file mode 100644
index 000000000000..ba4dfc3796a9
Binary files /dev/null and b/vcl/qa/cppunit/data/Exif1_180.jpg differ
diff --git a/vcl/qa/cppunit/data/Exif1_270CW.jpg b/vcl/qa/cppunit/data/Exif1_270CW.jpg
new file mode 100644
index 000000000000..7f7cdfb909bb
Binary files /dev/null and b/vcl/qa/cppunit/data/Exif1_270CW.jpg differ
diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx b/vcl/source/filter/GraphicNativeMetadata.cxx
index 132a51a52391..6eb60cd67374 100644
--- a/vcl/source/filter/GraphicNativeMetadata.cxx
+++ b/vcl/source/filter/GraphicNativeMetadata.cxx
@@ -18,10 +18,7 @@
  */
 
 #include <vcl/GraphicNativeMetadata.hxx>
-
 #include <vcl/gfxlink.hxx>
-#include <tools/stream.hxx>
-
 #include "jpeg/Exif.hxx"
 #include <memory>
 
@@ -47,8 +44,15 @@ bool GraphicNativeMetadata::read(Graphic const& rGraphic)
     memcpy(aBuffer.get(), aLink.GetData(), aDataSize);
     SvMemoryStream aMemoryStream(aBuffer.get(), aDataSize, StreamMode::READ);
 
+    read(aMemoryStream);
+
+    return true;
+}
+
+bool GraphicNativeMetadata::read(SvStream& rStream)
+{
     Exif aExif;
-    aExif.read(aMemoryStream);
+    aExif.read(rStream);
     mRotation = aExif.getRotation();
 
     return true;
commit 8a61ed66f0c2a9926e6d72dfe21044ac950c4bb2
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 22 19:52:19 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 20:42:21 2020 +0200

    ImpGraphic: rename ImplCreateSwapInfo and simplify
    
    ImplCreateSwapInfo changed to createSwapInfo.
    Flatten the code body
    
    Change-Id: I5865373d0b7f3cc717a9600bcf6fd198e8320e35

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index ec7a43f30bc8..3a3bdf88c866 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -116,7 +116,7 @@ private:
         return mpGraphicID->getIDString();
     }
 
-    void                ImplCreateSwapInfo();
+    void                createSwapInfo();
     void                ImplClearGraphics();
     void                ImplClear();
 
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 1b0797889525..6cace1f79d79 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -384,18 +384,18 @@ const std::shared_ptr<VectorGraphicData>& ImpGraphic::getVectorGraphicData() con
     return maVectorGraphicData;
 }
 
-void ImpGraphic::ImplCreateSwapInfo()
+void ImpGraphic::createSwapInfo()
 {
-    if (!isSwappedOut())
-    {
-        maSwapInfo.maPrefMapMode = ImplGetPrefMapMode();
-        maSwapInfo.maPrefSize = ImplGetPrefSize();
-        maSwapInfo.mbIsAnimated = ImplIsAnimated();
-        maSwapInfo.mbIsEPS = ImplIsEPS();
-        maSwapInfo.mbIsTransparent = ImplIsTransparent();
-        maSwapInfo.mbIsAlpha = ImplIsAlpha();
-        maSwapInfo.mnAnimationLoopCount = ImplGetAnimationLoopCount();
-    }
+    if (isSwappedOut())
+        return;
+
+    maSwapInfo.maPrefMapMode = ImplGetPrefMapMode();
+    maSwapInfo.maPrefSize = ImplGetPrefSize();
+    maSwapInfo.mbIsAnimated = ImplIsAnimated();
+    maSwapInfo.mbIsEPS = ImplIsEPS();
+    maSwapInfo.mbIsTransparent = ImplIsTransparent();
+    maSwapInfo.mbIsAlpha = ImplIsAlpha();
+    maSwapInfo.mnAnimationLoopCount = ImplGetAnimationLoopCount();
 }
 
 void ImpGraphic::ImplClearGraphics()
@@ -1387,12 +1387,13 @@ bool ImpGraphic::swapOut()
     // Check if writing was successfull
     if (bResult)
     {
-        // We have swapped out, so can clean memory
-        mbSwapOut = true;
-        mpSwapFile = std::move(pSwapFile);
-        ImplCreateSwapInfo();
+        // We have swapped out, so can clean memory and prepare swap info
+        createSwapInfo();
         ImplClearGraphics();
 
+        mpSwapFile = std::move(pSwapFile);
+        mbSwapOut = true;
+
         // Signal to manager that we have swapped out
         vcl::graphic::Manager::get().swappedOut(this);
     }
commit 99c1c9befee20313233276cb10cea390bde7c1e3
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 22 19:21:22 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 20:42:20 2020 +0200

    ImpGraphic: move content of swapOutToStream into swapOut
    
    Change-Id: Iec0227b1e1ceebda961e158315ea5e56c2d33204

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 64f8770c7686..ec7a43f30bc8 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -177,7 +177,6 @@ private:
     bool                ImplWriteEmbedded( SvStream& rOStream );
 
     bool                swapInFromStream(SvStream* pIStm);
-    bool                swapOutToStream(SvStream* pOStm);
 
     bool                ImplIsDummyContext() const { return mbDummyContext; }
     void                ImplSetLink( const std::shared_ptr<GfxLink>& );
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 4a3e26946678..1b0797889525 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1356,59 +1356,50 @@ bool ImpGraphic::swapOut()
     if (isSwappedOut())
         return false;
 
+    // Create a temp filename for the swap file
     utl::TempFile aTempFile;
     const INetURLObject aTempFileURL(aTempFile.GetURL());
 
+    // Create a swap file
     std::shared_ptr<ImpSwapFile> pSwapFile(new ImpSwapFile(aTempFileURL, getOriginURL()), o3tl::default_delete<ImpSwapFile>());
 
-    std::unique_ptr<SvStream> xOutputStream = pSwapFile->openOutputStream();
+    bool bResult = false;
 
-    if (!xOutputStream)
-        return false;
+    // Open a stream to write the swap file to
+    {
+        std::unique_ptr<SvStream> xOutputStream = pSwapFile->openOutputStream();
 
-    xOutputStream->SetVersion(SOFFICE_FILEFORMAT_50);
-    xOutputStream->SetCompressMode(SvStreamCompressFlags::NATIVE);
+        if (!xOutputStream)
+            return false;
 
-    bool bResult = swapOutToStream(xOutputStream.get());
+        // Write to stream
+        xOutputStream->SetVersion(SOFFICE_FILEFORMAT_50);
+        xOutputStream->SetCompressMode(SvStreamCompressFlags::NATIVE);
+        xOutputStream->SetBufferSize(GRAPHIC_STREAMBUFSIZE);
 
-    xOutputStream.reset();
+        if (!xOutputStream->GetError() && ImplWriteEmbedded(*xOutputStream))
+        {
+            xOutputStream->Flush();
+            bResult = !xOutputStream->GetError();
+        }
+    }
 
+    // Check if writing was successfull
     if (bResult)
     {
-        mpSwapFile = pSwapFile;
+        // We have swapped out, so can clean memory
+        mbSwapOut = true;
+        mpSwapFile = std::move(pSwapFile);
+        ImplCreateSwapInfo();
+        ImplClearGraphics();
+
+        // Signal to manager that we have swapped out
         vcl::graphic::Manager::get().swappedOut(this);
     }
 
     return bResult;
 }
 
-bool ImpGraphic::swapOutToStream(SvStream* xOStm)
-{
-    if( !xOStm )
-    {
-        SAL_WARN("vcl.gdi", "Graphic SwapOut: No stream for swap out!");
-        return false;
-    }
-
-    xOStm->SetBufferSize( GRAPHIC_STREAMBUFSIZE );
-
-    bool bRet = false;
-
-    if( !xOStm->GetError() && ImplWriteEmbedded( *xOStm ) )
-    {
-        xOStm->Flush();
-
-        if( !xOStm->GetError() )
-        {
-            ImplCreateSwapInfo();
-            ImplClearGraphics();
-            bRet = mbSwapOut = true;
-        }
-    }
-
-    return bRet;
-}
-
 bool ImpGraphic::ensureAvailable() const
 {
     auto pThis = const_cast<ImpGraphic*>(this);
commit c810809dc8cbcd69cf1ee6d6771c364a84cee590
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 22 10:03:16 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 20:40:37 2020 +0200

    ImpGraphic: move filename handling from swapout to ImpSwapFile
    
    Change-Id: I30930f61385e31e7754d6653ff2eecfea61ce4e1

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 610d98b9528c..4a3e26946678 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -74,8 +74,8 @@ private:
     OUString maOriginURL;
 
 public:
-    ImpSwapFile(INetURLObject const & aSwapURL, OUString const & rOriginURL)
-        : maSwapURL(aSwapURL)
+    ImpSwapFile(INetURLObject const & rSwapURL, OUString const & rOriginURL)
+        : maSwapURL(rSwapURL)
         , maOriginURL(rOriginURL)
     {
     }
@@ -85,8 +85,33 @@ public:
         utl::UCBContentHelper::Kill(maSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
     }
 
-    INetURLObject getSwapURL() { return maSwapURL; }
+    INetURLObject getSwapURL()
+    {
+        return maSwapURL;
+    }
+
+    OUString getSwapURLString()
+    {
+        return maSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+    }
+
     OUString const & getOriginURL() { return maOriginURL; }
+
+    std::unique_ptr<SvStream> openOutputStream()
+    {
+        OUString sSwapURL = getSwapURLString();
+        if (!sSwapURL.isEmpty())
+        {
+            try
+            {
+                return utl::UcbStreamHelper::CreateStream(sSwapURL, StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE);
+            }
+            catch (const css::uno::Exception&)
+            {
+            }
+        }
+        return std::unique_ptr<SvStream>();
+    }
 };
 
 OUString ImpGraphic::getSwapFileURL()
@@ -1333,39 +1358,26 @@ bool ImpGraphic::swapOut()
 
     utl::TempFile aTempFile;
     const INetURLObject aTempFileURL(aTempFile.GetURL());
-    OUString sTempFileURLString = aTempFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 
-    if (sTempFileURLString.isEmpty())
-        return false;
-    std::unique_ptr<SvStream> xOutputStream;
+    std::shared_ptr<ImpSwapFile> pSwapFile(new ImpSwapFile(aTempFileURL, getOriginURL()), o3tl::default_delete<ImpSwapFile>());
 
-    try
-    {
-        xOutputStream = utl::UcbStreamHelper::CreateStream(sTempFileURLString, StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE);
-    }
-    catch (const css::uno::Exception&)
-    {
-    }
+    std::unique_ptr<SvStream> xOutputStream = pSwapFile->openOutputStream();
 
     if (!xOutputStream)
         return false;
+
     xOutputStream->SetVersion(SOFFICE_FILEFORMAT_50);
     xOutputStream->SetCompressMode(SvStreamCompressFlags::NATIVE);
 
     bool bResult = swapOutToStream(xOutputStream.get());
 
-    if (bResult)
-    {
-        mpSwapFile.reset(new ImpSwapFile(aTempFileURL, getOriginURL()), o3tl::default_delete<ImpSwapFile>());
-    }
-    else
-    {
-        xOutputStream.reset();
-        utl::UCBContentHelper::Kill(sTempFileURLString);
-    }
+    xOutputStream.reset();
 
     if (bResult)
+    {
+        mpSwapFile = pSwapFile;
         vcl::graphic::Manager::get().swappedOut(this);
+    }
 
     return bResult;
 }
commit 99ffd3a87c4581d67976ef85b6d2a4f7e65077d1
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Apr 20 22:29:04 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:47:02 2020 +0200

    ImpGraphic: clean-up and simplify swapOut()
    
    Change-Id: I3e578c3172fcea341a218798843cd750971a5af1

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 9eb42fec39e8..610d98b9528c 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1328,44 +1328,46 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
 
 bool ImpGraphic::swapOut()
 {
-
-    if( isSwappedOut() )
+    if (isSwappedOut())
         return false;
 
-    ::utl::TempFile     aTempFile;
-    const INetURLObject aTmpURL( aTempFile.GetURL() );
+    utl::TempFile aTempFile;
+    const INetURLObject aTempFileURL(aTempFile.GetURL());
+    OUString sTempFileURLString = aTempFileURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 
-    if( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ).isEmpty() )
+    if (sTempFileURLString.isEmpty())
         return false;
+    std::unique_ptr<SvStream> xOutputStream;
 
-    std::unique_ptr<SvStream> xOStm;
     try
     {
-        xOStm = ::utl::UcbStreamHelper::CreateStream( aTmpURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE );
+        xOutputStream = utl::UcbStreamHelper::CreateStream(sTempFileURLString, StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE);
     }
-    catch( const css::uno::Exception& )
+    catch (const css::uno::Exception&)
     {
     }
-    if( !xOStm )
+
+    if (!xOutputStream)
         return false;
+    xOutputStream->SetVersion(SOFFICE_FILEFORMAT_50);
+    xOutputStream->SetCompressMode(SvStreamCompressFlags::NATIVE);
 
-    xOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
-    xOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
+    bool bResult = swapOutToStream(xOutputStream.get());
 
-    bool bRet = swapOutToStream( xOStm.get() );
-    if( bRet )
+    if (bResult)
     {
-        mpSwapFile.reset(new ImpSwapFile(aTmpURL, getOriginURL()), o3tl::default_delete<ImpSwapFile>());
+        mpSwapFile.reset(new ImpSwapFile(aTempFileURL, getOriginURL()), o3tl::default_delete<ImpSwapFile>());
     }
     else
     {
-        xOStm.reset();
-        utl::UCBContentHelper::Kill(aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+        xOutputStream.reset();
+        utl::UCBContentHelper::Kill(sTempFileURLString);
     }
 
-    if (bRet)
+    if (bResult)
         vcl::graphic::Manager::get().swappedOut(this);
-    return bRet;
+
+    return bResult;
 }
 
 bool ImpGraphic::swapOutToStream(SvStream* xOStm)
commit 4c3bebcf292fcd1dcbc54274f40e42d02e3b8d7e
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Apr 20 22:17:01 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:45:09 2020 +0200

    ImpGraphic: encapsulate members of ImpSwapFile
    
    Change-Id: I882d30f2f27149c865160b3fa68fa974701cea71

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 0088062352ac..64f8770c7686 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -43,7 +43,7 @@ struct ImpSwapInfo
 
 class OutputDevice;
 class GfxLink;
-struct ImpSwapFile;
+class ImpSwapFile;
 class GraphicConversionParameters;
 class ImpGraphic;
 
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index d4634f1c58ca..9eb42fec39e8 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -67,21 +67,32 @@ constexpr sal_uInt32 constPdfMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') <<
 
 using namespace com::sun::star;
 
-struct ImpSwapFile
+class ImpSwapFile
 {
-    INetURLObject aSwapURL;
+private:
+    INetURLObject maSwapURL;
     OUString maOriginURL;
 
+public:
+    ImpSwapFile(INetURLObject const & aSwapURL, OUString const & rOriginURL)
+        : maSwapURL(aSwapURL)
+        , maOriginURL(rOriginURL)
+    {
+    }
+
     ~ImpSwapFile() COVERITY_NOEXCEPT_FALSE
     {
-        utl::UCBContentHelper::Kill(aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+        utl::UCBContentHelper::Kill(maSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
     }
+
+    INetURLObject getSwapURL() { return maSwapURL; }
+    OUString const & getOriginURL() { return maOriginURL; }
 };
 
 OUString ImpGraphic::getSwapFileURL()
 {
     if (mpSwapFile)
-        return mpSwapFile->aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+        return mpSwapFile->getSwapURL().GetMainURL(INetURLObject::DecodeMechanism::NONE);
     return OUString();
 }
 
@@ -1344,9 +1355,7 @@ bool ImpGraphic::swapOut()
     bool bRet = swapOutToStream( xOStm.get() );
     if( bRet )
     {
-        mpSwapFile.reset(new ImpSwapFile, o3tl::default_delete<ImpSwapFile>());
-        mpSwapFile->aSwapURL = aTmpURL;
-        mpSwapFile->maOriginURL = getOriginURL();
+        mpSwapFile.reset(new ImpSwapFile(aTmpURL, getOriginURL()), o3tl::default_delete<ImpSwapFile>());
     }
     else
     {
@@ -1436,7 +1445,7 @@ bool ImpGraphic::swapIn()
         OUString aSwapURL;
 
         if( mpSwapFile )
-            aSwapURL = mpSwapFile->aSwapURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+            aSwapURL = mpSwapFile->getSwapURL().GetMainURL( INetURLObject::DecodeMechanism::NONE );
 
         if( !aSwapURL.isEmpty() )
         {
@@ -1457,7 +1466,7 @@ bool ImpGraphic::swapIn()
                 bRet = swapInFromStream(xIStm.get());
                 xIStm.reset();
                 if (mpSwapFile)
-                    setOriginURL(mpSwapFile->maOriginURL);
+                    setOriginURL(mpSwapFile->getOriginURL());
                 mpSwapFile.reset();
             }
         }
commit fd967c96db8c5cfcbcc7b9ca040db2b94a817bbf
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Apr 25 12:06:53 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:35 2020 +0200

    Test swapping of Graphic
    
    Change-Id: I895002aa31380d2b5bc2593e66080f3fc94034e7

diff --git a/vcl/CppunitTest_vcl_graphic_test.mk b/vcl/CppunitTest_vcl_graphic_test.mk
index fd5c7aeb039b..63dea32f9757 100644
--- a/vcl/CppunitTest_vcl_graphic_test.mk
+++ b/vcl/CppunitTest_vcl_graphic_test.mk
@@ -39,19 +39,9 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_graphic_test, \
 ))
 
 $(eval $(call gb_CppunitTest_use_sdk_api,vcl_graphic_test))
-
 $(eval $(call gb_CppunitTest_use_ure,vcl_graphic_test))
 $(eval $(call gb_CppunitTest_use_vcl,vcl_graphic_test))
-
-$(eval $(call gb_CppunitTest_use_components,vcl_graphic_test,\
-    configmgr/source/configmgr \
-    i18npool/util/i18npool \
-    ucb/source/core/ucb1 \
-    unotools/util/utl \
-    emfio/emfio \
-    drawinglayer/drawinglayer \
-))
-
+$(eval $(call gb_CppunitTest_use_rdb,vcl_graphic_test,services))
 $(eval $(call gb_CppunitTest_use_configuration,vcl_graphic_test))
 
 # we need to explicitly depend on Library_gie because it's dynamically loaded for .gif
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 92dd0c078519..0088062352ac 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_VCL_INC_IMPGRAPH_HXX
 #define INCLUDED_VCL_INC_IMPGRAPH_HXX
 
+#include <vcl/dllapi.h>
 #include <vcl/GraphicExternalLink.hxx>
 #include <vcl/gdimtf.hxx>
 #include <vcl/graph.hxx>
@@ -46,7 +47,7 @@ struct ImpSwapFile;
 class GraphicConversionParameters;
 class ImpGraphic;
 
-class ImpGraphic final
+class VCL_DLLPUBLIC ImpGraphic final
 {
     friend class Graphic;
     friend class GraphicID;
@@ -175,14 +176,9 @@ private:
     bool                ImplReadEmbedded( SvStream& rIStream );
     bool                ImplWriteEmbedded( SvStream& rOStream );
 
-    bool                swapIn();
     bool                swapInFromStream(SvStream* pIStm);
-
-    bool                swapOut();
     bool                swapOutToStream(SvStream* pOStm);
 
-    bool                isSwappedOut() const { return mbSwapOut;}
-
     bool                ImplIsDummyContext() const { return mbDummyContext; }
     void                ImplSetLink( const std::shared_ptr<GfxLink>& );
     std::shared_ptr<GfxLink> ImplGetSharedGfxLink() const;
@@ -206,6 +202,12 @@ private:
     bool loadPrepared();
 
     sal_Int32 getPageNumber() const;
+
+public:
+    bool swapIn();
+    bool swapOut();
+    bool isSwappedOut() const { return mbSwapOut; }
+    OUString getSwapFileURL();
 };
 
 #endif // INCLUDED_VCL_INC_IMPGRAPH_HXX
diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index e67ba6ff7ee7..c86c85d55171 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -19,6 +19,11 @@
 #include <vcl/graphicfilter.hxx>
 #include <tools/stream.hxx>
 #include <unotest/directories.hxx>
+#include <comphelper/DirectoryHelper.hxx>
+#include <comphelper/hash.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+
+#include <impgraph.hxx>
 
 using namespace css;
 
@@ -31,6 +36,8 @@ class GraphicTest : public CppUnit::TestFixture
     void testUnloadedGraphicWmf();
     void testUnloadedGraphicAlpha();
     void testUnloadedGraphicSizeUnit();
+    void testSwapping();
+    void testSwappingVectorGraphic();
 
     CPPUNIT_TEST_SUITE(GraphicTest);
     CPPUNIT_TEST(testUnloadedGraphic);
@@ -38,6 +45,8 @@ class GraphicTest : public CppUnit::TestFixture
     CPPUNIT_TEST(testUnloadedGraphicWmf);
     CPPUNIT_TEST(testUnloadedGraphicAlpha);
     CPPUNIT_TEST(testUnloadedGraphicSizeUnit);
+    CPPUNIT_TEST(testSwapping);
+    CPPUNIT_TEST(testSwappingVectorGraphic);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -82,6 +91,71 @@ Graphic makeUnloadedGraphic(OUString const& sType, bool alpha = false)
     return rGraphicFilter.ImportUnloadedGraphic(aStream);
 }
 
+std::string toHexString(const std::vector<unsigned char>& a)
+{
+    std::stringstream aStrm;
+    for (auto& i : a)
+    {
+        aStrm << std::setw(2) << std::setfill('0') << std::hex << static_cast<int>(i);
+    }
+
+    return aStrm.str();
+}
+
+std::unique_ptr<SvStream> createStream(OUString const& rSwapFileURL)
+{
+    std::unique_ptr<SvStream> xStream;
+
+    try
+    {
+        xStream = ::utl::UcbStreamHelper::CreateStream(
+            rSwapFileURL, StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE);
+    }
+    catch (const css::uno::Exception&)
+    {
+    }
+
+    return xStream;
+}
+
+std::vector<unsigned char> calculateHash(std::unique_ptr<SvStream>& rStream)
+{
+    comphelper::Hash aHashEngine(comphelper::HashType::SHA1);
+    const sal_uInt32 nSize(rStream->remainingSize());
+    std::vector<sal_uInt8> aData(nSize);
+    aHashEngine.update(aData.data(), nSize);
+    return aHashEngine.finalize();
+}
+
+bool checkBitmap(Graphic& rGraphic)
+{
+    bool bResult = true;
+
+    Bitmap aBitmap(rGraphic.GetBitmapEx().GetBitmap());
+    {
+        Bitmap::ScopedReadAccess pReadAccess(aBitmap);
+        for (long y = 0; y < rGraphic.GetSizePixel().Height(); y++)
+        {
+            for (long x = 0; x < rGraphic.GetSizePixel().Width(); x++)
+            {
+                if (pReadAccess->HasPalette())
+                {
+                    sal_uInt32 nIndex = pReadAccess->GetPixelIndex(y, x);
+                    Color aColor = pReadAccess->GetPaletteColor(nIndex);
+                    bResult &= (aColor == Color(0xff, 0x00, 0x00));
+                }
+                else
+                {
+                    Color aColor = pReadAccess->GetPixel(y, x);
+                    bResult &= (aColor == Color(0xff, 0x00, 0x00));
+                }
+            }
+        }
+    }
+
+    return bResult;
+}
+
 char const DATA_DIRECTORY[] = "/vcl/qa/cppunit/data/";
 
 void GraphicTest::testUnloadedGraphic()
@@ -114,6 +188,14 @@ void GraphicTest::testUnloadedGraphic()
     CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
     CPPUNIT_ASSERT(aGraphic.GetSizeBytes() > 0);
     CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
+
+    //check Type
+    aGraphic = makeUnloadedGraphic("png");
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+    CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.makeAvailable());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
+    CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType());
 }
 
 void GraphicTest::testUnloadedGraphicLoading()
@@ -131,29 +213,9 @@ void GraphicTest::testUnloadedGraphicLoading()
         CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
         CPPUNIT_ASSERT(aGraphic.GetSizeBytes() > 0);
         CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
-        Bitmap aBitmap(aGraphic.GetBitmapEx().GetBitmap());
 
-        {
-            Bitmap::ScopedReadAccess pReadAccess(aBitmap);
-            for (long y = 0; y < aGraphic.GetSizePixel().Height(); y++)
-            {
-                for (long x = 0; x < aGraphic.GetSizePixel().Width(); x++)
-                {
-                    if (pReadAccess->HasPalette())
-                    {
-                        Color aColor
-                            = pReadAccess->GetPaletteColor(pReadAccess->GetPixelIndex(y, x));
-                        CPPUNIT_ASSERT_EQUAL(OUString("ff0000"), aColor.AsRGBHexString());
-                    }
-                    else
-                    {
-                        Color aColor = pReadAccess->GetPixel(y, x);
-                        if (sFormat != "jpg")
-                            CPPUNIT_ASSERT_EQUAL(OUString("ff0000"), aColor.AsRGBHexString());
-                    }
-                }
-            }
-        }
+        if (sFormat != "jpg")
+            CPPUNIT_ASSERT_EQUAL(true, checkBitmap(aGraphic));
     }
 }
 
@@ -216,6 +278,132 @@ void GraphicTest::testUnloadedGraphicSizeUnit()
     CPPUNIT_ASSERT_EQUAL(Size(400, 363), aGraphic.GetPrefSize());
 }
 
+void GraphicTest::testSwapping()
+{
+    // Prepare Graphic from a PNG image first
+    Graphic aGraphic = makeUnloadedGraphic("png");
+
+    CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.makeAvailable());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
+
+    CPPUNIT_ASSERT_EQUAL(120L, aGraphic.GetSizePixel().Width());
+    CPPUNIT_ASSERT_EQUAL(100L, aGraphic.GetSizePixel().Height());
+    CPPUNIT_ASSERT_EQUAL(BitmapChecksum(0xF5331397837B58EB), aGraphic.GetChecksum());
+
+    CPPUNIT_ASSERT_EQUAL(sal_uInt32(319), aGraphic.GetGfxLink().GetDataSize());
+
+    // We loaded the Graphic and made it available
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut());
+    // Get the declared byte size of the graphic
+    sal_uLong rByteSize = aGraphic.GetSizeBytes();
+    OUString rSwapFileURL = aGraphic.ImplGetImpGraphic()->getSwapFileURL();
+    CPPUNIT_ASSERT_EQUAL(true, rSwapFileURL.isEmpty());
+
+    // Swapping out
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.ImplGetImpGraphic()->swapOut());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.ImplGetImpGraphic()->isSwappedOut());
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+
+    // Byte size doesn't change when we swapped out
+    CPPUNIT_ASSERT_EQUAL(rByteSize, aGraphic.GetSizeBytes());
+
+    // Let's check the swap file
+    rSwapFileURL = aGraphic.ImplGetImpGraphic()->getSwapFileURL();
+    CPPUNIT_ASSERT_EQUAL(true, comphelper::DirectoryHelper::fileExists(rSwapFileURL));
+
+    std::unique_ptr<SvStream> xStream = createStream(rSwapFileURL);
+    CPPUNIT_ASSERT_EQUAL(true, bool(xStream));
+
+    // Check size of the stream
+    CPPUNIT_ASSERT_EQUAL(sal_uLong(445), xStream->remainingSize());
+
+    std::vector<unsigned char> aHash = calculateHash(xStream);
+    CPPUNIT_ASSERT_EQUAL(std::string("304f17d9c56e79b95f6c337dab88709d4f9b61f0"),
+                         toHexString(aHash));
+
+    // Let's swap in
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.makeAvailable());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut());
+
+    CPPUNIT_ASSERT_EQUAL(BitmapChecksum(0xF5331397837B58EB), aGraphic.GetChecksum());
+
+    // File shouldn't be available anymore
+    CPPUNIT_ASSERT_EQUAL(false, comphelper::DirectoryHelper::fileExists(rSwapFileURL));
+
+    // Check the bitmap
+    CPPUNIT_ASSERT_EQUAL(120L, aGraphic.GetSizePixel().Width());
+    CPPUNIT_ASSERT_EQUAL(100L, aGraphic.GetSizePixel().Height());
+    CPPUNIT_ASSERT_EQUAL(true, checkBitmap(aGraphic));
+    CPPUNIT_ASSERT_EQUAL(true, checkBitmap(aGraphic));
+}
+
+void GraphicTest::testSwappingVectorGraphic()
+{
+    test::Directories aDirectories;
+    OUString aURL = aDirectories.getURLFromSrc(DATA_DIRECTORY) + "SimpleExample.svg";
+    SvFileStream aStream(aURL, StreamMode::READ);
+    GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+    Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream);
+
+    CPPUNIT_ASSERT_EQUAL(GraphicType::Bitmap, aGraphic.GetType());
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+
+    // Load the vector graphic
+    CPPUNIT_ASSERT_EQUAL(true, bool(aGraphic.getVectorGraphicData()));
+    CPPUNIT_ASSERT_EQUAL(sal_uInt32(223),
+                         aGraphic.getVectorGraphicData()->getVectorGraphicDataArrayLength());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
+    CPPUNIT_ASSERT_EQUAL(sal_uInt32(223), aGraphic.GetGfxLink().GetDataSize());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
+
+    CPPUNIT_ASSERT_EQUAL(BitmapChecksum(0x97C6486E73B1F712), aGraphic.GetBitmapEx().GetChecksum());
+
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut());
+
+    // Get the declared byte size of the graphic
+    sal_uLong rByteSize = aGraphic.GetSizeBytes();
+    CPPUNIT_ASSERT_EQUAL(sal_uLong(223), rByteSize);
+    OUString rSwapFileURL = aGraphic.ImplGetImpGraphic()->getSwapFileURL();
+    CPPUNIT_ASSERT_EQUAL(true, rSwapFileURL.isEmpty());
+
+    // Swapping out
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.ImplGetImpGraphic()->swapOut());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.ImplGetImpGraphic()->isSwappedOut());
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+
+    // Byte size doesn't change when we swapped out
+    // TODO: In case we don't trigger GetBitmapEx (above) the size is 0
+    CPPUNIT_ASSERT_EQUAL(rByteSize, aGraphic.GetSizeBytes());
+
+    // Let's check the swap file
+    rSwapFileURL = aGraphic.ImplGetImpGraphic()->getSwapFileURL();
+    CPPUNIT_ASSERT_EQUAL(true, comphelper::DirectoryHelper::fileExists(rSwapFileURL));
+
+    std::unique_ptr<SvStream> xStream = createStream(rSwapFileURL);
+    CPPUNIT_ASSERT_EQUAL(true, bool(xStream));
+
+    // Check size of the stream
+    CPPUNIT_ASSERT_EQUAL(sal_uLong(349), xStream->remainingSize());
+
+    std::vector<unsigned char> aHash = calculateHash(xStream);
+    CPPUNIT_ASSERT_EQUAL(std::string("88b4c1c359e3cf7be005fbb46c93ffa6de9dcf4a"),
+                         toHexString(aHash));
+
+    // Let's swap in
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.isAvailable());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.makeAvailable());
+    CPPUNIT_ASSERT_EQUAL(true, aGraphic.isAvailable());
+    CPPUNIT_ASSERT_EQUAL(false, aGraphic.ImplGetImpGraphic()->isSwappedOut());
+
+    CPPUNIT_ASSERT_EQUAL(BitmapChecksum(0x97C6486E73B1F712), aGraphic.GetBitmapEx().GetChecksum());
+
+    // File shouldn't be available anymore
+    CPPUNIT_ASSERT_EQUAL(false, comphelper::DirectoryHelper::fileExists(rSwapFileURL));
+}
+
 } // namespace
 
 CPPUNIT_TEST_SUITE_REGISTRATION(GraphicTest);
diff --git a/vcl/qa/cppunit/data/SimpleExample.svg b/vcl/qa/cppunit/data/SimpleExample.svg
new file mode 100644
index 000000000000..6890b5456cdf
--- /dev/null
+++ b/vcl/qa/cppunit/data/SimpleExample.svg
@@ -0,0 +1,4 @@
+<svg width="50" height="50" version="1.1" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
+ <rect x="0" y="0" width="50" height="50" fill="#aaaaaa"/>
+ <rect x="5" y="5" width="40" height="40" fill="#ff44aa"/>
+</svg>
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 02f8189bd81c..d4634f1c58ca 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -78,6 +78,13 @@ struct ImpSwapFile
     }
 };
 
+OUString ImpGraphic::getSwapFileURL()
+{
+    if (mpSwapFile)
+        return mpSwapFile->aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+    return OUString();
+}
+
 ImpGraphic::ImpGraphic() :
         meType          ( GraphicType::NONE ),
         mnSizeBytes     ( 0 ),
commit a750e0327b31b4524452fdce36bdb30c88061a66
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Apr 20 22:07:58 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:35 2020 +0200

    ImpGraphic: put ImpSwapFile destructor into the class body
    
    Change-Id: Ia3f7c29bf7b84dfa8d5cc044269ed51e09c9f1a3

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index e7e8d71ffd71..02f8189bd81c 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -71,7 +71,11 @@ struct ImpSwapFile
 {
     INetURLObject aSwapURL;
     OUString maOriginURL;
-    ~ImpSwapFile() COVERITY_NOEXCEPT_FALSE;
+
+    ~ImpSwapFile() COVERITY_NOEXCEPT_FALSE
+    {
+        utl::UCBContentHelper::Kill(aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+    }
 };
 
 ImpGraphic::ImpGraphic() :
@@ -360,11 +364,6 @@ void ImpGraphic::ImplClearGraphics()
     maVectorGraphicData.reset();
 }
 
-ImpSwapFile::~ImpSwapFile() COVERITY_NOEXCEPT_FALSE
-{
-    utl::UCBContentHelper::Kill(aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
-}
-
 void ImpGraphic::ImplSetPrepared(bool bAnimated, const Size* pSizeHint)
 {
     mbPrepared = true;
commit 76725c4aff632a1ddf402d43ad595339b709fd00
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Apr 19 10:45:11 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:34 2020 +0200

    ImpGraphic: rename maEx to maBitmapEx
    
    Change-Id: I49dd552010d008cc486c6aaf51e226cc5bf4a1cb

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 8dc3e21de640..92dd0c078519 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -55,7 +55,7 @@ class ImpGraphic final
 private:
 
     GDIMetaFile                  maMetaFile;
-    BitmapEx                     maEx;
+    BitmapEx                     maBitmapEx;
     /// If maEx is empty, this preferred size will be set on it when it gets initialized.
     Size                         maExPrefSize;
     ImpSwapInfo                  maSwapInfo;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 7e82456ba397..e7e8d71ffd71 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -86,7 +86,7 @@ ImpGraphic::ImpGraphic() :
 
 ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic)
     : maMetaFile(rImpGraphic.maMetaFile)
-    , maEx(rImpGraphic.maEx)
+    , maBitmapEx(rImpGraphic.maBitmapEx)
     , maSwapInfo(rImpGraphic.maSwapInfo)
     , mpContext(rImpGraphic.mpContext)
     , mpSwapFile(rImpGraphic.mpSwapFile)
@@ -103,13 +103,13 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic)
     if( rImpGraphic.mpAnimation )
     {
         mpAnimation = std::make_unique<Animation>( *rImpGraphic.mpAnimation );
-        maEx = mpAnimation->GetBitmapEx();
+        maBitmapEx = mpAnimation->GetBitmapEx();
     }
 }
 
 ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic) noexcept
     : maMetaFile(std::move(rImpGraphic.maMetaFile))
-    , maEx(std::move(rImpGraphic.maEx))
+    , maBitmapEx(std::move(rImpGraphic.maBitmapEx))
     , maSwapInfo(std::move(rImpGraphic.maSwapInfo))
     , mpAnimation(std::move(rImpGraphic.mpAnimation))
     , mpContext(std::move(rImpGraphic.mpContext))
@@ -140,7 +140,7 @@ ImpGraphic::ImpGraphic(GraphicExternalLink const & rGraphicExternalLink) :
 }
 
 ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
-        maEx            ( rBitmap ),
+        maBitmapEx            ( rBitmap ),
         meType          ( !rBitmap.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE ),
         mnSizeBytes     ( 0 ),
         mbSwapOut       ( false ),
@@ -151,7 +151,7 @@ ImpGraphic::ImpGraphic( const Bitmap& rBitmap ) :
 }
 
 ImpGraphic::ImpGraphic( const BitmapEx& rBitmapEx ) :
-        maEx            ( rBitmapEx ),
+        maBitmapEx            ( rBitmapEx ),
         meType          ( !rBitmapEx.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE ),
         mnSizeBytes     ( 0 ),
         mbSwapOut       ( false ),
@@ -173,7 +173,7 @@ ImpGraphic::ImpGraphic(const std::shared_ptr<VectorGraphicData>& rVectorGraphicD
 }
 
 ImpGraphic::ImpGraphic( const Animation& rAnimation ) :
-        maEx            ( rAnimation.GetBitmapEx() ),
+        maBitmapEx      ( rAnimation.GetBitmapEx() ),
         mpAnimation     ( std::make_unique<Animation>( rAnimation ) ),
         meType          ( GraphicType::Bitmap ),
         mnSizeBytes     ( 0 ),
@@ -220,11 +220,11 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic )
         if ( rImpGraphic.mpAnimation )
         {
             mpAnimation = std::make_unique<Animation>( *rImpGraphic.mpAnimation );
-            maEx = mpAnimation->GetBitmapEx();
+            maBitmapEx = mpAnimation->GetBitmapEx();
         }
         else
         {
-            maEx = rImpGraphic.maEx;
+            maBitmapEx = rImpGraphic.maBitmapEx;
         }
 
         mbSwapOut = rImpGraphic.mbSwapOut;
@@ -253,7 +253,7 @@ ImpGraphic& ImpGraphic::operator=(ImpGraphic&& rImpGraphic)
     mpContext = std::move(rImpGraphic.mpContext);
     mbDummyContext = rImpGraphic.mbDummyContext;
     mpAnimation = std::move(rImpGraphic.mpAnimation);
-    maEx = std::move(rImpGraphic.maEx);
+    maBitmapEx = std::move(rImpGraphic.maBitmapEx);
     mbSwapOut = rImpGraphic.mbSwapOut;
     mpSwapFile = std::move(rImpGraphic.mpSwapFile);
     mpGfxLink = std::move(rImpGraphic.mpGfxLink);
@@ -315,7 +315,7 @@ bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const
                     if( rImpGraphic.mpAnimation && ( *rImpGraphic.mpAnimation == *mpAnimation ) )
                         bRet = true;
                 }
-                else if( !rImpGraphic.mpAnimation && ( rImpGraphic.maEx == maEx ) )
+                else if( !rImpGraphic.mpAnimation && ( rImpGraphic.maBitmapEx == maBitmapEx ) )
                 {
                     bRet = true;
                 }
@@ -353,7 +353,7 @@ void ImpGraphic::ImplCreateSwapInfo()
 
 void ImpGraphic::ImplClearGraphics()
 {
-    maEx.Clear();
+    maBitmapEx.Clear();
     maMetaFile.Clear();
     mpAnimation.reset();
     mpGfxLink.reset();
@@ -449,7 +449,7 @@ bool ImpGraphic::ImplIsTransparent() const
     }
     else if (meType == GraphicType::Bitmap && !maVectorGraphicData.get())
     {
-        bRet = mpAnimation ? mpAnimation->IsTransparent() : maEx.IsTransparent();
+        bRet = mpAnimation ? mpAnimation->IsTransparent() : maBitmapEx.IsTransparent();
     }
 
     return bRet;
@@ -469,7 +469,7 @@ bool ImpGraphic::ImplIsAlpha() const
     }
     else if (meType == GraphicType::Bitmap)
     {
-        bRet = (nullptr == mpAnimation && maEx.IsAlpha());
+        bRet = (nullptr == mpAnimation && maBitmapEx.IsAlpha());
     }
 
     return bRet;
@@ -520,13 +520,13 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
 
     if( meType == GraphicType::Bitmap )
     {
-        if(maVectorGraphicData.get() && maEx.IsEmpty())
+        if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
         {
-            // use maEx as local buffer for rendered svg
-            const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
+            // use maBitmapEx as local buffer for rendered svg
+            const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
         }
 
-        const BitmapEx& rRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
+        const BitmapEx& rRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maBitmapEx );
 
         aRetBmp = rRetBmpEx.GetBitmap( COL_WHITE );
 
@@ -535,7 +535,7 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
     }
     else if( ( meType != GraphicType::Default ) && ImplIsSupportedGraphic() )
     {
-        if(maEx.IsEmpty())
+        if(maBitmapEx.IsEmpty())
         {
             // calculate size
             ScopedVclPtrInstance< VirtualDevice > aVDev;
@@ -604,12 +604,12 @@ Bitmap ImpGraphic::ImplGetBitmap(const GraphicConversionParameters& rParameters)
 
                 ImplDraw( aVDev.get(), Point(), aDrawSize );
 
-                // use maEx as local buffer for rendered metafile
-                const_cast< ImpGraphic* >(this)->maEx = aVDev->GetBitmapEx( Point(), aVDev->GetOutputSizePixel() );
+                // use maBitmapEx as local buffer for rendered metafile
+                const_cast< ImpGraphic* >(this)->maBitmapEx = aVDev->GetBitmapEx( Point(), aVDev->GetOutputSizePixel() );
             }
         }
 
-        aRetBmp = maEx.GetBitmap();
+        aRetBmp = maBitmapEx.GetBitmap();
     }
 
     if( !!aRetBmp )
@@ -629,13 +629,13 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParamet
 
     if( meType == GraphicType::Bitmap )
     {
-        if(maVectorGraphicData.get() && maEx.IsEmpty())
+        if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
         {
-            // use maEx as local buffer for rendered svg
-            const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
+            // use maBitmapEx as local buffer for rendered svg
+            const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
         }
 
-        aRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maEx );
+        aRetBmpEx = ( mpAnimation ? mpAnimation->GetBitmapEx() : maBitmapEx );
 
         if(rParameters.getSizePixel().Width() || rParameters.getSizePixel().Height())
         {
@@ -646,15 +646,15 @@ BitmapEx ImpGraphic::ImplGetBitmapEx(const GraphicConversionParameters& rParamet
     }
     else if( ( meType != GraphicType::Default ) && ImplIsSupportedGraphic() )
     {
-        if(maEx.IsEmpty())
+        if(maBitmapEx.IsEmpty())
         {
             const ImpGraphic aMonoMask( maMetaFile.GetMonochromeMtf( COL_BLACK ) );
 
-            // use maEx as local buffer for rendered metafile
-            const_cast< ImpGraphic* >(this)->maEx = BitmapEx(ImplGetBitmap(rParameters), aMonoMask.ImplGetBitmap(rParameters));
+            // use maBitmapEx as local buffer for rendered metafile
+            const_cast< ImpGraphic* >(this)->maBitmapEx = BitmapEx(ImplGetBitmap(rParameters), aMonoMask.ImplGetBitmap(rParameters));
         }
 
-        aRetBmpEx = maEx;
+        aRetBmpEx = maBitmapEx;
     }
 
     return aRetBmpEx;
@@ -674,7 +674,7 @@ Animation ImpGraphic::ImplGetAnimation() const
 const BitmapEx& ImpGraphic::ImplGetBitmapExRef() const
 {
     ensureAvailable();
-    return maEx;
+    return maBitmapEx;
 }
 
 const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
@@ -716,27 +716,27 @@ const GDIMetaFile& ImpGraphic::ImplGetGDIMetaFile() const
         // survive copying (change this if not wanted)
         ImpGraphic* pThat = const_cast< ImpGraphic* >(this);
 
-        if(maVectorGraphicData.get() && !maEx)
+        if(maVectorGraphicData.get() && !maBitmapEx)
         {
-            // use maEx as local buffer for rendered svg
-            pThat->maEx = getVectorGraphicReplacement();
+            // use maBitmapEx as local buffer for rendered svg
+            pThat->maBitmapEx = getVectorGraphicReplacement();
         }
 
         // #123983# directly create a metafile with the same PrefSize and PrefMapMode
         // the bitmap has, this will be an always correct metafile
-        if(maEx.IsTransparent())
+        if(maBitmapEx.IsTransparent())
         {
-            pThat->maMetaFile.AddAction(new MetaBmpExScaleAction(Point(), maEx.GetPrefSize(), maEx));
+            pThat->maMetaFile.AddAction(new MetaBmpExScaleAction(Point(), maBitmapEx.GetPrefSize(), maBitmapEx));
         }
         else
         {
-            pThat->maMetaFile.AddAction(new MetaBmpScaleAction(Point(), maEx.GetPrefSize(), maEx.GetBitmap()));
+            pThat->maMetaFile.AddAction(new MetaBmpScaleAction(Point(), maBitmapEx.GetPrefSize(), maBitmapEx.GetBitmap()));
         }
 
         pThat->maMetaFile.Stop();
         pThat->maMetaFile.WindStart();
-        pThat->maMetaFile.SetPrefSize(maEx.GetPrefSize());
-        pThat->maMetaFile.SetPrefMapMode(maEx.GetPrefMapMode());
+        pThat->maMetaFile.SetPrefSize(maBitmapEx.GetPrefSize());
+        pThat->maMetaFile.SetPrefMapMode(maBitmapEx.GetPrefMapMode());
     }
 
     return maMetaFile;
@@ -772,11 +772,11 @@ Size ImpGraphic::ImplGetPrefSize() const
 
             case GraphicType::Bitmap:
             {
-                if(maVectorGraphicData.get() && maEx.IsEmpty())
+                if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
                 {
                     if (!maExPrefSize.getWidth() || !maExPrefSize.getHeight())
                     {
-                        // svg not yet buffered in maEx, return size derived from range
+                        // svg not yet buffered in maBitmapEx, return size derived from range
                         const basegfx::B2DRange& rRange = maVectorGraphicData->getRange();
 
                         aSize = Size(basegfx::fround(rRange.getWidth()), basegfx::fround(rRange.getHeight()));
@@ -788,11 +788,11 @@ Size ImpGraphic::ImplGetPrefSize() const
                 }
                 else
                 {
-                    aSize = maEx.GetPrefSize();
+                    aSize = maBitmapEx.GetPrefSize();
 
                     if( !aSize.Width() || !aSize.Height() )
                     {
-                        aSize = maEx.GetSizePixel();
+                        aSize = maBitmapEx.GetSizePixel();
                     }
                 }
             }
@@ -824,7 +824,7 @@ void ImpGraphic::ImplSetPrefSize( const Size& rPrefSize )
         {
             // used when importing a writer FlyFrame with SVG as graphic, added conversion
             // to allow setting the PrefSize at the BitmapEx to hold it
-            if(maVectorGraphicData.get() && maEx.IsEmpty())
+            if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
             {
                 maExPrefSize = rPrefSize;
             }
@@ -838,7 +838,7 @@ void ImpGraphic::ImplSetPrefSize( const Size& rPrefSize )
 
             if (!maExPrefSize.getWidth() || !maExPrefSize.getHeight())
             {
-                maEx.SetPrefSize( rPrefSize );
+                maBitmapEx.SetPrefSize( rPrefSize );
             }
         }
         break;
@@ -870,17 +870,17 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
 
             case GraphicType::Bitmap:
             {
-                if(maVectorGraphicData.get() && maEx.IsEmpty())
+                if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
                 {
-                    // svg not yet buffered in maEx, return default PrefMapMode
+                    // svg not yet buffered in maBitmapEx, return default PrefMapMode
                     aMapMode = MapMode(MapUnit::Map100thMM);
                 }
                 else
                 {
-                    const Size aSize( maEx.GetPrefSize() );
+                    const Size aSize( maBitmapEx.GetPrefSize() );
 
                     if ( aSize.Width() && aSize.Height() )
-                        aMapMode = maEx.GetPrefMapMode();
+                        aMapMode = maBitmapEx.GetPrefMapMode();
                 }
             }
             break;
@@ -912,7 +912,7 @@ void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode )
             if(maVectorGraphicData.get())
             {
                 // ignore for Vector Graphic Data. If this is really used (except the grfcache)
-                // it can be extended by using maEx as buffer for getVectorGraphicReplacement()
+                // it can be extended by using maBitmapEx as buffer for getVectorGraphicReplacement()
             }
             else
             {
@@ -923,7 +923,7 @@ void ImpGraphic::ImplSetPrefMapMode( const MapMode& rPrefMapMode )
                     const_cast< BitmapEx& >(mpAnimation->GetBitmapEx()).SetPrefMapMode( rPrefMapMode );
                 }
 
-                maEx.SetPrefMapMode( rPrefMapMode );
+                maBitmapEx.SetPrefMapMode( rPrefMapMode );
             }
         }
         break;
@@ -958,7 +958,7 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
         }
         else
         {
-            mnSizeBytes = mpAnimation ? mpAnimation->GetSizeBytes() : maEx.GetSizeBytes();
+            mnSizeBytes = mpAnimation ? mpAnimation->GetSizeBytes() : maBitmapEx.GetSizeBytes();
         }
     }
     else if( meType == GraphicType::GdiMetafile )
@@ -982,10 +982,10 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
 
         case GraphicType::Bitmap:
         {
-            if(maVectorGraphicData.get() && !maEx)
+            if(maVectorGraphicData.get() && !maBitmapEx)
             {
                 // use maEx as local buffer for rendered svg
-                const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
+                const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
             }
 
             if ( mpAnimation )
@@ -994,7 +994,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
             }
             else
             {
-                maEx.Draw( pOutDev, rDestPt );
+                maBitmapEx.Draw( pOutDev, rDestPt );
             }
         }
         break;
@@ -1019,10 +1019,10 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
 
         case GraphicType::Bitmap:
         {
-            if(maVectorGraphicData.get() && maEx.IsEmpty())
+            if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
             {
                 // use maEx as local buffer for rendered svg
-                const_cast< ImpGraphic* >(this)->maEx = getVectorGraphicReplacement();
+                const_cast< ImpGraphic* >(this)->maBitmapEx = getVectorGraphicReplacement();
             }
 
             if( mpAnimation )
@@ -1031,7 +1031,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
             }
             else
             {
-                maEx.Draw( pOutDev, rDestPt, rDestSize );
+                maBitmapEx.Draw( pOutDev, rDestPt, rDestSize );
             }
         }
         break;
@@ -1166,18 +1166,18 @@ bool ImpGraphic::ImplReadEmbedded( SvStream& rIStm )
     {
         if( meType == GraphicType::Bitmap )
         {
-            if(maVectorGraphicData.get() && maEx.IsEmpty())
+            if(maVectorGraphicData.get() && maBitmapEx.IsEmpty())
             {
-                // use maEx as local buffer for rendered svg
-                maEx = getVectorGraphicReplacement();
+                // use maBitmapEx as local buffer for rendered svg
+                maBitmapEx = getVectorGraphicReplacement();
             }
 
-            maEx.SetSizePixel(aSize);
+            maBitmapEx.SetSizePixel(aSize);
 
             if( aMapMode != MapMode() )
             {
-                maEx.SetPrefMapMode( aMapMode );
-                maEx.SetPrefSize( aSize );
+                maBitmapEx.SetPrefMapMode( aMapMode );
+                maBitmapEx.SetPrefSize( aSize );
             }
         }
         else
@@ -1551,7 +1551,7 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
                 else if( mpAnimation )
                     nRet = mpAnimation->GetChecksum();
                 else
-                    nRet = maEx.GetChecksum();
+                    nRet = maBitmapEx.GetChecksum();
             }
             break;
 
@@ -1841,7 +1841,7 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
                 }
                 else
                 {
-                    WriteDIBBitmapEx(rImpGraphic.maEx, rOStm);
+                    WriteDIBBitmapEx(rImpGraphic.maBitmapEx, rOStm);
                 }
             }
             break;
commit fb1ca509fb6fc7a59ddd88966e8e5934d54131c1
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Apr 19 10:37:35 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:34 2020 +0200

    ImpGraphic: make magic bits for vector formats as constexpr
    
    Change-Id: If0caaf76feebbdc0fb9b16a3adeecf0e3e9dc295

diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 8eb9e0346dd0..7e82456ba397 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -56,6 +56,15 @@
 #define GRAPHIC_FORMAT_50           COMPAT_FORMAT( 'G', 'R', 'F', '5' )
 #define NATIVE_FORMAT_50            COMPAT_FORMAT( 'N', 'A', 'T', '5' )
 
+namespace {
+
+constexpr sal_uInt32 constSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
+constexpr sal_uInt32 constWmfMagic((sal_uInt32('w') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
+constexpr sal_uInt32 constEmfMagic((sal_uInt32('e') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
+constexpr sal_uInt32 constPdfMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
+
+}
+
 using namespace com::sun::star;
 
 struct ImpSwapFile
@@ -1696,16 +1705,12 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
             ErrCode nOrigError = rIStm.GetErrorCode();
             // try to stream in Svg defining data (length, byte array and evtl. path)
             // See below (operator<<) for more information
-            const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
-            const sal_uInt32 nWmfMagic((sal_uInt32('w') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-            const sal_uInt32 nEmfMagic((sal_uInt32('e') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-            const sal_uInt32 nPdfMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
             sal_uInt32 nMagic;
             rIStm.Seek(nStmPos1);
             rIStm.ResetError();
             rIStm.ReadUInt32( nMagic );
 
-            if (nSvgMagic == nMagic || nWmfMagic == nMagic || nEmfMagic == nMagic || nPdfMagic == nMagic)
+            if (constSvgMagic == nMagic || constWmfMagic == nMagic || constEmfMagic == nMagic || constPdfMagic == nMagic)
             {
                 sal_uInt32 nVectorGraphicDataArrayLength(0);
                 rIStm.ReadUInt32(nVectorGraphicDataArrayLength);
@@ -1721,15 +1726,15 @@ void ReadImpGraphic( SvStream& rIStm, ImpGraphic& rImpGraphic )
                     {
                         VectorGraphicDataType aDataType(VectorGraphicDataType::Svg);
 
-                        if (nWmfMagic == nMagic)
+                        if (constWmfMagic == nMagic)
                         {
                             aDataType = VectorGraphicDataType::Wmf;
                         }
-                        else if (nEmfMagic == nMagic)
+                        else if (constEmfMagic == nMagic)
                         {
                             aDataType = VectorGraphicDataType::Emf;
                         }
-                        else if (nPdfMagic == nMagic)
+                        else if (constPdfMagic == nMagic)
                         {
                             aDataType = VectorGraphicDataType::Pdf;
                         }
@@ -1804,26 +1809,22 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
                     {
                         case VectorGraphicDataType::Wmf:
                         {
-                            const sal_uInt32 nWmfMagic((sal_uInt32('w') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-                            rOStm.WriteUInt32(nWmfMagic);
+                            rOStm.WriteUInt32(constWmfMagic);
                             break;
                         }
                         case VectorGraphicDataType::Emf:
                         {
-                            const sal_uInt32 nEmfMagic((sal_uInt32('e') << 24) | (sal_uInt32('m') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-                            rOStm.WriteUInt32(nEmfMagic);
+                            rOStm.WriteUInt32(constEmfMagic);
                             break;
                         }
                         case VectorGraphicDataType::Svg:
                         {
-                            const sal_uInt32 nSvgMagic((sal_uInt32('s') << 24) | (sal_uInt32('v') << 16) | (sal_uInt32('g') << 8) | sal_uInt32('0'));
-                            rOStm.WriteUInt32(nSvgMagic);
+                            rOStm.WriteUInt32(constSvgMagic);
                             break;
                         }
                         case VectorGraphicDataType::Pdf:
                         {
-                            const sal_uInt32 nSvgMagic((sal_uInt32('p') << 24) | (sal_uInt32('d') << 16) | (sal_uInt32('f') << 8) | sal_uInt32('0'));
-                            rOStm.WriteUInt32(nSvgMagic);
+                            rOStm.WriteUInt32(constPdfMagic);
                             break;
                         }
                     }
commit 0674e9048fb902b23bb7386fec08fc5650302a67
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Apr 18 21:40:12 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:34 2020 +0200

    remove Impl from swap method names in ImpGraphic
    
    Change-Id: Ie235b6d02582d4d5ee3dc3d9d2be7f022bcb13c4

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 8fa1df9b82fc..8dc3e21de640 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -175,13 +175,14 @@ private:
     bool                ImplReadEmbedded( SvStream& rIStream );
     bool                ImplWriteEmbedded( SvStream& rOStream );
 
-    bool                ImplSwapIn();
-    bool                ImplSwapIn( SvStream* pIStm );
+    bool                swapIn();
+    bool                swapInFromStream(SvStream* pIStm);
 
-    bool                ImplSwapOut();
-    bool                ImplSwapOut( SvStream* pOStm );
+    bool                swapOut();
+    bool                swapOutToStream(SvStream* pOStm);
+
+    bool                isSwappedOut() const { return mbSwapOut;}
 
-    bool                ImplIsSwapOut() const { return mbSwapOut;}
     bool                ImplIsDummyContext() const { return mbDummyContext; }
     void                ImplSetLink( const std::shared_ptr<GfxLink>& );
     std::shared_ptr<GfxLink> ImplGetSharedGfxLink() const;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index dd4f2cdebd58..8eb9e0346dd0 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -330,7 +330,7 @@ const std::shared_ptr<VectorGraphicData>& ImpGraphic::getVectorGraphicData() con
 
 void ImpGraphic::ImplCreateSwapInfo()
 {
-    if (!ImplIsSwapOut())
+    if (!isSwappedOut())
     {
         maSwapInfo.maPrefMapMode = ImplGetPrefMapMode();
         maSwapInfo.maPrefSize = ImplGetPrefSize();
@@ -737,7 +737,7 @@ Size ImpGraphic::ImplGetSizePixel() const
 {
     Size aSize;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
         aSize = maSwapInfo.maSizePixel;
     else
         aSize = ImplGetBitmapEx(GraphicConversionParameters()).GetSizePixel();
@@ -749,7 +749,7 @@ Size ImpGraphic::ImplGetPrefSize() const
 {
     Size aSize;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
     {
         aSize = maSwapInfo.maPrefSize;
     }
@@ -847,7 +847,7 @@ MapMode ImpGraphic::ImplGetPrefMapMode() const
 {
     MapMode aMapMode;
 
-    if (ImplIsSwapOut())
+    if (isSwappedOut())
     {
         aMapMode = maSwapInfo.maPrefMapMode;
     }
@@ -963,7 +963,7 @@ sal_uLong ImpGraphic::ImplGetSizeBytes() const
 void ImpGraphic::ImplDraw( OutputDevice* pOutDev, const Point& rDestPt ) const
 {
     ensureAvailable();
-    if( !ImplIsSupportedGraphic() || ImplIsSwapOut() )
+    if( !ImplIsSupportedGraphic() || isSwappedOut() )
         return;
 
     switch( meType )
@@ -1000,7 +1000,7 @@ void ImpGraphic::ImplDraw( OutputDevice* pOutDev,
                            const Point& rDestPt, const Size& rDestSize ) const
 {
     ensureAvailable();
-    if( !ImplIsSupportedGraphic() || ImplIsSwapOut() )
+    if( !ImplIsSupportedGraphic() || isSwappedOut() )
         return;
 
     switch( meType )
@@ -1043,7 +1043,7 @@ void ImpGraphic::ImplStartAnimation( OutputDevice* pOutDev, const Point& rDestPt
 {
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() && mpAnimation )
         mpAnimation->Start( pOutDev, rDestPt, rDestSize, nExtraData, pFirstFrameOutDev );
 }
 
@@ -1051,7 +1051,7 @@ void ImpGraphic::ImplStopAnimation( OutputDevice* pOutDev, long nExtraData )
 {
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() && mpAnimation )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() && mpAnimation )
         mpAnimation->Stop( pOutDev, nExtraData );
 }
 
@@ -1227,7 +1227,7 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
 {
     ensureAvailable();
 
-    if( ( meType == GraphicType::NONE ) || ( meType == GraphicType::Default ) || ImplIsSwapOut() )
+    if( ( meType == GraphicType::NONE ) || ( meType == GraphicType::Default ) || isSwappedOut() )
         return false;
 
     const MapMode   aMapMode( ImplGetPrefMapMode() );
@@ -1300,10 +1300,10 @@ bool ImpGraphic::ImplWriteEmbedded( SvStream& rOStm )
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapOut()
+bool ImpGraphic::swapOut()
 {
 
-    if( ImplIsSwapOut() )
+    if( isSwappedOut() )
         return false;
 
     ::utl::TempFile     aTempFile;
@@ -1326,7 +1326,7 @@ bool ImpGraphic::ImplSwapOut()
     xOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
     xOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
 
-    bool bRet = ImplSwapOut( xOStm.get() );
+    bool bRet = swapOutToStream( xOStm.get() );
     if( bRet )
     {
         mpSwapFile.reset(new ImpSwapFile, o3tl::default_delete<ImpSwapFile>());
@@ -1344,7 +1344,7 @@ bool ImpGraphic::ImplSwapOut()
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapOut( SvStream* xOStm )
+bool ImpGraphic::swapOutToStream(SvStream* xOStm)
 {
     if( !xOStm )
     {
@@ -1375,8 +1375,8 @@ bool ImpGraphic::ensureAvailable() const
 {
     auto pThis = const_cast<ImpGraphic*>(this);
 
-    if (ImplIsSwapOut())
-        return pThis->ImplSwapIn();
+    if (isSwappedOut())
+        return pThis->swapIn();
 
     pThis->maLastUsed = std::chrono::high_resolution_clock::now();
     return true;
@@ -1405,11 +1405,11 @@ bool ImpGraphic::loadPrepared()
     return true;
 }
 
-bool ImpGraphic::ImplSwapIn()
+bool ImpGraphic::swapIn()
 {
     bool bRet = false;
 
-    if (!ImplIsSwapOut())
+    if (!isSwappedOut())
         return bRet;
 
     if (mbPrepared)
@@ -1439,7 +1439,7 @@ bool ImpGraphic::ImplSwapIn()
                 xIStm->SetVersion( SOFFICE_FILEFORMAT_50 );
                 xIStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
 
-                bRet = ImplSwapIn( xIStm.get() );
+                bRet = swapInFromStream(xIStm.get());
                 xIStm.reset();
                 if (mpSwapFile)
                     setOriginURL(mpSwapFile->maOriginURL);
@@ -1454,7 +1454,7 @@ bool ImpGraphic::ImplSwapIn()
     return bRet;
 }
 
-bool ImpGraphic::ImplSwapIn( SvStream* xIStm )
+bool ImpGraphic::swapInFromStream(SvStream* xIStm)
 {
     bool bRet = false;
 
@@ -1528,7 +1528,7 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
 
     ensureAvailable();
 
-    if( ImplIsSupportedGraphic() && !ImplIsSwapOut() )
+    if( ImplIsSupportedGraphic() && !isSwappedOut() )
     {
         switch( meType )
         {
@@ -1565,7 +1565,7 @@ bool ImpGraphic::ImplExportNative( SvStream& rOStm ) const
 
     bool bResult = false;
 
-    if( !ImplIsSwapOut() )
+    if( !isSwappedOut() )
     {
         if( mpGfxLink && mpGfxLink->IsNative() )
             bResult = mpGfxLink->ExportNative( rOStm );
@@ -1758,7 +1758,7 @@ void WriteImpGraphic(SvStream& rOStm, const ImpGraphic& rImpGraphic)
 
     rImpGraphic.ensureAvailable();
 
-    if (rImpGraphic.ImplIsSwapOut())
+    if (rImpGraphic.isSwappedOut())
     {
         rOStm.SetError( SVSTREAM_GENERALERROR );
         return;
diff --git a/vcl/source/graphic/Manager.cxx b/vcl/source/graphic/Manager.cxx
index b019d5adceaa..65e81fc1e605 100644
--- a/vcl/source/graphic/Manager.cxx
+++ b/vcl/source/graphic/Manager.cxx
@@ -93,7 +93,7 @@ void Manager::reduceGraphicMemory()
             return;
 
         sal_Int64 nCurrentGraphicSize = getGraphicSizeBytes(pEachImpGraphic);
-        if (!pEachImpGraphic->ImplIsSwapOut() && nCurrentGraphicSize > 1000000)
+        if (!pEachImpGraphic->isSwappedOut() && nCurrentGraphicSize > 1000000)
         {
             if (!pEachImpGraphic->mpContext)
             {
@@ -102,7 +102,7 @@ void Manager::reduceGraphicMemory()
                 auto aSeconds = std::chrono::duration_cast<std::chrono::seconds>(aDeltaTime);
 
                 if (aSeconds > mnAllowedIdleTime)
-                    pEachImpGraphic->ImplSwapOut();
+                    pEachImpGraphic->swapOut();
             }
         }
     }
@@ -141,7 +141,7 @@ void Manager::registerGraphic(const std::shared_ptr<ImpGraphic>& pImpGraphic,
     sal_Int64 calculatedSize = 0;
     for (ImpGraphic* pEachImpGraphic : m_pImpGraphicList)
     {
-        if (!pEachImpGraphic->ImplIsSwapOut())
+        if (!pEachImpGraphic->isSwappedOut())
         {
             calculatedSize += getGraphicSizeBytes(pEachImpGraphic);
         }
commit 8b5ae1110b567f26d791c69276ad2fe4a75e019b
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 15 22:05:33 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:33 2020 +0200

    remove GraphicNative{Metadata,Transform} from clang-f. blacklist
    
    Change-Id: Ib60485e5d35e9d3ec2b0028d38fb8d5eaa72421c

diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx
index 118efa480df8..318fb724bf25 100644
--- a/include/vcl/GraphicNativeMetadata.hxx
+++ b/include/vcl/GraphicNativeMetadata.hxx
@@ -29,8 +29,8 @@ public:
     GraphicNativeMetadata();
     ~GraphicNativeMetadata();
 
-    bool read(Graphic const & rGraphic);
-    sal_uInt16 getRotation() const { return mRotation;}
+    bool read(Graphic const& rGraphic);
+    sal_uInt16 getRotation() const { return mRotation; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
index 318327bf5b66..b4d71f2d53d0 100644
--- a/include/vcl/GraphicNativeTransform.hxx
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -29,9 +29,9 @@ class VCL_DLLPUBLIC GraphicNativeTransform final
 {
     Graphic& mrGraphic;
 
-    bool rotateBitmapOnly (sal_uInt16 aRotation);
-    void rotateJPEG       (sal_uInt16 aRotation);
-    bool rotateGeneric    (sal_uInt16 aRotation, const OUString& aType);
+    bool rotateBitmapOnly(sal_uInt16 aRotation);
+    void rotateJPEG(sal_uInt16 aRotation);
+    bool rotateGeneric(sal_uInt16 aRotation, const OUString& aType);
 
 public:
     GraphicNativeTransform(Graphic& rGraphic);
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index 66b455d7fda1..29d6a69d4004 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -7320,8 +7320,6 @@ include/vcl/BitmapTools.hxx
 include/vcl/ColorMask.hxx
 include/vcl/EnumContext.hxx
 include/vcl/FilterConfigItem.hxx
-include/vcl/GraphicNativeMetadata.hxx
-include/vcl/GraphicNativeTransform.hxx
 include/vcl/GraphicObject.hxx
 include/vcl/IContext.hxx
 include/vcl/IDialogRenderable.hxx
@@ -17152,8 +17150,6 @@ vcl/source/edit/xtextedt.cxx
 vcl/source/filter/FilterConfigCache.cxx
 vcl/source/filter/FilterConfigCache.hxx
 vcl/source/filter/FilterConfigItem.cxx
-vcl/source/filter/GraphicNativeMetadata.cxx
-vcl/source/filter/GraphicNativeTransform.cxx
 vcl/source/filter/graphicfilter.cxx
 vcl/source/filter/graphicfilter2.cxx
 vcl/source/filter/graphicfilter_internal.hxx
diff --git a/vcl/source/filter/GraphicNativeMetadata.cxx b/vcl/source/filter/GraphicNativeMetadata.cxx
index e42669d3c4aa..132a51a52391 100644
--- a/vcl/source/filter/GraphicNativeMetadata.cxx
+++ b/vcl/source/filter/GraphicNativeMetadata.cxx
@@ -25,18 +25,17 @@
 #include "jpeg/Exif.hxx"
 #include <memory>
 
-GraphicNativeMetadata::GraphicNativeMetadata() :
-    mRotation(0)
-{}
-
-GraphicNativeMetadata::~GraphicNativeMetadata()
-{}
+GraphicNativeMetadata::GraphicNativeMetadata()
+    : mRotation(0)
+{
+}
 
+GraphicNativeMetadata::~GraphicNativeMetadata() {}
 
-bool GraphicNativeMetadata::read(Graphic const & rGraphic)
+bool GraphicNativeMetadata::read(Graphic const& rGraphic)
 {
     GfxLink aLink = rGraphic.GetGfxLink();
-    if ( aLink.GetType() != GfxLinkType::NativeJpg )
+    if (aLink.GetType() != GfxLinkType::NativeJpg)
         return false;
 
     sal_uInt32 aDataSize = aLink.GetDataSize();
diff --git a/vcl/source/filter/GraphicNativeTransform.cxx b/vcl/source/filter/GraphicNativeTransform.cxx
index ba6e6a194f63..8083dd4c2e77 100644
--- a/vcl/source/filter/GraphicNativeTransform.cxx
+++ b/vcl/source/filter/GraphicNativeTransform.cxx
@@ -30,12 +30,12 @@
 
 using namespace ::exif;
 
-GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic) :
-    mrGraphic(rGraphic)
-{}
+GraphicNativeTransform::GraphicNativeTransform(Graphic& rGraphic)
+    : mrGraphic(rGraphic)
+{
+}
 
-GraphicNativeTransform::~GraphicNativeTransform()
-{}
+GraphicNativeTransform::~GraphicNativeTransform() {}
 
 void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
 {
@@ -52,19 +52,19 @@ void GraphicNativeTransform::rotate(sal_uInt16 aInputRotation)
     }
 
     GfxLink aLink = mrGraphic.GetGfxLink();
-    if ( aLink.GetType() == GfxLinkType::NativeJpg )
+    if (aLink.GetType() == GfxLinkType::NativeJpg)
     {
         rotateJPEG(aRotation);
     }
-    else if ( aLink.GetType() == GfxLinkType::NativePng )
+    else if (aLink.GetType() == GfxLinkType::NativePng)
     {
         rotateGeneric(aRotation, "png");
     }
-    else if ( aLink.GetType() == GfxLinkType::NativeGif )
+    else if (aLink.GetType() == GfxLinkType::NativeGif)
     {
         rotateGeneric(aRotation, "gif");
     }
-    else if ( aLink.GetType() == GfxLinkType::NONE )
+    else if (aLink.GetType() == GfxLinkType::NONE)
     {
         rotateBitmapOnly(aRotation);
     }
@@ -96,24 +96,24 @@ bool GraphicNativeTransform::rotateGeneric(sal_uInt16 aRotation, const OUString&
 
     GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
 
-    css::uno::Sequence< css::beans::PropertyValue > aFilterData( 3 );
-    aFilterData[ 0 ].Name = "Interlaced";
-    aFilterData[ 0 ].Value <<= sal_Int32(0);
-    aFilterData[ 1 ].Name = "Compression";
-    aFilterData[ 1 ].Value <<= sal_Int32(9);
-    aFilterData[ 2 ].Name = "Quality";
-    aFilterData[ 2 ].Value <<= sal_Int32(90);
+    css::uno::Sequence<css::beans::PropertyValue> aFilterData(3);
+    aFilterData[0].Name = "Interlaced";
+    aFilterData[0].Value <<= sal_Int32(0);
+    aFilterData[1].Name = "Compression";
+    aFilterData[1].Value <<= sal_Int32(9);
+    aFilterData[2].Name = "Quality";
+    aFilterData[2].Value <<= sal_Int32(90);
 
-    sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName( aType );
+    sal_uInt16 nFilterFormat = rFilter.GetExportFormatNumberForShortName(aType);
 
     BitmapEx aBitmap = mrGraphic.GetBitmapEx();
     aBitmap.Rotate(aRotation, COL_BLACK);
-    rFilter.ExportGraphic( aBitmap, "none", aStream, nFilterFormat, &aFilterData );
+    rFilter.ExportGraphic(aBitmap, "none", aStream, nFilterFormat, &aFilterData);
 
-    aStream.Seek( STREAM_SEEK_TO_BEGIN );
+    aStream.Seek(STREAM_SEEK_TO_BEGIN);
 
     Graphic aGraphic;
-    rFilter.ImportGraphic( aGraphic, "import", aStream );
+    rFilter.ImportGraphic(aGraphic, "import", aStream);
 
     mrGraphic = aGraphic;
     return true;
@@ -123,8 +123,7 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
 {
     BitmapEx aBitmap = mrGraphic.GetBitmapEx();
 
-    if (aBitmap.GetSizePixel().Width()  % 16 != 0 ||
-        aBitmap.GetSizePixel().Height() % 16 != 0 )
+    if (aBitmap.GetSizePixel().Width() % 16 != 0 || aBitmap.GetSizePixel().Height() % 16 != 0)
     {
         rotateGeneric(aRotation, "png");
     }
@@ -134,12 +133,12 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
 
         SvMemoryStream aSourceStream;
         aSourceStream.WriteBytes(aLink.GetData(), aLink.GetDataSize());
-        aSourceStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aSourceStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         Orientation aOrientation = TOP_LEFT;
 
         Exif exif;
-        if ( exif.read(aSourceStream) )
+        if (exif.read(aSourceStream))
         {
             aOrientation = exif.getOrientation();
         }
@@ -149,20 +148,20 @@ void GraphicNativeTransform::rotateJPEG(sal_uInt16 aRotation)
         transform.setRotate(aRotation);
         transform.perform();
 
-        aTargetStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aTargetStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         // Reset orientation in exif if needed
-        if ( exif.hasExif() && aOrientation != TOP_LEFT)
+        if (exif.hasExif() && aOrientation != TOP_LEFT)
         {
             exif.setOrientation(TOP_LEFT);
             exif.write(aTargetStream);
         }
 
-        aTargetStream.Seek( STREAM_SEEK_TO_BEGIN );
+        aTargetStream.Seek(STREAM_SEEK_TO_BEGIN);
 
         Graphic aGraphic;
         GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
-        rFilter.ImportGraphic( aGraphic, "import", aTargetStream );
+        rFilter.ImportGraphic(aGraphic, "import", aTargetStream);
         mrGraphic = aGraphic;
     }
 }
commit 467bdb572bdc004954195ed252b477dc58ea0e5e
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Apr 14 20:48:56 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:33 2020 +0200

    use pragma once
    
    Change-Id: Ia78cc4ee565a5f39835499764b1f2d0a2a72c5ba

diff --git a/include/vcl/GraphicNativeMetadata.hxx b/include/vcl/GraphicNativeMetadata.hxx
index b6b162556e76..118efa480df8 100644
--- a/include/vcl/GraphicNativeMetadata.hxx
+++ b/include/vcl/GraphicNativeMetadata.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_GRAPHICNATIVEMETADATA_HXX
-#define INCLUDED_VCL_GRAPHICNATIVEMETADATA_HXX
+#pragma once
 
 #include <vcl/graph.hxx>
 
@@ -34,6 +33,4 @@ public:
     sal_uInt16 getRotation() const { return mRotation;}
 };
 
-#endif // INCLUDED_VCL_GRAPHICNATIVEMETADATA_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/GraphicNativeTransform.hxx b/include/vcl/GraphicNativeTransform.hxx
index c8203377dc55..318327bf5b66 100644
--- a/include/vcl/GraphicNativeTransform.hxx
+++ b/include/vcl/GraphicNativeTransform.hxx
@@ -17,12 +17,12 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_GRAPHICNATIVETRANSFORM_HXX
-#define INCLUDED_VCL_GRAPHICNATIVETRANSFORM_HXX
+#pragma once
 
 #include <rtl/ustring.hxx>
 #include <sal/types.h>
 #include <vcl/dllapi.h>
+
 class Graphic;
 
 class VCL_DLLPUBLIC GraphicNativeTransform final
@@ -40,6 +40,4 @@ public:
     void rotate(sal_uInt16 aRotation);
 };
 
-#endif // INCLUDED_VCL_GRAPHICNATIVETRANSFORM_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/filter/jpeg/Exif.hxx b/vcl/source/filter/jpeg/Exif.hxx
index 47c34e427810..6052a44842da 100644
--- a/vcl/source/filter/jpeg/Exif.hxx
+++ b/vcl/source/filter/jpeg/Exif.hxx
@@ -17,12 +17,12 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
-#define INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
+#pragma once
 
 #include <tools/stream.hxx>
 
 namespace exif {
+
 enum Orientation {
     TOP_LEFT        = 1,
     TOP_RIGHT       = 2,
@@ -80,6 +80,4 @@ public:
 
 };
 
-#endif // INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1f8ce5328d11b7dad83128ead35b77b531cf8eeb
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Apr 1 13:00:25 2020 +0200
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:33 2020 +0200

    Add OutputDevice::drawPrimitive2D to OutputDevice
    
    Change-Id: Ifc22eca62df72bddd247ba097054f34756520614

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index e4430b2415f3..44aa8f821dae 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -49,6 +49,8 @@
 #include <com/sun/star/drawing/LineCap.hpp>
 #include <com/sun/star/uno/Reference.h>
 
+#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
+
 #include <memory>
 #include <vector>
 
@@ -1955,6 +1957,9 @@ public:
     ///@}
 
 
+    bool drawPrimitive2D(drawinglayer::primitive2d::Primitive2DContainer & rPrimitive2D);
+
+
     /** @name Native Widget Rendering functions
 
         These all just call through to the private mpGraphics functions of the same name.
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index cb59e378fb89..6d5b09ae4592 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\
     basegfx \
     comphelper \
     cppuhelper \
+    drawinglayercore \
     i18nlangtag \
     i18nutil \
     $(if $(filter OPENCL,$(BUILD_TYPE)),opencl) \
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 0dcdd84a5d0a..52f31234caa3 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -713,4 +713,9 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
     return bDrawn;
 }
 
+bool OutputDevice::drawPrimitive2D(drawinglayer::primitive2d::Primitive2DContainer & rPrimitive2D)
+{
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 8885d77914454d51b7a1c9e2b4bd8ca3fd526fc7
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Mar 7 14:33:43 2020 +0100
Commit:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Sat Apr 25 16:43:33 2020 +0200

    Separate core drawinglayer func. into drawinglayercore library
    
    This separates the drawinglayer core functionallity into a
    separate library, to keep a strict separation what is backend
    dependent and what is not. More strict separation can be done
    at a later date.
    
    This will make it possible to push part of drawinglayer
    (part of processor2d) directly into VCL.
    
    Change-Id: Ibc26580067e50bf20d7cdd37fa0e44eb10200878

diff --git a/Repository.mk b/Repository.mk
index 4479ed901e23..78b146096bdd 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -350,6 +350,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \
 	$(call gb_Helper_optional,SCRIPTING,dlgprov) \
 	$(if $(filter WNT,$(OS)),directx9canvas) \
 	$(if $(ENABLE_OPENGL_CANVAS),oglcanvas) \
+	drawinglayercore \
 	drawinglayer \
 	editeng \
 	$(if $(filter WNT,$(OS)),emser) \
diff --git a/drawinglayer/CppunitTest_drawinglayer_border.mk b/drawinglayer/CppunitTest_drawinglayer_border.mk
index fa2f715590cd..e00006c18dba 100644
--- a/drawinglayer/CppunitTest_drawinglayer_border.mk
+++ b/drawinglayer/CppunitTest_drawinglayer_border.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,drawinglayer_border, \
 	sal \
 	salhelper \
 	drawinglayer \
+	drawinglayercore \
 	vcl \
 	test \
 	tl \
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 2a0f1030a789..46f21f56b6b6 100644
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Library_use_externals,drawinglayer,\
 ))
 
 $(eval $(call gb_Library_use_libraries,drawinglayer,\
+    drawinglayercore \
     basegfx \
     canvastools \
     comphelper \
@@ -67,11 +68,9 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/attribute/sdrsceneattribute3d \
     drawinglayer/source/attribute/sdrshadowattribute \
     drawinglayer/source/attribute/strokeattribute \
-    drawinglayer/source/geometry/viewinformation2d \
     drawinglayer/source/geometry/viewinformation3d \
     drawinglayer/source/primitive2d/animatedprimitive2d \
     drawinglayer/source/primitive2d/backgroundcolorprimitive2d \
-    drawinglayer/source/primitive2d/baseprimitive2d \
     drawinglayer/source/primitive2d/bitmapprimitive2d \
     drawinglayer/source/primitive2d/borderlineprimitive2d \
     drawinglayer/source/primitive2d/controlprimitive2d \
@@ -111,7 +110,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D \
     drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D \
     drawinglayer/source/primitive2d/primitivetools2d \
-    drawinglayer/source/primitive2d/Primitive2DContainer \
     drawinglayer/source/primitive2d/sceneprimitive2d \
     drawinglayer/source/primitive2d/sdrdecompositiontools2d \
     drawinglayer/source/primitive2d/shadowprimitive2d \
@@ -126,7 +124,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
     drawinglayer/source/primitive2d/textlineprimitive2d \
     drawinglayer/source/primitive2d/textprimitive2d \
     drawinglayer/source/primitive2d/textstrikeoutprimitive2d \
-    drawinglayer/source/primitive2d/Tools \
     drawinglayer/source/primitive2d/transformprimitive2d \
     drawinglayer/source/primitive2d/transparenceprimitive2d \
     drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d \
diff --git a/drawinglayer/Library_drawinglayercore.mk b/drawinglayer/Library_drawinglayercore.mk
new file mode 100644
index 000000000000..f1643d27014d
--- /dev/null
+++ b/drawinglayer/Library_drawinglayercore.mk
@@ -0,0 +1,49 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Library_Library,drawinglayercore))
+
+$(eval $(call gb_Library_set_include,drawinglayercore,\
+    $$(INCLUDE) \
+    -I$(SRCDIR)/drawinglayer/inc \
+))
+
+$(eval $(call gb_Library_add_defs,drawinglayercore,\
+    -DDRAWINGLAYERCORE_DLLIMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_set_precompiled_header,drawinglayercore,drawinglayer/inc/pch/precompiled_drawinglayercore))
+
+$(eval $(call gb_Library_use_sdk_api,drawinglayercore))
+
+$(eval $(call gb_Library_use_externals,drawinglayercore,\
+    boost_headers \
+    libxml2 \
+))
+
+$(eval $(call gb_Library_use_libraries,drawinglayercore,\
+    basegfx \
+    comphelper \
+    cppu \
+    cppuhelper \
+    i18nlangtag \
+    sal \
+    salhelper \
+    svl \
+    tl \
+))
+
+$(eval $(call gb_Library_add_exception_objects,drawinglayercore,\
+    drawinglayer/source/primitive2d/baseprimitive2d \
+    drawinglayer/source/primitive2d/Primitive2DContainer \
+    drawinglayer/source/primitive2d/Tools \
+    drawinglayer/source/geometry/viewinformation2d \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/drawinglayer/Module_drawinglayer.mk b/drawinglayer/Module_drawinglayer.mk
index 6d329e95c60a..687cd9c2671f 100644
--- a/drawinglayer/Module_drawinglayer.mk
+++ b/drawinglayer/Module_drawinglayer.mk
@@ -10,6 +10,7 @@
 $(eval $(call gb_Module_Module,drawinglayer))
 
 $(eval $(call gb_Module_add_targets,drawinglayer,\
+    Library_drawinglayercore \
     Library_drawinglayer \
 ))
 
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
index 2e7acea69e7b..57f107623f49 100644
--- a/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
+++ b/drawinglayer/inc/pch/precompiled_drawinglayer.hxx
@@ -92,7 +92,6 @@
 #include <basegfx/range/basicrange.hxx>
 #include <basegfx/tuple/b2dtuple.hxx>
 #include <basegfx/tuple/b3dtuple.hxx>
-#include <basegfx/utils/canvastools.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 #include <basegfx/vector/b2enums.hxx>
 #include <basegfx/vector/b2ivector.hxx>
@@ -104,7 +103,7 @@
 #include <com/sun/star/drawing/TextureMode.hpp>
 #include <com/sun/star/drawing/TextureProjectionMode.hpp>
 #include <com/sun/star/graphic/XPrimitive3D.hpp>
-#include <com/sun/star/util/XAccounting.hpp>
+#include <com/sun/star/uno/Reference.hxx>
 #include <comphelper/comphelperdllapi.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequence.hxx>
@@ -138,7 +137,6 @@
 #include <drawinglayer/drawinglayerdllapi.h>
 #include <drawinglayer/geometry/viewinformation2d.hxx>
 #include <drawinglayer/geometry/viewinformation3d.hxx>
-#include <drawinglayer/primitive2d/CommonTypes.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonGradientPrimitive2D.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.hxx>
@@ -146,9 +144,6 @@
 #include <drawinglayer/primitive2d/PolyPolygonHatchPrimitive2D.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx>
 #include <drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx>
-#include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
-#include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
-#include <drawinglayer/primitive2d/Tools.hxx>
 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
 #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx b/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx
new file mode 100644
index 000000000000..4a8c23ea8e65
--- /dev/null
+++ b/drawinglayer/inc/pch/precompiled_drawinglayercore.cxx
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "precompiled_drawinglayercore.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx b/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx
new file mode 100644
index 000000000000..4cc5ca4612c9
--- /dev/null
+++ b/drawinglayer/inc/pch/precompiled_drawinglayercore.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+/*
+ This file has been autogenerated by update_pch.sh. It is possible to edit it
+ manually (such as when an include file has been moved/renamed/removed). All such
+ manual changes will be rewritten by the next run of update_pch.sh (which presumably
+ also fixes all possible problems, so it's usually better to use it).
+
+ Generated on 2020-03-07 12:37:18 using:
+ ./bin/update_pch drawinglayer drawinglayercore --cutoff=4 --exclude:system --exclude:module --exclude:local
+
+ If after updating build fails, use the following command to locate conflicting headers:
+ ./bin/update_pch_bisect ./drawinglayer/inc/pch/precompiled_drawinglayercore.hxx "make drawinglayer.build" --find-conflicts
+*/
+
+#if PCH_LEVEL >= 1
+#include <ostream>
+#include <vector>
+#endif // PCH_LEVEL >= 1
+#if PCH_LEVEL >= 2
+#include <osl/diagnose.h>
+#include <osl/interlck.h>
+#include <sal/config.h>
+#include <sal/types.h>
+#endif // PCH_LEVEL >= 2
+#if PCH_LEVEL >= 3
+#include <basegfx/basegfxdllapi.h>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/utils/canvastools.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#endif // PCH_LEVEL >= 3
+#if PCH_LEVEL >= 4
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#endif // PCH_LEVEL >= 4
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/emfio/CppunitTest_emfio_emf_test.mk b/emfio/CppunitTest_emfio_emf_test.mk
index 123e4b3549bd..2679c0a604d9 100644
--- a/emfio/CppunitTest_emfio_emf_test.mk
+++ b/emfio/CppunitTest_emfio_emf_test.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_CppunitTest_use_sdk_api,emfio_emf))
 $(eval $(call gb_CppunitTest_use_libraries,emfio_emf,\
     basegfx \
     drawinglayer \
+    drawinglayercore \
     cppu \
     cppuhelper \
     comphelper \
diff --git a/emfio/Library_emfio.mk b/emfio/Library_emfio.mk
index 52fde14885b3..89add50b781a 100644
--- a/emfio/Library_emfio.mk
+++ b/emfio/Library_emfio.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_use_sdk_api,emfio))
 
 $(eval $(call gb_Library_use_libraries,emfio,\
     basegfx \
+    drawinglayercore \
     drawinglayer \
     cppu \
     cppuhelper \
diff --git a/filter/Library_svgfilter.mk b/filter/Library_svgfilter.mk
index 21318aa1fd03..1f0caf11758c 100644
--- a/filter/Library_svgfilter.mk
+++ b/filter/Library_svgfilter.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_use_libraries,svgfilter,\
 	sax \
 	salhelper \
 	comphelper \
+	drawinglayercore \
 	drawinglayer \
 	basegfx \
 	cppuhelper \
diff --git a/include/drawinglayer/drawinglayerdllapi.h b/include/drawinglayer/drawinglayerdllapi.h
index 0b3983504919..36a0d8abfea2 100644
--- a/include/drawinglayer/drawinglayerdllapi.h
+++ b/include/drawinglayer/drawinglayerdllapi.h
@@ -19,6 +19,12 @@
 #endif
 #define DRAWINGLAYER_DLLPRIVATE SAL_DLLPRIVATE
 
+#if defined(DRAWINGLAYERCORE_DLLIMPLEMENTATION)
+#define DRAWINGLAYERCORE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DRAWINGLAYERCORE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx
index 95be29a72bda..06b17248d213 100644
--- a/include/drawinglayer/geometry/viewinformation2d.hxx
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -63,7 +63,7 @@ namespace drawinglayer::geometry
     It is an implementation to support the sequence of PropertyValues used in a
     css::graphic::XPrimitive2D for C++ implementations working with those
 */
-class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
+class DRAWINGLAYERCORE_DLLPUBLIC ViewInformation2D
 {
 public:
     typedef o3tl::cow_wrapper<ImpViewInformation2D, o3tl::ThreadSafeRefCountingPolicy> ImplType;
diff --git a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
index cca3a0a91485..c096e9a8cc2f 100644
--- a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
+++ b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
@@ -34,7 +34,7 @@ class ViewInformation2D;
 
 namespace drawinglayer::primitive2d
 {
-class SAL_WARN_UNUSED DRAWINGLAYER_DLLPUBLIC Primitive2DContainer
+class SAL_WARN_UNUSED DRAWINGLAYERCORE_DLLPUBLIC Primitive2DContainer
     : public std::deque<Primitive2DReference>,
       public Primitive2DDecompositionVisitor
 {
diff --git a/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
index dfe04b32a320..e174d1e0878d 100644
--- a/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
+++ b/include/drawinglayer/primitive2d/Primitive2DVisitor.hxx
@@ -27,7 +27,7 @@ namespace drawinglayer::primitive2d
 class Primitive2DContainer;
 
 // Visitor class for walking a tree of Primitive2DReference
-class DRAWINGLAYER_DLLPUBLIC Primitive2DDecompositionVisitor
+class DRAWINGLAYERCORE_DLLPUBLIC Primitive2DDecompositionVisitor
 {
 public:
     virtual void append(const Primitive2DReference&) = 0;
diff --git a/include/drawinglayer/primitive2d/Tools.hxx b/include/drawinglayer/primitive2d/Tools.hxx
index fbb6f5717c01..1c30565c8c1b 100644
--- a/include/drawinglayer/primitive2d/Tools.hxx

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list