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
4 #include <svtools/svtreebx.hxx>
8 +//using namespace std;
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;
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 /***************************************************************************
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)
39 + if( pTree && pContent )
41 + SwWrtShell* pShell = pTree->GetWrtShell();
42 + sal_Int32 nPos = pContent->GetYPos();
45 + key = (void*)pShell->getIDocumentOutlineNodesAccess()->getOutlineNode( nPos );
51 sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
53 + SvLBoxEntry* pEntry = pTargetEntry;
54 + if( pEntry && ( nRootType == CONTENT_TYPE_OUTLINE ) && lcl_IsContent( pEntry ) )
56 + SwOutlineContent* pOutlineContent = ( SwOutlineContent* )( pEntry->GetUserData() );
57 + if( pOutlineContent )
59 + void* key = lcl_GetOutlineKey(this, pOutlineContent);
60 + if( !mOutLineNodeMap[key] )
62 + while( pEntry->HasChilds() )
64 + SvLBoxEntry* pChildEntry = FirstChild( pEntry );
65 + while( pChildEntry )
67 + pEntry = pChildEntry;
68 + pChildEntry = NextSibling( pChildEntry );
71 + pTargetEntry = pEntry;
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
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;
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 )
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
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);