xref: /AOO41X/main/sd/source/ui/dlg/navigatr.cxx (revision 5b1900111deff329a5580f97b99b67a25168e53d)
1*5b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5b190011SAndrew Rist  * distributed with this work for additional information
6*5b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5b190011SAndrew Rist  * "License"); you may not use this file except in compliance
9*5b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*5b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*5b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5b190011SAndrew Rist  * software distributed under the License is distributed on an
15*5b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
17*5b190011SAndrew Rist  * specific language governing permissions and limitations
18*5b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*5b190011SAndrew Rist  *************************************************************/
21*5b190011SAndrew Rist 
22*5b190011SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <tools/urlobj.hxx>
29cdf0e10cSrcweir #include <unotools/localfilehelper.hxx>
30cdf0e10cSrcweir #include <sfx2/imgmgr.hxx>
31cdf0e10cSrcweir #include <sfx2/fcontnr.hxx>
32cdf0e10cSrcweir #include <svl/eitem.hxx>
33cdf0e10cSrcweir #include <svl/stritem.hxx>
34cdf0e10cSrcweir #include <sfx2/docfilt.hxx>
35cdf0e10cSrcweir #include <sfx2/docfile.hxx>
36cdf0e10cSrcweir #include <svl/intitem.hxx>
37cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
38cdf0e10cSrcweir #include <svx/svxids.hrc>
39cdf0e10cSrcweir #include <vcl/menu.hxx>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
42cdf0e10cSrcweir #include <sfx2/dockwin.hxx>
43cdf0e10cSrcweir #include <sfx2/sfxresid.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include "pres.hxx"
46cdf0e10cSrcweir #include "navigatr.hxx"
47cdf0e10cSrcweir #include "navigatr.hrc"
48cdf0e10cSrcweir #include "pgjump.hxx"
49cdf0e10cSrcweir #include "app.hrc"
50cdf0e10cSrcweir #include "strings.hrc"
51cdf0e10cSrcweir #include "res_bmp.hrc"
52cdf0e10cSrcweir #include "drawdoc.hxx"
53cdf0e10cSrcweir #include "DrawDocShell.hxx"
54cdf0e10cSrcweir #include "sdresid.hxx"
55cdf0e10cSrcweir #include "ViewShell.hxx"
56cdf0e10cSrcweir #include "ViewShellBase.hxx"
57cdf0e10cSrcweir #include "DrawViewShell.hxx"
58cdf0e10cSrcweir #include "slideshow.hxx"
59cdf0e10cSrcweir #include "FrameView.hxx"
60cdf0e10cSrcweir #include "helpids.h"
61cdf0e10cSrcweir 
62cdf0e10cSrcweir namespace {
63cdf0e10cSrcweir static const sal_uInt16 nShowNamedShapesFilter=1;
64cdf0e10cSrcweir static const sal_uInt16 nShowAllShapesFilter=2;
65cdf0e10cSrcweir }
66cdf0e10cSrcweir 
67cdf0e10cSrcweir /*************************************************************************
68cdf0e10cSrcweir |*	SdNavigatorWin - FloatingWindow
69cdf0e10cSrcweir \************************************************************************/
70cdf0e10cSrcweir 
71cdf0e10cSrcweir SdNavigatorWin::SdNavigatorWin(
72cdf0e10cSrcweir     ::Window* pParent,
73cdf0e10cSrcweir     ::sd::NavigatorChildWindow* pChWinCtxt,
74cdf0e10cSrcweir     const SdResId& rSdResId,
75cdf0e10cSrcweir     SfxBindings* pInBindings )
76cdf0e10cSrcweir :	::Window( pParent, rSdResId )
77cdf0e10cSrcweir ,	maToolbox        ( this, SdResId( 1 ) )
78cdf0e10cSrcweir ,	maTlbObjects( this, SdResId( TLB_OBJECTS ) )
79cdf0e10cSrcweir ,	maLbDocs         ( this, SdResId( LB_DOCS ) )
80cdf0e10cSrcweir ,	mpChildWinContext( pChWinCtxt )
81cdf0e10cSrcweir ,	mbDocImported	( sal_False )
82cdf0e10cSrcweir     // Bei Aenderung des DragTypes: SelectionMode der TLB anpassen!
83cdf0e10cSrcweir ,	meDragType		( NAVIGATOR_DRAGTYPE_EMBEDDED )
84cdf0e10cSrcweir ,	mpBindings		( pInBindings )
85cdf0e10cSrcweir ,	maImageList		( SdResId( IL_NAVIGATR ) )
86cdf0e10cSrcweir ,	maImageListH	( SdResId( ILH_NAVIGATR ) )
87cdf0e10cSrcweir {
88cdf0e10cSrcweir 	maTlbObjects.SetViewFrame( mpBindings->GetDispatcher()->GetFrame() );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	FreeResource();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     maTlbObjects.SetAccessibleName(String(SdResId(STR_OBJECTS_TREE)));
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	mpNavigatorCtrlItem = new SdNavigatorControllerItem( SID_NAVIGATOR_STATE, this, mpBindings );
95cdf0e10cSrcweir 	mpPageNameCtrlItem = new SdPageNameControllerItem( SID_NAVIGATOR_PAGENAME, this, mpBindings );
96cdf0e10cSrcweir 	mpDocList = new List();
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	ApplyImageList(); // load images *before* calculating sizes to get something useful !!!
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	Size aTbxSize( maToolbox.CalcWindowSizePixel() );
101cdf0e10cSrcweir 	maToolbox.SetOutputSizePixel( aTbxSize );
102cdf0e10cSrcweir 	maToolbox.SetSelectHdl( LINK( this, SdNavigatorWin, SelectToolboxHdl ) );
103cdf0e10cSrcweir 	maToolbox.SetClickHdl( LINK( this, SdNavigatorWin, ClickToolboxHdl ) );
104cdf0e10cSrcweir     maToolbox.SetDropdownClickHdl( LINK(this, SdNavigatorWin, DropdownClickToolBoxHdl) );
105cdf0e10cSrcweir     maToolbox.SetItemBits( TBI_DRAGTYPE, maToolbox.GetItemBits( TBI_DRAGTYPE ) | TIB_DROPDOWNONLY );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     // Shape filter drop down menu.
108cdf0e10cSrcweir     maToolbox.SetItemBits(TBI_SHAPE_FILTER,
109cdf0e10cSrcweir         maToolbox.GetItemBits(TBI_SHAPE_FILTER) | TIB_DROPDOWNONLY);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	// TreeListBox
112cdf0e10cSrcweir     // set position below toolbox
113cdf0e10cSrcweir     long nListboxYPos = maToolbox.GetPosPixel().Y() + maToolbox.GetSizePixel().Height() + 4;
114cdf0e10cSrcweir     maTlbObjects.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
115cdf0e10cSrcweir 	maTlbObjects.SetDoubleClickHdl( LINK( this, SdNavigatorWin, ClickObjectHdl ) );
116cdf0e10cSrcweir 	maTlbObjects.SetSelectionMode( SINGLE_SELECTION );
117cdf0e10cSrcweir     // set focus to listbox, otherwise it is in the toolbox which is only useful
118cdf0e10cSrcweir     // for keyboard navigation
119cdf0e10cSrcweir     maTlbObjects.GrabFocus();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 	// DragTypeListBox
122cdf0e10cSrcweir 	maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) );
123cdf0e10cSrcweir     // set position below treelistbox
124cdf0e10cSrcweir     nListboxYPos = maTlbObjects.GetPosPixel().Y() + maTlbObjects.GetSizePixel().Height() + 4;
125cdf0e10cSrcweir     maLbDocs.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir     // set min outputsize after all sizes are known
128cdf0e10cSrcweir     long nFullHeight = nListboxYPos + maLbDocs.GetSizePixel().Height() + 4;
129cdf0e10cSrcweir 	maSize = GetOutputSizePixel();
130cdf0e10cSrcweir     if( maSize.Height() < nFullHeight )
131cdf0e10cSrcweir     {
132cdf0e10cSrcweir         maSize.Height() = nFullHeight;
133cdf0e10cSrcweir         SetOutputSizePixel( maSize );
134cdf0e10cSrcweir     }
135cdf0e10cSrcweir     maMinSize = maSize;
136cdf0e10cSrcweir     long nMinWidth = 2*maToolbox.GetPosPixel().X() + aTbxSize.Width(); // never clip the toolbox
137cdf0e10cSrcweir     if( nMinWidth > maMinSize.Width() )
138cdf0e10cSrcweir         maMinSize.Width() = nMinWidth;
139cdf0e10cSrcweir 	maMinSize.Height() -= 40;
140cdf0e10cSrcweir 	((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel( maMinSize );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	// InitTlb; Wird ueber Slot initiiert
143cdf0e10cSrcweir 	SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
144cdf0e10cSrcweir 	mpBindings->GetDispatcher()->Execute(
145cdf0e10cSrcweir 		SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
146cdf0e10cSrcweir 
147cdf0e10cSrcweir }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // -----------------------------------------------------------------------
150cdf0e10cSrcweir 
151cdf0e10cSrcweir SdNavigatorWin::~SdNavigatorWin()
152cdf0e10cSrcweir {
153cdf0e10cSrcweir 	delete mpNavigatorCtrlItem;
154cdf0e10cSrcweir 	delete mpPageNameCtrlItem;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	// Liste der DocInfos loeschen
157cdf0e10cSrcweir 	long nCount = mpDocList->Count();
158cdf0e10cSrcweir 	while( nCount-- )
159cdf0e10cSrcweir 		delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 );
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	delete mpDocList;
162cdf0e10cSrcweir }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir // -----------------------------------------------------------------------
165cdf0e10cSrcweir 
166cdf0e10cSrcweir void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc )
167cdf0e10cSrcweir {
168cdf0e10cSrcweir 	SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can...
169cdf0e10cSrcweir 	::sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh();
170cdf0e10cSrcweir 	String aDocShName( pDocShell->GetName() );
171cdf0e10cSrcweir 	::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     // Restore the 'ShowAllShapes' flag from the last time (in this session)
174cdf0e10cSrcweir     // that the navigator was shown.
175cdf0e10cSrcweir     if (pViewShell != NULL)
176cdf0e10cSrcweir     {
177cdf0e10cSrcweir         ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
178cdf0e10cSrcweir         if (pFrameView != NULL)
179cdf0e10cSrcweir             maTlbObjects.SetShowAllShapes(pFrameView->IsNavigatorShowingAllShapes(), false);
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     // Disable the shape filter drop down menu when there is a running slide
183cdf0e10cSrcweir     // show.
184cdf0e10cSrcweir 	if (pViewShell!=NULL && sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ))
185cdf0e10cSrcweir         maToolbox.EnableItem(TBI_SHAPE_FILTER, sal_False);
186cdf0e10cSrcweir     else
187cdf0e10cSrcweir         maToolbox.EnableItem(TBI_SHAPE_FILTER);
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	if( !maTlbObjects.IsEqualToDoc( pDoc ) )
190cdf0e10cSrcweir 	{
191cdf0e10cSrcweir 		String aDocName = pDocShell->GetMedium()->GetName();
192cdf0e10cSrcweir 		maTlbObjects.Clear();
193cdf0e10cSrcweir 		maTlbObjects.Fill( pDoc, (sal_Bool) sal_False, aDocName ); // Nur normale Seiten
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 		RefreshDocumentLB();
196cdf0e10cSrcweir 		maLbDocs.SelectEntry( aDocShName );
197cdf0e10cSrcweir 	}
198cdf0e10cSrcweir 	else
199cdf0e10cSrcweir 	{
200cdf0e10cSrcweir 		maLbDocs.SetNoSelection();
201cdf0e10cSrcweir 		maLbDocs.SelectEntry( aDocShName );
202cdf0e10cSrcweir 
203cdf0e10cSrcweir // auskommentiert um 30246 zu fixen
204cdf0e10cSrcweir //		  if( maLbDocs.GetSelectEntryCount() == 0 )
205cdf0e10cSrcweir 		{
206cdf0e10cSrcweir 			RefreshDocumentLB();
207cdf0e10cSrcweir 			maLbDocs.SelectEntry( aDocShName );
208cdf0e10cSrcweir 		}
209cdf0e10cSrcweir 	}
210cdf0e10cSrcweir 
211cdf0e10cSrcweir 	SfxViewFrame* pViewFrame = ( ( pViewShell && pViewShell->GetViewFrame() ) ? pViewShell->GetViewFrame() : SfxViewFrame::Current() );
212cdf0e10cSrcweir 	if( pViewFrame )
213cdf0e10cSrcweir 		pViewFrame->GetBindings().Invalidate(SID_NAVIGATOR_PAGENAME, sal_True, sal_True);
214cdf0e10cSrcweir }
215cdf0e10cSrcweir 
216cdf0e10cSrcweir /*************************************************************************
217cdf0e10cSrcweir |*
218cdf0e10cSrcweir |* DragType wird in Abhaengigkeit davon gesetzt, ob ein Drag ueberhaupt
219cdf0e10cSrcweir |* moeglich ist. Graphiken duerfen beispielsweise unter gewissen Umstaenden
220cdf0e10cSrcweir |* nicht gedragt werden (#31038#).
221cdf0e10cSrcweir |*
222cdf0e10cSrcweir \************************************************************************/
223cdf0e10cSrcweir 
224cdf0e10cSrcweir NavigatorDragType SdNavigatorWin::GetNavigatorDragType()
225cdf0e10cSrcweir {
226cdf0e10cSrcweir 	NavigatorDragType   eDT = meDragType;
227cdf0e10cSrcweir 	NavDocInfo*         pInfo = GetDocInfo();
228cdf0e10cSrcweir 
229cdf0e10cSrcweir 	if( ( eDT == NAVIGATOR_DRAGTYPE_LINK ) && ( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() ) )
230cdf0e10cSrcweir 		eDT = NAVIGATOR_DRAGTYPE_NONE;
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	return( eDT );
233cdf0e10cSrcweir }
234cdf0e10cSrcweir 
235cdf0e10cSrcweir // -----------------------------------------------------------------------
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 
238cdf0e10cSrcweir IMPL_LINK( SdNavigatorWin, SelectToolboxHdl, void *, EMPTYARG )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir 	sal_uInt16 nId = maToolbox.GetCurItemId();
241cdf0e10cSrcweir 	sal_uInt16 nSId = 0;
242cdf0e10cSrcweir 	PageJump ePage = PAGE_NONE;
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	switch( nId )
245cdf0e10cSrcweir 	{
246cdf0e10cSrcweir 		case TBI_PEN:
247cdf0e10cSrcweir 		{
248cdf0e10cSrcweir 			if( nId == TBI_PEN )
249cdf0e10cSrcweir 			{
250cdf0e10cSrcweir 				nSId = SID_NAVIGATOR_PEN;
251cdf0e10cSrcweir 			}
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 			if( nSId > 0 )
254cdf0e10cSrcweir 			{
255cdf0e10cSrcweir 				SfxBoolItem aItem( nSId, sal_True );
256cdf0e10cSrcweir 				mpBindings->GetDispatcher()->Execute(
257cdf0e10cSrcweir 					nSId, SFX_CALLMODE_SLOT |SFX_CALLMODE_RECORD, &aItem, 0L );
258cdf0e10cSrcweir 			}
259cdf0e10cSrcweir 		}
260cdf0e10cSrcweir 		break;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 		case TBI_FIRST:
263cdf0e10cSrcweir 		case TBI_PREVIOUS:
264cdf0e10cSrcweir 		case TBI_NEXT:
265cdf0e10cSrcweir 		case TBI_LAST:
266cdf0e10cSrcweir 		{
267cdf0e10cSrcweir 			if( nId == TBI_FIRST )
268cdf0e10cSrcweir 				ePage = PAGE_FIRST;
269cdf0e10cSrcweir 			else if( nId == TBI_PREVIOUS )
270cdf0e10cSrcweir 				ePage = PAGE_PREVIOUS;
271cdf0e10cSrcweir 			else if( nId == TBI_NEXT )
272cdf0e10cSrcweir 				ePage = PAGE_NEXT;
273cdf0e10cSrcweir 			else if( nId == TBI_LAST )
274cdf0e10cSrcweir 				ePage = PAGE_LAST;
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 			if( ePage != PAGE_NONE )
277cdf0e10cSrcweir 			{
278cdf0e10cSrcweir 				SfxUInt16Item aItem( SID_NAVIGATOR_PAGE, (sal_uInt16)ePage );
279cdf0e10cSrcweir 				mpBindings->GetDispatcher()->Execute(
280cdf0e10cSrcweir 					SID_NAVIGATOR_PAGE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L );
281cdf0e10cSrcweir 			}
282cdf0e10cSrcweir 		}
283cdf0e10cSrcweir 		break;
284cdf0e10cSrcweir 	}
285cdf0e10cSrcweir 	return 0;
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir // -----------------------------------------------------------------------
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 
291cdf0e10cSrcweir IMPL_LINK( SdNavigatorWin, ClickToolboxHdl, ToolBox*, EMPTYARG )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir 	return 0;
294cdf0e10cSrcweir }
295cdf0e10cSrcweir 
296cdf0e10cSrcweir // -----------------------------------------------------------------------
297cdf0e10cSrcweir 
298cdf0e10cSrcweir IMPL_LINK( SdNavigatorWin, DropdownClickToolBoxHdl, ToolBox*, pBox )
299cdf0e10cSrcweir {
300cdf0e10cSrcweir 	sal_uInt16 nId = maToolbox.GetCurItemId();
301cdf0e10cSrcweir 
302cdf0e10cSrcweir 	switch( nId )
303cdf0e10cSrcweir 	{
304cdf0e10cSrcweir 		case TBI_DRAGTYPE:
305cdf0e10cSrcweir 		{
306cdf0e10cSrcweir 			// Popup-Menu wird in Abhaengigkeit davon erzeugt, ob Dokument
307cdf0e10cSrcweir 			// gespeichert ist oder nicht
308cdf0e10cSrcweir 			PopupMenu *pMenu = new PopupMenu;
309cdf0e10cSrcweir 
310cdf0e10cSrcweir             static const char* aHIDs[] =
311cdf0e10cSrcweir             {
312cdf0e10cSrcweir                  HID_SD_NAVIGATOR_MENU1,
313cdf0e10cSrcweir                  HID_SD_NAVIGATOR_MENU2,
314cdf0e10cSrcweir                  HID_SD_NAVIGATOR_MENU3,
315cdf0e10cSrcweir                  0
316cdf0e10cSrcweir             };
317cdf0e10cSrcweir 
318cdf0e10cSrcweir 			for( sal_uInt16 nID = NAVIGATOR_DRAGTYPE_URL;
319cdf0e10cSrcweir 				 nID < NAVIGATOR_DRAGTYPE_COUNT;
320cdf0e10cSrcweir 				 nID++ )
321cdf0e10cSrcweir 			{
322cdf0e10cSrcweir 				sal_uInt16 nRId = GetDragTypeSdResId( (NavigatorDragType)nID );
323cdf0e10cSrcweir 				if( nRId > 0 )
324cdf0e10cSrcweir 				{
325cdf0e10cSrcweir                     DBG_ASSERT(aHIDs[nID-NAVIGATOR_DRAGTYPE_URL],"HelpId not added!");
326cdf0e10cSrcweir 					pMenu->InsertItem( nID, String( SdResId( nRId ) ) );
327cdf0e10cSrcweir 					pMenu->SetHelpId( nID, aHIDs[nID - NAVIGATOR_DRAGTYPE_URL] );
328cdf0e10cSrcweir 				}
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 			}
331cdf0e10cSrcweir 			NavDocInfo* pInfo = GetDocInfo();
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 			if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() )
334cdf0e10cSrcweir 			{
335cdf0e10cSrcweir 				pMenu->EnableItem( NAVIGATOR_DRAGTYPE_LINK, sal_False );
336cdf0e10cSrcweir 				pMenu->EnableItem( NAVIGATOR_DRAGTYPE_URL, sal_False );
337cdf0e10cSrcweir 				meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED;
338cdf0e10cSrcweir 			}
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 			pMenu->CheckItem( (sal_uInt16)meDragType );
341cdf0e10cSrcweir 			pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, MenuSelectHdl ) );
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 			pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
344cdf0e10cSrcweir 			pBox->EndSelection();
345cdf0e10cSrcweir 			delete pMenu;
346cdf0e10cSrcweir 		}
347cdf0e10cSrcweir 		break;
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 		case TBI_SHAPE_FILTER:
350cdf0e10cSrcweir 		{
351cdf0e10cSrcweir 			PopupMenu *pMenu = new PopupMenu;
352cdf0e10cSrcweir 
353cdf0e10cSrcweir             pMenu->InsertItem(
354cdf0e10cSrcweir                 nShowNamedShapesFilter,
355cdf0e10cSrcweir                 String(SdResId(STR_NAVIGATOR_SHOW_NAMED_SHAPES)));
356cdf0e10cSrcweir             pMenu->InsertItem(
357cdf0e10cSrcweir                 nShowAllShapesFilter,
358cdf0e10cSrcweir                 String(SdResId(STR_NAVIGATOR_SHOW_ALL_SHAPES)));
359cdf0e10cSrcweir 
360cdf0e10cSrcweir             if (maTlbObjects.GetShowAllShapes())
361cdf0e10cSrcweir                 pMenu->CheckItem(nShowAllShapesFilter);
362cdf0e10cSrcweir             else
363cdf0e10cSrcweir                 pMenu->CheckItem(nShowNamedShapesFilter);
364cdf0e10cSrcweir 			pMenu->SetSelectHdl( LINK( this, SdNavigatorWin, ShapeFilterCallback ) );
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 			pMenu->Execute( this, maToolbox.GetItemRect( nId ), POPUPMENU_EXECUTE_DOWN );
367cdf0e10cSrcweir 			pBox->EndSelection();
368cdf0e10cSrcweir 			delete pMenu;
369cdf0e10cSrcweir 		}
370cdf0e10cSrcweir 		break;
371cdf0e10cSrcweir 	}
372cdf0e10cSrcweir 	return 0;
373cdf0e10cSrcweir }
374cdf0e10cSrcweir 
375cdf0e10cSrcweir // -----------------------------------------------------------------------
376cdf0e10cSrcweir 
377cdf0e10cSrcweir IMPL_LINK( SdNavigatorWin, ClickObjectHdl, void *, EMPTYARG )
378cdf0e10cSrcweir {
379cdf0e10cSrcweir 	if( !mbDocImported || maLbDocs.GetSelectEntryPos() != 0 )
380cdf0e10cSrcweir 	{
381cdf0e10cSrcweir 		NavDocInfo* pInfo = GetDocInfo();
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 		// Nur wenn es sich um das aktive Fenster handelt, wird
384cdf0e10cSrcweir 		// auf die Seite gesprungen
385cdf0e10cSrcweir 		if( pInfo && pInfo->IsActive() )
386cdf0e10cSrcweir 		{
387cdf0e10cSrcweir 			String aStr( maTlbObjects.GetSelectEntry() );
388cdf0e10cSrcweir 
389cdf0e10cSrcweir 			if( aStr.Len() > 0 )
390cdf0e10cSrcweir 			{
391cdf0e10cSrcweir 				SfxStringItem aItem( SID_NAVIGATOR_OBJECT, aStr );
392cdf0e10cSrcweir 				mpBindings->GetDispatcher()->Execute(
393cdf0e10cSrcweir 					SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L );
394cdf0e10cSrcweir 
395cdf0e10cSrcweir                 // #98821# moved here from SetGetFocusHdl. Reset the
396cdf0e10cSrcweir                 // focus only if something has been selected in the
397cdf0e10cSrcweir                 // document.
398cdf0e10cSrcweir                 SfxViewShell* pCurSh = SfxViewShell::Current();
399cdf0e10cSrcweir 
400cdf0e10cSrcweir                 if ( pCurSh )
401cdf0e10cSrcweir                 {
402cdf0e10cSrcweir                     Window* pShellWnd = pCurSh->GetWindow();
403cdf0e10cSrcweir                     if ( pShellWnd )
404cdf0e10cSrcweir                         pShellWnd->GrabFocus();
405cdf0e10cSrcweir                 }
406cdf0e10cSrcweir 			}
407cdf0e10cSrcweir 		}
408cdf0e10cSrcweir 	}
409cdf0e10cSrcweir 	return( 0L );
410cdf0e10cSrcweir }
411cdf0e10cSrcweir 
412cdf0e10cSrcweir // -----------------------------------------------------------------------
413cdf0e10cSrcweir 
414cdf0e10cSrcweir IMPL_LINK( SdNavigatorWin, SelectDocumentHdl, void *, EMPTYARG )
415cdf0e10cSrcweir {
416cdf0e10cSrcweir 	String aStrLb = maLbDocs.GetSelectEntry();
417cdf0e10cSrcweir 	long   nPos = maLbDocs.GetSelectEntryPos();
418cdf0e10cSrcweir 	sal_Bool   bFound = sal_False;
419cdf0e10cSrcweir 	::sd::DrawDocShell* pDocShell = NULL;
420cdf0e10cSrcweir 	NavDocInfo* pInfo = GetDocInfo();
421cdf0e10cSrcweir 
422cdf0e10cSrcweir 	// Handelt es sich um ein gedragtes Objekt?
423cdf0e10cSrcweir 	if( mbDocImported && nPos == 0 )
424cdf0e10cSrcweir 	{
425cdf0e10cSrcweir 		// Dokument in TLB aufbauen
426cdf0e10cSrcweir 		InsertFile( aStrLb );
427cdf0e10cSrcweir 	}
428cdf0e10cSrcweir 	else if (pInfo)
429cdf0e10cSrcweir 	{
430cdf0e10cSrcweir 		pDocShell = pInfo->mpDocShell;
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 		bFound = sal_True;
433cdf0e10cSrcweir 	}
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 	if( bFound )
436cdf0e10cSrcweir 	{
437cdf0e10cSrcweir 		SdDrawDocument* pDoc = pDocShell->GetDoc();
438cdf0e10cSrcweir 		if( !maTlbObjects.IsEqualToDoc( pDoc ) )
439cdf0e10cSrcweir 		{
440cdf0e10cSrcweir 			SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can...
441cdf0e10cSrcweir 			::sd::DrawDocShell* pNCDocShell = pNonConstDoc->GetDocSh();
442cdf0e10cSrcweir 			String aDocName = pNCDocShell->GetMedium()->GetName();
443cdf0e10cSrcweir 			maTlbObjects.Clear();
444cdf0e10cSrcweir 			maTlbObjects.Fill( pDoc, (sal_Bool) sal_False, aDocName ); // Nur normale Seiten
445cdf0e10cSrcweir 		}
446cdf0e10cSrcweir 	}
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 	// Pruefen, ob Link oder URL moeglich ist
449cdf0e10cSrcweir 	if( ( pInfo && !pInfo->HasName() ) || !maTlbObjects.IsLinkableSelected() || ( meDragType != NAVIGATOR_DRAGTYPE_EMBEDDED ) )
450cdf0e10cSrcweir 	{
451cdf0e10cSrcweir 		meDragType = NAVIGATOR_DRAGTYPE_EMBEDDED;
452cdf0e10cSrcweir 		SetDragImage();
453cdf0e10cSrcweir 	}
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 	return( 0L );
456cdf0e10cSrcweir }
457cdf0e10cSrcweir 
458cdf0e10cSrcweir /*************************************************************************
459cdf0e10cSrcweir |*
460cdf0e10cSrcweir |* DrageType wird gesetzt und Image wird entspr. gesetzt.
461cdf0e10cSrcweir |* Sollte Handler mit NULL gerufen werden, so wird der Default (URL) gesetzt.
462cdf0e10cSrcweir |*
463cdf0e10cSrcweir \************************************************************************/
464cdf0e10cSrcweir 
465cdf0e10cSrcweir IMPL_LINK( SdNavigatorWin, MenuSelectHdl, Menu *, pMenu )
466cdf0e10cSrcweir {
467cdf0e10cSrcweir 	sal_uInt16 nMenuId;
468cdf0e10cSrcweir 	if( pMenu )
469cdf0e10cSrcweir 		nMenuId = pMenu->GetCurItemId();
470cdf0e10cSrcweir 	else
471cdf0e10cSrcweir 		nMenuId = NAVIGATOR_DRAGTYPE_URL;
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 	if( nMenuId != USHRT_MAX ) // Notwendig ?
474cdf0e10cSrcweir 	{
475cdf0e10cSrcweir 		NavigatorDragType eDT = (NavigatorDragType) nMenuId;
476cdf0e10cSrcweir 		if( meDragType != eDT )
477cdf0e10cSrcweir 		{
478cdf0e10cSrcweir 			meDragType = eDT;
479cdf0e10cSrcweir 			SetDragImage();
480cdf0e10cSrcweir 
481cdf0e10cSrcweir 			if( meDragType == NAVIGATOR_DRAGTYPE_URL )
482cdf0e10cSrcweir 			{
483cdf0e10cSrcweir 				// Fix, um Endlosschleife zu unterbinden
484cdf0e10cSrcweir 				if( maTlbObjects.GetSelectionCount() > 1 )
485cdf0e10cSrcweir 					maTlbObjects.SelectAll( sal_False );
486cdf0e10cSrcweir 
487cdf0e10cSrcweir 				maTlbObjects.SetSelectionMode( SINGLE_SELECTION );
488cdf0e10cSrcweir 			}
489cdf0e10cSrcweir 			else
490cdf0e10cSrcweir 				maTlbObjects.SetSelectionMode( MULTIPLE_SELECTION );
491cdf0e10cSrcweir 		}
492cdf0e10cSrcweir 	}
493cdf0e10cSrcweir 	return( 0 );
494cdf0e10cSrcweir }
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 
497cdf0e10cSrcweir 
498cdf0e10cSrcweir 
499cdf0e10cSrcweir IMPL_LINK( SdNavigatorWin, ShapeFilterCallback, Menu *, pMenu )
500cdf0e10cSrcweir {
501cdf0e10cSrcweir 	if (pMenu != NULL)
502cdf0e10cSrcweir     {
503cdf0e10cSrcweir         bool bShowAllShapes (maTlbObjects.GetShowAllShapes());
504cdf0e10cSrcweir         sal_uInt16 nMenuId (pMenu->GetCurItemId());
505cdf0e10cSrcweir         switch (nMenuId)
506cdf0e10cSrcweir         {
507cdf0e10cSrcweir             case nShowNamedShapesFilter:
508cdf0e10cSrcweir                 bShowAllShapes = false;
509cdf0e10cSrcweir                 break;
510cdf0e10cSrcweir 
511cdf0e10cSrcweir             case nShowAllShapesFilter:
512cdf0e10cSrcweir                 bShowAllShapes = true;
513cdf0e10cSrcweir                 break;
514cdf0e10cSrcweir 
515cdf0e10cSrcweir             default:
516cdf0e10cSrcweir                 OSL_ENSURE(
517cdf0e10cSrcweir                     false, "SdNavigatorWin::ShapeFilterCallback called for unknown menu entry");
518cdf0e10cSrcweir                 break;
519cdf0e10cSrcweir         }
520cdf0e10cSrcweir 
521cdf0e10cSrcweir         maTlbObjects.SetShowAllShapes(bShowAllShapes, true);
522cdf0e10cSrcweir 
523cdf0e10cSrcweir         // Remember the selection in the FrameView.
524cdf0e10cSrcweir         NavDocInfo* pInfo = GetDocInfo();
525cdf0e10cSrcweir         if (pInfo != NULL)
526cdf0e10cSrcweir         {
527cdf0e10cSrcweir             ::sd::DrawDocShell* pDocShell = pInfo->mpDocShell;
528cdf0e10cSrcweir             if (pDocShell != NULL)
529cdf0e10cSrcweir             {
530cdf0e10cSrcweir                 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
531cdf0e10cSrcweir                 if (pViewShell != NULL)
532cdf0e10cSrcweir                 {
533cdf0e10cSrcweir                     ::sd::FrameView* pFrameView = pViewShell->GetFrameView();
534cdf0e10cSrcweir                     if (pFrameView != NULL)
535cdf0e10cSrcweir                     {
536cdf0e10cSrcweir                         pFrameView->SetIsNavigatorShowingAllShapes(bShowAllShapes);
537cdf0e10cSrcweir                     }
538cdf0e10cSrcweir                 }
539cdf0e10cSrcweir             }
540cdf0e10cSrcweir         }
541cdf0e10cSrcweir 	}
542cdf0e10cSrcweir 
543cdf0e10cSrcweir 	return 0;
544cdf0e10cSrcweir }
545cdf0e10cSrcweir 
546cdf0e10cSrcweir // -----------------------------------------------------------------------
547cdf0e10cSrcweir 
548cdf0e10cSrcweir void SdNavigatorWin::Resize()
549cdf0e10cSrcweir {
550cdf0e10cSrcweir 	Size aWinSize( GetOutputSizePixel() );
551cdf0e10cSrcweir 	if( aWinSize.Height() >= maMinSize.Height() )
552cdf0e10cSrcweir 		//aWinSize.Width() >= maMinSize.Width() )
553cdf0e10cSrcweir 	{
554cdf0e10cSrcweir 		Size aDiffSize;
555cdf0e10cSrcweir 		aDiffSize.Width() = aWinSize.Width() - maSize.Width();
556cdf0e10cSrcweir 		aDiffSize.Height() = aWinSize.Height() - maSize.Height();
557cdf0e10cSrcweir 
558cdf0e10cSrcweir 		// Umgroessern der Toolbox
559cdf0e10cSrcweir 		Size aObjSize( maToolbox.GetOutputSizePixel() );
560cdf0e10cSrcweir 		aObjSize.Width() += aDiffSize.Width();
561cdf0e10cSrcweir 		maToolbox.SetOutputSizePixel( aObjSize );
562cdf0e10cSrcweir 
563cdf0e10cSrcweir 		// Umgroessern der TreeLB
564cdf0e10cSrcweir 		aObjSize = maTlbObjects.Control::GetOutputSizePixel();
565cdf0e10cSrcweir 		aObjSize.Width() += aDiffSize.Width();
566cdf0e10cSrcweir 		aObjSize.Height() += aDiffSize.Height();
567cdf0e10cSrcweir 		maTlbObjects.SetOutputSizePixel( aObjSize );
568cdf0e10cSrcweir 
569cdf0e10cSrcweir 		Point aPt( 0, aDiffSize.Height() );
570cdf0e10cSrcweir 
571cdf0e10cSrcweir 		// Verschieben der anderen Controls (DocumentLB)
572cdf0e10cSrcweir 		maLbDocs.Hide();
573cdf0e10cSrcweir 		aObjSize = maLbDocs.GetOutputSizePixel();
574cdf0e10cSrcweir 		aObjSize.Width() += aDiffSize.Width();
575cdf0e10cSrcweir 		maLbDocs.SetPosPixel( maLbDocs.GetPosPixel() + aPt );
576cdf0e10cSrcweir 		maLbDocs.SetOutputSizePixel( aObjSize );
577cdf0e10cSrcweir 		maLbDocs.Show();
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 		maSize = aWinSize;
580cdf0e10cSrcweir 	}
581cdf0e10cSrcweir 	Window::Resize();
582cdf0e10cSrcweir }
583cdf0e10cSrcweir 
584cdf0e10cSrcweir // -----------------------------------------------------------------------
585cdf0e10cSrcweir 
586cdf0e10cSrcweir sal_Bool SdNavigatorWin::InsertFile(const String& rFileName)
587cdf0e10cSrcweir {
588cdf0e10cSrcweir 	INetURLObject	aURL( rFileName );
589cdf0e10cSrcweir 	sal_Bool			bReturn = sal_True;
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 	if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
592cdf0e10cSrcweir 	{
593cdf0e10cSrcweir 		String aURLStr;
594cdf0e10cSrcweir 		::utl::LocalFileHelper::ConvertPhysicalNameToURL( rFileName, aURLStr );
595cdf0e10cSrcweir 		aURL = INetURLObject( aURLStr );
596cdf0e10cSrcweir 	}
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 	// get adjusted FileName
599cdf0e10cSrcweir 	String aFileName( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
600cdf0e10cSrcweir 
601cdf0e10cSrcweir 	if (!aFileName.Len())
602cdf0e10cSrcweir 	{
603cdf0e10cSrcweir 		/**********************************************************************
604cdf0e10cSrcweir 		* Wieder aktuelles Dokument anzeigen
605cdf0e10cSrcweir 		**********************************************************************/
606cdf0e10cSrcweir 		maDropFileName = aFileName;
607cdf0e10cSrcweir 	}
608cdf0e10cSrcweir 	else
609cdf0e10cSrcweir 	{
610cdf0e10cSrcweir 		/**********************************************************************
611cdf0e10cSrcweir 		* Hineingedraggtes Dokument anzeigen
612cdf0e10cSrcweir 		**********************************************************************/
613cdf0e10cSrcweir 		const SfxFilter* pFilter = NULL;
614cdf0e10cSrcweir 		ErrCode nErr = 0;
615cdf0e10cSrcweir 
616cdf0e10cSrcweir 		if (aFileName != maDropFileName)
617cdf0e10cSrcweir 		{
618cdf0e10cSrcweir 			SfxMedium aMed(aFileName, (STREAM_READ | STREAM_SHARE_DENYNONE), sal_False);
619cdf0e10cSrcweir 			SfxFilterMatcher aMatch( String::CreateFromAscii("simpress") );
620cdf0e10cSrcweir             aMed.UseInteractionHandler( sal_True );
621cdf0e10cSrcweir 			nErr = aMatch.GuessFilter(aMed, &pFilter);
622cdf0e10cSrcweir 		}
623cdf0e10cSrcweir 
624cdf0e10cSrcweir 		if ((pFilter && !nErr) || aFileName == maDropFileName)
625cdf0e10cSrcweir 		{
626cdf0e10cSrcweir 			// Das Medium muss ggf. mit READ/WRITE geoeffnet werden, daher wird
627cdf0e10cSrcweir 			// ersteinmal nachgeschaut, ob es einen Storage enthaelt
628cdf0e10cSrcweir 			SfxMedium* pMedium = new SfxMedium( aFileName,
629cdf0e10cSrcweir 												STREAM_READ | STREAM_NOCREATE,
630cdf0e10cSrcweir 												sal_True);				  // Download
631cdf0e10cSrcweir 
632cdf0e10cSrcweir 			if (pMedium->IsStorage())
633cdf0e10cSrcweir 			{
634cdf0e10cSrcweir 				// Jetzt modusabhaengig:
635cdf0e10cSrcweir 				// maTlbObjects.SetSelectionMode(MULTIPLE_SELECTION);
636cdf0e10cSrcweir 				// Eigentuemeruebergabe von pMedium;
637cdf0e10cSrcweir 				SdDrawDocument* pDropDoc = maTlbObjects.GetBookmarkDoc(pMedium);
638cdf0e10cSrcweir 
639cdf0e10cSrcweir 				if (pDropDoc)
640cdf0e10cSrcweir 				{
641cdf0e10cSrcweir 					maTlbObjects.Clear();
642cdf0e10cSrcweir 					maDropFileName = aFileName;
643cdf0e10cSrcweir 
644cdf0e10cSrcweir 					if( !maTlbObjects.IsEqualToDoc( pDropDoc ) )
645cdf0e10cSrcweir 					{
646cdf0e10cSrcweir 						// Nur normale Seiten
647cdf0e10cSrcweir 						maTlbObjects.Fill(pDropDoc, (sal_Bool) sal_False, maDropFileName);
648cdf0e10cSrcweir 						RefreshDocumentLB( &maDropFileName );
649cdf0e10cSrcweir 					}
650cdf0e10cSrcweir 				}
651cdf0e10cSrcweir 			}
652cdf0e10cSrcweir 			else
653cdf0e10cSrcweir 			{
654cdf0e10cSrcweir 				bReturn = sal_False;
655cdf0e10cSrcweir 				delete pMedium;
656cdf0e10cSrcweir 			}
657cdf0e10cSrcweir 		}
658cdf0e10cSrcweir 		else
659cdf0e10cSrcweir 		{
660cdf0e10cSrcweir 			bReturn = sal_False;
661cdf0e10cSrcweir 		}
662cdf0e10cSrcweir 	}
663cdf0e10cSrcweir 
664cdf0e10cSrcweir 	return (bReturn);
665cdf0e10cSrcweir }
666cdf0e10cSrcweir 
667cdf0e10cSrcweir // -----------------------------------------------------------------------
668cdf0e10cSrcweir 
669cdf0e10cSrcweir void SdNavigatorWin::RefreshDocumentLB( const String* pDocName )
670cdf0e10cSrcweir {
671cdf0e10cSrcweir 	sal_uInt16 nPos = 0;
672cdf0e10cSrcweir 
673cdf0e10cSrcweir 	if( pDocName )
674cdf0e10cSrcweir 	{
675cdf0e10cSrcweir 		if( mbDocImported )
676cdf0e10cSrcweir 			maLbDocs.RemoveEntry( 0 );
677cdf0e10cSrcweir 
678cdf0e10cSrcweir 		maLbDocs.InsertEntry( *pDocName, 0 );
679cdf0e10cSrcweir 		mbDocImported = sal_True;
680cdf0e10cSrcweir 	}
681cdf0e10cSrcweir 	else
682cdf0e10cSrcweir 	{
683cdf0e10cSrcweir 		nPos = maLbDocs.GetSelectEntryPos();
684cdf0e10cSrcweir 		if( nPos == LISTBOX_ENTRY_NOTFOUND )
685cdf0e10cSrcweir 			nPos = 0;
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 		String aStr;
688cdf0e10cSrcweir 		if( mbDocImported )
689cdf0e10cSrcweir 			aStr = maLbDocs.GetEntry( 0 );
690cdf0e10cSrcweir 
691cdf0e10cSrcweir 		maLbDocs.Clear();
692cdf0e10cSrcweir 
693cdf0e10cSrcweir 		// Liste der DocInfos loeschen
694cdf0e10cSrcweir 		long nCount = mpDocList->Count();
695cdf0e10cSrcweir 		while( nCount-- )
696cdf0e10cSrcweir 			delete (NavDocInfo*) mpDocList->Remove( (sal_uLong)0 );
697cdf0e10cSrcweir 
698cdf0e10cSrcweir 		if( mbDocImported )
699cdf0e10cSrcweir 			maLbDocs.InsertEntry( aStr, 0 );
700cdf0e10cSrcweir 
701cdf0e10cSrcweir 		::sd::DrawDocShell* pCurrentDocShell =
702cdf0e10cSrcweir               PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
703cdf0e10cSrcweir 		SfxObjectShell* pSfxDocShell = SfxObjectShell::GetFirst(0, sal_False);
704cdf0e10cSrcweir 		while( pSfxDocShell )
705cdf0e10cSrcweir 		{
706cdf0e10cSrcweir 			::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, pSfxDocShell );
707cdf0e10cSrcweir 			if( pDocShell  && !pDocShell->IsInDestruction() && ( pDocShell->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) )
708cdf0e10cSrcweir 			{
709cdf0e10cSrcweir 				NavDocInfo* pInfo = new NavDocInfo();
710cdf0e10cSrcweir 				pInfo->mpDocShell = pDocShell;
711cdf0e10cSrcweir 
712cdf0e10cSrcweir 				aStr = pDocShell->GetMedium()->GetName();
713cdf0e10cSrcweir 				if( aStr.Len() )
714cdf0e10cSrcweir 					pInfo->SetName();
715cdf0e10cSrcweir 				else
716cdf0e10cSrcweir 					pInfo->SetName( sal_False );
717cdf0e10cSrcweir 				// z.Z. wird wieder der Name der Shell genommen (also ohne Pfad)
718cdf0e10cSrcweir 				// da Koose es als Fehler ansieht, wenn er Pfad in URL-Notation
719cdf0e10cSrcweir 				// angezeigt wird!
720cdf0e10cSrcweir 				aStr = pDocShell->GetName();
721cdf0e10cSrcweir 
722cdf0e10cSrcweir 				maLbDocs.InsertEntry( aStr, LISTBOX_APPEND );
723cdf0e10cSrcweir 
724cdf0e10cSrcweir 				//
725cdf0e10cSrcweir 				if( pDocShell == pCurrentDocShell )
726cdf0e10cSrcweir 					pInfo->SetActive();
727cdf0e10cSrcweir 				else
728cdf0e10cSrcweir 					pInfo->SetActive( sal_False );
729cdf0e10cSrcweir 
730cdf0e10cSrcweir 				mpDocList->Insert( pInfo, LIST_APPEND );
731cdf0e10cSrcweir 			}
732cdf0e10cSrcweir 			pSfxDocShell = SfxObjectShell::GetNext( *pSfxDocShell, 0 , sal_False );
733cdf0e10cSrcweir 		}
734cdf0e10cSrcweir 	}
735cdf0e10cSrcweir 	maLbDocs.SelectEntryPos( nPos );
736cdf0e10cSrcweir }
737cdf0e10cSrcweir 
738cdf0e10cSrcweir //------------------------------------------------------------------------
739cdf0e10cSrcweir 
740cdf0e10cSrcweir sal_uInt16 SdNavigatorWin::GetDragTypeSdResId( NavigatorDragType eDT, sal_Bool bImage )
741cdf0e10cSrcweir {
742cdf0e10cSrcweir 	switch( eDT )
743cdf0e10cSrcweir 	{
744cdf0e10cSrcweir 		case NAVIGATOR_DRAGTYPE_NONE:
745cdf0e10cSrcweir 				return( bImage ? 0 : STR_NONE );
746cdf0e10cSrcweir 		case NAVIGATOR_DRAGTYPE_URL:
747cdf0e10cSrcweir 				return( bImage ? TBI_HYPERLINK : STR_DRAGTYPE_URL );
748cdf0e10cSrcweir 		case NAVIGATOR_DRAGTYPE_EMBEDDED:
749cdf0e10cSrcweir 				return( bImage ? TBI_EMBEDDED : STR_DRAGTYPE_EMBEDDED );
750cdf0e10cSrcweir 		case NAVIGATOR_DRAGTYPE_LINK:
751cdf0e10cSrcweir 				return( bImage ? TBI_LINK : STR_DRAGTYPE_LINK );
752cdf0e10cSrcweir 		default: DBG_ERROR( "Keine Resource fuer DragType vorhanden!" );
753cdf0e10cSrcweir 	}
754cdf0e10cSrcweir 	return( 0 );
755cdf0e10cSrcweir }
756cdf0e10cSrcweir 
757cdf0e10cSrcweir //------------------------------------------------------------------------
758cdf0e10cSrcweir 
759cdf0e10cSrcweir NavDocInfo* SdNavigatorWin::GetDocInfo()
760cdf0e10cSrcweir {
761cdf0e10cSrcweir 	long nPos = maLbDocs.GetSelectEntryPos();
762cdf0e10cSrcweir 
763cdf0e10cSrcweir 	if( mbDocImported )
764cdf0e10cSrcweir 	{
765cdf0e10cSrcweir 		if( nPos == 0 )
766cdf0e10cSrcweir 		{
767cdf0e10cSrcweir 			return( NULL );
768cdf0e10cSrcweir 		}
769cdf0e10cSrcweir 		nPos--;
770cdf0e10cSrcweir 	}
771cdf0e10cSrcweir 
772cdf0e10cSrcweir 	NavDocInfo* pInfo = (NavDocInfo*)mpDocList->GetObject( nPos );
773cdf0e10cSrcweir 
774cdf0e10cSrcweir 	return( pInfo );
775cdf0e10cSrcweir }
776cdf0e10cSrcweir 
777cdf0e10cSrcweir /*************************************************************************
778cdf0e10cSrcweir |*
779cdf0e10cSrcweir |* PreNotify
780cdf0e10cSrcweir |*
781cdf0e10cSrcweir \************************************************************************/
782cdf0e10cSrcweir 
783cdf0e10cSrcweir long SdNavigatorWin::Notify(NotifyEvent& rNEvt)
784cdf0e10cSrcweir {
785cdf0e10cSrcweir 	const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
786cdf0e10cSrcweir 	long			nOK = sal_False;
787cdf0e10cSrcweir 
788cdf0e10cSrcweir 	if( pKEvt )
789cdf0e10cSrcweir 	{
790cdf0e10cSrcweir 		if( KEY_ESCAPE == pKEvt->GetKeyCode().GetCode() )
791cdf0e10cSrcweir 		{
792cdf0e10cSrcweir 			if( SdPageObjsTLB::IsInDrag() )
793cdf0e10cSrcweir 			{
794cdf0e10cSrcweir 				// during drag'n'drop we just stop the drag but do not close the navigator
795cdf0e10cSrcweir 				nOK = sal_True;
796cdf0e10cSrcweir 			}
797cdf0e10cSrcweir 			else
798cdf0e10cSrcweir 			{
799cdf0e10cSrcweir                 ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( mpBindings->GetDispatcher()->GetFrame());
800cdf0e10cSrcweir                 if( pBase )
801cdf0e10cSrcweir                 {
802cdf0e10cSrcweir                     sd::SlideShow::Stop( *pBase );
803cdf0e10cSrcweir                     // Stopping the slide show may result in a synchronous
804cdf0e10cSrcweir                     // deletion of the navigator window.  Calling the
805cdf0e10cSrcweir                     // parents Notify after this is unsafe.  Therefore we
806cdf0e10cSrcweir                     // return now.
807cdf0e10cSrcweir                     return sal_True;
808cdf0e10cSrcweir                 }
809cdf0e10cSrcweir             }
810cdf0e10cSrcweir         }
811cdf0e10cSrcweir     }
812cdf0e10cSrcweir 
813cdf0e10cSrcweir     if( !nOK )
814cdf0e10cSrcweir 		nOK = Window::Notify( rNEvt );
815cdf0e10cSrcweir 
816cdf0e10cSrcweir 	return( nOK );
817cdf0e10cSrcweir }
818cdf0e10cSrcweir 
819cdf0e10cSrcweir 
820cdf0e10cSrcweir /*************************************************************************
821cdf0e10cSrcweir |*
822cdf0e10cSrcweir |* KeyInput: ESCAPE abfangen, um Show zu beenden
823cdf0e10cSrcweir |*
824cdf0e10cSrcweir \************************************************************************/
825cdf0e10cSrcweir 
826cdf0e10cSrcweir void SdNavigatorWin::KeyInput( const KeyEvent& rKEvt )
827cdf0e10cSrcweir {
828cdf0e10cSrcweir 	long nOK = sal_False;
829cdf0e10cSrcweir 
830cdf0e10cSrcweir 	if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE)
831cdf0e10cSrcweir 	{
832cdf0e10cSrcweir 		if( SdPageObjsTLB::IsInDrag() )
833cdf0e10cSrcweir 		{
834cdf0e10cSrcweir 			// during drag'n'drop we just stop the drag but do not close the navigator
835cdf0e10cSrcweir 			nOK = sal_True;
836cdf0e10cSrcweir 		}
837cdf0e10cSrcweir 		else
838cdf0e10cSrcweir 		{
839cdf0e10cSrcweir             ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( mpBindings->GetDispatcher()->GetFrame());
840cdf0e10cSrcweir 			if(pBase)
841cdf0e10cSrcweir 			{
842cdf0e10cSrcweir 				::sd::SlideShow::Stop( *pBase );
843cdf0e10cSrcweir 			}
844cdf0e10cSrcweir 		}
845cdf0e10cSrcweir 	}
846cdf0e10cSrcweir 
847cdf0e10cSrcweir 	if (!nOK)
848cdf0e10cSrcweir 	{
849cdf0e10cSrcweir 		Window::KeyInput(rKEvt);
850cdf0e10cSrcweir 	}
851cdf0e10cSrcweir }
852cdf0e10cSrcweir 
853cdf0e10cSrcweir void SdNavigatorWin::DataChanged( const DataChangedEvent& rDCEvt )
854cdf0e10cSrcweir {
855cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
856cdf0e10cSrcweir             ApplyImageList();
857cdf0e10cSrcweir 
858cdf0e10cSrcweir     Window::DataChanged( rDCEvt );
859cdf0e10cSrcweir }
860cdf0e10cSrcweir 
861cdf0e10cSrcweir void SdNavigatorWin::SetDragImage()
862cdf0e10cSrcweir {
863cdf0e10cSrcweir 	maToolbox.SetItemImage( TBI_DRAGTYPE, maToolbox.GetImageList().GetImage( GetDragTypeSdResId( meDragType, sal_True ) ) );
864cdf0e10cSrcweir }
865cdf0e10cSrcweir 
866cdf0e10cSrcweir void SdNavigatorWin::ApplyImageList()
867cdf0e10cSrcweir {
868cdf0e10cSrcweir 	const bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
869cdf0e10cSrcweir 
870cdf0e10cSrcweir 	maToolbox.SetImageList( bHighContrast ? maImageListH : maImageList );
871cdf0e10cSrcweir 
872cdf0e10cSrcweir     maToolbox.SetItemImage(TBI_SHAPE_FILTER, BitmapEx(SdResId( bHighContrast ? BMP_GRAPHIC_H : BMP_GRAPHIC)));
873cdf0e10cSrcweir 
874cdf0e10cSrcweir 	SetDragImage();
875cdf0e10cSrcweir }
876cdf0e10cSrcweir 
877cdf0e10cSrcweir 
878cdf0e10cSrcweir 
879cdf0e10cSrcweir /*************************************************************************
880cdf0e10cSrcweir |*
881cdf0e10cSrcweir |* ControllerItem fuer Navigator
882cdf0e10cSrcweir |*
883cdf0e10cSrcweir \************************************************************************/
884cdf0e10cSrcweir 
885cdf0e10cSrcweir SdNavigatorControllerItem::SdNavigatorControllerItem( sal_uInt16 _nId,
886cdf0e10cSrcweir 								SdNavigatorWin* pNavWin,
887cdf0e10cSrcweir 								SfxBindings*	_pBindings) :
888cdf0e10cSrcweir 	SfxControllerItem( _nId, *_pBindings ),
889cdf0e10cSrcweir 	pNavigatorWin( pNavWin )
890cdf0e10cSrcweir {
891cdf0e10cSrcweir }
892cdf0e10cSrcweir 
893cdf0e10cSrcweir // -----------------------------------------------------------------------
894cdf0e10cSrcweir 
895cdf0e10cSrcweir void SdNavigatorControllerItem::StateChanged( sal_uInt16 nSId,
896cdf0e10cSrcweir 						SfxItemState eState, const SfxPoolItem* pItem )
897cdf0e10cSrcweir {
898cdf0e10cSrcweir 	if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_NAVIGATOR_STATE )
899cdf0e10cSrcweir 	{
900cdf0e10cSrcweir 		const SfxUInt32Item* pStateItem = PTR_CAST( SfxUInt32Item, pItem );
901cdf0e10cSrcweir 		DBG_ASSERT( pStateItem, "SfxUInt16Item erwartet");
902cdf0e10cSrcweir 		sal_uInt32 nState = pStateItem->GetValue();
903cdf0e10cSrcweir 
904cdf0e10cSrcweir 		// Stift
905cdf0e10cSrcweir 		if( nState & NAVBTN_PEN_ENABLED &&
906cdf0e10cSrcweir 			!pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) )
907cdf0e10cSrcweir 			pNavigatorWin->maToolbox.EnableItem( TBI_PEN );
908cdf0e10cSrcweir 		if( nState & NAVBTN_PEN_DISABLED &&
909cdf0e10cSrcweir 			pNavigatorWin->maToolbox.IsItemEnabled( TBI_PEN ) )
910cdf0e10cSrcweir 			pNavigatorWin->maToolbox.EnableItem( TBI_PEN, sal_False );
911cdf0e10cSrcweir 		if( nState & NAVBTN_PEN_CHECKED &&
912cdf0e10cSrcweir 			!pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) )
913cdf0e10cSrcweir 			pNavigatorWin->maToolbox.CheckItem( TBI_PEN );
914cdf0e10cSrcweir 		if( nState & NAVBTN_PEN_UNCHECKED &&
915cdf0e10cSrcweir 			pNavigatorWin->maToolbox.IsItemChecked( TBI_PEN ) )
916cdf0e10cSrcweir 			pNavigatorWin->maToolbox.CheckItem( TBI_PEN, sal_False );
917cdf0e10cSrcweir 
918cdf0e10cSrcweir 		// Nur wenn Doc in LB das Aktive ist
919cdf0e10cSrcweir 		NavDocInfo* pInfo = pNavigatorWin->GetDocInfo();
920cdf0e10cSrcweir 		if( pInfo && pInfo->IsActive() )
921cdf0e10cSrcweir 		{
922cdf0e10cSrcweir 			// First
923cdf0e10cSrcweir 			if( nState & NAVBTN_FIRST_ENABLED &&
924cdf0e10cSrcweir 				!pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) )
925cdf0e10cSrcweir 				pNavigatorWin->maToolbox.EnableItem( TBI_FIRST );
926cdf0e10cSrcweir 			if( nState & NAVBTN_FIRST_DISABLED &&
927cdf0e10cSrcweir 				pNavigatorWin->maToolbox.IsItemEnabled( TBI_FIRST ) )
928cdf0e10cSrcweir 				pNavigatorWin->maToolbox.EnableItem( TBI_FIRST, sal_False );
929cdf0e10cSrcweir 
930cdf0e10cSrcweir 			// Prev
931cdf0e10cSrcweir 			if( nState & NAVBTN_PREV_ENABLED &&
932cdf0e10cSrcweir 				!pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) )
933cdf0e10cSrcweir 				pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS );
934cdf0e10cSrcweir 			if( nState & NAVBTN_PREV_DISABLED &&
935cdf0e10cSrcweir 				pNavigatorWin->maToolbox.IsItemEnabled( TBI_PREVIOUS ) )
936cdf0e10cSrcweir 				pNavigatorWin->maToolbox.EnableItem( TBI_PREVIOUS, sal_False );
937cdf0e10cSrcweir 
938cdf0e10cSrcweir 			// Last
939cdf0e10cSrcweir 			if( nState & NAVBTN_LAST_ENABLED &&
940cdf0e10cSrcweir 				!pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) )
941cdf0e10cSrcweir 				pNavigatorWin->maToolbox.EnableItem( TBI_LAST );
942cdf0e10cSrcweir 			if( nState & NAVBTN_LAST_DISABLED &&
943cdf0e10cSrcweir 				pNavigatorWin->maToolbox.IsItemEnabled( TBI_LAST ) )
944cdf0e10cSrcweir 				pNavigatorWin->maToolbox.EnableItem( TBI_LAST, sal_False );
945cdf0e10cSrcweir 
946cdf0e10cSrcweir 			// Next
947cdf0e10cSrcweir 			if( nState & NAVBTN_NEXT_ENABLED &&
948cdf0e10cSrcweir 				!pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) )
949cdf0e10cSrcweir 				pNavigatorWin->maToolbox.EnableItem( TBI_NEXT );
950cdf0e10cSrcweir 			if( nState & NAVBTN_NEXT_DISABLED &&
951cdf0e10cSrcweir 				pNavigatorWin->maToolbox.IsItemEnabled( TBI_NEXT ) )
952cdf0e10cSrcweir 				pNavigatorWin->maToolbox.EnableItem( TBI_NEXT, sal_False );
953cdf0e10cSrcweir 
954cdf0e10cSrcweir 			if( nState & NAVTLB_UPDATE )
955cdf0e10cSrcweir 			{
956cdf0e10cSrcweir 				// InitTlb; Wird ueber Slot initiiert
957cdf0e10cSrcweir 				SfxBoolItem aItem( SID_NAVIGATOR_INIT, sal_True );
958cdf0e10cSrcweir 				GetBindings().GetDispatcher()->Execute(
959cdf0e10cSrcweir 					SID_NAVIGATOR_INIT, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aItem, 0L );
960cdf0e10cSrcweir 			}
961cdf0e10cSrcweir 		}
962cdf0e10cSrcweir 	}
963cdf0e10cSrcweir }
964cdf0e10cSrcweir 
965cdf0e10cSrcweir /*************************************************************************
966cdf0e10cSrcweir |*
967cdf0e10cSrcweir |* ControllerItem fuer Navigator, um die Seite in der TreeLB anzuzeigen
968cdf0e10cSrcweir |*
969cdf0e10cSrcweir \************************************************************************/
970cdf0e10cSrcweir 
971cdf0e10cSrcweir SdPageNameControllerItem::SdPageNameControllerItem( sal_uInt16 _nId,
972cdf0e10cSrcweir 								SdNavigatorWin* pNavWin,
973cdf0e10cSrcweir 								SfxBindings*	_pBindings) :
974cdf0e10cSrcweir 	SfxControllerItem( _nId, *_pBindings ),
975cdf0e10cSrcweir 	pNavigatorWin( pNavWin )
976cdf0e10cSrcweir {
977cdf0e10cSrcweir }
978cdf0e10cSrcweir 
979cdf0e10cSrcweir // -----------------------------------------------------------------------
980cdf0e10cSrcweir 
981cdf0e10cSrcweir void SdPageNameControllerItem::StateChanged( sal_uInt16 nSId,
982cdf0e10cSrcweir 						SfxItemState eState, const SfxPoolItem* pItem )
983cdf0e10cSrcweir {
984cdf0e10cSrcweir 	if( eState >= SFX_ITEM_AVAILABLE && nSId == SID_NAVIGATOR_PAGENAME )
985cdf0e10cSrcweir 	{
986cdf0e10cSrcweir 		// Nur wenn Doc in LB das Aktive ist
987cdf0e10cSrcweir 		NavDocInfo* pInfo = pNavigatorWin->GetDocInfo();
988cdf0e10cSrcweir 		if( pInfo && pInfo->IsActive() )
989cdf0e10cSrcweir 		{
990cdf0e10cSrcweir 			const SfxStringItem* pStateItem = PTR_CAST( SfxStringItem, pItem );
991cdf0e10cSrcweir 			DBG_ASSERT( pStateItem, "SfxStringItem erwartet");
992cdf0e10cSrcweir 			String aPageName = pStateItem->GetValue();
993cdf0e10cSrcweir 
994cdf0e10cSrcweir 			if( !pNavigatorWin->maTlbObjects.HasSelectedChilds( aPageName ) )
995cdf0e10cSrcweir 			{
996cdf0e10cSrcweir 				if( pNavigatorWin->maTlbObjects.GetSelectionMode() == MULTIPLE_SELECTION )
997cdf0e10cSrcweir 				{
998cdf0e10cSrcweir 					// Weil sonst immer dazuselektiert wird
999cdf0e10cSrcweir 					pNavigatorWin->maTlbObjects.SelectAll( sal_False );
1000cdf0e10cSrcweir 				}
1001cdf0e10cSrcweir 				pNavigatorWin->maTlbObjects.SelectEntry( aPageName );
1002cdf0e10cSrcweir 			}
1003cdf0e10cSrcweir 		}
1004cdf0e10cSrcweir 	}
1005cdf0e10cSrcweir }
1006