[Libreoffice-commits] core.git: connectivity/source filter/source framework/source include/unotools sd/qa sfx2/source sw/source unotools/source

Stephan Bergmann sbergman at redhat.com
Wed May 14 04:39:31 PDT 2014


 connectivity/source/drivers/dbase/DTable.cxx     |    2 +-
 filter/source/xsltdialog/xmlfiltertestdialog.cxx |    4 ++--
 framework/source/services/autorecovery.cxx       |    2 +-
 include/unotools/tempfile.hxx                    |   10 +---------
 sd/qa/unit/HtmlExportTest.cxx                    |    2 +-
 sd/qa/unit/sdmodeltestbase.hxx                   |    2 +-
 sfx2/source/doc/docfile.cxx                      |    6 +++---
 sw/source/core/doc/docglbl.cxx                   |    4 ++--
 sw/source/core/uibase/dbui/dbmgr.cxx             |    4 ++--
 sw/source/core/uibase/misc/glosdoc.cxx           |    2 +-
 sw/source/core/uibase/uno/unomailmerge.cxx       |    2 +-
 sw/source/ui/dbui/addresslistdialog.cxx          |    2 +-
 sw/source/ui/dbui/mmlayoutpage.cxx               |    2 +-
 unotools/source/ucbhelper/tempfile.cxx           |    7 -------
 14 files changed, 18 insertions(+), 33 deletions(-)

New commits:
commit c8695c6cce4aaa07ab2d615783d74037abb241b5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 14 13:38:23 2014 +0200

    Unify utl::TempFile ctors
    
    Change-Id: I0a781a86804808cebf7756506d9299971c13e2ff

diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 609161e..9dd02ba 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2453,7 +2453,7 @@ OUString ODbaseTable::createTempFile()
     OUString sTempName(aIdent);
     OUString sExt(OUString(".") + m_pConnection->getExtension());
     OUString sName(m_Name);
