diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-08-23 07:58:18 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-08-25 14:21:28 +0000 |
commit | ed834ce6fdd222b97e3bc280e8430b33631b31f1 (patch) | |
tree | 84b7d6bb5d67e70c64c6d462f58f08c0731f8708 | |
parent | d598bb3ec735e45e53d82258d8aa9788bf0dc9a4 (diff) |
String to OUString
Change-Id: I54c8f641b6db1762404916c4e4174d1f0e15cc39
Reviewed-on: https://gerrit.libreoffice.org/5613
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/inc/swunohelper.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/swunohelper.cxx | 18 | ||||
-rw-r--r-- | sw/source/ui/dochdl/gloshdl.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/inc/glosbib.hxx | 7 | ||||
-rw-r--r-- | sw/source/ui/inc/glosdoc.hxx | 44 | ||||
-rw-r--r-- | sw/source/ui/misc/glosbib.cxx | 7 | ||||
-rw-r--r-- | sw/source/ui/misc/glosdoc.cxx | 105 | ||||
-rw-r--r-- | sw/source/ui/misc/glossary.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/misc/glshell.cxx | 12 | ||||
-rw-r--r-- | sw/source/ui/utlui/gloslst.cxx | 13 |
10 files changed, 106 insertions, 113 deletions
diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx index 21aec7d11809..e33e973ffee9 100644 --- a/sw/inc/swunohelper.hxx +++ b/sw/inc/swunohelper.hxx @@ -31,6 +31,8 @@ namespace com { namespace sun { namespace star { } }}} +namespace rtl {class OUString;} + class String; class DateTime; @@ -60,9 +62,9 @@ SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL ); // pDateTime != 0 -> returns also the modified date/time of // the files in a vector --> // !! objects must be deleted from the caller!! -bool UCB_GetFileListOfFolder( const String& rURL, - std::vector<String*>& rList, - const String* pExtension = 0, +bool UCB_GetFileListOfFolder( const OUString& rURL, + std::vector<OUString*>& rList, + const OUString* pExtension = 0, std::vector<DateTime*>* pDateTimeList = 0 ); // is the URL an existing file? diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index 63e9027e9854..729d9383193f 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -32,6 +32,7 @@ #include <tools/urlobj.hxx> #include <tools/datetime.hxx> #include <tools/string.hxx> +#include "rtl/ustring.hxx" #include <ucbhelper/contentidentifier.hxx> #include <ucbhelper/content.hxx> #include <swunohelper.hxx> @@ -186,9 +187,9 @@ sal_Bool UCB_IsDirectory( const String& rURL ) // pDateTime != 0 -> returns also the modified date/time of // the files in a std::vector<String*> --> // !! objects must be deleted from the caller!! -bool UCB_GetFileListOfFolder( const String& rURL, - std::vector<String*>& rList, - const String* pExtension, +bool UCB_GetFileListOfFolder( const OUString& rURL, + std::vector<OUString*>& rList, + const OUString* pExtension, std::vector< ::DateTime* >* pDateTimeList ) { bool bOk = false; @@ -216,19 +217,18 @@ bool UCB_GetFileListOfFolder( const String& rURL, if( xResultSet.is() ) { ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow > xRow( xResultSet, ::com::sun::star::uno::UNO_QUERY ); - xub_StrLen nExtLen = pExtension ? pExtension->Len() : 0; + const sal_Int32 nExtLen = pExtension ? pExtension->getLength() : 0; try { if( xResultSet->first() ) { do { - String sTitle( xRow->getString( 1 ) ); + const OUString sTitle( xRow->getString( 1 ) ); if( !nExtLen || - ( sTitle.Len() > nExtLen && - sTitle.Equals( *pExtension, - sTitle.Len() - nExtLen, nExtLen )) ) + ( sTitle.getLength() > nExtLen && + sTitle.endsWith( *pExtension )) ) { - rList.push_back( new String(sTitle) ); + rList.push_back( new OUString(sTitle) ); if( pDateTimeList ) { diff --git a/sw/source/ui/dochdl/gloshdl.cxx b/sw/source/ui/dochdl/gloshdl.cxx index 4c4edefdbbc7..50df75d7b6df 100644 --- a/sw/source/ui/dochdl/gloshdl.cxx +++ b/sw/source/ui/dochdl/gloshdl.cxx @@ -119,8 +119,7 @@ void SwGlossaryHdl::SetCurGroup(const OUString &rGrp, sal_Bool bApi, sal_Bool bA const OUString sCurBase = aTemp.getBase(); aTemp.removeSegment(); const OUString sCurEntryPath = aTemp.GetMainURL(INetURLObject::NO_DECODE); - const std::vector<String> & rPathArr = - rStatGlossaries.GetPathArray(); + const std::vector<OUString> & rPathArr = rStatGlossaries.GetPathArray(); sal_uInt16 nCurrentPath = USHRT_MAX; for (size_t nPath = 0; nPath < rPathArr.size(); ++nPath) { diff --git a/sw/source/ui/inc/glosbib.hxx b/sw/source/ui/inc/glosbib.hxx index abe7ceed70d5..c943d8fa732e 100644 --- a/sw/source/ui/inc/glosbib.hxx +++ b/sw/source/ui/inc/glosbib.hxx @@ -17,8 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _GLOSBIB_HXX -#define _GLOSBIB_HXX +#ifndef GLOSBIB_HXX +#define GLOSBIB_HXX #include <vcl/edit.hxx> #include <svx/stddlg.hxx> @@ -28,6 +28,7 @@ #include <vcl/button.hxx> #include <vcl/fixed.hxx> +#include "rtl/ustring.hxx" #include <vector> @@ -103,7 +104,7 @@ protected: public: SwGlossaryGroupDlg(Window * pParent, - std::vector<String> const& rPathArr, + std::vector<OUString> const& rPathArr, SwGlossaryHdl *pGlosHdl); ~SwGlossaryGroupDlg(); diff --git a/sw/source/ui/inc/glosdoc.hxx b/sw/source/ui/inc/glosdoc.hxx index 196194e23c10..98041f2112d8 100644 --- a/sw/source/ui/inc/glosdoc.hxx +++ b/sw/source/ui/inc/glosdoc.hxx @@ -16,10 +16,10 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef _GLOSDOC_HXX -#define _GLOSDOC_HXX +#ifndef GLOSDOC_HXX +#define GLOSDOC_HXX -#include <tools/string.hxx> +#include "rtl/ustring.hxx" #include <com/sun/star/text/XAutoTextGroup.hpp> class SwTextBlocks; @@ -49,17 +49,17 @@ class SW_DLLPUBLIC SwGlossaries UnoAutoTextGroups m_aGlossaryGroups; UnoAutoTextEntries m_aGlossaryEntries; - String m_aPath; - std::vector<rtl::OUString> m_aInvalidPaths; - std::vector<String> m_PathArr; - std::vector<String> m_GlosArr; + OUString m_aPath; + std::vector<OUString> m_aInvalidPaths; + std::vector<OUString> m_PathArr; + std::vector<OUString> m_GlosArr; sal_Bool m_bError; - SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, sal_Bool bCreate = sal_True) const; - SW_DLLPRIVATE std::vector<String> & GetNameList(); + SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const OUString &rName, sal_Bool bCreate = sal_True) const; + SW_DLLPRIVATE std::vector<OUString> & GetNameList(); // implementation in unoatxt.cxx - SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup ); + SW_DLLPRIVATE void RemoveFileFromList( const OUString& rGroup ); SW_DLLPRIVATE void InvalidateUNOOjects(); public: @@ -98,39 +98,39 @@ public: */ ::com::sun::star::uno::Reference< ::com::sun::star::text::XAutoTextEntry > GetAutoTextEntry( - const String& _rCompleteGroupName, + const OUString& _rCompleteGroupName, const OUString& _rGroupName, const OUString& _rEntryName, bool _bCreate = false ); sal_uInt16 GetGroupCnt(); - String GetGroupName(sal_uInt16 ); - String GetGroupTitle( const String& rGroupName ); + OUString GetGroupName(sal_uInt16 ); + OUString GetGroupTitle( const OUString& rGroupName ); sal_Bool FindGroupName(OUString& rGroup); - SwTextBlocks* GetGroupDoc(const String &rName, + SwTextBlocks* GetGroupDoc(const OUString &rName, sal_Bool bCreate = sal_False); SwTextBlocks* GetDefGroupDoc() { return GetGroupDoc(GetDefName()); } void PutGroupDoc(SwTextBlocks *pBlock); - static String GetDefName(); - static String GetExtension(); + static OUString GetDefName(); + static OUString GetExtension(); - String GetCompleteGroupName( const OUString& GroupName ); + OUString GetCompleteGroupName( const OUString& GroupName ); sal_Bool NewGroupDoc(OUString &rGroupName, const OUString& rTitle); sal_Bool RenameGroupDoc(const OUString& sOldGroup, OUString& sNewGroup, const OUString& rNewTitle); - sal_Bool DelGroupDoc(const String &); - SwDocShellRef EditGroupDoc(const String &rGrpName, const String& rShortName, sal_Bool bShow = sal_True ); - void SaveGroupDoc(const String &rGrpName, const String& rLongName ); + sal_Bool DelGroupDoc(const OUString &); + SwDocShellRef EditGroupDoc(const OUString &rGrpName, const OUString& rShortName, sal_Bool bShow = sal_True ); + void SaveGroupDoc(const OUString &rGrpName, const OUString& rLongName ); void UpdateGlosPath(sal_Bool bFull); void ShowError(); inline sal_uLong IsGlosPathErr() { return m_bError; } - std::vector<String> const& GetPathArray() const { return m_PathArr; } + std::vector<OUString> const& GetPathArray() const { return m_PathArr; } }; -#endif // _GLOSDOC_HXX +#endif // GLOSDOC_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index a6019e66da74..0ec6d7fe5b17 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -42,7 +42,7 @@ #define RENAME_TOKEN_DELIM (sal_Unicode)1 SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent, - std::vector<String> const& rPathArr, SwGlossaryHdl *pHdl) + std::vector<OUString> const& rPathArr, SwGlossaryHdl *pHdl) : SvxStandardDialog(pParent, "EditCategoriesDialog", "modules/swriter/ui/editcategories.ui") , pGlosHdl(pHdl) @@ -76,9 +76,8 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent, for (size_t i = 0; i < rPathArr.size(); ++i) { - OUString sPath(rPathArr[i]); - INetURLObject aTempURL(sPath); - sPath = aTempURL.GetMainURL(INetURLObject::DECODE_WITH_CHARSET ); + INetURLObject aTempURL(rPathArr[i]); + const OUString sPath = aTempURL.GetMainURL(INetURLObject::DECODE_WITH_CHARSET ); m_pPathLB->InsertEntry(sPath); sal_uLong nCaseReadonly = 0; utl::TempFile aTempFile(&sPath); diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index c34330016e3c..77655e632eb9 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -93,7 +93,7 @@ OUString lcl_CheckFileName( const OUString& rNewFilePath, /*------------------------------------------------------------------------ Description: supplies the default group's name ------------------------------------------------------------------------*/ -String SwGlossaries::GetDefName() +OUString SwGlossaries::GetDefName() { return OUString("standard"); @@ -143,16 +143,16 @@ sal_Bool SwGlossaries::FindGroupName(OUString& rGroup) return sal_False; } -String SwGlossaries::GetGroupName(sal_uInt16 nGroupId) +OUString SwGlossaries::GetGroupName(sal_uInt16 nGroupId) { OSL_ENSURE(static_cast<size_t>(nGroupId) < m_GlosArr.size(), "SwGlossaries::GetGroupName: index out of bounds"); return m_GlosArr[nGroupId]; } -String SwGlossaries::GetGroupTitle( const String& rGroupName ) +OUString SwGlossaries::GetGroupTitle( const OUString& rGroupName ) { - String sRet; + OUString sRet; OUString sGroup(rGroupName); if (sGroup.indexOf(GLOS_DELIM)<0) FindGroupName(sGroup); @@ -160,7 +160,7 @@ String SwGlossaries::GetGroupTitle( const String& rGroupName ) if(pGroup) { sRet = pGroup->GetName(); - PutGroupDoc( pGroup ); + PutGroupDoc( pGroup ); } return sRet; } @@ -168,13 +168,13 @@ String SwGlossaries::GetGroupTitle( const String& rGroupName ) /*------------------------------------------------------------------------ Description: supplies the group rName's text block document ------------------------------------------------------------------------*/ -SwTextBlocks* SwGlossaries::GetGroupDoc(const String &rName, +SwTextBlocks* SwGlossaries::GetGroupDoc(const OUString &rName, sal_Bool bCreate) { // insert to the list of text blocks if applicable if(bCreate && !m_GlosArr.empty()) { - std::vector<String>::const_iterator it(m_GlosArr.begin()); + std::vector<OUString>::const_iterator it(m_GlosArr.begin()); for (; it != m_GlosArr.end(); ++it) { if (*it == rName) @@ -206,9 +206,8 @@ sal_Bool SwGlossaries::NewGroupDoc(OUString& rGroupName, const OUString& rTitle) if (static_cast<size_t>(nNewPath) >= m_PathArr.size()) return sal_False; const OUString sNewFilePath(m_PathArr[nNewPath]); - String sNewGroup = lcl_CheckFileName(sNewFilePath, rGroupName.getToken(0, GLOS_DELIM)); - sNewGroup += GLOS_DELIM; - sNewGroup += rGroupName.getToken(1, GLOS_DELIM); + const OUString sNewGroup = lcl_CheckFileName(sNewFilePath, rGroupName.getToken(0, GLOS_DELIM)) + + OUString(GLOS_DELIM) + rGroupName.getToken(1, GLOS_DELIM); SwTextBlocks *pBlock = GetGlosDoc( sNewGroup ); if(pBlock) { @@ -276,12 +275,12 @@ sal_Bool SwGlossaries::RenameGroupDoc( /*------------------------------------------------------------------------ Description: Deletes a text block group ------------------------------------------------------------------------*/ -sal_Bool SwGlossaries::DelGroupDoc(const String &rName) +sal_Bool SwGlossaries::DelGroupDoc(const OUString &rName) { - sal_uInt16 nPath = (sal_uInt16)rName.GetToken(1, GLOS_DELIM).ToInt32(); + sal_uInt16 nPath = (sal_uInt16)rName.getToken(1, GLOS_DELIM).toInt32(); if (static_cast<size_t>(nPath) >= m_PathArr.size()) return sal_False; - const OUString sBaseName(rName.GetToken(0, GLOS_DELIM)); + const OUString sBaseName(rName.getToken(0, GLOS_DELIM)); const OUString sFileURL = lcl_FullPathName(m_PathArr[nPath], sBaseName); const OUString aName = sBaseName + OUString(GLOS_DELIM) + OUString::number(nPath); // Even if the file doesn't exist it has to be deleted from @@ -301,14 +300,14 @@ SwGlossaries::~SwGlossaries() /*------------------------------------------------------------------------ Description: read a block document ------------------------------------------------------------------------*/ -SwTextBlocks* SwGlossaries::GetGlosDoc( const String &rName, sal_Bool bCreate ) const +SwTextBlocks* SwGlossaries::GetGlosDoc( const OUString &rName, sal_Bool bCreate ) const { - sal_uInt16 nPath = (sal_uInt16)rName.GetToken(1, GLOS_DELIM).ToInt32(); + sal_uInt16 nPath = (sal_uInt16)rName.getToken(1, GLOS_DELIM).toInt32(); SwTextBlocks *pTmp = 0; if (static_cast<size_t>(nPath) < m_PathArr.size()) { const OUString sFileURL = - lcl_FullPathName(m_PathArr[nPath], rName.GetToken(0, GLOS_DELIM)); + lcl_FullPathName(m_PathArr[nPath], rName.getToken(0, GLOS_DELIM)); sal_Bool bExist = sal_False; if(!bCreate) @@ -335,23 +334,22 @@ SwTextBlocks* SwGlossaries::GetGlosDoc( const String &rName, sal_Bool bCreate ) /*------------------------------------------------------------------------ Description: access to the list of names; read in if applicable ------------------------------------------------------------------------*/ -std::vector<String> & SwGlossaries::GetNameList() +std::vector<OUString> & SwGlossaries::GetNameList() { if (m_GlosArr.empty()) { - String sExt( SwGlossaries::GetExtension() ); + const OUString sExt( SwGlossaries::GetExtension() ); for (size_t i = 0; i < m_PathArr.size(); ++i) { - std::vector<String*> aFiles; + std::vector<OUString*> aFiles; SWUnoHelper::UCB_GetFileListOfFolder(m_PathArr[i], aFiles, &sExt); - for( std::vector<String*>::const_iterator filesIt(aFiles.begin()); + for( std::vector<OUString*>::const_iterator filesIt(aFiles.begin()); filesIt != aFiles.end(); ++filesIt) { - String *pTitle = *filesIt; - String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() )); - sName += GLOS_DELIM; - sName += OUString::number( static_cast<sal_Int16>(i) ); + const OUString *pTitle = *filesIt; + const OUString sName( pTitle->copy( 0, pTitle->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 @@ -361,10 +359,7 @@ std::vector<String> & SwGlossaries::GetNameList() if (m_GlosArr.empty()) { // the standard block is inside of the path's first part - String tmp( SwGlossaries::GetDefName() ); - tmp += GLOS_DELIM; - tmp += '0'; - m_GlosArr.push_back( tmp ); + m_GlosArr.push_back( SwGlossaries::GetDefName() + OUString(GLOS_DELIM) + "0" ); } } return m_GlosArr; @@ -396,7 +391,7 @@ rtl::OUString lcl_makePath(const std::vector<rtl::OUString>& rPaths) void SwGlossaries::UpdateGlosPath(sal_Bool bFull) { SvtPathOptions aPathOpt; - String aNewPath( aPathOpt.GetAutoTextPath() ); + OUString aNewPath( aPathOpt.GetAutoTextPath() ); bool bPathChanged = m_aPath != aNewPath; if (bFull || bPathChanged) { @@ -405,13 +400,14 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) m_PathArr.clear(); sal_uInt16 nTokenCount = comphelper::string::getTokenCount(m_aPath, SVT_SEARCHPATH_DELIMITER); - std::vector<String> aDirArr; + std::vector<OUString> aDirArr; std::vector<rtl::OUString> aInvalidPaths; for( sal_uInt16 i = 0; i < nTokenCount; i++ ) { - String sPth(m_aPath.GetToken(i, SVT_SEARCHPATH_DELIMITER)); - sPth = URIHelper::SmartRel2Abs( - INetURLObject(), sPth, URIHelper::GetMaybeFileHdl()); + const OUString sPth = URIHelper::SmartRel2Abs( + INetURLObject(), + m_aPath.getToken(i, SVT_SEARCHPATH_DELIMITER), + URIHelper::GetMaybeFileHdl()); if(i && std::find(aDirArr.begin(), aDirArr.end(), sPth) != aDirArr.end()) { @@ -459,16 +455,16 @@ void SwGlossaries::ShowError() ErrorHandler::HandleError( nPathError ); } -String SwGlossaries::GetExtension() +OUString SwGlossaries::GetExtension() { return OUString(".bau"); } -void SwGlossaries::RemoveFileFromList( const String& rGroup ) +void SwGlossaries::RemoveFileFromList( const OUString& rGroup ) { if (!m_GlosArr.empty()) { - for (std::vector<String>::iterator it(m_GlosArr.begin()); + for (std::vector<OUString>::iterator it(m_GlosArr.begin()); it != m_GlosArr.end(); ++it) { if (*it == rGroup) @@ -523,23 +519,21 @@ void SwGlossaries::RemoveFileFromList( const String& rGroup ) } } -String SwGlossaries::GetCompleteGroupName( const OUString& GroupName ) +OUString SwGlossaries::GetCompleteGroupName( const OUString& rGroupName ) { sal_uInt16 nCount = GetGroupCnt(); // when the group name was created internally the path is here as well - String sGroup(GroupName); - String sGroupName(sGroup.GetToken(0, GLOS_DELIM)); - String sPath = sGroup.GetToken(1, GLOS_DELIM); - bool bPathLen = sPath.Len() > 0; + const OUString sGroupName(rGroupName.getToken(0, GLOS_DELIM)); + const bool bPathLen = !rGroupName.getToken(1, GLOS_DELIM).isEmpty(); for ( sal_uInt16 i = 0; i < nCount; i++ ) { - String sGrpName = GetGroupName(i); - if(bPathLen ? sGroup == sGrpName : sGroupName == sGrpName.GetToken(0, GLOS_DELIM)) + const OUString sGrpName = GetGroupName(i); + if(bPathLen ? rGroupName == sGrpName : sGroupName == sGrpName.getToken(0, GLOS_DELIM)) { return sGrpName; } } - return aEmptyStr; + return OUString(); } void SwGlossaries::InvalidateUNOOjects() @@ -579,7 +573,7 @@ void SwGlossaries::InvalidateUNOOjects() Reference< text::XAutoTextGroup > SwGlossaries::GetAutoTextGroup( const OUString& _rGroupName, bool _bCreate ) { // first, find the name with path-extension - String sCompleteGroupName = GetCompleteGroupName( _rGroupName ); + const OUString sCompleteGroupName = GetCompleteGroupName( _rGroupName ); Reference< text::XAutoTextGroup > xGroup; @@ -602,7 +596,7 @@ Reference< text::XAutoTextGroup > SwGlossaries::GetAutoTextGroup( const OUString if ( _rGroupName == pSwGroup->getName() ) { // the group is already cached - if ( sCompleteGroupName.Len() ) + if ( !sCompleteGroupName.isEmpty() ) { // the group still exists -> return it xGroup = pSwGroup; break; @@ -630,16 +624,19 @@ Reference< text::XAutoTextGroup > SwGlossaries::GetAutoTextGroup( const OUString return xGroup; } -Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( const String& _rCompleteGroupName, const OUString& _rGroupName, const OUString& _rEntryName, +Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( + const OUString& rCompleteGroupName, + const OUString& rGroupName, + const OUString& rEntryName, bool _bCreate ) { //standard must be created - sal_Bool bCreate = ( _rCompleteGroupName == GetDefName() ); - ::std::auto_ptr< SwTextBlocks > pGlosGroup( GetGroupDoc( _rCompleteGroupName, bCreate ) ); + sal_Bool bCreate = ( rCompleteGroupName == GetDefName() ); + ::std::auto_ptr< SwTextBlocks > pGlosGroup( GetGroupDoc( rCompleteGroupName, bCreate ) ); if ( pGlosGroup.get() && !pGlosGroup->GetError() ) { - sal_uInt16 nIdx = pGlosGroup->GetIndex( _rEntryName ); + sal_uInt16 nIdx = pGlosGroup->GetIndex( rEntryName ); if ( USHRT_MAX == nIdx ) throw container::NoSuchElementException(); } @@ -647,8 +644,6 @@ Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( const String& throw lang::WrappedTargetException(); Reference< text::XAutoTextEntry > xReturn; - String sGroupName( _rGroupName ); - String sEntryName( _rEntryName ); UnoAutoTextEntries::iterator aSearch( m_aGlossaryEntries.begin() ); for ( ; aSearch != m_aGlossaryEntries.end(); ) @@ -666,8 +661,8 @@ Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( const String& } if ( pEntry - && ( COMPARE_EQUAL == pEntry->GetGroupName().CompareTo( sGroupName ) ) - && ( COMPARE_EQUAL == pEntry->GetEntryName().CompareTo( sEntryName ) ) + && ( COMPARE_EQUAL == pEntry->GetGroupName().CompareTo( rGroupName ) ) + && ( COMPARE_EQUAL == pEntry->GetEntryName().CompareTo( rEntryName ) ) ) { xReturn = pEntry; @@ -679,7 +674,7 @@ Reference< text::XAutoTextEntry > SwGlossaries::GetAutoTextEntry( const String& if ( !xReturn.is() && _bCreate ) { - xReturn = new SwXAutoTextEntry( this, sGroupName, sEntryName ); + xReturn = new SwXAutoTextEntry( this, rGroupName, rEntryName ); // cache it m_aGlossaryEntries.push_back( AutoTextEntryRef( xReturn ) ); } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 98af8b869d19..7cb9983b165d 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -880,7 +880,7 @@ void SwGlTreeListBox::RequestHelp( const HelpEvent& rHEvt ) if(!GetParent(pEntry)) { GroupUserData* pData = (GroupUserData*)pEntry->GetUserData(); - const std::vector<String> & rPathArr = ::GetGlossaries()->GetPathArray(); + const std::vector<OUString> & rPathArr = ::GetGlossaries()->GetPathArray(); if( !rPathArr.empty() ) { sMsg = rPathArr[pData->nPathIdx]; diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx index a4c0239db2a5..5c8bc94c5b13 100644 --- a/sw/source/ui/misc/glshell.cxx +++ b/sw/source/ui/misc/glshell.cxx @@ -95,8 +95,8 @@ static void lcl_GetState( SwDocShell& rSh, SfxItemSet& rSet ) } } -static sal_Bool lcl_Save( SwWrtShell& rSh, const String& rGroupName, - const String& rShortNm, const String& rLongNm ) +static sal_Bool lcl_Save( SwWrtShell& rSh, const OUString& rGroupName, + const OUString& rShortNm, const OUString& rLongNm ) { const SvxAutoCorrCfg& rCfg = SvxAutoCorrCfg::Get(); SwTextBlocks * pBlock = ::GetGlossaries()->GetGroupDoc( rGroupName ); @@ -197,7 +197,7 @@ sal_Bool SwWebGlosDocShell::Save() SV_IMPL_REF ( SwDocShell ) -SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rShortName, sal_Bool bShow ) +SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString& rShortName, sal_Bool bShow ) { SwDocShellRef xDocSh; @@ -206,7 +206,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS { // query which view is registered. In WebWriter there is no normal view sal_uInt16 nViewId = 0 != &SwView::Factory() ? 2 : 6; - String sLongName = pGroup->GetLongName(pGroup->GetIndex( rShortName )); + const OUString sLongName = pGroup->GetLongName(pGroup->GetIndex( rShortName )); if( 6 == nViewId ) { @@ -229,9 +229,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS // set document title SfxViewFrame* pFrame = bShow ? SfxViewFrame::LoadDocument( *xDocSh, nViewId ) : SfxViewFrame::LoadHiddenDocument( *xDocSh, nViewId ); - String aDocTitle(SW_RES( STR_GLOSSARY )); - aDocTitle += ' '; - aDocTitle += sLongName; + const OUString aDocTitle(SW_RESSTR( STR_GLOSSARY ) + " " + sLongName); bool const bDoesUndo = xDocSh->GetDoc()->GetIDocumentUndoRedo().DoesUndo(); diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx index 9290720f5313..fdc507e78f17 100644 --- a/sw/source/ui/utlui/gloslst.cxx +++ b/sw/source/ui/utlui/gloslst.cxx @@ -247,8 +247,8 @@ void SwGlossaryList::Update() ClearGroups(); } SwGlossaries* pGlossaries = ::GetGlossaries(); - const std::vector<String> & rPathArr = pGlossaries->GetPathArray(); - String sExt( SwGlossaries::GetExtension() ); + const std::vector<OUString> & rPathArr = pGlossaries->GetPathArray(); + const OUString sExt( SwGlossaries::GetExtension() ); if(!bFilled) { sal_uInt16 nGroupCount = pGlossaries->GetGroupCnt(); @@ -278,21 +278,20 @@ void SwGlossaryList::Update() for( size_t nPath = 0; nPath < rPathArr.size(); nPath++ ) { std::vector<String> aFoundGroupNames; - std::vector<String*> 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 ) { - String* pTitle = aFiles[ nFiles ]; + const OUString* pTitle = aFiles[ nFiles ]; ::DateTime* pDT = (::DateTime*) aDateTimeArr[ static_cast<sal_uInt16>(nFiles) ]; - OUString sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() )); + OUString sName( pTitle->copy( 0, pTitle->getLength() - sExt.getLength() )); aFoundGroupNames.push_back(sName); - sName += OUString(GLOS_DELIM); - sName += OUString::number( static_cast<sal_uInt16>(nPath) ); + sName += OUString(GLOS_DELIM) + OUString::number( static_cast<sal_uInt16>(nPath) ); AutoTextGroup* pFound = FindGroup( sName ); if( !pFound ) { |