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