-    TempFile aTempFile(sName, &sExt, &sTempName);
+    TempFile aTempFile(sName, true, &sExt, &sTempName);
     if(!aTempFile.IsValid())
         getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE, *this);
 
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 8c504a6..4358071 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -430,7 +430,7 @@ void XMLFilterTestDialog::doExport( Reference< XComponent > xComp )
         if( xStorable.is() )
         {
             OUString const ext(".xml");
-            utl::TempFile aTempFile(OUString(), &ext);
+            utl::TempFile aTempFile(OUString(), true, &ext);
             OUString aTempFileURL( aTempFile.GetURL() );
 
             const application_info_impl* pAppInfo = getApplicationInfo( m_pFilterInfo->maExportService );
@@ -593,7 +593,7 @@ void XMLFilterTestDialog::import( const OUString& rURL )
         if( m_pCBXDisplaySource->IsChecked() )
         {
             OUString const ext(".xml");
-            TempFile aTempFile(OUString(), &ext);
+            TempFile aTempFile(OUString(), true, &ext);
             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 1d5178e..715b4ba 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3541,7 +3541,7 @@ void AutoRecovery::implts_generateNewTempURL(const OUString&               sBack
     OUString sName(sUniqueName.makeStringAndClear());
     OUString sExtension(rInfo.Extension);
     OUString sPath(sBackupPath);
-    ::utl::TempFile aTempFile(sName, &sExtension, &sPath);
+    ::utl::TempFile aTempFile(sName, true, &sExtension, &sPath);
 
     rInfo.NewTempURL = aTempFile.GetURL();
 }
diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx
index 3299e58..67f03fb 100644
--- a/include/unotools/tempfile.hxx
+++ b/include/unotools/tempfile.hxx
@@ -69,17 +69,9 @@ public:
                     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
-                    */
-                    TempFile( const OUString& rLeadingChars, const OUString* pExtension=NULL, const OUString* pParent=NULL,
-                                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"
                     */
-                    TempFile( const OUString& rLeadingChars, bool _bStartWithZero, const OUString* pExtension=NULL, const OUString* pParent=NULL, bool bDirectory=false);
+                    TempFile( const OUString& rLeadingChars, bool _bStartWithZero=true, const OUString* pExtension=NULL, const OUString* pParent=NULL, bool bDirectory=false);
 
                     /**
                     TempFile will be removed from disk in dtor if EnableKillingTempFile was called before.
diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx
index 4ce0a5d..a85f4a5 100644
--- a/sd/qa/unit/HtmlExportTest.cxx
+++ b/sd/qa/unit/HtmlExportTest.cxx
@@ -22,7 +22,7 @@ private:
     {
         FileFormat* pFormat = getFormat(HTML);
         OUString aExt = OUString( "." ) + OUString::createFromAscii(pFormat->pName);
-        utl::TempFile aTempFile(OUString(), &aExt);
+        utl::TempFile aTempFile(OUString(), true, &aExt);
         aTempFile.EnableKillingFile();
         exportTo(xDocShRef, pFormat, aTempFile);
         return parseHtml(aTempFile);
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index bc63fa1..bb82929 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -174,7 +174,7 @@ protected:
     {
         FileFormat* pFormat = getFormat(nExportType);
         OUString aExt = OUString( "." ) + OUString::createFromAscii(pFormat->pName);
-        utl::TempFile aTempFile(OUString(), &aExt);
+        utl::TempFile aTempFile(OUString(), true, &aExt);
         aTempFile.EnableKillingFile();
         save(pShell, pFormat, aTempFile);
         return loadURL(aTempFile.GetURL());
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 1f52566..517da19 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2037,7 +2037,7 @@ void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalCont
     if ( !pImp->m_aBackupURL.isEmpty() )
         return; // the backup was done already
 
-    ::utl::TempFile aTransactTemp( aPrefix, &aExtension, &aDestDir );
+    ::utl::TempFile aTransactTemp( aPrefix, true, &aExtension, &aDestDir );
     aTransactTemp.EnableKillingFile( false );
 
     INetURLObject aBackObj( aTransactTemp.GetURL() );
@@ -3504,7 +3504,7 @@ OUString SfxMedium::CreateTempCopyWithExt( const OUString& aURL )
         sal_Int32 nPrefixLen = aURL.lastIndexOf( '.' );
         OUString aExt = ( nPrefixLen == -1 ) ? OUString() :  aURL.copy( nPrefixLen );
 
-        OUString aNewTempFileURL = ::utl::TempFile( OUString(), &aExt ).GetURL();
+        OUString aNewTempFileURL = ::utl::TempFile( OUString(), true, &aExt ).GetURL();
         if ( !aNewTempFileURL.isEmpty() )
         {
             INetURLObject aSource( aURL );
@@ -3579,7 +3579,7 @@ OUString SfxMedium::SwitchDocumentToTempFile()
         OUString const aExt = (nPrefixLen == -1)
                                 ? OUString()
                                 : aOrigURL.copy(nPrefixLen);
-        OUString aNewURL = ::utl::TempFile( OUString(), &aExt ).GetURL();
+        OUString aNewURL = ::utl::TempFile( OUString(), true, &aExt ).GetURL();
 
         // TODO/LATER: In future the aLogicName should be set to shared folder URL
         //             and a temporary file should be created. Transport_Impl should be impossible then.
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 340770b..5b1793f 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -231,7 +231,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
     OUString sLeading(aEntry.GetBase());
     aEntry.removeSegment();
     OUString sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
-    utl::TempFile aTemp(sLeading,&sExt,&sPath );
+    utl::TempFile aTemp(sLeading, true, &sExt, &sPath);
     aTemp.EnableKillingFile();
 
     DateTime aTmplDate( DateTime::SYSTEM );
@@ -316,7 +316,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
                     // And what's with all the Bookmarks?
                     // ?????
 
-                    utl::TempFile aTempFile2(sLeading,&sExt,&sPath );
+                    utl::TempFile aTempFile2(sLeading, true, &sExt, &sPath);
                     sFileName = aTempFile2.GetURL();
                     SfxMedium* pTmpMed = new SfxMedium( sFileName,
                                                 STREAM_STD_READWRITE );
diff --git a/sw/source/core/uibase/dbui/dbmgr.cxx b/sw/source/core/uibase/dbui/dbmgr.cxx
index 5b0566f..4574a91 100644
--- a/sw/source/core/uibase/dbui/dbmgr.cxx
+++ b/sw/source/core/uibase/dbui/dbmgr.cxx
@@ -991,7 +991,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                         sPath = aEntry.GetMainURL( INetURLObject::NO_DECODE );
                         OUString sExt(comphelper::string::stripStart(pStoreToFilter->GetDefaultExtension(), '*'));
                         aTempFile.reset(
-                                new utl::TempFile(sLeading,&sExt,&sPath ));
+                            new utl::TempFile(sLeading, true, &sExt, &sPath));
                         if( bAsSingleFile )
                             aTempFile->EnableKillingFile();
                     }
@@ -2354,7 +2354,7 @@ OUString SwDBManager::LoadAndRegisterDataSource()
                 OUString sOutputExt = ".odb";
                 OUString sTmpName;
                 {
-                    utl::TempFile aTempFile(sNewName , &sOutputExt, &sHomePath);
+                    utl::TempFile aTempFile(sNewName, true, &sOutputExt, &sHomePath);
                     aTempFile.EnableKillingFile(true);
                     sTmpName = aTempFile.GetURL();
                 }
diff --git a/sw/source/core/uibase/misc/glosdoc.cxx b/sw/source/core/uibase/misc/glosdoc.cxx
index fd78f33..2094257 100644
--- a/sw/source/core/uibase/misc/glosdoc.cxx
+++ b/sw/source/core/uibase/misc/glosdoc.cxx
@@ -80,7 +80,7 @@ OUString lcl_CheckFileName( const OUString& rNewFilePath,
 
     OUString rSG = SwGlossaries::GetExtension();
     //generate generic name
-    utl::TempFile aTemp(OUString("group"), &rSG, &rNewFilePath );
+    utl::TempFile aTemp("group", true, &rSG, &rNewFilePath);
     aTemp.EnableKillingFile();
 
     INetURLObject aTempURL( aTemp.GetURL() );
diff --git a/sw/source/core/uibase/uno/unomailmerge.cxx b/sw/source/core/uibase/uno/unomailmerge.cxx
index 11fb62a..4fef364 100644
--- a/sw/source/core/uibase/uno/unomailmerge.cxx
+++ b/sw/source/core/uibase/uno/unomailmerge.cxx
@@ -767,7 +767,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
             OUString( FILTER_XML ),
             SwDocShell::Factory().GetFilterContainer() );
     OUString aExtension(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*'));
-    utl::TempFile aTempFile( OUString("SwMM"), &aExtension );
+    utl::TempFile aTempFile( "SwMM", true, &aExtension );
     aTmpFileName = aTempFile.GetURL();
 
     Reference< XStorable > xStorable( xCurModel, UNO_QUERY );
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx
index 283f74e..72ef290 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -400,7 +400,7 @@ IMPL_LINK(SwAddressListDialog, CreateHdl_Impl, PushButton*, pButton)
             OUString sTmpName;
             {
                 OUString sHomePath(SvtPathOptions().GetWorkPath());
-                utl::TempFile aTempFile(sFind , &sExt, &sHomePath);
+                utl::TempFile aTempFile(sFind, true, &sExt, &sHomePath);
                 aTempFile.EnableKillingFile(true);
                 sTmpName = aTempFile.GetURL();
             }
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index 3df9f3a..14c36fd 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -105,7 +105,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage( SwMailMergeWizard* _pParent) :
         //creating with extension is not supported by a static method :-(
         OUString const sExt(
             comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(),'*'));
-        utl::TempFile aTempFile( OUString(), &sExt );
+        utl::TempFile aTempFile( OUString(), true, &sExt );
         m_sExampleURL = aTempFile.GetURL();
         aTempFile.EnableKillingFile();
     }
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 54799fd..a62e68d 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -272,13 +272,6 @@ TempFile::TempFile( const OUString* pParent, bool bDirectory )
     aName = CreateTempName_Impl( pParent, true, bDirectory );
 }
 
-TempFile::TempFile( const OUString& rLeadingChars, const OUString* pExtension, const OUString* pParent, bool bDirectory)
-    : pStream( 0 )
-    , bIsDirectory( bDirectory )
-    , bKillingFileEnabled( false )
-{
-    aName = lcl_createName(rLeadingChars, 0, true, pExtension, pParent, bDirectory, true);
-}
 TempFile::TempFile( const OUString& rLeadingChars, bool _bStartWithZero, const OUString* pExtension, const OUString* pParent, bool bDirectory)
     : pStream( 0 )
     , bIsDirectory( bDirectory )


More information about the Libreoffice-commits mailing list