diff options
author | Noel Grandin <noel@peralex.com> | 2013-09-17 15:10:14 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-09-19 10:14:16 +0200 |
commit | 8692fc43ac1fbac2c3a1b84051380461f50a790f (patch) | |
tree | 1c07fc1fa16a62926e457b6ac81adb609e94f46c /sw | |
parent | 781751b37ca3657d21cc3f94eb6f66f4637e49e0 (diff) |
convert sw/inc/swunohelper.hxx from String to OUString
and simplify GetFileListOfFolder to take a vector<OUString>
instead of vector<OUString*>
Change-Id: Ie2871bc01880c35b88d9e693a3d8d8c9b92055fb
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/swunohelper.hxx | 15 | ||||
-rw-r--r-- | sw/source/core/unocore/swunohelper.cxx | 16 | ||||
-rw-r--r-- | sw/source/ui/misc/glosdoc.cxx | 11 | ||||
-rw-r--r-- | sw/source/ui/utlui/gloslst.cxx | 7 |
4 files changed, 22 insertions, 27 deletions
diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx index e33e973ffee9..abd71e31b75e 100644 --- a/sw/inc/swunohelper.hxx +++ b/sw/inc/swunohelper.hxx @@ -33,7 +33,6 @@ namespace com { namespace sun { namespace star { namespace rtl {class OUString;} -class String; class DateTime; namespace SWUnoHelper { @@ -45,17 +44,17 @@ sal_Int32 GetEnumAsInt32( const com::sun::star::uno::Any& rVal ); // methods for UCB actions: // delete the file under this URL -SW_DLLPUBLIC sal_Bool UCB_DeleteFile( const String& rURL ); +SW_DLLPUBLIC sal_Bool UCB_DeleteFile( const OUString& rURL ); // copy/move the file to a new location -sal_Bool UCB_CopyFile( const String& rURL, const String& rNewURL, +sal_Bool UCB_CopyFile( const OUString& rURL, const OUString& rNewURL, sal_Bool bCopyIsMove = sal_False ); // is the URL on the current system case sentive? -SW_DLLPUBLIC sal_Bool UCB_IsCaseSensitiveFileName( const String& rURL ); +SW_DLLPUBLIC sal_Bool UCB_IsCaseSensitiveFileName( const OUString& rURL ); // is the URL readonly? -SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL ); +SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const OUString& rURL ); // get a list of files from the folder of the URL // options: pExtension = 0 -> all, else this specific extension @@ -63,15 +62,15 @@ SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL ); // the files in a vector --> // !! objects must be deleted from the caller!! bool UCB_GetFileListOfFolder( const OUString& rURL, - std::vector<OUString*>& rList, + std::vector<OUString>& rList, const OUString* pExtension = 0, std::vector<DateTime*>* pDateTimeList = 0 ); // is the URL an existing file? -SW_DLLPUBLIC sal_Bool UCB_IsFile( const String& rURL ); +SW_DLLPUBLIC sal_Bool UCB_IsFile( const OUString& rURL ); // is the URL a existing directory? -sal_Bool UCB_IsDirectory( const String& rURL ); +sal_Bool UCB_IsDirectory( const OUString& rURL ); } #endif diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index 729d9383193f..5eabfa60cb80 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -56,7 +56,7 @@ sal_Int32 GetEnumAsInt32( const ::com::sun::star::uno::Any& rVal ) // methods for UCB actions -sal_Bool UCB_DeleteFile( const String& rURL ) +sal_Bool UCB_DeleteFile( const OUString& rURL ) { sal_Bool bRemoved; try @@ -76,7 +76,7 @@ sal_Bool UCB_DeleteFile( const String& rURL ) return bRemoved; } -sal_Bool UCB_CopyFile( const String& rURL, const String& rNewURL, sal_Bool bCopyIsMove ) +sal_Bool UCB_CopyFile( const OUString& rURL, const OUString& rNewURL, sal_Bool bCopyIsMove ) { sal_Bool bCopyCompleted = sal_True; try @@ -108,7 +108,7 @@ sal_Bool UCB_CopyFile( const String& rURL, const String& rNewURL, sal_Bool bCopy return bCopyCompleted; } -sal_Bool UCB_IsCaseSensitiveFileName( const String& rURL ) +sal_Bool UCB_IsCaseSensitiveFileName( const OUString& rURL ) { sal_Bool bCaseSensitive; try @@ -136,7 +136,7 @@ sal_Bool UCB_IsCaseSensitiveFileName( const String& rURL ) return bCaseSensitive; } -sal_Bool UCB_IsReadOnlyFileName( const String& rURL ) +sal_Bool UCB_IsReadOnlyFileName( const OUString& rURL ) { sal_Bool bIsReadOnly = sal_False; try @@ -154,7 +154,7 @@ sal_Bool UCB_IsReadOnlyFileName( const String& rURL ) return bIsReadOnly; } -sal_Bool UCB_IsFile( const String& rURL ) +sal_Bool UCB_IsFile( const OUString& rURL ) { sal_Bool bExists = sal_False; try @@ -168,7 +168,7 @@ sal_Bool UCB_IsFile( const String& rURL ) return bExists; } -sal_Bool UCB_IsDirectory( const String& rURL ) +sal_Bool UCB_IsDirectory( const OUString& rURL ) { sal_Bool bExists = sal_False; try @@ -188,7 +188,7 @@ sal_Bool UCB_IsDirectory( const String& rURL ) // the files in a std::vector<String*> --> // !! objects must be deleted from the caller!! bool UCB_GetFileListOfFolder( const OUString& rURL, - std::vector<OUString*>& rList, + std::vector<OUString>& rList, const OUString* pExtension, std::vector< ::DateTime* >* pDateTimeList ) { @@ -228,7 +228,7 @@ bool UCB_GetFileListOfFolder( const OUString& rURL, ( sTitle.getLength() > nExtLen && sTitle.endsWith( *pExtension )) ) { - rList.push_back( new OUString(sTitle) ); + rList.push_back( sTitle ); if( pDateTimeList ) { diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index fa4a0e692276..9e4c1ff7db26 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -342,19 +342,16 @@ std::vector<OUString> & SwGlossaries::GetNameList() const OUString sExt( SwGlossaries::GetExtension() ); for (size_t i = 0; i < m_PathArr.size(); ++i) { - std::vector<OUString*> aFiles; + std::vector<OUString> aFiles; SWUnoHelper::UCB_GetFileListOfFolder(m_PathArr[i], aFiles, &sExt); - for( std::vector<OUString*>::const_iterator filesIt(aFiles.begin()); + for( std::vector<OUString>::const_iterator filesIt(aFiles.begin()); filesIt != aFiles.end(); ++filesIt) { - const OUString *pTitle = *filesIt; - const OUString sName( pTitle->copy( 0, pTitle->getLength() - sExt.getLength() ) + const OUString aTitle = *filesIt; + const OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() ) + OUString(GLOS_DELIM) + OUString::number( static_cast<sal_Int16>(i) )); m_GlosArr.push_back(sName); - - // don't need any more these pointers - delete pTitle; } } if (m_GlosArr.empty()) diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx index fdc507e78f17..5308845ae2d2 100644 --- a/sw/source/ui/utlui/gloslst.cxx +++ b/sw/source/ui/utlui/gloslst.cxx @@ -278,17 +278,17 @@ void SwGlossaryList::Update() for( size_t nPath = 0; nPath < rPathArr.size(); nPath++ ) { std::vector<String> aFoundGroupNames; - std::vector<OUString*> aFiles; + std::vector<OUString> aFiles; std::vector<DateTime*> aDateTimeArr; SWUnoHelper::UCB_GetFileListOfFolder( rPathArr[nPath], aFiles, &sExt, &aDateTimeArr ); for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles ) { - const OUString* pTitle = aFiles[ nFiles ]; + const OUString aTitle = aFiles[ nFiles ]; ::DateTime* pDT = (::DateTime*) aDateTimeArr[ static_cast<sal_uInt16>(nFiles) ]; - OUString sName( pTitle->copy( 0, pTitle->getLength() - sExt.getLength() )); + OUString sName( aTitle.copy( 0, aTitle.getLength() - sExt.getLength() )); aFoundGroupNames.push_back(sName); sName += OUString(GLOS_DELIM) + OUString::number( static_cast<sal_uInt16>(nPath) ); @@ -309,7 +309,6 @@ void SwGlossaryList::Update() } // don't need any more these pointers - delete pTitle; delete pDT; } |