[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Tue Apr 10 06:37:31 UTC 2018


 include/vcl/GraphicExternalLink.hxx |   31 +++++++++++++++++++++++++++++++
 vcl/inc/impgraph.hxx                |    8 +++++---
 vcl/source/gdi/impgraph.cxx         |   10 +++++-----
 3 files changed, 41 insertions(+), 8 deletions(-)

New commits:
commit a50897107bca839af5665ee0f9621e9cce54900b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Apr 4 16:47:00 2018 +0900

    replace originURL with GraphicExternalLink class (internally)
    
    For now just introduce the GraphicExternalLink internally in
    ImpGraphic, and use it for the origin URL. In a future patch this
    will store additional data about the link.
    
    Change-Id: I7b4edac80d0e71603d37243ff28bcac1b18fdc01
    Reviewed-on: https://gerrit.libreoffice.org/52393
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/GraphicExternalLink.hxx b/include/vcl/GraphicExternalLink.hxx
new file mode 100644
index 000000000000..7a9cac258d30
--- /dev/null
+++ b/include/vcl/GraphicExternalLink.hxx
@@ -0,0 +1,31 @@
+/* -*- 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/.
+ */
+
+#ifndef INCLUDED_VCL_GRAPHIC_EXTERNAL_LINK_HXX
+#define INCLUDED_VCL_GRAPHIC_EXTERNAL_LINK_HXX
+
+#include <memory>
+#include <vcl/dllapi.h>
+
+class VCL_DLLPUBLIC GraphicExternalLink
+{
+public:
+    OUString msURL;
+
+    GraphicExternalLink() {}
+
+    GraphicExternalLink(OUString const& rURL)
+        : msURL(rURL)
+    {
+    }
+};
+
+#endif // INCLUDED_VCL_GRAPHIC_EXTERNAL_LINK_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 834113130bbe..d0b44bbf15e6 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_VCL_INC_IMPGRAPH_HXX
 #define INCLUDED_VCL_INC_IMPGRAPH_HXX
 
+#include <vcl/GraphicExternalLink.hxx>
+
 struct ImpSwapInfo
 {
     MapMode     maPrefMapMode;
@@ -76,8 +78,8 @@ private:
     bool                         mbDummyContext;
     VectorGraphicDataPtr         maVectorGraphicData;
     css::uno::Sequence<sal_Int8> maPdfData;
-    OUString msOriginURL;
     std::unique_ptr<GraphicID>   mpGraphicID;
+    GraphicExternalLink          maGraphicExternalLink;
 
 private:
 
@@ -100,12 +102,12 @@ private:
 
     OUString getOriginURL() const
     {
-        return msOriginURL;
+        return maGraphicExternalLink.msURL;
     }
 
     void setOriginURL(OUString const & rOriginURL)
     {
-        msOriginURL = rOriginURL;
+        maGraphicExternalLink.msURL = rOriginURL;
     }
 
     OString getUniqueID()
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index bd51fe571d07..dec1bad37226 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -191,7 +191,7 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic)
     , mbDummyContext(rImpGraphic.mbDummyContext)
     , maVectorGraphicData(rImpGraphic.maVectorGraphicData)
     , maPdfData(rImpGraphic.maPdfData)
-    , msOriginURL(rImpGraphic.msOriginURL)
+    , maGraphicExternalLink(rImpGraphic.maGraphicExternalLink)
 {
     if( rImpGraphic.mpGfxLink )
         mpGfxLink = o3tl::make_unique<GfxLink>( *rImpGraphic.mpGfxLink );
@@ -217,7 +217,7 @@ ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic)
     , mbDummyContext(rImpGraphic.mbDummyContext)
     , maVectorGraphicData(std::move(rImpGraphic.maVectorGraphicData))
     , maPdfData(std::move(rImpGraphic.maPdfData))
-    , msOriginURL(rImpGraphic.msOriginURL)
+    , maGraphicExternalLink(rImpGraphic.maGraphicExternalLink)
 {
     rImpGraphic.ImplClear();
     rImpGraphic.mbDummyContext = false;
@@ -284,7 +284,7 @@ ImpGraphic& ImpGraphic::operator=( const ImpGraphic& rImpGraphic )
         maSwapInfo = rImpGraphic.maSwapInfo;
         mpContext = rImpGraphic.mpContext;
         mbDummyContext = rImpGraphic.mbDummyContext;
-        msOriginURL = rImpGraphic.msOriginURL;
+        maGraphicExternalLink = rImpGraphic.maGraphicExternalLink;
 
         mpAnimation.reset();
 
@@ -328,7 +328,7 @@ ImpGraphic& ImpGraphic::operator=(ImpGraphic&& rImpGraphic)
     mpGfxLink = std::move(rImpGraphic.mpGfxLink);
     maVectorGraphicData = std::move(rImpGraphic.maVectorGraphicData);
     maPdfData = std::move(rImpGraphic.maPdfData);
-    msOriginURL = rImpGraphic.msOriginURL;
+    maGraphicExternalLink = rImpGraphic.maGraphicExternalLink;
 
     rImpGraphic.ImplClear();
     rImpGraphic.mbDummyContext = false;
@@ -448,7 +448,7 @@ void ImpGraphic::ImplClear()
     ImplClearGraphics();
     meType = GraphicType::NONE;
     mnSizeBytes = 0;
-    msOriginURL.clear();
+    maGraphicExternalLink.msURL.clear();
 }
 
 void ImpGraphic::ImplSetDefaultType()


More information about the Libreoffice-commits mailing list