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