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