xref: /aoo42x/main/sw/source/ui/utlui/navipi.cxx (revision efeef26f)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*efeef26fSAndrew Rist  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19*efeef26fSAndrew Rist  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #define NAVIPI_CXX
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
32cdf0e10cSrcweir #include <tools/list.hxx>
33cdf0e10cSrcweir #include <svl/urlbmk.hxx>
34cdf0e10cSrcweir #include <svl/stritem.hxx>
35cdf0e10cSrcweir #include <svtools/filter.hxx>
36cdf0e10cSrcweir #include <svl/urihelper.hxx>
37cdf0e10cSrcweir #include <sot/formats.hxx>
38cdf0e10cSrcweir #include <sot/filelist.hxx>
39cdf0e10cSrcweir #include <sfx2/event.hxx>
40cdf0e10cSrcweir #include <sfx2/imgmgr.hxx>
41cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
42cdf0e10cSrcweir #include <sfx2/dockwin.hxx>
43cdf0e10cSrcweir #include <vcl/toolbox.hxx>
44cdf0e10cSrcweir #include <swtypes.hxx>	// fuer Pathfinder
45cdf0e10cSrcweir #include <errhdl.hxx>
46cdf0e10cSrcweir #include <swmodule.hxx>
47cdf0e10cSrcweir #ifndef _VIEW_HXX
48cdf0e10cSrcweir #include <view.hxx>
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #include <navicfg.hxx>
51cdf0e10cSrcweir #include <wrtsh.hxx>
52cdf0e10cSrcweir #ifndef _DOCSH_HXX
53cdf0e10cSrcweir #include <docsh.hxx>
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir #include <actctrl.hxx>
56cdf0e10cSrcweir #include <IMark.hxx>
57cdf0e10cSrcweir #include <navipi.hxx>
58cdf0e10cSrcweir #include <content.hxx>
59cdf0e10cSrcweir #include <workctrl.hxx>
60cdf0e10cSrcweir #include <section.hxx>
61cdf0e10cSrcweir #include <edtwin.hxx>
62cdf0e10cSrcweir #include <sfx2/app.hxx>
63cdf0e10cSrcweir #ifndef _CMDID_H
64cdf0e10cSrcweir #include <cmdid.h>
65cdf0e10cSrcweir #endif
66cdf0e10cSrcweir #ifndef _HELPID_H
67cdf0e10cSrcweir #include <helpid.h>
68cdf0e10cSrcweir #endif
69cdf0e10cSrcweir #ifndef _RIBBAR_HRC
70cdf0e10cSrcweir #include <ribbar.hrc>
71cdf0e10cSrcweir #endif
72cdf0e10cSrcweir #ifndef _NAVIPI_HRC
73cdf0e10cSrcweir #include <navipi.hrc>
74cdf0e10cSrcweir #endif
75cdf0e10cSrcweir #ifndef _UTLUI_HRC
76cdf0e10cSrcweir #include <utlui.hrc>
77cdf0e10cSrcweir #endif
78cdf0e10cSrcweir 
79cdf0e10cSrcweir #include "access.hrc"
80cdf0e10cSrcweir 
81cdf0e10cSrcweir #include <unomid.h>
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
84cdf0e10cSrcweir #define PAGE_CHANGE_TIMEOUT 1000 //Timeout fuer Seitenwechsel
85cdf0e10cSrcweir 
86cdf0e10cSrcweir #define JUMP_TYPE_TBL 0
87cdf0e10cSrcweir #define JUMP_TYPE_FRM 1
88cdf0e10cSrcweir #define JUMP_TYPE_GRF 2
89cdf0e10cSrcweir #define JUMP_TYPE_REG 3
90cdf0e10cSrcweir #define JUMP_TYPE_BKM 4
91cdf0e10cSrcweir 
92cdf0e10cSrcweir // Version fuer Konfiguration
93cdf0e10cSrcweir 
94cdf0e10cSrcweir #define NAVI_VERSION0	0
95cdf0e10cSrcweir #define NAVI_VERSION1   1
96cdf0e10cSrcweir #define NAVI_VERSION2   2 // bIsGlobalActive
97cdf0e10cSrcweir 
98cdf0e10cSrcweir #define NAVI_CONFIG_VERSION NAVI_VERSION2
99cdf0e10cSrcweir 
100cdf0e10cSrcweir using namespace ::com::sun::star::uno;
101cdf0e10cSrcweir using namespace ::com::sun::star::frame;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW_CONTEXT( SwNavigationChild, SID_NAVIGATOR, SwView )
104cdf0e10cSrcweir 
105cdf0e10cSrcweir /*------------------------------------------------------------------------
106cdf0e10cSrcweir 	Bechreibung: Steuerzeichen aus dem Outline-Entry filtern
107cdf0e10cSrcweir ------------------------------------------------------------------------*/
108cdf0e10cSrcweir 
109cdf0e10cSrcweir void SwNavigationPI::CleanEntry( String& rEntry )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir 	sal_uInt16 i = rEntry.Len();
112cdf0e10cSrcweir 	if( i )
113cdf0e10cSrcweir 		for( sal_Unicode* pStr = rEntry.GetBufferAccess(); i; --i, ++pStr )
114cdf0e10cSrcweir 			if( *pStr == 10 || *pStr == 9 )
115cdf0e10cSrcweir 				*pStr = 0x20;
116cdf0e10cSrcweir }
117cdf0e10cSrcweir /*------------------------------------------------------------------------
118cdf0e10cSrcweir  Beschreibung:	Ausfuehrung der Drag-Operation
119cdf0e10cSrcweir 				mit und ohne Childs
120cdf0e10cSrcweir ------------------------------------------------------------------------*/
121cdf0e10cSrcweir 
122cdf0e10cSrcweir void SwNavigationPI::MoveOutline(sal_uInt16 nSource, sal_uInt16 nTarget,
123cdf0e10cSrcweir 													sal_Bool bWithChilds)
124cdf0e10cSrcweir {
125cdf0e10cSrcweir     SwView *pView = GetCreateView();
126cdf0e10cSrcweir 	SwWrtShell &rSh = pView->GetWrtShell();
127cdf0e10cSrcweir 	if(nTarget < nSource || nTarget == USHRT_MAX)
128cdf0e10cSrcweir 		nTarget ++;
129cdf0e10cSrcweir 	if ( rSh.IsOutlineMovable( nSource ))
130cdf0e10cSrcweir 	{
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 		short nMove = nTarget-nSource; //( nDir<0 ) ? 1 : 0 ;
133cdf0e10cSrcweir 		rSh.GotoOutline(nSource);
134cdf0e10cSrcweir 		if (bWithChilds)
135cdf0e10cSrcweir 			rSh.MakeOutlineSel(nSource, nSource, sal_True);
136cdf0e10cSrcweir 		// Die selektierten Children zaehlen bei der Bewegung vorwaerts nicht mit
137cdf0e10cSrcweir 		sal_uInt16 nLastOutlinePos = rSh.GetOutlinePos(MAXLEVEL);
138cdf0e10cSrcweir 		if(bWithChilds && nMove > 1 &&
139cdf0e10cSrcweir 				nLastOutlinePos < nTarget)
140cdf0e10cSrcweir 		{
141cdf0e10cSrcweir 			if(!rSh.IsCrsrPtAtEnd())
142cdf0e10cSrcweir 				rSh.SwapPam();
143cdf0e10cSrcweir 			nMove -= nLastOutlinePos - nSource;
144cdf0e10cSrcweir 		}
145cdf0e10cSrcweir 		if(!bWithChilds || nMove < 1 || nLastOutlinePos < nTarget )
146cdf0e10cSrcweir 			rSh.MoveOutlinePara( nMove );
147cdf0e10cSrcweir 		rSh.ClearMark();
148cdf0e10cSrcweir 		rSh.GotoOutline( nSource + nMove);
149cdf0e10cSrcweir 		FillBox();
150cdf0e10cSrcweir 	}
151cdf0e10cSrcweir 
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 
155cdf0e10cSrcweir /*------------------------------------------------------------------------
156cdf0e10cSrcweir  Beschreibung:	Nach Goto einen Status Rahmenselektion aufheben
157cdf0e10cSrcweir ------------------------------------------------------------------------*/
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 
160cdf0e10cSrcweir void lcl_UnSelectFrm(SwWrtShell *pSh)
161cdf0e10cSrcweir {
162cdf0e10cSrcweir 	if (pSh->IsFrmSelected())
163cdf0e10cSrcweir 	{
164cdf0e10cSrcweir 		pSh->UnSelectFrm();
165cdf0e10cSrcweir 		pSh->LeaveSelFrmMode();
166cdf0e10cSrcweir 	}
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir /*------------------------------------------------------------------------
170cdf0e10cSrcweir  Beschreibung:	Select der Documentanzeige
171cdf0e10cSrcweir ------------------------------------------------------------------------*/
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 
174cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, DocListBoxSelectHdl, ListBox *, pBox )
175cdf0e10cSrcweir {
176cdf0e10cSrcweir 	int nEntryIdx = pBox->GetSelectEntryPos();
177cdf0e10cSrcweir 	SwView *pView ;
178cdf0e10cSrcweir 	pView = SwModule::GetFirstView();
179cdf0e10cSrcweir 	while (nEntryIdx-- && pView)
180cdf0e10cSrcweir 	{
181cdf0e10cSrcweir 		pView = SwModule::GetNextView(pView);
182cdf0e10cSrcweir 	}
183cdf0e10cSrcweir 	if(!pView)
184cdf0e10cSrcweir 	{
185cdf0e10cSrcweir 		nEntryIdx == 0 ?
186cdf0e10cSrcweir 			aContentTree.ShowHiddenShell():
187cdf0e10cSrcweir 				aContentTree.ShowActualView();
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 	}
191cdf0e10cSrcweir 	else
192cdf0e10cSrcweir 	{
193cdf0e10cSrcweir 		aContentTree.SetConstantShell(pView->GetWrtShellPtr());
194cdf0e10cSrcweir 	}
195cdf0e10cSrcweir 	return 0;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir 
198cdf0e10cSrcweir /*------------------------------------------------------------------------
199cdf0e10cSrcweir  Beschreibung:	Fuellen der ListBox fuer Outline Sicht oder Dokumente
200cdf0e10cSrcweir 				Der PI wird auf volle Groesse gesetzt
201cdf0e10cSrcweir ------------------------------------------------------------------------*/
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 
204cdf0e10cSrcweir void SwNavigationPI::FillBox()
205cdf0e10cSrcweir {
206cdf0e10cSrcweir 	if(pContentWrtShell)
207cdf0e10cSrcweir 	{
208cdf0e10cSrcweir 		aContentTree.SetHiddenShell( pContentWrtShell );
209cdf0e10cSrcweir 		aContentTree.Display(  sal_False );
210cdf0e10cSrcweir 	}
211cdf0e10cSrcweir 	else
212cdf0e10cSrcweir 	{
213cdf0e10cSrcweir         SwView *pView = GetCreateView();
214cdf0e10cSrcweir 		if(!pView)
215cdf0e10cSrcweir 		{
216cdf0e10cSrcweir 			aContentTree.SetActiveShell(0);
217cdf0e10cSrcweir 		}
218cdf0e10cSrcweir 		else if( pView != pActContView)
219cdf0e10cSrcweir 		{
220cdf0e10cSrcweir 			SwWrtShell* pWrtShell = pView->GetWrtShellPtr();
221cdf0e10cSrcweir 			aContentTree.SetActiveShell(pWrtShell);
222cdf0e10cSrcweir 		}
223cdf0e10cSrcweir 		else
224cdf0e10cSrcweir 			aContentTree.Display( sal_True );
225cdf0e10cSrcweir 		pActContView = pView;
226cdf0e10cSrcweir 	}
227cdf0e10cSrcweir }
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 
230cdf0e10cSrcweir void SwNavigationPI::UsePage(SwWrtShell *pSh)
231cdf0e10cSrcweir {
232cdf0e10cSrcweir 	if (!pSh)
233cdf0e10cSrcweir 	{
234cdf0e10cSrcweir         SwView *pView = GetCreateView();
235cdf0e10cSrcweir 		pSh = pView ? &pView->GetWrtShell() : 0;
236cdf0e10cSrcweir 		GetPageEdit().SetValue(1);
237cdf0e10cSrcweir 	}
238cdf0e10cSrcweir 	if (pSh)
239cdf0e10cSrcweir 	{
240cdf0e10cSrcweir 		const sal_uInt16 nPageCnt = pSh->GetPageCnt();
241cdf0e10cSrcweir 		sal_uInt16 nPhyPage, nVirPage;
242cdf0e10cSrcweir 		pSh->GetPageNum(nPhyPage, nVirPage);
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 		GetPageEdit().SetMax(nPageCnt);
245cdf0e10cSrcweir 		GetPageEdit().SetLast(nPageCnt);
246cdf0e10cSrcweir 		GetPageEdit().SetValue(nPhyPage);
247cdf0e10cSrcweir 	}
248cdf0e10cSrcweir }
249cdf0e10cSrcweir 
250cdf0e10cSrcweir /*------------------------------------------------------------------------
251cdf0e10cSrcweir  Beschreibung:	SelectHandler der Toolboxen
252cdf0e10cSrcweir ------------------------------------------------------------------------*/
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 
255cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox )
256cdf0e10cSrcweir {
257cdf0e10cSrcweir     const sal_uInt16 nCurrItemId = pBox->GetCurItemId();
258cdf0e10cSrcweir     SwView *pView = GetCreateView();
259cdf0e10cSrcweir 	if (!pView)
260cdf0e10cSrcweir 		return 1;
261cdf0e10cSrcweir 	SwWrtShell &rSh = pView->GetWrtShell();
262cdf0e10cSrcweir 	//MouseModifier fuer Outline-Move besorgen
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 	//Standard: Unterebenen werden mitgenommen
265cdf0e10cSrcweir 	// mit Ctrl Unterebenen nicht mitnehmen
266cdf0e10cSrcweir 	sal_Bool bOutlineWithChilds  = ( KEY_MOD1 != pBox->GetModifier());
267cdf0e10cSrcweir 	int nFuncId = 0;
268cdf0e10cSrcweir     sal_Bool bFocusToDoc = sal_False;
269cdf0e10cSrcweir     switch (nCurrItemId)
270cdf0e10cSrcweir 	{
271cdf0e10cSrcweir 		case FN_UP:
272cdf0e10cSrcweir 		case FN_DOWN:
273cdf0e10cSrcweir         {
274cdf0e10cSrcweir             // #i75416# move the execution of the search to an asynchronously called static link
275cdf0e10cSrcweir             bool* pbNext = new bool( FN_DOWN == nCurrItemId );
276cdf0e10cSrcweir             Application::PostUserEvent( STATIC_LINK(pView, SwView, MoveNavigationHdl), pbNext );
277cdf0e10cSrcweir         }
278cdf0e10cSrcweir 		break;
279cdf0e10cSrcweir 		case FN_SHOW_ROOT:
280cdf0e10cSrcweir 		{
281cdf0e10cSrcweir 			aContentTree.ToggleToRoot();
282cdf0e10cSrcweir 		}
283cdf0e10cSrcweir 		break;
284cdf0e10cSrcweir 		case FN_SHOW_CONTENT_BOX:
285cdf0e10cSrcweir 		case FN_SELECT_CONTENT:
286cdf0e10cSrcweir 		if(pContextWin->GetFloatingWindow())
287cdf0e10cSrcweir 		{
288cdf0e10cSrcweir 			if(_IsZoomedIn() )
289cdf0e10cSrcweir 			{
290cdf0e10cSrcweir 				_ZoomOut();
291cdf0e10cSrcweir 			}
292cdf0e10cSrcweir 			else
293cdf0e10cSrcweir 			{
294cdf0e10cSrcweir 				_ZoomIn();
295cdf0e10cSrcweir 			}
296cdf0e10cSrcweir 		}
297cdf0e10cSrcweir 		return sal_True;
298cdf0e10cSrcweir 		//break;
299cdf0e10cSrcweir 		// Funktionen, die eine direkte Aktion ausloesen
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 		case FN_SELECT_FOOTER:
302cdf0e10cSrcweir 		{
303cdf0e10cSrcweir 			rSh.MoveCrsr();
304cdf0e10cSrcweir 			const sal_uInt16 eType = rSh.GetFrmType(0,sal_False);
305cdf0e10cSrcweir 			if (eType & FRMTYPE_FOOTER)
306cdf0e10cSrcweir 			{
307cdf0e10cSrcweir 				if (rSh.EndPg())
308cdf0e10cSrcweir 					nFuncId = FN_END_OF_PAGE;
309cdf0e10cSrcweir 			}
310cdf0e10cSrcweir 			else if (rSh.GotoFooterTxt())
311cdf0e10cSrcweir 				nFuncId = FN_TO_FOOTER;
312cdf0e10cSrcweir             bFocusToDoc = sal_True;
313cdf0e10cSrcweir 		}
314cdf0e10cSrcweir 		break;
315cdf0e10cSrcweir 		case FN_SELECT_HEADER:
316cdf0e10cSrcweir 		{
317cdf0e10cSrcweir 			rSh.MoveCrsr();
318cdf0e10cSrcweir 			const sal_uInt16 eType = rSh.GetFrmType(0,sal_False);
319cdf0e10cSrcweir 			if (eType & FRMTYPE_HEADER)
320cdf0e10cSrcweir 			{
321cdf0e10cSrcweir 				if (rSh.SttPg())
322cdf0e10cSrcweir 					nFuncId = FN_START_OF_PAGE;
323cdf0e10cSrcweir 			}
324cdf0e10cSrcweir 			else if (rSh.GotoHeaderTxt())
325cdf0e10cSrcweir 				nFuncId = FN_TO_HEADER;
326cdf0e10cSrcweir             bFocusToDoc = sal_True;
327cdf0e10cSrcweir         }
328cdf0e10cSrcweir 		break;
329cdf0e10cSrcweir 		case FN_SELECT_FOOTNOTE:
330cdf0e10cSrcweir 		{
331cdf0e10cSrcweir 			rSh.MoveCrsr();
332cdf0e10cSrcweir 			const sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_False);
333cdf0e10cSrcweir 				// aus Fussnote zum Anker springen
334cdf0e10cSrcweir 			if (eFrmType & FRMTYPE_FOOTNOTE)
335cdf0e10cSrcweir 			{
336cdf0e10cSrcweir 				if (rSh.GotoFtnAnchor())
337cdf0e10cSrcweir 					nFuncId = FN_FOOTNOTE_TO_ANCHOR;
338cdf0e10cSrcweir 			}
339cdf0e10cSrcweir 				// andernfalls zuerst zum Fussnotentext springen; geht
340cdf0e10cSrcweir 				// dies nicht, zur naechten Fussnote; geht auch dies
341cdf0e10cSrcweir 				// nicht, zur vorhergehenden Fussnote
342cdf0e10cSrcweir 			else
343cdf0e10cSrcweir 			{
344cdf0e10cSrcweir 				if (rSh.GotoFtnTxt())
345cdf0e10cSrcweir 					nFuncId = FN_FOOTNOTE_TO_ANCHOR;
346cdf0e10cSrcweir 				else if (rSh.GotoNextFtnAnchor())
347cdf0e10cSrcweir 					nFuncId = FN_NEXT_FOOTNOTE;
348cdf0e10cSrcweir 				else if (rSh.GotoPrevFtnAnchor())
349cdf0e10cSrcweir 					nFuncId = FN_PREV_FOOTNOTE;
350cdf0e10cSrcweir 			}
351cdf0e10cSrcweir             bFocusToDoc = sal_True;
352cdf0e10cSrcweir         }
353cdf0e10cSrcweir 		break;
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 		case FN_SELECT_SET_AUTO_BOOKMARK:
356cdf0e10cSrcweir 			MakeMark();
357cdf0e10cSrcweir 		break;
358cdf0e10cSrcweir 		case FN_ITEM_DOWN:
359cdf0e10cSrcweir 		case FN_ITEM_UP:
360cdf0e10cSrcweir 		case FN_ITEM_LEFT:
361cdf0e10cSrcweir 		case FN_ITEM_RIGHT:
362cdf0e10cSrcweir 		case FN_GLOBAL_EDIT:
363cdf0e10cSrcweir 		{
364cdf0e10cSrcweir 			if(IsGlobalMode())
365cdf0e10cSrcweir                 aGlobalTree.ExecCommand(nCurrItemId);
366cdf0e10cSrcweir 			else
367cdf0e10cSrcweir                 aContentTree.ExecCommand(nCurrItemId, bOutlineWithChilds);
368cdf0e10cSrcweir 		}
369cdf0e10cSrcweir 		break;
370cdf0e10cSrcweir 		case FN_GLOBAL_SWITCH:
371cdf0e10cSrcweir 		{
372cdf0e10cSrcweir 			ToggleTree();
373cdf0e10cSrcweir 			pConfig->SetGlobalActive(IsGlobalMode());
374cdf0e10cSrcweir 		}
375cdf0e10cSrcweir 		break;
376cdf0e10cSrcweir 		case FN_GLOBAL_SAVE_CONTENT:
377cdf0e10cSrcweir 		{
378cdf0e10cSrcweir 			sal_Bool bSave = rSh.IsGlblDocSaveLinks();
379cdf0e10cSrcweir 			rSh.SetGlblDocSaveLinks( !bSave );
380cdf0e10cSrcweir 			pBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, !bSave );
381cdf0e10cSrcweir 		}
382cdf0e10cSrcweir 		break;
383cdf0e10cSrcweir 	}
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 	if (nFuncId)
386cdf0e10cSrcweir 	{
387cdf0e10cSrcweir 		lcl_UnSelectFrm(&rSh);
388cdf0e10cSrcweir 	}
389cdf0e10cSrcweir     if(bFocusToDoc)
390cdf0e10cSrcweir         pView->GetEditWin().GrabFocus();
391cdf0e10cSrcweir 	return sal_True;
392cdf0e10cSrcweir }
393cdf0e10cSrcweir /*------------------------------------------------------------------------
394cdf0e10cSrcweir  Beschreibung:	ClickHandler der Toolboxen
395cdf0e10cSrcweir ------------------------------------------------------------------------*/
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 
398cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxClickHdl, ToolBox *, pBox )
399cdf0e10cSrcweir {
400cdf0e10cSrcweir     const sal_uInt16 nCurrItemId = pBox->GetCurItemId();
401cdf0e10cSrcweir     switch (nCurrItemId)
402cdf0e10cSrcweir 	{
403cdf0e10cSrcweir 		case FN_GLOBAL_UPDATE:
404cdf0e10cSrcweir 		case FN_GLOBAL_OPEN:
405cdf0e10cSrcweir 		{
406cdf0e10cSrcweir             aGlobalTree.TbxMenuHdl(nCurrItemId, pBox);
407cdf0e10cSrcweir 		}
408cdf0e10cSrcweir 		break;
409cdf0e10cSrcweir 	}
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 	return sal_True;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir 
414cdf0e10cSrcweir /*-----------------13.07.04 -------------------
415cdf0e10cSrcweir  ----------------------------------------------*/
416cdf0e10cSrcweir 
417cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox )
418cdf0e10cSrcweir {
419cdf0e10cSrcweir     const sal_uInt16 nCurrItemId = pBox->GetCurItemId();
420cdf0e10cSrcweir     switch (nCurrItemId)
421cdf0e10cSrcweir     {
422cdf0e10cSrcweir 		case FN_CREATE_NAVIGATION:
423cdf0e10cSrcweir 		{
424cdf0e10cSrcweir             CreateNavigationTool(pBox->GetItemRect(FN_CREATE_NAVIGATION), sal_True);
425cdf0e10cSrcweir         }
426cdf0e10cSrcweir 		break;
427cdf0e10cSrcweir 
428cdf0e10cSrcweir         case FN_DROP_REGION:
429cdf0e10cSrcweir 		{
430cdf0e10cSrcweir             static const char* aHIDs[] =
431cdf0e10cSrcweir             {
432cdf0e10cSrcweir 				HID_NAVI_DRAG_HYP,
433cdf0e10cSrcweir 				HID_NAVI_DRAG_LINK,
434cdf0e10cSrcweir 				HID_NAVI_DRAG_COPY,
435cdf0e10cSrcweir             };
436cdf0e10cSrcweir 			PopupMenu *pMenu = new PopupMenu;
437cdf0e10cSrcweir 			for (sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++)
438cdf0e10cSrcweir 			{
439cdf0e10cSrcweir 				pMenu->InsertItem( i + 1, aContextArr[i] );
440cdf0e10cSrcweir 				pMenu->SetHelpId(i + 1, aHIDs[i]);
441cdf0e10cSrcweir 			}
442cdf0e10cSrcweir 			pMenu->CheckItem( nRegionMode + 1 );
443cdf0e10cSrcweir 			pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl));
444cdf0e10cSrcweir             pBox->SetItemDown( nCurrItemId, sal_True );
445cdf0e10cSrcweir             pMenu->Execute( pBox,
446cdf0e10cSrcweir 					pBox->GetItemRect(FN_DROP_REGION),
447cdf0e10cSrcweir                     POPUPMENU_EXECUTE_DOWN );
448cdf0e10cSrcweir             pBox->SetItemDown( nCurrItemId, sal_False );
449cdf0e10cSrcweir 			pBox->EndSelection();
450cdf0e10cSrcweir 			delete pMenu;
451cdf0e10cSrcweir 			pBox->Invalidate();
452cdf0e10cSrcweir 		}
453cdf0e10cSrcweir 		break;
454cdf0e10cSrcweir 		case FN_OUTLINE_LEVEL:
455cdf0e10cSrcweir 		{
456cdf0e10cSrcweir 			PopupMenu *pMenu = new PopupMenu;
457cdf0e10cSrcweir 			for (sal_uInt16 i = 101; i <= 100 + MAXLEVEL; i++)
458cdf0e10cSrcweir 			{
459cdf0e10cSrcweir 				pMenu->InsertItem( i, String::CreateFromInt32(i - 100) );
460cdf0e10cSrcweir 				pMenu->SetHelpId( i, HID_NAVI_OUTLINES );
461cdf0e10cSrcweir 			}
462cdf0e10cSrcweir 			pMenu->CheckItem( aContentTree.GetOutlineLevel() + 100 );
463cdf0e10cSrcweir 			pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl));
464cdf0e10cSrcweir             pBox->SetItemDown( nCurrItemId, sal_True );
465cdf0e10cSrcweir 			pMenu->Execute(	pBox,
466cdf0e10cSrcweir 					pBox->GetItemRect(FN_OUTLINE_LEVEL),
467cdf0e10cSrcweir                     POPUPMENU_EXECUTE_DOWN );
468cdf0e10cSrcweir             pBox->SetItemDown( nCurrItemId, sal_False );
469cdf0e10cSrcweir 			delete pMenu;
470cdf0e10cSrcweir 			pBox->EndSelection();
471cdf0e10cSrcweir 			pBox->Invalidate();
472cdf0e10cSrcweir 		}
473cdf0e10cSrcweir 		break;
474cdf0e10cSrcweir     }
475cdf0e10cSrcweir 	return sal_True;
476cdf0e10cSrcweir }
477cdf0e10cSrcweir 
478cdf0e10cSrcweir /*-----------------13.07.04 -------------------
479cdf0e10cSrcweir --------------------------------------------------*/
480cdf0e10cSrcweir 
481cdf0e10cSrcweir SwNavHelpToolBox::SwNavHelpToolBox(SwNavigationPI* pParent, const ResId &rResId) :
482cdf0e10cSrcweir 			SwHelpToolBox(pParent, rResId)
483cdf0e10cSrcweir {}
484cdf0e10cSrcweir /*-----------------19.06.97 09:09-------------------
485cdf0e10cSrcweir 
486cdf0e10cSrcweir --------------------------------------------------*/
487cdf0e10cSrcweir void SwNavHelpToolBox::MouseButtonDown(const MouseEvent &rEvt)
488cdf0e10cSrcweir {
489cdf0e10cSrcweir 	if(rEvt.GetButtons() == MOUSE_LEFT &&
490cdf0e10cSrcweir 			FN_CREATE_NAVIGATION == GetItemId(rEvt.GetPosPixel()))
491cdf0e10cSrcweir 	{
492cdf0e10cSrcweir         ((SwNavigationPI*)GetParent())->CreateNavigationTool(GetItemRect(FN_CREATE_NAVIGATION), sal_False);
493cdf0e10cSrcweir     }
494cdf0e10cSrcweir 	else
495cdf0e10cSrcweir 		SwHelpToolBox::MouseButtonDown(rEvt);
496cdf0e10cSrcweir }
497cdf0e10cSrcweir /* -----------------------------12.03.2002 16:55------------------------------
498cdf0e10cSrcweir 
499cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
500cdf0e10cSrcweir void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, sal_Bool bSetFocus)
501cdf0e10cSrcweir {
502cdf0e10cSrcweir //    SfxBindings& rBind = GetCreateView()->GetViewFrame()->GetBindings();
503cdf0e10cSrcweir //    rBind.ENTERREGISTRATIONS();
504cdf0e10cSrcweir     Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface();
505cdf0e10cSrcweir     SwScrollNaviPopup* pPopup = new
506cdf0e10cSrcweir         SwScrollNaviPopup(FN_SCROLL_NAVIGATION,
507cdf0e10cSrcweir                           xFrame );
508cdf0e10cSrcweir //    rBind.LEAVEREGISTRATIONS();
509cdf0e10cSrcweir 
510cdf0e10cSrcweir     Rectangle aRect(rRect);
511cdf0e10cSrcweir     Point aT1 = aRect.TopLeft();
512cdf0e10cSrcweir     aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox.OutputToAbsoluteScreenPixel(aT1)));
513cdf0e10cSrcweir     aRect.SetPos(aT1);
514cdf0e10cSrcweir     pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_RIGHT|FLOATWIN_POPUPMODE_ALLOWTEAROFF);
515cdf0e10cSrcweir     SetPopupWindow( pPopup );
516cdf0e10cSrcweir     if(bSetFocus)
517cdf0e10cSrcweir     {
518cdf0e10cSrcweir         pPopup->EndPopupMode(FLOATWIN_POPUPMODEEND_TEAROFF);
519cdf0e10cSrcweir         pPopup->GrabFocus();
520cdf0e10cSrcweir     }
521cdf0e10cSrcweir }
522cdf0e10cSrcweir 
523cdf0e10cSrcweir /*-----------------19.06.97 10:12-------------------
524cdf0e10cSrcweir 
525cdf0e10cSrcweir --------------------------------------------------*/
526cdf0e10cSrcweir void  SwNavHelpToolBox::RequestHelp( const HelpEvent& rHEvt )
527cdf0e10cSrcweir {
528cdf0e10cSrcweir 	sal_uInt16 nItemId = GetItemId(ScreenToOutputPixel(rHEvt.GetMousePosPixel()));
529cdf0e10cSrcweir 	if( FN_UP == nItemId || FN_DOWN == nItemId )
530cdf0e10cSrcweir 	{
531cdf0e10cSrcweir 		SetItemText(nItemId, SwScrollNaviPopup::GetQuickHelpText((FN_DOWN == nItemId)));
532cdf0e10cSrcweir 	}
533cdf0e10cSrcweir 	SwHelpToolBox::RequestHelp(rHEvt);
534cdf0e10cSrcweir }
535cdf0e10cSrcweir 
536cdf0e10cSrcweir /*------------------------------------------------------------------------
537cdf0e10cSrcweir  Beschreibung:	Action-Handler Edit; wechselt auf die Seite, wenn
538cdf0e10cSrcweir 				nicht Gliederungssicht angeschaltet ist.
539cdf0e10cSrcweir ------------------------------------------------------------------------*/
540cdf0e10cSrcweir 
541cdf0e10cSrcweir 
542cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, EditAction, NumEditAction *, pEdit )
543cdf0e10cSrcweir {
544cdf0e10cSrcweir     SwView *pView = GetCreateView();
545cdf0e10cSrcweir 	if (pView)
546cdf0e10cSrcweir 	{
547cdf0e10cSrcweir 		if(aPageChgTimer.IsActive())
548cdf0e10cSrcweir 			aPageChgTimer.Stop();
549cdf0e10cSrcweir 		pCreateView->GetWrtShell().GotoPage((sal_uInt16)pEdit->GetValue(), sal_True);
550cdf0e10cSrcweir 		pCreateView->GetEditWin().GrabFocus();
551cdf0e10cSrcweir 		pCreateView->GetViewFrame()->GetBindings().Invalidate(FN_STAT_PAGE);
552cdf0e10cSrcweir 	}
553cdf0e10cSrcweir 	return 0;
554cdf0e10cSrcweir }
555cdf0e10cSrcweir 
556cdf0e10cSrcweir /*------------------------------------------------------------------------
557cdf0e10cSrcweir  Beschreibung:	Falls die Seite eingestellt werden kann, wird hier
558cdf0e10cSrcweir 				das Maximum gesetzt.
559cdf0e10cSrcweir ------------------------------------------------------------------------*/
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 
562cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, EditGetFocus, NumEditAction *, pEdit )
563cdf0e10cSrcweir {
564cdf0e10cSrcweir     SwView *pView = GetCreateView();
565cdf0e10cSrcweir 	if (!pView)
566cdf0e10cSrcweir 		return 0;
567cdf0e10cSrcweir 	SwWrtShell &rSh = pView->GetWrtShell();
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 	const sal_uInt16 nPageCnt = rSh.GetPageCnt();
570cdf0e10cSrcweir 	pEdit->SetMax(nPageCnt);
571cdf0e10cSrcweir 	pEdit->SetLast(nPageCnt);
572cdf0e10cSrcweir 	return 0;
573cdf0e10cSrcweir }
574cdf0e10cSrcweir 
575cdf0e10cSrcweir /*------------------------------------------------------------------------
576cdf0e10cSrcweir  Beschreibung:
577cdf0e10cSrcweir ------------------------------------------------------------------------*/
578cdf0e10cSrcweir 
579cdf0e10cSrcweir sal_Bool SwNavigationPI::Close()
580cdf0e10cSrcweir {
581cdf0e10cSrcweir 	SfxViewFrame* pVFrame = pCreateView->GetViewFrame();
582cdf0e10cSrcweir 	pVFrame->GetBindings().Invalidate(SID_NAVIGATOR);
583cdf0e10cSrcweir 	pVFrame->GetDispatcher()->Execute(SID_NAVIGATOR);
584cdf0e10cSrcweir 	return sal_True;
585cdf0e10cSrcweir }
586cdf0e10cSrcweir 
587cdf0e10cSrcweir /*------------------------------------------------------------------------
588cdf0e10cSrcweir  Beschreibung:	Setzen einer automatischen Marke
589cdf0e10cSrcweir ------------------------------------------------------------------------*/
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 
592cdf0e10cSrcweir void SwNavigationPI::MakeMark()
593cdf0e10cSrcweir {
594cdf0e10cSrcweir     SwView *pView = GetCreateView();
595cdf0e10cSrcweir     if (!pView) return;
596cdf0e10cSrcweir     SwWrtShell &rSh = pView->GetWrtShell();
597cdf0e10cSrcweir     IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     // collect and sort navigator reminder names
600cdf0e10cSrcweir     ::std::vector< ::rtl::OUString > vNavMarkNames;
601cdf0e10cSrcweir     for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
602cdf0e10cSrcweir         ppMark != pMarkAccess->getMarksEnd();
603cdf0e10cSrcweir         ppMark++)
604cdf0e10cSrcweir         if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER )
605cdf0e10cSrcweir             vNavMarkNames.push_back(ppMark->get()->GetName());
606cdf0e10cSrcweir     ::std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
607cdf0e10cSrcweir 
608cdf0e10cSrcweir     // we are maxed out and delete one
609cdf0e10cSrcweir     // nAutoMarkIdx rotates through the available MarkNames
610cdf0e10cSrcweir     // this assumes that IDocumentMarkAccess generates Names in ascending order
611cdf0e10cSrcweir     if(vNavMarkNames.size() == MAX_MARKS)
612cdf0e10cSrcweir         pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[nAutoMarkIdx]));
613cdf0e10cSrcweir 
614cdf0e10cSrcweir     rSh.SetBookmark(KeyCode(), ::rtl::OUString(), ::rtl::OUString(), IDocumentMarkAccess::NAVIGATOR_REMINDER);
615cdf0e10cSrcweir     SwView::SetActMark( nAutoMarkIdx );
616cdf0e10cSrcweir 
617cdf0e10cSrcweir     if(++nAutoMarkIdx == MAX_MARKS)
618cdf0e10cSrcweir         nAutoMarkIdx = 0;
619cdf0e10cSrcweir }
620cdf0e10cSrcweir 
621cdf0e10cSrcweir /*------------------------------------------------------------------------
622cdf0e10cSrcweir  Beschreibung:
623cdf0e10cSrcweir ------------------------------------------------------------------------*/
624cdf0e10cSrcweir 
625cdf0e10cSrcweir void SwNavigationPI::GotoPage()
626cdf0e10cSrcweir {
627cdf0e10cSrcweir 	if ( pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp())
628cdf0e10cSrcweir 		_ZoomIn();
629cdf0e10cSrcweir 	if(IsGlobalMode())
630cdf0e10cSrcweir 		ToggleTree();
631cdf0e10cSrcweir 	UsePage(0);
632cdf0e10cSrcweir 	GetPageEdit().GrabFocus();
633cdf0e10cSrcweir }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir /*------------------------------------------------------------------------
636cdf0e10cSrcweir  Beschreibung:
637cdf0e10cSrcweir ------------------------------------------------------------------------*/
638cdf0e10cSrcweir 
639cdf0e10cSrcweir void SwNavigationPI::_ZoomOut()
640cdf0e10cSrcweir {
641cdf0e10cSrcweir 	if (_IsZoomedIn())
642cdf0e10cSrcweir 	{
643cdf0e10cSrcweir 		FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
644cdf0e10cSrcweir 		bIsZoomedIn = sal_False;
645cdf0e10cSrcweir 		Size aSz(GetOutputSizePixel());
646cdf0e10cSrcweir 		aSz.Height() = nZoomOut;
647cdf0e10cSrcweir 		Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
648cdf0e10cSrcweir 		((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
649cdf0e10cSrcweir 							aMinOutSizePixel.Width(),nZoomOutInit));
650cdf0e10cSrcweir 		pFloat->SetOutputSizePixel(aSz);
651cdf0e10cSrcweir 		FillBox();
652cdf0e10cSrcweir 		if(IsGlobalMode())
653cdf0e10cSrcweir 		{
654cdf0e10cSrcweir 			aGlobalTree.ShowTree();
655cdf0e10cSrcweir 		}
656cdf0e10cSrcweir 		else
657cdf0e10cSrcweir 		{
658cdf0e10cSrcweir 			aContentTree.ShowTree();
659cdf0e10cSrcweir 			aDocListBox.Show();
660cdf0e10cSrcweir 		}
661cdf0e10cSrcweir 		SvLBoxEntry* pFirst = aContentTree.FirstSelected();
662cdf0e10cSrcweir 		if(pFirst)
663cdf0e10cSrcweir 			aContentTree.Select(pFirst, sal_True); // toolbox enablen
664cdf0e10cSrcweir 		pConfig->SetSmall( sal_False );
665cdf0e10cSrcweir 		aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX);
666cdf0e10cSrcweir 	}
667cdf0e10cSrcweir }
668cdf0e10cSrcweir 
669cdf0e10cSrcweir /*------------------------------------------------------------------------
670cdf0e10cSrcweir  Beschreibung:
671cdf0e10cSrcweir ------------------------------------------------------------------------*/
672cdf0e10cSrcweir 
673cdf0e10cSrcweir void SwNavigationPI::_ZoomIn()
674cdf0e10cSrcweir {
675cdf0e10cSrcweir 	FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
676cdf0e10cSrcweir 	if (pFloat &&
677cdf0e10cSrcweir 		(!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
678cdf0e10cSrcweir 	{
679cdf0e10cSrcweir 		aContentTree.HideTree();
680cdf0e10cSrcweir 		aDocListBox.Hide();
681cdf0e10cSrcweir 		aGlobalTree.HideTree();
682cdf0e10cSrcweir 		bIsZoomedIn = sal_True;
683cdf0e10cSrcweir 		Size aSz(GetOutputSizePixel());
684cdf0e10cSrcweir 		if( aSz.Height() > nZoomIn )
685cdf0e10cSrcweir 			nZoomOut = ( short ) aSz.Height();
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 		aSz.Height() = nZoomIn;
688cdf0e10cSrcweir 		Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
689cdf0e10cSrcweir 		((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
690cdf0e10cSrcweir 							aMinOutSizePixel.Width(), aSz.Height()));
691cdf0e10cSrcweir 		pFloat->SetOutputSizePixel(aSz);
692cdf0e10cSrcweir 		SvLBoxEntry* pFirst = aContentTree.FirstSelected();
693cdf0e10cSrcweir 		if(pFirst)
694cdf0e10cSrcweir 			aContentTree.Select(pFirst, sal_True); // toolbox enablen
695cdf0e10cSrcweir 		pConfig->SetSmall( sal_True );
696cdf0e10cSrcweir 		aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False);
697cdf0e10cSrcweir 	}
698cdf0e10cSrcweir }
699cdf0e10cSrcweir /*------------------------------------------------------------------------
700cdf0e10cSrcweir  Beschreibung:
701cdf0e10cSrcweir ------------------------------------------------------------------------*/
702cdf0e10cSrcweir 
703cdf0e10cSrcweir void SwNavigationPI::Resize()
704cdf0e10cSrcweir {
705cdf0e10cSrcweir 	Window* pParent = GetParent();
706cdf0e10cSrcweir 	FloatingWindow* pFloat =  ((DockingWindow*)pParent)->GetFloatingWindow();
707cdf0e10cSrcweir 	Size aNewSize;
708cdf0e10cSrcweir 	if( !_IsZoomedIn() )
709cdf0e10cSrcweir 	{
710cdf0e10cSrcweir         //change the minimum width depending on the dock status
711cdf0e10cSrcweir         Size aMinOutSizePixel = ((SfxDockingWindow*)pParent)->GetMinOutputSizePixel();
712cdf0e10cSrcweir         if( pFloat)
713cdf0e10cSrcweir 		{
714cdf0e10cSrcweir 			aNewSize = pFloat->GetOutputSizePixel();
715cdf0e10cSrcweir             aMinOutSizePixel.Width() = nWishWidth;
716cdf0e10cSrcweir             aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit;
717cdf0e10cSrcweir         }
718cdf0e10cSrcweir 		else
719cdf0e10cSrcweir 		{
720cdf0e10cSrcweir 			aNewSize = pParent->GetOutputSizePixel();
721cdf0e10cSrcweir             aMinOutSizePixel.Width() = 0;
722cdf0e10cSrcweir             aMinOutSizePixel.Height() = 0;
723cdf0e10cSrcweir         }
724cdf0e10cSrcweir         ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(aMinOutSizePixel);
725cdf0e10cSrcweir 
726cdf0e10cSrcweir         const Point aPos = aContentTree.GetPosPixel();
727cdf0e10cSrcweir 		Point aLBPos = aDocListBox.GetPosPixel();
728cdf0e10cSrcweir 		long nDist = aPos.X();
729cdf0e10cSrcweir 		aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist);
730cdf0e10cSrcweir 		aNewSize.Width() -= 2 * nDist;
731cdf0e10cSrcweir 		aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist;
732cdf0e10cSrcweir 		aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() );
733cdf0e10cSrcweir 
734cdf0e10cSrcweir 		Size aDocLBSz = aDocListBox.GetSizePixel();
735cdf0e10cSrcweir 		aDocLBSz.Width() = aNewSize.Width();
736cdf0e10cSrcweir 		if(aNewSize.Height() < 0)
737cdf0e10cSrcweir 			aDocLBSz.Height() = 0;
738cdf0e10cSrcweir 		else
739cdf0e10cSrcweir 			aDocLBSz.Height() = nDocLBIniHeight;
740cdf0e10cSrcweir 		aContentTree.SetSizePixel(aNewSize);
741cdf0e10cSrcweir 		// GlobalTree faengt weiter oben an und reicht bis ganz unten
742cdf0e10cSrcweir 		aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y());
743cdf0e10cSrcweir 		aGlobalTree.SetSizePixel(aNewSize);
744cdf0e10cSrcweir 		aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(),
745cdf0e10cSrcweir 									 aDocLBSz.Width(), aDocLBSz.Height(),
746cdf0e10cSrcweir 									  WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
747cdf0e10cSrcweir 
748cdf0e10cSrcweir 	}
749cdf0e10cSrcweir }
750cdf0e10cSrcweir 
751cdf0e10cSrcweir 
752cdf0e10cSrcweir /*------------------------------------------------------------------------
753cdf0e10cSrcweir  Beschreibung:
754cdf0e10cSrcweir ------------------------------------------------------------------------*/
755cdf0e10cSrcweir 
756cdf0e10cSrcweir SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
757cdf0e10cSrcweir 								SfxChildWindowContext* pCw,
758cdf0e10cSrcweir 								Window* pParent) :
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 	Window( pParent, SW_RES(DLG_NAVIGATION_PI)),
761cdf0e10cSrcweir     SfxControllerItem( SID_DOCFULLNAME, *_pBindings ),
762cdf0e10cSrcweir 
763cdf0e10cSrcweir     aContentToolBox(this, SW_RES(TB_CONTENT)),
764cdf0e10cSrcweir     aGlobalToolBox(this, SW_RES(TB_GLOBAL)),
765cdf0e10cSrcweir     aContentImageList(SW_RES(IL_CONTENT)),
766cdf0e10cSrcweir     aContentImageListH(SW_RES(ILH_CONTENT)),
767cdf0e10cSrcweir     aContentTree(this, SW_RES(TL_CONTENT)),
768cdf0e10cSrcweir 	aGlobalTree(this, SW_RES(TL_GLOBAL)),
769cdf0e10cSrcweir 	aDocListBox(this, SW_RES(LB_DOCS)),
770cdf0e10cSrcweir 
771cdf0e10cSrcweir     pxObjectShell(0),
772cdf0e10cSrcweir     pContentView(0),
773cdf0e10cSrcweir     pContentWrtShell(0),
774cdf0e10cSrcweir     pActContView(0),
775cdf0e10cSrcweir     pCreateView(0),
776cdf0e10cSrcweir     pPopupWindow(0),
777cdf0e10cSrcweir     pFloatingWindow(0),
778cdf0e10cSrcweir 
779cdf0e10cSrcweir     pContextWin(pCw),
780cdf0e10cSrcweir 
781cdf0e10cSrcweir     pConfig(SW_MOD()->GetNavigationConfig()),
782cdf0e10cSrcweir     rBindings(*_pBindings),
783cdf0e10cSrcweir 
784cdf0e10cSrcweir     nWishWidth(0),
785cdf0e10cSrcweir 	nAutoMarkIdx(1),
786cdf0e10cSrcweir     nRegionMode(REGION_MODE_NONE),
787cdf0e10cSrcweir 
788cdf0e10cSrcweir     bSmallMode(sal_False),
789cdf0e10cSrcweir 	bIsZoomedIn(sal_False),
790cdf0e10cSrcweir 	bPageCtrlsVisible(sal_False),
791cdf0e10cSrcweir     bGlobalMode(sal_False)
792cdf0e10cSrcweir {
793cdf0e10cSrcweir     GetCreateView();
794cdf0e10cSrcweir     InitImageList();
795cdf0e10cSrcweir 
796cdf0e10cSrcweir 	aContentToolBox.SetHelpId(HID_NAVIGATOR_TOOLBOX );
797cdf0e10cSrcweir 	aGlobalToolBox.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX);
798cdf0e10cSrcweir 	aDocListBox.SetHelpId(HID_NAVIGATOR_LISTBOX );
799cdf0e10cSrcweir 
800cdf0e10cSrcweir 	nDocLBIniHeight = aDocListBox.GetSizePixel().Height();
801cdf0e10cSrcweir 	nZoomOutInit = nZoomOut = Resource::ReadShortRes();
802cdf0e10cSrcweir 
803cdf0e10cSrcweir 	//NumericField in die Toolbox einfuegen
804cdf0e10cSrcweir 	NumEditAction* pEdit = new NumEditAction(
805cdf0e10cSrcweir 					&aContentToolBox, SW_RES(NF_PAGE ));
806cdf0e10cSrcweir 	pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction));
807cdf0e10cSrcweir 	pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus));
808cdf0e10cSrcweir 	pEdit->SetAccessibleName(pEdit->GetQuickHelpText());
809cdf0e10cSrcweir 	pEdit->SetUpHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
810cdf0e10cSrcweir 	pEdit->SetDownHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
811cdf0e10cSrcweir 
812cdf0e10cSrcweir 	bPageCtrlsVisible = sal_True;
813cdf0e10cSrcweir 
814cdf0e10cSrcweir //	Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SHOW_ROOT);
815cdf0e10cSrcweir //	sal_uInt16 nWidth = 2 * (sal_uInt16)aFirstRect.Left();
816cdf0e10cSrcweir 	//doppelte Separatoren sind nicht erlaubt, also muss
817cdf0e10cSrcweir 	//die passende Groesse anders ermittelt werden
818cdf0e10cSrcweir     Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SELECT_FOOTNOTE);
819cdf0e10cSrcweir     Rectangle aSecondRect = aContentToolBox.GetItemRect(FN_SELECT_HEADER);
820cdf0e10cSrcweir 	sal_uInt16 nWidth = sal_uInt16(aFirstRect.Left() - aSecondRect.Left());
821cdf0e10cSrcweir 
822cdf0e10cSrcweir     Size aItemWinSize( nWidth , aFirstRect.Bottom() - aFirstRect.Top() );
823cdf0e10cSrcweir 	pEdit->SetSizePixel(aItemWinSize);
824cdf0e10cSrcweir 	aContentToolBox.InsertSeparator(4);
825cdf0e10cSrcweir 	aContentToolBox.InsertWindow( FN_PAGENUMBER, pEdit, 0, 4);
826cdf0e10cSrcweir 	aContentToolBox.InsertSeparator(4);
827cdf0e10cSrcweir 	aContentToolBox.SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16);
828cdf0e10cSrcweir 	aContentToolBox.ShowItem( FN_PAGENUMBER );
829cdf0e10cSrcweir 
830cdf0e10cSrcweir 	for( sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++  )
831cdf0e10cSrcweir 	{
832cdf0e10cSrcweir 		aContextArr[i] = SW_RESSTR(ST_HYPERLINK + i);
833cdf0e10cSrcweir 		aStatusArr[i] = SW_RESSTR(ST_STATUS_FIRST + i);
834cdf0e10cSrcweir 	}
835cdf0e10cSrcweir 	aStatusArr[3] = SW_RESSTR(ST_ACTIVE_VIEW);
836cdf0e10cSrcweir 	FreeResource();
837cdf0e10cSrcweir 
838cdf0e10cSrcweir 
839cdf0e10cSrcweir 	const Size& rOutSize =  GetOutputSizePixel();
840cdf0e10cSrcweir 
841cdf0e10cSrcweir 	nZoomIn = (short)rOutSize.Height();
842cdf0e10cSrcweir 
843cdf0e10cSrcweir     // Make sure the toolbox has a size that fits all its contents
844cdf0e10cSrcweir     Size aContentToolboxSize( aContentToolBox.CalcWindowSizePixel() );
845cdf0e10cSrcweir     aContentToolBox.SetOutputSizePixel( aContentToolboxSize );
846cdf0e10cSrcweir 
847cdf0e10cSrcweir     // position listbox below toolbar and add some space
848cdf0e10cSrcweir     long nListboxYPos = aContentToolBox.GetPosPixel().Y() + aContentToolboxSize.Height() + 4;
849cdf0e10cSrcweir 
850cdf0e10cSrcweir 	//Der linke und rechte Rand um die Toolboxen soll gleich sein
851cdf0e10cSrcweir 	nWishWidth = aContentToolboxSize.Width();
852cdf0e10cSrcweir 	nWishWidth += 2 * aContentToolBox.GetPosPixel().X();
853cdf0e10cSrcweir 
854cdf0e10cSrcweir     FloatingWindow* pFloat =  ((DockingWindow*)pParent)->GetFloatingWindow();
855cdf0e10cSrcweir     Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0);
856cdf0e10cSrcweir 	((SfxDockingWindow*)pParent)->SetMinOutputSizePixel(aMinSize);
857cdf0e10cSrcweir 	SetOutputSizePixel( Size( nWishWidth, nZoomOutInit));
858cdf0e10cSrcweir 	Size aTmpParentSize(((SfxDockingWindow*)pParent)->GetSizePixel());
859cdf0e10cSrcweir 	if(
860cdf0e10cSrcweir         (
861cdf0e10cSrcweir            aTmpParentSize.Width() < aMinSize.Width() ||
862cdf0e10cSrcweir            aTmpParentSize.Height() < aMinSize.Height()
863cdf0e10cSrcweir         )
864cdf0e10cSrcweir         &&
865cdf0e10cSrcweir         ((SfxDockingWindow*)pParent)->GetFloatingWindow() &&
866cdf0e10cSrcweir         !((SfxDockingWindow*)pParent)->GetFloatingWindow()->IsRollUp()
867cdf0e10cSrcweir       )
868cdf0e10cSrcweir 	    ((SfxDockingWindow*)pParent)->SetOutputSizePixel(aMinSize);
869cdf0e10cSrcweir 
870cdf0e10cSrcweir     aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
871cdf0e10cSrcweir 	aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
872cdf0e10cSrcweir 							WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
873cdf0e10cSrcweir     aContentTree.SetSpaceBetweenEntries(3);
874cdf0e10cSrcweir 	aContentTree.SetSelectionMode( SINGLE_SELECTION );
875cdf0e10cSrcweir 	aContentTree.SetDragDropMode( 	SV_DRAGDROP_CTRL_MOVE |
876cdf0e10cSrcweir 									SV_DRAGDROP_CTRL_COPY |
877cdf0e10cSrcweir 									SV_DRAGDROP_ENABLE_TOP );
878cdf0e10cSrcweir 	aContentTree.EnableAsyncDrag(sal_True);
879cdf0e10cSrcweir 	aContentTree.ShowTree();
880cdf0e10cSrcweir 	aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_True);
881cdf0e10cSrcweir 
882cdf0e10cSrcweir // 	TreeListBox fuer Globaldokument
883cdf0e10cSrcweir     aGlobalTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
884cdf0e10cSrcweir 	aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION );
885cdf0e10cSrcweir 	aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
886cdf0e10cSrcweir 								WB_CLIPCHILDREN|WB_HSCROLL );
887cdf0e10cSrcweir 	Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel());
888cdf0e10cSrcweir 	aGlobalToolBox.SetSizePixel(aGlblSize);
889cdf0e10cSrcweir 
890cdf0e10cSrcweir //	Handler
891cdf0e10cSrcweir 
892cdf0e10cSrcweir 	Link aLk = LINK(this, SwNavigationPI, ToolBoxSelectHdl);
893cdf0e10cSrcweir 	aContentToolBox.SetSelectHdl( aLk );
894cdf0e10cSrcweir 	aGlobalToolBox.SetSelectHdl( aLk );
895cdf0e10cSrcweir 	aDocListBox.SetSelectHdl(LINK(this, SwNavigationPI,
896cdf0e10cSrcweir 													DocListBoxSelectHdl));
897cdf0e10cSrcweir 	aContentToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
898cdf0e10cSrcweir 	aContentToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
899cdf0e10cSrcweir 	aGlobalToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
900cdf0e10cSrcweir 	aGlobalToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
901cdf0e10cSrcweir 	aGlobalToolBox.CheckItem(FN_GLOBAL_SWITCH, sal_True);
902cdf0e10cSrcweir 
903cdf0e10cSrcweir 	Font aFont(GetFont());
904cdf0e10cSrcweir 	aFont.SetWeight(WEIGHT_NORMAL);
905cdf0e10cSrcweir 	GetPageEdit().SetFont(aFont);
906cdf0e10cSrcweir 	aFont = aContentTree.GetFont();
907cdf0e10cSrcweir 	aFont.SetWeight(WEIGHT_NORMAL);
908cdf0e10cSrcweir 	aContentTree.SetFont(aFont);
909cdf0e10cSrcweir 	aGlobalTree.SetFont(aFont);
910cdf0e10cSrcweir 
911cdf0e10cSrcweir 	StartListening(*SFX_APP());
912cdf0e10cSrcweir     if ( pCreateView )
913cdf0e10cSrcweir         StartListening(*pCreateView);
914cdf0e10cSrcweir     SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() );
915cdf0e10cSrcweir 	pImgMan->RegisterToolBox(&aContentToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE);
916cdf0e10cSrcweir 	pImgMan->RegisterToolBox(&aGlobalToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE);
917cdf0e10cSrcweir 
918cdf0e10cSrcweir     aContentToolBox.SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox.GetItemBits( FN_CREATE_NAVIGATION ) | TIB_DROPDOWNONLY );
919cdf0e10cSrcweir     aContentToolBox.SetItemBits( FN_DROP_REGION, aContentToolBox.GetItemBits( FN_DROP_REGION ) | TIB_DROPDOWNONLY );
920cdf0e10cSrcweir     aContentToolBox.SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox.GetItemBits( FN_OUTLINE_LEVEL ) | TIB_DROPDOWNONLY );
921cdf0e10cSrcweir 
922cdf0e10cSrcweir 	if(IsGlobalDoc())
923cdf0e10cSrcweir 	{
924cdf0e10cSrcweir         SwView *pActView = GetCreateView();
925cdf0e10cSrcweir 		aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT,
926cdf0e10cSrcweir 					pActView->GetWrtShellPtr()->IsGlblDocSaveLinks());
927cdf0e10cSrcweir 		if(pConfig->IsGlobalActive())
928cdf0e10cSrcweir 			ToggleTree();
929cdf0e10cSrcweir         aGlobalTree.GrabFocus();
930cdf0e10cSrcweir     }
931cdf0e10cSrcweir     else
932cdf0e10cSrcweir         aContentTree.GrabFocus();
933cdf0e10cSrcweir 	UsePage(0);
934cdf0e10cSrcweir 	aPageChgTimer.SetTimeoutHdl(LINK(this, SwNavigationPI, ChangePageHdl));
935cdf0e10cSrcweir 	aPageChgTimer.SetTimeout(PAGE_CHANGE_TIMEOUT);
936cdf0e10cSrcweir 
937cdf0e10cSrcweir 	aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT));
938cdf0e10cSrcweir 	aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL));
939cdf0e10cSrcweir 	aDocListBox.SetAccessibleName(aStatusArr[3]);
940cdf0e10cSrcweir }
941cdf0e10cSrcweir 
942cdf0e10cSrcweir /*------------------------------------------------------------------------
943cdf0e10cSrcweir  Beschreibung:
944cdf0e10cSrcweir ------------------------------------------------------------------------*/
945cdf0e10cSrcweir 
946cdf0e10cSrcweir SwNavigationPI::~SwNavigationPI()
947cdf0e10cSrcweir {
948cdf0e10cSrcweir 	if(IsGlobalDoc() && !IsGlobalMode())
949cdf0e10cSrcweir 	{
950cdf0e10cSrcweir         SwView *pView = GetCreateView();
951cdf0e10cSrcweir 		SwWrtShell &rSh = pView->GetWrtShell();
952cdf0e10cSrcweir 		if( !rSh.IsAllProtect() )
953cdf0e10cSrcweir 			pView->GetDocShell()->SetReadOnlyUI(sal_False);
954cdf0e10cSrcweir 	}
955cdf0e10cSrcweir 
956cdf0e10cSrcweir 	EndListening(*SFX_APP());
957cdf0e10cSrcweir 
958cdf0e10cSrcweir     SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() );
959cdf0e10cSrcweir 	pImgMan->ReleaseToolBox(&aContentToolBox);
960cdf0e10cSrcweir 	pImgMan->ReleaseToolBox(&aGlobalToolBox);
961cdf0e10cSrcweir     delete aContentToolBox.GetItemWindow(FN_PAGENUMBER);
962cdf0e10cSrcweir     aContentToolBox.Clear();
963cdf0e10cSrcweir     if(pxObjectShell)
964cdf0e10cSrcweir 	{
965cdf0e10cSrcweir 		if(pxObjectShell->Is())
966cdf0e10cSrcweir 			(*pxObjectShell)->DoClose();
967cdf0e10cSrcweir 		delete pxObjectShell;
968cdf0e10cSrcweir 	}
969cdf0e10cSrcweir     delete pPopupWindow;
970cdf0e10cSrcweir     delete pFloatingWindow;
971cdf0e10cSrcweir 
972cdf0e10cSrcweir     if ( IsBound() )
973cdf0e10cSrcweir         rBindings.Release(*this);
974cdf0e10cSrcweir }
975cdf0e10cSrcweir 
976cdf0e10cSrcweir /*------------------------------------------------------------------------
977cdf0e10cSrcweir  Beschreibung:
978cdf0e10cSrcweir ------------------------------------------------------------------------*/
979cdf0e10cSrcweir 
980cdf0e10cSrcweir void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow )
981cdf0e10cSrcweir {
982cdf0e10cSrcweir     pPopupWindow = pWindow;
983cdf0e10cSrcweir     pPopupWindow->SetPopupModeEndHdl( LINK( this, SwNavigationPI, PopupModeEndHdl ));
984cdf0e10cSrcweir     pPopupWindow->SetDeleteLink_Impl( LINK( this, SwNavigationPI, ClosePopupWindow ));
985cdf0e10cSrcweir }
986cdf0e10cSrcweir 
987cdf0e10cSrcweir /*------------------------------------------------------------------------
988cdf0e10cSrcweir  Beschreibung:
989cdf0e10cSrcweir ------------------------------------------------------------------------*/
990cdf0e10cSrcweir 
991cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, PopupModeEndHdl, void *, EMPTYARG )
992cdf0e10cSrcweir {
993cdf0e10cSrcweir 	if ( pPopupWindow->IsVisible() )
994cdf0e10cSrcweir     {
995cdf0e10cSrcweir         // Replace floating window with popup window and destroy
996cdf0e10cSrcweir         // floating window instance.
997cdf0e10cSrcweir         delete pFloatingWindow;
998cdf0e10cSrcweir         pFloatingWindow = pPopupWindow;
999cdf0e10cSrcweir         pPopupWindow    = 0;
1000cdf0e10cSrcweir     }
1001cdf0e10cSrcweir     else
1002cdf0e10cSrcweir     {
1003cdf0e10cSrcweir         // Popup window has been closed by the user. No replacement, instance
1004cdf0e10cSrcweir         // will destroy itself.
1005cdf0e10cSrcweir         pPopupWindow = 0;
1006cdf0e10cSrcweir     }
1007cdf0e10cSrcweir 
1008cdf0e10cSrcweir     return 1;
1009cdf0e10cSrcweir }
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir /*------------------------------------------------------------------------
1012cdf0e10cSrcweir  Beschreibung:
1013cdf0e10cSrcweir ------------------------------------------------------------------------*/
1014cdf0e10cSrcweir 
1015cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ClosePopupWindow, SfxPopupWindow *, pWindow )
1016cdf0e10cSrcweir {
1017cdf0e10cSrcweir     if ( pWindow == pFloatingWindow )
1018cdf0e10cSrcweir         pFloatingWindow = 0;
1019cdf0e10cSrcweir     else
1020cdf0e10cSrcweir         pPopupWindow = 0;
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir     return 1;
1023cdf0e10cSrcweir }
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir /*------------------------------------------------------------------------
1026cdf0e10cSrcweir  Beschreibung:
1027cdf0e10cSrcweir ------------------------------------------------------------------------*/
1028cdf0e10cSrcweir 
1029cdf0e10cSrcweir void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
1030cdf0e10cSrcweir                                             const SfxPoolItem* /*pState*/ )
1031cdf0e10cSrcweir {
1032cdf0e10cSrcweir 	if(nSID == SID_DOCFULLNAME)
1033cdf0e10cSrcweir 	{
1034cdf0e10cSrcweir         SwView *pActView = GetCreateView();
1035cdf0e10cSrcweir 		if(pActView)
1036cdf0e10cSrcweir 		{
1037cdf0e10cSrcweir 			SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
1038cdf0e10cSrcweir 			aContentTree.SetActiveShell(pWrtShell);
1039cdf0e10cSrcweir 			sal_Bool bGlobal = IsGlobalDoc();
1040cdf0e10cSrcweir 			aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal);
1041cdf0e10cSrcweir 			if( (!bGlobal && IsGlobalMode()) ||
1042cdf0e10cSrcweir 					(!IsGlobalMode() && pConfig->IsGlobalActive()) )
1043cdf0e10cSrcweir 			{
1044cdf0e10cSrcweir 				ToggleTree();
1045cdf0e10cSrcweir 			}
1046cdf0e10cSrcweir 			if(bGlobal)
1047cdf0e10cSrcweir 			{
1048cdf0e10cSrcweir 				aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks());
1049cdf0e10cSrcweir 			}
1050cdf0e10cSrcweir 		}
1051cdf0e10cSrcweir 		else
1052cdf0e10cSrcweir 		{
1053cdf0e10cSrcweir 			aContentTree.SetActiveShell(0);
1054cdf0e10cSrcweir 		}
1055cdf0e10cSrcweir 		UpdateListBox();
1056cdf0e10cSrcweir 	}
1057cdf0e10cSrcweir }
1058cdf0e10cSrcweir 
1059cdf0e10cSrcweir /*------------------------------------------------------------------------
1060cdf0e10cSrcweir 	Bechreibung: NumericField aus der Toolbox holen
1061cdf0e10cSrcweir ------------------------------------------------------------------------*/
1062cdf0e10cSrcweir 
1063cdf0e10cSrcweir NumEditAction& SwNavigationPI::GetPageEdit()
1064cdf0e10cSrcweir {
1065cdf0e10cSrcweir 	return *(NumEditAction*)aContentToolBox.GetItemWindow(FN_PAGENUMBER);
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir 
1068cdf0e10cSrcweir /*------------------------------------------------------------------------
1069cdf0e10cSrcweir  Beschreibung:
1070cdf0e10cSrcweir ------------------------------------------------------------------------*/
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir SfxChildAlignment SwNavigationPI::CheckAlignment
1073cdf0e10cSrcweir 	(
1074cdf0e10cSrcweir 		SfxChildAlignment eActAlign,
1075cdf0e10cSrcweir 		SfxChildAlignment eAlign
1076cdf0e10cSrcweir 	)
1077cdf0e10cSrcweir {
1078cdf0e10cSrcweir SfxChildAlignment eRetAlign;
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir 	if(_IsZoomedIn())
1081cdf0e10cSrcweir 		eRetAlign = SFX_ALIGN_NOALIGNMENT;
1082cdf0e10cSrcweir 	else
1083cdf0e10cSrcweir 		switch (eAlign)
1084cdf0e10cSrcweir 		{
1085cdf0e10cSrcweir 			case SFX_ALIGN_BOTTOM:
1086cdf0e10cSrcweir 			case SFX_ALIGN_LOWESTBOTTOM:
1087cdf0e10cSrcweir 			case SFX_ALIGN_HIGHESTBOTTOM:
1088cdf0e10cSrcweir 				eRetAlign = eActAlign;
1089cdf0e10cSrcweir 				break;
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir 			case SFX_ALIGN_TOP:
1092cdf0e10cSrcweir 			case SFX_ALIGN_HIGHESTTOP:
1093cdf0e10cSrcweir 			case SFX_ALIGN_LOWESTTOP:
1094cdf0e10cSrcweir 			case SFX_ALIGN_LEFT:
1095cdf0e10cSrcweir 			case SFX_ALIGN_RIGHT:
1096cdf0e10cSrcweir 			case SFX_ALIGN_FIRSTLEFT:
1097cdf0e10cSrcweir 			case SFX_ALIGN_LASTLEFT:
1098cdf0e10cSrcweir 			case SFX_ALIGN_FIRSTRIGHT:
1099cdf0e10cSrcweir 			case SFX_ALIGN_LASTRIGHT:
1100cdf0e10cSrcweir 				eRetAlign = eAlign;
1101cdf0e10cSrcweir 				break;
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir 			default:
1104cdf0e10cSrcweir 				eRetAlign = eAlign;
1105cdf0e10cSrcweir 				break;
1106cdf0e10cSrcweir 		}
1107cdf0e10cSrcweir 	return eRetAlign;
1108cdf0e10cSrcweir 
1109cdf0e10cSrcweir }
1110cdf0e10cSrcweir 
1111cdf0e10cSrcweir /*--------------------------------------------------------------------
1112cdf0e10cSrcweir 	Beschreibung: 	Benachrichtigung bei geaenderter DocInfo
1113cdf0e10cSrcweir  --------------------------------------------------------------------*/
1114cdf0e10cSrcweir 
1115cdf0e10cSrcweir void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint )
1116cdf0e10cSrcweir {
1117cdf0e10cSrcweir     if(&rBrdc == pCreateView)
1118cdf0e10cSrcweir     {
1119cdf0e10cSrcweir         if(rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
1120cdf0e10cSrcweir         {
1121cdf0e10cSrcweir             pCreateView = 0;
1122cdf0e10cSrcweir         }
1123cdf0e10cSrcweir     }
1124cdf0e10cSrcweir     else
1125cdf0e10cSrcweir     {
1126cdf0e10cSrcweir         if(rHint.ISA(SfxEventHint))
1127cdf0e10cSrcweir         {
1128cdf0e10cSrcweir             if( pxObjectShell &&
1129cdf0e10cSrcweir                         ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_CLOSEAPP)
1130cdf0e10cSrcweir             {
1131cdf0e10cSrcweir                 DELETEZ(pxObjectShell);
1132cdf0e10cSrcweir             }
1133cdf0e10cSrcweir             else if(((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_OPENDOC)
1134cdf0e10cSrcweir             {
1135cdf0e10cSrcweir 
1136cdf0e10cSrcweir                 SwView *pActView = GetCreateView();
1137cdf0e10cSrcweir                 if(pActView)
1138cdf0e10cSrcweir                 {
1139cdf0e10cSrcweir                     SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
1140cdf0e10cSrcweir                     aContentTree.SetActiveShell(pWrtShell);
1141cdf0e10cSrcweir                     if(aGlobalTree.IsVisible())
1142cdf0e10cSrcweir                     {
1143cdf0e10cSrcweir                         if(aGlobalTree.Update( sal_False ))
1144cdf0e10cSrcweir                             aGlobalTree.Display();
1145cdf0e10cSrcweir                         else
1146cdf0e10cSrcweir                         // wenn kein Update notwendig, dann zumindest painten
1147cdf0e10cSrcweir                         // wg. der roten Eintraege fuer broken links
1148cdf0e10cSrcweir                             aGlobalTree.Invalidate();
1149cdf0e10cSrcweir                     }
1150cdf0e10cSrcweir                 }
1151cdf0e10cSrcweir             }
1152cdf0e10cSrcweir         }
1153cdf0e10cSrcweir     }
1154cdf0e10cSrcweir }
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir /*--------------------------------------------------------------------
1157cdf0e10cSrcweir 	Beschreibung:
1158cdf0e10cSrcweir  --------------------------------------------------------------------*/
1159cdf0e10cSrcweir 
1160cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu )
1161cdf0e10cSrcweir {
1162cdf0e10cSrcweir 	sal_uInt16 nMenuId = pMenu->GetCurItemId();
1163cdf0e10cSrcweir 	if(nMenuId != USHRT_MAX)
1164cdf0e10cSrcweir 	{
1165cdf0e10cSrcweir 		if(nMenuId < 100)
1166cdf0e10cSrcweir 			SetRegionDropMode( --nMenuId);
1167cdf0e10cSrcweir 		else
1168cdf0e10cSrcweir             aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) );
1169cdf0e10cSrcweir 	}
1170cdf0e10cSrcweir 	return 0;
1171cdf0e10cSrcweir }
1172cdf0e10cSrcweir 
1173cdf0e10cSrcweir 
1174cdf0e10cSrcweir /*--------------------------------------------------------------------
1175cdf0e10cSrcweir 	Beschreibung:
1176cdf0e10cSrcweir  --------------------------------------------------------------------*/
1177cdf0e10cSrcweir 
1178cdf0e10cSrcweir void SwNavigationPI::UpdateListBox()
1179cdf0e10cSrcweir {
1180cdf0e10cSrcweir 	aDocListBox.SetUpdateMode(sal_False);
1181cdf0e10cSrcweir 	aDocListBox.Clear();
1182cdf0e10cSrcweir     SwView *pActView = GetCreateView();
1183cdf0e10cSrcweir 	sal_Bool bDisable = pActView == 0;
1184cdf0e10cSrcweir 	SwView *pView = SwModule::GetFirstView();
1185cdf0e10cSrcweir 	sal_uInt16 nCount = 0;
1186cdf0e10cSrcweir 	sal_uInt16 nAct = 0;
1187cdf0e10cSrcweir 	sal_uInt16 nConstPos = 0;
1188cdf0e10cSrcweir 	const SwView* pConstView = aContentTree.IsConstantView() &&
1189cdf0e10cSrcweir 								aContentTree.GetActiveWrtShell() ?
1190cdf0e10cSrcweir 									&aContentTree.GetActiveWrtShell()->GetView():
1191cdf0e10cSrcweir 										0;
1192cdf0e10cSrcweir 	while (pView)
1193cdf0e10cSrcweir 	{
1194cdf0e10cSrcweir         SfxObjectShell* pDoc = pView->GetDocShell();
1195cdf0e10cSrcweir         // pb: #i53333# don't show help pages here
1196cdf0e10cSrcweir         if ( !pDoc->IsHelpDocument() )
1197cdf0e10cSrcweir         {
1198cdf0e10cSrcweir             String sEntry = pDoc->GetTitle();
1199cdf0e10cSrcweir             sEntry += C2S(" (");
1200cdf0e10cSrcweir             if (pView == pActView)
1201cdf0e10cSrcweir             {
1202cdf0e10cSrcweir                 nAct = nCount;
1203cdf0e10cSrcweir                 sEntry += aStatusArr[ST_ACTIVE - ST_STATUS_FIRST];
1204cdf0e10cSrcweir             }
1205cdf0e10cSrcweir             else
1206cdf0e10cSrcweir                 sEntry += aStatusArr[ST_INACTIVE - ST_STATUS_FIRST];
1207cdf0e10cSrcweir             sEntry += ')';
1208cdf0e10cSrcweir             aDocListBox.InsertEntry(sEntry);
1209cdf0e10cSrcweir 
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir             if (pConstView && pView == pConstView)
1212cdf0e10cSrcweir                 nConstPos = nCount;
1213cdf0e10cSrcweir 
1214cdf0e10cSrcweir             nCount++;
1215cdf0e10cSrcweir         }
1216cdf0e10cSrcweir         pView = SwModule::GetNextView(pView);
1217cdf0e10cSrcweir 	}
1218cdf0e10cSrcweir 	aDocListBox.InsertEntry(aStatusArr[3]); //"Aktives Fenster"
1219cdf0e10cSrcweir 	nCount++;
1220cdf0e10cSrcweir 
1221cdf0e10cSrcweir 	if(aContentTree.GetHiddenWrtShell())
1222cdf0e10cSrcweir 	{
1223cdf0e10cSrcweir 		String sEntry = aContentTree.GetHiddenWrtShell()->GetView().
1224cdf0e10cSrcweir 										GetDocShell()->GetTitle();
1225cdf0e10cSrcweir 		sEntry += C2S(" (");
1226cdf0e10cSrcweir 		sEntry += aStatusArr[ST_HIDDEN - ST_STATUS_FIRST];
1227cdf0e10cSrcweir 		sEntry += ')';
1228cdf0e10cSrcweir 		aDocListBox.InsertEntry(sEntry);
1229cdf0e10cSrcweir 		bDisable = sal_False;
1230cdf0e10cSrcweir 	}
1231cdf0e10cSrcweir 	if(aContentTree.IsActiveView())
1232cdf0e10cSrcweir 	{
1233cdf0e10cSrcweir 		//entweder den Namen des akt. Docs oder "Aktives Dokument"
1234cdf0e10cSrcweir 		sal_uInt16 nTmp = pActView ? nAct : --nCount;
1235cdf0e10cSrcweir 		aDocListBox.SelectEntryPos( nTmp );
1236cdf0e10cSrcweir 	}
1237cdf0e10cSrcweir 	else if(aContentTree.IsHiddenView())
1238cdf0e10cSrcweir 	{
1239cdf0e10cSrcweir 		aDocListBox.SelectEntryPos(nCount);
1240cdf0e10cSrcweir 	}
1241cdf0e10cSrcweir 	else
1242cdf0e10cSrcweir 		aDocListBox.SelectEntryPos(nConstPos);
1243cdf0e10cSrcweir 
1244cdf0e10cSrcweir 	aDocListBox.Enable( !bDisable );
1245cdf0e10cSrcweir 	aDocListBox.SetUpdateMode(sal_True);
1246cdf0e10cSrcweir }
1247cdf0e10cSrcweir 
1248cdf0e10cSrcweir /*-----------------16.06.97 15:05-------------------
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir --------------------------------------------------*/
1251cdf0e10cSrcweir 
1252cdf0e10cSrcweir /*------------------------------------------------------------------------
1253cdf0e10cSrcweir 	Beschreibung:
1254cdf0e10cSrcweir ------------------------------------------------------------------------*/
1255cdf0e10cSrcweir 
1256cdf0e10cSrcweir IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem)
1257cdf0e10cSrcweir {
1258cdf0e10cSrcweir 	const SfxViewFrameItem* pFrameItem = PTR_CAST(SfxViewFrameItem, pItem );
1259cdf0e10cSrcweir 	if( pFrameItem )
1260cdf0e10cSrcweir 	{
1261cdf0e10cSrcweir 		SfxViewFrame* pFrame =  pFrameItem->GetFrame();
1262cdf0e10cSrcweir 		if(pFrame)
1263cdf0e10cSrcweir 		{
1264cdf0e10cSrcweir 			aContentTree.Clear();
1265cdf0e10cSrcweir 			pContentView = PTR_CAST(SwView, pFrame->GetViewShell());
1266cdf0e10cSrcweir 			DBG_ASSERT(pContentView, "keine SwView");
1267cdf0e10cSrcweir 			if(pContentView)
1268cdf0e10cSrcweir 				pContentWrtShell = pContentView->GetWrtShellPtr();
1269cdf0e10cSrcweir 			else
1270cdf0e10cSrcweir 				pContentWrtShell = 0;
1271cdf0e10cSrcweir 			pxObjectShell = new SfxObjectShellLock(pFrame->GetObjectShell());
1272cdf0e10cSrcweir 			FillBox();
1273cdf0e10cSrcweir 			aContentTree.Update();
1274cdf0e10cSrcweir 		}
1275cdf0e10cSrcweir 	}
1276cdf0e10cSrcweir 	return 0;
1277cdf0e10cSrcweir }
1278cdf0e10cSrcweir 
1279cdf0e10cSrcweir String SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData )
1280cdf0e10cSrcweir {
1281cdf0e10cSrcweir 	String sFileName;
1282cdf0e10cSrcweir 	sal_uLong nFmt;
1283cdf0e10cSrcweir 	if( rData.HasFormat( nFmt = FORMAT_FILE_LIST ))
1284cdf0e10cSrcweir 	{
1285cdf0e10cSrcweir 		FileList aFileList;
1286cdf0e10cSrcweir 		rData.GetFileList( nFmt, aFileList );
1287cdf0e10cSrcweir 		sFileName = aFileList.GetFile( 0 );
1288cdf0e10cSrcweir 	}
1289cdf0e10cSrcweir 	else if( rData.HasFormat( nFmt = FORMAT_STRING ) ||
1290cdf0e10cSrcweir 	 		 rData.HasFormat( nFmt = FORMAT_FILE ) ||
1291cdf0e10cSrcweir 			 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILENAME ))
1292cdf0e10cSrcweir 		rData.GetString( nFmt, sFileName );
1293cdf0e10cSrcweir 	else if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_SOLK ) ||
1294cdf0e10cSrcweir  		  	 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
1295cdf0e10cSrcweir  		  	 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILECONTENT ) ||
1296cdf0e10cSrcweir  		  	 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
1297cdf0e10cSrcweir  		  	 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ))
1298cdf0e10cSrcweir 	{
1299cdf0e10cSrcweir 		INetBookmark aBkmk( aEmptyStr, aEmptyStr );
1300cdf0e10cSrcweir 		rData.GetINetBookmark( nFmt, aBkmk );
1301cdf0e10cSrcweir 		sFileName = aBkmk.GetURL();
1302cdf0e10cSrcweir 	}
1303cdf0e10cSrcweir 	if( sFileName.Len() )
1304cdf0e10cSrcweir     {
1305cdf0e10cSrcweir         sFileName = INetURLObject( sFileName ).GetMainURL( INetURLObject::NO_DECODE );
1306cdf0e10cSrcweir     }
1307cdf0e10cSrcweir 	return sFileName;
1308cdf0e10cSrcweir }
1309cdf0e10cSrcweir 
1310cdf0e10cSrcweir /*------------------------------------------------------------------------
1311cdf0e10cSrcweir 	Beschreibung:
1312cdf0e10cSrcweir ------------------------------------------------------------------------*/
1313cdf0e10cSrcweir 
1314cdf0e10cSrcweir sal_Int8 SwNavigationPI::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
1315cdf0e10cSrcweir {
1316cdf0e10cSrcweir 	return ( !aContentTree.IsInDrag() &&
1317cdf0e10cSrcweir 		( aContentTree.IsDropFormatSupported( FORMAT_FILE ) ||
1318cdf0e10cSrcweir 		  aContentTree.IsDropFormatSupported( FORMAT_STRING ) ||
1319cdf0e10cSrcweir 		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_SOLK ) ||
1320cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
1321cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILECONTENT ) ||
1322cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
1323cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) ||
1324cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILENAME )))
1325cdf0e10cSrcweir 		? DND_ACTION_COPY
1326cdf0e10cSrcweir 		: DND_ACTION_NONE;
1327cdf0e10cSrcweir }
1328cdf0e10cSrcweir 
1329cdf0e10cSrcweir sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt )
1330cdf0e10cSrcweir {
1331cdf0e10cSrcweir 	TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
1332cdf0e10cSrcweir 	sal_Int8 nRet = DND_ACTION_NONE;
1333cdf0e10cSrcweir 	String sFileName;
1334cdf0e10cSrcweir 	if( !aContentTree.IsInDrag() &&
1335cdf0e10cSrcweir 		0 != (sFileName = SwNavigationPI::CreateDropFileName( aData )).Len() )
1336cdf0e10cSrcweir 	{
1337cdf0e10cSrcweir 		INetURLObject aTemp( sFileName );
1338cdf0e10cSrcweir 		GraphicDescriptor aDesc( aTemp );
1339cdf0e10cSrcweir 		if( !aDesc.Detect() )	// keine Grafiken annehmen
1340cdf0e10cSrcweir 		{
1341cdf0e10cSrcweir 			if( STRING_NOTFOUND == sFileName.Search('#')
1342cdf0e10cSrcweir 				&& (!sContentFileName.Len() || sContentFileName != sFileName ))
1343cdf0e10cSrcweir 			{
1344cdf0e10cSrcweir 				nRet = rEvt.mnAction;
1345cdf0e10cSrcweir 				sFileName.EraseTrailingChars( char(0) );
1346cdf0e10cSrcweir 				sContentFileName = sFileName;
1347cdf0e10cSrcweir 				if(pxObjectShell)
1348cdf0e10cSrcweir 				{
1349cdf0e10cSrcweir 					aContentTree.SetHiddenShell( 0 );
1350cdf0e10cSrcweir 					(*pxObjectShell)->DoClose();
1351cdf0e10cSrcweir 					DELETEZ( pxObjectShell);
1352cdf0e10cSrcweir 				}
1353cdf0e10cSrcweir 				SfxStringItem aFileItem(SID_FILE_NAME, sFileName );
1354cdf0e10cSrcweir 				String sOptions = C2S("HRC");
1355cdf0e10cSrcweir 				SfxStringItem aOptionsItem( SID_OPTIONS, sOptions );
1356cdf0e10cSrcweir 				SfxLinkItem aLink( SID_DONELINK,
1357cdf0e10cSrcweir 									LINK( this, SwNavigationPI, DoneLink ) );
1358cdf0e10cSrcweir 				GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(
1359cdf0e10cSrcweir 							SID_OPENDOC, SFX_CALLMODE_ASYNCHRON,
1360cdf0e10cSrcweir 							&aFileItem, &aOptionsItem, &aLink, 0L );
1361cdf0e10cSrcweir 			}
1362cdf0e10cSrcweir 		}
1363cdf0e10cSrcweir 	}
1364cdf0e10cSrcweir 	return nRet;
1365cdf0e10cSrcweir }
1366cdf0e10cSrcweir 
1367cdf0e10cSrcweir /*-----------------27.11.96 13.00-------------------
1368cdf0e10cSrcweir 
1369cdf0e10cSrcweir --------------------------------------------------*/
1370cdf0e10cSrcweir 
1371cdf0e10cSrcweir void SwNavigationPI::SetRegionDropMode(sal_uInt16 nNewMode)
1372cdf0e10cSrcweir {
1373cdf0e10cSrcweir 	nRegionMode = nNewMode;
1374cdf0e10cSrcweir 	pConfig->SetRegionMode( nRegionMode );
1375cdf0e10cSrcweir 
1376cdf0e10cSrcweir     sal_uInt16 nDropId = FN_DROP_REGION;
1377cdf0e10cSrcweir 	if(nRegionMode == REGION_MODE_LINK)
1378cdf0e10cSrcweir         nDropId = FN_DROP_REGION_LINK;
1379cdf0e10cSrcweir 	else if(nRegionMode == REGION_MODE_EMBEDDED)
1380cdf0e10cSrcweir         nDropId = FN_DROP_REGION_COPY;
1381cdf0e10cSrcweir 
1382cdf0e10cSrcweir     ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode()
1383cdf0e10cSrcweir 				? aContentImageListH : aContentImageList;
1384cdf0e10cSrcweir 
1385cdf0e10cSrcweir     aContentToolBox.SetItemImage( FN_DROP_REGION,
1386cdf0e10cSrcweir                                     rImgLst.GetImage(nDropId));
1387cdf0e10cSrcweir }
1388cdf0e10cSrcweir 
1389cdf0e10cSrcweir 
1390cdf0e10cSrcweir /*-----------------12.06.97 09:47-------------------
1391cdf0e10cSrcweir 
1392cdf0e10cSrcweir --------------------------------------------------*/
1393cdf0e10cSrcweir 
1394cdf0e10cSrcweir sal_Bool	SwNavigationPI::ToggleTree()
1395cdf0e10cSrcweir {
1396cdf0e10cSrcweir 	sal_Bool bRet = sal_True;
1397cdf0e10cSrcweir 	sal_Bool bGlobalDoc = IsGlobalDoc();
1398cdf0e10cSrcweir 	if(!IsGlobalMode() && bGlobalDoc)
1399cdf0e10cSrcweir 	{
1400cdf0e10cSrcweir 		SetUpdateMode(sal_False);
1401cdf0e10cSrcweir 		if(_IsZoomedIn())
1402cdf0e10cSrcweir 			_ZoomOut();
1403cdf0e10cSrcweir 		aGlobalTree.ShowTree();
1404cdf0e10cSrcweir 		aGlobalToolBox.Show();
1405cdf0e10cSrcweir 		aContentTree.HideTree();
1406cdf0e10cSrcweir 		aContentToolBox.Hide();
1407cdf0e10cSrcweir 		aDocListBox.Hide();
1408cdf0e10cSrcweir 		SetGlobalMode(sal_True);
1409cdf0e10cSrcweir 		SetUpdateMode(sal_True);
1410cdf0e10cSrcweir 	}
1411cdf0e10cSrcweir 	else
1412cdf0e10cSrcweir 	{
1413cdf0e10cSrcweir 		aGlobalTree.HideTree();
1414cdf0e10cSrcweir 		aGlobalToolBox.Hide();
1415cdf0e10cSrcweir 		if(!_IsZoomedIn())
1416cdf0e10cSrcweir 		{
1417cdf0e10cSrcweir 			aContentTree.ShowTree();
1418cdf0e10cSrcweir 			aContentToolBox.Show();
1419cdf0e10cSrcweir 			aDocListBox.Show();
1420cdf0e10cSrcweir 		}
1421cdf0e10cSrcweir 		bRet = sal_False;
1422cdf0e10cSrcweir 		SetGlobalMode(sal_False);
1423cdf0e10cSrcweir 	}
1424cdf0e10cSrcweir     return bRet;
1425cdf0e10cSrcweir }
1426cdf0e10cSrcweir 
1427cdf0e10cSrcweir /*-----------------13.06.97 09:42-------------------
1428cdf0e10cSrcweir 
1429cdf0e10cSrcweir --------------------------------------------------*/
1430cdf0e10cSrcweir sal_Bool 	SwNavigationPI::IsGlobalDoc() const
1431cdf0e10cSrcweir {
1432cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1433cdf0e10cSrcweir     SwView *pView = GetCreateView();
1434cdf0e10cSrcweir 	if(pView)
1435cdf0e10cSrcweir 	{
1436cdf0e10cSrcweir 		SwWrtShell &rSh = pView->GetWrtShell();
1437cdf0e10cSrcweir 		bRet = rSh.IsGlobalDoc();
1438cdf0e10cSrcweir 	}
1439cdf0e10cSrcweir 	return bRet;
1440cdf0e10cSrcweir }
1441cdf0e10cSrcweir /* -----------------26.10.98 08:10-------------------
1442cdf0e10cSrcweir  *
1443cdf0e10cSrcweir  * --------------------------------------------------*/
1444cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ChangePageHdl, Timer*, EMPTYARG )
1445cdf0e10cSrcweir {
1446cdf0e10cSrcweir 	EditAction(&GetPageEdit());
1447cdf0e10cSrcweir 	GetPageEdit().GrabFocus();
1448cdf0e10cSrcweir 	return 0;
1449cdf0e10cSrcweir }
1450cdf0e10cSrcweir /* -----------------26.10.98 08:14-------------------
1451cdf0e10cSrcweir  *
1452cdf0e10cSrcweir  * --------------------------------------------------*/
1453cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, PageEditModifyHdl, Edit*, EMPTYARG )
1454cdf0e10cSrcweir {
1455cdf0e10cSrcweir 	if(aPageChgTimer.IsActive())
1456cdf0e10cSrcweir 		aPageChgTimer.Stop();
1457cdf0e10cSrcweir 	aPageChgTimer.Start();
1458cdf0e10cSrcweir 	return 0;
1459cdf0e10cSrcweir }
1460cdf0e10cSrcweir 
1461cdf0e10cSrcweir /* -----------------------------23.04.01 07:34--------------------------------
1462cdf0e10cSrcweir 
1463cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1464cdf0e10cSrcweir SwView*  SwNavigationPI::GetCreateView() const
1465cdf0e10cSrcweir {
1466cdf0e10cSrcweir     if(!pCreateView)
1467cdf0e10cSrcweir     {
1468cdf0e10cSrcweir         SwView* pView = SwModule::GetFirstView();
1469cdf0e10cSrcweir         while(pView)
1470cdf0e10cSrcweir         {
1471cdf0e10cSrcweir             if(&pView->GetViewFrame()->GetBindings() == &rBindings)
1472cdf0e10cSrcweir             {
1473cdf0e10cSrcweir                 ((SwNavigationPI*)this)->pCreateView = pView;
1474cdf0e10cSrcweir                 ((SwNavigationPI*)this)->StartListening(*pCreateView);
1475cdf0e10cSrcweir                 break;
1476cdf0e10cSrcweir             }
1477cdf0e10cSrcweir             pView = SwModule::GetNextView(pView);
1478cdf0e10cSrcweir         }
1479cdf0e10cSrcweir     }
1480cdf0e10cSrcweir     return pCreateView;
1481cdf0e10cSrcweir }
1482cdf0e10cSrcweir 
1483cdf0e10cSrcweir 
1484cdf0e10cSrcweir /*------------------------------------------------------------------------
1485cdf0e10cSrcweir  Beschreibung:
1486cdf0e10cSrcweir ------------------------------------------------------------------------*/
1487cdf0e10cSrcweir 
1488cdf0e10cSrcweir SwNavigationChild::SwNavigationChild( Window* pParent,
1489cdf0e10cSrcweir                         sal_uInt16 nId,
1490cdf0e10cSrcweir                         SfxBindings* _pBindings,
1491cdf0e10cSrcweir 						SfxChildWinInfo* pInfo )
1492cdf0e10cSrcweir 	: SfxChildWindowContext( nId )
1493cdf0e10cSrcweir {
1494cdf0e10cSrcweir     SwNavigationPI* pNavi  = new SwNavigationPI( _pBindings, this, pParent );
1495cdf0e10cSrcweir 	SetWindow( pNavi );
1496cdf0e10cSrcweir     _pBindings->Invalidate(SID_NAVIGATOR);
1497cdf0e10cSrcweir 	String sExtra = pInfo->aExtraString;
1498cdf0e10cSrcweir 
1499cdf0e10cSrcweir 	SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();
1500cdf0e10cSrcweir 
1501cdf0e10cSrcweir     sal_uInt16 nRootType = static_cast< sal_uInt16 >( pNaviConfig->GetRootType() );
1502cdf0e10cSrcweir 	if( nRootType < CONTENT_TYPE_MAX )
1503cdf0e10cSrcweir 	{
1504cdf0e10cSrcweir 		pNavi->aContentTree.SetRootType(nRootType);
1505cdf0e10cSrcweir 		pNavi->aContentToolBox.CheckItem(FN_SHOW_ROOT, sal_True);
1506cdf0e10cSrcweir 	}
1507cdf0e10cSrcweir     pNavi->aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) );
1508cdf0e10cSrcweir     pNavi->SetRegionDropMode( static_cast< sal_uInt16 >( pNaviConfig->GetRegionMode() ) );
1509cdf0e10cSrcweir 
1510cdf0e10cSrcweir 	if(GetFloatingWindow() && pNaviConfig->IsSmall())
1511cdf0e10cSrcweir 	{
1512cdf0e10cSrcweir 		pNavi->_ZoomIn();
1513cdf0e10cSrcweir 	}
1514cdf0e10cSrcweir }
1515cdf0e10cSrcweir /* -----------------------------06.05.2002 10:06------------------------------
1516cdf0e10cSrcweir 
1517cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1518cdf0e10cSrcweir void SwNavigationPI::DataChanged( const DataChangedEvent& rDCEvt )
1519cdf0e10cSrcweir {
1520cdf0e10cSrcweir     Window::DataChanged( rDCEvt );
1521cdf0e10cSrcweir     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
1522cdf0e10cSrcweir          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1523cdf0e10cSrcweir     {
1524cdf0e10cSrcweir         InitImageList();
1525cdf0e10cSrcweir         const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1526cdf0e10cSrcweir         Color aBgColor = rStyleSettings.GetFaceColor();
1527cdf0e10cSrcweir         Wallpaper aBack( aBgColor );
1528cdf0e10cSrcweir         SetBackground( aBack );
1529cdf0e10cSrcweir     }
1530cdf0e10cSrcweir }
1531cdf0e10cSrcweir /* -----------------------------06.05.2002 10:07------------------------------
1532cdf0e10cSrcweir 
1533cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1534cdf0e10cSrcweir void SwNavigationPI::InitImageList()
1535cdf0e10cSrcweir {
1536cdf0e10cSrcweir     sal_uInt16 k;
1537cdf0e10cSrcweir 
1538cdf0e10cSrcweir     ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ?
1539cdf0e10cSrcweir                 aContentImageListH : aContentImageList;
1540cdf0e10cSrcweir     for( k = 0; k < aContentToolBox.GetItemCount(); k++)
1541cdf0e10cSrcweir 			aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k),
1542cdf0e10cSrcweir                     rImgLst.GetImage(aContentToolBox.GetItemId(k)));
1543cdf0e10cSrcweir 
1544cdf0e10cSrcweir 	for( k = 0; k < aGlobalToolBox.GetItemCount(); k++)
1545cdf0e10cSrcweir 			aGlobalToolBox.SetItemImage(aGlobalToolBox.GetItemId(k),
1546cdf0e10cSrcweir                     rImgLst.GetImage(aGlobalToolBox.GetItemId(k)));
1547cdf0e10cSrcweir 
1548cdf0e10cSrcweir     sal_uInt16 nDropId = FN_DROP_REGION;
1549cdf0e10cSrcweir 	if(nRegionMode == REGION_MODE_LINK)
1550cdf0e10cSrcweir         nDropId = FN_DROP_REGION_LINK;
1551cdf0e10cSrcweir 	else if(nRegionMode == REGION_MODE_EMBEDDED)
1552cdf0e10cSrcweir         nDropId = FN_DROP_REGION_COPY;
1553cdf0e10cSrcweir     aContentToolBox.SetItemImage( FN_DROP_REGION,
1554cdf0e10cSrcweir                                     rImgLst.GetImage(nDropId));
1555cdf0e10cSrcweir }
1556cdf0e10cSrcweir 
1557