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