summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorBrad Sowden <code@sowden.org>2011-12-29 22:25:11 +1300
committerLuboš Luňák <l.lunak@suse.cz>2012-01-03 18:02:55 +0100
commit8172646815db38744d8ba0dfd959b1afc089fb40 (patch)
tree00eb584e66e92848a35f0bbcabcb4e5978a1df36 /sw
parent89a8d75c12c6c67f6f7d894fec9ad3edf8839f8a (diff)
Easyhack fdo#38831 remove SvStrings
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/swunohelper.hxx6
-rw-r--r--sw/source/core/unocore/swunohelper.cxx8
-rw-r--r--sw/source/ui/inc/glosdoc.hxx11
-rw-r--r--sw/source/ui/misc/glosdoc.cxx89
-rw-r--r--sw/source/ui/utlui/gloslst.cxx10
5 files changed, 51 insertions, 73 deletions
diff --git a/sw/inc/swunohelper.hxx b/sw/inc/swunohelper.hxx
index 9f7b05ba8b13..6d61d2e4fcad 100644
--- a/sw/inc/swunohelper.hxx
+++ b/sw/inc/swunohelper.hxx
@@ -32,6 +32,8 @@
#include <sal/types.h>
#include "swdllapi.h"
+#include <vector>
+
namespace com { namespace sun { namespace star {
namespace uno {
class Any;
@@ -39,7 +41,6 @@ namespace com { namespace sun { namespace star {
}}}
class String;
-class SvStrings;
class SvPtrarr;
namespace SWUnoHelper {
@@ -68,7 +69,8 @@ SW_DLLPUBLIC sal_Bool UCB_IsReadOnlyFileName( const String& rURL );
// pDateTime != 0 -> returns also the modified date/time of
// the files in a SvPtrarr -->
// !! objects must be deleted from the caller!!
-sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList,
+sal_Bool UCB_GetFileListOfFolder( const String& rURL,
+ std::vector<String*>& rList,
const String* pExtension = 0,
SvPtrarr* pDateTimeList = 0 );
diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx
index 9946c2ce9726..c3896faa8b84 100644
--- a/sw/source/core/unocore/swunohelper.cxx
+++ b/sw/source/core/unocore/swunohelper.cxx
@@ -26,8 +26,6 @@
*
************************************************************************/
-
-#define _SVSTDARR_STRINGS
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/ucb/XContentIdentifier.hpp>
@@ -204,7 +202,8 @@ sal_Bool UCB_IsDirectory( const String& rURL )
// pDateTime != 0 -> returns also the modified date/time of
// the files in a SvPtrarr -->
// !! objects must be deleted from the caller!!
-sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList,
+sal_Bool UCB_GetFileListOfFolder( const String& rURL,
+ std::vector<String*>& rList,
const String* pExtension,
SvPtrarr* pDateTimeList )
{
@@ -245,8 +244,7 @@ sal_Bool UCB_GetFileListOfFolder( const String& rURL, SvStrings& rList,
sTitle.Equals( *pExtension,
sTitle.Len() - nExtLen, nExtLen )) )
{
- String* pStr = new String( sTitle );
- rList.Insert( pStr, rList.Count() );
+ rList.push_back( new String(sTitle) );
if( pDateTimeList )
{
diff --git a/sw/source/ui/inc/glosdoc.hxx b/sw/source/ui/inc/glosdoc.hxx
index a0db0b88e045..114c9bc24b79 100644
--- a/sw/source/ui/inc/glosdoc.hxx
+++ b/sw/source/ui/inc/glosdoc.hxx
@@ -29,11 +29,9 @@
#define _GLOSDOC_HXX
#include <tools/string.hxx>
-#include <svl/svarray.hxx>
#include <com/sun/star/text/XAutoTextGroup.hpp>
class SwTextBlocks;
-class SvStrings;
class SwDocShell;
#ifndef SW_DECL_SWDOCSHELL_DEFINED
@@ -43,10 +41,7 @@ SV_DECL_REF( SwDocShell )
#endif
#include <cppuhelper/weakref.hxx>
-#ifndef INCLUDED_VECTOR
#include <vector>
-#define INCLUDED_VECTOR
-#endif
#include "swdllapi.h"
typedef ::com::sun::star::uno::WeakReference< ::com::sun::star::text::XAutoTextGroup > AutoTextGroupRef;
@@ -67,11 +62,11 @@ class SW_DLLPUBLIC SwGlossaries
String m_sOldErrPath;
String m_sErrPath;
std::vector<String*> m_aPathArr;
- SvStrings *m_pGlosArr;
- sal_Bool m_bError;
+ std::vector<String*> *m_pGlosArr;
+ sal_Bool m_bError;
SW_DLLPRIVATE SwTextBlocks* GetGlosDoc(const String &rName, sal_Bool bCreate = sal_True) const;
- SW_DLLPRIVATE SvStrings *GetNameList();
+ SW_DLLPRIVATE std::vector<String*>* GetNameList();
// implementation in unoatxt.cxx
SW_DLLPRIVATE void RemoveFileFromList( const String& rGroup );
diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx
index 3f02b0138890..c012152a03ef 100644
--- a/sw/source/ui/misc/glosdoc.cxx
+++ b/sw/source/ui/misc/glosdoc.cxx
@@ -31,7 +31,6 @@
#include <com/sun/star/container/XNamed.hpp>
-#define _SVSTDARR_STRINGS
#include <unotools/transliterationwrapper.hxx>
#include <svl/svstdarr.hxx>
@@ -115,7 +114,7 @@ String SwGlossaries::GetDefName()
------------------------------------------------------------------------*/
sal_uInt16 SwGlossaries::GetGroupCnt()
{
- return GetNameList()->Count();
+ return static_cast<sal_uInt16>(GetNameList()->size());
}
/*------------------------------------------------------------------------
@@ -156,7 +155,7 @@ sal_Bool SwGlossaries::FindGroupName(String & rGroup)
String SwGlossaries::GetGroupName(sal_uInt16 nGroupId)
{
- OSL_ENSURE(nGroupId < m_pGlosArr->Count(), "Textbausteinarray ueberindiziert");
+ OSL_ENSURE(static_cast<size_t>(nGroupId) < m_pGlosArr->size(), "Textbausteinarray ueberindiziert");
return *(*m_pGlosArr)[nGroupId];
}
@@ -181,23 +180,18 @@ String SwGlossaries::GetGroupTitle( const String& rGroupName )
SwTextBlocks* SwGlossaries::GetGroupDoc(const String &rName,
sal_Bool bCreate) const
{
- // insert to the list of text blocks if applicable
+ // insert to the list of text blocks if applicable
if(bCreate && m_pGlosArr)
{
- const String aName(rName);
- const sal_uInt16 nCount = m_pGlosArr->Count();
- sal_uInt16 i;
-
- for( i = 0; i < nCount; ++i)
+ std::vector<String*>::const_iterator it(m_pGlosArr->begin());
+ for(; it != m_pGlosArr->end(); ++it)
{
- const String *pName = (*m_pGlosArr)[i];
- if(*pName == aName)
+ if(**it == rName)
break;
}
- if(i == nCount)
+ if( it == m_pGlosArr->end() )
{ // block not in the list
- String *pTmp = new String(aName);
- m_pGlosArr->Insert(pTmp, m_pGlosArr->Count());
+ m_pGlosArr->push_back(new String(rName));
}
}
return GetGlosDoc( rName, bCreate );
@@ -227,10 +221,7 @@ sal_Bool SwGlossaries::NewGroupDoc(String& rGroupName, const String& rTitle)
SwTextBlocks *pBlock = GetGlosDoc( sNewGroup );
if(pBlock)
{
- String *pTmp =
- new String(sNewGroup);
- SvStrings* pList = GetNameList();
- pList->Insert(pTmp, pList->Count());
+ GetNameList()->push_back(new String(sNewGroup));
pBlock->SetName(rTitle);
PutGroupDoc(pBlock);
rGroupName = sNewGroup;
@@ -279,11 +270,10 @@ sal_Bool SwGlossaries::RenameGroupDoc(
rNewGroup = sNewFileName.Copy(0, nFileNameLen);
rNewGroup += GLOS_DELIM;
rNewGroup += String::CreateFromInt32(nNewPath);
- String *pTmp = new String(rNewGroup);
if(!m_pGlosArr)
GetNameList();
else
- m_pGlosArr->Insert(pTmp, m_pGlosArr->Count());
+ m_pGlosArr->push_back(new String(rNewGroup));
sNewFilePath += INET_PATH_TOKEN;
sNewFilePath += sNewFileName ;
@@ -326,20 +316,16 @@ sal_Bool SwGlossaries::DelGroupDoc(const String &rName)
SwGlossaries::~SwGlossaries()
{
- sal_uInt16 nCount = m_pGlosArr? m_pGlosArr->Count() : 0;
- sal_uInt16 i;
-
- for( i = 0; i < nCount; ++i)
+ if( m_pGlosArr )
{
- String *pTmp = (*m_pGlosArr)[i];
- delete pTmp;
+ for(std::vector<String*>::const_iterator it(m_pGlosArr->begin()); it != m_pGlosArr->end(); ++it)
+ delete *it;
+ delete m_pGlosArr;
}
for(std::vector<String*>::const_iterator it(m_aPathArr.begin()); it != m_aPathArr.end(); ++it)
delete *it;
- delete m_pGlosArr;
-
InvalidateUNOOjects();
}
@@ -383,37 +369,37 @@ SwTextBlocks* SwGlossaries::GetGlosDoc( const String &rName, sal_Bool bCreate )
/*------------------------------------------------------------------------
Description: access to the list of names; read in if applicable
------------------------------------------------------------------------*/
-SvStrings* SwGlossaries::GetNameList()
+std::vector<String*>* SwGlossaries::GetNameList()
{
if( !m_pGlosArr )
{
- m_pGlosArr = new SvStrings;
+ m_pGlosArr = new std::vector<String*>;
String sExt( SwGlossaries::GetExtension() );
for( size_t i = 0; i < m_aPathArr.size(); ++i )
{
- SvStrings aFiles( 16, 16 );
+ std::vector<String*> aFiles;
SWUnoHelper::UCB_GetFileListOfFolder( *m_aPathArr[i], aFiles, &sExt );
- for( sal_uInt16 nFiles = 0, nFEnd = aFiles.Count();
- nFiles < nFEnd; ++nFiles )
+ for( std::vector<String*>::const_iterator filesIt(aFiles.begin());
+ filesIt != aFiles.end(); ++filesIt)
{
- String* pTitle = aFiles[ nFiles ];
+ String *pTitle = *filesIt;
String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() ));
sName += GLOS_DELIM;
sName += String::CreateFromInt32( static_cast<sal_Int16>(i) );
- m_pGlosArr->Insert( new String(sName), m_pGlosArr->Count() );
+ m_pGlosArr->push_back( new String(sName) );
// don't need any more these pointers
delete pTitle;
}
}
- if(!m_pGlosArr->Count())
+ if( m_pGlosArr->empty() )
{
// the standard block is inside of the path's first part
String *pTmp = new String( SwGlossaries::GetDefName() );
(*pTmp) += GLOS_DELIM;
(*pTmp) += '0';
- m_pGlosArr->Insert(pTmp, m_pGlosArr->Count());
+ m_pGlosArr->push_back( pTmp );
}
}
return m_pGlosArr;
@@ -432,10 +418,10 @@ SwGlossaries::SwGlossaries() :
/* --------------------------------------------------
* #61050# double paths cause irritation - get rid of it
* --------------------------------------------------*/
-sal_Bool lcl_FindSameEntry(const SvStrings& rDirArr, const String& rEntryURL)
+sal_Bool lcl_FindSameEntry(const std::vector<String*>& rDirArr, const String& rEntryURL)
{
- for(sal_uInt16 i = 0; i < rDirArr.Count(); i++)
- if(rEntryURL == (*rDirArr.GetObject(i)))
+ for(std::vector<String*>::const_iterator it(rDirArr.begin()); it != rDirArr.end(); ++it)
+ if( **it == rEntryURL )
return sal_True;
return sal_False;
}
@@ -454,7 +440,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
m_aPathArr.clear();
sal_uInt16 nTokenCount = m_aPath.GetTokenCount(SVT_SEARCHPATH_DELIMITER);
- SvStrings aDirArr;
+ std::vector<String*> aDirArr;
for( sal_uInt16 i = 0; i < nTokenCount; i++ )
{
String sPth(m_aPath.GetToken(i, SVT_SEARCHPATH_DELIMITER));
@@ -465,7 +451,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
{
continue;
}
- aDirArr.Insert(new String(sPth), aDirArr.Count());
+ aDirArr.push_back(new String(sPth));
if( !FStatHelper::IsFolder( sPth ) )
{
if( m_sErrPath.Len() )
@@ -476,7 +462,8 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
else
m_aPathArr.push_back(new String(sPth));
}
- aDirArr.DeleteAndDestroy(0, aDirArr.Count());
+ for(std::vector<String*>::const_iterator it(aDirArr.begin()); it != aDirArr.end(); ++it)
+ delete *it;
if(!nTokenCount ||
(m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) )
@@ -494,10 +481,8 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull)
if(m_pGlosArr)
{
- for(sal_uInt16 i = 0; i < m_pGlosArr->Count(); ++i)
- {
- delete (String *)(*m_pGlosArr)[i];
- }
+ for(std::vector<String*>::const_iterator it(m_pGlosArr->begin()); it != m_pGlosArr->end(); ++it)
+ delete *it;
DELETEZ(m_pGlosArr);
GetNameList();
}
@@ -520,11 +505,9 @@ void SwGlossaries::RemoveFileFromList( const String& rGroup )
{
if(m_pGlosArr)
{
- const sal_uInt16 nCount = m_pGlosArr->Count();
- for(sal_uInt16 i = 0; i < nCount; ++i)
+ for(std::vector<String*>::iterator it(m_pGlosArr->begin()); it != m_pGlosArr->end(); ++it)
{
- String *pTmp = (*m_pGlosArr)[i];
- if(*pTmp == rGroup)
+ if(**it == rGroup)
{
rtl::OUString aUName = rGroup;
{
@@ -569,8 +552,8 @@ void SwGlossaries::RemoveFileFromList( const String& rGroup )
}
}
- m_pGlosArr->Remove(i);
- delete pTmp;
+ delete *it;
+ m_pGlosArr->erase(it);
break;
}
}
diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx
index 860b5d1b0d34..b19f92deaa08 100644
--- a/sw/source/ui/utlui/gloslst.cxx
+++ b/sw/source/ui/utlui/gloslst.cxx
@@ -31,7 +31,6 @@
#define _SVSTDARR_STRINGSDTOR
#define _SVSTDARR_STRINGSISORTDTOR
-#define _SVSTDARR_STRINGS
#include <svl/svstdarr.hxx>
#include <tools/urlobj.hxx>
#include <vcl/dialog.hxx>
@@ -50,6 +49,8 @@
#include <gloslst.hxx>
#include <swunohelper.hxx>
+#include <vector>
+
#include <utlui.hrc>
#include <gloslst.hrc>
@@ -325,16 +326,15 @@ void SwGlossaryList::Update()
for( size_t nPath = 0; nPath < pPathArr->size(); nPath++ )
{
SvStringsDtor aFoundGroupNames;
- SvStrings aFiles( 16, 16 );
+ std::vector<String*> aFiles;
SvPtrarr aDateTimeArr( 16, 16 );
SWUnoHelper::UCB_GetFileListOfFolder( *(*pPathArr)[nPath], aFiles,
&sExt, &aDateTimeArr );
- for( sal_uInt16 nFiles = 0, nFEnd = aFiles.Count();
- nFiles < nFEnd; ++nFiles )
+ for( size_t nFiles = 0; nFiles < aFiles.size(); ++nFiles )
{
String* pTitle = aFiles[ nFiles ];
- ::DateTime* pDT = (::DateTime*) aDateTimeArr[ nFiles ];
+ ::DateTime* pDT = (::DateTime*) aDateTimeArr[ static_cast<sal_uInt16>(nFiles) ];
String sName( pTitle->Copy( 0, pTitle->Len() - sExt.Len() ));