xref: /aoo41x/main/sw/source/ui/utlui/navipi.cxx (revision b7d08b69)
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
10efeef26fSAndrew Rist  *
11efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist  *
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.
19efeef26fSAndrew Rist  *
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 
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:
286*b7d08b69SAndre Fischer             if(pContextWin!=NULL && pContextWin->GetFloatingWindow()!=NULL)
287*b7d08b69SAndre Fischer             {
288*b7d08b69SAndre Fischer                 if(_IsZoomedIn() )
289*b7d08b69SAndre Fischer                 {
290*b7d08b69SAndre Fischer                     _ZoomOut();
291*b7d08b69SAndre Fischer                 }
292*b7d08b69SAndre Fischer                 else
293*b7d08b69SAndre Fischer                 {
294*b7d08b69SAndre Fischer                     _ZoomIn();
295*b7d08b69SAndre Fischer                 }
296*b7d08b69SAndre Fischer             }
297*b7d08b69SAndre Fischer             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 {
627*b7d08b69SAndre Fischer 	if (pContextWin && 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 	{
643*b7d08b69SAndre Fischer 		FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL;
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));
650*b7d08b69SAndre Fischer         if (pFloat != NULL)
651*b7d08b69SAndre Fischer             pFloat->SetOutputSizePixel(aSz);
652cdf0e10cSrcweir 		FillBox();
653cdf0e10cSrcweir 		if(IsGlobalMode())
654cdf0e10cSrcweir 		{
655cdf0e10cSrcweir 			aGlobalTree.ShowTree();
656cdf0e10cSrcweir 		}
657cdf0e10cSrcweir 		else
658cdf0e10cSrcweir 		{
659cdf0e10cSrcweir 			aContentTree.ShowTree();
660cdf0e10cSrcweir 			aDocListBox.Show();
661cdf0e10cSrcweir 		}
662cdf0e10cSrcweir 		SvLBoxEntry* pFirst = aContentTree.FirstSelected();
663cdf0e10cSrcweir 		if(pFirst)
664cdf0e10cSrcweir 			aContentTree.Select(pFirst, sal_True); // toolbox enablen
665cdf0e10cSrcweir 		pConfig->SetSmall( sal_False );
666cdf0e10cSrcweir 		aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX);
667cdf0e10cSrcweir 	}
668cdf0e10cSrcweir }
669cdf0e10cSrcweir 
670cdf0e10cSrcweir /*------------------------------------------------------------------------
671cdf0e10cSrcweir  Beschreibung:
672cdf0e10cSrcweir ------------------------------------------------------------------------*/
673cdf0e10cSrcweir 
674cdf0e10cSrcweir void SwNavigationPI::_ZoomIn()
675cdf0e10cSrcweir {
676*b7d08b69SAndre Fischer     if (pContextWin != NULL)
677*b7d08b69SAndre Fischer     {
678*b7d08b69SAndre Fischer         FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
679*b7d08b69SAndre Fischer         if (pFloat &&
680*b7d08b69SAndre Fischer             (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
681*b7d08b69SAndre Fischer         {
682*b7d08b69SAndre Fischer             aContentTree.HideTree();
683*b7d08b69SAndre Fischer             aDocListBox.Hide();
684*b7d08b69SAndre Fischer             aGlobalTree.HideTree();
685*b7d08b69SAndre Fischer             bIsZoomedIn = sal_True;
686*b7d08b69SAndre Fischer             Size aSz(GetOutputSizePixel());
687*b7d08b69SAndre Fischer             if( aSz.Height() > nZoomIn )
688*b7d08b69SAndre Fischer                 nZoomOut = ( short ) aSz.Height();
689*b7d08b69SAndre Fischer 
690*b7d08b69SAndre Fischer             aSz.Height() = nZoomIn;
691*b7d08b69SAndre Fischer             Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
692*b7d08b69SAndre Fischer             ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
693*b7d08b69SAndre Fischer                     aMinOutSizePixel.Width(), aSz.Height()));
694*b7d08b69SAndre Fischer             pFloat->SetOutputSizePixel(aSz);
695*b7d08b69SAndre Fischer             SvLBoxEntry* pFirst = aContentTree.FirstSelected();
696*b7d08b69SAndre Fischer             if(pFirst)
697*b7d08b69SAndre Fischer                 aContentTree.Select(pFirst, sal_True); // toolbox enablen
698*b7d08b69SAndre Fischer             pConfig->SetSmall( sal_True );
699*b7d08b69SAndre Fischer             aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False);
700*b7d08b69SAndre Fischer         }
701*b7d08b69SAndre Fischer     }
702cdf0e10cSrcweir }
703cdf0e10cSrcweir /*------------------------------------------------------------------------
704cdf0e10cSrcweir  Beschreibung:
705cdf0e10cSrcweir ------------------------------------------------------------------------*/
706cdf0e10cSrcweir 
707cdf0e10cSrcweir void SwNavigationPI::Resize()
708cdf0e10cSrcweir {
709cdf0e10cSrcweir 	Window* pParent = GetParent();
710*b7d08b69SAndre Fischer     if( !_IsZoomedIn() )
711*b7d08b69SAndre Fischer     {
712*b7d08b69SAndre Fischer         Size aNewSize (pParent->GetOutputSizePixel());
713cdf0e10cSrcweir 
714*b7d08b69SAndre Fischer         SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParent);
715*b7d08b69SAndre Fischer         if (pDockingParent != NULL)
716*b7d08b69SAndre Fischer         {
717*b7d08b69SAndre Fischer             FloatingWindow* pFloat =  pDockingParent->GetFloatingWindow();
718*b7d08b69SAndre Fischer             //change the minimum width depending on the dock status
719*b7d08b69SAndre Fischer             Size aMinOutSizePixel = pDockingParent->GetMinOutputSizePixel();
720*b7d08b69SAndre Fischer             if( pFloat)
721*b7d08b69SAndre Fischer             {
722*b7d08b69SAndre Fischer                 aNewSize = pFloat->GetOutputSizePixel();
723*b7d08b69SAndre Fischer                 aMinOutSizePixel.Width() = nWishWidth;
724*b7d08b69SAndre Fischer                 aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit;
725*b7d08b69SAndre Fischer             }
726*b7d08b69SAndre Fischer             else
727*b7d08b69SAndre Fischer             {
728*b7d08b69SAndre Fischer                 aMinOutSizePixel.Width() = 0;
729*b7d08b69SAndre Fischer                 aMinOutSizePixel.Height() = 0;
730*b7d08b69SAndre Fischer             }
731*b7d08b69SAndre Fischer             pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel);
732*b7d08b69SAndre Fischer         }
733*b7d08b69SAndre Fischer 
734cdf0e10cSrcweir         const Point aPos = aContentTree.GetPosPixel();
735*b7d08b69SAndre Fischer         Point aLBPos = aDocListBox.GetPosPixel();
736*b7d08b69SAndre Fischer         long nDist = aPos.X();
737*b7d08b69SAndre Fischer         aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist);
738*b7d08b69SAndre Fischer         aNewSize.Width() -= 2 * nDist;
739*b7d08b69SAndre Fischer         aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist;
740*b7d08b69SAndre Fischer         aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() );
741*b7d08b69SAndre Fischer 
742*b7d08b69SAndre Fischer         Size aDocLBSz = aDocListBox.GetSizePixel();
743*b7d08b69SAndre Fischer         aDocLBSz.Width() = aNewSize.Width();
744*b7d08b69SAndre Fischer         if(aNewSize.Height() < 0)
745*b7d08b69SAndre Fischer             aDocLBSz.Height() = 0;
746*b7d08b69SAndre Fischer         else
747*b7d08b69SAndre Fischer             aDocLBSz.Height() = nDocLBIniHeight;
748*b7d08b69SAndre Fischer         aContentTree.SetSizePixel(aNewSize);
749*b7d08b69SAndre Fischer         // GlobalTree faengt weiter oben an und reicht bis ganz unten
750*b7d08b69SAndre Fischer         aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y());
751*b7d08b69SAndre Fischer         aGlobalTree.SetSizePixel(aNewSize);
752*b7d08b69SAndre Fischer         aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(),
753*b7d08b69SAndre Fischer             aDocLBSz.Width(), aDocLBSz.Height(),
754*b7d08b69SAndre Fischer             WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
755cdf0e10cSrcweir 	}
756cdf0e10cSrcweir }
757cdf0e10cSrcweir 
758cdf0e10cSrcweir 
759cdf0e10cSrcweir /*------------------------------------------------------------------------
760cdf0e10cSrcweir  Beschreibung:
761cdf0e10cSrcweir ------------------------------------------------------------------------*/
762cdf0e10cSrcweir 
763cdf0e10cSrcweir SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
764cdf0e10cSrcweir 								SfxChildWindowContext* pCw,
765cdf0e10cSrcweir 								Window* pParent) :
766cdf0e10cSrcweir 
767cdf0e10cSrcweir 	Window( pParent, SW_RES(DLG_NAVIGATION_PI)),
768cdf0e10cSrcweir     SfxControllerItem( SID_DOCFULLNAME, *_pBindings ),
769cdf0e10cSrcweir 
770cdf0e10cSrcweir     aContentToolBox(this, SW_RES(TB_CONTENT)),
771cdf0e10cSrcweir     aGlobalToolBox(this, SW_RES(TB_GLOBAL)),
772cdf0e10cSrcweir     aContentImageList(SW_RES(IL_CONTENT)),
773cdf0e10cSrcweir     aContentImageListH(SW_RES(ILH_CONTENT)),
774cdf0e10cSrcweir     aContentTree(this, SW_RES(TL_CONTENT)),
775cdf0e10cSrcweir 	aGlobalTree(this, SW_RES(TL_GLOBAL)),
776cdf0e10cSrcweir 	aDocListBox(this, SW_RES(LB_DOCS)),
777cdf0e10cSrcweir 
778cdf0e10cSrcweir     pxObjectShell(0),
779cdf0e10cSrcweir     pContentView(0),
780cdf0e10cSrcweir     pContentWrtShell(0),
781cdf0e10cSrcweir     pActContView(0),
782cdf0e10cSrcweir     pCreateView(0),
783cdf0e10cSrcweir     pPopupWindow(0),
784cdf0e10cSrcweir     pFloatingWindow(0),
785cdf0e10cSrcweir 
786cdf0e10cSrcweir     pContextWin(pCw),
787cdf0e10cSrcweir 
788cdf0e10cSrcweir     pConfig(SW_MOD()->GetNavigationConfig()),
789cdf0e10cSrcweir     rBindings(*_pBindings),
790cdf0e10cSrcweir 
791cdf0e10cSrcweir     nWishWidth(0),
792cdf0e10cSrcweir 	nAutoMarkIdx(1),
793cdf0e10cSrcweir     nRegionMode(REGION_MODE_NONE),
794cdf0e10cSrcweir 
795cdf0e10cSrcweir     bSmallMode(sal_False),
796cdf0e10cSrcweir 	bIsZoomedIn(sal_False),
797cdf0e10cSrcweir 	bPageCtrlsVisible(sal_False),
798cdf0e10cSrcweir     bGlobalMode(sal_False)
799cdf0e10cSrcweir {
800cdf0e10cSrcweir     GetCreateView();
801cdf0e10cSrcweir     InitImageList();
802cdf0e10cSrcweir 
803cdf0e10cSrcweir 	aContentToolBox.SetHelpId(HID_NAVIGATOR_TOOLBOX );
804cdf0e10cSrcweir 	aGlobalToolBox.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX);
805cdf0e10cSrcweir 	aDocListBox.SetHelpId(HID_NAVIGATOR_LISTBOX );
806cdf0e10cSrcweir 
807cdf0e10cSrcweir 	nDocLBIniHeight = aDocListBox.GetSizePixel().Height();
808cdf0e10cSrcweir 	nZoomOutInit = nZoomOut = Resource::ReadShortRes();
809cdf0e10cSrcweir 
810cdf0e10cSrcweir 	//NumericField in die Toolbox einfuegen
811cdf0e10cSrcweir 	NumEditAction* pEdit = new NumEditAction(
812cdf0e10cSrcweir 					&aContentToolBox, SW_RES(NF_PAGE ));
813cdf0e10cSrcweir 	pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction));
814cdf0e10cSrcweir 	pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus));
815cdf0e10cSrcweir 	pEdit->SetAccessibleName(pEdit->GetQuickHelpText());
816cdf0e10cSrcweir 	pEdit->SetUpHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
817cdf0e10cSrcweir 	pEdit->SetDownHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
818cdf0e10cSrcweir 
819cdf0e10cSrcweir 	bPageCtrlsVisible = sal_True;
820cdf0e10cSrcweir 
821cdf0e10cSrcweir //	Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SHOW_ROOT);
822cdf0e10cSrcweir //	sal_uInt16 nWidth = 2 * (sal_uInt16)aFirstRect.Left();
823cdf0e10cSrcweir 	//doppelte Separatoren sind nicht erlaubt, also muss
824cdf0e10cSrcweir 	//die passende Groesse anders ermittelt werden
825cdf0e10cSrcweir     Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SELECT_FOOTNOTE);
826cdf0e10cSrcweir     Rectangle aSecondRect = aContentToolBox.GetItemRect(FN_SELECT_HEADER);
827cdf0e10cSrcweir 	sal_uInt16 nWidth = sal_uInt16(aFirstRect.Left() - aSecondRect.Left());
828cdf0e10cSrcweir 
829cdf0e10cSrcweir     Size aItemWinSize( nWidth , aFirstRect.Bottom() - aFirstRect.Top() );
830cdf0e10cSrcweir 	pEdit->SetSizePixel(aItemWinSize);
831cdf0e10cSrcweir 	aContentToolBox.InsertSeparator(4);
832cdf0e10cSrcweir 	aContentToolBox.InsertWindow( FN_PAGENUMBER, pEdit, 0, 4);
833cdf0e10cSrcweir 	aContentToolBox.InsertSeparator(4);
834cdf0e10cSrcweir 	aContentToolBox.SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16);
835cdf0e10cSrcweir 	aContentToolBox.ShowItem( FN_PAGENUMBER );
836cdf0e10cSrcweir 
837cdf0e10cSrcweir 	for( sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++  )
838cdf0e10cSrcweir 	{
839cdf0e10cSrcweir 		aContextArr[i] = SW_RESSTR(ST_HYPERLINK + i);
840cdf0e10cSrcweir 		aStatusArr[i] = SW_RESSTR(ST_STATUS_FIRST + i);
841cdf0e10cSrcweir 	}
842cdf0e10cSrcweir 	aStatusArr[3] = SW_RESSTR(ST_ACTIVE_VIEW);
843cdf0e10cSrcweir 	FreeResource();
844cdf0e10cSrcweir 
845cdf0e10cSrcweir 
846cdf0e10cSrcweir 	const Size& rOutSize =  GetOutputSizePixel();
847cdf0e10cSrcweir 
848cdf0e10cSrcweir 	nZoomIn = (short)rOutSize.Height();
849cdf0e10cSrcweir 
850cdf0e10cSrcweir     // Make sure the toolbox has a size that fits all its contents
851cdf0e10cSrcweir     Size aContentToolboxSize( aContentToolBox.CalcWindowSizePixel() );
852cdf0e10cSrcweir     aContentToolBox.SetOutputSizePixel( aContentToolboxSize );
853cdf0e10cSrcweir 
854cdf0e10cSrcweir     // position listbox below toolbar and add some space
855cdf0e10cSrcweir     long nListboxYPos = aContentToolBox.GetPosPixel().Y() + aContentToolboxSize.Height() + 4;
856cdf0e10cSrcweir 
857cdf0e10cSrcweir 	//Der linke und rechte Rand um die Toolboxen soll gleich sein
858cdf0e10cSrcweir 	nWishWidth = aContentToolboxSize.Width();
859cdf0e10cSrcweir 	nWishWidth += 2 * aContentToolBox.GetPosPixel().X();
860cdf0e10cSrcweir 
861*b7d08b69SAndre Fischer     DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent);
862*b7d08b69SAndre Fischer     if (pDockingParent != NULL)
863*b7d08b69SAndre Fischer     {
864*b7d08b69SAndre Fischer         FloatingWindow* pFloat =  pDockingParent->GetFloatingWindow();
865*b7d08b69SAndre Fischer         Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0);
866*b7d08b69SAndre Fischer         pDockingParent->SetMinOutputSizePixel(aMinSize);
867*b7d08b69SAndre Fischer         SetOutputSizePixel( Size( nWishWidth, nZoomOutInit));
868*b7d08b69SAndre Fischer 
869*b7d08b69SAndre Fischer         SfxDockingWindow* pSfxDockingParent = dynamic_cast<SfxDockingWindow*>(pParent);
870*b7d08b69SAndre Fischer         if (pSfxDockingParent != NULL)
871*b7d08b69SAndre Fischer         {
872*b7d08b69SAndre Fischer             Size aTmpParentSize(pSfxDockingParent->GetSizePixel());
873*b7d08b69SAndre Fischer             if (aTmpParentSize.Width() < aMinSize.Width()
874*b7d08b69SAndre Fischer                 || aTmpParentSize.Height() < aMinSize.Height())
875*b7d08b69SAndre Fischer             {
876*b7d08b69SAndre Fischer                 if (pSfxDockingParent->GetFloatingWindow()
877*b7d08b69SAndre Fischer                     && ! pSfxDockingParent->GetFloatingWindow()->IsRollUp())
878*b7d08b69SAndre Fischer                 {
879*b7d08b69SAndre Fischer                     pSfxDockingParent->SetOutputSizePixel(aMinSize);
880*b7d08b69SAndre Fischer                 }
881*b7d08b69SAndre Fischer             }
882*b7d08b69SAndre Fischer         }
883*b7d08b69SAndre Fischer     }
884cdf0e10cSrcweir 
885cdf0e10cSrcweir     aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
886cdf0e10cSrcweir 	aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
887cdf0e10cSrcweir 							WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
888cdf0e10cSrcweir     aContentTree.SetSpaceBetweenEntries(3);
889cdf0e10cSrcweir 	aContentTree.SetSelectionMode( SINGLE_SELECTION );
890cdf0e10cSrcweir 	aContentTree.SetDragDropMode( 	SV_DRAGDROP_CTRL_MOVE |
891cdf0e10cSrcweir 									SV_DRAGDROP_CTRL_COPY |
892cdf0e10cSrcweir 									SV_DRAGDROP_ENABLE_TOP );
893cdf0e10cSrcweir 	aContentTree.EnableAsyncDrag(sal_True);
894cdf0e10cSrcweir 	aContentTree.ShowTree();
895*b7d08b69SAndre Fischer     aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_True);
896cdf0e10cSrcweir 
897cdf0e10cSrcweir // 	TreeListBox fuer Globaldokument
898cdf0e10cSrcweir     aGlobalTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
899cdf0e10cSrcweir 	aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION );
900cdf0e10cSrcweir 	aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
901cdf0e10cSrcweir 								WB_CLIPCHILDREN|WB_HSCROLL );
902cdf0e10cSrcweir 	Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel());
903cdf0e10cSrcweir 	aGlobalToolBox.SetSizePixel(aGlblSize);
904cdf0e10cSrcweir 
905cdf0e10cSrcweir //	Handler
906cdf0e10cSrcweir 
907cdf0e10cSrcweir 	Link aLk = LINK(this, SwNavigationPI, ToolBoxSelectHdl);
908cdf0e10cSrcweir 	aContentToolBox.SetSelectHdl( aLk );
909cdf0e10cSrcweir 	aGlobalToolBox.SetSelectHdl( aLk );
910cdf0e10cSrcweir 	aDocListBox.SetSelectHdl(LINK(this, SwNavigationPI,
911cdf0e10cSrcweir 													DocListBoxSelectHdl));
912cdf0e10cSrcweir 	aContentToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
913cdf0e10cSrcweir 	aContentToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
914cdf0e10cSrcweir 	aGlobalToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
915cdf0e10cSrcweir 	aGlobalToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
916cdf0e10cSrcweir 	aGlobalToolBox.CheckItem(FN_GLOBAL_SWITCH, sal_True);
917cdf0e10cSrcweir 
918cdf0e10cSrcweir 	Font aFont(GetFont());
919cdf0e10cSrcweir 	aFont.SetWeight(WEIGHT_NORMAL);
920cdf0e10cSrcweir 	GetPageEdit().SetFont(aFont);
921cdf0e10cSrcweir 	aFont = aContentTree.GetFont();
922cdf0e10cSrcweir 	aFont.SetWeight(WEIGHT_NORMAL);
923cdf0e10cSrcweir 	aContentTree.SetFont(aFont);
924cdf0e10cSrcweir 	aGlobalTree.SetFont(aFont);
925cdf0e10cSrcweir 
926cdf0e10cSrcweir 	StartListening(*SFX_APP());
927cdf0e10cSrcweir     if ( pCreateView )
928cdf0e10cSrcweir         StartListening(*pCreateView);
929cdf0e10cSrcweir     SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() );
930cdf0e10cSrcweir 	pImgMan->RegisterToolBox(&aContentToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE);
931cdf0e10cSrcweir 	pImgMan->RegisterToolBox(&aGlobalToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE);
932cdf0e10cSrcweir 
933cdf0e10cSrcweir     aContentToolBox.SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox.GetItemBits( FN_CREATE_NAVIGATION ) | TIB_DROPDOWNONLY );
934cdf0e10cSrcweir     aContentToolBox.SetItemBits( FN_DROP_REGION, aContentToolBox.GetItemBits( FN_DROP_REGION ) | TIB_DROPDOWNONLY );
935cdf0e10cSrcweir     aContentToolBox.SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox.GetItemBits( FN_OUTLINE_LEVEL ) | TIB_DROPDOWNONLY );
936cdf0e10cSrcweir 
937cdf0e10cSrcweir 	if(IsGlobalDoc())
938cdf0e10cSrcweir 	{
939cdf0e10cSrcweir         SwView *pActView = GetCreateView();
940cdf0e10cSrcweir 		aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT,
941cdf0e10cSrcweir 					pActView->GetWrtShellPtr()->IsGlblDocSaveLinks());
942cdf0e10cSrcweir 		if(pConfig->IsGlobalActive())
943cdf0e10cSrcweir 			ToggleTree();
944cdf0e10cSrcweir         aGlobalTree.GrabFocus();
945cdf0e10cSrcweir     }
946cdf0e10cSrcweir     else
947cdf0e10cSrcweir         aContentTree.GrabFocus();
948cdf0e10cSrcweir 	UsePage(0);
949cdf0e10cSrcweir 	aPageChgTimer.SetTimeoutHdl(LINK(this, SwNavigationPI, ChangePageHdl));
950cdf0e10cSrcweir 	aPageChgTimer.SetTimeout(PAGE_CHANGE_TIMEOUT);
951cdf0e10cSrcweir 
952cdf0e10cSrcweir 	aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT));
953cdf0e10cSrcweir 	aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL));
954cdf0e10cSrcweir 	aDocListBox.SetAccessibleName(aStatusArr[3]);
955*b7d08b69SAndre Fischer 
956*b7d08b69SAndre Fischer     if (pContextWin == NULL)
957*b7d08b69SAndre Fischer     {
958*b7d08b69SAndre Fischer         // When the context window is missing then the navigator is
959*b7d08b69SAndre Fischer         // displayed in the sidebar.  While the navigator could change
960*b7d08b69SAndre Fischer         // its size, the sidebar can not, and the navigator would just
961*b7d08b69SAndre Fischer         // waste space.  Therefore hide this button.
962*b7d08b69SAndre Fischer         aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX));
963*b7d08b69SAndre Fischer     }
964cdf0e10cSrcweir }
965cdf0e10cSrcweir 
966cdf0e10cSrcweir /*------------------------------------------------------------------------
967cdf0e10cSrcweir  Beschreibung:
968cdf0e10cSrcweir ------------------------------------------------------------------------*/
969cdf0e10cSrcweir 
970cdf0e10cSrcweir SwNavigationPI::~SwNavigationPI()
971cdf0e10cSrcweir {
972cdf0e10cSrcweir 	if(IsGlobalDoc() && !IsGlobalMode())
973cdf0e10cSrcweir 	{
974cdf0e10cSrcweir         SwView *pView = GetCreateView();
975cdf0e10cSrcweir 		SwWrtShell &rSh = pView->GetWrtShell();
976cdf0e10cSrcweir 		if( !rSh.IsAllProtect() )
977cdf0e10cSrcweir 			pView->GetDocShell()->SetReadOnlyUI(sal_False);
978cdf0e10cSrcweir 	}
979cdf0e10cSrcweir 
980cdf0e10cSrcweir 	EndListening(*SFX_APP());
981cdf0e10cSrcweir 
982cdf0e10cSrcweir     SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() );
983cdf0e10cSrcweir 	pImgMan->ReleaseToolBox(&aContentToolBox);
984cdf0e10cSrcweir 	pImgMan->ReleaseToolBox(&aGlobalToolBox);
985cdf0e10cSrcweir     delete aContentToolBox.GetItemWindow(FN_PAGENUMBER);
986cdf0e10cSrcweir     aContentToolBox.Clear();
987cdf0e10cSrcweir     if(pxObjectShell)
988cdf0e10cSrcweir 	{
989cdf0e10cSrcweir 		if(pxObjectShell->Is())
990cdf0e10cSrcweir 			(*pxObjectShell)->DoClose();
991cdf0e10cSrcweir 		delete pxObjectShell;
992cdf0e10cSrcweir 	}
993cdf0e10cSrcweir     delete pPopupWindow;
994cdf0e10cSrcweir     delete pFloatingWindow;
995cdf0e10cSrcweir 
996cdf0e10cSrcweir     if ( IsBound() )
997cdf0e10cSrcweir         rBindings.Release(*this);
998cdf0e10cSrcweir }
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir /*------------------------------------------------------------------------
1001cdf0e10cSrcweir  Beschreibung:
1002cdf0e10cSrcweir ------------------------------------------------------------------------*/
1003cdf0e10cSrcweir 
1004cdf0e10cSrcweir void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow )
1005cdf0e10cSrcweir {
1006cdf0e10cSrcweir     pPopupWindow = pWindow;
1007cdf0e10cSrcweir     pPopupWindow->SetPopupModeEndHdl( LINK( this, SwNavigationPI, PopupModeEndHdl ));
1008cdf0e10cSrcweir     pPopupWindow->SetDeleteLink_Impl( LINK( this, SwNavigationPI, ClosePopupWindow ));
1009cdf0e10cSrcweir }
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir /*------------------------------------------------------------------------
1012cdf0e10cSrcweir  Beschreibung:
1013cdf0e10cSrcweir ------------------------------------------------------------------------*/
1014cdf0e10cSrcweir 
1015cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, PopupModeEndHdl, void *, EMPTYARG )
1016cdf0e10cSrcweir {
1017cdf0e10cSrcweir 	if ( pPopupWindow->IsVisible() )
1018cdf0e10cSrcweir     {
1019cdf0e10cSrcweir         // Replace floating window with popup window and destroy
1020cdf0e10cSrcweir         // floating window instance.
1021cdf0e10cSrcweir         delete pFloatingWindow;
1022cdf0e10cSrcweir         pFloatingWindow = pPopupWindow;
1023cdf0e10cSrcweir         pPopupWindow    = 0;
1024cdf0e10cSrcweir     }
1025cdf0e10cSrcweir     else
1026cdf0e10cSrcweir     {
1027cdf0e10cSrcweir         // Popup window has been closed by the user. No replacement, instance
1028cdf0e10cSrcweir         // will destroy itself.
1029cdf0e10cSrcweir         pPopupWindow = 0;
1030cdf0e10cSrcweir     }
1031cdf0e10cSrcweir 
1032cdf0e10cSrcweir     return 1;
1033cdf0e10cSrcweir }
1034cdf0e10cSrcweir 
1035cdf0e10cSrcweir /*------------------------------------------------------------------------
1036cdf0e10cSrcweir  Beschreibung:
1037cdf0e10cSrcweir ------------------------------------------------------------------------*/
1038cdf0e10cSrcweir 
1039cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ClosePopupWindow, SfxPopupWindow *, pWindow )
1040cdf0e10cSrcweir {
1041cdf0e10cSrcweir     if ( pWindow == pFloatingWindow )
1042cdf0e10cSrcweir         pFloatingWindow = 0;
1043cdf0e10cSrcweir     else
1044cdf0e10cSrcweir         pPopupWindow = 0;
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir     return 1;
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir /*------------------------------------------------------------------------
1050cdf0e10cSrcweir  Beschreibung:
1051cdf0e10cSrcweir ------------------------------------------------------------------------*/
1052cdf0e10cSrcweir 
1053cdf0e10cSrcweir void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
1054cdf0e10cSrcweir                                             const SfxPoolItem* /*pState*/ )
1055cdf0e10cSrcweir {
1056cdf0e10cSrcweir 	if(nSID == SID_DOCFULLNAME)
1057cdf0e10cSrcweir 	{
1058cdf0e10cSrcweir         SwView *pActView = GetCreateView();
1059cdf0e10cSrcweir 		if(pActView)
1060cdf0e10cSrcweir 		{
1061cdf0e10cSrcweir 			SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
1062cdf0e10cSrcweir 			aContentTree.SetActiveShell(pWrtShell);
1063cdf0e10cSrcweir 			sal_Bool bGlobal = IsGlobalDoc();
1064cdf0e10cSrcweir 			aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal);
1065cdf0e10cSrcweir 			if( (!bGlobal && IsGlobalMode()) ||
1066cdf0e10cSrcweir 					(!IsGlobalMode() && pConfig->IsGlobalActive()) )
1067cdf0e10cSrcweir 			{
1068cdf0e10cSrcweir 				ToggleTree();
1069cdf0e10cSrcweir 			}
1070cdf0e10cSrcweir 			if(bGlobal)
1071cdf0e10cSrcweir 			{
1072cdf0e10cSrcweir 				aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks());
1073cdf0e10cSrcweir 			}
1074cdf0e10cSrcweir 		}
1075cdf0e10cSrcweir 		else
1076cdf0e10cSrcweir 		{
1077cdf0e10cSrcweir 			aContentTree.SetActiveShell(0);
1078cdf0e10cSrcweir 		}
1079cdf0e10cSrcweir 		UpdateListBox();
1080cdf0e10cSrcweir 	}
1081cdf0e10cSrcweir }
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir /*------------------------------------------------------------------------
1084cdf0e10cSrcweir 	Bechreibung: NumericField aus der Toolbox holen
1085cdf0e10cSrcweir ------------------------------------------------------------------------*/
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir NumEditAction& SwNavigationPI::GetPageEdit()
1088cdf0e10cSrcweir {
1089cdf0e10cSrcweir 	return *(NumEditAction*)aContentToolBox.GetItemWindow(FN_PAGENUMBER);
1090cdf0e10cSrcweir }
1091cdf0e10cSrcweir 
1092cdf0e10cSrcweir /*------------------------------------------------------------------------
1093cdf0e10cSrcweir  Beschreibung:
1094cdf0e10cSrcweir ------------------------------------------------------------------------*/
1095cdf0e10cSrcweir 
1096cdf0e10cSrcweir SfxChildAlignment SwNavigationPI::CheckAlignment
1097cdf0e10cSrcweir 	(
1098cdf0e10cSrcweir 		SfxChildAlignment eActAlign,
1099cdf0e10cSrcweir 		SfxChildAlignment eAlign
1100cdf0e10cSrcweir 	)
1101cdf0e10cSrcweir {
1102cdf0e10cSrcweir SfxChildAlignment eRetAlign;
1103cdf0e10cSrcweir 
1104cdf0e10cSrcweir 	if(_IsZoomedIn())
1105cdf0e10cSrcweir 		eRetAlign = SFX_ALIGN_NOALIGNMENT;
1106cdf0e10cSrcweir 	else
1107cdf0e10cSrcweir 		switch (eAlign)
1108cdf0e10cSrcweir 		{
1109cdf0e10cSrcweir 			case SFX_ALIGN_BOTTOM:
1110cdf0e10cSrcweir 			case SFX_ALIGN_LOWESTBOTTOM:
1111cdf0e10cSrcweir 			case SFX_ALIGN_HIGHESTBOTTOM:
1112cdf0e10cSrcweir 				eRetAlign = eActAlign;
1113cdf0e10cSrcweir 				break;
1114cdf0e10cSrcweir 
1115cdf0e10cSrcweir 			case SFX_ALIGN_TOP:
1116cdf0e10cSrcweir 			case SFX_ALIGN_HIGHESTTOP:
1117cdf0e10cSrcweir 			case SFX_ALIGN_LOWESTTOP:
1118cdf0e10cSrcweir 			case SFX_ALIGN_LEFT:
1119cdf0e10cSrcweir 			case SFX_ALIGN_RIGHT:
1120cdf0e10cSrcweir 			case SFX_ALIGN_FIRSTLEFT:
1121cdf0e10cSrcweir 			case SFX_ALIGN_LASTLEFT:
1122cdf0e10cSrcweir 			case SFX_ALIGN_FIRSTRIGHT:
1123cdf0e10cSrcweir 			case SFX_ALIGN_LASTRIGHT:
1124cdf0e10cSrcweir 				eRetAlign = eAlign;
1125cdf0e10cSrcweir 				break;
1126cdf0e10cSrcweir 
1127cdf0e10cSrcweir 			default:
1128cdf0e10cSrcweir 				eRetAlign = eAlign;
1129cdf0e10cSrcweir 				break;
1130cdf0e10cSrcweir 		}
1131cdf0e10cSrcweir 	return eRetAlign;
1132cdf0e10cSrcweir 
1133cdf0e10cSrcweir }
1134cdf0e10cSrcweir 
1135cdf0e10cSrcweir /*--------------------------------------------------------------------
1136cdf0e10cSrcweir 	Beschreibung: 	Benachrichtigung bei geaenderter DocInfo
1137cdf0e10cSrcweir  --------------------------------------------------------------------*/
1138cdf0e10cSrcweir 
1139cdf0e10cSrcweir void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint )
1140cdf0e10cSrcweir {
1141cdf0e10cSrcweir     if(&rBrdc == pCreateView)
1142cdf0e10cSrcweir     {
1143cdf0e10cSrcweir         if(rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
1144cdf0e10cSrcweir         {
1145cdf0e10cSrcweir             pCreateView = 0;
1146cdf0e10cSrcweir         }
1147cdf0e10cSrcweir     }
1148cdf0e10cSrcweir     else
1149cdf0e10cSrcweir     {
1150cdf0e10cSrcweir         if(rHint.ISA(SfxEventHint))
1151cdf0e10cSrcweir         {
1152cdf0e10cSrcweir             if( pxObjectShell &&
1153cdf0e10cSrcweir                         ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_CLOSEAPP)
1154cdf0e10cSrcweir             {
1155cdf0e10cSrcweir                 DELETEZ(pxObjectShell);
1156cdf0e10cSrcweir             }
1157cdf0e10cSrcweir             else if(((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_OPENDOC)
1158cdf0e10cSrcweir             {
1159cdf0e10cSrcweir 
1160cdf0e10cSrcweir                 SwView *pActView = GetCreateView();
1161cdf0e10cSrcweir                 if(pActView)
1162cdf0e10cSrcweir                 {
1163cdf0e10cSrcweir                     SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
1164cdf0e10cSrcweir                     aContentTree.SetActiveShell(pWrtShell);
1165cdf0e10cSrcweir                     if(aGlobalTree.IsVisible())
1166cdf0e10cSrcweir                     {
1167cdf0e10cSrcweir                         if(aGlobalTree.Update( sal_False ))
1168cdf0e10cSrcweir                             aGlobalTree.Display();
1169cdf0e10cSrcweir                         else
1170cdf0e10cSrcweir                         // wenn kein Update notwendig, dann zumindest painten
1171cdf0e10cSrcweir                         // wg. der roten Eintraege fuer broken links
1172cdf0e10cSrcweir                             aGlobalTree.Invalidate();
1173cdf0e10cSrcweir                     }
1174cdf0e10cSrcweir                 }
1175cdf0e10cSrcweir             }
1176cdf0e10cSrcweir         }
1177cdf0e10cSrcweir     }
1178cdf0e10cSrcweir }
1179cdf0e10cSrcweir 
1180cdf0e10cSrcweir /*--------------------------------------------------------------------
1181cdf0e10cSrcweir 	Beschreibung:
1182cdf0e10cSrcweir  --------------------------------------------------------------------*/
1183cdf0e10cSrcweir 
1184cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu )
1185cdf0e10cSrcweir {
1186cdf0e10cSrcweir 	sal_uInt16 nMenuId = pMenu->GetCurItemId();
1187cdf0e10cSrcweir 	if(nMenuId != USHRT_MAX)
1188cdf0e10cSrcweir 	{
1189cdf0e10cSrcweir 		if(nMenuId < 100)
1190cdf0e10cSrcweir 			SetRegionDropMode( --nMenuId);
1191cdf0e10cSrcweir 		else
1192cdf0e10cSrcweir             aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) );
1193cdf0e10cSrcweir 	}
1194cdf0e10cSrcweir 	return 0;
1195cdf0e10cSrcweir }
1196cdf0e10cSrcweir 
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir /*--------------------------------------------------------------------
1199cdf0e10cSrcweir 	Beschreibung:
1200cdf0e10cSrcweir  --------------------------------------------------------------------*/
1201cdf0e10cSrcweir 
1202cdf0e10cSrcweir void SwNavigationPI::UpdateListBox()
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir 	aDocListBox.SetUpdateMode(sal_False);
1205cdf0e10cSrcweir 	aDocListBox.Clear();
1206cdf0e10cSrcweir     SwView *pActView = GetCreateView();
1207cdf0e10cSrcweir 	sal_Bool bDisable = pActView == 0;
1208cdf0e10cSrcweir 	SwView *pView = SwModule::GetFirstView();
1209cdf0e10cSrcweir 	sal_uInt16 nCount = 0;
1210cdf0e10cSrcweir 	sal_uInt16 nAct = 0;
1211cdf0e10cSrcweir 	sal_uInt16 nConstPos = 0;
1212cdf0e10cSrcweir 	const SwView* pConstView = aContentTree.IsConstantView() &&
1213cdf0e10cSrcweir 								aContentTree.GetActiveWrtShell() ?
1214cdf0e10cSrcweir 									&aContentTree.GetActiveWrtShell()->GetView():
1215cdf0e10cSrcweir 										0;
1216cdf0e10cSrcweir 	while (pView)
1217cdf0e10cSrcweir 	{
1218cdf0e10cSrcweir         SfxObjectShell* pDoc = pView->GetDocShell();
1219cdf0e10cSrcweir         // pb: #i53333# don't show help pages here
1220cdf0e10cSrcweir         if ( !pDoc->IsHelpDocument() )
1221cdf0e10cSrcweir         {
1222cdf0e10cSrcweir             String sEntry = pDoc->GetTitle();
1223cdf0e10cSrcweir             sEntry += C2S(" (");
1224cdf0e10cSrcweir             if (pView == pActView)
1225cdf0e10cSrcweir             {
1226cdf0e10cSrcweir                 nAct = nCount;
1227cdf0e10cSrcweir                 sEntry += aStatusArr[ST_ACTIVE - ST_STATUS_FIRST];
1228cdf0e10cSrcweir             }
1229cdf0e10cSrcweir             else
1230cdf0e10cSrcweir                 sEntry += aStatusArr[ST_INACTIVE - ST_STATUS_FIRST];
1231cdf0e10cSrcweir             sEntry += ')';
1232cdf0e10cSrcweir             aDocListBox.InsertEntry(sEntry);
1233cdf0e10cSrcweir 
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir             if (pConstView && pView == pConstView)
1236cdf0e10cSrcweir                 nConstPos = nCount;
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir             nCount++;
1239cdf0e10cSrcweir         }
1240cdf0e10cSrcweir         pView = SwModule::GetNextView(pView);
1241cdf0e10cSrcweir 	}
1242cdf0e10cSrcweir 	aDocListBox.InsertEntry(aStatusArr[3]); //"Aktives Fenster"
1243cdf0e10cSrcweir 	nCount++;
1244cdf0e10cSrcweir 
1245cdf0e10cSrcweir 	if(aContentTree.GetHiddenWrtShell())
1246cdf0e10cSrcweir 	{
1247cdf0e10cSrcweir 		String sEntry = aContentTree.GetHiddenWrtShell()->GetView().
1248cdf0e10cSrcweir 										GetDocShell()->GetTitle();
1249cdf0e10cSrcweir 		sEntry += C2S(" (");
1250cdf0e10cSrcweir 		sEntry += aStatusArr[ST_HIDDEN - ST_STATUS_FIRST];
1251cdf0e10cSrcweir 		sEntry += ')';
1252cdf0e10cSrcweir 		aDocListBox.InsertEntry(sEntry);
1253cdf0e10cSrcweir 		bDisable = sal_False;
1254cdf0e10cSrcweir 	}
1255cdf0e10cSrcweir 	if(aContentTree.IsActiveView())
1256cdf0e10cSrcweir 	{
1257cdf0e10cSrcweir 		//entweder den Namen des akt. Docs oder "Aktives Dokument"
1258cdf0e10cSrcweir 		sal_uInt16 nTmp = pActView ? nAct : --nCount;
1259cdf0e10cSrcweir 		aDocListBox.SelectEntryPos( nTmp );
1260cdf0e10cSrcweir 	}
1261cdf0e10cSrcweir 	else if(aContentTree.IsHiddenView())
1262cdf0e10cSrcweir 	{
1263cdf0e10cSrcweir 		aDocListBox.SelectEntryPos(nCount);
1264cdf0e10cSrcweir 	}
1265cdf0e10cSrcweir 	else
1266cdf0e10cSrcweir 		aDocListBox.SelectEntryPos(nConstPos);
1267cdf0e10cSrcweir 
1268cdf0e10cSrcweir 	aDocListBox.Enable( !bDisable );
1269cdf0e10cSrcweir 	aDocListBox.SetUpdateMode(sal_True);
1270cdf0e10cSrcweir }
1271cdf0e10cSrcweir 
1272cdf0e10cSrcweir /*-----------------16.06.97 15:05-------------------
1273cdf0e10cSrcweir 
1274cdf0e10cSrcweir --------------------------------------------------*/
1275cdf0e10cSrcweir 
1276cdf0e10cSrcweir /*------------------------------------------------------------------------
1277cdf0e10cSrcweir 	Beschreibung:
1278cdf0e10cSrcweir ------------------------------------------------------------------------*/
1279cdf0e10cSrcweir 
1280cdf0e10cSrcweir IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem)
1281cdf0e10cSrcweir {
1282cdf0e10cSrcweir 	const SfxViewFrameItem* pFrameItem = PTR_CAST(SfxViewFrameItem, pItem );
1283cdf0e10cSrcweir 	if( pFrameItem )
1284cdf0e10cSrcweir 	{
1285cdf0e10cSrcweir 		SfxViewFrame* pFrame =  pFrameItem->GetFrame();
1286cdf0e10cSrcweir 		if(pFrame)
1287cdf0e10cSrcweir 		{
1288cdf0e10cSrcweir 			aContentTree.Clear();
1289cdf0e10cSrcweir 			pContentView = PTR_CAST(SwView, pFrame->GetViewShell());
1290cdf0e10cSrcweir 			DBG_ASSERT(pContentView, "keine SwView");
1291cdf0e10cSrcweir 			if(pContentView)
1292cdf0e10cSrcweir 				pContentWrtShell = pContentView->GetWrtShellPtr();
1293cdf0e10cSrcweir 			else
1294cdf0e10cSrcweir 				pContentWrtShell = 0;
1295cdf0e10cSrcweir 			pxObjectShell = new SfxObjectShellLock(pFrame->GetObjectShell());
1296cdf0e10cSrcweir 			FillBox();
1297cdf0e10cSrcweir 			aContentTree.Update();
1298cdf0e10cSrcweir 		}
1299cdf0e10cSrcweir 	}
1300cdf0e10cSrcweir 	return 0;
1301cdf0e10cSrcweir }
1302cdf0e10cSrcweir 
1303cdf0e10cSrcweir String SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData )
1304cdf0e10cSrcweir {
1305cdf0e10cSrcweir 	String sFileName;
1306cdf0e10cSrcweir 	sal_uLong nFmt;
1307cdf0e10cSrcweir 	if( rData.HasFormat( nFmt = FORMAT_FILE_LIST ))
1308cdf0e10cSrcweir 	{
1309cdf0e10cSrcweir 		FileList aFileList;
1310cdf0e10cSrcweir 		rData.GetFileList( nFmt, aFileList );
1311cdf0e10cSrcweir 		sFileName = aFileList.GetFile( 0 );
1312cdf0e10cSrcweir 	}
1313cdf0e10cSrcweir 	else if( rData.HasFormat( nFmt = FORMAT_STRING ) ||
1314cdf0e10cSrcweir 	 		 rData.HasFormat( nFmt = FORMAT_FILE ) ||
1315cdf0e10cSrcweir 			 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILENAME ))
1316cdf0e10cSrcweir 		rData.GetString( nFmt, sFileName );
1317cdf0e10cSrcweir 	else if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_SOLK ) ||
1318cdf0e10cSrcweir  		  	 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
1319cdf0e10cSrcweir  		  	 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILECONTENT ) ||
1320cdf0e10cSrcweir  		  	 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
1321cdf0e10cSrcweir  		  	 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ))
1322cdf0e10cSrcweir 	{
1323cdf0e10cSrcweir 		INetBookmark aBkmk( aEmptyStr, aEmptyStr );
1324cdf0e10cSrcweir 		rData.GetINetBookmark( nFmt, aBkmk );
1325cdf0e10cSrcweir 		sFileName = aBkmk.GetURL();
1326cdf0e10cSrcweir 	}
1327cdf0e10cSrcweir 	if( sFileName.Len() )
1328cdf0e10cSrcweir     {
1329cdf0e10cSrcweir         sFileName = INetURLObject( sFileName ).GetMainURL( INetURLObject::NO_DECODE );
1330cdf0e10cSrcweir     }
1331cdf0e10cSrcweir 	return sFileName;
1332cdf0e10cSrcweir }
1333cdf0e10cSrcweir 
1334cdf0e10cSrcweir /*------------------------------------------------------------------------
1335cdf0e10cSrcweir 	Beschreibung:
1336cdf0e10cSrcweir ------------------------------------------------------------------------*/
1337cdf0e10cSrcweir 
1338cdf0e10cSrcweir sal_Int8 SwNavigationPI::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
1339cdf0e10cSrcweir {
1340cdf0e10cSrcweir 	return ( !aContentTree.IsInDrag() &&
1341cdf0e10cSrcweir 		( aContentTree.IsDropFormatSupported( FORMAT_FILE ) ||
1342cdf0e10cSrcweir 		  aContentTree.IsDropFormatSupported( FORMAT_STRING ) ||
1343cdf0e10cSrcweir 		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_SOLK ) ||
1344cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
1345cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILECONTENT ) ||
1346cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
1347cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) ||
1348cdf0e10cSrcweir  		  aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILENAME )))
1349cdf0e10cSrcweir 		? DND_ACTION_COPY
1350cdf0e10cSrcweir 		: DND_ACTION_NONE;
1351cdf0e10cSrcweir }
1352cdf0e10cSrcweir 
1353cdf0e10cSrcweir sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt )
1354cdf0e10cSrcweir {
1355cdf0e10cSrcweir 	TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
1356cdf0e10cSrcweir 	sal_Int8 nRet = DND_ACTION_NONE;
1357cdf0e10cSrcweir 	String sFileName;
1358cdf0e10cSrcweir 	if( !aContentTree.IsInDrag() &&
1359cdf0e10cSrcweir 		0 != (sFileName = SwNavigationPI::CreateDropFileName( aData )).Len() )
1360cdf0e10cSrcweir 	{
1361cdf0e10cSrcweir 		INetURLObject aTemp( sFileName );
1362cdf0e10cSrcweir 		GraphicDescriptor aDesc( aTemp );
1363cdf0e10cSrcweir 		if( !aDesc.Detect() )	// keine Grafiken annehmen
1364cdf0e10cSrcweir 		{
1365cdf0e10cSrcweir 			if( STRING_NOTFOUND == sFileName.Search('#')
1366cdf0e10cSrcweir 				&& (!sContentFileName.Len() || sContentFileName != sFileName ))
1367cdf0e10cSrcweir 			{
1368cdf0e10cSrcweir 				nRet = rEvt.mnAction;
1369cdf0e10cSrcweir 				sFileName.EraseTrailingChars( char(0) );
1370cdf0e10cSrcweir 				sContentFileName = sFileName;
1371cdf0e10cSrcweir 				if(pxObjectShell)
1372cdf0e10cSrcweir 				{
1373cdf0e10cSrcweir 					aContentTree.SetHiddenShell( 0 );
1374cdf0e10cSrcweir 					(*pxObjectShell)->DoClose();
1375cdf0e10cSrcweir 					DELETEZ( pxObjectShell);
1376cdf0e10cSrcweir 				}
1377cdf0e10cSrcweir 				SfxStringItem aFileItem(SID_FILE_NAME, sFileName );
1378cdf0e10cSrcweir 				String sOptions = C2S("HRC");
1379cdf0e10cSrcweir 				SfxStringItem aOptionsItem( SID_OPTIONS, sOptions );
1380cdf0e10cSrcweir 				SfxLinkItem aLink( SID_DONELINK,
1381cdf0e10cSrcweir 									LINK( this, SwNavigationPI, DoneLink ) );
1382cdf0e10cSrcweir 				GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(
1383cdf0e10cSrcweir 							SID_OPENDOC, SFX_CALLMODE_ASYNCHRON,
1384cdf0e10cSrcweir 							&aFileItem, &aOptionsItem, &aLink, 0L );
1385cdf0e10cSrcweir 			}
1386cdf0e10cSrcweir 		}
1387cdf0e10cSrcweir 	}
1388cdf0e10cSrcweir 	return nRet;
1389cdf0e10cSrcweir }
1390cdf0e10cSrcweir 
1391cdf0e10cSrcweir /*-----------------27.11.96 13.00-------------------
1392cdf0e10cSrcweir 
1393cdf0e10cSrcweir --------------------------------------------------*/
1394cdf0e10cSrcweir 
1395cdf0e10cSrcweir void SwNavigationPI::SetRegionDropMode(sal_uInt16 nNewMode)
1396cdf0e10cSrcweir {
1397cdf0e10cSrcweir 	nRegionMode = nNewMode;
1398cdf0e10cSrcweir 	pConfig->SetRegionMode( nRegionMode );
1399cdf0e10cSrcweir 
1400cdf0e10cSrcweir     sal_uInt16 nDropId = FN_DROP_REGION;
1401cdf0e10cSrcweir 	if(nRegionMode == REGION_MODE_LINK)
1402cdf0e10cSrcweir         nDropId = FN_DROP_REGION_LINK;
1403cdf0e10cSrcweir 	else if(nRegionMode == REGION_MODE_EMBEDDED)
1404cdf0e10cSrcweir         nDropId = FN_DROP_REGION_COPY;
1405cdf0e10cSrcweir 
1406cdf0e10cSrcweir     ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode()
1407cdf0e10cSrcweir 				? aContentImageListH : aContentImageList;
1408cdf0e10cSrcweir 
1409cdf0e10cSrcweir     aContentToolBox.SetItemImage( FN_DROP_REGION,
1410cdf0e10cSrcweir                                     rImgLst.GetImage(nDropId));
1411cdf0e10cSrcweir }
1412cdf0e10cSrcweir 
1413cdf0e10cSrcweir 
1414cdf0e10cSrcweir /*-----------------12.06.97 09:47-------------------
1415cdf0e10cSrcweir 
1416cdf0e10cSrcweir --------------------------------------------------*/
1417cdf0e10cSrcweir 
1418cdf0e10cSrcweir sal_Bool	SwNavigationPI::ToggleTree()
1419cdf0e10cSrcweir {
1420cdf0e10cSrcweir 	sal_Bool bRet = sal_True;
1421cdf0e10cSrcweir 	sal_Bool bGlobalDoc = IsGlobalDoc();
1422cdf0e10cSrcweir 	if(!IsGlobalMode() && bGlobalDoc)
1423cdf0e10cSrcweir 	{
1424cdf0e10cSrcweir 		SetUpdateMode(sal_False);
1425cdf0e10cSrcweir 		if(_IsZoomedIn())
1426cdf0e10cSrcweir 			_ZoomOut();
1427cdf0e10cSrcweir 		aGlobalTree.ShowTree();
1428cdf0e10cSrcweir 		aGlobalToolBox.Show();
1429cdf0e10cSrcweir 		aContentTree.HideTree();
1430cdf0e10cSrcweir 		aContentToolBox.Hide();
1431cdf0e10cSrcweir 		aDocListBox.Hide();
1432cdf0e10cSrcweir 		SetGlobalMode(sal_True);
1433cdf0e10cSrcweir 		SetUpdateMode(sal_True);
1434cdf0e10cSrcweir 	}
1435cdf0e10cSrcweir 	else
1436cdf0e10cSrcweir 	{
1437cdf0e10cSrcweir 		aGlobalTree.HideTree();
1438cdf0e10cSrcweir 		aGlobalToolBox.Hide();
1439cdf0e10cSrcweir 		if(!_IsZoomedIn())
1440cdf0e10cSrcweir 		{
1441cdf0e10cSrcweir 			aContentTree.ShowTree();
1442cdf0e10cSrcweir 			aContentToolBox.Show();
1443cdf0e10cSrcweir 			aDocListBox.Show();
1444cdf0e10cSrcweir 		}
1445cdf0e10cSrcweir 		bRet = sal_False;
1446cdf0e10cSrcweir 		SetGlobalMode(sal_False);
1447cdf0e10cSrcweir 	}
1448cdf0e10cSrcweir     return bRet;
1449cdf0e10cSrcweir }
1450cdf0e10cSrcweir 
1451cdf0e10cSrcweir /*-----------------13.06.97 09:42-------------------
1452cdf0e10cSrcweir 
1453cdf0e10cSrcweir --------------------------------------------------*/
1454cdf0e10cSrcweir sal_Bool 	SwNavigationPI::IsGlobalDoc() const
1455cdf0e10cSrcweir {
1456cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1457cdf0e10cSrcweir     SwView *pView = GetCreateView();
1458cdf0e10cSrcweir 	if(pView)
1459cdf0e10cSrcweir 	{
1460cdf0e10cSrcweir 		SwWrtShell &rSh = pView->GetWrtShell();
1461cdf0e10cSrcweir 		bRet = rSh.IsGlobalDoc();
1462cdf0e10cSrcweir 	}
1463cdf0e10cSrcweir 	return bRet;
1464cdf0e10cSrcweir }
1465cdf0e10cSrcweir /* -----------------26.10.98 08:10-------------------
1466cdf0e10cSrcweir  *
1467cdf0e10cSrcweir  * --------------------------------------------------*/
1468cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ChangePageHdl, Timer*, EMPTYARG )
1469cdf0e10cSrcweir {
1470cdf0e10cSrcweir 	EditAction(&GetPageEdit());
1471cdf0e10cSrcweir 	GetPageEdit().GrabFocus();
1472cdf0e10cSrcweir 	return 0;
1473cdf0e10cSrcweir }
1474cdf0e10cSrcweir /* -----------------26.10.98 08:14-------------------
1475cdf0e10cSrcweir  *
1476cdf0e10cSrcweir  * --------------------------------------------------*/
1477cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, PageEditModifyHdl, Edit*, EMPTYARG )
1478cdf0e10cSrcweir {
1479cdf0e10cSrcweir 	if(aPageChgTimer.IsActive())
1480cdf0e10cSrcweir 		aPageChgTimer.Stop();
1481cdf0e10cSrcweir 	aPageChgTimer.Start();
1482cdf0e10cSrcweir 	return 0;
1483cdf0e10cSrcweir }
1484cdf0e10cSrcweir 
1485cdf0e10cSrcweir /* -----------------------------23.04.01 07:34--------------------------------
1486cdf0e10cSrcweir 
1487cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1488cdf0e10cSrcweir SwView*  SwNavigationPI::GetCreateView() const
1489cdf0e10cSrcweir {
1490cdf0e10cSrcweir     if(!pCreateView)
1491cdf0e10cSrcweir     {
1492cdf0e10cSrcweir         SwView* pView = SwModule::GetFirstView();
1493cdf0e10cSrcweir         while(pView)
1494cdf0e10cSrcweir         {
1495cdf0e10cSrcweir             if(&pView->GetViewFrame()->GetBindings() == &rBindings)
1496cdf0e10cSrcweir             {
1497cdf0e10cSrcweir                 ((SwNavigationPI*)this)->pCreateView = pView;
1498cdf0e10cSrcweir                 ((SwNavigationPI*)this)->StartListening(*pCreateView);
1499cdf0e10cSrcweir                 break;
1500cdf0e10cSrcweir             }
1501cdf0e10cSrcweir             pView = SwModule::GetNextView(pView);
1502cdf0e10cSrcweir         }
1503cdf0e10cSrcweir     }
1504cdf0e10cSrcweir     return pCreateView;
1505cdf0e10cSrcweir }
1506cdf0e10cSrcweir 
1507cdf0e10cSrcweir 
1508cdf0e10cSrcweir /*------------------------------------------------------------------------
1509cdf0e10cSrcweir  Beschreibung:
1510cdf0e10cSrcweir ------------------------------------------------------------------------*/
1511cdf0e10cSrcweir 
1512cdf0e10cSrcweir SwNavigationChild::SwNavigationChild( Window* pParent,
1513cdf0e10cSrcweir                         sal_uInt16 nId,
1514cdf0e10cSrcweir                         SfxBindings* _pBindings,
1515cdf0e10cSrcweir 						SfxChildWinInfo* pInfo )
1516cdf0e10cSrcweir 	: SfxChildWindowContext( nId )
1517cdf0e10cSrcweir {
1518cdf0e10cSrcweir     SwNavigationPI* pNavi  = new SwNavigationPI( _pBindings, this, pParent );
1519cdf0e10cSrcweir 	SetWindow( pNavi );
1520cdf0e10cSrcweir     _pBindings->Invalidate(SID_NAVIGATOR);
1521cdf0e10cSrcweir 	String sExtra = pInfo->aExtraString;
1522cdf0e10cSrcweir 
1523cdf0e10cSrcweir 	SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();
1524cdf0e10cSrcweir 
1525cdf0e10cSrcweir     sal_uInt16 nRootType = static_cast< sal_uInt16 >( pNaviConfig->GetRootType() );
1526cdf0e10cSrcweir 	if( nRootType < CONTENT_TYPE_MAX )
1527cdf0e10cSrcweir 	{
1528cdf0e10cSrcweir 		pNavi->aContentTree.SetRootType(nRootType);
1529cdf0e10cSrcweir 		pNavi->aContentToolBox.CheckItem(FN_SHOW_ROOT, sal_True);
1530cdf0e10cSrcweir 	}
1531cdf0e10cSrcweir     pNavi->aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) );
1532cdf0e10cSrcweir     pNavi->SetRegionDropMode( static_cast< sal_uInt16 >( pNaviConfig->GetRegionMode() ) );
1533cdf0e10cSrcweir 
1534cdf0e10cSrcweir 	if(GetFloatingWindow() && pNaviConfig->IsSmall())
1535cdf0e10cSrcweir 	{
1536cdf0e10cSrcweir 		pNavi->_ZoomIn();
1537cdf0e10cSrcweir 	}
1538cdf0e10cSrcweir }
1539cdf0e10cSrcweir /* -----------------------------06.05.2002 10:06------------------------------
1540cdf0e10cSrcweir 
1541cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1542cdf0e10cSrcweir void SwNavigationPI::DataChanged( const DataChangedEvent& rDCEvt )
1543cdf0e10cSrcweir {
1544cdf0e10cSrcweir     Window::DataChanged( rDCEvt );
1545cdf0e10cSrcweir     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
1546cdf0e10cSrcweir          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1547cdf0e10cSrcweir     {
1548cdf0e10cSrcweir         InitImageList();
1549cdf0e10cSrcweir         const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1550cdf0e10cSrcweir         Color aBgColor = rStyleSettings.GetFaceColor();
1551cdf0e10cSrcweir         Wallpaper aBack( aBgColor );
1552cdf0e10cSrcweir         SetBackground( aBack );
1553cdf0e10cSrcweir     }
1554cdf0e10cSrcweir }
1555cdf0e10cSrcweir /* -----------------------------06.05.2002 10:07------------------------------
1556cdf0e10cSrcweir 
1557cdf0e10cSrcweir  ---------------------------------------------------------------------------*/
1558cdf0e10cSrcweir void SwNavigationPI::InitImageList()
1559cdf0e10cSrcweir {
1560cdf0e10cSrcweir     sal_uInt16 k;
1561cdf0e10cSrcweir 
1562cdf0e10cSrcweir     ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ?
1563cdf0e10cSrcweir                 aContentImageListH : aContentImageList;
1564cdf0e10cSrcweir     for( k = 0; k < aContentToolBox.GetItemCount(); k++)
1565cdf0e10cSrcweir 			aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k),
1566cdf0e10cSrcweir                     rImgLst.GetImage(aContentToolBox.GetItemId(k)));
1567cdf0e10cSrcweir 
1568cdf0e10cSrcweir 	for( k = 0; k < aGlobalToolBox.GetItemCount(); k++)
1569cdf0e10cSrcweir 			aGlobalToolBox.SetItemImage(aGlobalToolBox.GetItemId(k),
1570cdf0e10cSrcweir                     rImgLst.GetImage(aGlobalToolBox.GetItemId(k)));
1571cdf0e10cSrcweir 
1572cdf0e10cSrcweir     sal_uInt16 nDropId = FN_DROP_REGION;
1573cdf0e10cSrcweir 	if(nRegionMode == REGION_MODE_LINK)
1574cdf0e10cSrcweir         nDropId = FN_DROP_REGION_LINK;
1575cdf0e10cSrcweir 	else if(nRegionMode == REGION_MODE_EMBEDDED)
1576cdf0e10cSrcweir         nDropId = FN_DROP_REGION_COPY;
1577cdf0e10cSrcweir     aContentToolBox.SetItemImage( FN_DROP_REGION,
1578cdf0e10cSrcweir                                     rImgLst.GetImage(nDropId));
1579cdf0e10cSrcweir }
1580cdf0e10cSrcweir 
1581