[Open Office] 答复: [PATCH]Bug 129410] I need a plus / minus sign next to each heading in Navigator]
Jian Hua Jiao
jjiao at novell.com
Thu Apr 27 11:53:32 EDT 2006
1. add plus/minus
2. changed select outlines goto the assosiate content
Attachment: Patch
-------------- next part --------------
--- sw/source/ui/utlui/content.cxx 2006-03-27 18:18:48.000000000 +0800
+++ sw/source/ui/utlui/content.cxx 2006-04-27 23:29:42.000000000 +0800
@@ -1255,19 +1255,64 @@
SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
sal_uInt16 nCount = pCntType->GetMemberCount();
- for(sal_uInt16 i = 0; i < nCount; i++)
- {
- const SwContent* pCnt = pCntType->GetMember(i);
- if(pCnt)
- {
- String sEntry = pCnt->GetName();
- if(!sEntry.Len())
+ /**************************************************************
+ Add for outline plus/minus
+ ***************************************************************/
+ if(pCntType->GetType() == CONTENT_TYPE_OUTLINE)
+ {
+ SvLBoxEntry* pChild = 0;
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SwContent* pCnt = pCntType->GetMember(i);
+ if(pCnt)
+ {
+ sal_uInt16 nLevel = ((SwOutlineContent*)pCnt)->GetOutlineLevel();
+ String sEntry = pCnt->GetName();
+ if(!sEntry.Len())
+ sEntry = sSpace;
+ if(!pChild || (nLevel == 0))
+ pChild = InsertEntry(sEntry, pParent,
+ sal_False, LIST_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);
+ else
+ {
+ pChild = Prev(pChild);
+ while(pChild &&
+ lcl_IsContent(pChild) &&
+ !(((SwOutlineContent*)pChild->GetUserData())->GetOutlineLevel() < nLevel)
+ )
+ {
+ pChild = Prev(pChild);
+ }
+ if(pChild)
+ pChild = InsertEntry(sEntry, pChild,
+ sal_False, LIST_APPEND, (void*)pCnt);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ for(sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const SwContent* pCnt = pCntType->GetMember(i);
+ if(pCnt)
+ {
+ String sEntry = pCnt->GetName();
+ if(!sEntry.Len())
sEntry = sSpace;
- SvLBoxEntry* pChild = InsertEntry(sEntry, pParent,
- sal_False, LIST_APPEND, (void*)pCnt);
- }
+ SvLBoxEntry* pChild = InsertEntry(sEntry, pParent,
+ sal_False, LIST_APPEND, (void*)pCnt);
+ }
- }
+ }
+ }
}
}
}
@@ -1291,6 +1336,19 @@
}
else
nHiddenBlock |= nOr;
+ if((pCntType->GetType() == CONTENT_TYPE_OUTLINE))
+ {
+ sal_Bool bBool = SvTreeListBox::Expand(pParent);
+ SvLBoxEntry* pChild = Next(pParent);
+ while(pChild && lcl_IsContent(pChild) && pParent->HasChilds())
+ {
+ if(pChild->HasChilds())
+ SvTreeListBox::Expand(pChild);
+ pChild = Next(pChild);
+ }
+ return bBool;
+ }
+
}
}
return SvTreeListBox::Expand(pParent);
@@ -1338,7 +1396,7 @@
DBG_ASSERT(pEntry, "kein aktueller Eintrag!")
if(pEntry)
{
- if(lcl_IsContentType(pEntry))
+ if(lcl_IsContentType(pEntry) && !pEntry->HasChilds())
RequestingChilds(pEntry);
else if(bIsActive || bIsConstant)
{
@@ -1864,9 +1922,9 @@
// or if the visibility of objects (frames, sections, tables) has changed
// i.e. in header/footer
pArrType->FillMemberList(&bLevelOrVisibiblityChanged);
- if(bLevelOrVisibiblityChanged)
- bInvalidate = sal_True;
sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
+ if((nType == CONTENT_TYPE_OUTLINE) && bLevelOrVisibiblityChanged)
+ bRepaint = sal_True;
if(bLevelOrVisibiblityChanged)
bInvalidate = sal_True;
@@ -2759,6 +2817,10 @@
return sal_False;
sal_Bool bEnable = sal_False;
SvLBoxEntry* pParentEntry = GetParent(pEntry);
+ while(pParentEntry && (!lcl_IsContentType(pParentEntry)))
+ {
+ pParentEntry = GetParent(pParentEntry);
+ }
if(!bIsLastReadOnly && (!IsVisible() ||
(bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry ||
lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)))
@@ -2768,6 +2830,11 @@
pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, bEnable);
pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, bEnable);
pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT,bEnable);
+ if(pParentEntry && (((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE) && bSelect)
+ {
+ SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+ GotoContent(pCnt);
+ }
return SvTreeListBox::Select(pEntry, bSelect);
}
More information about the Openoffice
mailing list