Kaydet (Commit) 104d688a authored tarafından August Sodora's avatar August Sodora

SV_DECL_PTRARR_DEL->std::vector

üst a56cf221
...@@ -62,10 +62,6 @@ struct TripleString ...@@ -62,10 +62,6 @@ struct TripleString
String sShort; String sShort;
}; };
typedef TripleString* TripleStringPtr;
SV_DECL_PTRARR_DEL( TripleStrings, TripleStringPtr, 0, 4 )
SV_IMPL_PTRARR( TripleStrings, TripleStringPtr )
class SwGlossDecideDlg : public ModalDialog class SwGlossDecideDlg : public ModalDialog
{ {
OKButton aOk; OKButton aOk;
...@@ -107,11 +103,6 @@ IMPL_LINK(SwGlossDecideDlg, SelectHdl, ListBox*, EMPTYARG) ...@@ -107,11 +103,6 @@ IMPL_LINK(SwGlossDecideDlg, SelectHdl, ListBox*, EMPTYARG)
return 0; return 0;
} }
/********************************************************************
********************************************************************/
SwGlossaryList::SwGlossaryList() : SwGlossaryList::SwGlossaryList() :
bFilled(sal_False) bFilled(sal_False)
{ {
...@@ -120,11 +111,6 @@ SwGlossaryList::SwGlossaryList() : ...@@ -120,11 +111,6 @@ SwGlossaryList::SwGlossaryList() :
SetTimeout(GLOS_TIMEOUT); SetTimeout(GLOS_TIMEOUT);
} }
/********************************************************************
********************************************************************/
SwGlossaryList::~SwGlossaryList() SwGlossaryList::~SwGlossaryList()
{ {
ClearGroups(); ClearGroups();
...@@ -136,42 +122,44 @@ SwGlossaryList::~SwGlossaryList() ...@@ -136,42 +122,44 @@ SwGlossaryList::~SwGlossaryList()
* bei Bedarf nach der richtigen Gruppe gefragt * bei Bedarf nach der richtigen Gruppe gefragt
********************************************************************/ ********************************************************************/
sal_Bool SwGlossaryList::GetShortName(const String& rLongName, sal_Bool SwGlossaryList::GetShortName(const String& rLongName,
String& rShortName, String& rGroupName ) String& rShortName, String& rGroupName )
{ {
if(!bFilled) if(!bFilled)
Update(); Update();
TripleStrings aTripleStrings; std::vector<TripleString> aTripleStrings;
sal_uInt16 nCount = aGroupArr.Count(); sal_uInt16 nCount = aGroupArr.Count();
sal_uInt16 nFound = 0; sal_uInt16 nFound = 0;
for(sal_uInt16 i = 0; i < nCount; i++ ) for(sal_uInt16 i = 0; i < nCount; i++ )
{ {
AutoTextGroup* pGroup = aGroupArr.GetObject(i); AutoTextGroup* pGroup = aGroupArr.GetObject(i);
if(!rGroupName.Len() || rGroupName == pGroup->sName) if(rGroupName.Len() && rGroupName != pGroup->sName)
for(sal_uInt16 j = 0; j < pGroup->nCount; j++) continue;
{
String sLong = pGroup->sLongNames.GetToken(j, STRING_DELIM); for(sal_uInt16 j = 0; j < pGroup->nCount; j++)
if((rLongName == sLong)) {
{ String sLong = pGroup->sLongNames.GetToken(j, STRING_DELIM);
TripleString* pTriple = new TripleString; if(rLongName != sLong)
pTriple->sGroup = pGroup->sName; continue;
pTriple->sBlock = sLong;
pTriple->sShort = pGroup->sShortNames.GetToken(j, STRING_DELIM); TripleString pTriple;
aTripleStrings.Insert(pTriple, nFound++); 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; sal_Bool bRet = sal_False;
nCount = aTripleStrings.Count(); nCount = aTripleStrings.size();
if(1 == nCount ) if(1 == nCount)
{ {
TripleString* pTriple = aTripleStrings[0]; const TripleString& pTriple(aTripleStrings.front());
rShortName = pTriple->sShort; rShortName = pTriple.sShort;
rGroupName = pTriple->sGroup; rGroupName = pTriple.sGroup;
bRet = sal_True; bRet = sal_True;
} }
else if(1 < nCount) else if(1 < nCount)
...@@ -179,20 +167,20 @@ sal_Bool SwGlossaryList::GetShortName(const String& rLongName, ...@@ -179,20 +167,20 @@ sal_Bool SwGlossaryList::GetShortName(const String& rLongName,
SwGlossDecideDlg aDlg(0); SwGlossDecideDlg aDlg(0);
String sTitle = aDlg.GetText(); String sTitle = aDlg.GetText();
sTitle += ' '; sTitle += ' ';
sTitle += aTripleStrings[0]->sBlock; sTitle += aTripleStrings.front().sBlock;
aDlg.SetText(sTitle); aDlg.SetText(sTitle);
ListBox& rLB = aDlg.GetListBox(); ListBox& rLB = aDlg.GetListBox();
for(sal_uInt16 i = 0; i < nCount; i++ ) for(std::vector<TripleString>::const_iterator i = aTripleStrings.begin(); i != aTripleStrings.end(); ++i)
rLB.InsertEntry(aTripleStrings[i]->sGroup.GetToken(0, GLOS_DELIM)); rLB.InsertEntry(i->sGroup.GetToken(0, GLOS_DELIM));
rLB.SelectEntryPos(0); rLB.SelectEntryPos(0);
if(RET_OK == aDlg.Execute() && if(RET_OK == aDlg.Execute() &&
LISTBOX_ENTRY_NOTFOUND != rLB.GetSelectEntryPos()) LISTBOX_ENTRY_NOTFOUND != rLB.GetSelectEntryPos())
{ {
TripleString* pTriple = aTripleStrings[rLB.GetSelectEntryPos()]; const TripleString& pTriple(aTripleStrings[rLB.GetSelectEntryPos()]);
rShortName = pTriple->sShort; rShortName = pTriple.sShort;
rGroupName = pTriple->sGroup; rGroupName = pTriple.sGroup;
bRet = sal_True; bRet = sal_True;
} }
else else
...@@ -201,11 +189,6 @@ sal_Bool SwGlossaryList::GetShortName(const String& rLongName, ...@@ -201,11 +189,6 @@ sal_Bool SwGlossaryList::GetShortName(const String& rLongName,
return bRet; return bRet;
} }
/********************************************************************
********************************************************************/
sal_uInt16 SwGlossaryList::GetGroupCount() sal_uInt16 SwGlossaryList::GetGroupCount()
{ {
if(!bFilled) if(!bFilled)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment