1 --- sw/source/ui/utlui/content.cxx.old 2009-04-02 10:50:42.000000000 +0000
2 +++ sw/source/ui/utlui/content.cxx 2009-04-06 16:41:38.000000000 +0000
3 @@ -1230,19 +1230,64 @@ void SwContentTree::RequestingChilds( S
4 SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
6 sal_uInt16 nCount = pCntType->GetMemberCount();
7 - for(sal_uInt16 i = 0; i < nCount; i++)
9 - const SwContent* pCnt = pCntType->GetMember(i);
12 - String sEntry = pCnt->GetName();
15 - InsertEntry(sEntry, pParent,
16 - sal_False, LIST_APPEND, (void*)pCnt);
20 + /**************************************************************
21 + Add for outline plus/minus
22 + ***************************************************************/
23 + if(pCntType->GetType() == CONTENT_TYPE_OUTLINE)
25 + SvLBoxEntry* pChild = 0;
26 + for(sal_uInt16 i = 0; i < nCount; i++)
28 + const SwContent* pCnt = pCntType->GetMember(i);
31 + sal_uInt16 nLevel = ((SwOutlineContent*)pCnt)->GetOutlineLevel();
32 + String sEntry = pCnt->GetName();
35 + if(!pChild || (nLevel == 0))
36 + pChild = InsertEntry(sEntry, pParent,
37 + sal_False, LIST_APPEND,(void*)pCnt);
40 + //back search parent.
41 + if(((SwOutlineContent*)pCntType->GetMember(i-1))->GetOutlineLevel() < nLevel)
42 + pChild = InsertEntry(sEntry, pChild,
43 + sal_False, LIST_APPEND, (void*)pCnt);
46 + pChild = Prev(pChild);
48 + lcl_IsContent(pChild) &&
49 + !(((SwOutlineContent*)pChild->GetUserData())->GetOutlineLevel() < nLevel)
52 + pChild = Prev(pChild);
55 + pChild = InsertEntry(sEntry, pChild,
56 + sal_False, LIST_APPEND, (void*)pCnt);
64 + for(sal_uInt16 i = 0; i < nCount; i++)
66 + const SwContent* pCnt = pCntType->GetMember(i);
69 + String sEntry = pCnt->GetName();
72 + InsertEntry(sEntry, pParent,
73 + sal_False, LIST_APPEND, (void*)pCnt);
81 @@ -1253,7 +1298,7 @@ void SwContentTree::RequestingChilds( S
83 sal_Bool SwContentTree::Expand( SvLBoxEntry* pParent )
86 + if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
88 if(lcl_IsContentType(pParent))
90 @@ -1266,6 +1311,19 @@ sal_Bool SwContentTree::Expand( SvLBoxE
94 + if((pCntType->GetType() == CONTENT_TYPE_OUTLINE))
96 + sal_Bool bBool = SvTreeListBox::Expand(pParent);
97 + SvLBoxEntry* pChild = Next(pParent);
98 + while(pChild && lcl_IsContent(pChild) && pParent->HasChilds())
100 + if(pChild->HasChilds())
101 + SvTreeListBox::Expand(pChild);
102 + pChild = Next(pChild);
109 return SvTreeListBox::Expand(pParent);
110 @@ -1278,10 +1336,12 @@ sal_Bool SwContentTree::Expand( SvLBoxE
111 sal_Bool SwContentTree::Collapse( SvLBoxEntry* pParent )
115 + if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
117 if(lcl_IsContentType(pParent))
120 + return bRet = sal_False;
121 SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
122 sal_uInt16 nAnd = 1 << pCntType->GetType();
124 @@ -1296,7 +1356,8 @@ sal_Bool SwContentTree::Collapse( SvLBo
125 bRet = SvTreeListBox::Collapse(pParent);
129 +// bRet = sal_False;
130 + bRet = SvTreeListBox::Collapse(pParent);
134 @@ -1313,9 +1374,9 @@ IMPL_LINK( SwContentTree, ContentDoubleC
135 DBG_ASSERT(pEntry, "kein aktueller Eintrag!");
138 - if(lcl_IsContentType(pEntry))
139 + if(lcl_IsContentType(pEntry) && !pEntry->HasChilds())
140 RequestingChilds(pEntry);
141 - else if(bIsActive || bIsConstant)
142 + else if(!lcl_IsContentType(pEntry) && (bIsActive || bIsConstant))
146 @@ -1359,9 +1420,14 @@ void SwContentTree::Display( sal_Bool bA
147 nOldScrollPos = pVScroll->GetThumbPos();
149 sEntryName = GetEntryText(pOldSelEntry);
150 + SvLBoxEntry* pParantEntry = pOldSelEntry;
151 + while( GetParent(pParantEntry))
153 + pParantEntry = GetParent(pParantEntry);
155 if(GetParent(pOldSelEntry))
157 - nEntryRelPos = (sal_uInt16)(GetModel()->GetAbsPos(pOldSelEntry) - GetModel()->GetAbsPos(GetParent(pOldSelEntry)));
158 + nEntryRelPos = (sal_uInt16)(GetModel()->GetAbsPos(pOldSelEntry) - GetModel()->GetAbsPos(pParantEntry));
162 @@ -1455,18 +1521,24 @@ void SwContentTree::Display( sal_Bool bA
163 (*ppRootContentT)->GetName(), rImage, rImage,
164 0, sal_False, LIST_APPEND, *ppRootContentT);
166 - for(sal_uInt16 i = 0; i < (*ppRootContentT)->GetMemberCount(); i++ )
168 - const SwContent* pCnt = (*ppRootContentT)->GetMember(i);
171 - String sEntry = pCnt->GetName();
174 - InsertEntry( sEntry, pParent,
175 - sal_False, LIST_APPEND, (void*)pCnt);
178 + if(nRootType != CONTENT_TYPE_OUTLINE)
180 + SvLBoxEntry* pEntry;
181 + for(sal_uInt16 i = 0; i < (*ppRootContentT)->GetMemberCount(); i++ )
183 + const SwContent* pCnt = (*ppRootContentT)->GetMember(i);
186 + String sEntry = pCnt->GetName();
189 + InsertEntry( sEntry, pParent,
190 + sal_False, LIST_APPEND, (void*)pCnt);
195 + RequestingChilds(pParent);
197 if( nRootType == CONTENT_TYPE_OUTLINE && bIsActive )
199 @@ -1841,9 +1913,9 @@ sal_Bool SwContentTree::HasContentChange
200 // or if the visibility of objects (frames, sections, tables) has changed
201 // i.e. in header/footer
202 pArrType->FillMemberList(&bLevelOrVisibiblityChanged);
203 - if(bLevelOrVisibiblityChanged)
204 - bInvalidate = sal_True;
205 sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
206 + if((nType == CONTENT_TYPE_OUTLINE) && bLevelOrVisibiblityChanged)
207 + bRepaint = sal_True;
208 if(bLevelOrVisibiblityChanged)
209 bInvalidate = sal_True;
211 @@ -2748,6 +2820,10 @@ sal_Bool SwContentTree::Select( SvLBoxE
213 sal_Bool bEnable = sal_False;
214 SvLBoxEntry* pParentEntry = GetParent(pEntry);
215 + while(pParentEntry && (!lcl_IsContentType(pParentEntry)))
217 + pParentEntry = GetParent(pParentEntry);
219 if(!bIsLastReadOnly && (!IsVisible() ||
220 (bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry ||
221 lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)))