Kaydet (Commit) 3e7004c3 authored tarafından Matteo Casalin's avatar Matteo Casalin

sal_uInt16 to size_t/bool in SwInputFieldList

Change-Id: Ib54e747abaf4e7a911dd3986d27f21a96eaa6120
üst 4f2b97d4
...@@ -357,17 +357,17 @@ public: ...@@ -357,17 +357,17 @@ public:
SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst = false ); SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst = false );
~SwInputFieldList(); ~SwInputFieldList();
sal_uInt16 Count() const; size_t Count() const;
SwField* GetField(sal_uInt16 nId); SwField* GetField(size_t nId);
void GotoFieldPos(sal_uInt16 nId); void GotoFieldPos(size_t nId);
void PushCrsr(); void PushCrsr();
void PopCrsr(); void PopCrsr();
/** Put all that are new into SortLst for updating. @return count. /** Put all that are new into SortLst for updating. @return true if not empty.
(For Glossary: only update its input-fields). (For Glossary: only update its input-fields).
Compare TmpLst with current fields. */ Compare TmpLst with current fields. */
sal_uInt16 BuildSortLst(); bool BuildSortLst();
private: private:
SwEditShell* pSh; SwEditShell* pSh;
......
...@@ -38,13 +38,13 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst ) ...@@ -38,13 +38,13 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst )
pSrtLst = new _SetGetExpFlds(); pSrtLst = new _SetGetExpFlds();
const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes(); const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes();
const sal_uInt16 nSize = rFldTypes.size(); const size_t nSize = rFldTypes.size();
// iterate over all types // iterate over all types
for(sal_uInt16 i=0; i < nSize; ++i) for(size_t i=0; i < nSize; ++i)
{ {
SwFieldType* pFldType = (SwFieldType*)rFldTypes[ i ]; SwFieldType* pFldType = (SwFieldType*)rFldTypes[ i ];
sal_uInt16 nType = pFldType->Which(); const sal_uInt16 nType = pFldType->Which();
if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType || RES_DROPDOWN == nType ) if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType || RES_DROPDOWN == nType )
{ {
...@@ -82,13 +82,13 @@ SwInputFieldList::~SwInputFieldList() ...@@ -82,13 +82,13 @@ SwInputFieldList::~SwInputFieldList()
delete pSrtLst; delete pSrtLst;
} }
sal_uInt16 SwInputFieldList::Count() const size_t SwInputFieldList::Count() const
{ {
return pSrtLst->size(); return pSrtLst->size();
} }
// get field from list in sorted order // get field from list in sorted order
SwField* SwInputFieldList::GetField(sal_uInt16 nId) SwField* SwInputFieldList::GetField(size_t nId)
{ {
const SwTxtFld* pTxtFld = (*pSrtLst)[ nId ]->GetTxtFld(); const SwTxtFld* pTxtFld = (*pSrtLst)[ nId ]->GetTxtFld();
OSL_ENSURE( pTxtFld, "no TextFld" ); OSL_ENSURE( pTxtFld, "no TextFld" );
...@@ -109,7 +109,7 @@ void SwInputFieldList::PopCrsr() ...@@ -109,7 +109,7 @@ void SwInputFieldList::PopCrsr()
} }
/// go to position of a field /// go to position of a field
void SwInputFieldList::GotoFieldPos(sal_uInt16 nId) void SwInputFieldList::GotoFieldPos(size_t nId)
{ {
pSh->StartAllAction(); pSh->StartAllAction();
(*pSrtLst)[ nId ]->GetPosOfContent( *pSh->GetCrsr()->GetPoint() ); (*pSrtLst)[ nId ]->GetPosOfContent( *pSh->GetCrsr()->GetPoint() );
...@@ -121,18 +121,18 @@ void SwInputFieldList::GotoFieldPos(sal_uInt16 nId) ...@@ -121,18 +121,18 @@ void SwInputFieldList::GotoFieldPos(sal_uInt16 nId)
* All new ones are added to SortList so that they can be updated. * All new ones are added to SortList so that they can be updated.
* For text blocks: update only input fields. * For text blocks: update only input fields.
* *
* @return count * @return true if not empty
*/ */
sal_uInt16 SwInputFieldList::BuildSortLst() bool SwInputFieldList::BuildSortLst()
{ {
const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes(); const SwFldTypes& rFldTypes = *pSh->GetDoc()->GetFldTypes();
sal_uInt16 nSize = rFldTypes.size(); const size_t nSize = rFldTypes.size();
// iterate over all types // iterate over all types
for( sal_uInt16 i = 0; i < nSize; ++i ) for( size_t i = 0; i < nSize; ++i )
{ {
SwFieldType* pFldType = (SwFieldType*)rFldTypes[ i ]; SwFieldType* pFldType = (SwFieldType*)rFldTypes[ i ];
sal_uInt16 nType = pFldType->Which(); const sal_uInt16 nType = pFldType->Which();
if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType ) if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType )
{ {
...@@ -166,7 +166,7 @@ sal_uInt16 SwInputFieldList::BuildSortLst() ...@@ -166,7 +166,7 @@ sal_uInt16 SwInputFieldList::BuildSortLst()
// the pointers are not needed anymore // the pointers are not needed anymore
aTmpLst.clear(); aTmpLst.clear();
return pSrtLst->size(); return !pSrtLst->empty();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -137,14 +137,14 @@ void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst ) ...@@ -137,14 +137,14 @@ void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst )
if( !pTmp ) if( !pTmp )
pTmp = new SwInputFieldList( this ); pTmp = new SwInputFieldList( this );
const sal_uInt16 nCnt = pTmp->Count(); const size_t nCnt = pTmp->Count();
if(nCnt) if(nCnt)
{ {
pTmp->PushCrsr(); pTmp->PushCrsr();
bool bCancel = false; bool bCancel = false;
OString aDlgPos; OString aDlgPos;
for( sal_uInt16 i = 0; i < nCnt && !bCancel; ++i ) for( size_t i = 0; i < nCnt && !bCancel; ++i )
{ {
pTmp->GotoFieldPos( i ); pTmp->GotoFieldPos( i );
SwField* pField = pTmp->GetField( i ); SwField* pField = pTmp->GetField( i );
......
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