diff options
168 files changed, 942 insertions, 824 deletions
diff --git a/chart2/qa/extras/charttest.hxx b/chart2/qa/extras/charttest.hxx index 0097229cfe34..a2fb6209bcea 100644 --- a/chart2/qa/extras/charttest.hxx +++ b/chart2/qa/extras/charttest.hxx @@ -116,8 +116,8 @@ class ChartTest : public test::BootstrapFixture, public unotest::MacrosTest, pub public: ChartTest():mbSkipValidation(false) {} void load( std::u16string_view rDir, std::u16string_view rFileName ); - std::shared_ptr<utl::TempFile> save( const OUString& rFileName ); - std::shared_ptr<utl::TempFile> reload( const OUString& rFileName ); + std::shared_ptr<utl::TempFileNamed> save( const OUString& rFileName ); + std::shared_ptr<utl::TempFileNamed> reload( const OUString& rFileName ); uno::Sequence < OUString > getImpressChartColumnDescriptions( std::u16string_view pDir, const char* pName ); std::u16string_view getFileExtension( std::u16string_view rFileName ); @@ -174,22 +174,22 @@ void ChartTest::load( std::u16string_view aDir, std::u16string_view aName ) mxComponent = loadFromDesktop(m_directories.getURLFromSrc(aDir) + aName, maServiceName); } -std::shared_ptr<utl::TempFile> ChartTest::save(const OUString& rFilterName) +std::shared_ptr<utl::TempFileNamed> ChartTest::save(const OUString& rFilterName) { uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); auto aArgs(::comphelper::InitPropertySequence({ { "FilterName", Any(rFilterName) } })); - std::shared_ptr<utl::TempFile> pTempFile = std::make_shared<utl::TempFile>(); + std::shared_ptr<utl::TempFileNamed> pTempFile = std::make_shared<utl::TempFileNamed>(); pTempFile->EnableKillingFile(); xStorable->storeToURL(pTempFile->GetURL(), aArgs); return pTempFile; } -std::shared_ptr<utl::TempFile> ChartTest::reload(const OUString& rFilterName) +std::shared_ptr<utl::TempFileNamed> ChartTest::reload(const OUString& rFilterName) { - std::shared_ptr<utl::TempFile> pTempFile = save(rFilterName); + std::shared_ptr<utl::TempFileNamed> pTempFile = save(rFilterName); mxComponent->dispose(); mxComponent = loadFromDesktop(pTempFile->GetURL(), maServiceName); std::cout << pTempFile->GetURL(); @@ -723,7 +723,7 @@ getShapeByName(const uno::Reference<drawing::XShapes>& rShapes, const OUString& xmlDocUniquePtr ChartTest::parseExport(const OUString& rDir, const OUString& rFilterFormat) { - std::shared_ptr<utl::TempFile> pTempFile = save(rFilterFormat); + std::shared_ptr<utl::TempFileNamed> pTempFile = save(rFilterFormat); // Read the XML stream we're interested in. uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), pTempFile->GetURL()); diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index e19abc6ed1f3..e194b6a222df 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2478,13 +2478,13 @@ OUString ODbaseTable::createTempFile() aIdent += "/"; OUString sExt("." + m_pConnection->getExtension()); - TempFile aTempFile(m_Name, true, sExt, &aIdent); - if(!aTempFile.IsValid()) + OUString aTempFileURL = utl::CreateTempURL(m_Name, true, sExt, &aIdent); + if(aTempFileURL.isEmpty()) getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE, *this); INetURLObject aURL; aURL.SetSmartProtocol(INetProtocol::File); - aURL.SetURL(aTempFile.GetURL()); + aURL.SetURL(aTempFileURL); OUString sNewName(aURL.getName().copy(0, aURL.getName().getLength() - sExt.getLength())); diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index 9230eb22f13b..e673d3f9fbff 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -161,7 +161,7 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >& bIsNewDatabase = !m_xEmbeddedStorage->hasElements(); - m_pDatabaseFileDir.reset(new ::utl::TempFile(nullptr, true)); + m_pDatabaseFileDir.reset(new ::utl::TempFileNamed(nullptr, true)); m_pDatabaseFileDir->EnableKillingFile(); m_sFirebirdURL = m_pDatabaseFileDir->GetFileName() + "/firebird.fdb"; m_sFBKPath = m_pDatabaseFileDir->GetFileName() + "/firebird.fbk"; diff --git a/connectivity/source/drivers/firebird/Connection.hxx b/connectivity/source/drivers/firebird/Connection.hxx index 9fdb0d4d3320..fa896439c9e7 100644 --- a/connectivity/source/drivers/firebird/Connection.hxx +++ b/connectivity/source/drivers/firebird/Connection.hxx @@ -104,7 +104,7 @@ namespace connectivity::firebird * The extracted .fbk is written in firebird.fbk, the temporary * .fdb is stored as firebird.fdb. */ - std::unique_ptr< ::utl::TempFile > m_pDatabaseFileDir; + std::unique_ptr< ::utl::TempFileNamed > m_pDatabaseFileDir; /** * Path for our extracted .fbk file. * diff --git a/connectivity/source/drivers/firebird/Driver.hxx b/connectivity/source/drivers/firebird/Driver.hxx index 06841d937e70..d884b5008d6a 100644 --- a/connectivity/source/drivers/firebird/Driver.hxx +++ b/connectivity/source/drivers/firebird/Driver.hxx @@ -45,8 +45,8 @@ namespace connectivity::firebird { private: css::uno::Reference<css::uno::XComponentContext> m_aContext; - ::utl::TempFile m_firebirdTMPDirectory; - ::utl::TempFile m_firebirdLockDirectory; + ::utl::TempFileNamed m_firebirdTMPDirectory; + ::utl::TempFileNamed m_firebirdLockDirectory; protected: ::osl::Mutex m_aMutex; // mutex is need to control member access diff --git a/dbaccess/qa/unit/dbtest_base.cxx b/dbaccess/qa/unit/dbtest_base.cxx index b5a3bd31cf90..6a2bbb2ef706 100644 --- a/dbaccess/qa/unit/dbtest_base.cxx +++ b/dbaccess/qa/unit/dbtest_base.cxx @@ -30,7 +30,7 @@ class DBTestBase public: DBTestBase() : UnoApiTest("dbaccess/qa/unit/data") {}; - utl::TempFile createTempCopy(std::u16string_view pathname); + utl::TempFileNamed createTempCopy(std::u16string_view pathname); uno::Reference< XOfficeDatabaseDocument > getDocumentForFileName(std::u16string_view sFileName); @@ -42,10 +42,10 @@ public: uno::Reference< XOfficeDatabaseDocument > const & xDocument); }; -utl::TempFile DBTestBase::createTempCopy(std::u16string_view pathname) { +utl::TempFileNamed DBTestBase::createTempCopy(std::u16string_view pathname) { OUString url; createFileURL(pathname, url); - utl::TempFile tmp; + utl::TempFileNamed tmp; tmp.EnableKillingFile(); auto const e = osl::File::copy(url, tmp.GetURL()); CPPUNIT_ASSERT_EQUAL_MESSAGE( diff --git a/dbaccess/qa/unit/embeddeddb_performancetest.cxx b/dbaccess/qa/unit/embeddeddb_performancetest.cxx index 17eaa52aeb9d..600704ef787d 100644 --- a/dbaccess/qa/unit/embeddeddb_performancetest.cxx +++ b/dbaccess/qa/unit/embeddeddb_performancetest.cxx @@ -195,7 +195,7 @@ void EmbeddedDBPerformanceTest::doPerformanceTestOnODB( std::u16string_view rDBName, const bool bUsePreparedStatement) { - ::utl::TempFile aFile; + ::utl::TempFileNamed aFile; aFile.EnableKillingFile(); { diff --git a/dbaccess/qa/unit/hsql_binary_import.cxx b/dbaccess/qa/unit/hsql_binary_import.cxx index 4eac0cdc4130..c77d9e5328d3 100644 --- a/dbaccess/qa/unit/hsql_binary_import.cxx +++ b/dbaccess/qa/unit/hsql_binary_import.cxx @@ -46,7 +46,7 @@ void HsqlBinaryImportTest::testBinaryImport() } // the migration requires the file to be writable - utl::TempFile const temp(createTempCopy(u"hsqldb_migration_test.odb")); + utl::TempFileNamed const temp(createTempCopy(u"hsqldb_migration_test.odb")); uno::Reference<XOfficeDatabaseDocument> const xDocument = getDocumentForUrl(temp.GetURL()); uno::Reference<XConnection> xConnection = getConnectionForDocument(xDocument); diff --git a/dbaccess/qa/unit/tdf119625.cxx b/dbaccess/qa/unit/tdf119625.cxx index 22fb5849305e..267730286561 100644 --- a/dbaccess/qa/unit/tdf119625.cxx +++ b/dbaccess/qa/unit/tdf119625.cxx @@ -66,7 +66,7 @@ void Tdf119625Test::testTime() } // the migration requires the file to be writable - utl::TempFile const temp(createTempCopy(u"tdf119625.odb")); + utl::TempFileNamed const temp(createTempCopy(u"tdf119625.odb")); uno::Reference<XOfficeDatabaseDocument> const xDocument = getDocumentForUrl(temp.GetURL()); uno::Reference<XConnection> xConnection = getConnectionForDocument(xDocument); diff --git a/dbaccess/qa/unit/tdf126268.cxx b/dbaccess/qa/unit/tdf126268.cxx index a4ed9dc3b868..b325d8dc1f62 100644 --- a/dbaccess/qa/unit/tdf126268.cxx +++ b/dbaccess/qa/unit/tdf126268.cxx @@ -60,7 +60,7 @@ void Tdf126268Test::testNumbers() } // the migration requires the file to be writable - utl::TempFile const temp(createTempCopy(u"tdf126268.odb")); + utl::TempFileNamed const temp(createTempCopy(u"tdf126268.odb")); uno::Reference<XOfficeDatabaseDocument> const xDocument = getDocumentForUrl(temp.GetURL()); uno::Reference<XConnection> xConnection = getConnectionForDocument(xDocument); diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index 3db610503313..3e21289dbe9a 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -836,7 +836,7 @@ bool ODatabaseModelImpl::commitEmbeddedStorage( bool _bPreventRootCommits ) bool ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors( const Reference< XStorage >& _rxStorage ) { bool bTryToPreserveScriptSignature = false; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OUString sTmpFileUrl = aTempFile.GetURL(); SignatureState aSignatureState = getScriptingSignatureState(); diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx index 77aa33472921..c69c04699769 100644 --- a/dbaccess/source/ui/misc/TableCopyHelper.cxx +++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx @@ -269,7 +269,7 @@ bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedData if ( bRet ) { // now we need to copy the stream - ::utl::TempFile aTmp; + ::utl::TempFileNamed aTmp; _rAsyncDrop.aUrl = aTmp.GetURL(); ::tools::SvRef<SotTempStream> aNew = new SotTempStream( aTmp.GetFileName() ); _rAsyncDrop.aHtmlRtfStorage->Seek(STREAM_SEEK_TO_BEGIN); diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 437acd28df42..f8b5e02536df 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -678,7 +678,7 @@ void DesktopLOKTest::testPaintTile() void DesktopLOKTest::testSaveAs() { LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", nullptr)); } @@ -689,7 +689,7 @@ void DesktopLOKTest::testSaveAsJsonOptions() LibLODocument_Impl* pDocument = loadDoc("3page.odg"); // When exporting that document to PDF, skipping the first page: - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OString aOptions("{\"PageRange\":{\"type\":\"string\",\"value\":\"2-\"}}"); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "pdf", aOptions.getStr())); @@ -714,7 +714,7 @@ void DesktopLOKTest::testSaveAsJsonOptions() void DesktopLOKTest::testSaveAsCalc() { LibLODocument_Impl* pDocument = loadDoc("search.ods"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "png", nullptr)); } @@ -2731,7 +2731,7 @@ void DesktopLOKTest::testInsertCertificate_DER_ODT() { // Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "odt", nullptr)); closeDoc(); @@ -2781,7 +2781,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT() { // Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "odt", nullptr)); closeDoc(); @@ -2838,7 +2838,7 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX() { // Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.docx"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "docx", nullptr)); closeDoc(); @@ -2895,7 +2895,7 @@ void DesktopLOKTest::testSignDocument_PEM_PDF() { // Load the document, save it into a temp file and load that file again LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); Scheduler::ProcessEventsToIdle(); @@ -3105,7 +3105,7 @@ void DesktopLOKTest::testCalcSaveAs() Scheduler::ProcessEventsToIdle(); // Save as a new file. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "ods", nullptr); closeDoc(); diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 9ce317209e87..1c837b833d16 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -245,11 +245,11 @@ void Desktop::CreateTemporaryDirectory() } // create new current temporary directory - OUString aTempPath = ::utl::TempFile::SetTempNameBaseDirectory( aTempBaseURL ); + OUString aTempPath = ::utl::SetTempNameBaseDirectory( aTempBaseURL ); if ( aTempPath.isEmpty() && ::osl::File::getTempDirURL( aTempBaseURL ) == osl::FileBase::E_None ) { - aTempPath = ::utl::TempFile::SetTempNameBaseDirectory( aTempBaseURL ); + aTempPath = ::utl::SetTempNameBaseDirectory( aTempBaseURL ); } // set new current temporary directory diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 16b76cb789fd..8ae45b40daa6 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -572,10 +572,10 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest OUString aOutFile = aOutFilename.GetMainURL(INetURLObject::DecodeMechanism::NONE); - std::unique_ptr<utl::TempFile> fileForCat; + std::unique_ptr<utl::TempFileNamed> fileForCat; if( aDispatchRequest.aRequestType == REQUEST_CAT ) { - fileForCat = std::make_unique<utl::TempFile>(); + fileForCat = std::make_unique<utl::TempFileNamed>(); if (fileForCat->IsValid()) fileForCat->EnableKillingFile(); else diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx index 2748373e5f62..e0d5bcd832b5 100644 --- a/desktop/source/app/updater.cxx +++ b/desktop/source/app/updater.cxx @@ -285,7 +285,7 @@ bool isUserWritable(const OUString& rFileURL) bool update() { - utl::TempFile aTempDir(nullptr, true); + utl::TempFileNamed aTempDir(nullptr, true); OUString aTempDirURL = aTempDir.GetURL(); CopyUpdaterToTempDir(Updater::getExecutableDirURL(), aTempDirURL); @@ -566,7 +566,7 @@ std::string download_content(const OString& rURL, bool bFile, OUString& rHash) curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); std::string response_body; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; WriteDataFile aFile(aTempFile.GetStream(StreamMode::WRITE)); if (!bFile) { diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index 2c52741c2acb..b26d1004a053 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -608,9 +608,7 @@ OUString PackageManagerImpl::insertToActivationLayer( Reference<XCommandEnvironment> xCmdEnv( sourceContent.getCommandEnvironment() ); - OUString baseDir(m_activePackages_expanded); - ::utl::TempFile aTemp(&baseDir, false); - OUString tempEntry = aTemp.GetURL(); + OUString tempEntry = ::utl::CreateTempURL(&m_activePackages_expanded, false); tempEntry = tempEntry.copy(tempEntry.lastIndexOf('/') + 1); OUString destFolder = makeURL( m_activePackages, tempEntry) + "_"; diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 28fe1b8de218..016ff66286d9 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -215,9 +215,7 @@ OUString PackageRegistryBackend::createFolder( ucbhelper::Content dataContent; ::dp_misc::create_folder(&dataContent, sDataFolder, xCmdEnv); - const OUString baseDir(sDataFolder); - ::utl::TempFile aTemp(&baseDir, true); - const OUString& url = aTemp.GetURL(); + const OUString url = ::utl::CreateTempURL(&sDataFolder, true); return sDataFolder + url.subView(url.lastIndexOf('/')); } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index b3fae56f721f..bf088d2a4f52 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -6624,7 +6624,7 @@ static void preloadData() // Create user profile in the temp directory for loading the dictionaries OUString sUserPath; rtl::Bootstrap::get("UserInstallation", sUserPath); - utl::TempFile aTempDir(nullptr, true); + utl::TempFileNamed aTempDir(nullptr, true); aTempDir.EnableKillingFile(); rtl::Bootstrap::set("UserInstallation", aTempDir.GetURL()); diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index f733dbb4dde9..5e3828dea8b2 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -216,7 +216,7 @@ extern "C" int unopkg_main() Reference<XLogHandler> xFileHandler; Reference<XLogHandler> xConsoleHandler; std::unique_ptr<comphelper::EventLogger> logger; - std::unique_ptr<utl::TempFile> pUserProfileTempDir; + std::unique_ptr<utl::TempFileNamed> pUserProfileTempDir; OptionInfo const * info_shared = getOptionInfo( s_option_infos, "shared" ); @@ -314,7 +314,7 @@ extern "C" int unopkg_main() // tdf#129917 Use temp user profile when installing shared extensions if (option_shared) { - pUserProfileTempDir.reset(new utl::TempFile(nullptr, true)); + pUserProfileTempDir.reset(new utl::TempFileNamed(nullptr, true)); pUserProfileTempDir->EnableKillingFile(); } diff --git a/embeddedobj/qa/cppunit/msole.cxx b/embeddedobj/qa/cppunit/msole.cxx index 85be389384fa..c7ec2476f8a1 100644 --- a/embeddedobj/qa/cppunit/msole.cxx +++ b/embeddedobj/qa/cppunit/msole.cxx @@ -112,7 +112,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSaveOnThread) getComponent().set(loadFromDesktop(aURL, "com.sun.star.text.TextDocument", aLoadProperties)); // When saving that document on a thread: - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OdtExportThread aThread(getComponent(), aTempFile.GetURL()); aThread.create(); diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index de03e1158775..0e92a8796433 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -698,7 +698,7 @@ bool Sane::Start( BitmapTransporter& rBitmap ) if( nStatus != SANE_STATUS_GOOD ) bSynchronousRead = true; } - utl::TempFile aFrame; + utl::TempFileNamed aFrame; aFrame.EnableKillingFile(); FILE* pFrame = fopen(OUStringToOString(aFrame.GetFileName(), osl_getThreadTextEncoding()).getStr(), "w+b"); if( ! pFrame ) diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 6d8a55ee9177..460d0c1a1a73 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -1846,9 +1846,7 @@ rtl::Reference<SdrObject> SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId, rStCtrl.SeekRel( 4 ); - ::utl::TempFile aTmpFile; - aTmpFile.EnableKillingFile(); - + ::utl::TempFileFast aTmpFile; SvStream* pDest = aTmpFile.GetStream(StreamMode::READWRITE); if (pDest) { diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx index 746a1dd9b178..2d6f8743373f 100644 --- a/filter/source/pdf/pdffilter.cxx +++ b/filter/source/pdf/pdffilter.cxx @@ -179,7 +179,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) if( mxSrcDoc.is() && xOStm.is() ) { PDFExport aExport( mxSrcDoc, xStatusIndicator, xIH, mxContext ); - ::utl::TempFile aTempFile; + ::utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); bRet = aExport.Export( aTempFile.GetURL(), aFilterData ); diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 71fe6b428676..fbf48565823a 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -2503,8 +2503,7 @@ void SVGFilter::implCreateObjectsFromBackground( const Reference< css::drawing:: GDIMetaFile aMtf; - utl::TempFile aFile; - aFile.EnableKillingFile(); + utl::TempFileFast aFile; SvStream* pStream = aFile.GetStream(StreamMode::READWRITE); Sequence< PropertyValue > aDescriptor{ diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx index ac78fb8c3d75..5177606ee2de 100644 --- a/filter/source/xsltdialog/xmlfilterjar.cxx +++ b/filter/source/xsltdialog/xmlfilterjar.cxx @@ -191,8 +191,7 @@ bool XMLFilterJarHelper::savePackage( const OUString& rPackageURL, const std::ve } // create TypeDetection.xcu - utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); + utl::TempFileFast aTempFile; SvStream* pStream = aTempFile.GetStream(StreamMode::READWRITE); { diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 1923243834f7..068132df6bad 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -418,7 +418,7 @@ void XMLFilterTestDialog::doExport( const Reference< XComponent >& xComp ) Reference< XStorable > xStorable( xComp, UNO_QUERY ); if( xStorable.is() ) { - utl::TempFile aTempFile(u"", true, u".xml"); + utl::TempFileNamed aTempFile(u"", true, u".xml"); OUString aTempFileURL( aTempFile.GetURL() ); const application_info_impl* pAppInfo = getApplicationInfo( m_xFilterInfo->maExportService ); @@ -577,7 +577,7 @@ void XMLFilterTestDialog::import( const OUString& rURL ) if( m_xCBXDisplaySource->get_active() ) { - TempFile aTempFile(u"", true, u".xml"); + TempFileNamed aTempFile(u"", true, u".xml"); OUString aTempFileURL( aTempFile.GetURL() ); Reference< XImportFilter > xImporter( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.documentconversion.XSLTFilter", mxContext ), UNO_QUERY ); diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index a17e9464e715..30894359e38b 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3485,9 +3485,7 @@ void AutoRecovery::implts_generateNewTempURL(const OUString& sBack // TODO: Must we strip some illegal signs - if we use the title? - ::utl::TempFile aTempFile(sUniqueName, true, rInfo.Extension, &sBackupPath, true); - - rInfo.NewTempURL = aTempFile.GetURL(); + rInfo.NewTempURL = ::utl::CreateTempURL(sUniqueName, true, rInfo.Extension, &sBackupPath, true); } void AutoRecovery::implts_informListener( Job eJob , diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx index 33e0c252f7bd..51fbd9b539a2 100644 --- a/hwpfilter/source/htags.cxx +++ b/hwpfilter/source/htags.cxx @@ -112,7 +112,7 @@ void OlePicture::Read(HWPFile & hwpf) return; } - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); SvFileStream aOutputStream(aTempFile.GetURL(), StreamMode::WRITE); diff --git a/include/test/htmltesttools.hxx b/include/test/htmltesttools.hxx index 154bb902dfac..d72d43f8c988 100644 --- a/include/test/htmltesttools.hxx +++ b/include/test/htmltesttools.hxx @@ -24,7 +24,7 @@ using htmlDocUniquePtr = xmlDocUniquePtr; class OOO_DLLPUBLIC_TEST HtmlTestTools { protected: - static htmlDocUniquePtr parseHtml(utl::TempFile const& aTempFile); + static htmlDocUniquePtr parseHtml(utl::TempFileNamed const& aTempFile); static htmlDocUniquePtr parseHtmlStream(SvStream* pStream); }; diff --git a/include/test/xmltesttools.hxx b/include/test/xmltesttools.hxx index a4f0ef30d8ba..f408273b802e 100644 --- a/include/test/xmltesttools.hxx +++ b/include/test/xmltesttools.hxx @@ -42,7 +42,7 @@ protected: XmlTestTools(); virtual ~XmlTestTools(); - static xmlDocUniquePtr parseXml(utl::TempFile const & aTempFile); + static xmlDocUniquePtr parseXml(utl::TempFileNamed const & aTempFile); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx); diff --git a/include/unotest/macros_test.hxx b/include/unotest/macros_test.hxx index 8773a6c99568..b2ac283e4f7d 100644 --- a/include/unotest/macros_test.hxx +++ b/include/unotest/macros_test.hxx @@ -37,7 +37,7 @@ class Directories; } namespace utl { -class TempFile; +class TempFileNamed; } namespace com::sun::star::security @@ -92,7 +92,7 @@ public: const css::uno::Sequence<css::beans::PropertyValue>& rPropertyValues); /// Opens rStreamName from rTempFile, assuming it's a ZIP storage. - static std::unique_ptr<SvStream> parseExportStream(const utl::TempFile& rTempFile, + static std::unique_ptr<SvStream> parseExportStream(const utl::TempFileNamed& rTempFile, const OUString& rStreamName); void setUpNssGpg(const test::Directories& rDirectories, const OUString& rTestName); diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx index bb44b2bf46a1..460f13b96e90 100644 --- a/include/unotools/tempfile.hxx +++ b/include/unotools/tempfile.hxx @@ -16,9 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#ifndef INCLUDED_UNOTOOLS_TEMPFILE_HXX -#define INCLUDED_UNOTOOLS_TEMPFILE_HXX +#pragma once #include <unotools/unotoolsdllapi.h> #include <tools/stream.hxx> @@ -27,6 +25,74 @@ namespace utl { + +/** + This is the "fast" temp file. Different OSes have different ideas how this should work, so this + class presents an interface that is fast across Windows and Unix (which differ in how they want + temp files to work). + The key point is that such a temporary file is only a readable/writeable stream, and does not have + a filename, or a location in the filesystem hierarchy. + If you need a name or a URL, you should use TempFileNamed, which is slower, but creates an actual + file in the filesystem. +*/ +class UNOTOOLS_DLLPUBLIC TempFileFast +{ + std::unique_ptr<SvFileStream> mxStream; + +public: + TempFileFast(); + TempFileFast(TempFileFast && other) noexcept; + ~TempFileFast(); + + /** + Returns a stream to the tempfiles data; the stream is owned by the tempfile object, so you have to keep this + alive as long as you want to use the stream. + */ + SvStream* GetStream( StreamMode eMode ); + + /** + Close and destroy the owned stream object if any. + */ + void CloseStream(); + +}; + +/** +Only create a "physical" file name for a temporary file that would be valid at that moment. +Should only be used for 3rd party code with a file name interface that wants to create the file by itself. +If you want to convert file name into a URL, always use class LocalFileHelper, but never use any +conversion functions of osl. +*/ +UNOTOOLS_DLLPUBLIC OUString CreateTempName(); + +UNOTOOLS_DLLPUBLIC OUString CreateTempURL( const OUString* pParent=nullptr, bool bDirectory=false ); + +/** +Same as above; additionally the name starts with some given characters followed by a counter ( example: +rLeadingChars="abc" means "abc0","abc1" and so on, depending on existing files in the folder ). +The extension string may be f.e. ".txt" or "", if no extension string is given, ".tmp" is used + @param _bStartWithZero If set to false names will be generated like "abc","abc0","abc1" + @param bCreateParentDirs If rLeadingChars contains a slash, this will create the required + parent directories. +*/ +UNOTOOLS_DLLPUBLIC OUString CreateTempURL( std::u16string_view rLeadingChars, bool _bStartWithZero=true, std::u16string_view pExtension={}, + const OUString* pParent=nullptr, bool bCreateParentDirs=false ); + +/** +The TempNameBaseDirectory is a subfolder in the folder that is passed as a "physical" file name in the +SetTempNameBaseDirectory method. +This subfolder will be used if a TempFile or TempName is created without a parent name or a parent name +that does not belong to the local file system. +The caller of the SetTempNameBase is responsible for deleting this folder and all temporary files in it. +The return value of both methods is the complete "physical" name of the tempname base folder. +It is not a URL because all URLs must be "UCB compatible", so there may be no suitable URL at all. +*/ +UNOTOOLS_DLLPUBLIC OUString SetTempNameBaseDirectory( const OUString &rBaseName ); + +// Return the URL of the temp directory (the one set with SetTempNameBaseDirectory or the +// default tempfile folder): +UNOTOOLS_DLLPUBLIC OUString GetTempNameBaseDirectory(); + /** The class TempFile gives access to temporary files in the local file system. Sometimes they are needed because a 3rd party code has a file name based interface, or some file access has to be done locally without transferring tons of bytes to or @@ -42,9 +108,9 @@ namespace utl So it is a potential error to convert between the filename and the URL of a TempFile object using functions or methods outside this class. */ - -class UNOTOOLS_DLLPUBLIC TempFile +class UNOTOOLS_DLLPUBLIC TempFileNamed { +friend UNOTOOLS_DLLPUBLIC OUString SetTempNameBaseDirectory( const OUString & ); OUString aName; std::unique_ptr<SvStream> pStream; @@ -58,7 +124,7 @@ public: The temporary object is created in the local file system, even if there is no UCB that can access it. If the given folder is part of the local file system, the TempFile is created in this folder. */ - TempFile( const OUString* pParent = nullptr, bool bDirectory=false ); + TempFileNamed( const OUString* pParent=nullptr, bool bDirectory=false ); /** Same as above; additionally the name starts with some given characters followed by a counter ( example: @@ -68,16 +134,16 @@ public: @param bCreateParentDirs If rLeadingChars contains a slash, this will create the required parent directories. */ - TempFile( std::u16string_view rLeadingChars, bool _bStartWithZero=true, std::u16string_view pExtension={}, + TempFileNamed( std::u16string_view rLeadingChars, bool _bStartWithZero=true, std::u16string_view pExtension={}, const OUString* pParent = nullptr, bool bCreateParentDirs=false ); - TempFile(TempFile && other) noexcept; + TempFileNamed(TempFileNamed && other) noexcept; /** TempFile will be removed from disk in dtor if EnableKillingFile(true) was called before. Temporary directories will be removed recursively in that case. */ - ~TempFile(); + ~TempFileNamed(); /** Returns sal_True if it has a valid file name. @@ -114,32 +180,8 @@ public: void EnableKillingFile( bool bEnable=true ) { bKillingFileEnabled = bEnable; } - /** - Only create a "physical" file name for a temporary file that would be valid at that moment. - Should only be used for 3rd party code with a file name interface that wants to create the file by itself. - If you want to convert file name into a URL, always use class LocalFileHelper, but never use any - conversion functions of osl. - */ - static OUString CreateTempName(); - - /** - The TempNameBaseDirectory is a subfolder in the folder that is passed as a "physical" file name in the - SetTempNameBaseDirectory method. - This subfolder will be used if a TempFile or TempName is created without a parent name or a parent name - that does not belong to the local file system. - The caller of the SetTempNameBase is responsible for deleting this folder and all temporary files in it. - The return value of both methods is the complete "physical" name of the tempname base folder. - It is not a URL because all URLs must be "UCB compatible", so there may be no suitable URL at all. - */ - static OUString SetTempNameBaseDirectory( const OUString &rBaseName ); - - // Return the URL of the temp directory (the one set with SetTempNameBaseDirectory or the - // default tempfile folder): - static OUString GetTempNameBaseDirectory(); }; } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 2317f411ec7e..12c4de7462e7 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -92,7 +92,7 @@ void OoxDrawingmlTest::loadAndReload(const OUString& rURL, const OUString& rFilt uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); mxComponent->dispose(); @@ -346,7 +346,7 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testTableShadow) uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("Impress Office Open XML"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); getComponent()->dispose(); diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 64e1cfaa47e7..d8771b0b9699 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -26,13 +26,13 @@ class Test : public test::BootstrapFixture, public unotest::MacrosTest, public X { private: uno::Reference<lang::XComponent> mxComponent; - utl::TempFile maTempFile; + utl::TempFileNamed maTempFile; public: void setUp() override; void tearDown() override; void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override; - utl::TempFile& getTempFile() { return maTempFile; } + utl::TempFileNamed& getTempFile() { return maTempFile; } void loadAndSave(const OUString& rURL, const OUString& rFilterName); }; diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 9f1360a4256b..3437df46f2fd 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -484,7 +484,6 @@ void OWriteStream_Impl::GetFilledTempFileIfNo( const uno::Reference< io::XInputS if ( !m_oTempFile.has_value() ) { m_oTempFile.emplace(); - m_oTempFile->EnableKillingFile(); try { if ( xStream.is() ) @@ -550,7 +549,6 @@ void OWriteStream_Impl::FillTempGetFileName() else if ( !m_oTempFile.has_value() ) { m_oTempFile.emplace(); - m_oTempFile->EnableKillingFile(); try { // copy stream contents to the file diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index 9fa6c6ea0e59..140257641576 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -74,7 +74,7 @@ struct OWriteStream_Impl friend class OInputCompStream; OWriteStream* m_pAntiImpl; - std::optional<utl::TempFile> m_oTempFile; + std::optional<utl::TempFileFast> m_oTempFile; css::uno::Reference< css::io::XStream > m_xCacheStream; css::uno::Reference< css::io::XSeekable > m_xCacheSeek; diff --git a/package/source/xstor/selfterminatefilestream.cxx b/package/source/xstor/selfterminatefilestream.cxx index 798f278f76f3..f3fe79439781 100644 --- a/package/source/xstor/selfterminatefilestream.cxx +++ b/package/source/xstor/selfterminatefilestream.cxx @@ -25,7 +25,7 @@ using namespace ::com::sun::star; -OSelfTerminateFileStream::OSelfTerminateFileStream( const uno::Reference< uno::XComponentContext >& xContext, utl::TempFile aTempFile ) +OSelfTerminateFileStream::OSelfTerminateFileStream( const uno::Reference< uno::XComponentContext >& xContext, utl::TempFileFast aTempFile ) : m_oTempFile( std::move(aTempFile) ) { uno::Reference< uno::XComponentContext > xOwnContext = xContext; diff --git a/package/source/xstor/selfterminatefilestream.hxx b/package/source/xstor/selfterminatefilestream.hxx index 333d1e55790e..f8cedcb64c46 100644 --- a/package/source/xstor/selfterminatefilestream.hxx +++ b/package/source/xstor/selfterminatefilestream.hxx @@ -35,11 +35,11 @@ struct OWriteStream_Impl; class OSelfTerminateFileStream final : public cppu::WeakImplHelper< css::io::XInputStream, css::io::XSeekable > { - std::optional<utl::TempFile> m_oTempFile; + std::optional<utl::TempFileFast> m_oTempFile; rtl::Reference< utl::OSeekableInputStreamWrapper > m_xStreamWrapper; public: - OSelfTerminateFileStream( const css::uno::Reference< css::uno::XComponentContext >& xContext, utl::TempFile aTempFile ); + OSelfTerminateFileStream( const css::uno::Reference< css::uno::XComponentContext >& xContext, utl::TempFileFast aTempFile ); virtual ~OSelfTerminateFileStream() override; diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index 5b290b6d4639..3ac69bbeae60 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -171,12 +171,14 @@ OUString OReportEngineJFree::getNewOutputName() OUString sName = m_xReport->getCaption(); if ( sName.isEmpty() ) sName = m_xReport->getName(); + sFileURL = ::utl::CreateTempURL(sName, false, sExt); + if ( sFileURL.isEmpty() ) { - ::utl::TempFile aTestFile(sName, false, sExt); + ::utl::TempFileNamed aTestFile(sName, false, sExt); if ( !aTestFile.IsValid() ) { sName = RptResId(RID_STR_REPORT); - ::utl::TempFile aFile(sName, false, sExt); + ::utl::TempFileNamed aFile(sName, false, sExt); sFileURL = aFile.GetURL(); } else diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx index 663bb468c76e..a94a34ba24d5 100644 --- a/sc/qa/extras/htmlexporttest.cxx +++ b/sc/qa/extras/htmlexporttest.cxx @@ -39,7 +39,7 @@ class ScHTMLExportTest : public test::BootstrapFixture, public unotest::MacrosTe mxComponent = loadFromDesktop(m_directories.getURLFromSrc(pDir) + OUString::createFromAscii(pName), "com.sun.star.comp.Calc.SpreadsheetDocument"); } - void save(const OUString& aFilterName, TempFile const & rTempFile) + void save(const OUString& aFilterName, TempFileNamed const & rTempFile) { Reference<XStorable> xStorable(mxComponent, UNO_QUERY); MediaDescriptor aMediaDescriptor; @@ -70,10 +70,10 @@ public: void testHtmlSkipImage() { // need a temp dir, because there's an image exported too - TempFile aTempDir(nullptr, true); + TempFileNamed aTempDir(nullptr, true); aTempDir.EnableKillingFile(); OUString const url(aTempDir.GetURL()); - TempFile aTempFile(&url, false); + TempFileNamed aTempFile(&url, false); htmlDocUniquePtr pDoc; diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 69e494d31434..36afbe4bed25 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -122,7 +122,7 @@ void ScMacrosTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) void ScMacrosTest::saveAndReload(css::uno::Reference<css::lang::XComponent>& xComponent, const OUString& rFilter) { - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); css::uno::Sequence aArgs{ comphelper::makePropertyValue("FilterName", rFilter) }; css::uno::Reference<css::frame::XStorable> xStorable(xComponent, css::uno::UNO_QUERY_THROW); @@ -314,7 +314,7 @@ void ScMacrosTest::testMacroButtonFormControlXlsxExport() uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("Calc MS Excel 2007 VBA XML"); - auto pTempFile = std::make_shared<utl::TempFile>(); + auto pTempFile = std::make_shared<utl::TempFileNamed>(); pTempFile->EnableKillingFile(); xStorable->storeToURL(pTempFile->GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); xComponent->dispose(); diff --git a/sc/qa/extras/scddelinkobj.cxx b/sc/qa/extras/scddelinkobj.cxx index 14273198ff49..bc46bc1449d5 100644 --- a/sc/qa/extras/scddelinkobj.cxx +++ b/sc/qa/extras/scddelinkobj.cxx @@ -33,9 +33,9 @@ using namespace com::sun::star; namespace sc_apitest { -static utl::TempFile createTempCopy(OUString const& url) +static utl::TempFileNamed createTempCopy(OUString const& url) { - utl::TempFile tmp; + utl::TempFileNamed tmp; tmp.EnableKillingFile(); auto const e = osl::File::copy(url, tmp.GetURL()); CPPUNIT_ASSERT_EQUAL_MESSAGE( @@ -50,7 +50,7 @@ namespace { struct TempFileBase { - utl::TempFile m_TempFile; + utl::TempFileNamed m_TempFile; explicit TempFileBase(OUString const& url) : m_TempFile(createTempCopy(url)) { diff --git a/sc/qa/extras/scpdfexport.cxx b/sc/qa/extras/scpdfexport.cxx index b3b878e5f77a..c22a1d0626e6 100644 --- a/sc/qa/extras/scpdfexport.cxx +++ b/sc/qa/extras/scpdfexport.cxx @@ -51,12 +51,12 @@ public: // helpers private: - std::shared_ptr<utl::TempFile> exportToPDF(const uno::Reference<frame::XModel>& xModel, - const ScRange& range); + std::shared_ptr<utl::TempFileNamed> exportToPDF(const uno::Reference<frame::XModel>& xModel, + const ScRange& range); - std::shared_ptr<utl::TempFile> exportToPDFWithUnoCommands(const OUString& rRange); + std::shared_ptr<utl::TempFileNamed> exportToPDFWithUnoCommands(const OUString& rRange); - static bool hasTextInPdf(const std::shared_ptr<utl::TempFile>& pPDFFile, const char* sText, + static bool hasTextInPdf(const std::shared_ptr<utl::TempFileNamed>& pPDFFile, const char* sText, bool& bFound); void setFont(ScFieldEditEngine& rEE, sal_Int32 nStart, sal_Int32 nEnd, @@ -110,7 +110,7 @@ void ScPDFExportTest::tearDown() test::BootstrapFixture::tearDown(); } -bool ScPDFExportTest::hasTextInPdf(const std::shared_ptr<utl::TempFile>& pPDFFile, +bool ScPDFExportTest::hasTextInPdf(const std::shared_ptr<utl::TempFileNamed>& pPDFFile, const char* sText, bool& bFound) { SvStream* pStream = pPDFFile->GetStream(StreamMode::STD_READ); @@ -140,11 +140,11 @@ bool ScPDFExportTest::hasTextInPdf(const std::shared_ptr<utl::TempFile>& pPDFFil return (nRead == nFileSize); } -std::shared_ptr<utl::TempFile> +std::shared_ptr<utl::TempFileNamed> ScPDFExportTest::exportToPDF(const uno::Reference<frame::XModel>& xModel, const ScRange& range) { // create temp file name - auto pTempFile = std::make_shared<utl::TempFile>(); + auto pTempFile = std::make_shared<utl::TempFileNamed>(); pTempFile->EnableKillingFile(); OUString sFileURL = pTempFile->GetURL(); // Note: under Windows path path should be with "/" delimiters instead of "\\" @@ -195,10 +195,11 @@ ScPDFExportTest::exportToPDF(const uno::Reference<frame::XModel>& xModel, const return pTempFile; } -std::shared_ptr<utl::TempFile> ScPDFExportTest::exportToPDFWithUnoCommands(const OUString& rRange) +std::shared_ptr<utl::TempFileNamed> +ScPDFExportTest::exportToPDFWithUnoCommands(const OUString& rRange) { // create temp file name - auto pTempFile = std::make_shared<utl::TempFile>(); + auto pTempFile = std::make_shared<utl::TempFileNamed>(); pTempFile->EnableKillingFile(); OUString sFileURL = pTempFile->GetURL(); // Note: under Windows path path should be with "/" delimiters instead of "\\" @@ -276,7 +277,7 @@ void ScPDFExportTest::testExportRange_Tdf120161() // A1:G1 { ScRange range1(0, 0, 0, 6, 0, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "DejaVuSans", bFound)); CPPUNIT_ASSERT_EQUAL(false, bFound); @@ -285,7 +286,7 @@ void ScPDFExportTest::testExportRange_Tdf120161() // G1:H1 { ScRange range1(6, 0, 0, 7, 0, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "DejaVuSans", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -294,7 +295,7 @@ void ScPDFExportTest::testExportRange_Tdf120161() // H1:I1 { ScRange range1(7, 0, 0, 8, 0, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "DejaVuSans", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -329,7 +330,7 @@ void ScPDFExportTest::testExportFitToPage_Tdf103516() // A1:G50: 2-page export { ScRange range1(0, 0, 0, 6, 49, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "/Count 2>>", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -338,7 +339,7 @@ void ScPDFExportTest::testExportFitToPage_Tdf103516() // A1:L80: 4-page export { ScRange range1(0, 0, 0, 11, 79, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "/Count 4>>", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -368,7 +369,7 @@ void ScPDFExportTest::testExportFitToPage_Tdf103516() // A1:G50 with fit to page width=1: slightly smaller zoom results only 1-page export { ScRange range1(0, 0, 0, 6, 49, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "/Count 1>>", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -377,7 +378,7 @@ void ScPDFExportTest::testExportFitToPage_Tdf103516() // A1:L80 with fit to page width=1: slightly smaller zoom results only 1-page export { ScRange range1(0, 0, 0, 11, 79, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "/Count 1>>", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -391,7 +392,7 @@ void ScPDFExportTest::testUnoCommands_Tdf120161() // A1:G1 { - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDFWithUnoCommands("A1:G1"); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDFWithUnoCommands("A1:G1"); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "DejaVuSans", bFound)); CPPUNIT_ASSERT_EQUAL(false, bFound); @@ -399,7 +400,7 @@ void ScPDFExportTest::testUnoCommands_Tdf120161() // G1:H1 { - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDFWithUnoCommands("G1:H1"); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDFWithUnoCommands("G1:H1"); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "DejaVuSans", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -407,7 +408,7 @@ void ScPDFExportTest::testUnoCommands_Tdf120161() // H1:I1 { - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDFWithUnoCommands("H1:I1"); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDFWithUnoCommands("H1:I1"); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "DejaVuSans", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -424,7 +425,7 @@ void ScPDFExportTest::testTdf64703_hiddenPageBreak() // A1:A11: 4-page export { ScRange range1(0, 0, 0, 0, 10, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); bool bFound = false; CPPUNIT_ASSERT(hasTextInPdf(pPDFFile, "/Count 4>>", bFound)); CPPUNIT_ASSERT_EQUAL(true, bFound); @@ -445,7 +446,7 @@ void ScPDFExportTest::testTdf143978() // A1:A2 ScRange range1(0, 0, 0, 0, 1, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); // Parse the export result with pdfium. SvFileStream aFile(pPDFFile->GetURL(), StreamMode::READ); SvMemoryStream aMemory; @@ -492,7 +493,7 @@ void ScPDFExportTest::testTdf84012() // A1 ScRange range1(0, 0, 0, 0, 0, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); // Parse the export result with pdfium. SvFileStream aFile(pPDFFile->GetURL(), StreamMode::READ); SvMemoryStream aMemory; @@ -533,7 +534,7 @@ void ScPDFExportTest::testTdf78897() // C3:D3 ScRange range1(2, 2, 0, 3, 2, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); // Parse the export result with pdfium. SvFileStream aFile(pPDFFile->GetURL(), StreamMode::READ); SvMemoryStream aMemory; @@ -569,7 +570,7 @@ void ScPDFExportTest::testForcepoint97() // A1:H81 ScRange range1(0, 0, 0, 7, 81, 0); - std::shared_ptr<utl::TempFile> pPDFFile = exportToPDF(xModel, range1); + std::shared_ptr<utl::TempFileNamed> pPDFFile = exportToPDF(xModel, range1); } CPPUNIT_TEST_SUITE_REGISTRATION(ScPDFExportTest); diff --git a/sc/qa/unit/SparklineImportExportTest.cxx b/sc/qa/unit/SparklineImportExportTest.cxx index 6d3f8a73931a..1aefc64006a5 100644 --- a/sc/qa/unit/SparklineImportExportTest.cxx +++ b/sc/qa/unit/SparklineImportExportTest.cxx @@ -186,7 +186,8 @@ void SparklineImportExportTest::testSparklinesExportODS() ScDocShellRef xDocSh = loadDoc(u"Sparklines.", FORMAT_XLSX); // Save as ODS and check content.xml with XPath - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_ODS); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); // We have 3 sparkline groups = 3 tables that contain sparklines @@ -250,7 +251,8 @@ void SparklineImportExportTest::testNoSparklinesInDocumentXLSX() // Load the document containing NO sparklines ScDocShellRef xDocSh = loadDoc(u"empty.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pXmlDoc); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 9a5c5124cb08..7c1266312ac4 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -760,9 +760,9 @@ void ScBootstrapFixture::createCSVPath(std::u16string_view aFileBase, OUString& ScDocShellRef ScBootstrapFixture::saveAndReload( ScDocShell& rShell, const OUString &rFilter, const OUString &rUserData, const OUString& rTypeName, SfxFilterFlags nFormatType, - std::shared_ptr<utl::TempFile>* pTempFileOut, const OUString* pPassword, bool bClose) + std::shared_ptr<utl::TempFileNamed>* pTempFileOut, const OUString* pPassword, bool bClose) { - auto pTempFile = std::make_shared<utl::TempFile>(); + auto pTempFile = std::make_shared<utl::TempFileNamed>(); SfxMedium aStoreMedium( pTempFile->GetURL(), StreamMode::STD_WRITE ); SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; if (nFormatType == ODS_FORMAT_TYPE) @@ -804,7 +804,7 @@ ScDocShellRef ScBootstrapFixture::saveAndReload( return xDocSh; } -ScDocShellRef ScBootstrapFixture::saveAndReload( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFile>* pTempFile ) +ScDocShellRef ScBootstrapFixture::saveAndReload( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFileNamed>* pTempFile ) { OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); @@ -814,7 +814,7 @@ ScDocShellRef ScBootstrapFixture::saveAndReload( ScDocShell& rShell, sal_Int32 n return xDocSh; } -ScDocShellRef ScBootstrapFixture::saveAndReloadPassword( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFile>* pTempFile ) +ScDocShellRef ScBootstrapFixture::saveAndReloadPassword( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFileNamed>* pTempFile ) { OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); @@ -826,7 +826,7 @@ ScDocShellRef ScBootstrapFixture::saveAndReloadPassword( ScDocShell& rShell, sal return xDocSh; } -ScDocShellRef ScBootstrapFixture::saveAndReloadNoClose( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFile>* pTempFile ) +ScDocShellRef ScBootstrapFixture::saveAndReloadNoClose( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFileNamed>* pTempFile ) { OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); @@ -837,12 +837,12 @@ ScDocShellRef ScBootstrapFixture::saveAndReloadNoClose( ScDocShell& rShell, sal_ return xDocSh; } -std::shared_ptr<utl::TempFile> ScBootstrapFixture::exportTo( ScDocShell& rShell, sal_Int32 nFormat, bool bValidate ) +std::shared_ptr<utl::TempFileNamed> ScBootstrapFixture::exportTo( ScDocShell& rShell, sal_Int32 nFormat, bool bValidate ) { OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); - auto pTempFile = std::make_shared<utl::TempFile>(); + auto pTempFile = std::make_shared<utl::TempFileNamed>(); pTempFile->EnableKillingFile(); SfxMedium aStoreMedium( pTempFile->GetURL(), StreamMode::STD_WRITE ); SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE; diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index 21b3c75f2869..8b32859df57f 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -31,7 +31,7 @@ #include <memory> #include <tuple> -namespace utl { class TempFile; } +namespace utl { class TempFileNamed; } #define ODS_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::TEMPLATE | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT | SfxFilterFlags::ENCRYPTION | SfxFilterFlags::PASSWORDTOMODIFY) #define XLS_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::ENCRYPTION | SfxFilterFlags::PASSWORDTOMODIFY | SfxFilterFlags::PREFERED) @@ -219,13 +219,13 @@ public: ScDocShellRef saveAndReload(ScDocShell& rShell, const OUString &rFilter, const OUString &rUserData, const OUString& rTypeName, SfxFilterFlags nFormatType, - std::shared_ptr<utl::TempFile>* pTempFile = nullptr, const OUString* pPassword = nullptr, bool bClose = true ); + std::shared_ptr<utl::TempFileNamed>* pTempFile = nullptr, const OUString* pPassword = nullptr, bool bClose = true ); - ScDocShellRef saveAndReload( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFile>* pTempFile = nullptr ); - ScDocShellRef saveAndReloadPassword( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFile>* pTempFile = nullptr ); - ScDocShellRef saveAndReloadNoClose( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFile>* pTempFile = nullptr ); + ScDocShellRef saveAndReload( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFileNamed>* pTempFile = nullptr ); + ScDocShellRef saveAndReloadPassword( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFileNamed>* pTempFile = nullptr ); + ScDocShellRef saveAndReloadNoClose( ScDocShell& rShell, sal_Int32 nFormat, std::shared_ptr<utl::TempFileNamed>* pTempFile = nullptr ); - std::shared_ptr<utl::TempFile> exportTo(ScDocShell& rShell, sal_Int32 nFormat, bool bValidate = true); + std::shared_ptr<utl::TempFileNamed> exportTo(ScDocShell& rShell, sal_Int32 nFormat, bool bValidate = true); void miscRowHeightsTest( TestParam const * aTestValues, unsigned int numElems ); }; diff --git a/sc/qa/unit/helper/xpath.cxx b/sc/qa/unit/helper/xpath.cxx index 458147d37248..4c8e276fb3ac 100644 --- a/sc/qa/unit/helper/xpath.cxx +++ b/sc/qa/unit/helper/xpath.cxx @@ -21,12 +21,12 @@ xmlDocUniquePtr XPathHelper::parseExport2(ScBootstrapFixture & rFixture, ScDocShell& rShell, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile, sal_Int32 nFormat) { - std::shared_ptr<utl::TempFile> pTempFile = rFixture.exportTo(rShell, nFormat); + std::shared_ptr<utl::TempFileNamed> pTempFile = rFixture.exportTo(rShell, nFormat); return parseExport(pTempFile, xSFactory, rFile); } -std::unique_ptr<SvStream> XPathHelper::parseExportStream(std::shared_ptr<utl::TempFile> const & pTempFile, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile) +std::unique_ptr<SvStream> XPathHelper::parseExportStream(std::shared_ptr<utl::TempFileNamed> const & pTempFile, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile) { // Read the XML stream we're interested in. uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(xSFactory), pTempFile->GetURL()); @@ -36,7 +36,7 @@ std::unique_ptr<SvStream> XPathHelper::parseExportStream(std::shared_ptr<utl::Te return pStream; } -xmlDocUniquePtr XPathHelper::parseExport(std::shared_ptr<utl::TempFile> const & pTempFile, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile) +xmlDocUniquePtr XPathHelper::parseExport(std::shared_ptr<utl::TempFileNamed> const & pTempFile, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile) { std::unique_ptr<SvStream> pStream = parseExportStream(pTempFile, xSFactory, rFile); return XmlTestTools::parseXmlStream(pStream.get()); diff --git a/sc/qa/unit/helper/xpath.hxx b/sc/qa/unit/helper/xpath.hxx index d81fb134df47..9502972ac873 100644 --- a/sc/qa/unit/helper/xpath.hxx +++ b/sc/qa/unit/helper/xpath.hxx @@ -46,7 +46,7 @@ namespace XPathHelper /** * Tries to parse the specified file in the temp file zip container as a binary file. */ - SCQAHELPER_DLLPUBLIC std::unique_ptr<SvStream> parseExportStream(std::shared_ptr<utl::TempFile> const & pTempFile, + SCQAHELPER_DLLPUBLIC std::unique_ptr<SvStream> parseExportStream(std::shared_ptr<utl::TempFileNamed> const & pTempFile, uno::Reference<lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile); /** @@ -55,7 +55,7 @@ namespace XPathHelper * Should be used when the same exported file is used for testing different files in * the same zip file. */ - SCQAHELPER_DLLPUBLIC xmlDocUniquePtr parseExport(std::shared_ptr<utl::TempFile> const & pTempFile, uno::Reference< lang::XMultiServiceFactory> const & xSFactory, + SCQAHELPER_DLLPUBLIC xmlDocUniquePtr parseExport(std::shared_ptr<utl::TempFileNamed> const & pTempFile, uno::Reference< lang::XMultiServiceFactory> const & xSFactory, const OUString& rFile); } diff --git a/sc/qa/unit/jumbosheets-test.cxx b/sc/qa/unit/jumbosheets-test.cxx index 81151b9ecefa..9f9ab5c4ad7f 100644 --- a/sc/qa/unit/jumbosheets-test.cxx +++ b/sc/qa/unit/jumbosheets-test.cxx @@ -128,7 +128,7 @@ void ScJumboSheetsTest::testRoundtripColumnRange() CPPUNIT_ASSERT_EQUAL(OUString("=SUM(C:C)"), rDoc.GetFormula(1, 0, 0)); } - std::shared_ptr<utl::TempFile> exportedFile; + std::shared_ptr<utl::TempFileNamed> exportedFile; ScDocShellRef xDocSh2 = saveAndReloadNoClose(*xDocSh1, FORMAT_ODS, &exportedFile); CPPUNIT_ASSERT(xDocSh2.is()); @@ -189,7 +189,7 @@ void ScJumboSheetsTest::testRoundtripNamedRanges() } } - std::shared_ptr<utl::TempFile> exportedFile; + std::shared_ptr<utl::TempFileNamed> exportedFile; ScDocShellRef xDocSh2 = saveAndReloadNoClose(*xDocSh1, FORMAT_ODS, &exportedFile); CPPUNIT_ASSERT(xDocSh2.is()); diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 69a1d4a3b7f0..d62f49eb4fcf 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -744,7 +744,8 @@ void ScPivotTableFiltersTest::testPivotTableExportXLSX() ScDocShellRef xShell = loadDoc(u"tdf89139_pivot_table.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -762,7 +763,8 @@ void ScPivotTableFiltersTest::testPivotTableExportXLSXSingleDataField() { ScDocShellRef xShell = loadDoc(u"tdf123421_1datafield.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -784,7 +786,8 @@ void ScPivotTableFiltersTest::testPivotTableExportXLSXMultipleDataFields() { ScDocShellRef xShell = loadDoc(u"tdf123421_2datafields.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -817,7 +820,8 @@ void ScPivotTableFiltersTest::testPivotCacheExportXLSX() ScDocShellRef xShell = loadDoc(u"pivot-table/with-strings-integers-and-dates.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); @@ -1943,7 +1947,8 @@ void ScPivotTableFiltersTest::testPivotTableFirstHeaderRowXLSX() // The documentation is not clear about what firstHeaderRow actually means, but MS Excel works on this way ScDocShellRef xShell = loadDoc(u"pivot_table_first_header_row.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -2398,7 +2403,8 @@ void ScPivotTableFiltersTest::testPivotTableOutlineModeXLSX() { ScDocShellRef xShell = loadDoc(u"pivottable_outline_mode.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -2417,7 +2423,8 @@ void ScPivotTableFiltersTest::testPivotTableDuplicatedMemberFilterXLSX() { ScDocShellRef xShell = loadDoc(u"pivottable_duplicated_member_filter.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -2435,7 +2442,8 @@ void ScPivotTableFiltersTest::testPivotTableTabularModeXLSX() { ScDocShellRef xShell = loadDoc(u"pivottable_tabular_mode.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); CPPUNIT_ASSERT(pTable); @@ -2455,7 +2463,8 @@ void ScPivotTableFiltersTest::testPivotTableDuplicateFields() { ScDocShellRef xShell = loadDoc(u"caseinsensitive-duplicate-fields.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); @@ -2509,7 +2518,8 @@ void ScPivotTableFiltersTest::testTdf123923() ScDocShellRef xShell = loadDoc(u"pivot-table-err-in-cache.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); @@ -2524,7 +2534,8 @@ void ScPivotTableFiltersTest::testTdf123939() ScDocShellRef xShell = loadDoc(u"pivot-table-str-and-err-in-data.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pTable); @@ -2560,7 +2571,8 @@ void ScPivotTableFiltersTest::testTdf124736() { ScDocShellRef xDocSh = loadDoc(u"pivot-table/shared-dategroup.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xDocSh->DoClose(); xmlDocUniquePtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, @@ -2612,7 +2624,8 @@ void ScPivotTableFiltersTest::tesTtdf124772NumFmt() { ScDocShellRef xDocSh = loadDoc(u"pivot-table-num-fmt.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xDocSh->DoClose(); xmlDocUniquePtr pTable diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index 4eb7a9a5ef60..299ef1f1290e 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -107,7 +107,7 @@ ScShapeTest::ScShapeTest() void ScShapeTest::saveAndReload(css::uno::Reference<css::lang::XComponent>& xComponent, const OUString& rFilter) { - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); css::uno::Sequence aArgs{ comphelper::makePropertyValue("FilterName", rFilter) }; // e.g. "calc8" diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index b460319bd0a3..9c3709e51a67 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -357,7 +357,8 @@ void ScExportTest::testTdf139167() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); CPPUNIT_ASSERT(pDoc); @@ -375,7 +376,8 @@ void ScExportTest::testTdf113271() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); CPPUNIT_ASSERT(pDoc); @@ -397,7 +399,8 @@ void ScExportTest::testTdf139394() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); @@ -428,7 +431,8 @@ void ScExportTest::testExtCondFormatXLSX() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); @@ -474,7 +478,8 @@ void ScExportTest::testTdf90104() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); @@ -657,7 +662,8 @@ void ScExportTest::testProtectionKeyODS_UTF16LErtlSHA1() // we can't assume that the user entered the password; check that we // round-trip the password as-is - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath(pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and " @@ -685,7 +691,8 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA1() // we can't assume that the user entered the password; check that we // round-trip the password as-is - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath(pXmlDoc, "//office:spreadsheet[@table:structure-protected='true' and " @@ -713,7 +720,8 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA256ODF12() // we can't assume that the user entered the password; check that we // round-trip the password as-is - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath( pXmlDoc, @@ -743,7 +751,8 @@ void ScExportTest::testProtectionKeyODS_UTF8SHA256W3C() // we can't assume that the user entered the password; check that we // round-trip the password as-is - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath( pXmlDoc, @@ -773,7 +782,8 @@ void ScExportTest::testProtectionKeyODS_XL_SHA1() // we can't assume that the user entered the password; check that we // round-trip the password as-is - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); assertXPath( pXmlDoc, @@ -856,7 +866,8 @@ void ScExportTest::testCommentExportXLSX() //tdf#104729 FILESAVE OpenOffice do not save author of the comment during export to .xlsx ScDocShellRef xShell = loadDoc(u"comment.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pComments = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml"); CPPUNIT_ASSERT(pComments); @@ -901,7 +912,8 @@ void ScExportTest::testCommentExportXLSX_2_XLSX() pNote->ShowCaption(aPosC9, true); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pComments = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/comments1.xml"); CPPUNIT_ASSERT(pComments); @@ -924,7 +936,8 @@ void ScExportTest::testCustomColumnWidthExportXLSX() //tdf#100946 FILESAVE Excel on macOS ignored column widths in XLSX last saved by LO ScDocShellRef xShell = loadDoc(u"custom_column_width.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -999,7 +1012,8 @@ void ScExportTest::testXfDefaultValuesXLSX() //tdf#70565 FORMATTING: User Defined Custom Formatting is not applied during importing XLSX documents ScDocShellRef xShell = loadDoc(u"xf_default_values.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); CPPUNIT_ASSERT(pSheet); @@ -1087,7 +1101,7 @@ void ScExportTest::testODF13() officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - std::shared_ptr<utl::TempFile> pXPathFile + std::shared_ptr<utl::TempFileNamed> pXPathFile = ScBootstrapFixture::exportTo(*pShell, FORMAT_ODS); // check XML @@ -1116,7 +1130,7 @@ void ScExportTest::testODF13() officecfg::Office::Common::Save::ODF::DefaultVersion::set(9, pBatch); pBatch->commit(); - std::shared_ptr<utl::TempFile> pXPathFile + std::shared_ptr<utl::TempFileNamed> pXPathFile = exportTo(*pShell, FORMAT_ODS, /*bValidate*/ false); pShell->DoClose(); @@ -1146,7 +1160,7 @@ void ScExportTest::testODF13() officecfg::Office::Common::Save::ODF::DefaultVersion::set(4, pBatch); pBatch->commit(); - std::shared_ptr<utl::TempFile> pXPathFile = exportTo(*pShell, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile = exportTo(*pShell, FORMAT_ODS); pShell->DoClose(); // check XML @@ -1177,7 +1191,8 @@ void ScExportTest::testColumnWidthResaveXLSX() // Test if after resave .xlsx file, columns width is identical with previous one ScDocShellRef xShell = loadDoc(u"different-column-width-excel2010.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -1282,7 +1297,8 @@ void ScExportTest::testOutlineExportXLSX() //tdf#51524 FILESAVE .xlsx and.xls looses width information for hidden/collapsed grouped columns ScDocShellRef xShell = loadDoc(u"outline.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -1429,7 +1445,7 @@ void ScExportTest::testAllRowsHiddenXLSX() { ScDocShellRef xOrigDocSh = loadDoc(u"tdf105840_allRowsHidden.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile + std::shared_ptr<utl::TempFileNamed> pXPathFile = ScBootstrapFixture::exportTo(*xOrigDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); @@ -1445,7 +1461,8 @@ void ScExportTest::testHiddenEmptyRowsXLSX() //tdf#98106 FILESAVE: Hidden and empty rows became visible when export to .XLSX ScDocShellRef xShell = loadDoc(u"hidden-empty-rows.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -1464,7 +1481,8 @@ void ScExportTest::testHiddenEmptyColsODS() //tdf#98106 FILESAVE: Hidden and empty rows became visible when export to .XLSX ScDocShellRef xShell = loadDoc(u"tdf128895_emptyHiddenCols.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); CPPUNIT_ASSERT(pSheet); assertXPath(pSheet, "//table:table/table:table-column[2]"); @@ -1478,7 +1496,8 @@ void ScExportTest::testLandscapeOrientationXLSX() //tdf#48767 - Landscape page orientation is not loaded from .xlsx format with MS Excel, after export with Libre Office ScDocShellRef xShell = loadDoc(u"hidden-empty-rows.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -2194,7 +2213,8 @@ void ScExportTest::testRichTextCellFormatXLSX() { ScDocShellRef xDocSh = loadDoc(u"cellformat.", FORMAT_XLS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -2448,7 +2468,8 @@ void ScExportTest::testEmbeddedChartODS() { ScDocShellRef xShell = loadDoc(u"embedded-chart.", FORMAT_XLS); - std::shared_ptr<utl::TempFile> pTempFile(ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS)); + std::shared_ptr<utl::TempFileNamed> pTempFile( + ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS)); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pTempFile, m_xSFactory, "content.xml"); CPPUNIT_ASSERT(pDoc); @@ -3194,7 +3215,8 @@ void ScExportTest::testTdf133487() { ScDocShellRef xShell = loadDoc(u"shapes_foreground_background.", FORMAT_FODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_ODS); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "content.xml"); CPPUNIT_ASSERT(pXmlDoc); @@ -3562,7 +3584,8 @@ void ScExportTest::testCeilingFloorODSToXLSX() // tdf#100011 - Cannot open sheet containing FLOOR/CEILING functions by MS Excel, after export to .xlsx ScDocShellRef xShell = loadDoc(u"ceiling-floor.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/workbook.xml"); CPPUNIT_ASSERT(pSheet); @@ -3581,7 +3604,8 @@ void ScExportTest::testCustomXml() // Load document and export it to a temporary file ScDocShellRef xShell = loadDoc(u"customxml.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "customXml/item1.xml"); CPPUNIT_ASSERT(pXmlDoc); @@ -3616,7 +3640,7 @@ void ScExportTest::testRelativePathsODS() { ScDocShellRef xDocSh = loadDoc(u"fdo79305.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pTempFile = exportTo(*xDocSh, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pTempFile = exportTo(*xDocSh, FORMAT_ODS); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pTempFile, m_xSFactory, "content.xml"); CPPUNIT_ASSERT(pDoc); OUString aURL = getXPath(pDoc, @@ -4527,9 +4551,9 @@ void ScExportTest::testDateStandardfilterXLSX() void ScExportTest::testTdf90299() { - utl::TempFile aTmpDirectory1(nullptr, true); - utl::TempFile aTmpDirectory2(nullptr, true); - utl::TempFile aSavedFile(&aTmpDirectory1.GetURL()); + const OUString aTmpDirectory1URL = utl::CreateTempURL(nullptr, true); + const OUString aTmpDirectory2URL = utl::CreateTempURL(nullptr, true); + const OUString aSavedFileURL = utl::CreateTempURL(&aTmpDirectory1URL); struct { @@ -4555,16 +4579,16 @@ void ScExportTest::testTdf90299() OUString aReferencingFileURL; createFileURL(u"tdf90299.", u"xls", aReferencingFileURL); - auto eError = osl::File::copy(aReferencingFileURL, aTmpDirectory1.GetURL() + "/tdf90299.xls"); + auto eError = osl::File::copy(aReferencingFileURL, aTmpDirectory1URL + "/tdf90299.xls"); CPPUNIT_ASSERT_EQUAL(osl::File::E_None, eError); - aReferencingFileURL = aTmpDirectory1.GetURL() + "/tdf90299.xls"; - aReferencedFileURL = aTmpDirectory1.GetURL() + "/dummy.xls"; + aReferencingFileURL = aTmpDirectory1URL + "/tdf90299.xls"; + aReferencedFileURL = aTmpDirectory1URL + "/dummy.xls"; ScDocShellRef xShell = load(aReferencingFileURL, FORMAT_XLS); aCheckShell.checkFormula(xShell, "'" + aReferencedFileURL + "'#$Sheet1.A1"); - aReferencingFileURL = aSavedFile.GetURL(); + aReferencingFileURL = aSavedFileURL; FileFormat afilterFormat = ScBootstrapFixture::getFileFormats()[FORMAT_XLS]; OUString aFilterName(afilterFormat.pFilterName, strlen(afilterFormat.pFilterName), @@ -4584,11 +4608,11 @@ void ScExportTest::testTdf90299() xShell->DoSaveAs(aStoreMedium); xShell->DoClose(); - eError = osl::File::copy(aReferencingFileURL, aTmpDirectory2.GetURL() + "/tdf90299.xls"); + eError = osl::File::copy(aReferencingFileURL, aTmpDirectory2URL + "/tdf90299.xls"); CPPUNIT_ASSERT_EQUAL(osl::File::E_None, eError); - aReferencingFileURL = aTmpDirectory2.GetURL() + "/tdf90299.xls"; - aReferencedFileURL = aTmpDirectory2.GetURL() + "/dummy.xls"; + aReferencingFileURL = aTmpDirectory2URL + "/tdf90299.xls"; + aReferencedFileURL = aTmpDirectory2URL + "/dummy.xls"; xShell = load(aReferencingFileURL, FORMAT_XLS); aCheckShell.checkFormula(xShell, "'" + aReferencedFileURL + "'#$Sheet1.A1"); diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx index cadc2da0d595..17e5da80eabb 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -804,7 +804,7 @@ void ScExportTest2::testAutofilterColorsOOXML() { { ScDocShellRef xDocSh = loadDoc(u"autofilter-colors.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile + std::shared_ptr<utl::TempFileNamed> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pTable1 = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/tables/table1.xml"); @@ -825,7 +825,7 @@ void ScExportTest2::testAutofilterColorsOOXML() { ScDocShellRef xDocSh = loadDoc(u"autofilter-colors-fg.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile + std::shared_ptr<utl::TempFileNamed> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pTable1 = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/tables/table1.xml"); @@ -1086,7 +1086,8 @@ void ScExportTest2::testKeepSettingsOfBlankRows() { ScDocShellRef xDocSh = loadDoc(u"tdf41425.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -1101,7 +1102,8 @@ void ScExportTest2::testTdf133595() { ScDocShellRef xDocSh = loadDoc(u"tdf133595.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -1116,7 +1118,8 @@ void ScExportTest2::testTdf134769() { ScDocShellRef xDocSh = loadDoc(u"tdf134769.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -1138,7 +1141,8 @@ void ScExportTest2::testTdf106181() { ScDocShellRef xDocSh = loadDoc(u"tdf106181.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -1274,7 +1278,7 @@ void ScExportTest2::testPivotCacheAfterExportXLSX() ScDocShellRef xDocSh = loadDoc(u"numgroup_example.", FORMAT_ODS); // export only - std::shared_ptr<utl::TempFile> pTemp = exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pTemp = exportTo(*xDocSh, FORMAT_XLSX); ScDocument& rDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT(rDoc.HasPivotTable()); @@ -1345,7 +1349,8 @@ void ScExportTest2::testTdf142764() void ScExportTest2::testTdf91634XLSX() { ScDocShellRef xDocSh = loadDoc(u"image_hyperlink.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); @@ -1388,7 +1393,8 @@ void ScExportTest2::testValidationCopyPaste() rDestDoc.CopyFromClip(aDstRange, aMark2, InsertDeleteFlags::ALL, nullptr, &aClipDoc); // save as XLSX - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*pShell2, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*pShell2, FORMAT_XLSX); // check validation xmlDocUniquePtr pDoc @@ -1511,7 +1517,8 @@ void ScExportTest2::testTdf142881() { ScDocShellRef xDocSh = loadDoc(u"tdf142881.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDrawing1 = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing1); @@ -1574,7 +1581,8 @@ void ScExportTest2::testTdf112567b() void ScExportTest2::testTdf123645XLSX() { ScDocShellRef xDocSh = loadDoc(u"chart_hyperlink.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); @@ -1614,7 +1622,8 @@ void ScExportTest2::testTdf123645XLSX() void ScExportTest2::testTdf125173XLSX() { ScDocShellRef xDocSh = loadDoc(u"text_box_hyperlink.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); @@ -1635,7 +1644,8 @@ void ScExportTest2::testTdf125173XLSX() void ScExportTest2::testTdf79972XLSX() { ScDocShellRef xDocSh = loadDoc(u"tdf79972.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); @@ -1655,7 +1665,8 @@ void ScExportTest2::testTdf79972XLSX() void ScExportTest2::testTdf126024XLSX() { ScDocShellRef xDocSh = loadDoc(u"hyperlink_formula.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); @@ -1675,7 +1686,8 @@ void ScExportTest2::testTdf126024XLSX() void ScExportTest2::testTdf126177XLSX() { ScDocShellRef xDocSh = loadDoc(u"hyperlink_export.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); @@ -1697,7 +1709,8 @@ void ScExportTest2::testCommentTextVAlignment() // Testing comment text alignments. ScDocShellRef xShell = loadDoc(u"CommentTextVAlign.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); @@ -1713,7 +1726,8 @@ void ScExportTest2::testCommentTextHAlignment() // Testing comment text alignments. ScDocShellRef xShell = loadDoc(u"CommentTextHAlign.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pVmlDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml"); @@ -1734,7 +1748,7 @@ void ScExportTest2::testRotatedImageODS() ScDocShellRef xDocSh = loadDoc(u"tdf103092_RotatedImage.", FORMAT_ODS, true); - std::shared_ptr<utl::TempFile> pTemp = exportTo(*xDocSh, FORMAT_ODS); + std::shared_ptr<utl::TempFileNamed> pTemp = exportTo(*xDocSh, FORMAT_ODS); CPPUNIT_ASSERT(pTemp); xmlDocUniquePtr pXmlDoc = XPathHelper::parseExport(pTemp, m_xSFactory, "content.xml"); CPPUNIT_ASSERT(pXmlDoc); @@ -1844,7 +1858,8 @@ void ScExportTest2::testTdf120502() const auto nOldWidth = rDoc.GetColWidth(nMaxCol, 0); rDoc.SetColWidth(nMaxCol, 0, nOldWidth + 100); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet1 = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet1); @@ -1931,7 +1946,8 @@ void ScExportTest2::testTdf121715_FirstPageHeaderFooterXLSX() // Check if first page header and footer are exported properly ScDocShellRef xShell = loadDoc(u"tdf121715.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); @@ -1954,7 +1970,8 @@ void ScExportTest2::testTdf121716_ExportEvenHeaderFooterXLSX() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); @@ -2027,7 +2044,8 @@ void ScExportTest2::testTdf121718_UseFirstPageNumberXLSX() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); @@ -2088,7 +2106,8 @@ void ScExportTest2::testTdf135828_Shape_Rect() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); @@ -2177,7 +2196,8 @@ void ScExportTest2::testTdf123353() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); @@ -2195,7 +2215,8 @@ void ScExportTest2::testTdf140098() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); @@ -2211,7 +2232,8 @@ void ScExportTest2::testTdf133688_precedents() // tdf#133688 Check that we do not export detective shapes. ScDocShellRef xShell = loadDoc(u"tdf133688_dont_save_precedents_to_xlsx.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); @@ -2229,7 +2251,8 @@ void ScExportTest2::testTdf91251_missingOverflowRoundtrip() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); @@ -2249,7 +2272,8 @@ void ScExportTest2::testTdf137000_handle_upright() // of workaround 'rot'. ScDocShellRef xShell = loadDoc(u"tdf137000_export_upright.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); CPPUNIT_ASSERT(pDrawing); @@ -2264,7 +2288,8 @@ void ScExportTest2::testTdf126305_DataValidatyErrorAlert() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); @@ -2319,8 +2344,7 @@ void ScExportTest2::testTdf87973_externalLinkSkipUnuseds() // saveAndReload save the file to a temporary directory // the link must be changed to point to that directory - utl::TempFile aTempFile; - auto aTempFilename = aTempFile.GetURL(); + OUString aTempFilename = utl::CreateTempURL(); auto nIdxOfTmpFile = aTempFilename.lastIndexOf('/'); aTempFilename = aTempFilename.copy(0, nIdxOfTmpFile + 1); @@ -2396,8 +2420,7 @@ void ScExportTest2::testTdf138824_linkToParentDirectory() // saveAndReload save the file to a temporary directory // the link must be changed to point to that parent directory - utl::TempFile aTempFile; - auto aTempFilename = aTempFile.GetURL(); + OUString aTempFilename = utl::CreateTempURL(); auto nIdxOfTmpFile = aTempFilename.lastIndexOf('/'); nIdxOfTmpFile = aTempFilename.lastIndexOf('/', nIdxOfTmpFile); aTempFilename = aTempFilename.copy(0, nIdxOfTmpFile + 1); @@ -2413,7 +2436,8 @@ void ScExportTest2::testTdf138824_linkToParentDirectory() ScDocShellRef xDocSh = saveAndReload(*xShell, FORMAT_XLSX); CPPUNIT_ASSERT(xDocSh.is()); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport( pXPathFile, m_xSFactory, "xl/externalLinks/_rels/externalLink1.xml.rels"); CPPUNIT_ASSERT(pDoc); @@ -2493,7 +2517,8 @@ void ScExportTest2::testTdf136721_paper_size() { ScDocShellRef xShell = loadDoc(u"tdf136721_letter_sized_paper.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pDoc); @@ -2506,7 +2531,8 @@ void ScExportTest2::testTdf139258_rotated_image() // Check that the topleft position of the image is correct. ScDocShellRef xShell = loadDoc(u"tdf139258_rotated_image.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); xmlDocUniquePtr pDrawing = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml"); @@ -2592,7 +2618,8 @@ void ScExportTest2::testCheckboxFormControlXlsxExport() ScDocShellRef xShell = loadDoc(u"checkbox-form-control.", FORMAT_XLSX); // When exporting to XLSX: - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); // Then make sure its VML markup is written and it has a correct position + size: xmlDocUniquePtr pDoc @@ -2608,7 +2635,8 @@ void ScExportTest2::testButtonFormControlXlsxExport() ScDocShellRef xShell = loadDoc(u"button-form-control.", FORMAT_XLSX); // When exporting to XLSX: - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xShell, FORMAT_XLSX); // Then make sure its control markup is written and it has a correct position + size: xmlDocUniquePtr pDoc @@ -2898,7 +2926,8 @@ void ScExportTest2::testTdf142578() { ScDocShellRef xDocSh = loadDoc(u"tdf142578.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -2936,7 +2965,8 @@ void ScExportTest2::testTdf145059() ScDocShellRef xDocSh = loadDoc(u"tdf145059.", FORMAT_ODS); // Export to xlsx. - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -2963,7 +2993,8 @@ void ScExportTest2::testTdf130104_XLSXIndent() ScDocShellRef xDocSh = loadDoc(u"tdf130104_indent.", FORMAT_XLSX); // Resave the xlsx file without any modification. - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); @@ -3086,7 +3117,7 @@ void ScExportTest2::testXlsxRowsOrder() void ScExportTest2::testTdf91286() { ScDocShellRef xDocSh = loadDoc(u"tdf91286.", FORMAT_ODS); - std::shared_ptr<utl::TempFile> pTemp = exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pTemp = exportTo(*xDocSh, FORMAT_XLSX); xDocSh->DoClose(); Reference<packages::zip::XZipFileAccess2> xNameAccess @@ -3108,7 +3139,8 @@ void ScExportTest2::testTdf91286() void ScExportTest2::testTdf148820() { ScDocShellRef xDocSh = loadDoc(u"tdf148820.", FORMAT_XLSX); - std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); + std::shared_ptr<utl::TempFileNamed> pXPathFile + = ScBootstrapFixture::exportTo(*xDocSh, FORMAT_XLSX); xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index cfd80d53fa89..2a8a112e5b94 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -206,7 +206,7 @@ private: uno::Reference<lang::XComponent> mxComponent; TestLokCallbackWrapper m_callbackWrapper; - std::unique_ptr<utl::TempFile> mpTempFile; + std::unique_ptr<utl::TempFileNamed> mpTempFile; }; ScTiledRenderingTest::ScTiledRenderingTest() @@ -249,7 +249,7 @@ void ScTiledRenderingTest::tearDown() void ScTiledRenderingTest::makeTempCopy(const OUString& rOrigURL) { - mpTempFile.reset(new utl::TempFile()); + mpTempFile.reset(new utl::TempFileNamed()); mpTempFile->EnableKillingFile(); auto const aError = osl::File::copy(rOrigURL, mpTempFile->GetURL()); CPPUNIT_ASSERT_EQUAL_MESSAGE( diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 38426cf774fa..36b23564eb58 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -48,8 +48,8 @@ public: virtual void tearDown() override; ScModelObj* createDoc(const char* pName); - utl::TempFile save(css::uno::Reference<css::lang::XComponent>& xComponent, - const OUString& rFilter); + utl::TempFileNamed save(css::uno::Reference<css::lang::XComponent>& xComponent, + const OUString& rFilter); ScModelObj* saveAndReload(css::uno::Reference<css::lang::XComponent>& xComponent, const OUString& rFilter); void goToCell(const OUString& rCell); @@ -170,10 +170,10 @@ ScModelObj* ScUiCalcTest::createDoc(const char* pName) return pModelObj; } -utl::TempFile ScUiCalcTest::save(css::uno::Reference<css::lang::XComponent>& xComponent, - const OUString& rFilter) +utl::TempFileNamed ScUiCalcTest::save(css::uno::Reference<css::lang::XComponent>& xComponent, + const OUString& rFilter) { - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); css::uno::Sequence aArgs{ comphelper::makePropertyValue("FilterName", rFilter) }; css::uno::Reference<css::frame::XStorable> xStorable(xComponent, css::uno::UNO_QUERY_THROW); @@ -187,7 +187,7 @@ utl::TempFile ScUiCalcTest::save(css::uno::Reference<css::lang::XComponent>& xCo ScModelObj* ScUiCalcTest::saveAndReload(css::uno::Reference<css::lang::XComponent>& xComponent, const OUString& rFilter) { - utl::TempFile aTempFile = save(xComponent, rFilter); + utl::TempFileNamed aTempFile = save(xComponent, rFilter); mxComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.sheet.SpreadsheetDocument"); @@ -205,7 +205,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf100847) CPPUNIT_ASSERT(pDoc); // Save the document - utl::TempFile aTempFile = save(mxComponent, "calc8"); + utl::TempFileNamed aTempFile = save(mxComponent, "calc8"); // Open a new document mxComponent = loadFromDesktop("private:factory/scalc"); @@ -240,7 +240,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences) insertStringToCell(*pModelObj, "D3", u"FISHY"); // Save the document - utl::TempFile aTempFile = save(mxComponent, "calc8"); + utl::TempFileNamed aTempFile = save(mxComponent, "calc8"); // Open a new document mxComponent = loadFromDesktop("private:factory/scalc"); @@ -348,7 +348,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf103994) insertStringToCell(*pModelObj, "B1", u"2"); // Save the document - utl::TempFile aTempFile = save(mxComponent, "calc8"); + utl::TempFileNamed aTempFile = save(mxComponent, "calc8"); // Open a new document mxComponent = loadFromDesktop("private:factory/scalc"); @@ -392,7 +392,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf113541) insertStringToCell(*pModelObj, "A1", u"50"); // Save the document - utl::TempFile aTempFile = save(mxComponent, "calc8"); + utl::TempFileNamed aTempFile = save(mxComponent, "calc8"); // Open a new document mxComponent = loadFromDesktop("private:factory/scalc"); diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 241d448e2992..1dbec73cd97e 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -2017,7 +2017,6 @@ void XclExpObjectManager::InitStream( bool bTempFile ) if( bTempFile ) { moTempFile.emplace(); - moTempFile->EnableKillingFile(); mpDffStrm = moTempFile->GetStream( StreamMode::STD_READWRITE ); } diff --git a/sc/source/filter/inc/xcl97esc.hxx b/sc/source/filter/inc/xcl97esc.hxx index 00012c8a95f0..d7724d758981 100644 --- a/sc/source/filter/inc/xcl97esc.hxx +++ b/sc/source/filter/inc/xcl97esc.hxx @@ -37,7 +37,7 @@ private: virtual SvStream* ImplQueryPictureStream() override; private: - ::std::unique_ptr< ::utl::TempFile > mxPicTempFile; + ::std::unique_ptr< ::utl::TempFileFast > mxPicTempFile; SvStream* mpPicStrm; }; diff --git a/sc/source/filter/inc/xeescher.hxx b/sc/source/filter/inc/xeescher.hxx index 55e970ed4e86..c7adf1050b9b 100644 --- a/sc/source/filter/inc/xeescher.hxx +++ b/sc/source/filter/inc/xeescher.hxx @@ -438,7 +438,7 @@ private: void InitStream( bool bTempFile ); private: - std::optional< ::utl::TempFile > moTempFile; + std::optional< ::utl::TempFileFast > moTempFile; SvStream* mpDffStrm = nullptr; std::unique_ptr<SvMemoryStream> mpBackupStrm; std::shared_ptr< XclEscherEx > mxEscherEx; diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index 1205cadbfe62..cb87fb7c3731 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -75,8 +75,7 @@ XclEscherExGlobal::XclEscherExGlobal( const XclExpRoot& rRoot ) SvStream* XclEscherExGlobal::ImplQueryPictureStream() { - mxPicTempFile.reset( new ::utl::TempFile ); - mxPicTempFile->EnableKillingFile(); + mxPicTempFile.reset( new ::utl::TempFileFast ); mpPicStrm = mxPicTempFile->GetStream( StreamMode::READWRITE ); mpPicStrm->SetEndian( SvStreamEndian::LITTLE ); return mpPicStrm; diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 2548c28be687..ed83dc893ae5 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -470,8 +470,7 @@ bool ScDrawTransferObj::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* // impl. for "single OLE" embed::XEmbeddedObject* pEmbObj = static_cast<embed::XEmbeddedObject*>(pUserObject); - ::utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); + ::utl::TempFileFast aTempFile; SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE); uno::Reference< embed::XStorage > xWorkStore = ::comphelper::OStorageHelper::GetStorageFromStream( new utl::OStreamWrapper(*pTempStream) ); @@ -515,8 +514,7 @@ bool ScDrawTransferObj::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* try { - ::utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); + ::utl::TempFileFast aTempFile; SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE); uno::Reference< embed::XStorage > xWorkStore = ::comphelper::OStorageHelper::GetStorageFromStream( new utl::OStreamWrapper(*pTempStream) ); diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 26a9ddc504de..a81e4149956e 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -508,8 +508,7 @@ bool ScTransferObj::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUse { // TODO/MBA: testing SfxObjectShell* pEmbObj = static_cast<SfxObjectShell*>(pUserObject); - ::utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); + ::utl::TempFileFast aTempFile; SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE); uno::Reference< embed::XStorage > xWorkStore = ::comphelper::OStorageHelper::GetStorageFromStream( new utl::OStreamWrapper(*pTempStream) ); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index e4e5fc40c532..6cbbc2f57222 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -3432,11 +3432,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDBF(SvStream &rStream) // we need a real file for this filter // put it in an empty dir - utl::TempFile aTmpDir(nullptr, true); + utl::TempFileNamed aTmpDir(nullptr, true); aTmpDir.EnableKillingFile(); OUString sTmpDir = aTmpDir.GetURL(); - utl::TempFile aTempInput(u"", true, u".dbf", &sTmpDir); + utl::TempFileNamed aTempInput(u"", true, u".dbf", &sTmpDir); aTempInput.EnableKillingFile(); SvStream* pInputStream = aTempInput.GetStream(StreamMode::WRITE); diff --git a/sd/qa/filter/eppt/eppt.cxx b/sd/qa/filter/eppt/eppt.cxx index 151b9cfce27a..ce8131d3e25f 100644 --- a/sd/qa/filter/eppt/eppt.cxx +++ b/sd/qa/filter/eppt/eppt.cxx @@ -66,7 +66,7 @@ CPPUNIT_TEST_FIXTURE(Test, testOOXMLCustomShapeBitmapFill) // Save the bugdoc to PPT. OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "custom-shape-bitmap-fill.pptx"; getComponent() = loadFromDesktop(aURL); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -106,7 +106,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeExport) xMasterPage->setPropertyValue("Theme", aTheme); // When exporting to PPTX: - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("Impress Office Open XML"); @@ -133,7 +133,7 @@ CPPUNIT_TEST_FIXTURE(Test, testLoopingFromAnimation) getComponent() = loadFromDesktop(aURL); // When exporting that to PPTX: - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("Impress Office Open XML"); diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx index 1390b267de7f..ea8de7b9be06 100644 --- a/sd/qa/unit/HtmlExportTest.cxx +++ b/sd/qa/unit/HtmlExportTest.cxx @@ -21,7 +21,7 @@ private: { FileFormat* pFormat = getFormat(HTML); OUString aExt = "." + OUString::createFromAscii(pFormat->pName); - utl::TempFile aTempFile(u"", true, aExt); + utl::TempFileNamed aTempFile(u"", true, aExt); aTempFile.EnableKillingFile(); exportTo(xDocShRef.get(), pFormat, aTempFile); return parseHtml(aTempFile); diff --git a/sd/qa/unit/PNGExportTests.cxx b/sd/qa/unit/PNGExportTests.cxx index a03350d8c882..0d3ed74eca28 100644 --- a/sd/qa/unit/PNGExportTests.cxx +++ b/sd/qa/unit/PNGExportTests.cxx @@ -62,7 +62,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf105998) uno::Reference<drawing::XGraphicExportFilter> xGraphicExporter = drawing::GraphicExportFilter::create(xContext); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor{ @@ -127,7 +127,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf126319) uno::Reference<drawing::XGraphicExportFilter> xGraphicExporter = drawing::GraphicExportFilter::create(xContext); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor{ @@ -201,7 +201,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf136632) uno::Sequence<beans::PropertyValue> aFilterData{ comphelper::makePropertyValue("Translucent", sal_Int32(0)) }; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor{ @@ -241,7 +241,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113163) comphelper::makePropertyValue("PixelHeight", sal_Int32(100)) }; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor{ @@ -296,7 +296,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf147119) comphelper::makePropertyValue("Translucent", sal_Int32(1)), }; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor{ @@ -348,7 +348,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf113197) comphelper::makePropertyValue("PixelHeight", sal_Int32(100)), }; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor{ @@ -403,7 +403,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf93124) comphelper::makePropertyValue("PixelHeight", sal_Int32(180)) }; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor{ @@ -466,7 +466,7 @@ CPPUNIT_TEST_FIXTURE(SdPNGExportTest, testTdf99729) comphelper::makePropertyValue("PixelHeight", sal_Int32(240)) }; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor{ diff --git a/sd/qa/unit/SVGExportTests.cxx b/sd/qa/unit/SVGExportTests.cxx index 4878eca27972..270c98dd53d8 100644 --- a/sd/qa/unit/SVGExportTests.cxx +++ b/sd/qa/unit/SVGExportTests.cxx @@ -96,7 +96,7 @@ class SdSVGFilterTest : public test::BootstrapFixture, public unotest::MacrosTes }; uno::Reference<lang::XComponent> mxComponent; - utl::TempFile maTempFile; + utl::TempFileNamed maTempFile; protected: void load(std::u16string_view pDir, const char* pName) diff --git a/sd/qa/unit/SdrPdfImportTest.cxx b/sd/qa/unit/SdrPdfImportTest.cxx index ba3c42e92d46..f92c659a1bba 100644 --- a/sd/qa/unit/SdrPdfImportTest.cxx +++ b/sd/qa/unit/SdrPdfImportTest.cxx @@ -231,7 +231,7 @@ CPPUNIT_TEST_FIXTURE(SdrPdfImportTest, testAnnotationsImportExport) } { // save as PDF and check annotations - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); diff --git a/sd/qa/unit/ShapeImportExportTest.cxx b/sd/qa/unit/ShapeImportExportTest.cxx index 071fdc58c74e..186aafa4a267 100644 --- a/sd/qa/unit/ShapeImportExportTest.cxx +++ b/sd/qa/unit/ShapeImportExportTest.cxx @@ -262,7 +262,7 @@ void ShapeImportExportTest::testTextDistancesOOXML_Export() ::sd::DrawDocShellRef xDocShell = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/TextDistancesInsets3.pptx"), PPTX); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xDocShell = saveAndReload(xDocShell.get(), PPTX, &aTempFile); xDocShell->DoClose(); diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index c5a2c2ebc7e8..624dcede7eb3 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -225,7 +225,7 @@ void SdOOXMLExportTest1::testTdf149311() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149311.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -239,7 +239,7 @@ void SdOOXMLExportTest1::testTdf149128() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149128.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -254,7 +254,7 @@ void SdOOXMLExportTest1::testTdf66228() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf66228.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -267,7 +267,7 @@ void SdOOXMLExportTest1::testTdf147919() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf147919.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -327,7 +327,7 @@ void SdOOXMLExportTest1::testTdf130165() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf146223.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -339,7 +339,7 @@ void SdOOXMLExportTest1::testTdf124781() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf124781.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -356,7 +356,7 @@ void SdOOXMLExportTest1::testTdf144914() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf144616.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -398,7 +398,7 @@ void SdOOXMLExportTest1::testTdf144914() void SdOOXMLExportTest1::testTdf124232() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf141704.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -440,7 +440,7 @@ void SdOOXMLExportTest1::testTdf124232() void SdOOXMLExportTest1::testTdf143624() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf143624.pptx"), PPTX ); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -454,7 +454,7 @@ void SdOOXMLExportTest1::testTdf143624() void SdOOXMLExportTest1::testTdf142648() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142648.pptx"), PPTX ); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW); uno::Reference<drawing::XDrawPages> xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW); @@ -475,7 +475,7 @@ void SdOOXMLExportTest1::testTdf142648() void SdOOXMLExportTest1::testTdf47365() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/loopNoPause.pptx"), PPTX ); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -489,7 +489,7 @@ void SdOOXMLExportTest1::testTdf47365() void SdOOXMLExportTest1::testTdf125071() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf125071.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -502,7 +502,7 @@ void SdOOXMLExportTest1::testTdf125071() void SdOOXMLExportTest1::testTdf54037() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf54037.pptx"), PPTX ); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -938,7 +938,7 @@ void SdOOXMLExportTest1::testTableCellFillProperties() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[PPTX].pFilterName), RTL_TEXTENCODING_UTF8); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); xComponent.set(xStorable, uno::UNO_QUERY); @@ -1274,7 +1274,7 @@ void SdOOXMLExportTest1::testTdf112633() { // Load document and export it to a temporary file ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112633.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1301,7 +1301,7 @@ void SdOOXMLExportTest1::testTdf112633() void SdOOXMLExportTest1::testTdf128952() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf128952.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1316,7 +1316,7 @@ void SdOOXMLExportTest1::testTdf128952() void SdOOXMLExportTest1::testTdf127090() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf127090.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1329,7 +1329,7 @@ void SdOOXMLExportTest1::testCustomXml() { // Load document and export it to a temporary file ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/customxml.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1351,7 +1351,7 @@ void SdOOXMLExportTest1::testTdf94238() // Load document and export it to a temporary file. ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf94238.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY); @@ -1389,7 +1389,7 @@ void SdOOXMLExportTest1::testPictureTransparency() // Load document and export it to a temporary file. ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/image_transparency.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY); @@ -1443,7 +1443,7 @@ void SdOOXMLExportTest1::testRoundtripOwnLineStyles() } // Save to pptx, reload and compare the LineDash values - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<drawing::XDrawPagesSupplier> xDocpptx(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY); CPPUNIT_ASSERT(xDocpptx.is()); @@ -1472,7 +1472,7 @@ void SdOOXMLExportTest1::testRoundtripPrstDash() // load and save document, compare prstDash values in saved document with original. ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/presetDashDot.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); const OUString sOriginal[] = { @@ -1522,7 +1522,7 @@ void SdOOXMLExportTest1::testDashOnHairline() // load and save document, make sure the custDash has 11 child elements. ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf127267DashOnHairline.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1534,7 +1534,7 @@ void SdOOXMLExportTest1::testNarrationNonMediaShape() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/narration-non-media-shape.pptx"), PPTX); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; // Without the accompanying fix in place, this test would have failed, // beans::UnknownPropertyException was thrown. xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &aTempFile); @@ -1546,7 +1546,7 @@ void SdOOXMLExportTest1::testCustomshapeBitmapfillSrcrect() ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/customshape-bitmapfill-srcrect.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1582,7 +1582,7 @@ void SdOOXMLExportTest1::testTdf100348FontworkBitmapFill() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf100348_FontworkBitmapFill.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1598,7 +1598,7 @@ void SdOOXMLExportTest1::testTdf100348FontworkGradientGlow() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf100348_FontworkGradientGlow.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1615,7 +1615,7 @@ void SdOOXMLExportTest1::testTdf128345FullTransparentGradient() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf128345_FullTransparentGradient.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1628,7 +1628,7 @@ void SdOOXMLExportTest1::testTdf128345GradientLinear() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf128345_GradientLinear.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1649,7 +1649,7 @@ void SdOOXMLExportTest1::testTdf128345GradientRadial() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf128345_GradientRadial.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1686,7 +1686,7 @@ void SdOOXMLExportTest1::testTdf134969TransparencyOnColorGradient() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf134969_TransparencyOnColorGradient.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1702,7 +1702,7 @@ void SdOOXMLExportTest1::testArcTo() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/arc-validiert.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1718,7 +1718,7 @@ void SdOOXMLExportTest1::testNarrationMimeType() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/narration.pptx"), PPTX); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &aTempFile); xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "[Content_Types].xml"); // Without the accompanying fix in place, this test would have failed with: @@ -1783,7 +1783,7 @@ void SdOOXMLExportTest1::testTdf140865Wordart3D() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf140865Wordart3D.pptx"), PPTX); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &aTempFile); xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "ppt/slides/slide1.xml"); @@ -1804,7 +1804,7 @@ void SdOOXMLExportTest1::testTdf140865Wordart3D() void SdOOXMLExportTest1::testTdf124457() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf124457.pptx"), PPTX ); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1824,7 +1824,7 @@ void SdOOXMLExportTest1::testTdf124457() void SdOOXMLExportTest1::testTdf143126() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf143126.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1838,7 +1838,7 @@ void SdOOXMLExportTest1::testTdf143126() void SdOOXMLExportTest1::testTdf143129() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf143129.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1852,7 +1852,7 @@ void SdOOXMLExportTest1::testTdf118045() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf118045.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1865,7 +1865,7 @@ void SdOOXMLExportTest1::testTdf137675() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf137675.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 6c82d765f27f..4366d26fddd1 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -218,7 +218,7 @@ void SdOOXMLExportTest2::testTdf149697() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf149697.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -241,7 +241,7 @@ void SdOOXMLExportTest2::testTdf149126() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf149126.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -255,7 +255,7 @@ void SdOOXMLExportTest2::testTdf131905() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf131905.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -291,7 +291,7 @@ void SdOOXMLExportTest2::testBnc822341() { // Check import / export of embedded text document ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/bnc822341.odp"), ODP); - utl::TempFile tempFile1; + utl::TempFileNamed tempFile1; xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile1 ); // Export an LO specific ole object (imported from an ODP document) @@ -321,7 +321,7 @@ void SdOOXMLExportTest2::testBnc822341() CPPUNIT_ASSERT_EQUAL( SdrObjKind::OLE2, pObj->GetObjIdentifier() ); } - utl::TempFile tempFile2; + utl::TempFileNamed tempFile2; xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile2 ); // Export an MS specific ole object (imported from a PPTX document) @@ -361,7 +361,7 @@ void SdOOXMLExportTest2::testMathObject() { // Check import / export of math object ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/math.odp"), ODP); - utl::TempFile tempFile1; + utl::TempFileNamed tempFile1; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile1); // Export an LO specific ole object (imported from an ODP document) @@ -381,7 +381,7 @@ void SdOOXMLExportTest2::testMathObject() CPPUNIT_ASSERT_EQUAL(SdrObjKind::OLE2, pObj->GetObjIdentifier()); } - utl::TempFile tempFile2; + utl::TempFileNamed tempFile2; xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile2 ); // Export an MS specific ole object (imported from a PPTX document) @@ -408,7 +408,7 @@ void SdOOXMLExportTest2::testMathObjectPPT2010() { // Check import / export of math object ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/Math.pptx"), PPTX); - utl::TempFile tempFile1; + utl::TempFileNamed tempFile1; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile1); // Export an MS specific ole object (imported from a PPTX document) @@ -738,7 +738,7 @@ void SdOOXMLExportTest2::testPresetShapesExport() "adj3","val 3770", }; - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload( xDocShRef.get(), PPTX, &tempFile ); xmlDocUniquePtr pXmlDocCT = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -988,7 +988,7 @@ void SdOOXMLExportTest2::testTdf92076() void SdOOXMLExportTest2::testTdf59046() { sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf59046.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xShell = saveAndReload(xShell.get(), PPTX, &tempFile); xShell->DoClose(); xmlDocUniquePtr pXmlDocRels = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -998,7 +998,7 @@ void SdOOXMLExportTest2::testTdf59046() void SdOOXMLExportTest2::testTdf133502() { sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf133502.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xShell = saveAndReload(xShell.get(), PPTX, &tempFile); xShell->DoClose(); xmlDocUniquePtr pXmlDocRels = parseExport(tempFile, "ppt/comments/comment1.xml"); @@ -1014,7 +1014,7 @@ void SdOOXMLExportTest2::testTdf105739() { // Gradient was lost during saving to ODP sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf105739.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xShell = saveAndReload(xShell.get(), ODP, &tempFile); uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell); uno::Reference<beans::XPropertySet> xPropSet(xPage, uno::UNO_QUERY); @@ -1069,7 +1069,7 @@ void SdOOXMLExportTest2::testPageBitmapWithTransparency() void SdOOXMLExportTest2::testPptmContentType() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptm/macro.pptm"), PPTM); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTM, &tempFile); // Assert that the content type is the one of PPTM @@ -1085,7 +1085,7 @@ void SdOOXMLExportTest2::testPptmContentType() void SdOOXMLExportTest2::testTdf111798() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf111798.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1130,7 +1130,7 @@ void SdOOXMLExportTest2::testTdf111798() void SdOOXMLExportTest2::testPptmVBAStream() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptm/macro.pptm"), PPTM); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTM, &tempFile); uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(comphelper::getComponentContext(m_xSFactory), tempFile.GetURL()); @@ -1143,7 +1143,7 @@ void SdOOXMLExportTest2::testPptmVBAStream() void SdOOXMLExportTest2::testTdf111863() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf111863.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1156,7 +1156,7 @@ void SdOOXMLExportTest2::testTdf111863() void SdOOXMLExportTest2::testTdf111518() { sd::DrawDocShellRef xShell = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf111518.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; tempFile.EnableKillingFile(false); xShell = saveAndReload(xShell.get(), PPTX, &tempFile); xShell->DoClose(); @@ -1172,7 +1172,7 @@ void SdOOXMLExportTest2::testTdf100387() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf100387.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1201,7 +1201,7 @@ void SdOOXMLExportTest2::testTdf100387() void SdOOXMLExportTest2::testClosingShapesAndLineCaps() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/closed-shapes.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1236,7 +1236,7 @@ void SdOOXMLExportTest2::testClosingShapesAndLineCaps() void SdOOXMLExportTest2::testRotateFlip() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/rotate_flip.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1282,7 +1282,7 @@ void SdOOXMLExportTest2::testRotateFlip() void SdOOXMLExportTest2::testTdf106867() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf106867.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); const SdrPage *pPage = GetPage(1, xDocShRef.get()); @@ -1312,7 +1312,7 @@ void SdOOXMLExportTest2::testTdf106867() void SdOOXMLExportTest2::testTdf112280() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112280.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1325,7 +1325,7 @@ void SdOOXMLExportTest2::testTdf112280() void SdOOXMLExportTest2::testTdf112088() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112088.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1337,7 +1337,7 @@ void SdOOXMLExportTest2::testTdf112088() void SdOOXMLExportTest2::testTdf112333() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112333.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1366,7 +1366,7 @@ void SdOOXMLExportTest2::testTdf112552() { // Background fill was not displayed, but it was because of the wrong geometry ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf112552.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1381,7 +1381,7 @@ void SdOOXMLExportTest2::testTdf112557() { // Subtitle shape should be skipped by export. ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf112557.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml"); @@ -1392,7 +1392,7 @@ void SdOOXMLExportTest2::testTdf112557() void SdOOXMLExportTest2::testTdf128049() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf128049.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1406,7 +1406,7 @@ void SdOOXMLExportTest2::testTdf128049() void SdOOXMLExportTest2::testTdf106026() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf106026.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlMasterContent = parseExport(tempFile, "ppt/slideMasters/slideMaster1.xml"); @@ -1431,7 +1431,7 @@ void SdOOXMLExportTest2::testTdf106026() void SdOOXMLExportTest2::testTdf112334() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112334.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1444,7 +1444,7 @@ void SdOOXMLExportTest2::testTdf112334() void SdOOXMLExportTest2::testTdf112089() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112089.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1458,7 +1458,7 @@ void SdOOXMLExportTest2::testTdf112089() void SdOOXMLExportTest2::testTdf112086() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112086.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1496,7 +1496,7 @@ void SdOOXMLExportTest2::testTdf112647() void SdOOXMLExportTest2::testGroupRotation() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/group_rotation.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1509,7 +1509,7 @@ void SdOOXMLExportTest2::testGroupRotation() void SdOOXMLExportTest2::testTdf104788() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf104788.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1535,7 +1535,7 @@ void SdOOXMLExportTest2::testSmartartRotation2() uno::Sequence<beans::PropertyValue> aInteropGrabBag; xShape->setPropertyValue("InteropGrabBag", uno::Any(aInteropGrabBag)); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1552,7 +1552,7 @@ void SdOOXMLExportTest2::testSmartartRotation2() void SdOOXMLExportTest2::testTdf91999_rotateShape() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf91999_rotateShape.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1568,7 +1568,7 @@ void SdOOXMLExportTest2::testTdf91999_rotateShape() void SdOOXMLExportTest2::testTdf114845_rotateShape() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf114845_rotateShape.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1584,7 +1584,7 @@ void SdOOXMLExportTest2::testTdf114845_rotateShape() void SdOOXMLExportTest2::testGroupsPosition() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/group.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1598,7 +1598,7 @@ void SdOOXMLExportTest2::testGroupsPosition() void SdOOXMLExportTest2::testGroupsRotatedPosition() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/group-rot.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1610,7 +1610,7 @@ void SdOOXMLExportTest2::testGroupsRotatedPosition() void SdOOXMLExportTest2::testAccentColor() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/accent-color.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1634,7 +1634,7 @@ void SdOOXMLExportTest2::testAccentColor() void SdOOXMLExportTest2::testThemeColors() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf84205.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1646,7 +1646,7 @@ void SdOOXMLExportTest2::testThemeColors() void SdOOXMLExportTest2::testTdf111785() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf111785.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1661,7 +1661,7 @@ void SdOOXMLExportTest2::testTdf111785() void SdOOXMLExportTest2::testTdf118825() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf118825-motionpath.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1701,7 +1701,7 @@ void SdOOXMLExportTest2::testTextColumns_tdf140852() xColProps->getPropertyValue("AutomaticDistance")); } - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); { @@ -1757,7 +1757,7 @@ void SdOOXMLExportTest2::testTextColumns_3columns() CPPUNIT_ASSERT_LESS(sal_Int16(100), nScale); } - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); { @@ -1794,7 +1794,7 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf59323.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), @@ -1851,7 +1851,7 @@ void SdOOXMLExportTest2::testTdf53970() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970_linked.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels"); diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index e2ef6928104f..4f5460e1c00b 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -224,7 +224,7 @@ void SdOOXMLExportTest3::testTdf129430() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf129430.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -237,7 +237,7 @@ void SdOOXMLExportTest3::testTdf114848() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf114848.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -253,7 +253,7 @@ void SdOOXMLExportTest3::testTdf147586() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf147586.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -273,7 +273,7 @@ void SdOOXMLExportTest3::testTdf68759() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf68759.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -299,7 +299,7 @@ void SdOOXMLExportTest3::testTdf127901() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf127901.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -321,7 +321,7 @@ void SdOOXMLExportTest3::testTdf48735() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf48735.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -336,7 +336,7 @@ void SdOOXMLExportTest3::testTdf90626() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf90626.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -355,7 +355,7 @@ void SdOOXMLExportTest3::testTdf107608() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf107608.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); @@ -381,7 +381,7 @@ void SdOOXMLExportTest3::testTdf111786() // Export line transparency with the color ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf111786.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); @@ -402,7 +402,7 @@ void SdOOXMLExportTest3::testFontScale() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/font-scale.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -418,7 +418,7 @@ void SdOOXMLExportTest3::testShapeAutofitPPTX() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/testShapeAutofit.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); CPPUNIT_ASSERT(pXmlDocContent); @@ -433,7 +433,7 @@ void SdOOXMLExportTest3::testLegacyShapeAutofitPPTX() { sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); CPPUNIT_ASSERT(pXmlDocContent); @@ -450,7 +450,7 @@ void SdOOXMLExportTest3::testTdf115394() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf115394.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); double fTransitionDuration; @@ -485,7 +485,7 @@ void SdOOXMLExportTest3::testTdf115394Zero() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf115394-zero.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); double fTransitionDuration; @@ -500,7 +500,7 @@ void SdOOXMLExportTest3::testTdf115005() { sd::DrawDocShellRef xDocShRefOriginal = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf115005.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRefResaved = saveAndReload(xDocShRefOriginal.get(), ODP, &tempFile); // additional checks of the output file @@ -536,7 +536,7 @@ int SdOOXMLExportTest3::testTdf115005_FallBack_Images(bool bAddReplacementImages } // save the file with already set options - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRefResaved = saveAndReload(xDocShRefOriginal.get(), ODP, &tempFile); // additional checks of the output file @@ -577,7 +577,7 @@ void SdOOXMLExportTest3::testTdf118806() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf118806.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -590,7 +590,7 @@ void SdOOXMLExportTest3::testTdf130058() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf130058.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); @@ -623,7 +623,7 @@ void SdOOXMLExportTest3::testTdf111789() // Shadow properties were not exported for text shapes. sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf111789.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // First text shape has some shadow @@ -666,7 +666,7 @@ void SdOOXMLExportTest3::testTdf145162() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf145162.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -681,7 +681,7 @@ void SdOOXMLExportTest3::testZeroIndentExport() // Load the bugdoc and save to pptx then. sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/testZeroIndent.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // There are 3 slides, get them xmlDocUniquePtr pSlide1 = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -716,7 +716,7 @@ void SdOOXMLExportTest3::testTdf100348_convert_Fontwork2TextWarp() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf100348_Fontwork2TextWarp.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // Resulting pptx has to contain the TextWarp shape @@ -772,7 +772,7 @@ void SdOOXMLExportTest3::testTdf1225573_FontWorkScaleX() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf125573_FontWorkScaleX.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // Error was, that attribute 'fromWordArt' was ignored @@ -807,7 +807,7 @@ void SdOOXMLExportTest3::testTdf99497_keepAppearanceOfCircleKind() // original angles. Shape 'arc' needs to be unfilled. ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf99497_CircleKind.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // slide 1 45° -> adj1 = 20493903, 270° -> adj2 = 5400000, <a:noFill/> exists @@ -843,7 +843,7 @@ void SdOOXMLExportTest3::testTdf104792() ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf104792-smart-art-animation.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -860,7 +860,7 @@ void SdOOXMLExportTest3::testTdf90627() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf90627.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -878,7 +878,7 @@ void SdOOXMLExportTest3::testTdf104786() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf104786.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide2.xml"); @@ -896,7 +896,7 @@ void SdOOXMLExportTest3::testTdf118783() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf118783.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -911,7 +911,7 @@ void SdOOXMLExportTest3::testTdf104789() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf104789.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -929,7 +929,7 @@ void SdOOXMLExportTest3::testOpenDocumentAsReadOnly() ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/open-as-read-only.pptx"), PPTX); CPPUNIT_ASSERT(xDocShRef->IsSecurityOptOpenReadOnly()); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); CPPUNIT_ASSERT(xDocShRef->IsSecurityOptOpenReadOnly()); xDocShRef->DoClose(); @@ -939,7 +939,7 @@ void SdOOXMLExportTest3::testTdf118835() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf118835.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -968,7 +968,7 @@ void SdOOXMLExportTest3::testTdf118768() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf118768-brake.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -988,7 +988,7 @@ void SdOOXMLExportTest3::testTdf118836() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf118836.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1080,7 +1080,7 @@ void SdOOXMLExportTest3::testTdf116350TextEffects() CPPUNIT_ASSERT_EQUAL(true, bScaleX); // Export - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1095,7 +1095,7 @@ void SdOOXMLExportTest3::testTdf128096() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf128096.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1114,7 +1114,7 @@ void SdOOXMLExportTest3::testTdf120573() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf120573.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1136,7 +1136,7 @@ void SdOOXMLExportTest3::testTdf119118() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf119118.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDocContent, "//p:iterate", "type", "lt"); @@ -1148,7 +1148,7 @@ void SdOOXMLExportTest3::testTdf99213() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf99213-target-missing.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); // Number of nodes with p:attrNameLst was 3, including one that missed tgtEl @@ -1168,7 +1168,7 @@ void SdOOXMLExportTest3::testPotxExport() xLoadable->initNew(); // Export as a POTM template - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), POTX, &tempFile); xDocShRef->DoClose(); @@ -1183,7 +1183,7 @@ void SdOOXMLExportTest3::testPotxExport() void SdOOXMLExportTest3::testTdf44223() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf44223.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); @@ -1225,7 +1225,7 @@ void SdOOXMLExportTest3::testTdf135843() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf135843_export.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1250,7 +1250,7 @@ void SdOOXMLExportTest3::testSmartArtPreserve() { ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/smartart-preserve.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1306,7 +1306,7 @@ void SdOOXMLExportTest3::testTdf125346() // There are two themes in the test document, make sure we use the right theme ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf125346.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); @@ -1329,7 +1329,7 @@ void SdOOXMLExportTest3::testTdf125346_2() // Test more slides with different themes ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf125346_2.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); { @@ -1385,7 +1385,7 @@ void SdOOXMLExportTest3::testTdf125360() xShape->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32>(23))); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xShape.set(getShapeFromPage(0, 0, xDocShRef)); @@ -1408,7 +1408,7 @@ void SdOOXMLExportTest3::testTdf125360_1() xShape->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32>(23))); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xShape.set(getShapeFromPage(0, 0, xDocShRef)); @@ -1435,7 +1435,7 @@ void SdOOXMLExportTest3::testTdf125360_2() xShape->setPropertyValue("FillTransparence", uno::Any(static_cast<sal_Int32>(23))); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xShape.set(getShapeFromPage(0, 0, xDocShRef)); @@ -1451,7 +1451,7 @@ void SdOOXMLExportTest3::testTdf125551() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf125551.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<drawing::XShapes> xGroupShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); @@ -1467,7 +1467,7 @@ void SdOOXMLExportTest3::testTdf136830() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf136830.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // Without the fix in place, the X position of the shapes would have been 0 @@ -1490,7 +1490,7 @@ void SdOOXMLExportTest3::testTdf126234() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf126234.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // check relative size of the bullet, 400% is a legitimate value for MS Office document @@ -1510,7 +1510,7 @@ void SdOOXMLExportTest3::testTdf126741() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf126741.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); // dash dot dot line style import fix @@ -1593,7 +1593,7 @@ void SdOOXMLExportTest3::testTdf128213() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf128213.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1604,7 +1604,7 @@ void SdOOXMLExportTest3::testTdf79082() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf79082.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); @@ -1761,7 +1761,7 @@ void SdOOXMLExportTest3::testTdf132201EffectOrder() { auto xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/effectOrder.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xmlDocUniquePtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); assertXPathChildren(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:effectLst", 2); @@ -1805,7 +1805,7 @@ void SdOOXMLExportTest3::testTdf119223() { auto xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf119223.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1830,7 +1830,7 @@ void SdOOXMLExportTest3::testTdf128213ShapeRot() { auto xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf128213-shaperot.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); @@ -1846,7 +1846,7 @@ void SdOOXMLExportTest3::testTdf125560_textDeflate() { auto xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/ShapePlusImage.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; // This problem did not affect the pptx export, only the ODP so assert that xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); @@ -1863,7 +1863,7 @@ void SdOOXMLExportTest3::testTdf125560_textInflateTop() { auto xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/ShapeTextInflateTop.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; // This problem did not affect the pptx export, only the ODP so assert that xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); @@ -1881,7 +1881,7 @@ void SdOOXMLExportTest3::testTdf142235_TestPlaceholderTextAlignment() auto xDocShRef = loadURL( m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/placeholder-box-textalignment.odp"), ODP); - utl::TempFile tmpfile; + utl::TempFileNamed tmpfile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tmpfile); xDocShRef->DoClose(); @@ -1963,7 +1963,7 @@ void SdOOXMLExportTest3::testTdf143315() m_directories.getURLFromSrc(u"sd/qa/unit/data/ppt/tdf143315-WordartWithoutBullet.ppt"), PPT); - utl::TempFile tmpfile; + utl::TempFileNamed tmpfile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tmpfile); xDocShRef->DoClose(); @@ -1999,7 +1999,7 @@ void SdOOXMLExportTest3::testTdf147121() const auto nFontSizeBefore = xRun->getPropertyValue("CharHeight").get<float>() * 100; // Save and reload - utl::TempFile tmpfile; + utl::TempFileNamed tmpfile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tmpfile); xDocShRef->DoClose(); @@ -2053,7 +2053,7 @@ void SdOOXMLExportTest3::testTdf74670() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf74670.odp"), ODP); - utl::TempFile tmpfile; + utl::TempFileNamed tmpfile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tmpfile); xDocShRef->DoClose(); @@ -2164,7 +2164,7 @@ void SdOOXMLExportTest3::testTdf149551_tbrl90() CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL90, eWritingMode); // Test, that it is exported to vert="vert" - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &aTempFile); xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDoc, "//a:bodyPr", "vert", "vert"); @@ -2200,7 +2200,7 @@ void SdOOXMLExportTest3::testTdf149551_btlr() CPPUNIT_ASSERT_EQUAL(text::WritingMode2::BT_LR, eWritingMode); // Test, that it is exported to vert="vert270" - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &aTempFile); xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "ppt/slides/slide1.xml"); assertXPath(pXmlDoc, "//a:bodyPr", "vert", "vert270"); @@ -2233,7 +2233,7 @@ void SdOOXMLExportTest3::testTdf94122_autoColor() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf94122_autocolor.odp"), ODP); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); xDocShRef->DoClose(); diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 97167d219ff3..a040438fb103 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -327,7 +327,7 @@ void SdExportTest::testMediaEmbedding() void SdExportTest::testFillBitmapUnused() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/fillbitmap2.odp"), ODP); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODP, &aTempFile); xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "content.xml"); @@ -417,7 +417,7 @@ void SdExportTest::testTdf97630() } - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODP, &aTempFile); { @@ -486,7 +486,7 @@ void SdExportTest::testSwappedOutImageExport() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); xComponent.set(xStorable, uno::UNO_QUERY); @@ -541,7 +541,7 @@ void SdExportTest::testOOoXMLAnimations() uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -618,7 +618,7 @@ void SdExportTest::testUnknownAttributes() uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(getFormat(ODP)->pFilterName), RTL_TEXTENCODING_UTF8); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -726,7 +726,7 @@ void SdExportTest::testLinkedGraphicRT() } // Save and reload - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); xComponent.set(xStorable, uno::UNO_QUERY); @@ -758,7 +758,7 @@ void SdExportTest::testTdf79082() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/ppt/tdf79082.ppt"), PPT); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; tempFile.EnableKillingFile(); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); @@ -821,7 +821,7 @@ void SdExportTest::testImageWithSpecialID() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[vFormats[nExportFormat]].pFilterName), RTL_TEXTENCODING_UTF8); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); xComponent.set(xStorable, uno::UNO_QUERY); @@ -998,7 +998,7 @@ void SdExportTest::testDefaultSubscripts() void SdExportTest::testTdf98477() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf98477grow.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); @@ -1027,7 +1027,7 @@ void SdExportTest::testAuthorField() void SdExportTest::testTdf50499() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf50499.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); @@ -1116,7 +1116,7 @@ void SdExportTest::testTextRotation() pBatch->commit(); ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/shape-text-rotate.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); uno::Reference<drawing::XDrawPage> xPage(getPage(0, xDocShRef)); @@ -1136,7 +1136,7 @@ void SdExportTest::testTextRotation() pBatch->commit(); ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/shape-text-rotate.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); uno::Reference<drawing::XDrawPage> xPage(getPage(0, xDocShRef)); @@ -1165,7 +1165,7 @@ void SdExportTest::testTdf115394PPT() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[PPT].pFilterName), RTL_TEXTENCODING_UTF8); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); xComponent.set(xStorable, uno::UNO_QUERY); @@ -1204,7 +1204,7 @@ void SdExportTest::testBulletsAsImage() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OStringToOUString(std::string_view(aFileFormats[nExportFormat].pFilterName), RTL_TEXTENCODING_UTF8); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); xComponent.set(xStorable, uno::UNO_QUERY); @@ -1284,7 +1284,7 @@ void SdExportTest::testBulletsAsImage() void SdExportTest::testTdf113822() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf113822underline.pptx"), PPTX); // Was unable to export iterate container (tdf#99213). @@ -1307,7 +1307,7 @@ void SdExportTest::testTdf113822() void SdExportTest::testTdf113818() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf113818-swivel.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), PPT); xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); @@ -1321,7 +1321,7 @@ void SdExportTest::testTdf113818() void SdExportTest::testTdf119629() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/ppt/tdf119629.ppt"), PPT); xDocShRef = saveAndReload(xDocShRef.get(), PPT); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); @@ -1342,7 +1342,7 @@ void SdExportTest::testTdf119629() void SdExportTest::testTdf141269() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf141269.odp"), ODP); xDocShRef = saveAndReload(xDocShRef.get(), PPT); @@ -1371,7 +1371,7 @@ void SdExportTest::testTdf141269() void SdExportTest::testTdf123557() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/trigger.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); @@ -1414,7 +1414,7 @@ void SdExportTest::testTdf126761() void SdExportTest::testGlow() { auto xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odg/glow.odg"), ODG); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile); uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); @@ -1456,7 +1456,7 @@ void SdExportTest::testSoftEdges() { auto xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odg/softedges.odg"), ODG); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile); auto xShapeProps(getShapeFromPage(0, 0, xDocShRef)); @@ -1483,7 +1483,7 @@ void SdExportTest::testSoftEdges() void SdExportTest::testShadowBlur() { auto xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odg/shadow-blur.odg"), ODG); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile); uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef)); @@ -1519,7 +1519,7 @@ void SdExportTest::testTdf91060() void SdExportTest::testTdf128550() { - utl::TempFile tempFile; + utl::TempFileNamed tempFile; sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf128550.pptx"), PPTX); xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "content.xml"); @@ -1534,7 +1534,7 @@ void SdExportTest::testTdf140714() //Without the fix in place, shape will be imported as GraphicObjectShape instead of CustomShape. auto xDocShRef = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf140714.pptx"), PPTX); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); uno::Reference<drawing::XShape> xShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); @@ -1608,7 +1608,7 @@ void SdExportTest::testMasterPageBackgroundFullSize() CPPUNIT_ASSERT_EQUAL(sal_Int16(0), xBackgroundProps->getPropertyValue("FillTransparence").get<sal_Int16>()); } - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODP, &tempFile); xMPS.set(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY); @@ -1717,7 +1717,7 @@ void SdExportTest::testColumnsODG() CPPUNIT_ASSERT_EQUAL(sal_Int32(700), pTextObj->GetTextColumnsSpacing()); } - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile); { @@ -1759,7 +1759,7 @@ void SdExportTest::testColumnsODG() void SdExportTest::testTdf112126() { sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/tdf112126.odg"), ODG); - utl::TempFile tempFile; + utl::TempFileNamed tempFile; xDocShRef = saveAndReload(xDocShRef.get(), ODG, &tempFile); uno::Reference<drawing::XDrawPage> xPage(getPage(0, xDocShRef)); uno::Reference<beans::XPropertySet> xPropertySet(xPage, uno::UNO_QUERY); diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 39d36fa35ef5..41d406e2a1e5 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -567,7 +567,7 @@ void SdMiscTest::testTdf101242_ODF_add_settings() std::shared_ptr<comphelper::ConfigurationChanges> pBatch( comphelper::ConfigurationChanges::create() ); officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); save(xDocShRef.get(), getFormat(ODG), aTempFile ); @@ -617,7 +617,7 @@ void SdMiscTest::testTdf101242_ODF_no_settings() std::shared_ptr<comphelper::ConfigurationChanges> pBatch( comphelper::ConfigurationChanges::create() ); officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(false, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); save(xDocShRef.get(), getFormat(ODG), aTempFile ); @@ -659,7 +659,7 @@ void SdMiscTest::testTdf101242_settings_keep() std::shared_ptr<comphelper::ConfigurationChanges> pBatch( comphelper::ConfigurationChanges::create() ); officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(true, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); save(xDocShRef.get(), getFormat(ODG), aTempFile ); @@ -710,7 +710,7 @@ void SdMiscTest::testTdf101242_settings_remove() std::shared_ptr<comphelper::ConfigurationChanges> pBatch( comphelper::ConfigurationChanges::create() ); officecfg::Office::Common::Misc::WriteLayerStateAsConfigItem::set(false, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); save(xDocShRef.get(), getFormat(ODG), aTempFile ); @@ -757,7 +757,7 @@ void SdMiscTest::testTdf119392() pPageView -> SetLayerVisible("-P-", false); pPageView -> SetLayerPrintable("-P-", true); pPageView -> SetLayerLocked("-P-", false); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); save(xDocShRef.get(), getFormat(ODG), aTempFile ); @@ -849,7 +849,7 @@ void SdMiscTest::testTdf98839_ShearVFlipH() pShape->Mirror(Point(4000, 2000), Point(4000, 10000)); // Save and examine attribute draw:transform - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); save(xDocShRef.get(), getFormat(ODG), aTempFile); xmlDocUniquePtr pXmlDoc = parseExport(aTempFile, "content.xml"); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index d5e63716f248..d7195a4bdd37 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -198,7 +198,7 @@ protected: return pFormat; } - void exportTo(sd::DrawDocShell* pShell, FileFormat const * pFormat, utl::TempFile const & rTempFile) + void exportTo(sd::DrawDocShell* pShell, FileFormat const * pFormat, utl::TempFileNamed const & rTempFile) { SfxMedium aStoreMedium(rTempFile.GetURL(), StreamMode::STD_WRITE); if ( std::strcmp(pFormat->pName, "odg") == 0) @@ -238,7 +238,7 @@ protected: } - void save(sd::DrawDocShell* pShell, FileFormat const * pFormat, utl::TempFile const & rTempFile) + void save(sd::DrawDocShell* pShell, FileFormat const * pFormat, utl::TempFileNamed const & rTempFile) { SfxMedium aStoreMedium(rTempFile.GetURL(), StreamMode::STD_WRITE); if ( std::strcmp(pFormat->pName, "odg") == 0 ) @@ -276,13 +276,13 @@ protected: } sd::DrawDocShellRef saveAndReload(sd::DrawDocShell *pShell, sal_Int32 nExportType, - utl::TempFile * pTempFile = nullptr) + utl::TempFileNamed * pTempFile = nullptr) { FileFormat* pFormat = getFormat(nExportType); - std::unique_ptr<utl::TempFile> pNewTempFile; + std::unique_ptr<utl::TempFileNamed> pNewTempFile; if (!pTempFile) { - pNewTempFile.reset(new utl::TempFile); + pNewTempFile.reset(new utl::TempFileNamed); pTempFile = pNewTempFile.get(); } save(pShell, pFormat, *pTempFile); @@ -444,7 +444,7 @@ class SdModelTestBaseXML { public: - xmlDocUniquePtr parseExport(utl::TempFile const & rTempFile, OUString const& rStreamName) + xmlDocUniquePtr parseExport(utl::TempFileNamed const & rTempFile, OUString const& rStreamName) { std::unique_ptr<SvStream> const pStream(parseExportStream(rTempFile, rStreamName)); xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get()); diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 3d2574da0b82..fafd3fe4cc56 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -72,7 +72,8 @@ public: void insertStringToObject(sal_uInt16 nObj, const std::u16string_view& rStr, bool bUseEscape); sd::slidesorter::SlideSorterViewShell* getSlideSorterViewShell(); FileFormat* getFormat(sal_Int32 nExportType); - void save(sd::DrawDocShell* pShell, FileFormat const* pFormat, utl::TempFile const& rTempFile); + void save(sd::DrawDocShell* pShell, FileFormat const* pFormat, + utl::TempFileNamed const& rTempFile); }; void SdUiImpressTest::setUp() @@ -174,7 +175,7 @@ FileFormat* SdUiImpressTest::getFormat(sal_Int32 nExportType) } void SdUiImpressTest::save(sd::DrawDocShell* pShell, FileFormat const* pFormat, - utl::TempFile const& rTempFile) + utl::TempFileNamed const& rTempFile) { SfxMedium aStoreMedium(rTempFile.GetURL(), StreamMode::STD_WRITE); if (std::strcmp(pFormat->pName, "odg") == 0) @@ -1118,7 +1119,7 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf127696) dispatchCommand(mxComponent, ".uno:OutlineFont", {}); // Save it as PPTX and load it again. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save(dynamic_cast<SdXImpressDocument*>(mxComponent.get())->GetDocShell(), getFormat(PPTX), aTempFile); mxComponent = loadFromDesktop(aTempFile.GetURL()); diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index a49579a60df5..4a67154ccd6f 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -597,8 +597,7 @@ bool SdTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pOb case SDTRANSFER_OBJECTTYPE_DRAWOLE: { SfxObjectShell* pEmbObj = static_cast<SfxObjectShell*>(pObject); - ::utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); + ::utl::TempFileFast aTempFile; SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE); try diff --git a/sfx2/qa/cppunit/test_misc.cxx b/sfx2/qa/cppunit/test_misc.cxx index 1bf90cfbc218..ae721c50c892 100644 --- a/sfx2/qa/cppunit/test_misc.cxx +++ b/sfx2/qa/cppunit/test_misc.cxx @@ -80,7 +80,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testODFCustomMetadata) uno::Sequence<beans::PropertyValue> mimeArgs({ beans::PropertyValue("MediaType", -1, uno::Any(OUString("application/vnd.oasis.opendocument.text")), beans::PropertyState_DIRECT_VALUE) }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xProps->storeToMedium(aTempFile.GetURL(), mimeArgs); // check that custom metadata is preserved @@ -111,7 +111,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testNoThumbnail) #endif uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY); CPPUNIT_ASSERT(xStorable.is()); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aProperties( comphelper::InitPropertySequence({ { "NoThumbnail", uno::Any(true) } })); @@ -193,7 +193,7 @@ CPPUNIT_TEST_FIXTURE(MiscTest, testHardLinks) CPPUNIT_TEST_FIXTURE(MiscTest, testOverwrite) { // tdf#60237 - try to overwrite an existing file using the different settings of the Overwrite option - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<lang::XComponent> xComponent = loadFromDesktop(aTempFile.GetURL(), "com.sun.star.text.TextDocument"); diff --git a/sfx2/source/appl/flatpak.cxx b/sfx2/source/appl/flatpak.cxx index 2ed2fe2101d8..c6edf6f23276 100644 --- a/sfx2/source/appl/flatpak.cxx +++ b/sfx2/source/appl/flatpak.cxx @@ -72,13 +72,12 @@ bool flatpak::createTemporaryHtmlDirectory(OUString ** url) { if (!parent.endsWith("/")) { parent += "/"; } - auto const tmp = utl::TempFile(&parent, true); - if (!tmp.IsValid()) { + temporaryHtmlDirectoryStatus.url = utl::CreateTempURL(&parent, true); + if (temporaryHtmlDirectoryStatus.url.isEmpty()) { SAL_WARN( "sfx.appl", "LIBO_FLATPAK mode failure creating temp dir at <" << parent << ">"); return false; } - temporaryHtmlDirectoryStatus.url = tmp.GetURL(); temporaryHtmlDirectoryStatus.created = true; } *url = &temporaryHtmlDirectoryStatus.url; diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 01641418de9f..d4c9bc7f5a6f 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -961,7 +961,7 @@ static bool impl_showOfflineHelp(const OUString& rURL, weld::Widget* pDialogPare if (flatpak::isFlatpak() && !flatpak::createTemporaryHtmlDirectory(&parent)) { return false; } - ::utl::TempFile aTempFile(u"NewHelp", true, aExtension, parent, false ); + ::utl::TempFileNamed aTempFile(u"NewHelp", true, aExtension, parent, false ); SvStream* pStream = aTempFile.GetStream(StreamMode::WRITE); pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8); diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index b9aa2b53cdcf..29ebcc615552 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -65,7 +65,7 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const OUString& aFolde ::ucbhelper::Content aContent; if( ::ucbhelper::Content::create( aFolderUrl, xComEnv, comphelper::getProcessComponentContext(), aContent ) ) { - OUString aTempURL = ::utl::TempFile().GetURL(); + OUString aTempURL = ::utl::CreateTempURL(); try { if ( aContent.isFolder() ) { diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 382a677369f4..35845bf7d2cf 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -457,9 +457,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( // This makes it possible to store the file for "send document as e-mail" // with the original file name. We cannot use the original file as // some mail programs need exclusive access. - ::utl::TempFile aTempDir( nullptr, true ); - - INetURLObject aFilePathObj( aTempDir.GetURL() ); + INetURLObject aFilePathObj( ::utl::CreateTempURL(nullptr, true) ); aFilePathObj.insertName( aFileName ); aFilePathObj.setExtension( aExtension ); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 826e77f2533a..a0f789884d4c 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -399,7 +399,7 @@ public: uno::Sequence < util::RevisionTag > aVersions; - std::unique_ptr<::utl::TempFile> pTempFile; + std::unique_ptr<::utl::TempFileNamed> pTempFile; uno::Reference<embed::XStorage> xStorage; uno::Reference<embed::XStorage> m_xZipStorage; @@ -1785,8 +1785,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempFile ) if ( pStream && pStream->GetError() == ERRCODE_NONE ) { // Unpack Stream in TempDir - ::utl::TempFile aTempFile; - const OUString& aTmpName = aTempFile.GetURL(); + const OUString aTmpName = ::utl::CreateTempURL(); SvFileStream aTmpStream( aTmpName, SFX_STREAM_READWRITE ); pStream->ReadStream( aTmpStream ); @@ -2519,7 +2518,7 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont if ( !pImpl->m_aBackupURL.isEmpty() ) return; // the backup was done already - ::utl::TempFile aTransactTemp( aPrefix, true, aExtension, &aDestDir ); + ::utl::TempFileNamed aTransactTemp( aPrefix, true, aExtension, &aDestDir ); INetURLObject aBackObj( aTransactTemp.GetURL() ); OUString aBackupName = aBackObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset ); @@ -3324,7 +3323,7 @@ void SfxMedium::CompleteReOpen() bool bUseInteractionHandler = pImpl->bUseInteractionHandler; pImpl->bUseInteractionHandler = false; - std::unique_ptr<::utl::TempFile> pTmpFile; + std::unique_ptr<::utl::TempFileNamed> pTmpFile; if ( pImpl->pTempFile ) { pTmpFile = std::move(pImpl->pTempFile); @@ -3831,7 +3830,7 @@ void SfxMedium::CreateTempFile( bool bReplace ) } OUString aLogicBase = GetLogicBase(GetURLObject(), pImpl); - pImpl->pTempFile.reset(new ::utl::TempFile(&aLogicBase)); + pImpl->pTempFile.reset(new ::utl::TempFileNamed(&aLogicBase)); pImpl->pTempFile->EnableKillingFile(); pImpl->m_aName = pImpl->pTempFile->GetFileName(); OUString aTmpURL = pImpl->pTempFile->GetURL(); @@ -3927,7 +3926,7 @@ void SfxMedium::CreateTempFileNoCopy() pImpl->pTempFile.reset(); OUString aLogicBase = GetLogicBase(GetURLObject(), pImpl); - pImpl->pTempFile.reset(new ::utl::TempFile(&aLogicBase)); + pImpl->pTempFile.reset(new ::utl::TempFileNamed(&aLogicBase)); pImpl->pTempFile->EnableKillingFile(); pImpl->m_aName = pImpl->pTempFile->GetFileName(); if ( pImpl->m_aName.isEmpty() ) @@ -4272,7 +4271,7 @@ OUString SfxMedium::CreateTempCopyWithExt( std::u16string_view aURL ) size_t nPrefixLen = aURL.rfind( '.' ); std::u16string_view aExt = ( nPrefixLen == std::u16string_view::npos ) ? std::u16string_view() : aURL.substr( nPrefixLen ); - OUString aNewTempFileURL = ::utl::TempFile( u"", true, aExt ).GetURL(); + OUString aNewTempFileURL = ::utl::CreateTempURL( u"", true, aExt ); if ( !aNewTempFileURL.isEmpty() ) { INetURLObject aSource( aURL ); @@ -4345,7 +4344,7 @@ OUString SfxMedium::SwitchDocumentToTempFile() std::u16string_view aExt = (nPrefixLen == -1) ? std::u16string_view() : aOrigURL.subView(nPrefixLen); - OUString aNewURL = ::utl::TempFile( u"", true, aExt ).GetURL(); + OUString aNewURL = ::utl::CreateTempURL( u"", true, aExt ); // TODO/LATER: In future the aLogicName should be set to shared folder URL // and a temporary file should be created. Transport_Impl should be impossible then. diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 84da6209172a..754d5692f8c7 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -77,7 +77,7 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta ) #ifdef _WIN32 if ( pGDIMeta ) { - ::utl::TempFile aTempFile( u"", true, u".emf" ); + ::utl::TempFileNamed aTempFile( u"", true, u".emf" ); OUString aMetaFile = aTempFile.GetFileName(); OUString aMetaURL = aTempFile.GetURL(); diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index 98e87e2963f5..6c83b4066466 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -248,7 +248,7 @@ bool SfxObjectShell::PutURLContentsToVersionStream_Impl( OUString SfxObjectShell::CreateTempCopyOfStorage_Impl( const uno::Reference< embed::XStorage >& xStorage ) { - OUString aTempURL = ::utl::TempFile().GetURL(); + OUString aTempURL = ::utl::CreateTempURL(); DBG_ASSERT( !aTempURL.isEmpty(), "Can't create a temporary file!\n" ); if ( !aTempURL.isEmpty() ) diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index cd2dc78bb0c0..732aca4f3a33 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -461,11 +461,11 @@ class ImplUCBPrintWatcher : public ::osl::Thread /// this describes the target location for the printed temp file OUString m_sTargetURL; /// it holds the temp file alive, till the print job will finish and remove it from disk automatically if the object die - ::utl::TempFile* m_pTempFile; + ::utl::TempFileNamed* m_pTempFile; public: /* initialize this watcher but don't start it */ - ImplUCBPrintWatcher( SfxPrinter* pPrinter, ::utl::TempFile* pTempFile, OUString sTargetURL ) + ImplUCBPrintWatcher( SfxPrinter* pPrinter, ::utl::TempFileNamed* pTempFile, OUString sTargetURL ) : m_pPrinter ( pPrinter ) , m_sTargetURL(std::move( sTargetURL )) , m_pTempFile ( pTempFile ) @@ -508,7 +508,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread the thread, if finishing of the job was detected outside this thread. But it must be called without using a corresponding thread for the given parameter! */ - static void moveAndDeleteTemp( ::utl::TempFile** ppTempFile, std::u16string_view sTargetURL ) + static void moveAndDeleteTemp( ::utl::TempFileNamed** ppTempFile, std::u16string_view sTargetURL ) { // move the file try @@ -577,7 +577,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // a local one we can suppress this special handling. Because then vcl makes all // right for us. OUString sUcbUrl; - ::utl::TempFile* pUCBPrintTempFile = nullptr; + ::utl::TempFileNamed* pUCBPrintTempFile = nullptr; uno::Sequence < beans::PropertyValue > aCheckedArgs( rOptions.getLength() ); auto pCheckedArgs = aCheckedArgs.getArray(); @@ -654,7 +654,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // Execution of the print job will be done later by executing // a slot ... if(!pUCBPrintTempFile) - pUCBPrintTempFile = new ::utl::TempFile(); + pUCBPrintTempFile = new ::utl::TempFileNamed(); pUCBPrintTempFile->EnableKillingFile(); //FIXME: does it work? diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index de2e9e2bc235..ebfa497aaef1 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2057,7 +2057,7 @@ Any SAL_CALL SfxBaseModel::getTransferData( const datatransfer::DataFlavor& aFla try { - utl::TempFile aTmp; + utl::TempFileNamed aTmp; aTmp.EnableKillingFile(); storeToURL( aTmp.GetURL(), Sequence < beans::PropertyValue >() ); std::unique_ptr<SvStream> pStream(aTmp.GetStream( StreamMode::READ )); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 2e53fa583828..fe7991553afc 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -616,9 +616,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) { SAL_WARN("sfx.view", "cannot create Flatpak html temp dir"); } - ::utl::TempFile aTempDir( parent, true ); - INetURLObject aFilePathObj( aTempDir.GetURL() ); + INetURLObject aFilePathObj( ::utl::CreateTempURL(parent, true) ); aFilePathObj.insertName( aFileName ); aFilePathObj.setExtension( u"htm" ); diff --git a/shell/source/win32/simplemail/smplmailclient.cxx b/shell/source/win32/simplemail/smplmailclient.cxx index 8e85ca0868ee..b4bef54ef15f 100644 --- a/shell/source/win32/simplemail/smplmailclient.cxx +++ b/shell/source/win32/simplemail/smplmailclient.cxx @@ -191,7 +191,7 @@ OUString CSmplMailClient::CopyAttachment(const OUString& sOrigAttachURL, OUStrin // removed in Desktop::RemoveTemporaryDirectory() if soffice process gets closed before the // mailer finishes using them. - maAttachmentFiles.emplace_back(std::make_unique<utl::TempFile>(&GetBaseTempDirURL())); + maAttachmentFiles.emplace_back(std::make_unique<utl::TempFileNamed>(&GetBaseTempDirURL())); maAttachmentFiles.back()->EnableKillingFile(); INetURLObject aFilePathObj(maAttachmentFiles.back()->GetURL()); OUString sNewAttachmentURL = aFilePathObj.GetMainURL(INetURLObject::DecodeMechanism::NONE); diff --git a/shell/source/win32/simplemail/smplmailclient.hxx b/shell/source/win32/simplemail/smplmailclient.hxx index 6f71a1a2a715..d2c4bf77a2a0 100644 --- a/shell/source/win32/simplemail/smplmailclient.hxx +++ b/shell/source/win32/simplemail/smplmailclient.hxx @@ -42,7 +42,7 @@ private: // Don't try to delete the copied attachment files; let the spawned process cleanup them void ReleaseAttachments(); - std::vector< std::unique_ptr<utl::TempFile> > maAttachmentFiles; + std::vector< std::unique_ptr<utl::TempFileNamed> > maAttachmentFiles; }; #endif diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx index cebade94f654..682aa08f504f 100644 --- a/sot/source/sdstor/stg.cxx +++ b/sot/source/sdstor/stg.cxx @@ -339,7 +339,7 @@ Storage::Storage( OUString aFile, StreamMode m, bool bDirect ) if( aName.isEmpty() ) { // no name = temporary name! - aName = utl::TempFile::CreateTempName(); + aName = utl::CreateTempName(); bTemp = true; } // the root storage creates the I/O system diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index 717e4e7d175b..b58c2a7922d9 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -1225,7 +1225,7 @@ void StgTmpStrm::SetSize(sal_uInt64 n) { if( n > THRESHOLD ) { - m_aName = utl::TempFile(nullptr, false).GetURL(); + m_aName = utl::CreateTempURL(); std::unique_ptr<SvFileStream> s(new SvFileStream( m_aName, StreamMode::READWRITE )); const sal_uInt64 nCur = Tell(); sal_uInt64 i = nEndOfData; diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index e44a8a32fe7f..5b6ca1b72e11 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -460,7 +460,7 @@ public: OUString m_aContentType; OUString m_aOriginalContentType; std::unique_ptr<::ucbhelper::Content> m_pContent; // the content that provides the storage elements - std::unique_ptr<::utl::TempFile> m_pTempFile; // temporary file, only for storages on stream + std::unique_ptr<::utl::TempFileNamed> m_pTempFile; // temporary file, only for storages on stream SvStream* m_pSource; // original stream, only for storages on a stream ErrCode m_nError; StreamMode m_nMode; // open mode ( read/write/trunc/nocreate/sharing ) @@ -681,7 +681,7 @@ bool UCBStorageStream_Impl::Init() // create one if ( m_aTempURL.isEmpty() ) - m_aTempURL = ::utl::TempFile().GetURL(); + m_aTempURL = ::utl::CreateTempURL(); m_pStream = ::utl::UcbStreamHelper::CreateStream( m_aTempURL, StreamMode::STD_READWRITE, true /* bFileExists */ ); #if OSL_DEBUG_LEVEL > 0 @@ -1451,7 +1451,7 @@ UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const OU { // no name given = use temporary name! DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" ); - m_pTempFile.reset(new ::utl::TempFile); + m_pTempFile.reset(new ::utl::TempFileNamed); m_pTempFile->EnableKillingFile(); m_aName = aName = m_pTempFile->GetURL(); } @@ -1479,7 +1479,7 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, UCBSt { // no name given = use temporary name! DBG_ASSERT( m_bIsRoot, "SubStorage must have a name!" ); - m_pTempFile.reset(new ::utl::TempFile); + m_pTempFile.reset(new ::utl::TempFileNamed); m_pTempFile->EnableKillingFile(); m_aName = aName = m_pTempFile->GetURL(); } @@ -1507,7 +1507,7 @@ UCBStorage_Impl::UCBStorage_Impl( const OUString& rName, StreamMode nMode, UCBSt UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, bool bDirect ) : m_pAntiImpl( pStorage ) - , m_pTempFile( new ::utl::TempFile ) + , m_pTempFile( new ::utl::TempFileNamed ) , m_pSource( &rStream ) , m_nError( ERRCODE_NONE ) , m_bCommited( false ) @@ -2108,7 +2108,7 @@ sal_Int16 UCBStorage_Impl::Commit() { // create a stream to write the manifest file - use a temp file OUString aURL( aNewSubFolder.getURL() ); - std::optional< ::utl::TempFile> pTempFile(&aURL ); + std::optional< ::utl::TempFileNamed > pTempFile(&aURL ); // get the stream from the temp file and create an output stream wrapper SvStream* pStream = pTempFile->GetStream( StreamMode::STD_READWRITE ); diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx index d41ba41e6c69..f74c0c76c851 100644 --- a/starmath/qa/extras/mmlexport-test.cxx +++ b/starmath/qa/extras/mmlexport-test.cxx @@ -77,7 +77,7 @@ void MathMLExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) xmlDocUniquePtr MathMLExportTest::exportAndParse() { - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); SfxMedium aStoreMedium(aTempFile.GetURL(), StreamMode::STD_WRITE); std::shared_ptr<const SfxFilter> pExportFilter = SfxFilter::GetFilterByName(MATHML_XML); diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx index b611ff5309d8..81c2bcff307d 100644 --- a/svl/source/fsstor/fsfactory.cxx +++ b/svl/source/fsstor/fsfactory.cxx @@ -37,8 +37,7 @@ using namespace ::com::sun::star; uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstance() { - OUString aTempURL = ::utl::TempFile( nullptr, true ).GetURL(); - + OUString aTempURL = ::utl::CreateTempURL( nullptr, true ); if ( aTempURL.isEmpty() ) throw uno::RuntimeException("Cannot create tempfile."); diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 6d604a9e3afd..2d453425b493 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -101,8 +101,7 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo { // TODO/LATER: Probably the graphic should be copied here as well // currently it is handled by the applications - utl::TempFile aTmp; - aTmp.EnableKillingFile(); + utl::TempFileFast aTmp; uno::Reference < embed::XEmbedPersist > xPers( m_xObj, uno::UNO_QUERY ); if ( xPers.is() ) { 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 ) diff --git a/sw/qa/core/draw/draw.cxx b/sw/qa/core/draw/draw.cxx index feb347adc8d4..25f7e1bd442d 100644 --- a/sw/qa/core/draw/draw.cxx +++ b/sw/qa/core/draw/draw.cxx @@ -111,7 +111,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreDrawTest, testTdf107727FrameBorder) // Export to RTF 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("Rich Text Format"); diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index 3e4dfd697206..e880e428fc34 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -117,7 +117,7 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL, bool bSaved; { - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); SfxMedium aDstMed(aTempFile.GetURL(), StreamMode::STD_WRITE); aDstMed.SetFilter(pExportFilter); diff --git a/sw/qa/core/filters-test2.cxx b/sw/qa/core/filters-test2.cxx index 965645c3be57..08736b962a85 100644 --- a/sw/qa/core/filters-test2.cxx +++ b/sw/qa/core/filters-test2.cxx @@ -111,7 +111,7 @@ bool SwFiltersTest2::filter(const OUString& rFilter, const OUString& rURL, if (bLoaded) xDocShRef->ResetError(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); SfxMedium aDstMed(aTempFile.GetURL(), StreamMode::STD_WRITE); aDstMed.SetFilter(pExportFilter); diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 0df5ea55a44f..f02bd34d91be 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -383,7 +383,7 @@ void SwMacrosTest::testFdo68983() loadFromDesktop(aFileName, "com.sun.star.text.TextDocument"); Reference< frame::XStorable > xDocStorable(xComponent, UNO_QUERY_THROW); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); Sequence<beans::PropertyValue> desc( comphelper::InitPropertySequence({ { "FilterName", Any(OUString("writer8")) } @@ -415,7 +415,7 @@ void SwMacrosTest::testFdo87530() Reference<css::lang::XComponent> xComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); Sequence<beans::PropertyValue> desc( comphelper::InitPropertySequence({ diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 7b6089b50641..a51a472ec7bc 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -196,7 +196,7 @@ void SwDocTest::testFileNameFields() { //Here's a file name with some chars in it that will be %% encoded, when expanding //SwFileNameFields we want to restore the original readable filename - utl::TempFile aTempFile(u"demo [name]"); + utl::TempFileNamed aTempFile(u"demo [name]"); aTempFile.EnableKillingFile(); INetURLObject aTempFileURL(aTempFile.GetURL()); diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 850df79be627..228c5dc0a234 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -114,7 +114,7 @@ void Test::testEmbeddedGraphicRoundtrip() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -182,7 +182,7 @@ void Test::testLinkedGraphicRT() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -248,7 +248,7 @@ void Test::testImageWithSpecialID() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -343,7 +343,7 @@ void Test::testGraphicShape() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -447,7 +447,7 @@ void Test::testMultipleIdenticalGraphics() // Export the document and import again for a check utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -505,7 +505,7 @@ void Test::testCharHighlightBody() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -601,7 +601,7 @@ void Test::testCharStyleHighlight() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -675,7 +675,7 @@ void Test::testCharHighlightODF() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("writer8"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -790,7 +790,7 @@ void Test::testMSCharBackgroundEditing() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -854,7 +854,7 @@ void Test::testCharBackgroundToHighlighting() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -1064,7 +1064,7 @@ void Test::testNestedFieldmark() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName.first; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); mxComponent->dispose(); @@ -1133,7 +1133,7 @@ void Test::testODF13() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("writer8"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> const xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -1169,7 +1169,7 @@ void Test::testODF13() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("writer8"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> const xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -1205,7 +1205,7 @@ void Test::testODF13() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("writer8"); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> const xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -1268,7 +1268,7 @@ void Test::testRedlineFlags() utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); @@ -1351,7 +1351,7 @@ void Test::testBulletAsImage() aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY); @@ -1440,7 +1440,7 @@ void Test::testTextFormField() uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -1503,7 +1503,7 @@ void Test::testCheckBoxFormField() uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -1566,7 +1566,7 @@ void Test::testDropDownFormField() uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -1651,7 +1651,7 @@ void Test::testDateFormField() uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); @@ -1845,7 +1845,7 @@ void Test::testDateFormFieldCharacterFormatting() uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= rFilterName; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); uno::Reference< lang::XComponent > xComponent(xStorable, uno::UNO_QUERY); diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 3a212d2242f5..38ee565cbd14 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1217,7 +1217,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PDF) mxComponent.clear(); ImportFromReqif(maTempFile.GetURL()); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aStoreProperties = { comphelper::makePropertyValue("FilterName", OUString("writer8")), diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 0536a54d8b7e..feda2a494469 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3376,7 +3376,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf109137) { createSwDoc(DATA_DIRECTORY, "tdf109137.docx"); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, @@ -3538,7 +3538,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) { createSwDoc(DATA_DIRECTORY, "tdf117188.docx"); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, @@ -3788,7 +3788,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf122607_regression) uno::Sequence<beans::PropertyValue> props(comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer_pdf_Export")) }, })); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), props); @@ -3832,7 +3832,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150616) uno::Sequence<beans::PropertyValue> props(comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer_pdf_Export")) }, })); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), props); diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index ac783be344fd..4ba57e79f336 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -740,7 +740,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTableCellInvalidate) uno::Sequence<beans::PropertyValue> props(comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer_pdf_Export")) }, })); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), props); @@ -2233,7 +2233,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf121509) CPPUNIT_ASSERT(pTriangleShapeFormat->SetFormatAttr(aNewAnch)); // Reload (docx) - auto aTemp = utl::TempFile(); + utl::TempFileNamed aTemp; save("Office Open XML Text", aTemp); // The second part: check if the reloaded doc has flys inside a fly diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx index 8d024194c985..41e1862ff509 100644 --- a/sw/qa/extras/mailmerge/mailmerge.cxx +++ b/sw/qa/extras/mailmerge/mailmerge.cxx @@ -84,7 +84,7 @@ public: header(); preTest(filename); - utl::TempFile aTempDir(nullptr, true); + utl::TempFileNamed aTempDir(nullptr, true); aTempDir.EnableKillingFile(); const OUString aWorkDir = aTempDir.GetURL(); const OUString aURI( m_directories.getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(datasource) ); diff --git a/sw/qa/extras/mailmerge/mailmerge2.cxx b/sw/qa/extras/mailmerge/mailmerge2.cxx index af49344e52b9..cc8bf1c7be15 100644 --- a/sw/qa/extras/mailmerge/mailmerge2.cxx +++ b/sw/qa/extras/mailmerge/mailmerge2.cxx @@ -84,7 +84,7 @@ public: header(); preTest(filename); - utl::TempFile aTempDir(nullptr, true); + utl::TempFileNamed aTempDir(nullptr, true); aTempDir.EnableKillingFile(); const OUString aWorkDir = aTempDir.GetURL(); const OUString aURI( m_directories.getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(datasource) ); diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 9c723e240380..b07249cc7d77 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -901,7 +901,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo58949) * and replacement image) OLE objects using UNO, so we'll check the zip file directly. */ - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); uno::Sequence<uno::Any> aArgs{ uno::Any(aTempFile.GetURL()) }; diff --git a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx index 79dd0dc7e540..000f4a607ae5 100644 --- a/sw/qa/extras/ooxmlexport/ooxmllinks.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmllinks.cxx @@ -45,7 +45,7 @@ CPPUNIT_ASSERT(!sFileName.isEmpty()); \ \ /* Get temp path */ \ - OUString sTempDir = utl::TempFile::GetTempNameBaseDirectory(); \ + OUString sTempDir = utl::GetTempNameBaseDirectory(); \ \ /* Create & apply new URL */ \ OUString sOriginalFileInTempDir = sTempDir + sFileName; \ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index c69c88227f2f..a147f2f9a0c7 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -83,7 +83,7 @@ public: std::unique_ptr<SwTextBlocks> SwUiWriterTest::readDOCXAutotext(std::u16string_view sFileName, bool bEmpty) { - utl::TempFile tmp; + utl::TempFileNamed tmp; tmp.EnableKillingFile(); OUString rURL = tmp.GetURL(); CPPUNIT_ASSERT_EQUAL( diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index b37c18b672f5..1a7549506bf0 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -646,7 +646,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testBookmarkCollapsed) CPPUNIT_ASSERT(pDoc); // save original document - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // load only content.xml from the resaved document @@ -722,7 +722,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkText) } // save document - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // load only content.xml from the resaved document @@ -825,7 +825,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNew) } // save document - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // load only content.xml from the resaved document @@ -891,7 +891,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNewAfterReload } // save original document - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // load only content.xml from the resaved document diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 7ef3ad0df433..0159c5bf07ed 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -688,7 +688,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115013) { const OUString sColumnName("Name with spaces, \"quotes\" and \\backslashes"); - utl::TempFile aTempDir(nullptr, true); + utl::TempFileNamed aTempDir(nullptr, true); aTempDir.EnableKillingFile(); const OUString aWorkDir = aTempDir.GetURL(); @@ -1078,7 +1078,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testFontEmbedding) xmlDocUniquePtr pXmlDoc; uno::Sequence<beans::PropertyValue> aDescriptor; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); // Get document settings @@ -1301,7 +1301,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testInconsistentBookmark) // save document and verify the bookmark scoup { // save document - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // load only content.xml diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx index a24201b78b2f..816bdcd766a6 100644 --- a/sw/qa/extras/uiwriter/uiwriter7.cxx +++ b/sw/qa/extras/uiwriter/uiwriter7.cxx @@ -110,7 +110,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testExportToPicture) uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence( { { "FilterName", uno::Any(OUString("writer_png_Export")) }, { "FilterData", uno::Any(aFilterData) } })); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); bool extchk = aTempFile.IsValid(); @@ -1290,7 +1290,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf74230) createSwDoc(); //exporting the empty document to ODT via TempFile uno::Sequence<beans::PropertyValue> aDescriptor; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); CPPUNIT_ASSERT(aTempFile.IsValid()); @@ -2765,7 +2765,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf149184) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("MS Word 97")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); // Without the fix in place, the test fails with: diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx b/sw/qa/extras/uiwriter/uiwriter8.cxx index 55edd0ff6963..76262c6a0354 100644 --- a/sw/qa/extras/uiwriter/uiwriter8.cxx +++ b/sw/qa/extras/uiwriter/uiwriter8.cxx @@ -2241,7 +2241,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf128106) SwWrtShell* pWrtShell = createSwDoc(DATA_DIRECTORY, "cross_reference_demo_bmk.odt")->GetDocShell()->GetWrtShell(); - utl::TempFile tempDir(nullptr, true); + utl::TempFileNamed tempDir(nullptr, true); const auto aPropertyValues = comphelper::InitPropertySequence( { { "FileName", css::uno::Any(tempDir.GetURL() + "/test.odm") } }); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 19255e6b3751..ccf8d8ac6ae6 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -110,7 +110,7 @@ protected: const char* mpFilter; sal_uInt32 mnStartTime; - utl::TempFile maTempFile; + utl::TempFileNamed maTempFile; SvMemoryStream maMemory; ///< Underlying memory for parsed PDF files. bool mbExported; ///< Does maTempFile already contain something useful? bool mbFontNameWYSIWYG; @@ -338,7 +338,7 @@ protected: void reload(const char* pFilter, const char* filename, const char* pPassword = nullptr); /// Save the loaded document to a tempfile. Can be used to check the resulting docx/odt directly as a ZIP file. - void save(const OUString& aFilterName, utl::TempFile& rTempFile); + void save(const OUString& aFilterName, utl::TempFileNamed& rTempFile); /// Combines load() and save(). void loadAndSave(const char* pName); diff --git a/sw/qa/uibase/uiview/uiview.cxx b/sw/qa/uibase/uiview/uiview.cxx index 6b608e0ae309..9ab34e995812 100644 --- a/sw/qa/uibase/uiview/uiview.cxx +++ b/sw/qa/uibase/uiview/uiview.cxx @@ -39,7 +39,7 @@ class SwUibaseUiviewTest : public SwModelTestBase CPPUNIT_TEST_FIXTURE(SwUibaseUiviewTest, testUpdateAllObjectReplacements) { // Make a temporary copy of the test document - utl::TempFile tmp; + utl::TempFileNamed tmp; tmp.EnableKillingFile(); OUString sTempCopy = tmp.GetURL(); CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 963d1f2d49f4..a526f4901331 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -626,7 +626,7 @@ void SwModelTestBase::reload(const char* pFilter, const char* filename, const ch calcLayout(); } -void SwModelTestBase::save(const OUString& aFilterName, utl::TempFile& rTempFile) +void SwModelTestBase::save(const OUString& aFilterName, utl::TempFileNamed& rTempFile) { rTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index ea0fd1453aef..f5c716ff0301 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -240,7 +240,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, OUString sLeading(aEntry.GetBase()); aEntry.removeSegment(); OUString sPath = aEntry.GetMainURL( INetURLObject::DecodeMechanism::NONE ); - utl::TempFile aTemp(sLeading, true, sExt, &sPath); + utl::TempFileNamed aTemp(sLeading, true, sExt, &sPath); aTemp.EnableKillingFile(); DateTime aTmplDate( DateTime::SYSTEM ); @@ -315,8 +315,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, pDoc->GetNodes().GetEndOfContent().GetIndex() ) pDoc->GetNodes().Delete( aIdx ); - utl::TempFile aTempFile2(sLeading, true, sExt, &sPath); - sFileName = aTempFile2.GetURL(); + sFileName = utl::CreateTempURL(sLeading, true, sExt, &sPath); SfxMedium* pTmpMed = new SfxMedium( sFileName, StreamMode::STD_READWRITE ); pTmpMed->SetFilter( pFilter ); diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 2889ab268ff8..35d94b86f5e7 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -159,7 +159,7 @@ SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL, std::u16string_view rFilte if (rBaseURL.isEmpty()) { // Paste: set base URL to a tempfile, so images are not lost. - mpTempBaseURL.reset(new utl::TempFile()); + mpTempBaseURL.reset(new utl::TempFileNamed()); mpTempBaseURL->EnableKillingFile(); SetBaseURL(mpTempBaseURL->GetURL()); } diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index bbec1a1b424a..8dbcb9781e52 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -63,7 +63,7 @@ class SwHTMLPosFlyFrames; class SwTextFootnote; enum class HtmlPosition; enum class HtmlTokenId : sal_Int16; -namespace utl { class TempFile; } +namespace utl { class TempFileNamed; } extern SwAttrFnTab aHTMLAttrFnTab; @@ -405,7 +405,7 @@ public: bool mbSkipHeaderFooter : 1; bool mbEmbedImages : 1; /// Temporary base URL for paste of images. - std::unique_ptr<utl::TempFile> mpTempBaseURL; + std::unique_ptr<utl::TempFileNamed> mpTempBaseURL; /// If XHTML markup should be written instead of HTML. bool mbXHTML = false; /// XML namespace, in case of XHTML. diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 1d401de0bbf3..47bbcaaa0a19 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3478,12 +3478,9 @@ ErrCode WW8Export::ExportDocument_Impl() Strm().SetEndian( SvStreamEndian::LITTLE ); - utl::TempFile aTempMain; - aTempMain.EnableKillingFile(); - utl::TempFile aTempTable; - aTempTable.EnableKillingFile(); - utl::TempFile aTempData; - aTempData.EnableKillingFile(); + utl::TempFileFast aTempMain; + utl::TempFileFast aTempTable; + utl::TempFileFast aTempData; msfilter::MSCodec_Std97 aCtx; bool bEncrypt = GetWriter().InitStd97CodecUpdateMedium(aCtx); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 82dec7f3105d..7d9c80a68481 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -5571,10 +5571,9 @@ ErrCode SwWW8ImplReader::SetSubStreams(tools::SvRef<SotStorageStream> &rTableStr namespace { - SvStream* MakeTemp(std::optional<utl::TempFile>& roTempFile) + SvStream* MakeTemp(std::optional<utl::TempFileFast>& roTempFile) { roTempFile.emplace(); - roTempFile->EnableKillingFile(); return roTempFile->GetStream(StreamMode::READWRITE | StreamMode::SHARE_DENYWRITE); } @@ -5803,9 +5802,9 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) if (!nErrRet) nErrRet = SetSubStreams(xTableStream, xDataStream); - std::optional<utl::TempFile> oTempMain; - std::optional<utl::TempFile> oTempTable; - std::optional<utl::TempFile> oTempData; + std::optional<utl::TempFileFast> oTempMain; + std::optional<utl::TempFileFast> oTempTable; + std::optional<utl::TempFileFast> oTempData; SvStream* pDecryptMain = nullptr; SvStream* pDecryptTable = nullptr; SvStream* pDecryptData = nullptr; diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index 947955516c22..9cb433974baa 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -370,7 +370,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, CreateHdl_Impl, weld::Button&, void) OUString sTmpName; { OUString sHomePath(SvtPathOptions().GetWorkPath()); - utl::TempFile aTempFile(sFind, true, u".odb", &sHomePath); + utl::TempFileNamed aTempFile(sFind, true, u".odb", &sHomePath); aTempFile.EnableKillingFile(); sTmpName = aTempFile.GetURL(); } diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index 10845d1aa67a..2e01e49ec90a 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -95,9 +95,9 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage(weld::Container* pPage, SwMailMerge //creating with extension is not supported by a static method :-( OUString const sExt( comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(),'*')); - utl::TempFile aTempFile( u"", true, sExt ); - m_sExampleURL = aTempFile.GetURL(); + utl::TempFileNamed aTempFile( u"", true, sExt ); aTempFile.EnableKillingFile(); + m_sExampleURL = aTempFile.GetURL(); } SwView* pView = m_pWizard->GetSwView(); // Don't save embedded data set! It would steal it from current document. diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 9ff6315eefb0..d34f97d856c4 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -609,7 +609,7 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, SaveOutputHdl_Impl, weld::Button&, void) else { OUString sTargetTempURL = URIHelper::SmartRel2Abs( - INetURLObject(), utl::TempFile::CreateTempName(), + INetURLObject(), utl::CreateTempName(), URIHelper::GetMaybeFileHdl()); std::shared_ptr<const SfxFilter> pSfxFlt = SwIoSystem::GetFilterOfFormat( FILTER_XML, @@ -1082,7 +1082,7 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi sFilterOptions = "EmbedImages"; } OUString sTargetTempURL = URIHelper::SmartRel2Abs( - INetURLObject(), utl::TempFile::CreateTempName(), + INetURLObject(), utl::CreateTempName(), URIHelper::GetMaybeFileHdl()); std::shared_ptr<const SfxFilter> pTargetSfxFlt = SwIoSystem::GetFilterOfFormat( FILTER_XML, @@ -1134,7 +1134,7 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi //then save it SfxStringItem aName(SID_FILE_NAME, URIHelper::SmartRel2Abs( - INetURLObject(), utl::TempFile::CreateTempName(), + INetURLObject(), utl::CreateTempName(), URIHelper::GetMaybeFileHdl()) ); { diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index 703b31b3a810..5e88c4871ee9 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -76,7 +76,7 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(weld::Window * pParent, INetURLObject aTempURL(rPathArr[i]); const OUString sPath = aTempURL.GetMainURL(INetURLObject::DecodeMechanism::WithCharset ); sal_uInt32 nCaseReadonly = 0; - utl::TempFile aTempFile(&sPath); + utl::TempFileNamed aTempFile(sPath); aTempFile.EnableKillingFile(); if(!aTempFile.IsValid()) nCaseReadonly |= PATH_READONLY; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index d683185f657a..8813828b5969 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -704,7 +704,7 @@ void SwDocShell::Execute(SfxRequest& rReq) bSetModified = IsModified() || pSrcView->IsModified(); if(pSrcView->IsModified()||pSrcView->HasSourceSaved()) { - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); pSrcView->SaveContent(aTempFile.GetURL()); bDone = true; diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index ac6aa2df1e6b..2ce2dc911c9a 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -775,7 +775,7 @@ static void lcl_SaveDebugDoc( SfxObjectShell *xTargetDocShell, if( sTempDirURL.isEmpty() ) { SvtPathOptions aPathOpt; - utl::TempFile aTempDir( &aPathOpt.GetTempPath(), true ); + utl::TempFileNamed aTempDir( &aPathOpt.GetTempPath(), true ); if( aTempDir.IsValid() ) { INetURLObject aTempDirURL( aTempDir.GetURL() ); @@ -790,7 +790,7 @@ static void lcl_SaveDebugDoc( SfxObjectShell *xTargetDocShell, if (no > 0) basename += OUString::number(no) + "-"; // aTempFile is not deleted, but that seems to be intentional - utl::TempFile aTempFile( basename, true, u".odt", &sTempDirURL ); + utl::TempFileNamed aTempFile( basename, true, u".odt", &sTempDirURL ); INetURLObject aTempFileURL( aTempFile.GetURL() ); auto pDstMed = std::make_unique<SfxMedium>( aTempFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), @@ -1180,7 +1180,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, SwDoc* pTargetDoc = nullptr; SfxObjectShellRef xTargetDocShell; - std::unique_ptr< utl::TempFile > aTempFile; + std::unique_ptr< utl::TempFileNamed > aTempFile; sal_uInt16 nStartingPageNo = 0; std::shared_ptr<weld::GenericDialogController> xProgressDlg; @@ -1323,7 +1323,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, } OUString sExt(comphelper::string::stripStart(pStoreToFilter->GetDefaultExtension(), '*')); - aTempFile.reset( new utl::TempFile(sLeading, sColumnData.isEmpty(), sExt, &sPrefix, true) ); + aTempFile.reset( new utl::TempFileNamed(sLeading, sColumnData.isEmpty(), sExt, &sPrefix, true) ); if( !aTempFile->IsValid() ) { ErrorHandler::HandleError( ERRCODE_IO_NOTSUPPORTED ); @@ -2743,8 +2743,7 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference { // Cannot embed, as embedded data source would need the URL of the parent document. OUString sHomePath(SvtPathOptions().GetWorkPath()); - utl::TempFile aTempFile(sNewName, true, u".odb", pDestDir ? pDestDir : &sHomePath); - const OUString& sTmpName = aTempFile.GetURL(); + const OUString sTmpName = utl::CreateTempURL(sNewName, true, u".odb", pDestDir ? pDestDir : &sHomePath); xStore->storeAsURL(sTmpName, uno::Sequence<beans::PropertyValue>()); } else diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index cd00b2698032..496d0c8903ef 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -738,8 +738,7 @@ bool SwTransferable::WriteObject( tools::SvRef<SotTempStream>& xStream, SfxObjectShell* pEmbObj = static_cast<SfxObjectShell*>(pObject); try { - ::utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); + ::utl::TempFileFast aTempFile; SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE); uno::Reference< embed::XStorage > xWorkStore = ::comphelper::OStorageHelper::GetStorageFromStream( new utl::OStreamWrapper(*pTempStream), embed::ElementModes::READWRITE ); diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index 5e187e0431dc..e9e99377f838 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -78,7 +78,7 @@ OUString lcl_CheckFileName( const OUString& rNewFilePath, } //generate generic name - utl::TempFile aTemp(u"group", true, SwGlossaries::GetExtension(), &rNewFilePath); + utl::TempFileNamed aTemp(u"group", true, SwGlossaries::GetExtension(), &rNewFilePath); aTemp.EnableKillingFile(); INetURLObject aTempURL( aTemp.GetURL() ); diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index a143493fe384..b9f9d821826f 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -794,7 +794,7 @@ void SwSrcView::Load(SwDocShell* pDocShell) } else { - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); const OUString sFileURL( aTempFile.GetURL() ); diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index e5875417e778..83c37bc9d338 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -767,8 +767,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( FILTER_XML, SwDocShell::Factory().GetFilterContainer() ); OUString aExtension(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*')); - utl::TempFile aTempFile( u"SwMM", true, aExtension ); - m_aTmpFileName = aTempFile.GetURL(); + m_aTmpFileName = utl::CreateTempURL( u"SwMM", true, aExtension ); Reference< XStorable > xStorable( xCurModel, UNO_QUERY ); bool bStoredAsTemporary = false; diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx index d9048b39465d..ce0f7b8bc6e5 100644 --- a/test/source/bootstrapfixture.cxx +++ b/test/source/bootstrapfixture.cxx @@ -187,7 +187,7 @@ void test::BootstrapFixture::validate(const OUString& rPath, test::ValidationFor + m_directories.getPathFromSrc(u"/schema/mathml2/mathml2.xsd"); } - utl::TempFile aOutput; + utl::TempFileNamed aOutput; aOutput.EnableKillingFile(); OUString aOutputFile = aOutput.GetFileName(); OUString aCommand = aValidator + " " + rPath + " > " + aOutputFile + " 2>&1"; diff --git a/test/source/htmltesttools.cxx b/test/source/htmltesttools.cxx index d61f07bd3d1b..dedda5f98225 100644 --- a/test/source/htmltesttools.cxx +++ b/test/source/htmltesttools.cxx @@ -12,7 +12,7 @@ #include <memory> -htmlDocUniquePtr HtmlTestTools::parseHtml(utl::TempFile const & aTempFile) +htmlDocUniquePtr HtmlTestTools::parseHtml(utl::TempFileNamed const & aTempFile) { SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ); htmlDocUniquePtr doc = parseHtmlStream(&aFileStream); diff --git a/test/source/text/baseindex.cxx b/test/source/text/baseindex.cxx index 56443dd1caab..172cabb57981 100644 --- a/test/source/text/baseindex.cxx +++ b/test/source/text/baseindex.cxx @@ -100,7 +100,7 @@ void BaseIndex::testBaseIndexProperties() // BackGraphicURL is "set-only" attribute CPPUNIT_ASSERT_MESSAGE("Expected RuntimeException wasn't thrown", bOK); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); writerFileWithBitmap(aTempFile.GetURL()); diff --git a/test/source/xmltesttools.cxx b/test/source/xmltesttools.cxx index 07dc1f1f59f2..a79b039332dd 100644 --- a/test/source/xmltesttools.cxx +++ b/test/source/xmltesttools.cxx @@ -42,7 +42,7 @@ XmlTestTools::XmlTestTools() XmlTestTools::~XmlTestTools() {} -xmlDocUniquePtr XmlTestTools::parseXml(utl::TempFile const & aTempFile) +xmlDocUniquePtr XmlTestTools::parseXml(utl::TempFileNamed const & aTempFile) { SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ); return parseXmlStream(&aFileStream); diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index 594ff353895a..5a370d59ac13 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -92,7 +92,7 @@ void MacrosTest::dispatchCommand(const uno::Reference<lang::XComponent>& xCompon xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues); } -std::unique_ptr<SvStream> MacrosTest::parseExportStream(const utl::TempFile& rTempFile, +std::unique_ptr<SvStream> MacrosTest::parseExportStream(const utl::TempFileNamed& rTempFile, const OUString& rStreamName) { const OUString aUrl = rTempFile.GetURL(); diff --git a/unotools/source/ucbhelper/XTempFile.hxx b/unotools/source/ucbhelper/XTempFile.hxx index 7fcaefb7be1f..b439068d99ac 100644 --- a/unotools/source/ucbhelper/XTempFile.hxx +++ b/unotools/source/ucbhelper/XTempFile.hxx @@ -49,7 +49,7 @@ typedef ::cppu::WeakImplHelper< css::io::XTempFile class OTempFileService : public OTempFileBase { protected: - std::optional<utl::TempFile> mpTempFile; + std::optional<utl::TempFileNamed> mpTempFile; std::mutex maMutex; SvStream* mpStream; bool mbRemoveFile; diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 5ec8df4a3263..af58473b9b87 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -346,7 +346,7 @@ static OUString CreateTempName_Impl( const OUString* pParent, bool bKeep, bool b false, false); } -OUString TempFile::CreateTempName() +OUString CreateTempName() { OUString aName(CreateTempName_Impl( nullptr, false )); @@ -357,14 +357,56 @@ OUString TempFile::CreateTempName() return aTmp; } -TempFile::TempFile( const OUString* pParent, bool bDirectory ) +TempFileFast::TempFileFast( ) +{ +} + +TempFileFast::TempFileFast(TempFileFast && other) noexcept : + mxStream(std::move(other.mxStream)) +{ +} + +TempFileFast::~TempFileFast() +{ +} + +SvStream* TempFileFast::GetStream( StreamMode eMode ) +{ + if (!mxStream) + { + OUString aName = CreateTempName_Impl( /*pParent*/nullptr, /*bKeep*/true, /*bDirectory*/false ); + mxStream.reset(new SvFileStream(aName, eMode | StreamMode::TEMPORARY)); + } + return mxStream.get(); +} + +void TempFileFast::CloseStream() +{ + mxStream.reset(); +} + +OUString CreateTempURL( const OUString* pParent, bool bDirectory ) +{ + return CreateTempName_Impl( pParent, true, bDirectory ); +} + +OUString CreateTempURL( std::u16string_view rLeadingChars, bool _bStartWithZero, + std::u16string_view pExtension, const OUString* pParent, + bool bCreateParentDirs ) +{ + SequentialTokens t(_bStartWithZero); + return lcl_createName( rLeadingChars, t, pExtension, pParent, false, + true, true, bCreateParentDirs ); +} + +TempFileNamed::TempFileNamed( const OUString* pParent, bool bDirectory ) : bIsDirectory( bDirectory ) , bKillingFileEnabled( false ) { aName = CreateTempName_Impl( pParent, true, bDirectory ); } -TempFile::TempFile( std::u16string_view rLeadingChars, bool _bStartWithZero, +TempFileNamed::TempFileNamed( std::u16string_view rLeadingChars, bool _bStartWithZero, std::u16string_view pExtension, const OUString* pParent, bool bCreateParentDirs ) : bIsDirectory( false ) @@ -375,14 +417,14 @@ TempFile::TempFile( std::u16string_view rLeadingChars, bool _bStartWithZero, true, true, bCreateParentDirs ); } -TempFile::TempFile(TempFile && other) noexcept : +TempFileNamed::TempFileNamed(TempFileNamed && other) noexcept : aName(std::move(other.aName)), pStream(std::move(other.pStream)), bIsDirectory(other.bIsDirectory), bKillingFileEnabled(other.bKillingFileEnabled) { other.bKillingFileEnabled = false; } -TempFile::~TempFile() +TempFileNamed::~TempFileNamed() { if ( !bKillingFileEnabled ) return; @@ -398,19 +440,19 @@ TempFile::~TempFile() } } -bool TempFile::IsValid() const +bool TempFileNamed::IsValid() const { return !aName.isEmpty(); } -OUString TempFile::GetFileName() const +OUString TempFileNamed::GetFileName() const { OUString aTmp; FileBase::getSystemPathFromFileURL(aName, aTmp); return aTmp; } -OUString const & TempFile::GetURL() const +OUString const & TempFileNamed::GetURL() const { // if you request the URL, then you presumably want to access this via UCB, // and UCB will want to open the file via a separate file handle, which means @@ -422,7 +464,7 @@ OUString const & TempFile::GetURL() const return aName; } -SvStream* TempFile::GetStream( StreamMode eMode ) +SvStream* TempFileNamed::GetStream( StreamMode eMode ) { if (!pStream) { @@ -435,12 +477,12 @@ SvStream* TempFile::GetStream( StreamMode eMode ) return pStream.get(); } -void TempFile::CloseStream() +void TempFileNamed::CloseStream() { pStream.reset(); } -OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName ) +OUString SetTempNameBaseDirectory( const OUString &rBaseName ) { if( rBaseName.isEmpty() ) return OUString(); @@ -468,7 +510,7 @@ OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName ) OUString &rTempNameBase_Impl = gTempNameBase_Impl; rTempNameBase_Impl = rBaseName + "/"; - TempFile aBase( nullptr, true ); + TempFileNamed aBase( {}, true ); if ( aBase.IsValid() ) // use it in case of success rTempNameBase_Impl = aBase.aName; @@ -480,7 +522,7 @@ OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName ) return aTmp; } -OUString TempFile::GetTempNameBaseDirectory() +OUString GetTempNameBaseDirectory() { return ConstructTempDir_Impl(nullptr, false); } diff --git a/vcl/inc/unx/gtk/gtksalmenu.hxx b/vcl/inc/unx/gtk/gtksalmenu.hxx index ec1e123e89d2..fc8ab760f5f5 100644 --- a/vcl/inc/unx/gtk/gtksalmenu.hxx +++ b/vcl/inc/unx/gtk/gtksalmenu.hxx @@ -44,7 +44,7 @@ private: /// Even setting null icon on a menuitem can be expensive, so cache state to avoid that call bool mbHasNullItemIcon = true; GtkWidget* mpMenuBarContainerWidget; - std::unique_ptr<utl::TempFile> mxPersonaImage; + std::unique_ptr<utl::TempFileNamed> mxPersonaImage; BitmapEx maPersonaBitmap; GtkWidget* mpMenuAllowShrinkWidget; GtkWidget* mpMenuBarWidget; diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx index d8875666431e..90164c7e317c 100644 --- a/vcl/qa/cppunit/GraphicTest.cxx +++ b/vcl/qa/cppunit/GraphicTest.cxx @@ -405,7 +405,7 @@ void GraphicTest::testWMFRoundtrip() Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream); // Save as WMF. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); sal_uInt16 nFormat = rGraphicFilter.GetExportFormatNumberForShortName(u"WMF"); SvStream& rOutStream = *aTempFile.GetStream(StreamMode::READWRITE); @@ -467,8 +467,7 @@ void GraphicTest::testWMFWithEmfPlusRoundtrip() for (bool useConvertMetafile : { false, true }) { // Save as WMF. - utl::TempFile aTempFile; - aTempFile.EnableKillingFile(); + utl::TempFileNamed aTempFile; SvStream& rOutStream = *aTempFile.GetStream(StreamMode::READWRITE); if (useConvertMetafile) ConvertGraphicToWMF(aGraphic, rOutStream, nullptr); diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx index fa8b7374c5d6..12a992bc037d 100644 --- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx +++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx @@ -78,7 +78,7 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, testPDFAddVisibleSignatureLastPage) if (!IsDefaultDPI()) return; // Given: copy the test document to a temporary file, as it'll be modified. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OUString aSourceURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "add-visible-signature-last-page.pdf"; diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 1b6036abfee8..faf87842d8cf 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -65,7 +65,7 @@ class PdfExportTest : public test::BootstrapFixture, public unotest::MacrosTest { protected: uno::Reference<lang::XComponent> mxComponent; - utl::TempFile maTempFile; + utl::TempFileNamed maTempFile; SvMemoryStream maMemory; utl::MediaDescriptor aMediaDescriptor; std::unique_ptr<vcl::pdf::PDFiumDocument> parseExport(const OString& rPassword = OString()); @@ -3415,48 +3415,47 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testURIs) OUString in; OString out; bool relativeFsys; - } URIs[] - = { { - "http://example.com/", - "http://example.com/", - true, - }, - { - "file://localfile.odt/", - "file://localfile.odt/", - true, - }, - { - // tdf 143216 - "http://username:password@example.com", - "http://username:password@example.com", - true, - }, - { - "git://git.example.org/project/example", - "git://git.example.org/project/example", - true, - }, - { - // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' - "filebypath.odt", - "filebypath.pdf", - true, - }, - { - // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' - // but this time with ExportLinksRelativeFsys off the path is added - "filebypath.odt", - OUStringToOString(utl::TempFile::GetTempNameBaseDirectory(), RTL_TEXTENCODING_UTF8) - + "filebypath.pdf", - false, - }, - { - // This also gets made relative due to 'ExportLinksRelativeFsys' - utl::TempFile::GetTempNameBaseDirectory() + "fileintempdir.odt", - "fileintempdir.pdf", - true, - } }; + } URIs[] = { { + "http://example.com/", + "http://example.com/", + true, + }, + { + "file://localfile.odt/", + "file://localfile.odt/", + true, + }, + { + // tdf 143216 + "http://username:password@example.com", + "http://username:password@example.com", + true, + }, + { + "git://git.example.org/project/example", + "git://git.example.org/project/example", + true, + }, + { + // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' + "filebypath.odt", + "filebypath.pdf", + true, + }, + { + // The odt/pdf gets substituted due to 'ConvertOOoTargetToPDFTarget' + // but this time with ExportLinksRelativeFsys off the path is added + "filebypath.odt", + OUStringToOString(utl::GetTempNameBaseDirectory(), RTL_TEXTENCODING_UTF8) + + "filebypath.pdf", + false, + }, + { + // This also gets made relative due to 'ExportLinksRelativeFsys' + utl::GetTempNameBaseDirectory() + "fileintempdir.odt", + "fileintempdir.pdf", + true, + } }; // Create an empty document. // Note: The test harness gets very upset if we try and create multiple diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx index a3ae29216d7e..791967da8e86 100644 --- a/vcl/qa/cppunit/png/PngFilterTest.cxx +++ b/vcl/qa/cppunit/png/PngFilterTest.cxx @@ -1730,7 +1730,7 @@ void PngFilterTest::testMsGifInPng() aFilterProperty.Value <<= aAdditionalChunkSequence; uno::Sequence<beans::PropertyValue> aPNGParameters{ aFilterProperty }; // Export the png with the chunk - utl::TempFile aTempFile(u"testPngExportMsGif", true, u".png"); + utl::TempFileNamed aTempFile(u"testPngExportMsGif", true, u".png"); if (!bKeepTemp) aTempFile.EnableKillingFile(); { @@ -1758,7 +1758,7 @@ void PngFilterTest::testMsGifInPng() void PngFilterTest::testPngRoundtrip8BitGrey() { - utl::TempFile aTempFile(u"testPngRoundtrip8BitGrey"); + utl::TempFileNamed aTempFile(u"testPngRoundtrip8BitGrey"); if (!bKeepTemp) aTempFile.EnableKillingFile(); { @@ -1806,7 +1806,7 @@ void PngFilterTest::testPngRoundtrip8BitGrey() void PngFilterTest::testPngRoundtrip24() { - utl::TempFile aTempFile(u"testPngRoundtrip24"); + utl::TempFileNamed aTempFile(u"testPngRoundtrip24"); if (!bKeepTemp) aTempFile.EnableKillingFile(); { @@ -1854,7 +1854,7 @@ void PngFilterTest::testPngRoundtrip24() void PngFilterTest::testPngRoundtrip24_8() { - utl::TempFile aTempFile(u"testPngRoundtrip24_8"); + utl::TempFileNamed aTempFile(u"testPngRoundtrip24_8"); if (!bKeepTemp) aTempFile.EnableKillingFile(); { diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 2f4f17d7beb4..abc4414c1566 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -280,7 +280,7 @@ void SvmTest::checkRendering(ScopedVclPtrInstance<VirtualDevice> const & pVirtua if (bWriteCompareBitmap) { - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); { diff --git a/vcl/source/filter/ieps/ieps.cxx b/vcl/source/filter/ieps/ieps.cxx index cf6565abb030..57462ccd4dc8 100644 --- a/vcl/source/filter/ieps/ieps.cxx +++ b/vcl/source/filter/ieps/ieps.cxx @@ -197,8 +197,8 @@ static oslProcessError runProcessWithPathSearch(const OUString &rProgName, static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &rGraphic) { - utl::TempFile aTempOutput; - utl::TempFile aTempInput; + utl::TempFileNamed aTempOutput; + utl::TempFileNamed aTempInput; aTempOutput.EnableKillingFile(); aTempInput.EnableKillingFile(); OUString output; diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 80a355423c6b..441838e01c8e 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -1931,7 +1931,7 @@ bool CreateCFFfontSubset(const unsigned char* pFontBytes, int nByteLength, const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding, int nGlyphCount, FontSubsetInfo& rInfo) { - utl::TempFile aTempFile; + utl::TempFileFast aTempFile; SvStream* pStream = aTempFile.GetStream(StreamMode::READWRITE); rInfo.LoadFont(FontType::CFF_FONT, pFontBytes, nByteLength); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 31980b1d1beb..ca63d8645063 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1321,8 +1321,7 @@ bool ImpGraphic::swapOut() else { // Create a temp filename for the swap file - utl::TempFile aTempFile; - const INetURLObject aTempFileURL(aTempFile.GetURL()); + const INetURLObject aTempFileURL(utl::CreateTempURL()); // Create a swap file auto pSwapFile = o3tl::make_shared<ImpSwapFile>(aTempFileURL, getOriginURL()); diff --git a/vcl/unx/generic/print/glyphset.cxx b/vcl/unx/generic/print/glyphset.cxx index 201ccb0fec33..ffba77d2c3f9 100644 --- a/vcl/unx/generic/print/glyphset.cxx +++ b/vcl/unx/generic/print/glyphset.cxx @@ -239,7 +239,7 @@ GlyphSet::PSUploadFont (osl::File& rOutFile, PrinterGfx &rGfx, bool bAllowType42 if (nSuccess != SFErrCodes::Ok) return; - utl::TempFile aTmpFile; + utl::TempFileFast aTmpFile; SvStream* pTmpFile = aTmpFile.GetStream(StreamMode::READWRITE); // encoding vector maps character encoding to the ordinal number diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 155974cdbd95..f37164de7400 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -9623,7 +9623,7 @@ class WidgetBackground private: GtkWidget* m_pWidget; GtkCssProvider* m_pCustomCssProvider; - std::unique_ptr<utl::TempFile> m_xCustomImage; + std::unique_ptr<utl::TempFileNamed> m_xCustomImage; public: // See: https://developer.gnome.org/Buttons/ @@ -9642,7 +9642,7 @@ public: if (!pDevice) return; - m_xCustomImage.reset(new utl::TempFile); + m_xCustomImage.reset(new utl::TempFileNamed); m_xCustomImage->EnableKillingFile(true); cairo_surface_t* surface = get_underlying_cairo_surface(*pDevice); diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index ca515f51eb9e..bb4048485db9 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -1072,7 +1072,7 @@ void GtkSalMenu::ApplyPersona() { if (maPersonaBitmap != rPersonaBitmap) { - mxPersonaImage.reset(new utl::TempFile); + mxPersonaImage.reset(new utl::TempFileNamed); mxPersonaImage->EnableKillingFile(true); SvStream* pStream = mxPersonaImage->GetStream(StreamMode::WRITE); vcl::PngImageWriter aPNGWriter(*pStream); diff --git a/writerperfect/qa/unit/EPUBExportTest.cxx b/writerperfect/qa/unit/EPUBExportTest.cxx index 71bf41130a9c..1536e2b449f5 100644 --- a/writerperfect/qa/unit/EPUBExportTest.cxx +++ b/writerperfect/qa/unit/EPUBExportTest.cxx @@ -44,7 +44,7 @@ class EPUBExportTest : public test::BootstrapFixture, { protected: uno::Reference<lang::XComponent> mxComponent; - utl::TempFile maTempFile; + utl::TempFileNamed maTempFile; xmlDocUniquePtr mpXmlDoc; uno::Reference<packages::zip::XZipFileAccess2> mxZipFile; OUString maFilterOptions; diff --git a/xmloff/qa/unit/draw.cxx b/xmloff/qa/unit/draw.cxx index 6aab4c12a46f..7fd1679effab 100644 --- a/xmloff/qa/unit/draw.cxx +++ b/xmloff/qa/unit/draw.cxx @@ -53,7 +53,7 @@ public: void tearDown() override; void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override; uno::Reference<lang::XComponent>& getComponent() { return mxComponent; } - void save(const OUString& rFilterName, utl::TempFile& rTempFile); + void save(const OUString& rFilterName, utl::TempFileNamed& rTempFile); uno::Reference<drawing::XShape> getShape(sal_uInt8 nShapeIndex); }; @@ -77,7 +77,7 @@ void XmloffDrawTest::registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) XmlTestTools::registerODFNamespaces(pXmlXpathCtx); } -void XmloffDrawTest::save(const OUString& rFilterName, utl::TempFile& rTempFile) +void XmloffDrawTest::save(const OUString& rFilterName, utl::TempFileNamed& rTempFile) { uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -104,7 +104,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextBoxLoss) OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "textbox-loss.docx"; getComponent() = loadFromDesktop(aURL); uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("writer8"); @@ -131,7 +131,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTdf141301_Extrusion_Angle) getComponent() = loadFromDesktop(aURL, "com.sun.star.comp.drawing.DrawingDocument"); // Prepare use of XPath - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("draw8", aTempFile); uno::Reference<packages::zip::XZipFileAccess2> xNameAccess = packages::zip::ZipFileAccess::createWithURL(mxComponentContext, aTempFile.GetURL()); @@ -163,7 +163,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testThemeExport) xMasterPage->setPropertyValue("Theme", aTheme); // Export to ODP: - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("impress8", aTempFile); // Check if the 12 colors are written in the XML: @@ -205,7 +205,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testVideoSnapshot) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1356), rCrop.Right); // Execute ODP export: - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("impress8", aTempFile); std::unique_ptr<SvStream> pStream = parseExportStream(aTempFile, "content.xml"); @@ -254,7 +254,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testReferToTheme) // When loading and saving that document: getComponent() = loadFromDesktop(aURL); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("impress8", aTempFile); // Make sure the export result has the theme reference: @@ -372,7 +372,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeExtended) lcl_assertMetalProperties("from doc", xShape); // Test, that new attribute is written with loext namespace. Adapt when attribute is added to ODF. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // assert XML. @@ -401,7 +401,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionMetalTypeStrict) // added to ODF. const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // assert XML. @@ -444,7 +444,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularityExtended) // Test, that attribute is written in draw namespace with value 100% and in loext namespace with // value 122.0703125%. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // assert XML. @@ -473,7 +473,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testExtrusionSpecularity) // Save to ODF 1.3 strict and make sure it does not produce a validation error. const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion(GetODFDefaultVersion()); SetODFDefaultVersion(SvtSaveOptions::ODFVER_013); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); SetODFDefaultVersion(nCurrentODFVersion); @@ -576,7 +576,7 @@ CPPUNIT_TEST_FIXTURE(XmloffDrawTest, testTextRotationPlusPre) // Save to ODF. Without the fix, a file format error was produced, because attribute // draw:text-rotate-angle was written twice, one from TextPreRotateAngle and the other from // TextRotateAngle. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; // This should already catch the format error, but does not, see tdf#149567 save("impress8", aTempFile); // But reload catches it. diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx index c01f188c762d..7c9053df6b6b 100644 --- a/xmloff/qa/unit/style.cxx +++ b/xmloff/qa/unit/style.cxx @@ -48,7 +48,7 @@ public: void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override; uno::Reference<lang::XComponent>& getComponent() { return mxComponent; } void load(std::u16string_view rURL); - void save(const OUString& rFilterName, utl::TempFile& rTempFile); + void save(const OUString& rFilterName, utl::TempFileNamed& rTempFile); }; void XmloffStyleTest::setUp() @@ -77,7 +77,7 @@ void XmloffStyleTest::load(std::u16string_view rFileName) mxComponent = loadFromDesktop(aURL); } -void XmloffStyleTest::save(const OUString& rFilterName, utl::TempFile& rTempFile) +void XmloffStyleTest::save(const OUString& rFilterName, utl::TempFileNamed& rTempFile) { uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -126,7 +126,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFontSorting) // When saving that document to ODT: uno::Reference<frame::XStorable> xStorable(getComponent(), uno::UNO_QUERY); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, @@ -234,7 +234,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // With applied fix for tdf150407 still loext:writing-mode="bt-lr" has to be written. @@ -254,7 +254,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testWritingModeBTLR) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // Without the fix an faulty 'writing-mode="bt-lr"' attribute was written in productive build. @@ -291,7 +291,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // With applied fix for tdf150407 still loext:vertical-rel="page-content-bottom" has to be @@ -314,7 +314,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelBottomMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // Without the fix an faulty 'vertical-rel="page-content-bottom"' attribute was written in @@ -351,7 +351,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(3, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // With applied fix for tdf150407 still loext:vertical-rel="page-content-top has to be @@ -374,7 +374,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPosRelTopMargin) comphelper::ConfigurationChanges::create()); officecfg::Office::Common::Save::ODF::DefaultVersion::set(10, pBatch); pBatch->commit(); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; save("writer8", aTempFile); // Without the fix an faulty 'vertical-rel="page-content-top"' attribute was written in diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx index 72b0e49ecbd0..ee5e4a580ebb 100644 --- a/xmloff/qa/unit/text.cxx +++ b/xmloff/qa/unit/text.cxx @@ -96,7 +96,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCommentResolved) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); getComponent()->dispose(); @@ -143,7 +143,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBibliographyLocalUrl) uno::Sequence<beans::PropertyValue> aStoreProps = { comphelper::makePropertyValue("FilterName", OUString("writer8")), }; - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); // Without the accompanying fix in place, this test would have resulted in an assertion failure, // as LocalURL was mapped to XML_TOKEN_INVALID. @@ -204,7 +204,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testParaStyleListLevel) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); @@ -258,7 +258,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testListId) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); @@ -292,7 +292,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testClearingBreakExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -371,7 +371,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); @@ -408,7 +408,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testScaleWidthAndHeight) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); @@ -444,7 +444,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -517,7 +517,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testCheckboxContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -614,7 +614,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -709,7 +709,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPictureContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -778,7 +778,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDateContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -855,7 +855,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -921,7 +921,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testComboBoxContentControlExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); xStorable->storeToURL(aTempFile.GetURL(), aStoreProps); validate(aTempFile.GetFileName(), test::ODF); @@ -977,7 +977,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testDropdownContentControlAutostyleExport) uno::Sequence<beans::PropertyValue> aStoreProps = comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) }, }); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); // Without the accompanying fix in place, this test would have failed, we had duplicated XML // attributes. diff --git a/xmlscript/qa/cppunit/test.cxx b/xmlscript/qa/cppunit/test.cxx index aa8bd934ea14..92c543e36f6d 100644 --- a/xmlscript/qa/cppunit/test.cxx +++ b/xmlscript/qa/cppunit/test.cxx @@ -138,7 +138,7 @@ void XmlScriptTest::testBasicElements() CPPUNIT_ASSERT(xModel.is()); // Export - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); exportToFile(aTempFile.GetURL(), xModel); @@ -196,7 +196,7 @@ void XmlScriptTest::testEmptyPopupItems() CPPUNIT_ASSERT(xModel.is()); // Export - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); exportToFile(aTempFile.GetURL(), xModel); diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 19dc3821288d..c4de66d57af9 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -171,7 +171,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDescription) // Create an empty document and store it to a tempfile, finally load it as a storage. createDoc(""); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -208,7 +208,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSA) // Create an empty document and store it to a tempfile, finally load it as a storage. createDoc(""); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -247,7 +247,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAOOXML) // Create an empty document and store it to a tempfile, finally load it as a storage. createDoc(""); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -288,7 +288,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testECDSAPDF) // a stream. createDoc(""); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -333,7 +333,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLDescription) // Create an empty document and store it to a tempfile, finally load it as a storage. createDoc(""); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -369,7 +369,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLDescription) CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLAppend) { // Copy the test document to a temporary file, as it'll be modified. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OUString aURL = aTempFile.GetURL(); CPPUNIT_ASSERT_EQUAL( @@ -408,7 +408,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemove) // Load the test document as a storage and read its signatures: purpose1 and purpose2. DocumentSignatureManager aManager(mxComponentContext, DocumentSignatureMode::Content); CPPUNIT_ASSERT(aManager.init()); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OUString aURL = aTempFile.GetURL(); CPPUNIT_ASSERT_EQUAL( @@ -441,7 +441,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemove) CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLRemoveAll) { // Copy the test document to a temporary file, as it'll be modified. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OUString aURL = aTempFile.GetURL(); CPPUNIT_ASSERT_EQUAL( @@ -799,7 +799,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPDFAddVisibleSignature) if (!IsDefaultDPI()) return; // Given: copy the test document to a temporary file, as it'll be modified. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OUString aSourceURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "add-visible-signature.pdf"; OUString aURL = aTempFile.GetURL(); @@ -876,7 +876,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Calc) uno::Reference<frame::XStorable> xDocStorable(mxComponent, uno::UNO_QUERY_THROW); // Save a copy - utl::TempFile aTempFileSaveCopy; + utl::TempFileNamed aTempFileSaveCopy; aTempFileSaveCopy.EnableKillingFile(); uno::Sequence<beans::PropertyValue> descSaveACopy(comphelper::InitPropertySequence( { { "SaveACopy", uno::Any(true) }, { "FilterName", uno::Any(OUString("calc8")) } })); @@ -885,7 +885,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Calc) try { // Save As - utl::TempFile aTempFileSaveAs; + utl::TempFileNamed aTempFileSaveAs; aTempFileSaveAs.EnableKillingFile(); uno::Sequence<beans::PropertyValue> descSaveAs( comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("calc8")) } })); @@ -913,7 +913,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Doc) uno::Reference<frame::XStorable> xDocStorable(mxComponent, uno::UNO_QUERY_THROW); // Save a copy - utl::TempFile aTempFileSaveCopy; + utl::TempFileNamed aTempFileSaveCopy; aTempFileSaveCopy.EnableKillingFile(); uno::Sequence<beans::PropertyValue> descSaveACopy(comphelper::InitPropertySequence( { { "SaveACopy", uno::Any(true) }, { "FilterName", uno::Any(OUString("writer8")) } })); @@ -922,7 +922,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Doc) try { // Save As - utl::TempFile aTempFileSaveAs; + utl::TempFileNamed aTempFileSaveAs; aTempFileSaveAs.EnableKillingFile(); uno::Sequence<beans::PropertyValue> descSaveAs( comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) } })); @@ -937,7 +937,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, test96097Doc) CPPUNIT_TEST_FIXTURE(SigningTest, testXAdESNotype) { // Create a working copy. - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); OUString aURL = aTempFile.GetURL(); CPPUNIT_ASSERT_EQUAL( @@ -999,7 +999,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testXAdES) // Create an empty document, store it to a tempfile and load it as a storage. createDoc(OUString()); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -1057,7 +1057,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_ODT) { createDoc(""); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -1136,7 +1136,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testSigningMultipleTimes_OOXML) { createDoc(""); - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; aTempFile.EnableKillingFile(); uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); utl::MediaDescriptor aMediaDescriptor; @@ -1346,7 +1346,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testODFEncryptedGPG) CPPUNIT_ASSERT(pObjectShell); // export and import again - utl::TempFile aTempFile; + utl::TempFileNamed aTempFile; { uno::Sequence<beans::PropertyValue> props( comphelper::InitPropertySequence({ { "FilterName", uno::Any(OUString("writer8")) } })); @@ -1419,7 +1419,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) SignatureState::OK, ODFVER_012_TEXT); // save as new ODT document - utl::TempFile aTempFileSaveAsODT; + utl::TempFileNamed aTempFileSaveAsODT; aTempFileSaveAsODT.EnableKillingFile(); try { @@ -1434,7 +1434,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) } // save as new OTT template - utl::TempFile aTempFileSaveAsOTT; + utl::TempFileNamed aTempFileSaveAsOTT; aTempFileSaveAsOTT.EnableKillingFile(); try { @@ -1466,7 +1466,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature12_ODF) SignatureState::OK, ODFVER_013_TEXT); // save as new OTT template - utl::TempFile aTempFileSaveAsODT_OTT; + utl::TempFileNamed aTempFileSaveAsODT_OTT; aTempFileSaveAsODT_OTT.EnableKillingFile(); try { @@ -1516,7 +1516,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) SignatureState::NOTVALIDATED, OUString()); // save as new ODT document - utl::TempFile aTempFileSaveAs; + utl::TempFileNamed aTempFileSaveAs; aTempFileSaveAs.EnableKillingFile(); try { @@ -1547,7 +1547,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) SignatureState::NOTVALIDATED, OUString()); // save as new OTT template - utl::TempFile aTempFileSaveAsOTT; + utl::TempFileNamed aTempFileSaveAsOTT; aTempFileSaveAsOTT.EnableKillingFile(); try { @@ -1609,7 +1609,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) SignatureState::NOTVALIDATED, OUString()); // save as new ODT document - utl::TempFile aTempFileSaveAsODT; + utl::TempFileNamed aTempFileSaveAsODT; aTempFileSaveAsODT.EnableKillingFile(); try { @@ -1624,7 +1624,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) } // save as new OTT template - utl::TempFile aTempFileSaveAsOTT; + utl::TempFileNamed aTempFileSaveAsOTT; aTempFileSaveAsOTT.EnableKillingFile(); try { @@ -1656,7 +1656,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) SignatureState::NOTVALIDATED, OUString()); // save as new OTT template - utl::TempFile aTempFileSaveAsODT_OTT; + utl::TempFileNamed aTempFileSaveAsODT_OTT; aTempFileSaveAsODT_OTT.EnableKillingFile(); try { diff --git a/xmlsecurity/qa/unit/signing/signing2.cxx b/xmlsecurity/qa/unit/signing/signing2.cxx index a436711ca02d..b569891d1a3e 100644 --- a/xmlsecurity/qa/unit/signing/signing2.cxx +++ b/xmlsecurity/qa/unit/signing/signing2.cxx @@ -83,7 +83,7 @@ CPPUNIT_TEST_FIXTURE(SigningTest2, testPreserveMacroSignatureODB) mxComponent = loadFromDesktop(aURL, "com.sun.star.sdb.OfficeDatabaseDocument"); // save as ODB - utl::TempFile aTempFileSaveAsODB; + utl::TempFileNamed aTempFileSaveAsODB; aTempFileSaveAsODB.EnableKillingFile(); try { diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx index 1302b0242d53..e26f72cd0e6a 100644 --- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx +++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx @@ -71,24 +71,24 @@ namespace class InitNSSPrivate { private: - std::unique_ptr<utl::TempFile> m_pTempFileDatabaseDirectory; + std::optional<utl::TempFileNamed> m_oTempFileDatabaseDirectory; public: OUString getTempDatabasePath() { - if (!m_pTempFileDatabaseDirectory) + if (!m_oTempFileDatabaseDirectory) { - m_pTempFileDatabaseDirectory.reset(new utl::TempFile(nullptr, true)); - m_pTempFileDatabaseDirectory->EnableKillingFile(); + m_oTempFileDatabaseDirectory.emplace(nullptr, true); + m_oTempFileDatabaseDirectory->EnableKillingFile(); } - return m_pTempFileDatabaseDirectory->GetFileName(); + return m_oTempFileDatabaseDirectory->GetFileName(); } void reset() { - if (m_pTempFileDatabaseDirectory) + if (m_oTempFileDatabaseDirectory) { - m_pTempFileDatabaseDirectory.reset(); + m_oTempFileDatabaseDirectory.reset(); } } }; |