[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - 8 commits - include/vcl vcl/CppunitTest_vcl_graphic_test.mk vcl/inc vcl/qa vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Sat Apr 25 12:36:20 UTC 2020
Rebased ref, commits from common ancestor:
commit 7390a74e1ab45aebc521b2828db1fe7ab94cf272
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 12:34:26 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 d6ec8330ce0324ce016f58f49a917a5800210dee
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 12:34: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 7d667ae58dd06b687c889f394f47b588a4996036
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 12:34:09 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 86532a1e3630..c06aaf477918 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -383,18 +383,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()
@@ -1386,12 +1386,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 54203175140ae175b117992cb078baae29da95a2
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 12:33:53 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 1593a8205255..86532a1e3630 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1355,59 +1355,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
auto pSwapFile = std::make_shared<ImpSwapFile>(aTempFileURL, getOriginURL());
- 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 d86f63e0ef5e56610b702ab91d9a4ed677335023
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 12:28:20 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 4db8042fbedf..1593a8205255 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -73,8 +73,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)
{
}
@@ -84,8 +84,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()
@@ -1332,39 +1357,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;
+ auto pSwapFile = std::make_shared<ImpSwapFile>(aTempFileURL, getOriginURL());
- 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 = std::make_shared<ImpSwapFile>(aTempFileURL, getOriginURL());
- }
- else
- {
- xOutputStream.reset();
- utl::UCBContentHelper::Kill(sTempFileURLString);
- }
+ xOutputStream.reset();
if (bResult)
+ {
+ mpSwapFile = pSwapFile;
vcl::graphic::Manager::get().swappedOut(this);
+ }
return bResult;
}
commit 17f10111a50c0fe99c8fb297f6d6aedeca098efb
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 12:19:33 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 7e7a71c43a6f..4db8042fbedf 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1327,44 +1327,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 = std::make_shared<ImpSwapFile>(aTmpURL, getOriginURL());
+ mpSwapFile = std::make_shared<ImpSwapFile>(aTempFileURL, getOriginURL());
}
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 c56c6f17b77e367f4f01c9a30cb8baedd8b3a147
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 12:19:25 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 5e26a1396adf..7e7a71c43a6f 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -66,21 +66,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();
}
@@ -1343,9 +1354,7 @@ bool ImpGraphic::swapOut()
bool bRet = swapOutToStream( xOStm.get() );
if( bRet )
{
- mpSwapFile = std::make_shared<ImpSwapFile>();
- mpSwapFile->aSwapURL = aTmpURL;
- mpSwapFile->maOriginURL = getOriginURL();
+ mpSwapFile = std::make_shared<ImpSwapFile>(aTmpURL, getOriginURL());
}
else
{
@@ -1435,7 +1444,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() )
{
@@ -1456,7 +1465,7 @@ bool ImpGraphic::swapIn()
bRet = swapInFromStream(xIStm.get());
xIStm.reset();
if (mpSwapFile)
- setOriginURL(mpSwapFile->maOriginURL);
+ setOriginURL(mpSwapFile->getOriginURL());
mpSwapFile.reset();
}
}
commit d164e99e8b18ee197ec3ae46f65d9e7c44e258eb
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 12:18:04 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 1cd351b0a7a4..5e26a1396adf 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -77,6 +77,13 @@ struct ImpSwapFile
}
};
+OUString ImpGraphic::getSwapFileURL()
+{
+ if (mpSwapFile)
+ return mpSwapFile->aSwapURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
+ return OUString();
+}
+
ImpGraphic::ImpGraphic() :
meType ( GraphicType::NONE ),
mnSizeBytes ( 0 ),
More information about the Libreoffice-commits
mailing list