diff options
author | Eike Rathke <erack@redhat.com> | 2014-03-01 03:13:28 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-03-05 07:31:19 -0600 |
commit | 68ec95b3f80408ae50897b043eed69a07d084df9 (patch) | |
tree | 5d32076e843fae44f28e3c8d9dbbacf7648fecbc /sw/source/ui/utlui | |
parent | c3403ac888c2e62edaf8befe7982f5f8cc95c16f (diff) |
made ListBox handle more than 64k elements, fdo#61520 related
ListBox and related now handle up to sal_Int32 elements correctly.
sal_Int32 instead of sal_Size or size_t because of UNO and a11y API.
Also disentangled some of the mess of SvTreeList and other containers
regarding sal_uInt16, sal_uLong, long, size_t, ... type mixtures.
Change-Id: Idb6e0ae689dc5bc2cf980721972b57b0261e688a
Reviewed-on: https://gerrit.libreoffice.org/8460
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sw/source/ui/utlui')
-rw-r--r-- | sw/source/ui/utlui/content.cxx | 14 | ||||
-rw-r--r-- | sw/source/ui/utlui/glbltree.cxx | 46 |
2 files changed, 30 insertions, 30 deletions
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index c31c650911eb..60ac680ffd66 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -1334,13 +1334,13 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent ) sEntry = sSpace; if(!pChild || (nLevel == 0)) pChild = InsertEntry(sEntry, pParent, - sal_False, LIST_APPEND,(void*)pCnt); + sal_False, TREELIST_APPEND,(void*)pCnt); else { //back search parent. if(((SwOutlineContent*)pCntType->GetMember(i-1))->GetOutlineLevel() < nLevel) pChild = InsertEntry(sEntry, pChild, - sal_False, LIST_APPEND, (void*)pCnt); + sal_False, TREELIST_APPEND, (void*)pCnt); else { pChild = Prev(pChild); @@ -1353,7 +1353,7 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent ) } if(pChild) pChild = InsertEntry(sEntry, pChild, - sal_False, LIST_APPEND, (void*)pCnt); + sal_False, TREELIST_APPEND, (void*)pCnt); } } } @@ -1370,7 +1370,7 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent ) if (sEntry.isEmpty()) sEntry = sSpace; SvTreeListEntry* pChild = InsertEntry(sEntry, pParent, - sal_False, LIST_APPEND, (void*)pCnt); + sal_False, TREELIST_APPEND, (void*)pCnt); //If object is marked , the corresponding entry is set true, //else the corresponding entry is set false . @@ -1639,7 +1639,7 @@ void SwContentTree::Display( bool bActive ) const Image& rImage = aEntryImages.GetImage(SID_SW_START + nCntType); sal_Bool bChOnDemand = 0 != (*ppContentT)->GetMemberCount(); pEntry = InsertEntry(sEntry, rImage, rImage, - 0, bChOnDemand, LIST_APPEND, (*ppContentT)); + 0, bChOnDemand, TREELIST_APPEND, (*ppContentT)); if(nCntType == nLastSelType) pSelEntry = pEntry; sal_Int32 nExpandOptions = bIsActive || bIsConstant ? @@ -1690,7 +1690,7 @@ void SwContentTree::Display( bool bActive ) const Image& rImage = aEntryImages.GetImage(20000 + nRootType); SvTreeListEntry* pParent = InsertEntry( (*ppRootContentT)->GetName(), rImage, rImage, - 0, sal_False, LIST_APPEND, *ppRootContentT); + 0, sal_False, TREELIST_APPEND, *ppRootContentT); if(nRootType != CONTENT_TYPE_OUTLINE) { @@ -1703,7 +1703,7 @@ void SwContentTree::Display( bool bActive ) if(sEntry.isEmpty()) sEntry = sSpace; InsertEntry( sEntry, pParent, - sal_False, LIST_APPEND, (void*)pCnt); + sal_False, TREELIST_APPEND, (void*)pCnt); } } } diff --git a/sw/source/ui/utlui/glbltree.cxx b/sw/source/ui/utlui/glbltree.cxx index 2065d9370230..9cdcf71b7e4b 100644 --- a/sw/source/ui/utlui/glbltree.cxx +++ b/sw/source/ui/utlui/glbltree.cxx @@ -201,7 +201,7 @@ sal_Int8 SwGlobalTree::ExecuteDrop( const ExecuteDropEvent& rEvt ) if( bIsInternalDrag ) { SvTreeListEntry* pDummy = 0; - sal_uLong nInsertionPos = LIST_APPEND; + sal_uLong nInsertionPos = TREELIST_APPEND; NotifyMoving( pDropEntry, pDDSource, pDummy, nInsertionPos ); } else @@ -219,7 +219,7 @@ sal_Int8 SwGlobalTree::ExecuteDrop( const ExecuteDropEvent& rEvt ) int nAbsContPos = pDropEntry ? (int) GetModel()->GetAbsPos(pDropEntry): - 1; - sal_uInt16 nEntryCount = (sal_uInt16)GetEntryCount(); + sal_uLong nEntryCount = GetEntryCount(); // Get data FileList aFileList; @@ -421,8 +421,8 @@ void SwGlobalTree::TbxMenuHdl(sal_uInt16 nTbxId, ToolBox* pBox) sal_uInt16 SwGlobalTree::GetEnableFlags() const { SvTreeListEntry* pEntry = FirstSelected(); - sal_uInt16 nSelCount = (sal_uInt16)GetSelectionCount(); - sal_uInt16 nEntryCount = (sal_uInt16)GetEntryCount(); + sal_uLong nSelCount = GetSelectionCount(); + sal_uLong nEntryCount = GetEntryCount(); SvTreeListEntry* pPrevEntry = pEntry ? Prev(pEntry) : 0; sal_uInt16 nRet = 0; @@ -499,9 +499,9 @@ void SwGlobalTree::RequestHelp( const HelpEvent& rHEvt ) void SwGlobalTree::SelectHdl() { - sal_uInt16 nSelCount = (sal_uInt16)GetSelectionCount(); + sal_uLong nSelCount = GetSelectionCount(); SvTreeListEntry* pSel = FirstSelected(); - sal_uInt16 nAbsPos = pSel ? (sal_uInt16)GetModel()->GetAbsPos(pSel) : 0; + sal_uLong nAbsPos = pSel ? GetModel()->GetAbsPos(pSel) : 0; SwNavigationPI* pNavi = GetParentWindow(); bool bReadonly = !pActiveShell || pActiveShell->GetView().GetDocShell()->IsReadOnly(); @@ -511,7 +511,7 @@ void SwGlobalTree::SelectHdl() pNavi->aGlobalToolBox.EnableItem(FN_ITEM_UP, nSelCount == 1 && nAbsPos && !bReadonly); pNavi->aGlobalToolBox.EnableItem(FN_ITEM_DOWN, - nSelCount == 1 && nAbsPos < ((sal_uInt16)GetEntryCount()) - 1 && !bReadonly); + nSelCount == 1 && nAbsPos < GetEntryCount() - 1 && !bReadonly); } @@ -540,8 +540,8 @@ sal_Bool SwGlobalTree::NotifyMoving( SvTreeListEntry* pTarget, ) { SvTreeList* _pModel = GetModel(); - sal_uInt16 nSource = (sal_uInt16) _pModel->GetAbsPos(pSource); - sal_uInt16 nDest = pTarget ? (sal_uInt16) _pModel->GetAbsPos(pTarget) : pSwGlblDocContents->size(); + sal_uLong nSource = _pModel->GetAbsPos(pSource); + sal_uLong nDest = pTarget ? _pModel->GetAbsPos(pTarget) : pSwGlblDocContents->size(); if( pActiveShell->MoveGlobalDocContent( *pSwGlblDocContents, nSource, nSource + 1, nDest ) && @@ -626,11 +626,11 @@ void SwGlobalTree::Display(bool bOnlyUpdateUserData) aEntryImages = ImageList(SW_RES(IMG_NAVI_ENTRYBMP)); bIsImageListInitialized = true; } - sal_uInt16 nCount = pSwGlblDocContents->size(); + size_t nCount = pSwGlblDocContents->size(); if(bOnlyUpdateUserData && GetEntryCount() == pSwGlblDocContents->size()) { SvTreeListEntry* pEntry = First(); - for( sal_uInt16 i = 0; i < nCount; i++) + for( size_t i = 0; i < nCount; i++) { SwGlblDocContent* pCont = (*pSwGlblDocContents)[i]; pEntry->SetUserData(pCont); @@ -642,18 +642,18 @@ void SwGlobalTree::Display(bool bOnlyUpdateUserData) SetUpdateMode( sal_False ); SvTreeListEntry* pOldSelEntry = FirstSelected(); OUString sEntryName; // Name of the entry - sal_uInt16 nSelPos = USHRT_MAX; + sal_uLong nSelPos = TREELIST_ENTRY_NOTFOUND; if(pOldSelEntry) { sEntryName = GetEntryText(pOldSelEntry); - nSelPos = (sal_uInt16)GetModel()->GetAbsPos(pOldSelEntry); + nSelPos = GetModel()->GetAbsPos(pOldSelEntry); } Clear(); if(!pSwGlblDocContents) Update( sal_False ); SvTreeListEntry* pSelEntry = 0; - for( sal_uInt16 i = 0; i < nCount; i++) + for( size_t i = 0; i < nCount; i++) { SwGlblDocContent* pCont = (*pSwGlblDocContents)[i]; OUString sEntry; @@ -682,7 +682,7 @@ void SwGlobalTree::Display(bool bOnlyUpdateUserData) break; } SvTreeListEntry* pEntry = InsertEntry(sEntry, aImage, aImage, - 0, sal_False, LIST_APPEND, pCont); + 0, sal_False, TREELIST_APPEND, pCont); if(sEntry == sEntryName) { pSelEntry = pEntry; @@ -692,7 +692,7 @@ void SwGlobalTree::Display(bool bOnlyUpdateUserData) { Select(pSelEntry); } - else if(nSelPos != USHRT_MAX && nSelPos < nCount) + else if(nSelPos != TREELIST_ENTRY_NOTFOUND && nSelPos < nCount) { Select(GetEntry(nSelPos)); } @@ -847,7 +847,7 @@ void SwGlobalTree::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry { pActiveShell->DeleteGlobalDocContent( pTempContents ? *pTempContents : *pSwGlblDocContents, - (sal_uInt16)GetModel()->GetAbsPos(pSelEntry)); + GetModel()->GetAbsPos(pSelEntry)); pSelEntry = PrevSelected(pSelEntry); if(pSelEntry) { @@ -1052,13 +1052,13 @@ void SwGlobalTree::ExecCommand(sal_uInt16 nCmd) if(GetSelectionCount() == 1) { bool bMove = false; - sal_uInt16 nSource = (sal_uInt16)GetModel()->GetAbsPos(pEntry); - sal_uInt16 nDest = nSource; + sal_uLong nSource = GetModel()->GetAbsPos(pEntry); + sal_uLong nDest = nSource; switch(nCmd) { case FN_ITEM_DOWN: { - sal_uInt16 nEntryCount = (sal_uInt16)GetEntryCount(); + sal_uLong nEntryCount = GetEntryCount(); bMove = nEntryCount > nSource + 1; nDest+= 2; } @@ -1111,7 +1111,7 @@ sal_Bool SwGlobalTree::Update(sal_Bool bHard) } else { - for(sal_uInt16 i = 0; i < pTempContents->size() && !bCopy; i++) + for(size_t i = 0; i < pTempContents->size() && !bCopy; i++) { SwGlblDocContent* pLeft = (*pTempContents)[i]; SwGlblDocContent* pRight = (*pSwGlblDocContents)[i]; @@ -1264,7 +1264,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen bMove = true; } OUString sFilePassword; - sal_uInt16 nEntryCount = (sal_uInt16)GetEntryCount(); + sal_uLong nEntryCount = GetEntryCount(); const OUString* pFileNames = _rFiles.getConstArray(); SwWrtShell& rSh = GetParentWindow()->GetCreateView()->GetWrtShell(); rSh.StartAction(); @@ -1335,7 +1335,7 @@ void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequen { Update( sal_False ); rSh.MoveGlobalDocContent( - *pSwGlblDocContents, nEntryCount, nEntryCount + (sal_uInt16)nFiles, nEntryCount - (sal_uInt16)nFiles ); + *pSwGlblDocContents, nEntryCount, nEntryCount + nFiles, nEntryCount - nFiles ); } rSh.EndAction(); Update( sal_False ); |