summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-09-21 20:54:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-09-29 09:11:18 +0200
commit4b95451f859bac8e05956ce12df17f1ee410032d (patch)
tree2ebe03c8ecbba3c9179d33c346774e037fcfc224 /svx
parenta08468c1a5255d3fb04cd8a0dc627acdea40426a (diff)
split utl::TempFile into fast and named variants
which makes it easier to know what each variant requires to stay on it's happy path Change-Id: I3275a2543573367714bc78092e882f6535507285 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140469 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/qa/unit/XTableImportExportTest.cxx2
-rw-r--r--svx/qa/unit/core.cxx2
-rw-r--r--svx/qa/unit/customshapes.cxx10
-rw-r--r--svx/qa/unit/gallery/test_gallery.cxx40
-rw-r--r--svx/qa/unit/unodraw.cxx2
-rw-r--r--svx/qa/unit/xoutdev.cxx4
-rw-r--r--svx/source/gallery2/gallerybinaryengine.cxx2
-rw-r--r--svx/source/xml/xmleohlp.cxx3
-rw-r--r--svx/source/xml/xmlgrhlp.cxx8
9 files changed, 34 insertions, 39 deletions
diff --git a/svx/qa/unit/XTableImportExportTest.cxx b/svx/qa/unit/XTableImportExportTest.cxx
index b97a7c50bc6b..cfab5c47c58f 100644
--- a/svx/qa/unit/XTableImportExportTest.cxx
+++ b/svx/qa/unit/XTableImportExportTest.cxx
@@ -35,7 +35,7 @@ public:
CPPUNIT_TEST_FIXTURE(XTableImportExportTest, testImportExport)
{
- utl::TempFile aTempFile(nullptr, true);
+ utl::TempFileNamed aTempFile(nullptr, true);
aTempFile.EnableKillingFile();
OUString aTempURL = aTempFile.GetURL();
BitmapChecksum aChecksum(0);
diff --git a/svx/qa/unit/core.cxx b/svx/qa/unit/core.cxx
index 3966010012e6..de0264555617 100644
--- a/svx/qa/unit/core.cxx
+++ b/svx/qa/unit/core.cxx
@@ -64,7 +64,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf)
uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(0), uno::UNO_QUERY);
// When exporting that chart to PDF:
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
GraphicHelper::SaveShapeAsGraphicToPath(getComponent(), xShape, "application/pdf",
aTempFile.GetURL());
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 39478fd92772..72920aab2933 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -179,7 +179,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_NonUI)
// Generate bitmap from shape
uno::Reference<drawing::XShape> xShape = getShape(0);
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", aTempFile.GetURL());
@@ -218,7 +218,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FrontLightDim)
// Generate bitmap from shape
uno::Reference<drawing::XShape> xShape = getShape(0);
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", aTempFile.GetURL());
@@ -251,7 +251,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf145700_3D_FirstLightHarsh)
// Generate bitmap from shape
uno::Reference<drawing::XShape> xShape = getShape(0);
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", aTempFile.GetURL());
@@ -1234,7 +1234,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf136176)
// Save and reload
uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= OUString("draw8");
@@ -1276,7 +1276,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf148501_OctagonBevel)
// Generate bitmap from shape
uno::Reference<drawing::XShape> xShape = getShape(0);
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
GraphicHelper::SaveShapeAsGraphicToPath(mxComponent, xShape, "image/png", aTempFile.GetURL());
diff --git a/svx/qa/unit/gallery/test_gallery.cxx b/svx/qa/unit/gallery/test_gallery.cxx
index da224b439f3b..6a4c4965bbf3 100644
--- a/svx/qa/unit/gallery/test_gallery.cxx
+++ b/svx/qa/unit/gallery/test_gallery.cxx
@@ -57,8 +57,8 @@ public:
void GalleryObjTest::TestCreateTheme()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -86,8 +86,8 @@ void GalleryObjTest::TestCreateTheme()
void GalleryObjTest::TestDeleteTheme()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -122,8 +122,8 @@ void GalleryObjTest::TestDeleteTheme()
void GalleryObjTest::TestSetThemeName()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -153,8 +153,8 @@ void GalleryObjTest::TestSetThemeName()
void GalleryObjTest::TestThemeURLCase()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -191,8 +191,8 @@ void GalleryObjTest::TestThemeURLCase()
void GalleryObjTest::TestThemeCount()
{
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -232,8 +232,8 @@ void GalleryObjTest::TestThemeCount()
void GalleryObjTest::TestGalleryThemeEntry()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -286,8 +286,8 @@ void GalleryObjTest::TestGalleryThemeEntry()
void GalleryObjTest::TestInsertGalleryObject()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -331,8 +331,8 @@ void GalleryObjTest::TestInsertGalleryObject()
void GalleryObjTest::TestRemoveGalleryObject()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -386,8 +386,8 @@ void GalleryObjTest::TestRemoveGalleryObject()
void GalleryObjTest::TestChangePositionGalleryObject()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
@@ -448,8 +448,8 @@ void GalleryObjTest::TestChangePositionGalleryObject()
void GalleryObjTest::TestGetThemeNameFromGalleryTheme()
{
// Create theme
- std::unique_ptr<utl::TempFile> pTempDir;
- pTempDir.reset(new utl::TempFile(nullptr, true));
+ std::unique_ptr<utl::TempFileNamed> pTempDir;
+ pTempDir.reset(new utl::TempFileNamed(nullptr, true));
CPPUNIT_ASSERT_MESSAGE("Could not create valid temporary directory", pTempDir->IsValid());
pTempDir->EnableKillingFile();
const OUString aGalleryURL = pTempDir->GetURL();
diff --git a/svx/qa/unit/unodraw.cxx b/svx/qa/unit/unodraw.cxx
index d026e07bc076..a1c8fd9d6249 100644
--- a/svx/qa/unit/unodraw.cxx
+++ b/svx/qa/unit/unodraw.cxx
@@ -87,7 +87,7 @@ CPPUNIT_TEST_FIXTURE(UnodrawTest, testWriterGraphicExport)
// picture.
xExportFilter->setSourceDocument(xShape);
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
uno::Sequence<beans::PropertyValue> aProperties(
comphelper::InitPropertySequence({ { "URL", uno::Any(aTempFile.GetURL()) },
diff --git a/svx/qa/unit/xoutdev.cxx b/svx/qa/unit/xoutdev.cxx
index f805f868207e..83f7c2801b06 100644
--- a/svx/qa/unit/xoutdev.cxx
+++ b/svx/qa/unit/xoutdev.cxx
@@ -67,7 +67,7 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testPdfGraphicExport)
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream));
// Export it.
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
XOutFlags const eFlags = XOutFlags::DontExpandFilename | XOutFlags::DontAddExtension
| XOutFlags::UseNativeIfPossible;
@@ -96,7 +96,7 @@ CPPUNIT_TEST_FIXTURE(XOutdevTest, testTdf60684)
GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, aURL, aStream));
// Export it.
- utl::TempFile aTempFile;
+ utl::TempFileNamed aTempFile;
aTempFile.EnableKillingFile();
XOutFlags const eFlags = XOutFlags::DontExpandFilename | XOutFlags::DontAddExtension
| XOutFlags::UseNativeIfPossible;
diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx
index 5bd5728343c5..9b4356c5ed83 100644
--- a/svx/source/gallery2/gallerybinaryengine.cxx
+++ b/svx/source/gallery2/gallerybinaryengine.cxx
@@ -554,7 +554,7 @@ SgaObjectSvDraw GalleryBinaryEngine::updateSvDrawObject(const GalleryObject* pEn
void GalleryBinaryEngine::updateTheme()
{
- ::utl::TempFile aTmp;
+ ::utl::TempFileNamed aTmp;
INetURLObject aInURL(GetSdgURL());
INetURLObject aTmpURL(aTmp.GetURL());
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index 7fd88e492a77..a7392cdeefe0 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -68,7 +68,7 @@ class OutputStorageWrapper_Impl : public ::cppu::WeakImplHelper<XOutputStream>
{
std::mutex maMutex;
Reference < XOutputStream > xOut;
- TempFile aTempFile;
+ TempFileFast aTempFile;
bool bStreamClosed : 1;
SvStream* pStream;
@@ -87,7 +87,6 @@ OutputStorageWrapper_Impl::OutputStorageWrapper_Impl()
: bStreamClosed( false )
, pStream(nullptr)
{
- aTempFile.EnableKillingFile();
pStream = aTempFile.GetStream( StreamMode::READWRITE );
xOut = new OOutputStreamWrapper( *pStream );
}
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 95f9038893ab..03e42c961b13 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -90,7 +90,7 @@ private:
virtual void SAL_CALL closeInput() override;
private:
- utl::TempFile maTempFile;
+ utl::TempFileFast maTempFile;
Reference<XInputStream> mxStreamWrapper;
public:
@@ -109,8 +109,6 @@ public:
GraphicInputStream::GraphicInputStream(GraphicObject const & aGraphicObject, const OUString & rMimeType)
{
- maTempFile.EnableKillingFile();
-
if (aGraphicObject.GetType() == GraphicType::NONE)
return;
@@ -224,7 +222,7 @@ private:
private:
- std::optional<::utl::TempFile> moTmp;
+ std::optional<::utl::TempFileFast> moTmp;
SvStream* mpOStm;
Reference< XOutputStream > mxStmWrapper;
std::optional<GraphicObject> moGrfObj;
@@ -247,8 +245,6 @@ SvXMLGraphicOutputStream::SvXMLGraphicOutputStream()
, moGrfObj(std::in_place)
, mbClosed(false)
{
- moTmp->EnableKillingFile();
-
mpOStm = moTmp->GetStream( StreamMode::READWRITE );
if( mpOStm )