chart2/qa/extras/charttest.hxx | 14 +- connectivity/source/drivers/dbase/DTable.cxx | 6 connectivity/source/drivers/firebird/Connection.cxx | 2 connectivity/source/drivers/firebird/Connection.hxx | 2 connectivity/source/drivers/firebird/Driver.hxx | 4 dbaccess/qa/unit/dbtest_base.cxx | 6 dbaccess/qa/unit/embeddeddb_performancetest.cxx | 2 dbaccess/qa/unit/hsql_binary_import.cxx | 2 dbaccess/qa/unit/tdf119625.cxx | 2 dbaccess/qa/unit/tdf126268.cxx | 2 dbaccess/source/core/dataaccess/ModelImpl.cxx | 2 dbaccess/source/ui/misc/TableCopyHelper.cxx | 2 desktop/qa/desktop_lib/test_desktop_lib.cxx | 16 +- desktop/source/app/appinit.cxx | 4 desktop/source/app/dispatchwatcher.cxx | 4 desktop/source/app/updater.cxx | 4 desktop/source/deployment/manager/dp_manager.cxx | 4 desktop/source/deployment/registry/dp_backend.cxx | 4 desktop/source/lib/init.cxx | 2 desktop/source/pkgchk/unopkg/unopkg_app.cxx | 4 embeddedobj/qa/cppunit/msole.cxx | 2 extensions/source/scanner/sane.cxx | 2 filter/source/msfilter/svdfppt.cxx | 4 filter/source/pdf/pdffilter.cxx | 2 filter/source/svg/svgexport.cxx | 3 filter/source/xsltdialog/xmlfilterjar.cxx | 3 filter/source/xsltdialog/xmlfiltertestdialog.cxx | 4 framework/source/services/autorecovery.cxx | 4 hwpfilter/source/htags.cxx | 2 include/test/htmltesttools.hxx | 2 include/test/xmltesttools.hxx | 2 include/unotest/macros_test.hxx | 4 include/unotools/tempfile.hxx | 108 +++++++++++----- oox/qa/unit/drawingml.cxx | 4 oox/qa/unit/export.cxx | 4 package/source/xstor/owriteablestream.cxx | 2 package/source/xstor/owriteablestream.hxx | 2 package/source/xstor/selfterminatefilestream.cxx | 2 package/source/xstor/selfterminatefilestream.hxx | 4 reportdesign/source/core/api/ReportEngineJFree.cxx | 6 sc/qa/extras/htmlexporttest.cxx | 6 sc/qa/extras/macros-test.cxx | 4 sc/qa/extras/scddelinkobj.cxx | 6 sc/qa/extras/scpdfexport.cxx | 49 +++---- sc/qa/unit/SparklineImportExportTest.cxx | 6 sc/qa/unit/helper/qahelper.cxx | 14 +- sc/qa/unit/helper/qahelper.hxx | 12 - sc/qa/unit/helper/xpath.cxx | 6 sc/qa/unit/helper/xpath.hxx | 4 sc/qa/unit/jumbosheets-test.cxx | 4 sc/qa/unit/pivottable_filters_test.cxx | 39 ++++-- sc/qa/unit/scshapetest.cxx | 2 sc/qa/unit/subsequent_export_test.cxx | 102 +++++++++------ sc/qa/unit/subsequent_export_test2.cxx | 118 +++++++++++------- sc/qa/unit/tiledrendering/tiledrendering.cxx | 4 sc/qa/unit/uicalc/uicalc.cxx | 20 +-- sc/source/filter/excel/xeescher.cxx | 1 sc/source/filter/inc/xcl97esc.hxx | 2 sc/source/filter/inc/xeescher.hxx | 2 sc/source/filter/xcl97/xcl97esc.cxx | 3 sc/source/ui/app/drwtrans.cxx | 6 sc/source/ui/app/transobj.cxx | 3 sc/source/ui/docshell/docsh.cxx | 4 sd/qa/filter/eppt/eppt.cxx | 6 sd/qa/unit/HtmlExportTest.cxx | 2 sd/qa/unit/PNGExportTests.cxx | 16 +- sd/qa/unit/SVGExportTests.cxx | 2 sd/qa/unit/SdrPdfImportTest.cxx | 2 sd/qa/unit/ShapeImportExportTest.cxx | 2 sd/qa/unit/export-tests-ooxml1.cxx | 78 ++++++------ sd/qa/unit/export-tests-ooxml2.cxx | 92 +++++++------- sd/qa/unit/export-tests-ooxml3.cxx | 130 ++++++++++---------- sd/qa/unit/export-tests.cxx | 54 ++++---- sd/qa/unit/misc-tests.cxx | 12 - sd/qa/unit/sdmodeltestbase.hxx | 12 - sd/qa/unit/uiimpress.cxx | 7 - sd/source/ui/app/sdxfer.cxx | 3 sfx2/qa/cppunit/test_misc.cxx | 6 sfx2/source/appl/flatpak.cxx | 5 sfx2/source/appl/sfxhelp.cxx | 2 sfx2/source/appl/xpackcreator.cxx | 2 sfx2/source/dialog/mailmodel.cxx | 4 sfx2/source/doc/docfile.cxx | 17 +- sfx2/source/doc/graphhelp.cxx | 2 sfx2/source/doc/objstor.cxx | 2 sfx2/source/doc/printhelper.cxx | 10 - sfx2/source/doc/sfxbasemodel.cxx | 2 sfx2/source/view/viewsh.cxx | 3 shell/source/win32/simplemail/smplmailclient.cxx | 2 shell/source/win32/simplemail/smplmailclient.hxx | 2 sot/source/sdstor/stg.cxx | 2 sot/source/sdstor/stgstrms.cxx | 2 sot/source/sdstor/ucbstorage.cxx | 12 - starmath/qa/extras/mmlexport-test.cxx | 2 svl/source/fsstor/fsfactory.cxx | 3 svtools/source/misc/embedtransfer.cxx | 3 svx/qa/unit/XTableImportExportTest.cxx | 2 svx/qa/unit/core.cxx | 2 svx/qa/unit/customshapes.cxx | 10 - svx/qa/unit/gallery/test_gallery.cxx | 40 +++--- svx/qa/unit/unodraw.cxx | 2 svx/qa/unit/xoutdev.cxx | 4 svx/source/gallery2/gallerybinaryengine.cxx | 2 svx/source/xml/xmleohlp.cxx | 3 svx/source/xml/xmlgrhlp.cxx | 8 - sw/qa/core/draw/draw.cxx | 2 sw/qa/core/filters-test.cxx | 2 sw/qa/core/filters-test2.cxx | 2 sw/qa/core/macros-test.cxx | 4 sw/qa/core/uwriter.cxx | 2 sw/qa/extras/globalfilter/globalfilter.cxx | 42 +++--- sw/qa/extras/htmlexport/htmlexport.cxx | 2 sw/qa/extras/layout/layout.cxx | 8 - sw/qa/extras/layout/layout2.cxx | 4 sw/qa/extras/mailmerge/mailmerge.cxx | 2 sw/qa/extras/mailmerge/mailmerge2.cxx | 2 sw/qa/extras/odfexport/odfexport.cxx | 2 sw/qa/extras/ooxmlexport/ooxmllinks.cxx | 2 sw/qa/extras/uiwriter/uiwriter.cxx | 2 sw/qa/extras/uiwriter/uiwriter4.cxx | 8 - sw/qa/extras/uiwriter/uiwriter6.cxx | 6 sw/qa/extras/uiwriter/uiwriter7.cxx | 6 sw/qa/extras/uiwriter/uiwriter8.cxx | 2 sw/qa/inc/swmodeltestbase.hxx | 4 sw/qa/uibase/uiview/uiview.cxx | 2 sw/qa/unit/swmodeltestbase.cxx | 2 sw/source/core/doc/docglbl.cxx | 5 sw/source/filter/html/wrthtml.cxx | 2 sw/source/filter/html/wrthtml.hxx | 4 sw/source/filter/ww8/wrtww8.cxx | 9 - sw/source/filter/ww8/ww8par.cxx | 9 - sw/source/ui/dbui/addresslistdialog.cxx | 2 sw/source/ui/dbui/mmlayoutpage.cxx | 4 sw/source/ui/dbui/mmresultdialogs.cxx | 6 sw/source/ui/misc/glosbib.cxx | 2 sw/source/uibase/app/docsh2.cxx | 2 sw/source/uibase/dbui/dbmgr.cxx | 11 - sw/source/uibase/dochdl/swdtflvr.cxx | 3 sw/source/uibase/misc/glosdoc.cxx | 2 sw/source/uibase/uiview/srcview.cxx | 2 sw/source/uibase/uno/unomailmerge.cxx | 3 test/source/bootstrapfixture.cxx | 2 test/source/htmltesttools.cxx | 2 test/source/text/baseindex.cxx | 2 test/source/xmltesttools.cxx | 2 unotest/source/cpp/macros_test.cxx | 2 unotools/source/ucbhelper/XTempFile.hxx | 2 unotools/source/ucbhelper/tempfile.cxx | 68 ++++++++-- vcl/inc/unx/gtk/gtksalmenu.hxx | 2 vcl/qa/cppunit/GraphicTest.cxx | 5 vcl/qa/cppunit/filter/ipdf/ipdf.cxx | 2 vcl/qa/cppunit/pdfexport/pdfexport.cxx | 85 ++++++------- vcl/qa/cppunit/png/PngFilterTest.cxx | 8 - vcl/qa/cppunit/svm/svmtest.cxx | 2 vcl/source/filter/ieps/ieps.cxx | 4 vcl/source/fontsubset/sft.cxx | 2 vcl/source/gdi/impgraph.cxx | 3 vcl/unx/generic/print/glyphset.cxx | 2 vcl/unx/gtk3/gtkinst.cxx | 4 vcl/unx/gtk3/gtksalmenu.cxx | 2 writerperfect/qa/unit/EPUBExportTest.cxx | 2 xmloff/qa/unit/draw.cxx | 24 +-- xmloff/qa/unit/style.cxx | 18 +- xmloff/qa/unit/text.cxx | 30 ++-- xmlscript/qa/cppunit/test.cxx | 4 xmlsecurity/qa/unit/signing/signing.cxx | 52 ++++---- xmlsecurity/qa/unit/signing/signing2.cxx | 2 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx | 14 +- 168 files changed, 942 insertions(+), 824 deletions(-)
New commits: commit 4b95451f859bac8e05956ce12df17f1ee410032d Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed Sep 21 20:54:00 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Sep 29 09:11:18 2022 +0200 split utl::TempFile into fast and named variants which makes it easier to know what each variant requires to stay on it's happy path Change-Id: I3275a2543573367714bc78092e882f6535507285 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140469 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> 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() { ... etc. - the rest is truncated