summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorAugust Sodora <augsod@gmail.com>2012-01-16 13:07:00 -0500
committerAugust Sodora <augsod@gmail.com>2012-01-16 20:23:31 -0500
commit104d688af4e34d13631dd37afb659bb8c7da74f0 (patch)
tree5cd390607a328220a9107b06d813ae270b36d195 /sw
parenta56cf2216105065b7576ff695cf376bc58b12346 (diff)
SV_DECL_PTRARR_DEL->std::vector
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/utlui/gloslst.cxx73
1 files changed, 28 insertions, 45 deletions
diff --git a/sw/source/ui/utlui/gloslst.cxx b/sw/source/ui/utlui/gloslst.cxx
index 9e507d87b3b7..9ada864e4e3d 100644
--- a/sw/source/ui/utlui/gloslst.cxx
+++ b/sw/source/ui/utlui/gloslst.cxx
@@ -62,10 +62,6 @@ struct TripleString
String sShort;
};
-typedef TripleString* TripleStringPtr;
-SV_DECL_PTRARR_DEL( TripleStrings, TripleStringPtr, 0, 4 )
-SV_IMPL_PTRARR( TripleStrings, TripleStringPtr )
-
class SwGlossDecideDlg : public ModalDialog
{
OKButton aOk;
@@ -107,11 +103,6 @@ IMPL_LINK(SwGlossDecideDlg, SelectHdl, ListBox*, EMPTYARG)
return 0;
}
-/********************************************************************
-
-********************************************************************/
-
-
SwGlossaryList::SwGlossaryList() :
bFilled(sal_False)
{
@@ -120,11 +111,6 @@ SwGlossaryList::SwGlossaryList() :
SetTimeout(GLOS_TIMEOUT);
}
-/********************************************************************
-
-********************************************************************/
-
-
SwGlossaryList::~SwGlossaryList()
{
ClearGroups();
@@ -136,42 +122,44 @@ SwGlossaryList::~SwGlossaryList()
* bei Bedarf nach der richtigen Gruppe gefragt
********************************************************************/
-
sal_Bool SwGlossaryList::GetShortName(const String& rLongName,
String& rShortName, String& rGroupName )
{
if(!bFilled)
Update();
- TripleStrings aTripleStrings;
+ std::vector<TripleString> aTripleStrings;
sal_uInt16 nCount = aGroupArr.Count();
sal_uInt16 nFound = 0;
for(sal_uInt16 i = 0; i < nCount; i++ )
{
AutoTextGroup* pGroup = aGroupArr.GetObject(i);
- if(!rGroupName.Len() || rGroupName == pGroup->sName)
- for(sal_uInt16 j = 0; j < pGroup->nCount; j++)
- {
- String sLong = pGroup->sLongNames.GetToken(j, STRING_DELIM);
- if((rLongName == sLong))
- {
- TripleString* pTriple = new TripleString;
- pTriple->sGroup = pGroup->sName;
- pTriple->sBlock = sLong;
- pTriple->sShort = pGroup->sShortNames.GetToken(j, STRING_DELIM);
- aTripleStrings.Insert(pTriple, nFound++);
- }
- }
+ if(rGroupName.Len() && rGroupName != pGroup->sName)
+ continue;
+
+ for(sal_uInt16 j = 0; j < pGroup->nCount; j++)
+ {
+ String sLong = pGroup->sLongNames.GetToken(j, STRING_DELIM);
+ if(rLongName != sLong)
+ continue;
+
+ TripleString pTriple;
+ pTriple.sGroup = pGroup->sName;
+ pTriple.sBlock = sLong;
+ pTriple.sShort = pGroup->sShortNames.GetToken(j, STRING_DELIM);
+ aTripleStrings.push_back(pTriple);
+ ++nFound;
+ }
}
sal_Bool bRet = sal_False;
- nCount = aTripleStrings.Count();
- if(1 == nCount )
+ nCount = aTripleStrings.size();
+ if(1 == nCount)
{
- TripleString* pTriple = aTripleStrings[0];
- rShortName = pTriple->sShort;
- rGroupName = pTriple->sGroup;
+ const TripleString& pTriple(aTripleStrings.front());
+ rShortName = pTriple.sShort;
+ rGroupName = pTriple.sGroup;
bRet = sal_True;
}
else if(1 < nCount)
@@ -179,20 +167,20 @@ sal_Bool SwGlossaryList::GetShortName(const String& rLongName,
SwGlossDecideDlg aDlg(0);
String sTitle = aDlg.GetText();
sTitle += ' ';
- sTitle += aTripleStrings[0]->sBlock;
+ sTitle += aTripleStrings.front().sBlock;
aDlg.SetText(sTitle);
ListBox& rLB = aDlg.GetListBox();
- for(sal_uInt16 i = 0; i < nCount; i++ )
- rLB.InsertEntry(aTripleStrings[i]->sGroup.GetToken(0, GLOS_DELIM));
+ for(std::vector<TripleString>::const_iterator i = aTripleStrings.begin(); i != aTripleStrings.end(); ++i)
+ rLB.InsertEntry(i->sGroup.GetToken(0, GLOS_DELIM));
rLB.SelectEntryPos(0);
if(RET_OK == aDlg.Execute() &&
LISTBOX_ENTRY_NOTFOUND != rLB.GetSelectEntryPos())
{
- TripleString* pTriple = aTripleStrings[rLB.GetSelectEntryPos()];
- rShortName = pTriple->sShort;
- rGroupName = pTriple->sGroup;
+ const TripleString& pTriple(aTripleStrings[rLB.GetSelectEntryPos()]);
+ rShortName = pTriple.sShort;
+ rGroupName = pTriple.sGroup;
bRet = sal_True;
}
else
@@ -201,11 +189,6 @@ sal_Bool SwGlossaryList::GetShortName(const String& rLongName,
return bRet;
}
-/********************************************************************
-
-********************************************************************/
-
-
sal_uInt16 SwGlossaryList::GetGroupCount()
{
if(!bFilled)