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