merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0029-plus-minus-sw-navigator.diff
blob04d94a3e3d43823fde53075ef30d11ac2d11906d
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++)
8 - {
9 - const SwContent* pCnt = pCntType->GetMember(i);
10 - if(pCnt)
11 - {
12 - String sEntry = pCnt->GetName();
13 - if(!sEntry.Len())
14 - sEntry = sSpace;
15 - InsertEntry(sEntry, pParent,
16 - sal_False, LIST_APPEND, (void*)pCnt);
17 - }
19 - }
20 + /**************************************************************
21 + Add for outline plus/minus
22 + ***************************************************************/
23 + if(pCntType->GetType() == CONTENT_TYPE_OUTLINE)
24 + {
25 + SvLBoxEntry* pChild = 0;
26 + for(sal_uInt16 i = 0; i < nCount; i++)
27 + {
28 + const SwContent* pCnt = pCntType->GetMember(i);
29 + if(pCnt)
30 + {
31 + sal_uInt16 nLevel = ((SwOutlineContent*)pCnt)->GetOutlineLevel();
32 + String sEntry = pCnt->GetName();
33 + if(!sEntry.Len())
34 + sEntry = sSpace;
35 + if(!pChild || (nLevel == 0))
36 + pChild = InsertEntry(sEntry, pParent,
37 + sal_False, LIST_APPEND,(void*)pCnt);
38 + else
39 + {
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);
44 + else
45 + {
46 + pChild = Prev(pChild);
47 + while(pChild &&
48 + lcl_IsContent(pChild) &&
49 + !(((SwOutlineContent*)pChild->GetUserData())->GetOutlineLevel() < nLevel)
50 + )
51 + {
52 + pChild = Prev(pChild);
53 + }
54 + if(pChild)
55 + pChild = InsertEntry(sEntry, pChild,
56 + sal_False, LIST_APPEND, (void*)pCnt);
57 + }
58 + }
59 + }
60 + }
61 + }
62 + else
63 + {
64 + for(sal_uInt16 i = 0; i < nCount; i++)
65 + {
66 + const SwContent* pCnt = pCntType->GetMember(i);
67 + if(pCnt)
68 + {
69 + String sEntry = pCnt->GetName();
70 + if(!sEntry.Len())
71 + sEntry = sSpace;
72 + InsertEntry(sEntry, pParent,
73 + sal_False, LIST_APPEND, (void*)pCnt);
74 + }
76 + }
77 + }
81 @@ -1253,7 +1298,7 @@ void SwContentTree::RequestingChilds( S
83 sal_Bool SwContentTree::Expand( SvLBoxEntry* pParent )
85 - if(!bIsRoot)
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
92 else
93 nHiddenBlock |= nOr;
94 + if((pCntType->GetType() == CONTENT_TYPE_OUTLINE))
95 + {
96 + sal_Bool bBool = SvTreeListBox::Expand(pParent);
97 + SvLBoxEntry* pChild = Next(pParent);
98 + while(pChild && lcl_IsContent(pChild) && pParent->HasChilds())
99 + {
100 + if(pChild->HasChilds())
101 + SvTreeListBox::Expand(pChild);
102 + pChild = Next(pChild);
104 + return bBool;
109 return SvTreeListBox::Expand(pParent);
110 @@ -1278,10 +1336,12 @@ sal_Bool SwContentTree::Expand( SvLBoxE
111 sal_Bool SwContentTree::Collapse( SvLBoxEntry* pParent )
113 sal_Bool bRet;
114 - if(!bIsRoot)
115 + if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
117 if(lcl_IsContentType(pParent))
119 + if(bIsRoot)
120 + return bRet = sal_False;
121 SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
122 sal_uInt16 nAnd = 1 << pCntType->GetType();
123 nAnd = ~nAnd;
124 @@ -1296,7 +1356,8 @@ sal_Bool SwContentTree::Collapse( SvLBo
125 bRet = SvTreeListBox::Collapse(pParent);
127 else
128 - bRet = sal_False;
129 +// bRet = sal_False;
130 + bRet = SvTreeListBox::Collapse(pParent);
131 return bRet;
134 @@ -1313,9 +1374,9 @@ IMPL_LINK( SwContentTree, ContentDoubleC
135 DBG_ASSERT(pEntry, "kein aktueller Eintrag!");
136 if(pEntry)
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))
144 if(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));
161 Clear();
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);
169 - if(pCnt)
171 - String sEntry = pCnt->GetName();
172 - if(!sEntry.Len())
173 - sEntry = sSpace;
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);
184 + if(pCnt)
186 + String sEntry = pCnt->GetName();
187 + if(!sEntry.Len())
188 + sEntry = sSpace;
189 + InsertEntry( sEntry, pParent,
190 + sal_False, LIST_APPEND, (void*)pCnt);
194 + else
195 + RequestingChilds(pParent);
196 Expand(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
212 return sal_False;
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)))