xref: /aoo41x/main/sw/source/ui/utlui/content.cxx (revision 1eef0485)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 
27 #ifndef _SVSTDARR_HXX
28 #define _SVSTDARR_STRINGSDTOR
29 #include <svl/svstdarr.hxx>
30 #endif
31 #include <svl/urlbmk.hxx>
32 #include <tools/urlobj.hxx>
33 #include <sfx2/docfile.hxx>
34 #include <sfx2/dispatch.hxx>
35 #include <vcl/help.hxx>
36 #include <sot/formats.hxx>
37 #include <vcl/sound.hxx>
38 #include <uiitems.hxx>
39 #include <fmtinfmt.hxx>
40 #include <txtinet.hxx>
41 #include <fmtfld.hxx>
42 #include <swmodule.hxx>
43 #include <wrtsh.hxx>
44 #include <view.hxx>
45 #include <errhdl.hxx>
46 #include <docsh.hxx>
47 #include <content.hxx>
48 #include <frmfmt.hxx>
49 #include <fldbas.hxx>
50 #include <txtatr.hxx>
51 #include <IMark.hxx>
52 #include <section.hxx>
53 #include <tox.hxx>
54 #define NAVIPI_CXX
55 #include <navipi.hxx>
56 #include <navicont.hxx>
57 #include <navicfg.hxx>
58 #include <edtwin.hxx>
59 #include <doc.hxx>
60 #include <unotools.hxx>
61 #include <crsskip.hxx>
62 #include <cmdid.h>
63 #include <helpid.h>
64 #include <navipi.hrc>
65 #include <utlui.hrc>
66 #include <misc.hrc>
67 #include <comcore.hrc>
68 #include <com/sun/star/text/XTextSectionsSupplier.hpp>
69 #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
70 #include <com/sun/star/text/XTextTablesSupplier.hpp>
71 #include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
72 #include <com/sun/star/text/XDocumentIndex.hpp>
73 #include <com/sun/star/text/XBookmarksSupplier.hpp>
74 #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
75 #include <com/sun/star/text/XTextFramesSupplier.hpp>
76 #include <dcontact.hxx>
77 #include <svx/svdogrp.hxx>
78 #include <svx/svdmodel.hxx>
79 #include <svx/svdpage.hxx>
80 #include <svx/svdview.hxx>
81 #include <vcl/scrbar.hxx>
82 #include <comcore.hrc>
83 #include <SwRewriter.hxx>
84 #include <hints.hxx>
85 #include <numrule.hxx>
86 #include <swundo.hxx>
87 #include <ndtxt.hxx>
88 //IAccessibility2 Implementation 2009-----
89 //#include <ndgrf.hxx>
90 #include <fmtcntnt.hxx>
91 #include <PostItMgr.hxx>
92 //#include <../../core/inc/flyfrm.hxx>
93 //#include <../../core/inc/cntfrm.hxx>
94 //#include <ndnotxt.hxx>
95 //-----IAccessibility2 Implementation 2009
96 //#include <postit.hxx>
97 #include <postithelper.hxx>
98 #include <redline.hxx>
99 #include <docary.hxx>
100 
101 #include "swabstdlg.hxx"
102 #include "globals.hrc"
103 #include <unomid.h>
104 
105 
106 #define CTYPE_CNT	0
107 #define CTYPE_CTT	1
108 
109 using namespace ::std;
110 using namespace ::com::sun::star;
111 using namespace ::com::sun::star::text;
112 using namespace ::com::sun::star::uno;
113 using namespace ::com::sun::star::container;
114 
115 
116 #define NAVI_BOOKMARK_DELIM		(sal_Unicode)1
117 
118 /***************************************************************************
119 
120 ***************************************************************************/
121 
122 typedef SwContent* SwContentPtr;
123 SV_DECL_PTRARR_SORT_DEL( SwContentArr, SwContentPtr, 0,4)
124 SV_IMPL_OP_PTRARR_SORT(SwContentArr, SwContentPtr)
125 
126 sal_Bool SwContentTree::bIsInDrag = sal_False;
127 
128 
129 namespace
130 {
131     static sal_Bool lcl_IsContent(SvLBoxEntry* pEntry)
132     {
133         return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CNT;
134     }
135 
136 
137     static sal_Bool lcl_IsContentType(SvLBoxEntry* pEntry)
138     {
139         return ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() == CTYPE_CTT;
140     }
141 
142 
143     static sal_Bool lcl_FindShell(SwWrtShell* pShell)
144     {
145         sal_Bool bFound = sal_False;
146         SwView *pView = SwModule::GetFirstView();
147         while (pView)
148         {
149             if(pShell == &pView->GetWrtShell())
150             {
151                 bFound = sal_True;
152                 break;
153             }
154             pView = SwModule::GetNextView(pView);
155         }
156         return bFound;
157     }
158 
159     static bool lcl_IsUiVisibleBookmark(const IDocumentMarkAccess::pMark_t& rpMark)
160     {
161         return IDocumentMarkAccess::GetType(*rpMark) == IDocumentMarkAccess::BOOKMARK;
162     }
163 }
164 
165 /***************************************************************************
166 	Beschreibung: Inhalt, enthaelt Namen und Verweis auf den Inhalstyp
167 ***************************************************************************/
168 
169 
170 SwContent::SwContent(const SwContentType* pCnt, const String& rName, long nYPos) :
171     SwTypeNumber(CTYPE_CNT),
172 	pParent(pCnt),
173 	sContentName(rName),
174 	nYPosition(nYPos),
175 	bInvisible(sal_False)
176 {
177 }
178 
179 
180 sal_uInt8	SwTypeNumber::GetTypeId()
181 {
182 	return nTypeId;
183 }
184 
185 SwTypeNumber::~SwTypeNumber()
186 {
187 }
188 
189 sal_Bool SwContent::IsProtect() const
190 {
191 	return sal_False;
192 }
193 
194 sal_Bool SwPostItContent::IsProtect() const
195 {
196 	if (mbPostIt)
197 		return pFld->IsProtect();
198 	else
199 		return false;
200 }
201 
202 sal_Bool SwURLFieldContent::IsProtect() const
203 {
204 	return pINetAttr->IsProtect();
205 }
206 
207 SwGraphicContent::~SwGraphicContent()
208 {
209 }
210 SwTOXBaseContent::~SwTOXBaseContent()
211 {
212 }
213 
214 /***************************************************************************
215 	Beschreibung: 	Inhaltstyp, kennt seine Inhalte und die WrtShell
216 ***************************************************************************/
217 
218 
219 SwContentType::SwContentType(SwWrtShell* pShell, sal_uInt16 nType, sal_uInt8 nLevel) :
220 	SwTypeNumber(CTYPE_CTT),
221 	pWrtShell(pShell),
222     pMember(0),
223     sContentTypeName(SW_RES(STR_CONTENT_TYPE_FIRST + nType)),
224     sSingleContentTypeName(SW_RES(STR_CONTENT_TYPE_SINGLE_FIRST + nType)),
225     nMemberCount(0),
226 	nContentType(nType),
227 	nOutlineLevel(nLevel),
228     bMemberFilled(sal_False),
229 	bDataValid(sal_False),
230 	bEdit(sal_False),
231     bDelete(sal_True)
232 {
233 	Init();
234 }
235 
236 /***************************************************************************
237 	Beschreibung: 	Initialisierung
238 ***************************************************************************/
239 
240 
241 void SwContentType::Init(sal_Bool* pbInvalidateWindow)
242 {
243 	// wenn sich der MemberCount aendert ...
244 	sal_uInt16 nOldMemberCount = nMemberCount;
245 	nMemberCount = 0;
246 	switch(nContentType)
247 	{
248 		case CONTENT_TYPE_OUTLINE	:
249 		{
250 			sTypeToken = C2S(pMarkToOutline);
251             sal_uInt16 nOutlineCount = nMemberCount =
252                 static_cast<sal_uInt16>(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount());
253 			if(nOutlineLevel < MAXLEVEL)
254 			{
255 				for(sal_uInt16 j = 0; j < nOutlineCount; j++)
256 				{
257                     if(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(j) > nOutlineLevel )
258 						nMemberCount --;
259 				}
260 			}
261 			bDelete = sal_False;
262 		}
263 		break;
264 
265 		case CONTENT_TYPE_TABLE 	:
266 			sTypeToken = C2S(pMarkToTable);
267 			nMemberCount = pWrtShell->GetTblFrmFmtCount(sal_True);
268 			bEdit = sal_True;
269 		break;
270 
271 		case CONTENT_TYPE_FRAME     :
272 		case CONTENT_TYPE_GRAPHIC   :
273 		case CONTENT_TYPE_OLE       :
274 		{
275 			FlyCntType eType = FLYCNTTYPE_FRM;
276 			sTypeToken = C2S(pMarkToFrame);
277 			if(nContentType == CONTENT_TYPE_OLE)
278 			{
279 				eType = FLYCNTTYPE_OLE;
280 				sTypeToken = C2S(pMarkToOLE);
281 			}
282 			else if(nContentType == CONTENT_TYPE_GRAPHIC)
283 			{
284 				eType = FLYCNTTYPE_GRF;
285 				sTypeToken = C2S(pMarkToGraphic);
286 			}
287 			nMemberCount = pWrtShell->GetFlyCount(eType);
288 			bEdit = sal_True;
289 		}
290 		break;
291         case CONTENT_TYPE_BOOKMARK:
292         {
293             IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess();
294             nMemberCount = static_cast<sal_uInt16>(count_if(
295                 pMarkAccess->getBookmarksBegin(),
296                 pMarkAccess->getBookmarksEnd(),
297                 &lcl_IsUiVisibleBookmark));
298             sTypeToken = aEmptyStr;
299             bEdit = sal_True;
300         }
301         break;
302 		case CONTENT_TYPE_REGION :
303 		{
304 			SwContentArr* 	pOldMember = 0;
305 			sal_uInt16 nOldRegionCount = 0;
306 			sal_Bool bInvalidate = sal_False;
307 			if(!pMember)
308 				pMember = new SwContentArr;
309 			else if(pMember->Count())
310 			{
311 				pOldMember = pMember;
312 				nOldRegionCount = pOldMember->Count();
313 				pMember = new SwContentArr;
314 			}
315 			const Point aNullPt;
316 			nMemberCount = pWrtShell->GetSectionFmtCount();
317 			for(sal_uInt16 i = 0; i < nMemberCount; i++)
318 			{
319 				const SwSectionFmt* pFmt;
320 				SectionType eTmpType;
321 				if( (pFmt = &pWrtShell->GetSectionFmt(i))->IsInNodesArr() &&
322 				(eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
323 				&& TOX_HEADER_SECTION != eTmpType )
324 				{
325                     const String& rSectionName =
326                         pFmt->GetSection()->GetSectionName();
327                     sal_uInt8 nLevel = 0;
328 					SwSectionFmt* pParentFmt = pFmt->GetParent();
329 					while(pParentFmt)
330 					{
331 						nLevel++;
332 						pParentFmt = pParentFmt->GetParent();
333 					}
334 
335 					SwContent* pCnt = new SwRegionContent(this, rSectionName,
336 							nLevel,
337 							pFmt->FindLayoutRect( sal_False, &aNullPt ).Top());
338 
339 					SwPtrMsgPoolItem aAskItem( RES_CONTENT_VISIBLE, 0 );
340 					if( !pFmt->GetInfo( aAskItem ) &&
341 						!aAskItem.pObject )		// not visible
342 						pCnt->SetInvisible();
343 					pMember->Insert(pCnt);//, pMember->Count());
344 
345 					sal_uInt16 nPos = pMember->Count() - 1;
346 					if(nOldRegionCount > nPos &&
347 						(pOldMember->GetObject(nPos))->IsInvisible()
348 								!= pCnt->IsInvisible())
349 							bInvalidate = sal_True;
350 				}
351 			}
352 			nMemberCount = pMember->Count();
353 			sTypeToken = C2S(pMarkToRegion);
354 			bEdit = sal_True;
355 			bDelete = sal_False;
356 			if(pOldMember)
357 			{
358 				pOldMember->DeleteAndDestroy(0, pOldMember->Count());
359 				delete pOldMember;
360 				if(pbInvalidateWindow && bInvalidate)
361 					*pbInvalidateWindow = sal_True;
362 			}
363 		}
364 		break;
365 		case CONTENT_TYPE_INDEX:
366 		{
367 			nMemberCount = pWrtShell->GetTOXCount();
368 			bEdit = sal_True;
369 			bDelete = sal_False;
370 		}
371 		break;
372 		case CONTENT_TYPE_REFERENCE:
373 		{
374 			nMemberCount = pWrtShell->GetRefMarks( 0 );
375 			bDelete = sal_False;
376 		}
377 		break;
378 		case CONTENT_TYPE_URLFIELD:
379 		{
380 			nMemberCount = 0;
381 			if(!pMember)
382 				pMember = new SwContentArr;
383 			else if(pMember->Count())
384 				pMember->DeleteAndDestroy(0, pMember->Count());
385 
386 			SwGetINetAttrs aArr;
387 			nMemberCount = pWrtShell->GetINetAttrs( aArr );
388 			for( sal_uInt16 n = 0; n < nMemberCount; ++n )
389 			{
390 				SwGetINetAttr* p = aArr[ n ];
391 				SwURLFieldContent* pCnt = new SwURLFieldContent(
392 									this,
393 									p->sText,
394 									INetURLObject::decode(
395 										p->rINetAttr.GetINetFmt().GetValue(),
396 										INET_HEX_ESCAPE,
397 						   				INetURLObject::DECODE_UNAMBIGUOUS,
398 										RTL_TEXTENCODING_UTF8 ),
399 									&p->rINetAttr,
400 									n );
401 				pMember->Insert( pCnt );//, n );
402 			}
403 			bEdit = sal_True;
404 			nOldMemberCount = nMemberCount;
405 			bDelete = sal_False;
406 		}
407 		break;
408 		case CONTENT_TYPE_POSTIT:
409 		{
410 			nMemberCount = 0;
411 			if(!pMember)
412 				pMember = new SwContentArr;
413 			else if(pMember->Count())
414 				pMember->DeleteAndDestroy(0, pMember->Count());
415 
416 			SwPostItMgr* aMgr = pWrtShell->GetView().GetPostItMgr();
417 			if (aMgr)
418 			{
419 				for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i)
420 				{
421 					if ( (*i)->GetBroadCaster()->ISA(SwFmtFld)) // SwPostit
422 					{
423 						SwFmtFld* aFmtFld = static_cast<SwFmtFld*>((*i)->GetBroadCaster());
424 						if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
425 							(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
426 						{
427 							String sEntry = aFmtFld->GetField()->GetPar2();
428 							RemoveNewline(sEntry);
429 							SwPostItContent* pCnt = new SwPostItContent(
430 												this,
431 												sEntry,
432 												(const SwFmtFld*)aFmtFld,
433 												nMemberCount);
434 							pMember->Insert(pCnt);
435 							nMemberCount++;
436 						}
437 					}
438 				}
439 			}
440 			//
441 			sTypeToken = aEmptyStr;
442 			bEdit = sal_True;
443 			nOldMemberCount = nMemberCount;
444 		}
445 		break;
446 		case CONTENT_TYPE_DRAWOBJECT:
447         {
448             sTypeToken = aEmptyStr;
449             nMemberCount = 0;
450             SdrModel* pModel = pWrtShell->getIDocumentDrawModelAccess()->GetDrawModel();
451             if(pModel)
452             {
453                 SdrPage* pPage = pModel->GetPage(0);
454                 sal_uInt32 nCount = pPage->GetObjCount();
455                 for( sal_uInt32 i=0; i< nCount; i++ )
456                 {
457                     SdrObject* pTemp = pPage->GetObj(i);
458                     // --> OD 2006-03-09 #i51726# - all drawing objects can be named now
459 //                    if(pTemp->ISA(SdrObjGroup) && pTemp->GetName().Len())
460                     if ( pTemp->GetName().Len() )
461                     // <--
462                         nMemberCount++;
463                 }
464             }
465         }
466 		break;
467 	}
468 	// ... dann koennen die Daten auch nicht mehr gueltig sein
469 	// abgesehen von denen, die schon korrigiert wurden, dann ist
470 	// nOldMemberCount doch nicht so old
471 	if(	nOldMemberCount != nMemberCount )
472 		bDataValid = sal_False;
473 }
474 
475 /***************************************************************************
476 	Beschreibung:
477 ***************************************************************************/
478 
479 
480 SwContentType::~SwContentType()
481 {
482 	delete pMember;
483 }
484 
485 /***************************************************************************
486 	Beschreibung:	 Inhalt liefern, dazu gfs. die Liste fuellen
487 ***************************************************************************/
488 
489 
490 const SwContent* SwContentType::GetMember(sal_uInt16 nIndex)
491 {
492 	if(!bDataValid || !pMember)
493 	{
494 		FillMemberList();
495 	}
496 	if(nIndex < pMember->Count())
497 		return pMember->GetObject(nIndex);
498 	else
499 		return 0;
500 
501 }
502 
503 
504 /***************************************************************************
505 	Beschreibung:
506 ***************************************************************************/
507 
508 
509 void	SwContentType::Invalidate()
510 {
511 	bDataValid = sal_False;
512 }
513 
514 /***************************************************************************
515 	Beschreibung: Liste der Inhalte fuellen
516 ***************************************************************************/
517 
518 
519 void	SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibiblityChanged)
520 {
521 	SwContentArr* 	pOldMember = 0;
522 	int nOldMemberCount = -1;
523 	SwPtrMsgPoolItem aAskItem( RES_CONTENT_VISIBLE, 0 );
524 	if(pMember && pbLevelOrVisibiblityChanged)
525 	{
526 		pOldMember = pMember;
527 		nOldMemberCount = pOldMember->Count();
528 		pMember = new SwContentArr;
529 		*pbLevelOrVisibiblityChanged = sal_False;
530 	}
531 	else if(!pMember)
532 		pMember = new SwContentArr;
533 	else if(pMember->Count())
534 		pMember->DeleteAndDestroy(0, pMember->Count());
535 	switch(nContentType)
536 	{
537 		case CONTENT_TYPE_OUTLINE	:
538 		{
539             sal_uInt16 nOutlineCount = nMemberCount =
540                 static_cast<sal_uInt16>(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount());
541 
542 			sal_uInt16 nPos = 0;
543 			for (sal_uInt16 i = 0; i < nOutlineCount; ++i)
544 			{
545                 const sal_Int8 nLevel = (sal_Int8)pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineLevel(i);
546 				if(nLevel >= nOutlineLevel )
547 					nMemberCount--;
548 				else
549 				{
550                     String aEntry(pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(i));
551 					aEntry.EraseLeadingChars();
552 					SwNavigationPI::CleanEntry( aEntry );
553 					SwOutlineContent* pCnt = new SwOutlineContent(this, aEntry, i, nLevel,
554 														pWrtShell->IsOutlineMovable( i ), nPos );
555 					pMember->Insert(pCnt);//, nPos);
556 					// bei gleicher Anzahl und vorhandenem pOldMember wird die
557 					// alte mit der neuen OutlinePos verglichen
558 					// cast fuer Win16
559 					if(nOldMemberCount > (int)nPos &&
560 						((SwOutlineContent*)pOldMember->GetObject(nPos))->GetOutlineLevel() != nLevel)
561 						*pbLevelOrVisibiblityChanged = sal_True;
562 
563 					nPos++;
564 				}
565 			}
566 
567 		}
568 		break;
569 
570 		case CONTENT_TYPE_TABLE 	:
571 		{
572 			DBG_ASSERT(nMemberCount ==
573 					pWrtShell->GetTblFrmFmtCount(sal_True),
574 					"MemberCount differiert");
575 			Point aNullPt;
576 			nMemberCount =	pWrtShell->GetTblFrmFmtCount(sal_True);
577 			for(sal_uInt16 i = 0; i < nMemberCount; i++)
578 			{
579 				const SwFrmFmt& rTblFmt = pWrtShell->GetTblFrmFmt(i, sal_True);
580 				String sTblName( rTblFmt.GetName() );
581 
582 				SwContent* pCnt = new SwContent(this, sTblName,
583 						rTblFmt.FindLayoutRect(sal_False, &aNullPt).Top() );
584 				if( !rTblFmt.GetInfo( aAskItem ) &&
585 					!aAskItem.pObject )		// not visible
586 					pCnt->SetInvisible();
587 
588 				pMember->Insert(pCnt);//, i);
589 
590 				if(nOldMemberCount > (int)i &&
591 					(pOldMember->GetObject(i))->IsInvisible() != pCnt->IsInvisible())
592 						*pbLevelOrVisibiblityChanged = sal_True;
593 			}
594 		}
595 		break;
596 		case CONTENT_TYPE_OLE       :
597 		case CONTENT_TYPE_FRAME     :
598 		case CONTENT_TYPE_GRAPHIC   :
599 		{
600 			FlyCntType eType = FLYCNTTYPE_FRM;
601 			if(nContentType == CONTENT_TYPE_OLE)
602 				eType = FLYCNTTYPE_OLE;
603 			else if(nContentType == CONTENT_TYPE_GRAPHIC)
604 				eType = FLYCNTTYPE_GRF;
605 			DBG_ASSERT(nMemberCount == 	pWrtShell->GetFlyCount(eType),
606 					"MemberCount differiert");
607 			Point aNullPt;
608 			nMemberCount = pWrtShell->GetFlyCount(eType);
609 			for(sal_uInt16 i = 0; i < nMemberCount; i++)
610 			{
611 				const SwFrmFmt* pFrmFmt = pWrtShell->GetFlyNum(i,eType);
612 				String sFrmName = pFrmFmt->GetName();
613 
614 				SwContent* pCnt;
615 				if(CONTENT_TYPE_GRAPHIC == nContentType)
616 				{
617 					String sLink;
618 					pWrtShell->GetGrfNms( &sLink, 0, (SwFlyFrmFmt*) pFrmFmt);
619 					pCnt = new SwGraphicContent(this, sFrmName,
620 								INetURLObject::decode( sLink, INET_HEX_ESCAPE,
621 						   				INetURLObject::DECODE_UNAMBIGUOUS,
622 										RTL_TEXTENCODING_UTF8 ),
623 								pFrmFmt->FindLayoutRect(sal_False, &aNullPt).Top());
624 				}
625 				else
626 				{
627 					pCnt = new SwContent(this, sFrmName,
628 							pFrmFmt->FindLayoutRect(sal_False, &aNullPt).Top() );
629 				}
630 				if( !pFrmFmt->GetInfo( aAskItem ) &&
631 					!aAskItem.pObject )		// not visible
632 					pCnt->SetInvisible();
633 				pMember->Insert(pCnt);//, i);
634 				if(nOldMemberCount > (int)i &&
635 					(pOldMember->GetObject(i))->IsInvisible() != pCnt->IsInvisible())
636 						*pbLevelOrVisibiblityChanged = sal_True;
637 			}
638 		}
639 		break;
640         case CONTENT_TYPE_BOOKMARK:
641         {
642             IDocumentMarkAccess* const pMarkAccess = pWrtShell->getIDocumentMarkAccess();
643             for(IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
644                 ppBookmark != pMarkAccess->getBookmarksEnd();
645                 ppBookmark++)
646             {
647                 if(lcl_IsUiVisibleBookmark(*ppBookmark))
648                 {
649                     const String& rBkmName = ppBookmark->get()->GetName();
650                     //nYPos von 0 -> text::Bookmarks werden nach Alphabet sortiert
651                     SwContent* pCnt = new SwContent(this, rBkmName, 0);
652                     pMember->Insert(pCnt);//, pMember->Count());
653                 }
654             }
655         }
656 		break;
657 		case CONTENT_TYPE_REGION    :
658 		{
659 			const Point aNullPt;
660 			nMemberCount = pWrtShell->GetSectionFmtCount();
661 			for(sal_uInt16 i = 0; i < nMemberCount; i++)
662 			{
663 				const SwSectionFmt* pFmt;
664 				SectionType eTmpType;
665 				if( (pFmt = &pWrtShell->GetSectionFmt(i))->IsInNodesArr() &&
666 				(eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
667 				&& TOX_HEADER_SECTION != eTmpType )
668 				{
669                     String sSectionName = pFmt->GetSection()->GetSectionName();
670 
671                     sal_uInt8 nLevel = 0;
672 					SwSectionFmt* pParentFmt = pFmt->GetParent();
673 					while(pParentFmt)
674 					{
675 						nLevel++;
676 						pParentFmt = pParentFmt->GetParent();
677 					}
678 
679 					SwContent* pCnt = new SwRegionContent(this, sSectionName,
680 							nLevel,
681 							pFmt->FindLayoutRect( sal_False, &aNullPt ).Top());
682 					if( !pFmt->GetInfo( aAskItem ) &&
683 						!aAskItem.pObject )		// not visible
684 						pCnt->SetInvisible();
685 					pMember->Insert(pCnt);//, pMember->Count());
686 
687 					sal_uInt16 nPos = pMember->Count() - 1;
688 					if(nOldMemberCount > nPos &&
689 						(pOldMember->GetObject(nPos))->IsInvisible()
690 								!= pCnt->IsInvisible())
691 							*pbLevelOrVisibiblityChanged = sal_True;
692 				}
693 			}
694 			nMemberCount = pMember->Count();
695 		}
696 		break;
697 		case CONTENT_TYPE_REFERENCE:
698 		{
699 			SvStringsDtor aRefMarks;
700 			nMemberCount = pWrtShell->GetRefMarks( &aRefMarks );
701 
702 			for(sal_uInt16 i=0; i<nMemberCount; i++)
703 			{
704 				//Referenzen nach Alphabet sortiert
705 				SwContent* pCnt = new SwContent(
706 							this, *aRefMarks.GetObject(i), 0);
707 				pMember->Insert(pCnt);//, i);
708 			}
709 		}
710 		break;
711 		case CONTENT_TYPE_URLFIELD:
712 		{
713 			SwGetINetAttrs aArr;
714 			nMemberCount = pWrtShell->GetINetAttrs( aArr );
715 			for( sal_uInt16 n = 0; n < nMemberCount; ++n )
716 			{
717 				SwGetINetAttr* p = aArr[ n ];
718 				SwURLFieldContent* pCnt = new SwURLFieldContent(
719 									this,
720 									p->sText,
721 									INetURLObject::decode(
722 										p->rINetAttr.GetINetFmt().GetValue(),
723 										INET_HEX_ESCAPE,
724 						   				INetURLObject::DECODE_UNAMBIGUOUS,
725 										RTL_TEXTENCODING_UTF8 ),
726 									&p->rINetAttr,
727 									n );
728 				pMember->Insert( pCnt );//, n );
729 			}
730 		}
731 		break;
732 		case CONTENT_TYPE_INDEX:
733 		{
734 
735 			sal_uInt16 nCount = nMemberCount = pWrtShell->GetTOXCount();
736 			for ( sal_uInt16 nTox = 0; nTox < nCount; nTox++ )
737 			{
738 				const SwTOXBase* pBase = pWrtShell->GetTOX( nTox );
739 				String sTOXNm( pBase->GetTOXName() );
740 
741 				SwContent* pCnt = new SwTOXBaseContent(
742 						this, sTOXNm, nTox, *pBase);
743 
744 				if( !pBase->GetInfo( aAskItem ) &&
745 					!aAskItem.pObject )		// not visible
746 					pCnt->SetInvisible();
747 
748 				pMember->Insert( pCnt );//, nTox );
749 				sal_uInt16 nPos = pMember->Count() - 1;
750 				if(nOldMemberCount > nPos &&
751 					(pOldMember->GetObject(nPos))->IsInvisible()
752 							!= pCnt->IsInvisible())
753 						*pbLevelOrVisibiblityChanged = sal_True;
754 			}
755 		}
756 		break;
757 		case CONTENT_TYPE_POSTIT:
758 		{
759 			nMemberCount = 0;
760 			if(!pMember)
761 				pMember = new SwContentArr;
762 			else if(pMember->Count())
763 				pMember->DeleteAndDestroy(0, pMember->Count());
764 			SwPostItMgr* aMgr = pWrtShell->GetView().GetPostItMgr();
765 			if (aMgr)
766 			{
767 				for(SwPostItMgr::const_iterator i = aMgr->begin(); i != aMgr->end(); ++i)
768 				{
769 					if ( (*i)->GetBroadCaster()->ISA(SwFmtFld)) // SwPostit
770 					{
771 						SwFmtFld* aFmtFld = static_cast<SwFmtFld*>((*i)->GetBroadCaster());
772 						if (aFmtFld->GetTxtFld() && aFmtFld->IsFldInDoc() &&
773 							(*i)->mLayoutStatus!=SwPostItHelper::INVISIBLE )
774 						{
775 							String sEntry = aFmtFld->GetField()->GetPar2();
776 							RemoveNewline(sEntry);
777 							SwPostItContent* pCnt = new SwPostItContent(
778 												this,
779 												sEntry,
780 												(const SwFmtFld*)aFmtFld,
781 												nMemberCount);
782 							pMember->Insert(pCnt);
783 							nMemberCount++;
784 						}
785 					}
786 					/*	this code can be used once we want redline comments in the margin
787 					else	// redcomment
788 					{
789 						SwRedline* pRedline = static_cast<SwRedline*>((*i)->GetBroadCaster());
790 						if ( pRedline->GetComment() != String(::rtl::OUString::createFromAscii("")) )
791 						{
792 							String sEntry = pRedline->GetComment();
793 							RemoveNewline(sEntry);
794 							SwPostItContent* pCnt = new SwPostItContent(
795 												this,
796 												sEntry,
797 												pRedline,
798 												nMemberCount);
799 							pMember->Insert(pCnt);
800 							nMemberCount++;
801 						}
802 					}
803 					*/
804 				}
805 			}
806 			//
807 		}
808 		break;
809 		case CONTENT_TYPE_DRAWOBJECT:
810         {
811             nMemberCount = 0;
812 			if(!pMember)
813 				pMember = new SwContentArr;
814 			else if(pMember->Count())
815 				pMember->DeleteAndDestroy(0, pMember->Count());
816 
817             IDocumentDrawModelAccess* pIDDMA = pWrtShell->getIDocumentDrawModelAccess();
818             SdrModel* pModel = pIDDMA->GetDrawModel();
819             if(pModel)
820             {
821                 SdrPage* pPage = pModel->GetPage(0);
822                 sal_uInt32 nCount = pPage->GetObjCount();
823                 for( sal_uInt32 i=0; i< nCount; i++ )
824                 {
825                     SdrObject* pTemp = pPage->GetObj(i);
826                     // --> OD 2006-03-09 #i51726# - all drawing objects can be named now
827 //                    if(pTemp->ISA(SdrObjGroup) && pTemp->GetName().Len())
828                     if ( pTemp->GetName().Len() )
829                     // <--
830                     {
831                         SwContact* pContact = (SwContact*)pTemp->GetUserCall();
832                         long nYPos = 0;
833                         const Point aNullPt;
834                         if(pContact && pContact->GetFmt())
835                             nYPos = pContact->GetFmt()->FindLayoutRect(sal_False, &aNullPt).Top();
836                         SwContent* pCnt = new SwContent(
837                                             this,
838                                             pTemp->GetName(),
839                                             nYPos);
840                         if(!pIDDMA->IsVisibleLayerId(pTemp->GetLayer()))
841                             pCnt->SetInvisible();
842                         pMember->Insert(pCnt);
843                         nMemberCount++;
844                         if(nOldMemberCount > (int)i &&
845                             (pOldMember->GetObject((sal_uInt16)i))->IsInvisible() != pCnt->IsInvisible())
846                                 *pbLevelOrVisibiblityChanged = sal_True;
847                     }
848                 }
849             }
850         }
851         break;
852 	}
853 	bDataValid = sal_True;
854 	if(pOldMember)
855 		pOldMember->DeleteAndDestroy(0, pOldMember->Count());
856 
857 }
858 
859 /***************************************************************************
860 	Beschreibung: TreeListBox fuer Inhaltsanzeige
861 ***************************************************************************/
862 
863 
864 SwContentTree::SwContentTree(Window* pParent, const ResId& rResId) :
865 		SvTreeListBox( pParent, rResId ),
866 
867         sSpace(C2S("                    ")),
868 
869         sRemoveIdx(SW_RES(ST_REMOVE_INDEX)),
870         sUpdateIdx(SW_RES(ST_UPDATE)),
871         sUnprotTbl(SW_RES(ST_REMOVE_TBL_PROTECTION)),
872         sRename(SW_RES(ST_RENAME)),
873         sReadonlyIdx(SW_RES(ST_READONLY_IDX)),
874         sInvisible(SW_RES(ST_INVISIBLE)),
875 
876 	sPostItShow(SW_RES(ST_POSTIT_SHOW)),
877 	sPostItHide(SW_RES(ST_POSTIT_HIDE)),
878 	sPostItDelete(SW_RES(ST_POSTIT_DELETE)),
879 
880         pHiddenShell(0),
881 	pActiveShell(0),
882 	pConfig(SW_MOD()->GetNavigationConfig()),
883 
884         nActiveBlock(0),
885 	nHiddenBlock(0),
886 
887         nRootType(USHRT_MAX),
888         nLastSelType(USHRT_MAX),
889         nOutlineLevel(MAXLEVEL),
890 
891         bIsActive(sal_True),
892 		bIsConstant(sal_False),
893 		bIsHidden(sal_False),
894         bDocChgdInDragging(sal_False),
895 		bIsInternalDrag(sal_False),
896 		bIsRoot(sal_False),
897 		bIsIdleClear(sal_False),
898 		bIsLastReadOnly(sal_False),
899 		bIsOutlineMoveable(sal_True),
900 		bViewHasChanged(sal_False),
901 		bIsImageListInitialized(sal_False),
902 		bIsKeySpace(sal_False) //IAccessibility2 Implementation 2009
903 {
904 	sal_uInt16 i;
905 
906 	SetHelpId(HID_NAVIGATOR_TREELIST);
907 
908 	SetNodeDefaultImages();
909 	SetDoubleClickHdl(LINK(this, SwContentTree, ContentDoubleClickHdl));
910 	SetDragDropMode(SV_DRAGDROP_APP_COPY);
911 	for( i = 0; i < CONTENT_TYPE_MAX; i++)
912 	{
913 		aActiveContentArr[i] 	= 0;
914 		aHiddenContentArr[i] 	= 0;
915 	}
916 	for( i = 0; i < CONTEXT_COUNT; i++  )
917 	{
918 		aContextStrings[i] = SW_RESSTR(i+ST_CONTEXT_FIRST);
919 	}
920 	nActiveBlock = pConfig->GetActiveBlock();
921 	aUpdTimer.SetTimeoutHdl(LINK(this, SwContentTree, TimerUpdate));
922 	aUpdTimer.SetTimeout(1000);
923 	Clear();
924     EnableContextMenuHandling();
925     SetStyle( GetStyle() | WB_QUICK_SEARCH );
926 }
927 
928 /***************************************************************************
929 	Beschreibung:
930 ***************************************************************************/
931 
932 
933 SwContentTree::~SwContentTree()
934 {
935 	Clear(); // vorher gfs. Inhaltstypen loeschen
936 	bIsInDrag = sal_False;
937 }
938 
939 //IAccessibility2 Implementation 2009-----
940 String SwContentTree::GetEntryAltText( SvLBoxEntry* pEntry ) const
941 {
942 	if( pEntry == NULL)
943 		return String();
944 
945 	SwContent* pCnt = (SwContent*)pEntry->GetUserData();
946 	if( pCnt == NULL || pCnt->GetParent() == NULL)
947 		return String();
948 
949 	sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
950 	SdrObject* pTemp;
951 
952 	switch(nJumpType)
953 	{
954 		case CONTENT_TYPE_DRAWOBJECT:
955 			{
956 				SdrView* pDrawView = pActiveShell->GetDrawView();
957 				if (pDrawView)
958 				{
959                     SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
960                     SdrPage* pPage = pDrawModel->GetPage(0);
961                     const sal_uInt32 nCount = pPage->GetObjCount();
962 					for( sal_uInt32 i=0; i< nCount; i++ )
963 					{
964 						pTemp = pPage->GetObj(i);
965 						sal_uInt16 nCmpId;
966 						switch( pTemp->GetObjIdentifier() )
967 						{
968 						case OBJ_GRUP:
969 						case OBJ_TEXT:
970 						case OBJ_TEXTEXT:
971 						case OBJ_wegFITTEXT:
972 						case OBJ_LINE:
973 						case OBJ_RECT:
974 							//caoxueqin added custom shape
975 						case OBJ_CUSTOMSHAPE:
976 							//end 2005/08/05
977 						case OBJ_CIRC:
978 						case OBJ_SECT:
979 						case OBJ_CARC:
980 						case OBJ_CCUT:
981 						case OBJ_POLY:
982 						case OBJ_PLIN:
983 						case OBJ_PATHLINE:
984 						case OBJ_PATHFILL:
985 						case OBJ_FREELINE:
986 						case OBJ_FREEFILL:
987 						case OBJ_PATHPOLY:
988 						case OBJ_PATHPLIN:
989 						case OBJ_CAPTION:
990 							nCmpId = OBJ_GRUP;
991 							break;
992 						default:
993 							nCmpId = pTemp->GetObjIdentifier();
994 						}
995 						if(nCmpId == OBJ_GRUP /*pTemp->ISA(SdrObjGroup)*/ && pTemp->GetName() == pCnt->GetName())
996 						{
997 							return pTemp->GetTitle();
998 						}
999 						//Commented End
1000 					}
1001 				}
1002 			}
1003 			break;
1004 		case CONTENT_TYPE_GRAPHIC   :
1005 			{
1006 				if( pActiveShell && pActiveShell->GetDoc() )
1007 				{
1008 					const SwFlyFrmFmt* pFrmFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
1009 					if( pFrmFmt )
1010 					{
1011 //                        SwNodeIndex aIdx( *(pFrmFmt->GetCntnt().GetCntntIdx()), 1 );
1012 //                        const SwGrfNode* pGrfNd = aIdx.GetNode().GetGrfNode();
1013 //                        if( pGrfNd )
1014 //                            return pGrfNd->GetAlternateText();
1015                         return pFrmFmt->GetObjTitle();
1016 					}
1017 				}
1018 			}
1019 			break;
1020 		case CONTENT_TYPE_OLE       :
1021 		case CONTENT_TYPE_FRAME     :
1022 			{
1023 				//Can't find the GetAlternateText function. Need to verify again.
1024 				const SwFlyFrmFmt* pFlyFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
1025 				if( pFlyFmt )
1026 					return pFlyFmt->/*GetAlternateText*/GetName();
1027 			}
1028 			break;
1029 	}
1030 	return String();
1031 }
1032 
1033 String SwContentTree::GetEntryLongDescription( SvLBoxEntry* pEntry ) const
1034 {
1035 	if( pEntry == NULL)
1036 		return String();
1037 
1038 	SwContent* pCnt = (SwContent*)pEntry->GetUserData();
1039 	if( pCnt == NULL || pCnt->GetParent() == NULL)
1040 		return String();
1041 
1042 	sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
1043 	SdrObject* pTemp;
1044 
1045 	switch(nJumpType)
1046 	{
1047 		case CONTENT_TYPE_DRAWOBJECT:
1048 			{
1049 				SdrView* pDrawView = pActiveShell->GetDrawView();
1050 				if (pDrawView)
1051 				{
1052                     SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
1053                     SdrPage* pPage = pDrawModel->GetPage(0);
1054 					sal_uInt32 nCount = pPage->GetObjCount();
1055 					for( sal_uInt32 i=0; i< nCount; i++ )
1056 					{
1057 						pTemp = pPage->GetObj(i);
1058 						sal_uInt16 nCmpId;
1059 						switch( pTemp->GetObjIdentifier() )
1060 						{
1061 						case OBJ_GRUP:
1062 						case OBJ_TEXT:
1063 						case OBJ_TEXTEXT:
1064 						case OBJ_wegFITTEXT:
1065 						case OBJ_LINE:
1066 						case OBJ_RECT:
1067 							//caoxueqin added custom shape
1068 						case OBJ_CUSTOMSHAPE:
1069 							//end 2005/08/05
1070 						case OBJ_CIRC:
1071 						case OBJ_SECT:
1072 						case OBJ_CARC:
1073 						case OBJ_CCUT:
1074 						case OBJ_POLY:
1075 						case OBJ_PLIN:
1076 						case OBJ_PATHLINE:
1077 						case OBJ_PATHFILL:
1078 						case OBJ_FREELINE:
1079 						case OBJ_FREEFILL:
1080 						case OBJ_PATHPOLY:
1081 						case OBJ_PATHPLIN:
1082 						case OBJ_CAPTION:
1083 							nCmpId = OBJ_GRUP;
1084 							break;
1085 						default:
1086 							nCmpId = pTemp->GetObjIdentifier();
1087 						}
1088 						if(nCmpId == OBJ_GRUP /*pTemp->ISA(SdrObjGroup)*/ && pTemp->GetName() == pCnt->GetName())
1089 						{
1090 							return pTemp->GetDescription();
1091 						}
1092 						//Commented End
1093 					}
1094 				}
1095 			}
1096 			break;
1097 		case CONTENT_TYPE_GRAPHIC   :
1098 		case CONTENT_TYPE_OLE       :
1099 		case CONTENT_TYPE_FRAME     :
1100 			{
1101 				//Can't find the function "GetLongDescription". Need to verify again.
1102 				const SwFlyFrmFmt* pFlyFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
1103 				if( pFlyFmt )
1104 					return pFlyFmt->GetDescription();
1105 			}
1106 			break;
1107 	}
1108 	return String();
1109 }
1110 
1111 //-----IAccessibility2 Implementation 2009
1112 /***************************************************************************
1113 	Drag&Drop methods
1114 ***************************************************************************/
1115 
1116 void SwContentTree::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
1117 {
1118 	if( !bIsRoot || nRootType != CONTENT_TYPE_OUTLINE )
1119 	{
1120 		ReleaseMouse();
1121 
1122 		TransferDataContainer* pContainer = new TransferDataContainer;
1123         uno::Reference<
1124             datatransfer::XTransferable > xRef( pContainer );
1125 
1126 		sal_Int8 nDragMode = DND_ACTION_COPYMOVE | DND_ACTION_LINK;
1127 		if( FillTransferData( *pContainer, nDragMode ))
1128 		{
1129 			SwContentTree::SetInDrag(sal_True);
1130 			pContainer->StartDrag( this, nDragMode, GetDragFinishedHdl() );
1131 		}
1132 	}
1133 	else
1134 		SvTreeListBox::StartDrag( nAction, rPosPixel );
1135 }
1136 
1137 void SwContentTree::DragFinished( sal_Int8 nAction )
1138 {
1139     //to prevent the removing of the selected entry in external drag and drop
1140     // the drag action mustn't be MOVE
1141     SvTreeListBox::DragFinished( bIsInternalDrag ? nAction : DND_ACTION_COPY );
1142 	SwContentTree::SetInDrag(sal_False);
1143 	bIsInternalDrag = sal_False;
1144 }
1145 
1146 /***************************************************************************
1147 	Beschreibung:   QueryDrop wird im Navigator ausgefuehrt
1148 ***************************************************************************/
1149 sal_Int8 SwContentTree::AcceptDrop( const AcceptDropEvent& rEvt )
1150 {
1151 	sal_Int8 nRet = DND_ACTION_NONE;
1152 	if( bIsRoot )
1153 	{
1154 		if( bIsOutlineMoveable )
1155 			nRet = SvTreeListBox::AcceptDrop( rEvt );
1156 	}
1157 	else if( !bIsInDrag )
1158 		nRet = GetParentWindow()->AcceptDrop( rEvt );
1159 	return nRet;
1160 }
1161 
1162 /***************************************************************************
1163 	Beschreibung:	Drop wird im Navigator ausgefuehrt
1164 ***************************************************************************/
1165 sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt )
1166 {
1167 	if( bIsRoot )
1168 		return SvTreeListBox::ExecuteDrop( rEvt );
1169 	return bIsInDrag ? DND_ACTION_NONE : GetParentWindow()->ExecuteDrop(rEvt);
1170 }
1171 
1172 
1173 /***************************************************************************
1174 	Beschreibung:	Handler fuer Dragging und ContextMenu
1175 ***************************************************************************/
1176 PopupMenu* SwContentTree::CreateContextMenu( void )
1177 {
1178     PopupMenu* pPop = new PopupMenu;
1179     PopupMenu* pSubPop1 = new PopupMenu;
1180     PopupMenu* pSubPop2 = new PopupMenu;
1181     PopupMenu* pSubPop3 = new PopupMenu;
1182     PopupMenu* pSubPop4 = new PopupMenu; // Edit
1183 
1184     sal_uInt16 i;
1185     for(i = 1; i <= MAXLEVEL; i++ )
1186     {
1187         pSubPop1->InsertItem( i + 100, String::CreateFromInt32(i));
1188     }
1189     pSubPop1->CheckItem(100 + nOutlineLevel);
1190     for(i=0; i < 3; i++ )
1191     {
1192         pSubPop2->InsertItem( i + 201, aContextStrings[
1193                 ST_HYPERLINK - ST_CONTEXT_FIRST + i]);
1194     }
1195     pSubPop2->CheckItem( 201 +
1196                     GetParentWindow()->GetRegionDropMode());
1197     //Liste der offenen Dateien einfuegen
1198     sal_uInt16 nId = 301;
1199     const SwView* pActiveView = ::GetActiveView();
1200     SwView *pView = SwModule::GetFirstView();
1201     while (pView)
1202     {
1203         String sInsert = pView->GetDocShell()->GetTitle();
1204         if(pView == pActiveView)
1205         {
1206             sInsert += '(';
1207             sInsert += aContextStrings[ ST_ACTIVE - ST_CONTEXT_FIRST];
1208             sInsert += ')';
1209         }
1210         pSubPop3->InsertItem(nId, sInsert);
1211         if(bIsConstant && pActiveShell == &pView->GetWrtShell())
1212             pSubPop3->CheckItem(nId);
1213         pView = SwModule::GetNextView(pView);
1214         nId++;
1215     }
1216     pSubPop3->InsertItem(nId++, aContextStrings[ST_ACTIVE_VIEW - ST_CONTEXT_FIRST]);
1217     if(pHiddenShell)
1218     {
1219         String sHiddenEntry = pHiddenShell->GetView().GetDocShell()->GetTitle();
1220         sHiddenEntry += C2S(" ( ");
1221         sHiddenEntry += aContextStrings[ ST_HIDDEN - ST_CONTEXT_FIRST];
1222         sHiddenEntry += C2S(" )");
1223         pSubPop3->InsertItem(nId, sHiddenEntry);
1224     }
1225 
1226     if(bIsActive)
1227         pSubPop3->CheckItem( --nId );
1228     else if(bIsHidden)
1229         pSubPop3->CheckItem( nId );
1230 
1231     pPop->InsertItem( 1, aContextStrings[ST_OUTLINE_LEVEL - ST_CONTEXT_FIRST]);
1232     pPop->InsertItem(2, aContextStrings[ST_DRAGMODE - ST_CONTEXT_FIRST]);
1233     pPop->InsertItem(3, aContextStrings[ST_DISPLAY - ST_CONTEXT_FIRST]);
1234     //jetzt noch bearbeiten
1235     SvLBoxEntry* pEntry = 0;
1236     //Bearbeiten nur, wenn die angezeigten Inhalte aus der aktiven View kommen
1237     if((bIsActive || pActiveShell == pActiveView->GetWrtShellPtr())
1238             && 0 != (pEntry = FirstSelected()) && lcl_IsContent(pEntry))
1239     {
1240         const SwContentType* pContType = ((SwContent*)pEntry->GetUserData())->GetParent();
1241         const sal_uInt16 nContentType = pContType->GetType();
1242         sal_Bool bReadonly = pActiveShell->GetView().GetDocShell()->IsReadOnly();
1243         sal_Bool bVisible = !((SwContent*)pEntry->GetUserData())->IsInvisible();
1244         sal_Bool bProtected = ((SwContent*)pEntry->GetUserData())->IsProtect();
1245         sal_Bool bEditable = pContType->IsEditable() &&
1246             ((bVisible && !bProtected) ||CONTENT_TYPE_REGION == nContentType);
1247         sal_Bool bDeletable = pContType->IsDeletable() &&
1248             ((bVisible && !bProtected) ||CONTENT_TYPE_REGION == nContentType);
1249         sal_Bool bRenamable = bEditable && !bReadonly &&
1250             (CONTENT_TYPE_TABLE == nContentType ||
1251                 CONTENT_TYPE_FRAME == nContentType ||
1252                 CONTENT_TYPE_GRAPHIC == nContentType ||
1253                 CONTENT_TYPE_OLE == nContentType ||
1254                 CONTENT_TYPE_BOOKMARK == nContentType ||
1255                 CONTENT_TYPE_REGION == nContentType||
1256                 CONTENT_TYPE_INDEX == nContentType);
1257 
1258         if(!bReadonly && (bEditable || bDeletable))
1259         {
1260             sal_Bool bSubPop4 = sal_False;
1261             if(CONTENT_TYPE_INDEX == nContentType)
1262             {
1263                 bSubPop4 = sal_True;
1264                 pSubPop4->InsertItem(401, sRemoveIdx);
1265                 pSubPop4->InsertItem(402, sUpdateIdx);
1266 
1267                 const SwTOXBase* pBase = ((SwTOXBaseContent*)pEntry->GetUserData())->GetTOXBase();
1268                 if(!pBase->IsTOXBaseInReadonly())
1269                     pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]);
1270                 pSubPop4->InsertItem(405, sReadonlyIdx);
1271 
1272                 pSubPop4->CheckItem( 405, pActiveShell->IsTOXBaseReadonly(*pBase));
1273                 pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]);
1274             }
1275             else if(CONTENT_TYPE_TABLE == nContentType && !bReadonly)
1276             {
1277                 bSubPop4 = sal_True;
1278                 pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]);
1279                 pSubPop4->InsertItem(404, sUnprotTbl);
1280                 sal_Bool bFull = sal_False;
1281                 String sTblName = ((SwContent*)pEntry->GetUserData())->GetName();
1282                 sal_Bool bProt =pActiveShell->HasTblAnyProtection( &sTblName, &bFull );
1283                 pSubPop4->EnableItem(403, !bFull );
1284                 pSubPop4->EnableItem(404, bProt );
1285                 pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]);
1286             }
1287             else if(bEditable || bDeletable)
1288             {
1289 
1290 				if(bEditable && bDeletable)
1291                 {
1292                     pSubPop4->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]);
1293                     pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]);
1294                     bSubPop4 = sal_True;
1295                 }
1296                 else if(bEditable)
1297                     pPop->InsertItem(403, aContextStrings[ST_EDIT_ENTRY - ST_CONTEXT_FIRST]);
1298                 else if(bDeletable)
1299 				{
1300                     pSubPop4->InsertItem(501, aContextStrings[ST_DELETE_ENTRY - ST_CONTEXT_FIRST]);
1301 				}
1302             }
1303             //Rename object
1304             if(bRenamable)
1305             {
1306                 if(bSubPop4)
1307                     pSubPop4->InsertItem(502, sRename);
1308                 else
1309                     pPop->InsertItem(502, sRename);
1310             }
1311 
1312             if(bSubPop4)
1313             {
1314                 pPop->InsertItem(4, pContType->GetSingleName());
1315                 pPop->SetPopupMenu(4, pSubPop4);
1316             }
1317         }
1318     }
1319     else if( pEntry )
1320 	{
1321 		SwContentType* pType = (SwContentType*)pEntry->GetUserData();
1322 		if ( (pType->GetType() == CONTENT_TYPE_POSTIT) &&  (!pActiveShell->GetView().GetDocShell()->IsReadOnly()) && ( pType->GetMemberCount() > 0) )
1323 		{
1324 				pSubPop4->InsertItem(600, sPostItShow );
1325 				pSubPop4->InsertItem(601, sPostItHide );
1326 				pSubPop4->InsertItem(602, sPostItDelete );
1327 				/*
1328 				pSubPop4->InsertItem(603,rtl::OUString::createFromAscii("Sort"));
1329 				PopupMenu* pMenuSort = new PopupMenu;
1330 				pMenuSort->InsertItem(604,rtl::OUString::createFromAscii("By Position"));
1331 				pMenuSort->InsertItem(605,rtl::OUString::createFromAscii("By Author"));
1332 				pMenuSort->InsertItem(606,rtl::OUString::createFromAscii("By Date"));
1333 				pSubPop4->SetPopupMenu(603, pMenuSort);
1334 				*/
1335 			    pPop->InsertItem(4, pType->GetSingleName());
1336                 pPop->SetPopupMenu(4, pSubPop4);
1337 		}
1338 	}
1339 
1340     pPop->SetPopupMenu( 1, pSubPop1 );
1341     pPop->SetPopupMenu( 2, pSubPop2 );
1342     pPop->SetPopupMenu( 3, pSubPop3 );
1343     return pPop;
1344 
1345 }
1346 /***************************************************************************
1347 	Beschreibung:	Einrueckung fuer outlines (und sections)
1348 ***************************************************************************/
1349 
1350 
1351 long	SwContentTree::GetTabPos( SvLBoxEntry* pEntry, SvLBoxTab* pTab)
1352 {
1353 	sal_uInt16 nLevel = 0;
1354 	if(lcl_IsContent(pEntry))
1355 	{
1356 		nLevel++;
1357 		SwContent* pCnt = (SwContent *) pEntry->GetUserData();
1358 		const SwContentType*	pParent;
1359 		if(pCnt &&	0 != (pParent = pCnt->GetParent()))
1360 		{
1361 			if(pParent->GetType() == CONTENT_TYPE_OUTLINE)
1362                 nLevel = nLevel + ((SwOutlineContent*)pCnt)->GetOutlineLevel();
1363 			else if(pParent->GetType() == CONTENT_TYPE_REGION)
1364                 nLevel = nLevel + ((SwRegionContent*)pCnt)->GetRegionLevel();
1365 		}
1366 	}
1367 	sal_uInt16 nBasis = bIsRoot ? 0 : 5;
1368 	return nLevel * 10 + nBasis + pTab->GetPos();  //empirisch ermittelt
1369 }
1370 
1371 /***************************************************************************
1372 	Beschreibung:	Inhalte werden erst auf Anforderung in die Box eingefuegt
1373 ***************************************************************************/
1374 
1375 
1376 void  SwContentTree::RequestingChilds( SvLBoxEntry* pParent )
1377 {
1378 	// ist es ein Inhaltstyp?
1379 	if(lcl_IsContentType(pParent))
1380 	{
1381 		if(!pParent->HasChilds())
1382 		{
1383 			DBG_ASSERT(pParent->GetUserData(), "keine UserData?");
1384 			SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
1385 
1386 			sal_uInt16 nCount = pCntType->GetMemberCount();
1387 			for(sal_uInt16 i = 0; i < nCount; i++)
1388 			{
1389 				const SwContent* pCnt = pCntType->GetMember(i);
1390 				if(pCnt)
1391 				{
1392 					String sEntry = pCnt->GetName();
1393 					if(!sEntry.Len())
1394 						sEntry = sSpace;
1395 					SvLBoxEntry* pChild = InsertEntry(sEntry, pParent,
1396 							sal_False, LIST_APPEND, (void*)pCnt);
1397 					//IAccessibility2 Implementation 2009-----
1398 					//Solution: If object is marked , the corresponding entry is set true ,
1399 					//else the corresponding entry is set false .
1400 					//==================================================
1401 					SdrObject * pObj = GetDrawingObjectsByContent(pCnt);
1402 					if(pChild)
1403 					      pChild->SetMarked(sal_False);
1404 					if(pObj)
1405 					{
1406 						SdrView* pDrawView = pActiveShell->GetDrawView();
1407 						SdrPageView* pPV = pDrawView->/*GetPageViewPvNum*/GetSdrPageView(/*0*/);
1408 						if( pPV )
1409 						{
1410 							sal_Bool Marked = pDrawView->IsObjMarked(pObj);
1411 							if(Marked)
1412 							{
1413 								//sEntry += String::CreateFromAscii(" *");
1414 								pChild->SetMarked(sal_True);
1415 							}
1416 
1417 						}
1418 					}
1419 					//-----IAccessibility2 Implementation 2009
1420 				}
1421 			}
1422 		}
1423 	}
1424 }
1425 /***************************************************************************
1426 	Beschreibung:	Expand - Zustand fuer Inhaltstypen merken
1427 ***************************************************************************/
1428 
1429 //IAccessibility2 Implementation 2009-----
1430 //Solution: Get drawing Objects by content .
1431 SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt)
1432 {
1433 	SdrObject *pRetObj = NULL;
1434 	sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
1435 	switch(nJumpType)
1436 	{
1437 		case CONTENT_TYPE_DRAWOBJECT:
1438 		{
1439 			SdrView* pDrawView = pActiveShell->GetDrawView();
1440 			if (pDrawView)
1441 			{
1442                 SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
1443                 SdrPage* pPage = pDrawModel->GetPage(0);
1444 				sal_uInt32 nCount = pPage->GetObjCount();
1445 
1446 				for( sal_uInt32 i=0; i< nCount; i++ )
1447 				{
1448 					SdrObject* pTemp = pPage->GetObj(i);
1449 					if( pTemp->GetName() == pCnt->GetName())
1450 					{
1451 						pRetObj = pTemp;
1452 						break;
1453 					}
1454 				}
1455 			}
1456 			break;
1457 		}
1458 		default:
1459 			pRetObj = NULL;
1460 	}
1461 	return pRetObj;
1462 }
1463 //-----IAccessibility2 Implementation 2009
1464 
1465 sal_Bool  SwContentTree::Expand( SvLBoxEntry* pParent )
1466 {
1467 	if(!bIsRoot)
1468 	{
1469 		if(lcl_IsContentType(pParent))
1470 		{
1471 			SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
1472 			sal_uInt16 nOr = 1 << pCntType->GetType(); //linear -> Bitposition
1473 			if(bIsActive || bIsConstant)
1474 			{
1475 				nActiveBlock |= nOr;
1476 				pConfig->SetActiveBlock(nActiveBlock);
1477 			}
1478 			else
1479 				nHiddenBlock |= nOr;
1480 		}
1481 	}
1482 	return SvTreeListBox::Expand(pParent);
1483 }
1484 /***************************************************************************
1485 	Beschreibung:	Collapse - Zustand fuer Inhaltstypen merken
1486 ***************************************************************************/
1487 
1488 
1489 sal_Bool  SwContentTree::Collapse( SvLBoxEntry* pParent )
1490 {
1491 	sal_Bool bRet;
1492 	if(!bIsRoot)
1493 	{
1494 		if(lcl_IsContentType(pParent))
1495 		{
1496 			SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
1497 			sal_uInt16 nAnd = 1 << pCntType->GetType();
1498 			nAnd = ~nAnd;
1499 			if(bIsActive || bIsConstant)
1500 			{
1501 				nActiveBlock &= nAnd;
1502 				pConfig->SetActiveBlock(nActiveBlock);
1503 			}
1504 			else
1505 				nHiddenBlock &= nAnd;
1506 		}
1507 			bRet = SvTreeListBox::Collapse(pParent);
1508 	}
1509 	else
1510 		bRet = sal_False;
1511 	return bRet;
1512 }
1513 
1514 
1515 /***************************************************************************
1516 	Beschreibung:	Auch auf Doppelclick wird zunaechst nur aufgeklappt
1517 ***************************************************************************/
1518 
1519 
1520 IMPL_LINK( SwContentTree, ContentDoubleClickHdl, SwContentTree *, EMPTYARG )
1521 {
1522 	SvLBoxEntry* pEntry = GetCurEntry();
1523 	// ist es ein Inhaltstyp?
1524 	DBG_ASSERT(pEntry, "kein aktueller Eintrag!");
1525 	if(pEntry)
1526 	{
1527 		if(lcl_IsContentType(pEntry))
1528 			RequestingChilds(pEntry);
1529 		else if(bIsActive || bIsConstant)
1530 		{
1531 			if(bIsConstant)
1532 			{
1533 				pActiveShell->GetView().GetViewFrame()->GetWindow().ToTop();
1534 			}
1535 			//Inhaltstyp anspringen:
1536 			SwContent* pCnt = (SwContent*)pEntry->GetUserData();
1537 			DBG_ASSERT( pCnt, "keine UserData");
1538 			GotoContent(pCnt);
1539 			if(pCnt->GetParent()->GetType()	== CONTENT_TYPE_FRAME)
1540 				pActiveShell->EnterStdMode();
1541 		}
1542 	}
1543 	return 0;
1544 }
1545 
1546 /***************************************************************************
1547 	Beschreibung:	Anzeigen der Datei
1548 ***************************************************************************/
1549 
1550 
1551 void SwContentTree::Display( sal_Bool bActive )
1552 {
1553 	if(!bIsImageListInitialized)
1554 	{
1555         sal_uInt16 nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP;
1556         aEntryImages = ImageList(SW_RES(nResId));
1557 		bIsImageListInitialized = sal_True;
1558 	}
1559 	// erst den selektierten Eintrag auslesen, um ihn spaeter evtl. wieder
1560 	// zu selektieren -> die UserDaten sind hier nicht mehr gueltig!
1561 	SvLBoxEntry* pOldSelEntry = FirstSelected();
1562 	String sEntryName;	// Name des Eintrags
1563 	sal_uInt16 nEntryRelPos = 0; // rel. Pos zu seinem Parent
1564     sal_uInt32 nOldEntryCount = GetEntryCount();
1565     sal_Int32 nOldScrollPos = 0;
1566 	if(pOldSelEntry)
1567 	{
1568         ScrollBar* pVScroll = GetVScroll();
1569         if(pVScroll && pVScroll->IsVisible())
1570             nOldScrollPos = pVScroll->GetThumbPos();
1571 
1572         sEntryName = GetEntryText(pOldSelEntry);
1573 		if(GetParent(pOldSelEntry))
1574 		{
1575 			nEntryRelPos = (sal_uInt16)(GetModel()->GetAbsPos(pOldSelEntry) - GetModel()->GetAbsPos(GetParent(pOldSelEntry)));
1576 		}
1577 	}
1578 	Clear();
1579 	SetUpdateMode( sal_False );
1580 	if(bActive && !bIsConstant && !bIsActive)
1581 		bIsActive = bActive;
1582 	bIsHidden = !bActive;
1583 	SwWrtShell* pShell = GetWrtShell();
1584 	sal_Bool bReadOnly = pShell ? pShell->GetView().GetDocShell()->IsReadOnly() : sal_True;
1585 	if(bReadOnly != bIsLastReadOnly)
1586 	{
1587 		bIsLastReadOnly = bReadOnly;
1588 		sal_Bool bDisable =  pShell == 0 || bReadOnly;
1589 		SwNavigationPI* pNavi = GetParentWindow();
1590 		pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , !bDisable);
1591 		pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, !bDisable);
1592 		pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, !bDisable);
1593 		pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT, !bDisable);
1594 		pNavi->aContentToolBox.EnableItem(FN_SELECT_SET_AUTO_BOOKMARK, !bDisable);
1595 	}
1596 	if(pShell)
1597 	{
1598 		SvLBoxEntry* pSelEntry = 0;
1599 		if(nRootType == USHRT_MAX)
1600 		{
1601 			for(sal_uInt16 nCntType = CONTENT_TYPE_OUTLINE;
1602                         nCntType <= CONTENT_TYPE_DRAWOBJECT; nCntType++ )
1603 			{
1604 				SwContentType** ppContentT = bActive ?
1605 								&aActiveContentArr[nCntType] :
1606 									&aHiddenContentArr[nCntType];
1607 				if(!*ppContentT)
1608 					(*ppContentT) = new SwContentType(pShell, nCntType, nOutlineLevel );
1609 
1610 
1611 				String sEntry = (*ppContentT)->GetName();
1612 				SvLBoxEntry* pEntry;
1613 				const Image& rImage = aEntryImages.GetImage(SID_SW_START + nCntType);
1614 				sal_Bool bChOnDemand = 0 != (*ppContentT)->GetMemberCount();
1615 				pEntry = InsertEntry(sEntry, rImage, rImage,
1616 								0, bChOnDemand, LIST_APPEND, (*ppContentT));
1617 				if(nCntType == nLastSelType)
1618 					pSelEntry = pEntry;
1619                 sal_Int32 nExpandOptions = bIsActive || bIsConstant ?
1620 											nActiveBlock :
1621 												nHiddenBlock;
1622 				if(nExpandOptions & (1 << nCntType))
1623 				{
1624 					Expand(pEntry);
1625 					if(nEntryRelPos && nCntType == nLastSelType)
1626 					{
1627 						// jetzt vielleicht noch ein Child selektieren
1628 						SvLBoxEntry* pChild = pEntry;
1629 						SvLBoxEntry* pTemp = 0;
1630 						sal_uInt16 nPos = 1;
1631 						while(0 != (pChild = Next(pChild)))
1632 						{
1633 							// der alte Text wird leicht bevorzugt
1634 							if(sEntryName == GetEntryText(pChild) ||
1635 								nPos == nEntryRelPos )
1636 							{
1637 								pSelEntry = pChild;
1638 								break;
1639 							}
1640 							pTemp = pChild;
1641 							nPos++;
1642 						}
1643 						if(!pSelEntry || lcl_IsContentType(pSelEntry))
1644 							pSelEntry = pTemp;
1645 					}
1646 
1647 				}
1648 			}
1649 			if(pSelEntry)
1650 			{
1651 				MakeVisible(pSelEntry);
1652 				Select(pSelEntry);
1653             }
1654             else
1655                 nOldScrollPos = 0;
1656 		}
1657 		else
1658 		{
1659 			SwContentType** ppRootContentT = bActive ?
1660 								&aActiveContentArr[nRootType] :
1661 									&aHiddenContentArr[nRootType];
1662 			if(!(*ppRootContentT))
1663 				(*ppRootContentT) = new SwContentType(pShell, nRootType, nOutlineLevel );
1664 			const Image& rImage = aEntryImages.GetImage(20000 + nRootType);
1665 			SvLBoxEntry* pParent = InsertEntry(
1666 					(*ppRootContentT)->GetName(), rImage, rImage,
1667 						0, sal_False, LIST_APPEND, *ppRootContentT);
1668 
1669 			for(sal_uInt16 i = 0; i < (*ppRootContentT)->GetMemberCount(); i++ )
1670 			{
1671 				const SwContent* pCnt = (*ppRootContentT)->GetMember(i);
1672 				if(pCnt)
1673 				{
1674 					String sEntry = pCnt->GetName();
1675 					if(!sEntry.Len())
1676 						sEntry = sSpace;
1677                     InsertEntry( sEntry, pParent,
1678 								sal_False, LIST_APPEND, (void*)pCnt);
1679 				}
1680 			}
1681 			Expand(pParent);
1682 			if( nRootType == CONTENT_TYPE_OUTLINE && bIsActive )
1683 			{
1684 				//feststellen, wo der Cursor steht
1685 				const sal_uInt16 nActPos = pShell->GetOutlinePos(MAXLEVEL);
1686 				SvLBoxEntry* pEntry = First();
1687 
1688 				while( 0 != (pEntry = Next(pEntry)) )
1689 				{
1690 					if(((SwOutlineContent*)pEntry->GetUserData())->GetPos() == nActPos)
1691 					{
1692 						MakeVisible(pEntry);
1693 						Select(pEntry);
1694 					}
1695 				}
1696 
1697 			}
1698 			else
1699 			{
1700 				// jetzt vielleicht noch ein Child selektieren
1701 				SvLBoxEntry* pChild = pParent;
1702 				SvLBoxEntry* pTemp = 0;
1703 				sal_uInt16 nPos = 1;
1704 				while(0 != (pChild = Next(pChild)))
1705 				{
1706 					// der alte Text wird leicht bevorzugt
1707 					if(sEntryName == GetEntryText(pChild) ||
1708 						nPos == nEntryRelPos )
1709 					{
1710 						pSelEntry = pChild;
1711 						break;
1712 					}
1713 					pTemp = pChild;
1714 					nPos++;
1715 				}
1716 				if(!pSelEntry)
1717 					pSelEntry = pTemp;
1718 				if(pSelEntry)
1719 				{
1720 					MakeVisible(pSelEntry);
1721 					Select(pSelEntry);
1722 				}
1723 			}
1724 		}
1725 	}
1726 	SetUpdateMode( sal_True );
1727     ScrollBar* pVScroll = GetVScroll();
1728     if(GetEntryCount() == nOldEntryCount &&
1729         nOldScrollPos && pVScroll && pVScroll->IsVisible()
1730         && pVScroll->GetThumbPos() != nOldScrollPos)
1731     {
1732         sal_Int32 nDelta = pVScroll->GetThumbPos() - nOldScrollPos;
1733         ScrollOutputArea( (short)nDelta );
1734     }
1735 
1736 }
1737 
1738 /***************************************************************************
1739 	Beschreibung:	Im Clear muessen auch die ContentTypes geloescht werden
1740 ***************************************************************************/
1741 
1742 
1743 void SwContentTree::Clear()
1744 {
1745 	SetUpdateMode(sal_False);
1746 	SvTreeListBox::Clear();
1747 	SetUpdateMode(sal_True);
1748 }
1749 
1750 /***************************************************************************
1751 	Beschreibung:
1752 ***************************************************************************/
1753 
1754 sal_Bool SwContentTree::FillTransferData( TransferDataContainer& rTransfer,
1755 											sal_Int8& rDragMode )
1756 {
1757 	SwWrtShell* pWrtShell = GetWrtShell();
1758 	DBG_ASSERT(pWrtShell, "keine Shell!");
1759 	SvLBoxEntry* pEntry = GetCurEntry();
1760 	if(!pEntry || lcl_IsContentType(pEntry) || !pWrtShell)
1761 		return sal_False;
1762 	String sEntry;
1763 	SwContent* pCnt = ((SwContent*)pEntry->GetUserData());
1764 
1765 	sal_uInt16 nActType = pCnt->GetParent()->GetType();
1766 	String sUrl;
1767 	sal_Bool bOutline = sal_False;
1768 	String sOutlineText;
1769 	switch( nActType )
1770 	{
1771 		case CONTENT_TYPE_OUTLINE:
1772 		{
1773 			sal_uInt16 nPos = ((SwOutlineContent*)pCnt)->GetPos();
1774             DBG_ASSERT(nPos < pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNodesCount(),
1775                        "outlinecnt veraendert");
1776 
1777             // #100738# make sure outline may actually be copied
1778             if( pWrtShell->IsOutlineCopyable( nPos ) )
1779             {
1780                 const SwNumRule* pOutlRule = pWrtShell->GetOutlineNumRule();
1781                 const SwTxtNode* pTxtNd =
1782                         pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineNode(nPos);
1783                 if( pTxtNd && pOutlRule && pTxtNd->IsNumbered())
1784                 {
1785                     SwNumberTree::tNumberVector aNumVector =
1786                         pTxtNd->GetNumberVector();
1787                     for( sal_Int8 nLevel = 0;
1788                          nLevel <= pTxtNd->GetActualListLevel();
1789                          nLevel++ )
1790                     {
1791                         sal_uInt16 nVal = (sal_uInt16)aNumVector[nLevel];
1792                         nVal ++;
1793                         nVal = nVal - pOutlRule->Get(nLevel).GetStart();
1794                         sEntry += String::CreateFromInt32( nVal );
1795                         sEntry += '.';
1796                     }
1797                 }
1798                 sEntry += pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, false);
1799                 sOutlineText = pWrtShell->getIDocumentOutlineNodesAccess()->getOutlineText(nPos, true);
1800                 bIsOutlineMoveable = ((SwOutlineContent*)pCnt)->IsMoveable();
1801                 bOutline = sal_True;
1802             }
1803 		}
1804 		break;
1805 		case CONTENT_TYPE_POSTIT:
1806 		case CONTENT_TYPE_INDEX:
1807 		case CONTENT_TYPE_REFERENCE :
1808 			// koennen weder als URL noch als Bereich eingefuegt werden
1809 		break;
1810 		case CONTENT_TYPE_URLFIELD:
1811 			sUrl = ((SwURLFieldContent*)pCnt)->GetURL();
1812 		// kein break;
1813 		case CONTENT_TYPE_OLE:
1814 		case CONTENT_TYPE_GRAPHIC:
1815 			if(GetParentWindow()->GetRegionDropMode() != REGION_MODE_NONE)
1816 				break;
1817 			else
1818 				rDragMode &= ~( DND_ACTION_MOVE | DND_ACTION_LINK );
1819 		default:
1820 			sEntry = GetEntryText(pEntry);
1821 	}
1822 
1823 	sal_Bool bRet = sal_False;
1824 	if(sEntry.Len())
1825 	{
1826 		const SwDocShell* pDocShell = pWrtShell->GetView().GetDocShell();
1827 		if(!sUrl.Len())
1828 		{
1829 			if(pDocShell->HasName())
1830 			{
1831 				SfxMedium* pMedium = pDocShell->GetMedium();
1832 				sUrl = pMedium->GetURLObject().GetURLNoMark();
1833 				// nur, wenn primaer ein Link eingefuegt werden soll
1834 				bRet = sal_True;
1835 			}
1836 			else if(	nActType == CONTENT_TYPE_REGION ||
1837 						nActType == CONTENT_TYPE_BOOKMARK )
1838 			{
1839 				// fuer Bereich und Textmarken ist ein Link auch ohne
1840 				// Dateiname ins eigene Dokument erlaubt
1841 				bRet = sal_True;
1842 			}
1843 			else if(bIsConstant &&
1844 					( !::GetActiveView() ||
1845 						pActiveShell != ::GetActiveView()->GetWrtShellPtr()))
1846 			{
1847 				// Urls von inaktiven Views ohne Dateinamen koennen auch nicht
1848 				// gedraggt werden
1849 				bRet = sal_False;
1850 			}
1851 			else
1852 			{
1853 				bRet = GetParentWindow()->GetRegionDropMode() == REGION_MODE_NONE;
1854 				rDragMode = DND_ACTION_MOVE;
1855 			}
1856 
1857 			const String& rToken = pCnt->GetParent()->GetTypeToken();
1858 			sUrl += '#';
1859 			sUrl += sEntry;
1860 			if(rToken.Len())
1861 			{
1862 				sUrl += cMarkSeperator;
1863 				sUrl += rToken;
1864 			}
1865 		}
1866 		else
1867 			bRet = sal_True;
1868 
1869 		if( bRet )
1870 		{
1871 			//fuer Outlines muss in die Description der Ueberschrifttext mit der echten Nummer
1872 			if(bOutline)
1873 				sEntry = sOutlineText;
1874 
1875 			{
1876 				NaviContentBookmark aBmk( sUrl, sEntry,
1877 									GetParentWindow()->GetRegionDropMode(),
1878 									pDocShell);
1879 				aBmk.Copy( rTransfer );
1880 			}
1881 
1882 			// fuer fremde DocShells muss eine INetBookmark
1883 			// dazugeliefert werden
1884 			if( pDocShell->HasName() )
1885 			{
1886 				INetBookmark aBkmk( sUrl, sEntry );
1887 				rTransfer.CopyINetBookmark( aBkmk );
1888 			}
1889 		}
1890 	}
1891 	return bRet;
1892 }
1893 /***************************************************************************
1894 	Beschreibung:	Umschalten der Anzeige auf Root
1895 ***************************************************************************/
1896 
1897 
1898 sal_Bool SwContentTree::ToggleToRoot()
1899 {
1900 	if(!bIsRoot)
1901 	{
1902 		SvLBoxEntry* pEntry = GetCurEntry();
1903 		const SwContentType* pCntType;
1904 		if(pEntry)
1905 		{
1906 			if(lcl_IsContentType(pEntry))
1907 				pCntType = (SwContentType*)pEntry->GetUserData();
1908 			else
1909 				pCntType = ((SwContent*)pEntry->GetUserData())->GetParent();
1910 			nRootType = pCntType->GetType();
1911 			bIsRoot = sal_True;
1912 			Display(bIsActive || bIsConstant);
1913 		}
1914 	}
1915 	else
1916 	{
1917 		nRootType = USHRT_MAX;
1918 		bIsRoot = sal_False;
1919 		FindActiveTypeAndRemoveUserData();
1920 		Display(bIsActive || bIsConstant);
1921 	}
1922 	pConfig->SetRootType( nRootType );
1923 	GetParentWindow()->aContentToolBox.CheckItem(FN_SHOW_ROOT, bIsRoot);
1924 	return bIsRoot;
1925 }
1926 
1927 /***************************************************************************
1928 	Beschreibung:	Angezeigten Inhalt auf Gueltigkeit pruefen
1929 ***************************************************************************/
1930 
1931 
1932 sal_Bool SwContentTree::HasContentChanged()
1933 {
1934 /*
1935 	-Parallel durch das lokale Array und die Treelistbox laufen.
1936 	-Sind die Eintraege nicht expandiert, werden sie nur im Array verworfen
1937 	und der Contenttype wird als UserData neu gesetzt.
1938 	- ist der Root-Modus aktiv, wird nur dieser aktualisiert,
1939 	fuer die nicht angezeigten Inhaltstypen gilt:
1940 		die Memberliste wird geloescht und der Membercount aktualisiert
1941 	Wenn Inhalte ueberprueft werden, werden gleichzeitig die vorhanden
1942 	Memberlisten aufgefuellt. Sobald ein Unterschied auftritt wird nur noch
1943 	gefuellt und nicht mehr ueberprueft. Abschliessend wird die Box neu gefuellt.
1944 
1945 */
1946 
1947 	sal_Bool bRepaint = sal_False;
1948 	sal_Bool bInvalidate = sal_False;
1949 
1950 	if(!bIsActive && ! bIsConstant)
1951 	{
1952 		for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
1953 		{
1954 			if(aActiveContentArr[i])
1955 				aActiveContentArr[i]->Invalidate();
1956 		}
1957 	}
1958 	else if(bIsRoot)
1959 	{
1960 		sal_Bool bOutline = sal_False;
1961 		SvLBoxEntry* pEntry = First();
1962 		if(!pEntry)
1963 			bRepaint = sal_True;
1964 		else
1965 		{
1966 			sal_uInt16 nType = ((SwContentType*)pEntry->GetUserData())->GetType();
1967 			bOutline = nRootType == CONTENT_TYPE_OUTLINE;
1968 			SwContentType* pArrType = aActiveContentArr[nType];
1969 			if(!pArrType)
1970 				bRepaint = sal_True;
1971 			else
1972 			{
1973 				sal_uInt16 nSelLevel = USHRT_MAX;
1974 
1975 				SvLBoxEntry* pFirstSel;
1976 				if(bOutline &&
1977 						0 != ( pFirstSel = FirstSelected()) &&
1978 							lcl_IsContent(pFirstSel))
1979 				{
1980 					nSelLevel = ((SwOutlineContent*)pFirstSel->GetUserData())->GetOutlineLevel();
1981 					SwWrtShell* pSh = GetWrtShell();
1982 					sal_uInt16 nOutlinePos = pSh->GetOutlinePos(MAXLEVEL);
1983                     bRepaint |= nOutlinePos != USHRT_MAX &&
1984                                 pSh->getIDocumentOutlineNodesAccess()->getOutlineLevel(nOutlinePos) != nSelLevel;
1985 				}
1986 
1987 				pArrType->Init(&bInvalidate);
1988 				pArrType->FillMemberList();
1989 				pEntry->SetUserData((void*)pArrType);
1990 				if(!bRepaint)
1991 				{
1992 					if(GetChildCount(pEntry) != pArrType->GetMemberCount())
1993 							bRepaint = sal_True;
1994 					else
1995 					{
1996 						sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
1997 						for(sal_uInt16 j = 0; j < nChildCount; j++)
1998 						{
1999 							pEntry = Next(pEntry);
2000 							const SwContent* pCnt = pArrType->GetMember(j);
2001 							pEntry->SetUserData((void*)pCnt);
2002 							String sEntryText = GetEntryText(pEntry);
2003 							if( sEntryText != pCnt->GetName() &&
2004 								!(sEntryText == sSpace && !pCnt->GetName().Len()))
2005 								bRepaint = sal_True;
2006 						}
2007 					}
2008 				}
2009 			}
2010 		}
2011 		if( !bRepaint && bOutline )
2012 		{
2013 			//feststellen, wo der Cursor steht
2014 			const sal_uInt16 nActPos = GetWrtShell()->GetOutlinePos(MAXLEVEL);
2015             SvLBoxEntry* pFirstEntry = First();
2016 
2017             while( 0 != (pFirstEntry = Next(pFirstEntry)) )
2018 			{
2019                 if(((SwOutlineContent*)pFirstEntry->GetUserData())->GetPos() == nActPos)
2020 				{
2021                     if(FirstSelected() != pFirstEntry)
2022 					{
2023                         Select(pFirstEntry);
2024                         MakeVisible(pFirstEntry);
2025 					}
2026 				}
2027 			}
2028 
2029 		}
2030 
2031 	}
2032 	else
2033 	{
2034 		SvLBoxEntry* pEntry = First();
2035 		while ( pEntry )
2036 		{
2037 			sal_Bool bNext = sal_True; // mindestens ein Next muss sein
2038 			SwContentType* pTreeType = (SwContentType*)pEntry->GetUserData();
2039 			sal_uInt16 nType = pTreeType->GetType();
2040 			sal_uInt16 nTreeCount = pTreeType->GetMemberCount();
2041 			SwContentType* pArrType = aActiveContentArr[nType];
2042 			if(!pArrType)
2043 				bRepaint = sal_True;
2044 			else
2045 			{
2046 				pArrType->Init(&bInvalidate);
2047 				pEntry->SetUserData((void*)pArrType);
2048 				if(IsExpanded(pEntry))
2049 				{
2050 					sal_Bool bLevelOrVisibiblityChanged = sal_False;
2051 					// bLevelOrVisibiblityChanged is set if outlines have changed their level
2052 					// or if the visibility of objects (frames, sections, tables) has changed
2053 					// i.e. in header/footer
2054 					pArrType->FillMemberList(&bLevelOrVisibiblityChanged);
2055 					if(bLevelOrVisibiblityChanged)
2056 						bInvalidate = sal_True;
2057 					sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
2058 					if(bLevelOrVisibiblityChanged)
2059 						bInvalidate = sal_True;
2060 
2061 					if(nChildCount != pArrType->GetMemberCount())
2062 						bRepaint = sal_True;
2063 					else
2064 					{
2065 						for(sal_uInt16 j = 0; j < nChildCount; j++)
2066 						{
2067 							pEntry = Next(pEntry);
2068 							bNext = sal_False;
2069 							const SwContent* pCnt = pArrType->GetMember(j);
2070 							pEntry->SetUserData((void*)pCnt);
2071 							String sEntryText = GetEntryText(pEntry);
2072 							if( sEntryText != pCnt->GetName() &&
2073 								!(sEntryText == sSpace && !pCnt->GetName().Len()))
2074 								bRepaint = sal_True;
2075 						}
2076 					}
2077 
2078 				}
2079 				else if(pEntry->HasChilds())
2080 				{
2081 					//war der Eintrag einmal aufgeklappt, dann muessen auch
2082 					// die unsichtbaren Eintraege geprueft werden.
2083 					// zumindest muessen die Userdaten aktualisiert werden
2084 					sal_Bool bLevelOrVisibiblityChanged = sal_False;
2085 					// bLevelOrVisibiblityChanged is set if outlines have changed their level
2086 					// or if the visibility of objects (frames, sections, tables) has changed
2087 					// i.e. in header/footer
2088 					pArrType->FillMemberList(&bLevelOrVisibiblityChanged);
2089 					sal_Bool bRemoveChildren = sal_False;
2090 					sal_uInt16 nChildCount = (sal_uInt16)GetChildCount(pEntry);
2091 					if( nChildCount != pArrType->GetMemberCount() )
2092 					{
2093 						bRemoveChildren = sal_True;
2094 					}
2095 					else
2096 					{
2097 						SvLBoxEntry* pChild = FirstChild(pEntry);
2098 						for(sal_uInt16 j = 0; j < nChildCount; j++)
2099 						{
2100 							const SwContent* pCnt = pArrType->GetMember(j);
2101 							pChild->SetUserData((void*)pCnt);
2102 							String sEntryText = GetEntryText(pChild);
2103 							if( sEntryText != pCnt->GetName() &&
2104 								!(sEntryText == sSpace && !pCnt->GetName().Len()))
2105 								bRemoveChildren = sal_True;
2106 							pChild = Next(pChild);
2107 						}
2108 					}
2109 					if(bRemoveChildren)
2110 					{
2111 						SvLBoxEntry* pChild = FirstChild(pEntry);
2112 						SvLBoxEntry* pRemove = pChild;
2113 						for(sal_uInt16 j = 0; j < nChildCount; j++)
2114 						{
2115 							pChild = Next(pRemove);
2116 							GetModel()->Remove(pRemove);
2117 							pRemove = pChild;
2118 						}
2119 					}
2120 					if(!nChildCount)
2121 					{
2122 						pEntry->EnableChildsOnDemand(sal_False);
2123 						InvalidateEntry(pEntry);
2124 					}
2125 
2126 				}
2127 				else if((nTreeCount != 0)
2128 							!= (pArrType->GetMemberCount()!=0))
2129 				{
2130 					bRepaint = sal_True;
2131 				}
2132 			}
2133 			//hier muss noch der naechste Root-Entry gefunden werden
2134 			while( pEntry && (bNext || GetParent(pEntry ) ))
2135 			{
2136 				pEntry = Next(pEntry);
2137 				bNext = sal_False;
2138 			}
2139 		}
2140 	}
2141 	if(!bRepaint && bInvalidate)
2142 		Invalidate();
2143 	return bRepaint;
2144 }
2145 
2146 /***************************************************************************
2147 	Beschreibung: 	Bevor alle Daten geloescht werden, soll noch der letzte
2148  * 					aktive Eintrag festgestellt werden. Dann werden die
2149  * 					UserData geloescht
2150 ***************************************************************************/
2151 void SwContentTree::FindActiveTypeAndRemoveUserData()
2152 {
2153 	SvLBoxEntry* pEntry = FirstSelected();
2154 	if(pEntry)
2155 	{
2156 		// wird Clear ueber TimerUpdate gerufen, kann nur fuer die Root
2157 		// die Gueltigkeit der UserData garantiert werden
2158 		SvLBoxEntry* pParent;
2159 		while(0 != (pParent = GetParent(pEntry)))
2160 			pEntry = pParent;
2161 		if(pEntry->GetUserData() && lcl_IsContentType(pEntry))
2162 			nLastSelType = ((SwContentType*)pEntry->GetUserData())->GetType();
2163 	}
2164 //	else
2165 //		nLastSelType = USHRT_MAX;
2166 	pEntry = First();
2167 	while(pEntry)
2168 	{
2169 		pEntry->SetUserData(0);
2170 		pEntry = Next(pEntry);
2171 	}
2172 }
2173 
2174 /***************************************************************************
2175 	Beschreibung: 	Nachdem ein File auf den Navigator gedroppt wurde,
2176 					wird die neue Shell gesetzt
2177 ***************************************************************************/
2178 
2179 
2180 void SwContentTree::SetHiddenShell(SwWrtShell* pSh)
2181 {
2182 	pHiddenShell = pSh;
2183 	bIsHidden = sal_True;
2184 	bIsActive = bIsConstant = sal_False;
2185 	FindActiveTypeAndRemoveUserData();
2186 	for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
2187 	{
2188 		DELETEZ(aHiddenContentArr[i]);
2189 	}
2190 	Display(bIsActive);
2191 
2192 	GetParentWindow()->UpdateListBox();
2193 }
2194 /***************************************************************************
2195 	Beschreibung:	Dokumentwechsel - neue Shell setzen
2196 ***************************************************************************/
2197 
2198 
2199 void SwContentTree::SetActiveShell(SwWrtShell* pSh)
2200 {
2201 	if(bIsInternalDrag)
2202 		bDocChgdInDragging = sal_True;
2203 	sal_Bool bClear = pActiveShell != pSh;
2204 	if(bIsActive && bClear)
2205 	{
2206 		pActiveShell = pSh;
2207 		FindActiveTypeAndRemoveUserData();
2208 		Clear();
2209 	}
2210 	else if(bIsConstant)
2211 	{
2212 		if(!lcl_FindShell(pActiveShell))
2213 		{
2214 			pActiveShell = pSh;
2215 			bIsActive = sal_True;
2216 			bIsConstant = sal_False;
2217 			bClear = sal_True;
2218 		}
2219 	}
2220 	// nur wenn es die aktive View ist, wird das Array geloescht und
2221 	// die Anzeige neu gefuellt
2222 	if(bIsActive && bClear)
2223 	{
2224 		FindActiveTypeAndRemoveUserData();
2225 		for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
2226 		{
2227 			DELETEZ(aActiveContentArr[i]);
2228 		}
2229 		Display(sal_True);
2230 	}
2231 }
2232 
2233 /***************************************************************************
2234 	Beschreibung: 	Eine offene View als aktiv festlegen
2235 ***************************************************************************/
2236 
2237 
2238 void SwContentTree::SetConstantShell(SwWrtShell* pSh)
2239 {
2240 	pActiveShell = pSh;
2241 	bIsActive 		= sal_False;
2242 	bIsConstant 	= sal_True;
2243 	FindActiveTypeAndRemoveUserData();
2244 	for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
2245 	{
2246 		DELETEZ(aActiveContentArr[i]);
2247 	}
2248 	Display(sal_True);
2249 }
2250 /***************************************************************************
2251 	Beschreibung:	Kommandos des Navigators ausfuehren
2252 ***************************************************************************/
2253 
2254 
2255 void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier)
2256 {
2257 	sal_Bool nMove = sal_False;
2258 	switch( nCmd )
2259 	{
2260 		case FN_ITEM_DOWN:
2261 		case FN_ITEM_UP:   nMove = sal_True;
2262 		case FN_ITEM_LEFT:
2263 		case FN_ITEM_RIGHT:
2264 		if( !GetWrtShell()->GetView().GetDocShell()->IsReadOnly() &&
2265 				(bIsActive ||
2266                     (bIsConstant && pActiveShell == GetParentWindow()->GetCreateView()->GetWrtShellPtr())))
2267 		{
2268 			SwWrtShell* pShell = GetWrtShell();
2269 			sal_Int8 nActOutlineLevel = nOutlineLevel;
2270 			sal_uInt16 nActPos = pShell->GetOutlinePos(nActOutlineLevel);
2271 			SvLBoxEntry* pFirstEntry = FirstSelected();
2272 			if (pFirstEntry && lcl_IsContent(pFirstEntry))
2273 			{
2274 				if((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE) ||
2275 					((SwContent*)pFirstEntry->GetUserData())->GetParent()->GetType()
2276 												== 	CONTENT_TYPE_OUTLINE)
2277 				{
2278 					nActPos = ((SwOutlineContent*)pFirstEntry->GetUserData())->GetPos();
2279 				}
2280 			}
2281 			if ( nActPos < USHRT_MAX &&
2282 					( !nMove || pShell->IsOutlineMovable( nActPos )) )
2283 			{
2284 				pShell->StartAllAction();
2285 				pShell->GotoOutline( nActPos); // Falls Textselektion != BoxSelektion
2286 				pShell->Push();
2287 				pShell->MakeOutlineSel( nActPos, nActPos,
2288 									bModifier);
2289 				if( nMove )
2290 				{
2291 					short nDir = nCmd == FN_ITEM_UP ? -1 : 1;
2292 					if( !bModifier && ((nDir == -1 && nActPos > 0) ||
2293 						(nDir == 1 && nActPos < GetEntryCount() - 2 )) )
2294 					{
2295 						pShell->MoveOutlinePara( nDir );
2296 						//Cursor wieder an die aktuelle Position setzen
2297 						pShell->GotoOutline( nActPos + nDir);
2298 					}
2299 					else if(bModifier)
2300 					{
2301 						sal_uInt16 nActEndPos = nActPos;
2302 						SvLBoxEntry* pEntry = pFirstEntry;
2303 						sal_uInt16 nActLevel = ((SwOutlineContent*)
2304 								pFirstEntry->GetUserData())->GetOutlineLevel();
2305 						pEntry = Next(pEntry);
2306 						while( pEntry && CONTENT_TYPE_OUTLINE ==
2307 							((SwTypeNumber*)pEntry->GetUserData())->GetTypeId() )
2308 						{
2309 							if(nActLevel >= ((SwOutlineContent*)
2310 								pEntry->GetUserData())->GetOutlineLevel())
2311 								break;
2312 							pEntry = Next(pEntry);
2313 							nActEndPos++;
2314 						}
2315 						sal_uInt16 nDest;
2316 						if(nDir == 1)
2317 						{
2318 							//Wenn der letzte Eintrag bewegt werden soll
2319 							//ist Schluss
2320 							if(pEntry && CONTENT_TYPE_OUTLINE ==
2321 								((SwTypeNumber*)pEntry->GetUserData())->GetTypeId())
2322 							{
2323 								// pEntry zeigt jetzt auf den
2324 								// dem letzten sel. Eintrag folgenden E.
2325 								nDest = nActEndPos;
2326 								nDest++;
2327 								//hier muss der uebernaechste Eintrag
2328 								//gefunden werden. Die Selektion muss davor eingefuegt
2329 								//werden
2330 								while(pEntry )
2331 								{
2332 									pEntry = Next(pEntry);
2333 									// nDest++ darf nur ausgefuehrt werden,
2334 									// wenn pEntry != 0
2335 									if(pEntry && nDest++ &&
2336 									( nActLevel >= ((SwOutlineContent*)pEntry->GetUserData())->GetOutlineLevel()||
2337 									 CONTENT_TYPE_OUTLINE != ((SwTypeNumber*)pEntry->GetUserData())->GetTypeId()))
2338 									{
2339 										nDest--;
2340 										break;
2341 									}
2342 								}
2343 								nDir = nDest - nActEndPos;
2344 								//wenn kein Eintrag gefunden wurde, der der Bedingung
2345 								//fuer das zuvor Einfuegen entspricht, muss etwas weniger
2346 								//geschoben werden
2347 							}
2348 							else
2349 								nDir = 0;
2350 						}
2351 						else
2352 						{
2353 							nDest = nActPos;
2354 							pEntry = pFirstEntry;
2355 							while(pEntry && nDest )
2356 							{
2357 								nDest--;
2358 								pEntry = Prev(pEntry);
2359 								if(pEntry &&
2360 									(nActLevel >= ((SwOutlineContent*)pEntry->GetUserData())->GetOutlineLevel()||
2361 									CONTENT_TYPE_OUTLINE !=
2362 								((SwTypeNumber*)pEntry->GetUserData())->GetTypeId()))
2363 								{
2364 									break;
2365 								}
2366 							}
2367 							nDir = nDest - nActPos;
2368 						}
2369 						if(nDir)
2370 						{
2371 							pShell->MoveOutlinePara( nDir );
2372 							//Cursor wieder an die aktuelle Position setzen
2373 							pShell->GotoOutline( nActPos + nDir);
2374 						}
2375 					}
2376 				}
2377 				else
2378 				{
2379 					if( pShell->IsProtectedOutlinePara() )
2380 						Sound::Beep(); //konnte nicht umgestuft werden
2381 					else
2382 						pShell->OutlineUpDown( nCmd == FN_ITEM_LEFT ? -1 : 1 );
2383 				}
2384 
2385 				pShell->ClearMark();
2386 				pShell->Pop(sal_False); //Cursor steht jetzt wieder an der akt. Ueberschrift
2387 				pShell->EndAllAction();
2388 				if(aActiveContentArr[CONTENT_TYPE_OUTLINE])
2389 					aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate();
2390 				Display(sal_True);
2391 				if(!bIsRoot)
2392 				{
2393                     const sal_uInt16 nCurrPos = pShell->GetOutlinePos(MAXLEVEL);
2394                     SvLBoxEntry* pFirst = First();
2395 
2396                     while( 0 != (pFirst = Next(pFirst)) && lcl_IsContent(pFirst))
2397 					{
2398                         if(((SwOutlineContent*)pFirst->GetUserData())->GetPos() == nCurrPos)
2399 						{
2400                             Select(pFirst);
2401                             MakeVisible(pFirst);
2402 						}
2403 					}
2404 				}
2405 			}
2406 			else
2407 				Sound::Beep(); //konnte nicht verschoben werden
2408 		}
2409 	}
2410 }
2411 /***************************************************************************
2412 	Beschreibung:
2413 ***************************************************************************/
2414 
2415 
2416 void	SwContentTree::ShowTree()
2417 {
2418 	aUpdTimer.Start();
2419 	SvTreeListBox::Show();
2420 }
2421 
2422 /***************************************************************************
2423 	Beschreibung:	zusammengefaltet wird nicht geidlet
2424 ***************************************************************************/
2425 
2426 
2427 void	SwContentTree::HideTree()
2428 {
2429 	aUpdTimer.Stop();
2430 	SvTreeListBox::Hide();
2431 }
2432 
2433 /***************************************************************************
2434 	Beschreibung:	Kein Idle mit Focus oder waehrend des Dragging
2435 ***************************************************************************/
2436 
2437 
2438 IMPL_LINK( SwContentTree, TimerUpdate, Timer*, EMPTYARG)
2439 {
2440 	// kein Update waehrend D&D
2441 	// Viewabfrage, da der Navigator zu spaet abgeraeumt wird
2442     SwView* pView = GetParentWindow()->GetCreateView();
2443 	if( (!HasFocus() || bViewHasChanged) &&
2444 		 !bIsInDrag && !bIsInternalDrag && pView &&
2445 		 pView->GetWrtShellPtr() && !pView->GetWrtShellPtr()->ActionPend() )
2446 	{
2447 		bViewHasChanged = sal_False;
2448 		bIsIdleClear = sal_False;
2449 		SwWrtShell* pActShell = pView->GetWrtShellPtr();
2450 		if( bIsConstant && !lcl_FindShell( pActiveShell ) )
2451 		{
2452 			SetActiveShell(pActShell);
2453 			GetParentWindow()->UpdateListBox();
2454 		}
2455 
2456 		if(bIsActive && pActShell != GetWrtShell())
2457 			SetActiveShell(pActShell);
2458 		else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) &&
2459 					HasContentChanged())
2460 		{
2461 			FindActiveTypeAndRemoveUserData();
2462 			Display(sal_True);
2463 			//IAccessibility2 Implementation 2009-----
2464 			//Solution: Set focus
2465 			if( bIsKeySpace )
2466 			{
2467 				HideFocus();
2468 				ShowFocus( oldRectangle);
2469 				bIsKeySpace = sal_False;
2470 			}
2471 			//-----IAccessibility2 Implementation 2009
2472 		}
2473 	}
2474 	else if(!pView && bIsActive && !bIsIdleClear)
2475 	{
2476 		if(pActiveShell)
2477 			SetActiveShell(0);
2478 		Clear();
2479 		bIsIdleClear = sal_True;
2480 	}
2481 	return 0;
2482 }
2483 
2484 /***************************************************************************
2485 	Beschreibung:
2486 ***************************************************************************/
2487 
2488 
2489 DragDropMode SwContentTree::NotifyStartDrag(
2490 				TransferDataContainer& rContainer,
2491 				SvLBoxEntry* pEntry )
2492 {
2493 	DragDropMode eMode = (DragDropMode)0;
2494 	if( bIsActive && nRootType == CONTENT_TYPE_OUTLINE &&
2495 		GetModel()->GetAbsPos( pEntry ) > 0
2496 		&& !GetWrtShell()->GetView().GetDocShell()->IsReadOnly())
2497 		eMode = GetDragDropMode();
2498 	else if(!bIsActive && GetWrtShell()->GetView().GetDocShell()->HasName())
2499 		eMode = SV_DRAGDROP_APP_COPY;
2500 
2501 	sal_Int8 nDragMode;
2502 	FillTransferData( rContainer, nDragMode );
2503 	bDocChgdInDragging = sal_False;
2504 	bIsInternalDrag = sal_True;
2505 	return eMode;
2506 }
2507 
2508 
2509 /***************************************************************************
2510 	Beschreibung :	Nach dem Drag wird der aktuelle Absatz m i t
2511 					Childs verschoben
2512 ***************************************************************************/
2513 
2514 
2515 sal_Bool  SwContentTree::NotifyMoving( SvLBoxEntry*  pTarget,
2516 		SvLBoxEntry*  pEntry, SvLBoxEntry*& , sal_uLong& )
2517 {
2518 	if(!bDocChgdInDragging)
2519 	{
2520 		sal_uInt16 nTargetPos = 0;
2521 		sal_uInt16 nSourcePos = (( SwOutlineContent* )pEntry->GetUserData())->GetPos();
2522 		if(!lcl_IsContent(pTarget))
2523 			nTargetPos = USHRT_MAX;
2524 		else
2525 			nTargetPos = (( SwOutlineContent* )pTarget->GetUserData())->GetPos();
2526 		if(	MAXLEVEL > nOutlineLevel && // werden nicht alle Ebenen angezeigt
2527 						nTargetPos != USHRT_MAX)
2528 		{
2529 			SvLBoxEntry* pNext = Next(pTarget);
2530 			if(pNext)
2531 				nTargetPos = (( SwOutlineContent* )pNext->GetUserData())->GetPos() -1;
2532 			else
2533                 nTargetPos = static_cast<sal_uInt16>(GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount())- 1;
2534 
2535 		}
2536 
2537 		DBG_ASSERT( pEntry &&
2538 			lcl_IsContent(pEntry),"Source == 0 oder Source hat keinen Content" );
2539 		GetParentWindow()->MoveOutline( nSourcePos,
2540 									nTargetPos,
2541 									sal_True);
2542 
2543 		aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate();
2544 		Display(sal_True);
2545 	}
2546 	//TreeListBox wird aus dem Dokument neu geladen
2547 	return sal_False;
2548 }
2549 /***************************************************************************
2550 	Beschreibung : 	Nach dem Drag wird der aktuelle Absatz o h n e
2551 					Childs verschoben
2552 ***************************************************************************/
2553 
2554 
2555 sal_Bool  SwContentTree::NotifyCopying( SvLBoxEntry*  pTarget,
2556 		SvLBoxEntry*  pEntry, SvLBoxEntry*& , sal_uLong& )
2557 {
2558 	if(!bDocChgdInDragging)
2559 	{
2560 		sal_uInt16 nTargetPos = 0;
2561 		sal_uInt16 nSourcePos = (( SwOutlineContent* )pEntry->GetUserData())->GetPos();
2562 		if(!lcl_IsContent(pTarget))
2563 			nTargetPos = USHRT_MAX;
2564 		else
2565 			nTargetPos = (( SwOutlineContent* )pTarget->GetUserData())->GetPos();
2566 
2567 		if(	MAXLEVEL > nOutlineLevel && // werden nicht alle Ebenen angezeigt
2568 						nTargetPos != USHRT_MAX)
2569 		{
2570 			SvLBoxEntry* pNext = Next(pTarget);
2571 			if(pNext)
2572 				nTargetPos = (( SwOutlineContent* )pNext->GetUserData())->GetPos() - 1;
2573 			else
2574                 nTargetPos = static_cast<sal_uInt16>(GetWrtShell()->getIDocumentOutlineNodesAccess()->getOutlineNodesCount()) - 1;
2575 
2576 		}
2577 
2578 
2579 		DBG_ASSERT( pEntry &&
2580 			lcl_IsContent(pEntry),"Source == 0 oder Source hat keinen Content" );
2581 		GetParentWindow()->MoveOutline( nSourcePos,	nTargetPos, sal_False);
2582 
2583 		//TreeListBox wird aus dem Dokument neu geladen
2584 		aActiveContentArr[CONTENT_TYPE_OUTLINE]->Invalidate();
2585 		Display(sal_True);
2586 	}
2587 	return sal_False;
2588 }
2589 
2590 /***************************************************************************
2591 	Beschreibung:	Kein Drop vor den ersten Eintrag - es ist ein SwContentType
2592 ***************************************************************************/
2593 
2594 sal_Bool  SwContentTree::NotifyAcceptDrop( SvLBoxEntry* pEntry)
2595 {
2596 	return pEntry != 0;
2597 }
2598 
2599 
2600 /***************************************************************************
2601 	Beschreibung: 	Wird ein Ctrl+DoubleClick in einen freien Bereich ausgefuehrt,
2602  * 					dann soll die Basisfunktion des Controls gerufen werden
2603 ***************************************************************************/
2604 void  SwContentTree::MouseButtonDown( const MouseEvent& rMEvt )
2605 {
2606 	Point aPos( rMEvt.GetPosPixel());
2607 	SvLBoxEntry* pEntry = GetEntry( aPos, sal_True );
2608 	if( !pEntry && rMEvt.IsLeft() && rMEvt.IsMod1() && (rMEvt.GetClicks() % 2) == 0)
2609 		Control::MouseButtonDown( rMEvt );
2610 	else
2611 		SvTreeListBox::MouseButtonDown( rMEvt );
2612 }
2613 
2614 /***************************************************************************
2615 	Beschreibung:	sofort aktualisieren
2616 ***************************************************************************/
2617 
2618 
2619 void  SwContentTree::GetFocus()
2620 {
2621     SwView* pActView = GetParentWindow()->GetCreateView();
2622 	if(pActView)
2623 	{
2624 		SwWrtShell* pActShell = pActView->GetWrtShellPtr();
2625 		if(bIsConstant && !lcl_FindShell(pActiveShell))
2626 		{
2627 			SetActiveShell(pActShell);
2628 		}
2629 
2630 		if(bIsActive && pActShell != GetWrtShell())
2631 			SetActiveShell(pActShell);
2632 		else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) &&
2633 					HasContentChanged())
2634 		{
2635 			Display(sal_True);
2636 		}
2637 	}
2638 	else if(bIsActive)
2639 		Clear();
2640 	SvTreeListBox::GetFocus();
2641 }
2642 
2643 /***************************************************************************
2644 	Beschreibung:
2645 ***************************************************************************/
2646 
2647 
2648 void  SwContentTree::KeyInput(const KeyEvent& rEvent)
2649 {
2650 	const KeyCode aCode = rEvent.GetKeyCode();
2651 	if(aCode.GetCode() == KEY_RETURN)
2652 	{
2653 		SvLBoxEntry* pEntry = FirstSelected();
2654 		if ( pEntry )
2655 		{
2656 			switch(aCode.GetModifier())
2657 			{
2658 				case KEY_MOD2:
2659 					// Boxen umschalten
2660 					GetParentWindow()->ToggleTree();
2661 				break;
2662 				case KEY_MOD1:
2663 					// RootModus umschalten
2664 					ToggleToRoot();
2665 				break;
2666 				case 0:
2667 					if(lcl_IsContentType(pEntry))
2668 					{
2669 						IsExpanded(pEntry) ?
2670 							Collapse(pEntry) :
2671 								Expand(pEntry);
2672 					}
2673 					else
2674 						ContentDoubleClickHdl(0);
2675 				break;
2676 			}
2677 		}
2678 	}
2679 	else if(aCode.GetCode() == KEY_DELETE && 0 == aCode.GetModifier())
2680 	{
2681 		SvLBoxEntry* pEntry = FirstSelected();
2682 		if(pEntry &&
2683 			lcl_IsContent(pEntry) &&
2684 				((SwContent*)pEntry->GetUserData())->GetParent()->IsDeletable() &&
2685 					!pActiveShell->GetView().GetDocShell()->IsReadOnly())
2686 		{
2687 			EditEntry(pEntry, EDIT_MODE_DELETE);
2688             bViewHasChanged = sal_True;
2689             GetParentWindow()->UpdateListBox();
2690             TimerUpdate(&aUpdTimer);
2691             GrabFocus();
2692         }
2693 	}
2694 	//IAccessibility2 Implementation 2009-----
2695 	//Solution: Make KEY_SPACE has same function as DoubleClick ,
2696 	//and realize multi-selection .
2697 	else if(aCode.GetCode() == KEY_SPACE && 0 == aCode.GetModifier())
2698 	{
2699 
2700 		SvLBoxEntry* pEntry = GetCurEntry();
2701 		if( GetChildCount( pEntry ) == 0 )
2702 			bIsKeySpace = sal_True;
2703 		Point tempPoint = GetEntryPosition( pEntry );//Change from "GetEntryPos" to "GetEntryPosition" for acc migration
2704 		oldRectangle = GetFocusRect( pEntry,tempPoint.Y() );
2705 
2706 		if(pEntry)
2707 		{
2708 			if(bIsActive || bIsConstant)
2709 			{
2710 				if(bIsConstant)
2711 				{
2712 					pActiveShell->GetView().GetViewFrame()->GetWindow().ToTop();
2713 				}
2714 
2715 				SwContent* pCnt = (SwContent*)pEntry->GetUserData();
2716 
2717 				sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
2718 				switch(nJumpType)
2719 				{
2720 					case CONTENT_TYPE_DRAWOBJECT:
2721 					{
2722 						SdrView* pDrawView = pActiveShell->GetDrawView();
2723 						if (pDrawView)
2724 						{
2725 							pDrawView->SdrEndTextEdit();//Change from "EndTextEdit" to "SdrEndTextEdit" for acc migration
2726 
2727                             SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
2728                             SdrPage* pPage = pDrawModel->GetPage(0);
2729 							sal_uInt32 nCount = pPage->GetObjCount();
2730 							sal_Bool hasObjectMarked = sal_False;
2731 
2732 							SdrObject* pObject = NULL;
2733 							pObject = GetDrawingObjectsByContent( pCnt );
2734 							if( pObject )
2735 							{
2736 								SdrPageView* pPV = pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
2737 								if( pPV )
2738 								{
2739 									sal_Bool bUnMark = pDrawView->IsObjMarked(pObject);
2740 									pDrawView->MarkObj( pObject, pPV, bUnMark);
2741 
2742 								}
2743 							}
2744 							for( sal_uInt32 i=0; i< nCount; i++ )
2745 							{
2746 								SdrObject* pTemp = pPage->GetObj(i);
2747 								sal_uInt16 nCmpId;
2748 								sal_Bool bMark = pDrawView->IsObjMarked(pTemp);
2749 								switch( pTemp->GetObjIdentifier() )
2750 								{
2751 									case OBJ_GRUP:
2752 									case OBJ_TEXT:
2753 									case OBJ_TEXTEXT:
2754 									case OBJ_wegFITTEXT:
2755 									case OBJ_LINE:
2756 									case OBJ_RECT:
2757 									case OBJ_CIRC:
2758 									case OBJ_SECT:
2759 									case OBJ_CARC:
2760 									case OBJ_CCUT:
2761 									case OBJ_POLY:
2762 									case OBJ_PLIN:
2763 									case OBJ_PATHLINE:
2764 									case OBJ_PATHFILL:
2765 									case OBJ_FREELINE:
2766 									case OBJ_FREEFILL:
2767 									case OBJ_PATHPOLY:
2768 									case OBJ_PATHPLIN:
2769 									case OBJ_CAPTION:
2770 									case OBJ_CUSTOMSHAPE:
2771 										nCmpId = OBJ_GRUP;
2772 										if( bMark )
2773 											hasObjectMarked = sal_True;
2774 										break;
2775 									default:
2776 										nCmpId = pTemp->GetObjIdentifier();
2777 										//IAccessibility2 Implementation 2009-----
2778 										if ( bMark )
2779 										{
2780 											SdrPageView* pPV = pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
2781 											if (pPV)
2782 											{
2783 												pDrawView->MarkObj(pTemp, pPV, sal_True);
2784 											}
2785 										}
2786 										//-----IAccessibility2 Implementation 2009
2787 								}
2788 								//mod end
2789 							}
2790 							if ( pActiveShell && !hasObjectMarked )
2791 							{
2792 								SwEditWin& pEditWindow =
2793 									pActiveShell->GetView().GetEditWin();
2794 								if( &pEditWindow )
2795 								{
2796 									KeyCode tempKeycode( KEY_ESCAPE );
2797 									KeyEvent rKEvt( 0 , tempKeycode );
2798 									((Window*)&pEditWindow)->KeyInput( rKEvt );
2799 
2800 								}
2801 								//rView.GetEditWin().GrabFocus();
2802 							}
2803 						}
2804 					}
2805 					break;
2806 				}
2807 
2808 
2809 				bViewHasChanged = sal_True;
2810 			}
2811 		}
2812 
2813 	}
2814 	//-----IAccessibility2 Implementation 2009
2815 	else
2816 		SvTreeListBox::KeyInput(rEvent);
2817 
2818 }
2819 
2820 /***************************************************************************
2821 	Beschreibung:
2822 ***************************************************************************/
2823 
2824 
2825 void  SwContentTree::RequestHelp( const HelpEvent& rHEvt )
2826 {
2827 	sal_Bool bCallBase = sal_True;
2828 	if( rHEvt.GetMode() & HELPMODE_QUICK )
2829 	{
2830 		Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ));
2831 		SvLBoxEntry* pEntry = GetEntry( aPos );
2832 		if( pEntry )
2833 		{
2834 			sal_uInt16 nType;
2835 			sal_Bool bBalloon = sal_False;
2836 			sal_Bool bContent = sal_False;
2837 			void* pUserData = pEntry->GetUserData();
2838 			if(lcl_IsContentType(pEntry))
2839 				nType = ((SwContentType*)pUserData)->GetType();
2840 			else
2841 			{
2842 				nType = ((SwContent*)pUserData)->GetParent()->GetType();
2843 				bContent = sal_True;
2844 			}
2845 			String sEntry;
2846 			sal_Bool bRet = sal_False;
2847 			if(bContent)
2848 			{
2849 				switch( nType )
2850 				{
2851 					case CONTENT_TYPE_URLFIELD:
2852 						sEntry = ((SwURLFieldContent*)pUserData)->GetURL();
2853 						bRet = sal_True;
2854 					break;
2855 
2856 					case CONTENT_TYPE_POSTIT:
2857 						sEntry = ((SwPostItContent*)pUserData)->GetName();
2858 						bRet = sal_True;
2859 						if(Help::IsBalloonHelpEnabled())
2860 							bBalloon = sal_True;
2861 					break;
2862 					case CONTENT_TYPE_OUTLINE:
2863 						sEntry = ((SwOutlineContent*)pUserData)->GetName();
2864 						bRet = sal_True;
2865 					break;
2866 					case CONTENT_TYPE_GRAPHIC:
2867 						sEntry = ((SwGraphicContent*)pUserData)->GetLink();
2868 #if OSL_DEBUG_LEVEL > 1
2869 						sEntry += ' ';
2870 						sEntry += String::CreateFromInt32(
2871 									((SwGraphicContent*)pUserData)->GetYPos());
2872 #endif
2873 						bRet = sal_True;
2874 					break;
2875 #if OSL_DEBUG_LEVEL > 1
2876 					case CONTENT_TYPE_TABLE:
2877 					case CONTENT_TYPE_FRAME:
2878 						sEntry = String::CreateFromInt32(
2879 										((SwContent*)pUserData)->GetYPos() );
2880 						bRet = sal_True;
2881 					break;
2882 #endif
2883 				}
2884 				if(((SwContent*)pUserData)->IsInvisible())
2885 				{
2886 					if(sEntry.Len())
2887 						sEntry += C2S(", ");
2888 					sEntry += sInvisible;
2889 					bRet = sal_True;
2890 				}
2891 			}
2892 			else
2893 			{
2894 				sal_uInt16 nMemberCount = ((SwContentType*)pUserData)->GetMemberCount();
2895 				sEntry = String::CreateFromInt32(nMemberCount);
2896 				sEntry += ' ';
2897 				sEntry += nMemberCount == 1
2898 							? ((SwContentType*)pUserData)->GetSingleName()
2899 							: ((SwContentType*)pUserData)->GetName();
2900 				bRet = sal_True;
2901 			}
2902 			if(bRet)
2903 			{
2904 				SvLBoxTab* pTab;
2905 				SvLBoxItem* pItem = GetItem( pEntry, aPos.X(), &pTab );
2906 				if( pItem && SV_ITEM_ID_LBOXSTRING == pItem->IsA())
2907 				{
2908 					aPos = GetEntryPosition( pEntry );
2909 
2910 					aPos.X() = GetTabPos( pEntry, pTab );
2911 					Size aSize( pItem->GetSize( this, pEntry ) );
2912 
2913 					if((aPos.X() + aSize.Width()) > GetSizePixel().Width())
2914 						aSize.Width() = GetSizePixel().Width() - aPos.X();
2915 
2916 					aPos = OutputToScreenPixel(aPos);
2917 					Rectangle aItemRect( aPos, aSize );
2918 					if(bBalloon)
2919 					{
2920 						aPos.X() += aSize.Width();
2921 						Help::ShowBalloon( this, aPos, aItemRect, sEntry );
2922 					}
2923 					else
2924 						Help::ShowQuickHelp( this, aItemRect, sEntry,
2925 							QUICKHELP_LEFT|QUICKHELP_VCENTER );
2926 					bCallBase = sal_False;
2927 				}
2928 			}
2929 			else
2930 			{
2931 				Help::ShowQuickHelp( this, Rectangle(), aEmptyStr, 0 );
2932 				bCallBase = sal_False;
2933 			}
2934 		}
2935 	}
2936 	if( bCallBase )
2937 		Window::RequestHelp( rHEvt );
2938 }
2939 
2940 /***************************************************************************
2941 	Beschreibung:
2942 ***************************************************************************/
2943 
2944 
2945 void    SwContentTree::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
2946 {
2947 	SvLBoxEntry* pFirst = FirstSelected();
2948     switch( nSelectedPopupEntry )
2949 	{
2950 		//Outlinelevel
2951 		case 101:
2952 		case 102:
2953 		case 103:
2954 		case 104:
2955 		case 105:
2956 		case 106:
2957 		case 107:
2958 		case 108:
2959 		case 109:
2960 		case 110:
2961             nSelectedPopupEntry -= 100;
2962             if(nOutlineLevel != nSelectedPopupEntry )
2963                 SetOutlineLevel((sal_Int8)nSelectedPopupEntry);
2964 		break;
2965 		case 201:
2966 		case 202:
2967 		case 203:
2968             GetParentWindow()->SetRegionDropMode(nSelectedPopupEntry - 201);
2969 		break;
2970 		case 401:
2971 		case 402:
2972             EditEntry(pFirst, nSelectedPopupEntry == 401 ? EDIT_MODE_RMV_IDX : EDIT_MODE_UPD_IDX);
2973 		break;
2974 		// Eintrag bearbeiten
2975 		case 403:
2976 			EditEntry(pFirst, EDIT_MODE_EDIT);
2977 		break;
2978 		case 404:
2979 			EditEntry(pFirst, EDIT_UNPROTECT_TABLE);
2980 		break;
2981 		case 405 :
2982 		{
2983 			const SwTOXBase* pBase = ((SwTOXBaseContent*)pFirst->GetUserData())
2984 																->GetTOXBase();
2985             pActiveShell->SetTOXBaseReadonly(*pBase, !pActiveShell->IsTOXBaseReadonly(*pBase));
2986 		}
2987 		break;
2988 		case 4:
2989 		break;
2990 		case 501:
2991 			EditEntry(pFirst, EDIT_MODE_DELETE);
2992 		break;
2993 		case 502 :
2994 			EditEntry(pFirst, EDIT_MODE_RENAME);
2995 		break;
2996 		case 600:
2997 			pActiveShell->GetView().GetPostItMgr()->Show();
2998 			break;
2999 		case 601:
3000 			pActiveShell->GetView().GetPostItMgr()->Hide();
3001 			break;
3002 		case 602:
3003 			{
3004                 pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0);
3005 				pActiveShell->GetView().GetPostItMgr()->Delete();
3006 				break;
3007 			}
3008 		//Anzeige
3009         default: // nSelectedPopupEntry > 300
3010         if(nSelectedPopupEntry > 300 && nSelectedPopupEntry < 400)
3011 		{
3012             nSelectedPopupEntry -= 300;
3013 			SwView *pView = SwModule::GetFirstView();
3014 			while (pView)
3015 			{
3016                 nSelectedPopupEntry --;
3017                 if(nSelectedPopupEntry == 0)
3018 				{
3019 					SetConstantShell(&pView->GetWrtShell());
3020 					break;
3021 				}
3022 				pView = SwModule::GetNextView(pView);
3023 			}
3024             if(nSelectedPopupEntry)
3025 			{
3026                 bViewHasChanged = bIsActive = nSelectedPopupEntry == 1;
3027 				bIsConstant = sal_False;
3028                 Display(nSelectedPopupEntry == 1);
3029 			}
3030 		}
3031 	}
3032 	GetParentWindow()->UpdateListBox();
3033 }
3034 
3035 /***************************************************************************
3036 	Beschreibung:
3037 ***************************************************************************/
3038 
3039 
3040 void SwContentTree::SetOutlineLevel(sal_uInt8 nSet)
3041 {
3042 	nOutlineLevel = nSet;
3043 	pConfig->SetOutlineLevel( nOutlineLevel );
3044 	SwContentType** ppContentT = bIsActive ?
3045 					&aActiveContentArr[CONTENT_TYPE_OUTLINE] :
3046 						&aHiddenContentArr[CONTENT_TYPE_OUTLINE];
3047 	if(*ppContentT)
3048 	{
3049 		(*ppContentT)->SetOutlineLevel(nOutlineLevel);
3050 		(*ppContentT)->Init();
3051 	}
3052 	Display(bIsActive);
3053 }
3054 
3055 /***************************************************************************
3056 	Beschreibung:	Moduswechsel: gedropptes Doc anzeigen
3057 ***************************************************************************/
3058 
3059 
3060 void SwContentTree::ShowHiddenShell()
3061 {
3062 	if(pHiddenShell)
3063 	{
3064 		bIsConstant = sal_False;
3065 		bIsActive = sal_False;
3066 		Display(sal_False);
3067 	}
3068 }
3069 
3070 /***************************************************************************
3071 	Beschreibung:	Moduswechsel: aktive Sicht anzeigen
3072 ***************************************************************************/
3073 
3074 
3075 void SwContentTree::ShowActualView()
3076 {
3077 	bIsActive = sal_True;
3078 	bIsConstant = sal_False;
3079 	Display(sal_True);
3080 	GetParentWindow()->UpdateListBox();
3081 }
3082 
3083 /*-----------------20.11.96 13.34-------------------
3084 	Beschreibung: Hier sollen die Buttons zum Verschieben von
3085 				  Outlines en-/disabled werden
3086 --------------------------------------------------*/
3087 
3088 sal_Bool  SwContentTree::Select( SvLBoxEntry* pEntry, sal_Bool bSelect )
3089 {
3090 	if(!pEntry)
3091 		return sal_False;
3092 	sal_Bool bEnable = sal_False;
3093 	SvLBoxEntry* pParentEntry = GetParent(pEntry);
3094 	if(!bIsLastReadOnly && (!IsVisible() ||
3095 		((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry) ||
3096 			(lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE))))
3097 		bEnable = sal_True;
3098 	SwNavigationPI* pNavi = GetParentWindow();
3099 	pNavi->aContentToolBox.EnableItem(FN_ITEM_UP ,  bEnable);
3100 	pNavi->aContentToolBox.EnableItem(FN_ITEM_DOWN, bEnable);
3101 	pNavi->aContentToolBox.EnableItem(FN_ITEM_LEFT, bEnable);
3102 	pNavi->aContentToolBox.EnableItem(FN_ITEM_RIGHT,bEnable);
3103 
3104 	return SvTreeListBox::Select(pEntry, bSelect);
3105 }
3106 
3107 /*-----------------27.11.96 12.56-------------------
3108 
3109 --------------------------------------------------*/
3110 
3111 void SwContentTree::SetRootType(sal_uInt16 nType)
3112 {
3113 	nRootType = nType;
3114 	bIsRoot = sal_True;
3115 	pConfig->SetRootType( nRootType );
3116 }
3117 
3118 /*-----------------10.01.97 12.19-------------------
3119 
3120 --------------------------------------------------*/
3121 
3122 void SwContentType::RemoveNewline(String& rEntry)
3123 {
3124 	sal_Unicode* pStr = rEntry.GetBufferAccess();
3125 	for(xub_StrLen i = rEntry.Len(); i; --i, ++pStr )
3126 	{
3127 		if( *pStr == 10 || *pStr == 13 )
3128 			*pStr = 0x20;
3129 	}
3130 }
3131 
3132 /*-----------------14.01.97 16.38-------------------
3133 
3134 --------------------------------------------------*/
3135 
3136 void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode)
3137 {
3138 	SwContent* pCnt = (SwContent*)pEntry->GetUserData();
3139 	GotoContent(pCnt);
3140 	sal_uInt16 nType = pCnt->GetParent()->GetType();
3141 	sal_uInt16 nSlot = 0;
3142 
3143 	uno::Reference< container::XNameAccess >  xNameAccess, xSecond, xThird;
3144 	switch(nType)
3145 	{
3146 		case CONTENT_TYPE_TABLE 	:
3147 			if(nMode == EDIT_UNPROTECT_TABLE)
3148 			{
3149 				pActiveShell->GetView().GetDocShell()->
3150 						GetDoc()->UnProtectCells( pCnt->GetName());
3151 			}
3152 			else if(nMode == EDIT_MODE_DELETE)
3153 			{
3154 				pActiveShell->StartAction();
3155                 String sTable = SW_RES(STR_TABLE_NAME);
3156                 SwRewriter aRewriterTableName;
3157                 aRewriterTableName.AddRule(UNDO_ARG1, SW_RES(STR_START_QUOTE));
3158                 aRewriterTableName.AddRule(UNDO_ARG2, pCnt->GetName());
3159                 aRewriterTableName.AddRule(UNDO_ARG3, SW_RES(STR_END_QUOTE));
3160                 sTable = aRewriterTableName.Apply(sTable);
3161 
3162                 SwRewriter aRewriter;
3163                 aRewriter.AddRule(UNDO_ARG1, sTable);
3164 				pActiveShell->StartUndo(UNDO_DELETE, &aRewriter);
3165 				pActiveShell->GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL);
3166 				pActiveShell->DeleteRow();
3167                 pActiveShell->EndUndo();
3168 				pActiveShell->EndAction();
3169 			}
3170 			else if(nMode == EDIT_MODE_RENAME)
3171 			{
3172 				uno::Reference< frame::XModel >  xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
3173 				uno::Reference< text::XTextTablesSupplier >  xTables(xModel, uno::UNO_QUERY);
3174 				xNameAccess = xTables->getTextTables();
3175 			}
3176 			else
3177 				nSlot = FN_FORMAT_TABLE_DLG;
3178 		break;
3179 
3180 		case CONTENT_TYPE_GRAPHIC   :
3181 			if(nMode == EDIT_MODE_DELETE)
3182 			{
3183 				pActiveShell->DelRight();
3184 			}
3185 			else if(nMode == EDIT_MODE_RENAME)
3186 			{
3187 				uno::Reference< frame::XModel >  xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
3188 				uno::Reference< text::XTextGraphicObjectsSupplier >  xGraphics(xModel, uno::UNO_QUERY);
3189 				xNameAccess = xGraphics->getGraphicObjects();
3190 				uno::Reference< text::XTextFramesSupplier >  xFrms(xModel, uno::UNO_QUERY);
3191 				xSecond = xFrms->getTextFrames();
3192 				uno::Reference< text::XTextEmbeddedObjectsSupplier >  xObjs(xModel, uno::UNO_QUERY);
3193 				xThird = xObjs->getEmbeddedObjects();
3194 			}
3195 			else
3196 				nSlot = FN_FORMAT_GRAFIC_DLG;
3197 		break;
3198 
3199 		case CONTENT_TYPE_FRAME     :
3200 		case CONTENT_TYPE_OLE       :
3201 			if(nMode == EDIT_MODE_DELETE)
3202 			{
3203 				pActiveShell->DelRight();
3204 			}
3205 			else if(nMode == EDIT_MODE_RENAME)
3206 			{
3207 				uno::Reference< frame::XModel >  xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
3208 				uno::Reference< text::XTextFramesSupplier >  xFrms(xModel, uno::UNO_QUERY);
3209 				uno::Reference< text::XTextEmbeddedObjectsSupplier >  xObjs(xModel, uno::UNO_QUERY);
3210 				if(CONTENT_TYPE_FRAME == nType)
3211 				{
3212 					xNameAccess = xFrms->getTextFrames();
3213 					xSecond = xObjs->getEmbeddedObjects();
3214 				}
3215 				else
3216 				{
3217 					xNameAccess = xObjs->getEmbeddedObjects();
3218 					xSecond = xFrms->getTextFrames();
3219 				}
3220 				uno::Reference< text::XTextGraphicObjectsSupplier >  xGraphics(xModel, uno::UNO_QUERY);
3221 				xThird = xGraphics->getGraphicObjects();
3222 			}
3223 			else
3224 				nSlot = FN_FORMAT_FRAME_DLG;
3225 		break;
3226         case CONTENT_TYPE_BOOKMARK  :
3227             if(nMode == EDIT_MODE_DELETE)
3228             {
3229                 IDocumentMarkAccess* const pMarkAccess = pActiveShell->getIDocumentMarkAccess();
3230                 pMarkAccess->deleteMark( pMarkAccess->findMark(pCnt->GetName()) );
3231             }
3232             else if(nMode == EDIT_MODE_RENAME)
3233             {
3234                 uno::Reference< frame::XModel >  xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
3235                 uno::Reference< text::XBookmarksSupplier >  xBkms(xModel, uno::UNO_QUERY);
3236                 xNameAccess = xBkms->getBookmarks();
3237             }
3238             else
3239                 nSlot = FN_INSERT_BOOKMARK;
3240         break;
3241 
3242 		case CONTENT_TYPE_REGION    :
3243 			if(nMode == EDIT_MODE_RENAME)
3244 			{
3245 				uno::Reference< frame::XModel >  xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
3246 				uno::Reference< text::XTextSectionsSupplier >  xSects(xModel, uno::UNO_QUERY);
3247 				xNameAccess = xSects->getTextSections();
3248 			}
3249 			else
3250 				nSlot = FN_EDIT_REGION;
3251 		break;
3252 
3253 		case CONTENT_TYPE_URLFIELD:
3254 			nSlot = FN_EDIT_HYPERLINK;
3255 		break;
3256 		case CONTENT_TYPE_REFERENCE:
3257 			nSlot = FN_EDIT_FIELD;
3258 		break;
3259 
3260 		case CONTENT_TYPE_POSTIT:
3261 			pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell();
3262 			if(nMode == EDIT_MODE_DELETE)
3263 			{
3264 				if (((SwPostItContent*)pCnt)->IsPostIt())
3265 				{
3266                     pActiveShell->GetView().GetPostItMgr()->SetActiveSidebarWin(0);
3267 					pActiveShell->DelRight();
3268 				}
3269 				/*
3270 				//	this code can be used once we want redline comments in the margin
3271 				else
3272 				{
3273 					SwMarginWin* pComment = pActiveShell->GetView().GetPostItMgr()->GetPostIt(((SwPostItContent*)pCnt)->GetRedline());
3274 					if (pComment)
3275 						pComment->Delete();
3276 				}
3277 				*/
3278 			}
3279 			else
3280 			{
3281 				if (((SwPostItContent*)pCnt)->IsPostIt())
3282 					nSlot = FN_POSTIT;
3283 				else
3284 					nSlot = FN_REDLINE_COMMENT;
3285 			}
3286 		break;
3287 		case CONTENT_TYPE_INDEX:
3288 		{
3289 			const SwTOXBase* pBase = ((SwTOXBaseContent*)pCnt)->GetTOXBase();
3290 			switch(nMode)
3291 			{
3292 				case EDIT_MODE_EDIT:
3293 					if(pBase)
3294 					{
3295 						SwPtrItem aPtrItem( FN_INSERT_MULTI_TOX, (void*)pBase);
3296 						pActiveShell->GetView().GetViewFrame()->
3297 							GetDispatcher()->Execute(FN_INSERT_MULTI_TOX,
3298 											SFX_CALLMODE_ASYNCHRON, &aPtrItem, 0L);
3299 
3300 					}
3301 				break;
3302 				case EDIT_MODE_RMV_IDX:
3303 				case EDIT_MODE_DELETE:
3304 				{
3305 					if( pBase )
3306 						pActiveShell->DeleteTOX(*pBase, EDIT_MODE_DELETE == nMode);
3307 				}
3308 				break;
3309 				case EDIT_MODE_UPD_IDX:
3310 				case EDIT_MODE_RENAME:
3311 				{
3312 					Reference< frame::XModel >  xModel = pActiveShell->GetView().GetDocShell()->GetBaseModel();
3313 					Reference< XDocumentIndexesSupplier >  xIndexes(xModel, UNO_QUERY);
3314 					Reference< XIndexAccess> xIdxAcc(xIndexes->getDocumentIndexes());
3315 					Reference< XNameAccess >xLocalNameAccess(xIdxAcc, UNO_QUERY);
3316 					if(EDIT_MODE_RENAME == nMode)
3317 						xNameAccess = xLocalNameAccess;
3318 					else if(xLocalNameAccess.is() && xLocalNameAccess->hasByName(pBase->GetTOXName()))
3319 					{
3320 						Any aIdx = xLocalNameAccess->getByName(pBase->GetTOXName());
3321 						Reference< XDocumentIndex> xIdx;
3322 						if(aIdx >>= xIdx)
3323 							xIdx->update();
3324 					}
3325 				}
3326 				break;
3327 			}
3328 		}
3329 		break;
3330         case CONTENT_TYPE_DRAWOBJECT :
3331             if(EDIT_MODE_DELETE == nMode)
3332                 nSlot = SID_DELETE;
3333         break;
3334 	}
3335 	if(nSlot)
3336 		pActiveShell->GetView().GetViewFrame()->
3337 					GetDispatcher()->Execute(nSlot, SFX_CALLMODE_ASYNCHRON);
3338 	else if(xNameAccess.is())
3339 	{
3340 		uno::Any aObj = xNameAccess->getByName(pCnt->GetName());
3341         uno::Reference< uno::XInterface >  xTmp;
3342         aObj >>= xTmp;
3343 		uno::Reference< container::XNamed >  xNamed(xTmp, uno::UNO_QUERY);
3344         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
3345         DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!");
3346 
3347         AbstractSwRenameXNamedDlg* pDlg = pFact->CreateSwRenameXNamedDlg( this, xNamed, xNameAccess, DLG_RENAME_XNAMED );
3348         DBG_ASSERT(pDlg, "Dialogdiet fail!");
3349 		if(xSecond.is())
3350             pDlg->SetAlternativeAccess( xSecond, xThird);
3351 
3352 		String sForbiddenChars;
3353 		if(CONTENT_TYPE_BOOKMARK == nType)
3354 		{
3355             sForbiddenChars = C2S("/\\@:*?\";,.#");
3356 		}
3357 		else if(CONTENT_TYPE_TABLE == nType)
3358 		{
3359 			sForbiddenChars = C2S(" .<>");
3360 		}
3361         pDlg->SetForbiddenChars(sForbiddenChars);
3362         pDlg->Execute();
3363         delete pDlg;
3364 	}
3365 }
3366 
3367 /*-----------------14.01.97 16.53-------------------
3368 
3369 --------------------------------------------------*/
3370 
3371 void SwContentTree::GotoContent(SwContent* pCnt)
3372 {
3373 	pActiveShell->EnterStdMode();
3374 
3375 	sal_Bool bSel = sal_False;
3376 	sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
3377 	switch(nJumpType)
3378 	{
3379 		case CONTENT_TYPE_OUTLINE	:
3380 		{
3381 			pActiveShell->GotoOutline(((SwOutlineContent*)pCnt)->GetPos());
3382 		}
3383 		break;
3384 		case CONTENT_TYPE_TABLE 	:
3385 		{
3386 			pActiveShell->GotoTable(pCnt->GetName());
3387 		}
3388 		break;
3389 		case CONTENT_TYPE_FRAME     :
3390 		case CONTENT_TYPE_GRAPHIC   :
3391 		case CONTENT_TYPE_OLE       :
3392 		{
3393 			if(pActiveShell->GotoFly(pCnt->GetName()))
3394 				bSel = sal_True;
3395 		}
3396 		break;
3397         case CONTENT_TYPE_BOOKMARK:
3398         {
3399             pActiveShell->GotoMark(pCnt->GetName());
3400         }
3401 		break;
3402 		case CONTENT_TYPE_REGION    :
3403 		{
3404 			pActiveShell->GotoRegion(pCnt->GetName());
3405 		}
3406 		break;
3407 		case CONTENT_TYPE_URLFIELD:
3408 		{
3409 			if(pActiveShell->GotoINetAttr(
3410 							*((SwURLFieldContent*)pCnt)->GetINetAttr() ))
3411 			{
3412 				pActiveShell->Right( CRSR_SKIP_CHARS, sal_True, 1, sal_False);
3413 				pActiveShell->SwCrsrShell::SelectTxtAttr( RES_TXTATR_INETFMT, sal_True );
3414 			}
3415 
3416 		}
3417 		break;
3418 		case CONTENT_TYPE_REFERENCE:
3419 		{
3420 			pActiveShell->GotoRefMark(pCnt->GetName());
3421 		}
3422 		break;
3423 		case CONTENT_TYPE_INDEX:
3424 		{
3425 			if (!pActiveShell->GotoNextTOXBase(&pCnt->GetName()))
3426 				pActiveShell->GotoPrevTOXBase(&pCnt->GetName());
3427 		}
3428 		break;
3429 		case CONTENT_TYPE_POSTIT:
3430 			pActiveShell->GetView().GetPostItMgr()->AssureStdModeAtShell();
3431 			if (((SwPostItContent*)pCnt)->IsPostIt())
3432 				pActiveShell->GotoFld(*((SwPostItContent*)pCnt)->GetPostIt());
3433 			else
3434 				pActiveShell->GetView().GetDocShell()->GetWrtShell()->GotoRedline(
3435 						pActiveShell->GetView().GetDocShell()->GetWrtShell()->FindRedlineOfData(((SwPostItContent*)pCnt)->GetRedline()->GetRedlineData()));
3436 
3437 		break;
3438 		case CONTENT_TYPE_DRAWOBJECT:
3439         {
3440             SdrView* pDrawView = pActiveShell->GetDrawView();
3441 			if (pDrawView)
3442 			{
3443 				pDrawView->SdrEndTextEdit();
3444 				pDrawView->UnmarkAll();
3445                 SdrModel* _pModel = pActiveShell->getIDocumentDrawModelAccess()->GetDrawModel();
3446                 SdrPage* pPage = _pModel->GetPage(0);
3447                 sal_uInt32 nCount = pPage->GetObjCount();
3448                 for( sal_uInt32 i=0; i< nCount; i++ )
3449                 {
3450                     SdrObject* pTemp = pPage->GetObj(i);
3451                     // --> OD 2006-03-09 #i51726# - all drawing objects can be named now
3452 //                    if(pTemp->ISA(SdrObjGroup) && pTemp->GetName() == pCnt->GetName())
3453                     if ( pTemp->GetName() == pCnt->GetName() )
3454                     // <--
3455                     {
3456                         SdrPageView* pPV = pDrawView->GetSdrPageView();
3457                         if( pPV )
3458                         {
3459                             pDrawView->MarkObj( pTemp, pPV );
3460                         }
3461                     }
3462                 }
3463             }
3464         }
3465 		break;
3466 	}
3467 	if(bSel)
3468 	{
3469 		pActiveShell->HideCrsr();
3470 		pActiveShell->EnterSelFrmMode();
3471 	}
3472 	SwView& rView = pActiveShell->GetView();
3473 	rView.StopShellTimer();
3474     rView.GetPostItMgr()->SetActiveSidebarWin(0);
3475 	rView.GetEditWin().GrabFocus();
3476 }
3477 /*-----------------06.02.97 19.14-------------------
3478     Jetzt nochtdie passende text::Bookmark
3479 --------------------------------------------------*/
3480 
3481 NaviContentBookmark::NaviContentBookmark()
3482     :
3483     nDocSh(0),
3484     nDefDrag( REGION_MODE_NONE )
3485 {
3486 }
3487 
3488 /*-----------------06.02.97 20.12-------------------
3489 
3490 --------------------------------------------------*/
3491 
3492 NaviContentBookmark::NaviContentBookmark( const String &rUrl,
3493 					const String& rDesc,
3494 					sal_uInt16 nDragType,
3495 					const SwDocShell* pDocSh ) :
3496 	aUrl( rUrl ),
3497 	aDescr(rDesc),
3498     nDocSh((long)pDocSh),
3499     nDefDrag( nDragType )
3500 {
3501 }
3502 
3503 void NaviContentBookmark::Copy( TransferDataContainer& rData ) const
3504 {
3505 	rtl_TextEncoding eSysCSet = gsl_getSystemTextEncoding();
3506 
3507 	ByteString sStr( aUrl, eSysCSet );
3508 	sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
3509 	sStr += ByteString( aDescr, eSysCSet );
3510 	sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
3511 	sStr += ByteString::CreateFromInt32( nDefDrag );
3512 	sStr += static_cast< char >(NAVI_BOOKMARK_DELIM);
3513 	sStr += ByteString::CreateFromInt32( nDocSh );
3514 	rData.CopyByteString( SOT_FORMATSTR_ID_SONLK, sStr );
3515 }
3516 
3517 sal_Bool NaviContentBookmark::Paste( TransferableDataHelper& rData )
3518 {
3519 	String sStr;
3520 	sal_Bool bRet = rData.GetString( SOT_FORMATSTR_ID_SONLK, sStr );
3521 	if( bRet )
3522 	{
3523 		xub_StrLen nPos = 0;
3524 		aUrl	= sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos );
3525 		aDescr	= sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos );
3526         nDefDrag= (sal_uInt16)sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ).ToInt32();
3527 		nDocSh	= sStr.GetToken(0, NAVI_BOOKMARK_DELIM, nPos ).ToInt32();
3528 	}
3529 	return bRet;
3530 }
3531 
3532 
3533 /* -----------------------------09.12.99 13:50--------------------------------
3534 
3535  ---------------------------------------------------------------------------*/
3536 class SwContentLBoxString : public SvLBoxString
3537 {
3538 public:
3539 	SwContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags,
3540 		const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr)	{}
3541 
3542 	virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
3543 		SvLBoxEntry* pEntry);
3544 };
3545 
3546 /* -----------------------------09.12.99 13:49--------------------------------
3547 
3548  ---------------------------------------------------------------------------*/
3549 void SwContentTree::InitEntry(SvLBoxEntry* pEntry,
3550 		const XubString& rStr ,const Image& rImg1,const Image& rImg2,
3551         SvLBoxButtonKind eButtonKind)
3552 {
3553 	sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
3554 	SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
3555 	SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
3556 	SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, pCol->GetText() );
3557 	pEntry->ReplaceItem( pStr, nColToHilite );
3558 }
3559 /* -----------------------------09.12.99 13:49--------------------------------
3560 
3561  ---------------------------------------------------------------------------*/
3562 void SwContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
3563 	SvLBoxEntry* pEntry )
3564 {
3565 	if(lcl_IsContent(pEntry) &&
3566 			((SwContent *)pEntry->GetUserData())->IsInvisible())
3567 	{
3568 		//* pCont = (SwContent*)pEntry->GetUserData();
3569 		Font aOldFont( rDev.GetFont());
3570 		Font aFont(aOldFont);
3571 		Color aCol( COL_LIGHTGRAY );
3572 		aFont.SetColor( aCol );
3573 		rDev.SetFont( aFont );
3574 		rDev.DrawText( rPos, GetText() );
3575 		rDev.SetFont( aOldFont );
3576 	}
3577 	//IAccessibility2 Implementation 2009-----
3578 	// IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
3579 	/*
3580 	else if (pEntry->IsMarked())
3581 	{
3582 			rDev.DrawText( rPos, GetText() );
3583 			XubString str;
3584 			str = XubString::CreateFromAscii("*");
3585 			Point rPosStar(rPos.X()-6,rPos.Y());
3586 			Font aOldFont( rDev.GetFont());
3587 			Font aFont(aOldFont);
3588 			Color aCol( aOldFont.GetColor() );
3589 			aCol.DecreaseLuminance( 200 );
3590 			aFont.SetColor( aCol );
3591 			rDev.SetFont( aFont );
3592 			rDev.DrawText( rPosStar, str);
3593 			rDev.SetFont( aOldFont );
3594 	}
3595 	//-----IAccessibility2 Implementation 2009
3596 	*/
3597 	else
3598 		SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
3599 }
3600 /* -----------------------------06.05.2002 10:20------------------------------
3601 
3602  ---------------------------------------------------------------------------*/
3603 void    SwContentTree::DataChanged( const DataChangedEvent& rDCEvt )
3604 {
3605   if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
3606          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
3607     {
3608         sal_uInt16 nResId = GetSettings().GetStyleSettings().GetHighContrastMode() ? IMG_NAVI_ENTRYBMPH : IMG_NAVI_ENTRYBMP;
3609         aEntryImages = ImageList(SW_RES(nResId));
3610         FindActiveTypeAndRemoveUserData();
3611         Display(sal_True);
3612     }
3613     SvTreeListBox::DataChanged( rDCEvt );
3614 }
3615 
3616 
3617 //IAccessibility2 Implementation 2009-----
3618 sal_Int32  SwContentTree::GetEntryRealChildsNum( SvLBoxEntry* pParent ) const
3619 {
3620 	// ist es ein Inhaltstyp?
3621 	if(lcl_IsContentType(pParent))
3622 	{
3623 		if(!pParent->HasChilds())
3624 		{
3625 			SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
3626 			return pCntType->GetMemberCount();
3627 		}
3628 	}
3629 	return 0;
3630 }
3631 //-----IAccessibility2 Implementation 2009
3632