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