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