update dev300-m57
[ooovba.git] / applied_patches / 0010-plus-minus-sw-navigator2.diff
blobbec9d3b4b4f1ba2441efbf6ea4d0cec952a0b566
1 --- sw/source/ui/inc/conttree.hxx.old 2009-04-02 10:50:50.000000000 +0000
2 +++ sw/source/ui/inc/conttree.hxx 2009-04-06 16:41:38.000000000 +0000
3 @@ -33,6 +33,9 @@
4 #include <svtools/svtreebx.hxx>
5 #include "swcont.hxx"
7 +#include<map>
8 +//using namespace std;
10 class SwWrtShell;
11 class SwContentType;
12 class SwNavigationPI;
13 @@ -77,6 +80,8 @@ class SwContentTree : public SvTreeListB
14 SwWrtShell* pActiveShell; // die aktive oder eine konst. offene View
15 SwNavigationConfig* pConfig;
17 + std::map< void*, sal_Bool > mOutLineNodeMap;
19 sal_Int32 nActiveBlock;
20 USHORT nHiddenBlock;
21 USHORT nRootType;
22 --- sw/source/ui/utlui/content.cxx.old 2009-04-06 16:41:38.000000000 +0000
23 +++ sw/source/ui/utlui/content.cxx 2009-04-06 16:41:38.000000000 +0000
24 @@ -958,7 +958,6 @@ SwContentTree::~SwContentTree()
25 /***************************************************************************
26 Drag&Drop methods
27 ***************************************************************************/
29 void SwContentTree::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
31 if( !bIsRoot || nRootType != CONTENT_TYPE_OUTLINE )
32 @@ -1008,8 +1007,45 @@ sal_Int8 SwContentTree::AcceptDrop( cons
33 /***************************************************************************
34 Beschreibung: Drop wird im Navigator ausgefuehrt
35 ***************************************************************************/
36 +void* lcl_GetOutlineKey( SwContentTree* pTree, SwOutlineContent* pContent)
38 + void* key = 0;
39 + if( pTree && pContent )
40 + {
41 + SwWrtShell* pShell = pTree->GetWrtShell();
42 + sal_Int32 nPos = pContent->GetYPos();
43 + if( nPos )
44 + {
45 + key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
46 + }
47 + }
48 + return key;
51 sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
53 + SvLBoxEntry* pEntry = pTargetEntry;
54 + if( pEntry && ( nRootType == CONTENT_TYPE_OUTLINE ) && lcl_IsContent( pEntry ) )
55 + {
56 + SwOutlineContent* pOutlineContent = ( SwOutlineContent* )( pEntry->GetUserData() );
57 + if( pOutlineContent )
58 + {
59 + void* key = lcl_GetOutlineKey(this, pOutlineContent);
60 + if( !mOutLineNodeMap[key] )
61 + {
62 + while( pEntry->HasChilds() )
63 + {
64 + SvLBoxEntry* pChildEntry = FirstChild( pEntry );
65 + while( pChildEntry )
66 + {
67 + pEntry = pChildEntry;
68 + pChildEntry = NextSibling( pChildEntry );
69 + }
70 + }
71 + pTargetEntry = pEntry;
72 + }
73 + }
74 + }
75 if( bIsRoot )
76 return SvTreeListBox::ExecuteDrop( rEvt );
77 return bIsInDrag ? DND_ACTION_NONE : GetParentWindow()->ExecuteDrop(rEvt);
78 @@ -1298,7 +1334,8 @@ void SwContentTree::RequestingChilds( S
80 sal_Bool SwContentTree::Expand( SvLBoxEntry* pParent )
82 - if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
83 + if(!bIsRoot || (((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE) ||
84 + (nRootType == CONTENT_TYPE_OUTLINE))
86 if(lcl_IsContentType(pParent))
88 @@ -1313,18 +1350,39 @@ sal_Bool SwContentTree::Expand( SvLBoxE
89 nHiddenBlock |= nOr;
90 if((pCntType->GetType() == CONTENT_TYPE_OUTLINE))
92 + std::map< void*, sal_Bool > mCurrOutLineNodeMap;
94 + SwWrtShell* pShell = GetWrtShell();
95 sal_Bool bBool = SvTreeListBox::Expand(pParent);
96 SvLBoxEntry* pChild = Next(pParent);
97 while(pChild && lcl_IsContent(pChild) && pParent->HasChilds())
99 if(pChild->HasChilds())
100 - SvTreeListBox::Expand(pChild);
102 + sal_Int32 nPos = ((SwContent*)pChild->GetUserData())->GetYPos();
103 + void* key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
104 + mCurrOutLineNodeMap.insert(std::map<void*, sal_Bool>::value_type( key, sal_False ) );
105 + std::map<void*,sal_Bool>::iterator iter = mOutLineNodeMap.find( key );
106 + if( iter != mOutLineNodeMap.end() && mOutLineNodeMap[key])
108 + mCurrOutLineNodeMap[key] = sal_True;
109 + SvTreeListBox::Expand(pChild);
112 pChild = Next(pChild);
114 + mOutLineNodeMap = mCurrOutLineNodeMap;
115 return bBool;
119 + else if( lcl_IsContent(pParent) )
121 + SwWrtShell* pShell = GetWrtShell();
122 + sal_Int32 nPos = ((SwContent*)pParent->GetUserData())->GetYPos();
123 + void* key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
124 + mOutLineNodeMap[key] = sal_True;
127 return SvTreeListBox::Expand(pParent);
129 @@ -1336,7 +1394,8 @@ sal_Bool SwContentTree::Expand( SvLBoxE
130 sal_Bool SwContentTree::Collapse( SvLBoxEntry* pParent )
132 sal_Bool bRet;
133 - if(!bIsRoot || ((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)
134 + if(!bIsRoot || (((SwContentType*)pParent->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE) ||
135 + (nRootType == CONTENT_TYPE_OUTLINE))
137 if(lcl_IsContentType(pParent))
139 @@ -1353,6 +1412,13 @@ sal_Bool SwContentTree::Collapse( SvLBo
140 else
141 nHiddenBlock &= nAnd;
143 + else if( lcl_IsContent(pParent) )
145 + SwWrtShell* pShell = GetWrtShell();
146 + sal_Int32 nPos = ((SwContent*)pParent->GetUserData())->GetYPos();
147 + void* key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
148 + mOutLineNodeMap[key] = sal_False;
150 bRet = SvTreeListBox::Collapse(pParent);
152 else