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

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 20 20:19:26 UTC 2020


 vcl/inc/impgraph.hxx        |    2 +-
 vcl/source/gdi/impgraph.cxx |   34 +++++++++++++++++++++-------------
 2 files changed, 22 insertions(+), 14 deletions(-)

New commits:
commit 4a5931f44853ec4557b89be59cdba2696d536522
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: Mon Apr 20 22:18:03 2020 +0200

    ImpGraphic: encapsulate members of ImpSwapFile
    
    Change-Id: I882d30f2f27149c865160b3fa68fa974701cea71

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 92dd0c078519..fd9ae31d358c 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -42,7 +42,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 8b305f1e471e..2a5780fc137c 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -66,15 +66,26 @@ 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()
     {
-        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; }
 };
 
 ImpGraphic::ImpGraphic() :
@@ -1335,9 +1346,7 @@ bool ImpGraphic::swapOut()
                 bRet = swapOutToStream(xOStm.get());
                 if( bRet )
                 {
-                    mpSwapFile = std::make_unique<ImpSwapFile>();
-                    mpSwapFile->aSwapURL = aTmpURL;
-                    mpSwapFile->maOriginURL = getOriginURL();
+                    mpSwapFile = std::make_unique<ImpSwapFile>(aTmpURL, getOriginURL());
                 }
                 else
                 {
@@ -1432,7 +1441,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() )
         {
@@ -1453,7 +1462,7 @@ bool ImpGraphic::swapIn()
                 bRet = swapInFromStream(xIStm.get());
                 xIStm.reset();
                 if (mpSwapFile)
-                    setOriginURL(mpSwapFile->maOriginURL);
+                    setOriginURL(mpSwapFile->getOriginURL());
                 mpSwapFile.reset();
             }
         }
commit eaec37310b90d96b41a33751a96383b58c9740da
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: Mon Apr 20 22:07:58 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 43463fd81b59..8b305f1e471e 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -70,7 +70,11 @@ struct ImpSwapFile
 {
     INetURLObject aSwapURL;
     OUString maOriginURL;
-    ~ImpSwapFile();
+
+    ~ImpSwapFile()
+    {
+        utl::UCBContentHelper::Kill(aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
+    }
 };
 
 ImpGraphic::ImpGraphic() :
@@ -359,11 +363,6 @@ void ImpGraphic::ImplClearGraphics()
     maVectorGraphicData.reset();
 }
 
-ImpSwapFile::~ImpSwapFile()
-{
-    utl::UCBContentHelper::Kill(aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE));
-}
-
 void ImpGraphic::ImplSetPrepared(bool bAnimated, const Size* pSizeHint)
 {
     mbPrepared = true;


More information about the Libreoffice-commits mailing list