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 #include <sal/types.h> 32*cdf0e10cSrcweir #include <sot/formats.hxx> 33*cdf0e10cSrcweir #include <sot/storage.hxx> 34*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 35*cdf0e10cSrcweir #include <svl/urihelper.hxx> 36*cdf0e10cSrcweir #include <svx/svditer.hxx> 37*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 38*cdf0e10cSrcweir #include <svx/svdoole2.hxx> 39*cdf0e10cSrcweir #include <vcl/svapp.hxx> 40*cdf0e10cSrcweir #include "cusshow.hxx" 41*cdf0e10cSrcweir #include <sfx2/childwin.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include "strmname.h" 46*cdf0e10cSrcweir #include "sdtreelb.hxx" 47*cdf0e10cSrcweir #include "DrawDocShell.hxx" 48*cdf0e10cSrcweir #include "drawdoc.hxx" 49*cdf0e10cSrcweir #include "sdpage.hxx" 50*cdf0e10cSrcweir #include "sdresid.hxx" 51*cdf0e10cSrcweir #include "navigatr.hxx" 52*cdf0e10cSrcweir #ifndef _SD_CFGID_HXX 53*cdf0e10cSrcweir #include "strings.hrc" 54*cdf0e10cSrcweir #endif 55*cdf0e10cSrcweir #include "res_bmp.hrc" 56*cdf0e10cSrcweir #include "ViewShell.hxx" 57*cdf0e10cSrcweir #include "DrawController.hxx" 58*cdf0e10cSrcweir #include "ViewShellBase.hxx" 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir #include <com/sun/star/embed/XEmbedPersist.hpp> 61*cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp> 62*cdf0e10cSrcweir #include <com/sun/star/frame/XFramesSupplier.hpp> 63*cdf0e10cSrcweir #include <svtools/embedtransfer.hxx> 64*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 65*cdf0e10cSrcweir #include <tools/diagnose_ex.h> 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir using namespace com::sun::star; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir class SdPageObjsTLB::IconProvider 70*cdf0e10cSrcweir { 71*cdf0e10cSrcweir public: 72*cdf0e10cSrcweir IconProvider (void); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir // Regular icons. 75*cdf0e10cSrcweir Image maImgPage; 76*cdf0e10cSrcweir Image maImgPageExcl; 77*cdf0e10cSrcweir Image maImgPageObjsExcl; 78*cdf0e10cSrcweir Image maImgPageObjs; 79*cdf0e10cSrcweir Image maImgObjects; 80*cdf0e10cSrcweir Image maImgGroup; 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir // High contrast icons. 83*cdf0e10cSrcweir Image maImgPageH; 84*cdf0e10cSrcweir Image maImgPageExclH; 85*cdf0e10cSrcweir Image maImgPageObjsExclH; 86*cdf0e10cSrcweir Image maImgPageObjsH; 87*cdf0e10cSrcweir Image maImgObjectsH; 88*cdf0e10cSrcweir Image maImgGroupH; 89*cdf0e10cSrcweir }; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir sal_Bool SD_DLLPRIVATE SdPageObjsTLB::bIsInDrag = sal_False; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir sal_Bool SdPageObjsTLB::IsInDrag() 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir return bIsInDrag; 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::mnListBoxDropFormatId = SAL_MAX_UINT32; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir // ----------------------------------------- 102*cdf0e10cSrcweir // - SdPageObjsTLB::SdPageObjsTransferable - 103*cdf0e10cSrcweir // ----------------------------------------- 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable::SdPageObjsTransferable( 106*cdf0e10cSrcweir SdPageObjsTLB& rParent, 107*cdf0e10cSrcweir const INetBookmark& rBookmark, 108*cdf0e10cSrcweir ::sd::DrawDocShell& rDocShell, 109*cdf0e10cSrcweir NavigatorDragType eDragType, 110*cdf0e10cSrcweir const ::com::sun::star::uno::Any& rTreeListBoxData ) 111*cdf0e10cSrcweir : SdTransferable(rDocShell.GetDoc(), NULL, sal_True), 112*cdf0e10cSrcweir mrParent( rParent ), 113*cdf0e10cSrcweir maBookmark( rBookmark ), 114*cdf0e10cSrcweir mrDocShell( rDocShell ), 115*cdf0e10cSrcweir meDragType( eDragType ), 116*cdf0e10cSrcweir maTreeListBoxData( rTreeListBoxData ) 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable::~SdPageObjsTransferable() 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats() 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir AddFormat(SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK); 132*cdf0e10cSrcweir AddFormat(SOT_FORMATSTR_ID_TREELISTBOX); 133*cdf0e10cSrcweir AddFormat(GetListBoxDropFormatId()); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir sal_Bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir sal_uLong nFormatId = SotExchange::GetFormat( rFlavor ); 141*cdf0e10cSrcweir switch (nFormatId) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK: 144*cdf0e10cSrcweir SetINetBookmark( maBookmark, rFlavor ); 145*cdf0e10cSrcweir return sal_True; 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir case SOT_FORMATSTR_ID_TREELISTBOX: 148*cdf0e10cSrcweir SetAny(maTreeListBoxData, rFlavor); 149*cdf0e10cSrcweir return sal_True; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir default: 152*cdf0e10cSrcweir return sal_False; 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir void SdPageObjsTLB::SdPageObjsTransferable::DragFinished( sal_Int8 nDropAction ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir mrParent.OnDragFinished( nDropAction ); 161*cdf0e10cSrcweir SdTransferable::DragFinished(nDropAction); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir ::sd::DrawDocShell& SdPageObjsTLB::SdPageObjsTransferable::GetDocShell() const 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir return mrDocShell; 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir NavigatorDragType SdPageObjsTLB::SdPageObjsTransferable::GetDragType() const 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir return meDragType; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir sal_Int64 SAL_CALL SdPageObjsTLB::SdPageObjsTransferable::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException ) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir sal_Int64 nRet; 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir if( ( rId.getLength() == 16 ) && 185*cdf0e10cSrcweir ( 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir nRet = (sal_Int64)(sal_IntPtr)this; 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir else 190*cdf0e10cSrcweir nRet = SdTransferable::getSomething(rId); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir return nRet; 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< sal_Int8 >& SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId() 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir if( !aSeq.getLength() ) 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir static osl::Mutex aCreateMutex; 204*cdf0e10cSrcweir osl::MutexGuard aGuard( aCreateMutex ); 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir aSeq.realloc( 16 ); 207*cdf0e10cSrcweir rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True ); 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir return aSeq; 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable* SdPageObjsTLB::SdPageObjsTransferable::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) 216*cdf0e10cSrcweir throw() 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir try 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( rxData, ::com::sun::star::uno::UNO_QUERY_THROW ); 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir return reinterpret_cast<SdPageObjsTLB::SdPageObjsTransferable*>( 223*cdf0e10cSrcweir sal::static_int_cast<sal_uIntPtr>( 224*cdf0e10cSrcweir xUnoTunnel->getSomething( SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId()) ) ); 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir catch( const ::com::sun::star::uno::Exception& ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir return 0; 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId (void) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir if (mnListBoxDropFormatId == SAL_MAX_UINT32) 236*cdf0e10cSrcweir mnListBoxDropFormatId = SotExchange::RegisterFormatMimeType( 237*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( 238*cdf0e10cSrcweir "application/x-openoffice-treelistbox-moveonly;" 239*cdf0e10cSrcweir "windows_formatname=\"SV_LBOX_DD_FORMAT_MOVE\"")); 240*cdf0e10cSrcweir return mnListBoxDropFormatId; 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir /************************************************************************* 247*cdf0e10cSrcweir |* 248*cdf0e10cSrcweir |* Ctor1 SdPageObjsTLB 249*cdf0e10cSrcweir |* 250*cdf0e10cSrcweir \************************************************************************/ 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId ) 253*cdf0e10cSrcweir : SvTreeListBox ( pParentWin, rSdResId ) 254*cdf0e10cSrcweir , mpParent ( pParentWin ) 255*cdf0e10cSrcweir , mpDoc ( NULL ) 256*cdf0e10cSrcweir , mpBookmarkDoc ( NULL ) 257*cdf0e10cSrcweir , mpMedium ( NULL ) 258*cdf0e10cSrcweir , mpOwnMedium ( NULL ) 259*cdf0e10cSrcweir , maImgOle ( BitmapEx( SdResId( BMP_OLE ) ) ) 260*cdf0e10cSrcweir , maImgGraphic ( BitmapEx( SdResId( BMP_GRAPHIC ) ) ) 261*cdf0e10cSrcweir , maImgOleH ( BitmapEx( SdResId( BMP_OLE_H ) ) ) 262*cdf0e10cSrcweir , maImgGraphicH ( BitmapEx( SdResId( BMP_GRAPHIC_H ) ) ) 263*cdf0e10cSrcweir , mbLinkableSelected ( sal_False ) 264*cdf0e10cSrcweir , mpDropNavWin ( NULL ) 265*cdf0e10cSrcweir , mbShowAllShapes ( false ) 266*cdf0e10cSrcweir , mbShowAllPages ( false ) 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir // Tree-ListBox mit Linien versehen 270*cdf0e10cSrcweir SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES | 271*cdf0e10cSrcweir WB_HASBUTTONS | // WB_HASLINESATROOT | 272*cdf0e10cSrcweir WB_HSCROLL | // #31562# 273*cdf0e10cSrcweir WB_HASBUTTONSATROOT | 274*cdf0e10cSrcweir WB_QUICK_SEARCH /* i31275 */ ); 275*cdf0e10cSrcweir SetNodeBitmaps( Bitmap( SdResId( BMP_EXPAND ) ), 276*cdf0e10cSrcweir Bitmap( SdResId( BMP_COLLAPSE ) ) ); 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir SetNodeBitmaps( Bitmap( SdResId( BMP_EXPAND_H ) ), 279*cdf0e10cSrcweir Bitmap( SdResId( BMP_COLLAPSE_H ) ), 280*cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST ); 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir SetDragDropMode( 283*cdf0e10cSrcweir SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY | 284*cdf0e10cSrcweir SV_DRAGDROP_APP_MOVE | SV_DRAGDROP_APP_COPY | SV_DRAGDROP_APP_DROP ); 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir /************************************************************************* 288*cdf0e10cSrcweir |* 289*cdf0e10cSrcweir |* Dtor SdPageObjsTLB 290*cdf0e10cSrcweir |* 291*cdf0e10cSrcweir \************************************************************************/ 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir SdPageObjsTLB::~SdPageObjsTLB() 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir if ( mpBookmarkDoc ) 296*cdf0e10cSrcweir CloseBookmarkDoc(); 297*cdf0e10cSrcweir else 298*cdf0e10cSrcweir // no document was created from mpMedium, so this object is still the owner of it 299*cdf0e10cSrcweir delete mpMedium; 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir /************************************************************************* 303*cdf0e10cSrcweir |* 304*cdf0e10cSrcweir |* return name of object 305*cdf0e10cSrcweir |* 306*cdf0e10cSrcweir \************************************************************************/ 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir String SdPageObjsTLB::GetObjectName( 309*cdf0e10cSrcweir const SdrObject* pObject, 310*cdf0e10cSrcweir const bool bCreate) const 311*cdf0e10cSrcweir { 312*cdf0e10cSrcweir String aRet; 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir if ( pObject ) 315*cdf0e10cSrcweir { 316*cdf0e10cSrcweir aRet = pObject->GetName(); 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir if( !aRet.Len() && pObject->ISA( SdrOle2Obj ) ) 319*cdf0e10cSrcweir aRet = static_cast< const SdrOle2Obj* >( pObject )->GetPersistName(); 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir if (bCreate 323*cdf0e10cSrcweir && mbShowAllShapes 324*cdf0e10cSrcweir && aRet.Len() == 0 325*cdf0e10cSrcweir && pObject!=NULL) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir aRet = SdResId(STR_NAVIGATOR_SHAPE_BASE_NAME); 328*cdf0e10cSrcweir aRet.SearchAndReplaceAscii("%1", String::CreateFromInt32(pObject->GetOrdNum() + 1)); 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir return aRet; 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir /************************************************************************* 335*cdf0e10cSrcweir |* 336*cdf0e10cSrcweir |* In TreeLB Eintrag selektieren 337*cdf0e10cSrcweir |* 338*cdf0e10cSrcweir \************************************************************************/ 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir sal_Bool SdPageObjsTLB::SelectEntry( const String& rName ) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir sal_Bool bFound = sal_False; 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir if( rName.Len() ) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir SvLBoxEntry* pEntry = NULL; 347*cdf0e10cSrcweir String aTmp; 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) ) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir aTmp = GetEntryText( pEntry ); 352*cdf0e10cSrcweir if( aTmp == rName ) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir bFound = sal_True; 355*cdf0e10cSrcweir SetCurEntry( pEntry ); 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir return( bFound ); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir /************************************************************************* 363*cdf0e10cSrcweir |* 364*cdf0e10cSrcweir |* Gibt zurueck, ob Childs des uebergebenen Strings selektiert sind 365*cdf0e10cSrcweir |* 366*cdf0e10cSrcweir \************************************************************************/ 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir sal_Bool SdPageObjsTLB::HasSelectedChilds( const String& rName ) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir sal_Bool bFound = sal_False; 371*cdf0e10cSrcweir sal_Bool bChilds = sal_False; 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir if( rName.Len() ) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir SvLBoxEntry* pEntry = NULL; 376*cdf0e10cSrcweir String aTmp; 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) ) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir aTmp = GetEntryText( pEntry ); 381*cdf0e10cSrcweir if( aTmp == rName ) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir bFound = sal_True; 384*cdf0e10cSrcweir sal_Bool bExpanded = IsExpanded( pEntry ); 385*cdf0e10cSrcweir long nCount = GetChildSelectionCount( pEntry ); 386*cdf0e10cSrcweir if( bExpanded && nCount > 0 ) 387*cdf0e10cSrcweir bChilds = sal_True; 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir return( bChilds ); 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir /************************************************************************* 396*cdf0e10cSrcweir |* 397*cdf0e10cSrcweir |* TreeLB mit Seiten und Objekten fuellen 398*cdf0e10cSrcweir |* 399*cdf0e10cSrcweir \************************************************************************/ 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, sal_Bool bAllPages, 402*cdf0e10cSrcweir const String& rDocName) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir String aSelection; 405*cdf0e10cSrcweir if( GetSelectionCount() > 0 ) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir aSelection = GetSelectEntry(); 408*cdf0e10cSrcweir Clear(); 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir mpDoc = pInDoc; 412*cdf0e10cSrcweir maDocName = rDocName; 413*cdf0e10cSrcweir mbShowAllPages = (bAllPages == sal_True); 414*cdf0e10cSrcweir mpMedium = NULL; 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir SdPage* pPage = NULL; 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir IconProvider aIconProvider; 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir // first insert all pages including objects 421*cdf0e10cSrcweir sal_uInt16 nPage = 0; 422*cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpDoc->GetPageCount(); 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir while( nPage < nMaxPages ) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir pPage = (SdPage*) mpDoc->GetPage( nPage ); 427*cdf0e10cSrcweir if( (mbShowAllPages || pPage->GetPageKind() == PK_STANDARD) 428*cdf0e10cSrcweir && !(pPage->GetPageKind()==PK_HANDOUT) ) //#94954# never list the normal handout page ( handout-masterpage is used instead ) 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir sal_Bool bPageExluded = pPage->IsExcluded(); 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir bool bPageBelongsToShow = PageBelongsToCurrentShow (pPage); 433*cdf0e10cSrcweir bPageExluded |= !bPageBelongsToShow; 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir AddShapeList(*pPage, NULL, pPage->GetName(), bPageExluded, NULL, aIconProvider); 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir nPage++; 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir // dann alle MasterPages incl. Objekte einfuegen 441*cdf0e10cSrcweir if( mbShowAllPages ) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir nPage = 0; 444*cdf0e10cSrcweir const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount(); 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir while( nPage < nMaxMasterPages ) 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir pPage = (SdPage*) mpDoc->GetMasterPage( nPage ); 449*cdf0e10cSrcweir AddShapeList(*pPage, NULL, pPage->GetName(), false, NULL, aIconProvider); 450*cdf0e10cSrcweir nPage++; 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir if( aSelection.Len() ) 454*cdf0e10cSrcweir SelectEntry( aSelection ); 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir /************************************************************************* 458*cdf0e10cSrcweir |* 459*cdf0e10cSrcweir |* Es wird nur der erste Eintrag eingefuegt. Childs werden OnDemand erzeugt 460*cdf0e10cSrcweir |* 461*cdf0e10cSrcweir \************************************************************************/ 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium, 464*cdf0e10cSrcweir const String& rDocName ) 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir mpDoc = pInDoc; 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir // this object now owns the Medium 469*cdf0e10cSrcweir mpMedium = pInMedium; 470*cdf0e10cSrcweir maDocName = rDocName; 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir Image aImgDocOpen=Image( BitmapEx( SdResId( BMP_DOC_OPEN ) ) ); 473*cdf0e10cSrcweir Image aImgDocClosed=Image( BitmapEx( SdResId( BMP_DOC_CLOSED ) ) ); 474*cdf0e10cSrcweir Image aImgDocOpenH=Image( BitmapEx( SdResId( BMP_DOC_OPEN_H ) ) ); 475*cdf0e10cSrcweir Image aImgDocClosedH=Image( BitmapEx( SdResId( BMP_DOC_CLOSED_H ) ) ); 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir // Dokumentnamen einfuegen 478*cdf0e10cSrcweir SvLBoxEntry* pFileEntry = InsertEntry( maDocName, 479*cdf0e10cSrcweir aImgDocOpen, 480*cdf0e10cSrcweir aImgDocClosed, 481*cdf0e10cSrcweir NULL, 482*cdf0e10cSrcweir sal_True, 483*cdf0e10cSrcweir LIST_APPEND, 484*cdf0e10cSrcweir reinterpret_cast< void* >( 1 ) ); 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir SetExpandedEntryBmp( pFileEntry, aImgDocOpenH, BMP_COLOR_HIGHCONTRAST ); 487*cdf0e10cSrcweir SetCollapsedEntryBmp( pFileEntry, aImgDocClosedH, BMP_COLOR_HIGHCONTRAST ); 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir void SdPageObjsTLB::AddShapeList ( 494*cdf0e10cSrcweir const SdrObjList& rList, 495*cdf0e10cSrcweir SdrObject* pShape, 496*cdf0e10cSrcweir const ::rtl::OUString& rsName, 497*cdf0e10cSrcweir const bool bIsExcluded, 498*cdf0e10cSrcweir SvLBoxEntry* pParentEntry, 499*cdf0e10cSrcweir const IconProvider& rIconProvider) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir Image aIcon (rIconProvider.maImgPage); 502*cdf0e10cSrcweir if (bIsExcluded) 503*cdf0e10cSrcweir aIcon = rIconProvider.maImgPageExcl; 504*cdf0e10cSrcweir else if (pShape != NULL) 505*cdf0e10cSrcweir aIcon = rIconProvider.maImgGroup; 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir void* pUserData (reinterpret_cast<void*>(1)); 508*cdf0e10cSrcweir if (pShape != NULL) 509*cdf0e10cSrcweir pUserData = pShape; 510*cdf0e10cSrcweir 511*cdf0e10cSrcweir SvLBoxEntry* pEntry = InsertEntry( 512*cdf0e10cSrcweir rsName, 513*cdf0e10cSrcweir aIcon, 514*cdf0e10cSrcweir aIcon, 515*cdf0e10cSrcweir pParentEntry, 516*cdf0e10cSrcweir sal_False, 517*cdf0e10cSrcweir LIST_APPEND, 518*cdf0e10cSrcweir pUserData); 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir SetExpandedEntryBmp( 521*cdf0e10cSrcweir pEntry, 522*cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageExclH : rIconProvider.maImgPageH, 523*cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST ); 524*cdf0e10cSrcweir SetCollapsedEntryBmp( 525*cdf0e10cSrcweir pEntry, 526*cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageExclH : rIconProvider.maImgPageH, 527*cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST ); 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir SdrObjListIter aIter( 530*cdf0e10cSrcweir rList, 531*cdf0e10cSrcweir !rList.HasObjectNavigationOrder() /* use navigation order, if available */, 532*cdf0e10cSrcweir IM_FLAT, 533*cdf0e10cSrcweir sal_False /*not reverse*/); 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir while( aIter.IsMore() ) 536*cdf0e10cSrcweir { 537*cdf0e10cSrcweir SdrObject* pObj = aIter.Next(); 538*cdf0e10cSrcweir OSL_ASSERT(pObj!=NULL); 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir // Get the shape name. 541*cdf0e10cSrcweir String aStr (GetObjectName( pObj ) ); 542*cdf0e10cSrcweir 543*cdf0e10cSrcweir if( aStr.Len() ) 544*cdf0e10cSrcweir { 545*cdf0e10cSrcweir if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 ) 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgOle, maImgOle, pEntry, 548*cdf0e10cSrcweir sal_False, LIST_APPEND, pObj); 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST ); 551*cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST ); 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF ) 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgGraphic, maImgGraphic, pEntry, 556*cdf0e10cSrcweir sal_False, LIST_APPEND, pObj ); 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST ); 559*cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST ); 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir else if (pObj->IsGroupObject()) 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir AddShapeList( 564*cdf0e10cSrcweir *pObj->GetSubList(), 565*cdf0e10cSrcweir pObj, 566*cdf0e10cSrcweir aStr, 567*cdf0e10cSrcweir false, 568*cdf0e10cSrcweir pEntry, 569*cdf0e10cSrcweir rIconProvider); 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir else 572*cdf0e10cSrcweir { 573*cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry( aStr, rIconProvider.maImgObjects, rIconProvider.maImgObjects, pEntry, 574*cdf0e10cSrcweir sal_False, LIST_APPEND, pObj ); 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST ); 577*cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST ); 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir if( pEntry->HasChilds() ) 583*cdf0e10cSrcweir { 584*cdf0e10cSrcweir SetExpandedEntryBmp( 585*cdf0e10cSrcweir pEntry, 586*cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs); 587*cdf0e10cSrcweir SetCollapsedEntryBmp( 588*cdf0e10cSrcweir pEntry, 589*cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs); 590*cdf0e10cSrcweir SetExpandedEntryBmp( 591*cdf0e10cSrcweir pEntry, 592*cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH, 593*cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST); 594*cdf0e10cSrcweir SetCollapsedEntryBmp( 595*cdf0e10cSrcweir pEntry, 596*cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH, 597*cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST); 598*cdf0e10cSrcweir } 599*cdf0e10cSrcweir } 600*cdf0e10cSrcweir 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir void SdPageObjsTLB::SetShowAllShapes ( 605*cdf0e10cSrcweir const bool bShowAllShapes, 606*cdf0e10cSrcweir const bool bFillList) 607*cdf0e10cSrcweir { 608*cdf0e10cSrcweir mbShowAllShapes = bShowAllShapes; 609*cdf0e10cSrcweir if (bFillList) 610*cdf0e10cSrcweir { 611*cdf0e10cSrcweir if (mpMedium == NULL) 612*cdf0e10cSrcweir Fill(mpDoc, mbShowAllPages, maDocName); 613*cdf0e10cSrcweir else 614*cdf0e10cSrcweir Fill(mpDoc, mpMedium, maDocName); 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir bool SdPageObjsTLB::GetShowAllShapes (void) const 622*cdf0e10cSrcweir { 623*cdf0e10cSrcweir return mbShowAllShapes; 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir /************************************************************************* 630*cdf0e10cSrcweir |* 631*cdf0e10cSrcweir |* Prueft, ob die Seiten (PK_STANDARD) und die darauf befindlichen Objekte 632*cdf0e10cSrcweir |* des Docs und der TreeLB identisch sind. 633*cdf0e10cSrcweir |* Wird ein Doc uebergeben, wird dieses zum aktuellem Doc (Wichtig bei 634*cdf0e10cSrcweir |* mehreren Documenten). 635*cdf0e10cSrcweir |* 636*cdf0e10cSrcweir \************************************************************************/ 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir sal_Bool SdPageObjsTLB::IsEqualToDoc( const SdDrawDocument* pInDoc ) 639*cdf0e10cSrcweir { 640*cdf0e10cSrcweir if( pInDoc ) 641*cdf0e10cSrcweir mpDoc = pInDoc; 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir if( !mpDoc ) 644*cdf0e10cSrcweir return( sal_False ); 645*cdf0e10cSrcweir 646*cdf0e10cSrcweir SdrObject* pObj = NULL; 647*cdf0e10cSrcweir SdPage* pPage = NULL; 648*cdf0e10cSrcweir SvLBoxEntry* pEntry = First(); 649*cdf0e10cSrcweir String aName; 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir // Alle Pages incl. Objekte vergleichen 652*cdf0e10cSrcweir sal_uInt16 nPage = 0; 653*cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpDoc->GetPageCount(); 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir while( nPage < nMaxPages ) 656*cdf0e10cSrcweir { 657*cdf0e10cSrcweir pPage = (SdPage*) mpDoc->GetPage( nPage ); 658*cdf0e10cSrcweir if( pPage->GetPageKind() == PK_STANDARD ) 659*cdf0e10cSrcweir { 660*cdf0e10cSrcweir if( !pEntry ) 661*cdf0e10cSrcweir return( sal_False ); 662*cdf0e10cSrcweir aName = GetEntryText( pEntry ); 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir if( pPage->GetName() != aName ) 665*cdf0e10cSrcweir return( sal_False ); 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir pEntry = Next( pEntry ); 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir SdrObjListIter aIter( 670*cdf0e10cSrcweir *pPage, 671*cdf0e10cSrcweir !pPage->HasObjectNavigationOrder() /* use navigation order, if available */, 672*cdf0e10cSrcweir IM_DEEPWITHGROUPS ); 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir while( aIter.IsMore() ) 675*cdf0e10cSrcweir { 676*cdf0e10cSrcweir pObj = aIter.Next(); 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir const String aObjectName( GetObjectName( pObj ) ); 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir if( aObjectName.Len() ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir if( !pEntry ) 683*cdf0e10cSrcweir return( sal_False ); 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir aName = GetEntryText( pEntry ); 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir if( aObjectName != aName ) 688*cdf0e10cSrcweir return( sal_False ); 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir pEntry = Next( pEntry ); 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir } 694*cdf0e10cSrcweir nPage++; 695*cdf0e10cSrcweir } 696*cdf0e10cSrcweir // Wenn noch Eintraege in der Listbox vorhanden sind, wurden 697*cdf0e10cSrcweir // Objekte (mit Namen) oder Seiten geloescht 698*cdf0e10cSrcweir return( !pEntry ); 699*cdf0e10cSrcweir } 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir /************************************************************************* 702*cdf0e10cSrcweir |* 703*cdf0e10cSrcweir |* Selectierten String zurueckgeben 704*cdf0e10cSrcweir |* 705*cdf0e10cSrcweir \************************************************************************/ 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir String SdPageObjsTLB::GetSelectEntry() 708*cdf0e10cSrcweir { 709*cdf0e10cSrcweir return( GetEntryText( GetCurEntry() ) ); 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir /************************************************************************* 713*cdf0e10cSrcweir |* 714*cdf0e10cSrcweir |* Selektierte Eintrage zurueckgeben 715*cdf0e10cSrcweir |* nDepth == 0 -> Seiten 716*cdf0e10cSrcweir |* nDepth == 1 -> Objekte 717*cdf0e10cSrcweir |* 718*cdf0e10cSrcweir \************************************************************************/ 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir List* SdPageObjsTLB::GetSelectEntryList( sal_uInt16 nDepth ) 721*cdf0e10cSrcweir { 722*cdf0e10cSrcweir List* pList = NULL; 723*cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstSelected(); 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir while( pEntry ) 726*cdf0e10cSrcweir { 727*cdf0e10cSrcweir sal_uInt16 nListDepth = GetModel()->GetDepth( pEntry ); 728*cdf0e10cSrcweir if( nListDepth == nDepth ) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir if( !pList ) 731*cdf0e10cSrcweir pList = new List(); 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir const String aEntryText( GetEntryText( pEntry ) ); 734*cdf0e10cSrcweir pList->Insert( new String( aEntryText ), LIST_APPEND ); 735*cdf0e10cSrcweir } 736*cdf0e10cSrcweir pEntry = NextSelected( pEntry ); 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir 739*cdf0e10cSrcweir return( pList ); 740*cdf0e10cSrcweir } 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir /************************************************************************* 743*cdf0e10cSrcweir |* 744*cdf0e10cSrcweir |* Eintraege werden erst auf Anforderung (Doppelklick) eingefuegt 745*cdf0e10cSrcweir |* 746*cdf0e10cSrcweir \************************************************************************/ 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir void SdPageObjsTLB::RequestingChilds( SvLBoxEntry* pFileEntry ) 749*cdf0e10cSrcweir { 750*cdf0e10cSrcweir if( !pFileEntry->HasChilds() ) 751*cdf0e10cSrcweir { 752*cdf0e10cSrcweir if( GetBookmarkDoc() ) 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir SdrObject* pObj = NULL; 755*cdf0e10cSrcweir SdPage* pPage = NULL; 756*cdf0e10cSrcweir SvLBoxEntry* pPageEntry = NULL; 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir Image aImgPage=Image( BitmapEx( SdResId( BMP_PAGE ) ) ); 759*cdf0e10cSrcweir Image aImgPageObjs=Image( BitmapEx( SdResId( BMP_PAGEOBJS ) ) ); 760*cdf0e10cSrcweir Image aImgObjects=Image( BitmapEx( SdResId( BMP_OBJECTS ) ) ); 761*cdf0e10cSrcweir Image aImgPageH=Image( BitmapEx( SdResId( BMP_PAGE_H ) ) ); 762*cdf0e10cSrcweir Image aImgPageObjsH=Image( BitmapEx( SdResId( BMP_PAGEOBJS_H ) ) ); 763*cdf0e10cSrcweir Image aImgObjectsH=Image( BitmapEx( SdResId( BMP_OBJECTS_H ) ) ); 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir // document name already inserted 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir // only insert all "normal" ? slides with objects 768*cdf0e10cSrcweir sal_uInt16 nPage = 0; 769*cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpBookmarkDoc->GetPageCount(); 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir while( nPage < nMaxPages ) 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir pPage = (SdPage*) mpBookmarkDoc->GetPage( nPage ); 774*cdf0e10cSrcweir if( pPage->GetPageKind() == PK_STANDARD ) 775*cdf0e10cSrcweir { 776*cdf0e10cSrcweir pPageEntry = InsertEntry( pPage->GetName(), 777*cdf0e10cSrcweir aImgPage, 778*cdf0e10cSrcweir aImgPage, 779*cdf0e10cSrcweir pFileEntry, 780*cdf0e10cSrcweir sal_False, 781*cdf0e10cSrcweir LIST_APPEND, 782*cdf0e10cSrcweir reinterpret_cast< void* >( 1 ) ); 783*cdf0e10cSrcweir 784*cdf0e10cSrcweir SetExpandedEntryBmp( pPageEntry, aImgPageH, BMP_COLOR_HIGHCONTRAST ); 785*cdf0e10cSrcweir SetCollapsedEntryBmp( pPageEntry, aImgPageH, BMP_COLOR_HIGHCONTRAST ); 786*cdf0e10cSrcweir 787*cdf0e10cSrcweir SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS ); 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir while( aIter.IsMore() ) 790*cdf0e10cSrcweir { 791*cdf0e10cSrcweir pObj = aIter.Next(); 792*cdf0e10cSrcweir String aStr( GetObjectName( pObj ) ); 793*cdf0e10cSrcweir if( aStr.Len() ) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 ) 796*cdf0e10cSrcweir { 797*cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry(aStr, maImgOle, maImgOle, pPageEntry); 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST ); 801*cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST ); 802*cdf0e10cSrcweir } 803*cdf0e10cSrcweir else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF ) 804*cdf0e10cSrcweir { 805*cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry(aStr, maImgGraphic, maImgGraphic, pPageEntry); 806*cdf0e10cSrcweir 807*cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST ); 808*cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST ); 809*cdf0e10cSrcweir } 810*cdf0e10cSrcweir else 811*cdf0e10cSrcweir { 812*cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry(aStr, aImgObjects, aImgObjects, pPageEntry); 813*cdf0e10cSrcweir 814*cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, aImgObjectsH, BMP_COLOR_HIGHCONTRAST ); 815*cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, aImgObjectsH, BMP_COLOR_HIGHCONTRAST ); 816*cdf0e10cSrcweir } 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir } 819*cdf0e10cSrcweir if( pPageEntry->HasChilds() ) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir SetExpandedEntryBmp( pPageEntry, aImgPageObjs ); 822*cdf0e10cSrcweir SetCollapsedEntryBmp( pPageEntry, aImgPageObjs ); 823*cdf0e10cSrcweir SetExpandedEntryBmp( pPageEntry, aImgPageObjsH, BMP_COLOR_HIGHCONTRAST ); 824*cdf0e10cSrcweir SetCollapsedEntryBmp( pPageEntry, aImgPageObjsH, BMP_COLOR_HIGHCONTRAST ); 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir } 827*cdf0e10cSrcweir nPage++; 828*cdf0e10cSrcweir } 829*cdf0e10cSrcweir } 830*cdf0e10cSrcweir } 831*cdf0e10cSrcweir else 832*cdf0e10cSrcweir SvTreeListBox::RequestingChilds( pFileEntry ); 833*cdf0e10cSrcweir } 834*cdf0e10cSrcweir 835*cdf0e10cSrcweir /************************************************************************* 836*cdf0e10cSrcweir |* 837*cdf0e10cSrcweir |* Prueft, ob es sich um eine Draw-Datei handelt und oeffnet anhand des 838*cdf0e10cSrcweir |* uebergebenen Docs das BookmarkDoc 839*cdf0e10cSrcweir |* 840*cdf0e10cSrcweir \************************************************************************/ 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed) 843*cdf0e10cSrcweir { 844*cdf0e10cSrcweir if ( 845*cdf0e10cSrcweir !mpBookmarkDoc || 846*cdf0e10cSrcweir (pMed && (!mpOwnMedium || mpOwnMedium->GetName() != pMed->GetName())) 847*cdf0e10cSrcweir ) 848*cdf0e10cSrcweir { 849*cdf0e10cSrcweir // create a new BookmarkDoc if now one exists or if a new Medium is provided 850*cdf0e10cSrcweir if (mpOwnMedium != pMed) 851*cdf0e10cSrcweir { 852*cdf0e10cSrcweir CloseBookmarkDoc(); 853*cdf0e10cSrcweir } 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir if (pMed) 856*cdf0e10cSrcweir { 857*cdf0e10cSrcweir // it looks that it is undefined if a Medium was set by Fill() allready 858*cdf0e10cSrcweir DBG_ASSERT( !mpMedium, "SfxMedium confusion!" ); 859*cdf0e10cSrcweir delete mpMedium; 860*cdf0e10cSrcweir mpMedium = NULL; 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir // take over this Medium (currently used only be Navigator) 863*cdf0e10cSrcweir mpOwnMedium = pMed; 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir DBG_ASSERT( mpMedium || pMed, "No SfxMedium provided!" ); 867*cdf0e10cSrcweir 868*cdf0e10cSrcweir if( pMed ) 869*cdf0e10cSrcweir { 870*cdf0e10cSrcweir // in this mode the document is also owned and controlled by this instance 871*cdf0e10cSrcweir mxBookmarkDocShRef = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_True); 872*cdf0e10cSrcweir if (mxBookmarkDocShRef->DoLoad(pMed)) 873*cdf0e10cSrcweir mpBookmarkDoc = mxBookmarkDocShRef->GetDoc(); 874*cdf0e10cSrcweir else 875*cdf0e10cSrcweir mpBookmarkDoc = NULL; 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir else if ( mpMedium ) 878*cdf0e10cSrcweir // in this mode the document is owned and controlled by the SdDrawDocument 879*cdf0e10cSrcweir // it can be released by calling the corresponding CloseBookmarkDoc method 880*cdf0e10cSrcweir // successfull creation of a document makes this the owner of the medium 881*cdf0e10cSrcweir mpBookmarkDoc = ((SdDrawDocument*) mpDoc)->OpenBookmarkDoc(*mpMedium); 882*cdf0e10cSrcweir 883*cdf0e10cSrcweir if ( !mpBookmarkDoc ) 884*cdf0e10cSrcweir { 885*cdf0e10cSrcweir ErrorBox aErrorBox( this, WB_OK, String( SdResId( STR_READ_DATA_ERROR ) ) ); 886*cdf0e10cSrcweir aErrorBox.Execute(); 887*cdf0e10cSrcweir mpMedium = 0; //On failure the SfxMedium is invalid 888*cdf0e10cSrcweir } 889*cdf0e10cSrcweir } 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir return( mpBookmarkDoc ); 892*cdf0e10cSrcweir } 893*cdf0e10cSrcweir 894*cdf0e10cSrcweir /************************************************************************* 895*cdf0e10cSrcweir |* 896*cdf0e10cSrcweir |* Bookmark-Dokument schlie�en und loeschen 897*cdf0e10cSrcweir |* 898*cdf0e10cSrcweir \************************************************************************/ 899*cdf0e10cSrcweir 900*cdf0e10cSrcweir void SdPageObjsTLB::CloseBookmarkDoc() 901*cdf0e10cSrcweir { 902*cdf0e10cSrcweir if (mxBookmarkDocShRef.Is()) 903*cdf0e10cSrcweir { 904*cdf0e10cSrcweir mxBookmarkDocShRef->DoClose(); 905*cdf0e10cSrcweir mxBookmarkDocShRef.Clear(); 906*cdf0e10cSrcweir 907*cdf0e10cSrcweir // Medium is owned by document, so it's destroyed already 908*cdf0e10cSrcweir mpOwnMedium = 0; 909*cdf0e10cSrcweir } 910*cdf0e10cSrcweir else if ( mpBookmarkDoc ) 911*cdf0e10cSrcweir { 912*cdf0e10cSrcweir DBG_ASSERT( !mpOwnMedium, "SfxMedium confusion!" ); 913*cdf0e10cSrcweir if ( mpDoc ) 914*cdf0e10cSrcweir { 915*cdf0e10cSrcweir // The document owns the Medium, so the Medium will be invalid after closing the document 916*cdf0e10cSrcweir ((SdDrawDocument*) mpDoc)->CloseBookmarkDoc(); 917*cdf0e10cSrcweir mpMedium = 0; 918*cdf0e10cSrcweir } 919*cdf0e10cSrcweir } 920*cdf0e10cSrcweir else 921*cdf0e10cSrcweir { 922*cdf0e10cSrcweir // perhaps mpOwnMedium provided, but no successfull creation of BookmarkDoc 923*cdf0e10cSrcweir delete mpOwnMedium; 924*cdf0e10cSrcweir mpOwnMedium = NULL; 925*cdf0e10cSrcweir } 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir mpBookmarkDoc = NULL; 928*cdf0e10cSrcweir } 929*cdf0e10cSrcweir 930*cdf0e10cSrcweir /************************************************************************* 931*cdf0e10cSrcweir |* 932*cdf0e10cSrcweir |* 933*cdf0e10cSrcweir |* 934*cdf0e10cSrcweir \************************************************************************/ 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir void SdPageObjsTLB::SelectHdl() 937*cdf0e10cSrcweir { 938*cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstSelected(); 939*cdf0e10cSrcweir 940*cdf0e10cSrcweir mbLinkableSelected = sal_True; 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir while( pEntry && mbLinkableSelected ) 943*cdf0e10cSrcweir { 944*cdf0e10cSrcweir if( NULL == pEntry->GetUserData() ) 945*cdf0e10cSrcweir mbLinkableSelected = sal_False; 946*cdf0e10cSrcweir 947*cdf0e10cSrcweir pEntry = NextSelected( pEntry ); 948*cdf0e10cSrcweir } 949*cdf0e10cSrcweir 950*cdf0e10cSrcweir SvTreeListBox::SelectHdl(); 951*cdf0e10cSrcweir } 952*cdf0e10cSrcweir 953*cdf0e10cSrcweir /************************************************************************* 954*cdf0e10cSrcweir |* 955*cdf0e10cSrcweir |* Ueberlaedt RETURN mit der Funktionsweise von DoubleClick 956*cdf0e10cSrcweir |* 957*cdf0e10cSrcweir \************************************************************************/ 958*cdf0e10cSrcweir 959*cdf0e10cSrcweir void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt ) 960*cdf0e10cSrcweir { 961*cdf0e10cSrcweir if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN ) 962*cdf0e10cSrcweir { 963*cdf0e10cSrcweir // Auskommentierter Code aus svtools/source/contnr/svimpbox.cxx 964*cdf0e10cSrcweir SvLBoxEntry* pCursor = GetCurEntry(); 965*cdf0e10cSrcweir if( pCursor->HasChilds() || pCursor->HasChildsOnDemand() ) 966*cdf0e10cSrcweir { 967*cdf0e10cSrcweir if( IsExpanded( pCursor ) ) 968*cdf0e10cSrcweir Collapse( pCursor ); 969*cdf0e10cSrcweir else 970*cdf0e10cSrcweir Expand( pCursor ); 971*cdf0e10cSrcweir } 972*cdf0e10cSrcweir 973*cdf0e10cSrcweir DoubleClickHdl(); 974*cdf0e10cSrcweir } 975*cdf0e10cSrcweir else 976*cdf0e10cSrcweir SvTreeListBox::KeyInput( rKEvt ); 977*cdf0e10cSrcweir } 978*cdf0e10cSrcweir 979*cdf0e10cSrcweir /************************************************************************* 980*cdf0e10cSrcweir |* 981*cdf0e10cSrcweir |* StartDrag-Request 982*cdf0e10cSrcweir |* 983*cdf0e10cSrcweir \************************************************************************/ 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir void SdPageObjsTLB::StartDrag( sal_Int8 nAction, const Point& rPosPixel) 986*cdf0e10cSrcweir { 987*cdf0e10cSrcweir (void)nAction; 988*cdf0e10cSrcweir (void)rPosPixel; 989*cdf0e10cSrcweir 990*cdf0e10cSrcweir SdNavigatorWin* pNavWin = NULL; 991*cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry(rPosPixel); 992*cdf0e10cSrcweir 993*cdf0e10cSrcweir if( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) 994*cdf0e10cSrcweir pNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ); 995*cdf0e10cSrcweir 996*cdf0e10cSrcweir if (pEntry != NULL 997*cdf0e10cSrcweir && pNavWin !=NULL 998*cdf0e10cSrcweir && pNavWin == mpParent 999*cdf0e10cSrcweir && pNavWin->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE ) 1000*cdf0e10cSrcweir { 1001*cdf0e10cSrcweir // Mark only the children of the page under the mouse as drop 1002*cdf0e10cSrcweir // targets. This prevents moving shapes from one page to another. 1003*cdf0e10cSrcweir 1004*cdf0e10cSrcweir // Select all entries and disable them as drop targets. 1005*cdf0e10cSrcweir SetSelectionMode(MULTIPLE_SELECTION); 1006*cdf0e10cSrcweir SetCursor(NULL, sal_False); 1007*cdf0e10cSrcweir SelectAll(sal_True, sal_False); 1008*cdf0e10cSrcweir EnableSelectionAsDropTarget(sal_False, sal_True); 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir // Enable only the entries as drop targets that are children of the 1011*cdf0e10cSrcweir // page under the mouse. 1012*cdf0e10cSrcweir SvLBoxEntry* pParent = GetRootLevelParent(pEntry); 1013*cdf0e10cSrcweir if (pParent != NULL) 1014*cdf0e10cSrcweir { 1015*cdf0e10cSrcweir SelectAll(sal_False, sal_False); 1016*cdf0e10cSrcweir Select(pParent, sal_True); 1017*cdf0e10cSrcweir // for (SvLBoxEntry*pChild=FirstChild(pParent); pChild!=NULL; pChild=NextSibling(pChild)) 1018*cdf0e10cSrcweir // Select(pChild, sal_True); 1019*cdf0e10cSrcweir EnableSelectionAsDropTarget(sal_True, sal_True);//sal_False); 1020*cdf0e10cSrcweir } 1021*cdf0e10cSrcweir 1022*cdf0e10cSrcweir // Set selection back to the entry under the mouse. 1023*cdf0e10cSrcweir SelectAll(sal_False,sal_False); 1024*cdf0e10cSrcweir SetSelectionMode(SINGLE_SELECTION); 1025*cdf0e10cSrcweir Select(pEntry, sal_True); 1026*cdf0e10cSrcweir 1027*cdf0e10cSrcweir // Aus dem ExecuteDrag heraus kann der Navigator geloescht werden 1028*cdf0e10cSrcweir // (beim Umschalten auf einen anderen Dokument-Typ), das wuerde aber 1029*cdf0e10cSrcweir // den StarView MouseMove-Handler, der Command() aufruft, umbringen. 1030*cdf0e10cSrcweir // Deshalb Drag&Drop asynchron: 1031*cdf0e10cSrcweir Application::PostUserEvent( STATIC_LINK( this, SdPageObjsTLB, ExecDragHdl ) ); 1032*cdf0e10cSrcweir } 1033*cdf0e10cSrcweir } 1034*cdf0e10cSrcweir 1035*cdf0e10cSrcweir /************************************************************************* 1036*cdf0e10cSrcweir |* 1037*cdf0e10cSrcweir |* Begin drag 1038*cdf0e10cSrcweir |* 1039*cdf0e10cSrcweir \************************************************************************/ 1040*cdf0e10cSrcweir 1041*cdf0e10cSrcweir void SdPageObjsTLB::DoDrag() 1042*cdf0e10cSrcweir { 1043*cdf0e10cSrcweir mpDropNavWin = ( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) ? 1044*cdf0e10cSrcweir (SdNavigatorWin*)( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ) : 1045*cdf0e10cSrcweir NULL; 1046*cdf0e10cSrcweir 1047*cdf0e10cSrcweir if( mpDropNavWin ) 1048*cdf0e10cSrcweir { 1049*cdf0e10cSrcweir ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh(); 1050*cdf0e10cSrcweir String aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INET_PROT_FILE ).GetMainURL( INetURLObject::NO_DECODE ); 1051*cdf0e10cSrcweir NavigatorDragType eDragType = mpDropNavWin->GetNavigatorDragType(); 1052*cdf0e10cSrcweir 1053*cdf0e10cSrcweir aURL.Append( '#' ); 1054*cdf0e10cSrcweir aURL.Append( GetSelectEntry() ); 1055*cdf0e10cSrcweir 1056*cdf0e10cSrcweir INetBookmark aBookmark( aURL, GetSelectEntry() ); 1057*cdf0e10cSrcweir sal_Int8 nDNDActions = DND_ACTION_COPYMOVE; 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir if( eDragType == NAVIGATOR_DRAGTYPE_LINK ) 1060*cdf0e10cSrcweir nDNDActions = DND_ACTION_LINK; // #93240# Either COPY *or* LINK, never both! 1061*cdf0e10cSrcweir else if (mpDoc->GetSdPageCount(PK_STANDARD) == 1) 1062*cdf0e10cSrcweir { 1063*cdf0e10cSrcweir // Can not move away the last slide in a document. 1064*cdf0e10cSrcweir nDNDActions = DND_ACTION_COPY; 1065*cdf0e10cSrcweir } 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir SvTreeListBox::ReleaseMouse(); 1068*cdf0e10cSrcweir 1069*cdf0e10cSrcweir bIsInDrag = sal_True; 1070*cdf0e10cSrcweir 1071*cdf0e10cSrcweir SvLBoxDDInfo aDDInfo; 1072*cdf0e10cSrcweir memset(&aDDInfo,0,sizeof(SvLBoxDDInfo)); 1073*cdf0e10cSrcweir aDDInfo.pApp = GetpApp(); 1074*cdf0e10cSrcweir aDDInfo.pSource = this; 1075*cdf0e10cSrcweir // aDDInfo.pDDStartEntry = pEntry; 1076*cdf0e10cSrcweir ::com::sun::star::uno::Sequence<sal_Int8> aSequence (sizeof(SvLBoxDDInfo)); 1077*cdf0e10cSrcweir memcpy(aSequence.getArray(), (sal_Char*)&aDDInfo, sizeof(SvLBoxDDInfo)); 1078*cdf0e10cSrcweir ::com::sun::star::uno::Any aTreeListBoxData (aSequence); 1079*cdf0e10cSrcweir 1080*cdf0e10cSrcweir // object is destroyed by internal reference mechanism 1081*cdf0e10cSrcweir SdTransferable* pTransferable = new SdPageObjsTLB::SdPageObjsTransferable( 1082*cdf0e10cSrcweir *this, aBookmark, *pDocShell, eDragType, aTreeListBoxData); 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir // Get the view. 1085*cdf0e10cSrcweir ::sd::ViewShell* pViewShell = GetViewShellForDocShell(*pDocShell); 1086*cdf0e10cSrcweir if (pViewShell == NULL) 1087*cdf0e10cSrcweir { 1088*cdf0e10cSrcweir OSL_ASSERT(pViewShell!=NULL); 1089*cdf0e10cSrcweir return; 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir sd::View* pView = pViewShell->GetView(); 1092*cdf0e10cSrcweir if (pView == NULL) 1093*cdf0e10cSrcweir { 1094*cdf0e10cSrcweir OSL_ASSERT(pView!=NULL); 1095*cdf0e10cSrcweir return; 1096*cdf0e10cSrcweir } 1097*cdf0e10cSrcweir 1098*cdf0e10cSrcweir SdrObject* pObject = NULL; 1099*cdf0e10cSrcweir void* pUserData = GetCurEntry()->GetUserData(); 1100*cdf0e10cSrcweir if (pUserData != NULL && pUserData != (void*)1) 1101*cdf0e10cSrcweir pObject = reinterpret_cast<SdrObject*>(pUserData); 1102*cdf0e10cSrcweir if (pObject != NULL) 1103*cdf0e10cSrcweir { 1104*cdf0e10cSrcweir // For shapes without a user supplied name (the automatically 1105*cdf0e10cSrcweir // created name does not count), a different drag and drop technique 1106*cdf0e10cSrcweir // is used. 1107*cdf0e10cSrcweir if (GetObjectName(pObject, false).Len() == 0) 1108*cdf0e10cSrcweir { 1109*cdf0e10cSrcweir AddShapeToTransferable(*pTransferable, *pObject); 1110*cdf0e10cSrcweir pTransferable->SetView(pView); 1111*cdf0e10cSrcweir SD_MOD()->pTransferDrag = pTransferable; 1112*cdf0e10cSrcweir } 1113*cdf0e10cSrcweir 1114*cdf0e10cSrcweir // Unnamed shapes have to be selected to be recognized by the 1115*cdf0e10cSrcweir // current drop implementation. In order to have a consistent 1116*cdf0e10cSrcweir // behaviour for all shapes, every shape that is to be dragged is 1117*cdf0e10cSrcweir // selected first. 1118*cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView(); 1119*cdf0e10cSrcweir pView->UnmarkAllObj(pPageView); 1120*cdf0e10cSrcweir pView->MarkObj(pObject, pPageView); 1121*cdf0e10cSrcweir } 1122*cdf0e10cSrcweir else 1123*cdf0e10cSrcweir { 1124*cdf0e10cSrcweir pTransferable->SetView(pView); 1125*cdf0e10cSrcweir SD_MOD()->pTransferDrag = pTransferable; 1126*cdf0e10cSrcweir } 1127*cdf0e10cSrcweir 1128*cdf0e10cSrcweir pTransferable->StartDrag( this, nDNDActions ); 1129*cdf0e10cSrcweir } 1130*cdf0e10cSrcweir } 1131*cdf0e10cSrcweir 1132*cdf0e10cSrcweir /************************************************************************* 1133*cdf0e10cSrcweir |* 1134*cdf0e10cSrcweir |* Drag finished 1135*cdf0e10cSrcweir |* 1136*cdf0e10cSrcweir \************************************************************************/ 1137*cdf0e10cSrcweir 1138*cdf0e10cSrcweir void SdPageObjsTLB::OnDragFinished( sal_uInt8 ) 1139*cdf0e10cSrcweir { 1140*cdf0e10cSrcweir if( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) 1141*cdf0e10cSrcweir { 1142*cdf0e10cSrcweir SdNavigatorWin* pNewNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ); 1143*cdf0e10cSrcweir 1144*cdf0e10cSrcweir if( mpDropNavWin == pNewNavWin) 1145*cdf0e10cSrcweir { 1146*cdf0e10cSrcweir MouseEvent aMEvt( mpDropNavWin->GetPointerPosPixel() ); 1147*cdf0e10cSrcweir SvTreeListBox::MouseButtonUp( aMEvt ); 1148*cdf0e10cSrcweir } 1149*cdf0e10cSrcweir } 1150*cdf0e10cSrcweir 1151*cdf0e10cSrcweir mpDropNavWin = NULL; 1152*cdf0e10cSrcweir bIsInDrag = sal_False; 1153*cdf0e10cSrcweir } 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir /************************************************************************* 1156*cdf0e10cSrcweir |* 1157*cdf0e10cSrcweir |* AcceptDrop-Event 1158*cdf0e10cSrcweir |* 1159*cdf0e10cSrcweir \************************************************************************/ 1160*cdf0e10cSrcweir 1161*cdf0e10cSrcweir sal_Int8 SdPageObjsTLB::AcceptDrop (const AcceptDropEvent& rEvent) 1162*cdf0e10cSrcweir { 1163*cdf0e10cSrcweir sal_Int8 nResult (DND_ACTION_NONE); 1164*cdf0e10cSrcweir 1165*cdf0e10cSrcweir if ( !bIsInDrag && IsDropFormatSupported( FORMAT_FILE ) ) 1166*cdf0e10cSrcweir { 1167*cdf0e10cSrcweir nResult = rEvent.mnAction; 1168*cdf0e10cSrcweir } 1169*cdf0e10cSrcweir else 1170*cdf0e10cSrcweir { 1171*cdf0e10cSrcweir SvLBoxEntry* pEntry = GetDropTarget(rEvent.maPosPixel); 1172*cdf0e10cSrcweir if (rEvent.mbLeaving || !CheckDragAndDropMode( this, rEvent.mnAction )) 1173*cdf0e10cSrcweir { 1174*cdf0e10cSrcweir ImplShowTargetEmphasis( pTargetEntry, sal_False ); 1175*cdf0e10cSrcweir } 1176*cdf0e10cSrcweir else if( !nDragDropMode ) 1177*cdf0e10cSrcweir { 1178*cdf0e10cSrcweir DBG_ERRORFILE( "SdPageObjsTLB::AcceptDrop(): no target" ); 1179*cdf0e10cSrcweir } 1180*cdf0e10cSrcweir else if (IsDropAllowed(pEntry)) 1181*cdf0e10cSrcweir { 1182*cdf0e10cSrcweir nResult = DND_ACTION_MOVE; 1183*cdf0e10cSrcweir 1184*cdf0e10cSrcweir // Draw emphasis. 1185*cdf0e10cSrcweir if (pEntry != pTargetEntry || !(nImpFlags & SVLBOX_TARGEMPH_VIS)) 1186*cdf0e10cSrcweir { 1187*cdf0e10cSrcweir ImplShowTargetEmphasis( pTargetEntry, sal_False ); 1188*cdf0e10cSrcweir pTargetEntry = pEntry; 1189*cdf0e10cSrcweir ImplShowTargetEmphasis( pTargetEntry, sal_True ); 1190*cdf0e10cSrcweir } 1191*cdf0e10cSrcweir } 1192*cdf0e10cSrcweir } 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir // Hide emphasis when there is no valid drop action. 1195*cdf0e10cSrcweir if (nResult == DND_ACTION_NONE) 1196*cdf0e10cSrcweir ImplShowTargetEmphasis(pTargetEntry, sal_False); 1197*cdf0e10cSrcweir 1198*cdf0e10cSrcweir return nResult; 1199*cdf0e10cSrcweir } 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir /************************************************************************* 1202*cdf0e10cSrcweir |* 1203*cdf0e10cSrcweir |* ExecuteDrop-Event 1204*cdf0e10cSrcweir |* 1205*cdf0e10cSrcweir \************************************************************************/ 1206*cdf0e10cSrcweir 1207*cdf0e10cSrcweir sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt ) 1208*cdf0e10cSrcweir { 1209*cdf0e10cSrcweir sal_Int8 nRet = DND_ACTION_NONE; 1210*cdf0e10cSrcweir 1211*cdf0e10cSrcweir try 1212*cdf0e10cSrcweir { 1213*cdf0e10cSrcweir if( !bIsInDrag ) 1214*cdf0e10cSrcweir { 1215*cdf0e10cSrcweir SdNavigatorWin* pNavWin = NULL; 1216*cdf0e10cSrcweir sal_uInt16 nId = SID_NAVIGATOR; 1217*cdf0e10cSrcweir 1218*cdf0e10cSrcweir if( mpFrame->HasChildWindow( nId ) ) 1219*cdf0e10cSrcweir pNavWin = (SdNavigatorWin*)( mpFrame->GetChildWindow( nId )->GetContextWindow( SD_MOD() ) ); 1220*cdf0e10cSrcweir 1221*cdf0e10cSrcweir if( pNavWin && ( pNavWin == mpParent ) ) 1222*cdf0e10cSrcweir { 1223*cdf0e10cSrcweir TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable ); 1224*cdf0e10cSrcweir String aFile; 1225*cdf0e10cSrcweir 1226*cdf0e10cSrcweir if( aDataHelper.GetString( FORMAT_FILE, aFile ) && 1227*cdf0e10cSrcweir ( (SdNavigatorWin*) mpParent)->InsertFile( aFile ) ) 1228*cdf0e10cSrcweir { 1229*cdf0e10cSrcweir nRet = rEvt.mnAction; 1230*cdf0e10cSrcweir } 1231*cdf0e10cSrcweir } 1232*cdf0e10cSrcweir } 1233*cdf0e10cSrcweir } 1234*cdf0e10cSrcweir catch (com::sun::star::uno::Exception&) 1235*cdf0e10cSrcweir { 1236*cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION(); 1237*cdf0e10cSrcweir } 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir if (nRet == DND_ACTION_NONE) 1240*cdf0e10cSrcweir SvTreeListBox::ExecuteDrop(rEvt, this); 1241*cdf0e10cSrcweir 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir return nRet; 1244*cdf0e10cSrcweir } 1245*cdf0e10cSrcweir 1246*cdf0e10cSrcweir /************************************************************************* 1247*cdf0e10cSrcweir |* 1248*cdf0e10cSrcweir |* Handler fuers Dragging 1249*cdf0e10cSrcweir |* 1250*cdf0e10cSrcweir \************************************************************************/ 1251*cdf0e10cSrcweir 1252*cdf0e10cSrcweir IMPL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*, EMPTYARG) 1253*cdf0e10cSrcweir { 1254*cdf0e10cSrcweir // als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch der 1255*cdf0e10cSrcweir // Navigator geloescht werden darf 1256*cdf0e10cSrcweir pThis->DoDrag(); 1257*cdf0e10cSrcweir return 0; 1258*cdf0e10cSrcweir } 1259*cdf0e10cSrcweir 1260*cdf0e10cSrcweir 1261*cdf0e10cSrcweir bool SdPageObjsTLB::PageBelongsToCurrentShow (const SdPage* pPage) const 1262*cdf0e10cSrcweir { 1263*cdf0e10cSrcweir // Return <TRUE/> as default when there is no custom show or when none 1264*cdf0e10cSrcweir // is used. The page does then belong to the standard show. 1265*cdf0e10cSrcweir bool bBelongsToShow = true; 1266*cdf0e10cSrcweir 1267*cdf0e10cSrcweir if (mpDoc->getPresentationSettings().mbCustomShow) 1268*cdf0e10cSrcweir { 1269*cdf0e10cSrcweir // Get the current custom show. 1270*cdf0e10cSrcweir SdCustomShow* pCustomShow = NULL; 1271*cdf0e10cSrcweir List* pShowList = const_cast<SdDrawDocument*>(mpDoc)->GetCustomShowList(); 1272*cdf0e10cSrcweir if (pShowList != NULL) 1273*cdf0e10cSrcweir { 1274*cdf0e10cSrcweir sal_uLong nCurrentShowIndex = pShowList->GetCurPos(); 1275*cdf0e10cSrcweir void* pObject = pShowList->GetObject(nCurrentShowIndex); 1276*cdf0e10cSrcweir pCustomShow = static_cast<SdCustomShow*>(pObject); 1277*cdf0e10cSrcweir } 1278*cdf0e10cSrcweir 1279*cdf0e10cSrcweir // Check whether the given page is part of that custom show. 1280*cdf0e10cSrcweir if (pCustomShow != NULL) 1281*cdf0e10cSrcweir { 1282*cdf0e10cSrcweir bBelongsToShow = false; 1283*cdf0e10cSrcweir sal_uLong nPageCount = pCustomShow->Count(); 1284*cdf0e10cSrcweir for (sal_uInt16 i=0; i<nPageCount && !bBelongsToShow; i++) 1285*cdf0e10cSrcweir if (pPage == static_cast<SdPage*>(pCustomShow->GetObject (i))) 1286*cdf0e10cSrcweir bBelongsToShow = true; 1287*cdf0e10cSrcweir } 1288*cdf0e10cSrcweir } 1289*cdf0e10cSrcweir 1290*cdf0e10cSrcweir return bBelongsToShow; 1291*cdf0e10cSrcweir } 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir 1294*cdf0e10cSrcweir 1295*cdf0e10cSrcweir 1296*cdf0e10cSrcweir sal_Bool SdPageObjsTLB::NotifyMoving( 1297*cdf0e10cSrcweir SvLBoxEntry* pTarget, 1298*cdf0e10cSrcweir SvLBoxEntry* pEntry, 1299*cdf0e10cSrcweir SvLBoxEntry*& rpNewParent, 1300*cdf0e10cSrcweir sal_uLong& rNewChildPos) 1301*cdf0e10cSrcweir { 1302*cdf0e10cSrcweir SvLBoxEntry* pDestination = pTarget; 1303*cdf0e10cSrcweir while (GetParent(pDestination) != NULL && GetParent(GetParent(pDestination)) != NULL) 1304*cdf0e10cSrcweir pDestination = GetParent(pDestination); 1305*cdf0e10cSrcweir 1306*cdf0e10cSrcweir SdrObject* pTargetObject = reinterpret_cast<SdrObject*>(pDestination->GetUserData()); 1307*cdf0e10cSrcweir SdrObject* pSourceObject = reinterpret_cast<SdrObject*>(pEntry->GetUserData()); 1308*cdf0e10cSrcweir if (pSourceObject == reinterpret_cast<SdrObject*>(1)) 1309*cdf0e10cSrcweir pSourceObject = NULL; 1310*cdf0e10cSrcweir 1311*cdf0e10cSrcweir if (pTargetObject != NULL && pSourceObject != NULL) 1312*cdf0e10cSrcweir { 1313*cdf0e10cSrcweir SdrPage* pObjectList = pSourceObject->GetPage(); 1314*cdf0e10cSrcweir if (pObjectList != NULL) 1315*cdf0e10cSrcweir { 1316*cdf0e10cSrcweir sal_uInt32 nNewPosition; 1317*cdf0e10cSrcweir if (pTargetObject == reinterpret_cast<SdrObject*>(1)) 1318*cdf0e10cSrcweir nNewPosition = 0; 1319*cdf0e10cSrcweir else 1320*cdf0e10cSrcweir nNewPosition = pTargetObject->GetNavigationPosition() + 1; 1321*cdf0e10cSrcweir pObjectList->SetObjectNavigationPosition(*pSourceObject, nNewPosition); 1322*cdf0e10cSrcweir } 1323*cdf0e10cSrcweir 1324*cdf0e10cSrcweir // Update the tree list. 1325*cdf0e10cSrcweir if (pTarget == NULL) 1326*cdf0e10cSrcweir { 1327*cdf0e10cSrcweir rpNewParent = 0; 1328*cdf0e10cSrcweir rNewChildPos = 0; 1329*cdf0e10cSrcweir return sal_True; 1330*cdf0e10cSrcweir } 1331*cdf0e10cSrcweir else if (GetParent(pDestination) == NULL) 1332*cdf0e10cSrcweir { 1333*cdf0e10cSrcweir rpNewParent = pDestination; 1334*cdf0e10cSrcweir rNewChildPos = 0; 1335*cdf0e10cSrcweir } 1336*cdf0e10cSrcweir else 1337*cdf0e10cSrcweir { 1338*cdf0e10cSrcweir rpNewParent = GetParent(pDestination); 1339*cdf0e10cSrcweir rNewChildPos = pModel->GetRelPos(pDestination) + 1; 1340*cdf0e10cSrcweir rNewChildPos += nCurEntrySelPos; 1341*cdf0e10cSrcweir nCurEntrySelPos++; 1342*cdf0e10cSrcweir } 1343*cdf0e10cSrcweir return sal_True; 1344*cdf0e10cSrcweir } 1345*cdf0e10cSrcweir else 1346*cdf0e10cSrcweir return sal_False; 1347*cdf0e10cSrcweir } 1348*cdf0e10cSrcweir 1349*cdf0e10cSrcweir 1350*cdf0e10cSrcweir 1351*cdf0e10cSrcweir 1352*cdf0e10cSrcweir SvLBoxEntry* SdPageObjsTLB::GetDropTarget (const Point& rLocation) 1353*cdf0e10cSrcweir { 1354*cdf0e10cSrcweir SvLBoxEntry* pEntry = SvTreeListBox::GetDropTarget(rLocation); 1355*cdf0e10cSrcweir if (pEntry == NULL) 1356*cdf0e10cSrcweir return NULL; 1357*cdf0e10cSrcweir 1358*cdf0e10cSrcweir if (GetParent(pEntry) == NULL) 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir // Use page entry as insertion position. 1361*cdf0e10cSrcweir } 1362*cdf0e10cSrcweir else 1363*cdf0e10cSrcweir { 1364*cdf0e10cSrcweir // Go to second hierarchy level, i.e. top level shapes, 1365*cdf0e10cSrcweir // i.e. children of pages. 1366*cdf0e10cSrcweir while (GetParent(pEntry) != NULL && GetParent(GetParent(pEntry)) != NULL) 1367*cdf0e10cSrcweir pEntry = GetParent(pEntry); 1368*cdf0e10cSrcweir 1369*cdf0e10cSrcweir // Advance to next sibling. 1370*cdf0e10cSrcweir SvLBoxEntry* pNext; 1371*cdf0e10cSrcweir sal_uInt16 nDepth (0); 1372*cdf0e10cSrcweir while (pEntry != NULL) 1373*cdf0e10cSrcweir { 1374*cdf0e10cSrcweir pNext = dynamic_cast<SvLBoxEntry*>(NextVisible(pEntry, &nDepth)); 1375*cdf0e10cSrcweir if (pNext != NULL && nDepth > 0 && nDepth!=0xffff) 1376*cdf0e10cSrcweir pEntry = pNext; 1377*cdf0e10cSrcweir else 1378*cdf0e10cSrcweir break; 1379*cdf0e10cSrcweir } 1380*cdf0e10cSrcweir } 1381*cdf0e10cSrcweir 1382*cdf0e10cSrcweir return pEntry; 1383*cdf0e10cSrcweir } 1384*cdf0e10cSrcweir 1385*cdf0e10cSrcweir 1386*cdf0e10cSrcweir 1387*cdf0e10cSrcweir 1388*cdf0e10cSrcweir bool SdPageObjsTLB::IsDropAllowed (SvLBoxEntry* pEntry) 1389*cdf0e10cSrcweir { 1390*cdf0e10cSrcweir if (pEntry == NULL) 1391*cdf0e10cSrcweir return false; 1392*cdf0e10cSrcweir 1393*cdf0e10cSrcweir if ( ! IsDropFormatSupported(SdPageObjsTransferable::GetListBoxDropFormatId())) 1394*cdf0e10cSrcweir return false; 1395*cdf0e10cSrcweir 1396*cdf0e10cSrcweir if ((pEntry->GetFlags() & SV_ENTRYFLAG_DISABLE_DROP) != 0) 1397*cdf0e10cSrcweir return false; 1398*cdf0e10cSrcweir 1399*cdf0e10cSrcweir return true; 1400*cdf0e10cSrcweir } 1401*cdf0e10cSrcweir 1402*cdf0e10cSrcweir 1403*cdf0e10cSrcweir 1404*cdf0e10cSrcweir 1405*cdf0e10cSrcweir void SdPageObjsTLB::AddShapeToTransferable ( 1406*cdf0e10cSrcweir SdTransferable& rTransferable, 1407*cdf0e10cSrcweir SdrObject& rObject) const 1408*cdf0e10cSrcweir { 1409*cdf0e10cSrcweir TransferableObjectDescriptor aObjectDescriptor; 1410*cdf0e10cSrcweir bool bIsDescriptorFillingPending (true); 1411*cdf0e10cSrcweir 1412*cdf0e10cSrcweir const SdrOle2Obj* pOleObject = dynamic_cast<const SdrOle2Obj*>(&rObject); 1413*cdf0e10cSrcweir if (pOleObject != NULL && pOleObject->GetObjRef().is()) 1414*cdf0e10cSrcweir { 1415*cdf0e10cSrcweir // If object has no persistence it must be copied as part of the document 1416*cdf0e10cSrcweir try 1417*cdf0e10cSrcweir { 1418*cdf0e10cSrcweir uno::Reference< embed::XEmbedPersist > xPersObj (pOleObject->GetObjRef(), uno::UNO_QUERY ); 1419*cdf0e10cSrcweir if (xPersObj.is() && xPersObj->hasEntry()) 1420*cdf0e10cSrcweir { 1421*cdf0e10cSrcweir SvEmbedTransferHelper::FillTransferableObjectDescriptor( 1422*cdf0e10cSrcweir aObjectDescriptor, 1423*cdf0e10cSrcweir pOleObject->GetObjRef(), 1424*cdf0e10cSrcweir pOleObject->GetGraphic(), 1425*cdf0e10cSrcweir pOleObject->GetAspect()); 1426*cdf0e10cSrcweir bIsDescriptorFillingPending = false; 1427*cdf0e10cSrcweir } 1428*cdf0e10cSrcweir } 1429*cdf0e10cSrcweir catch( uno::Exception& ) 1430*cdf0e10cSrcweir { 1431*cdf0e10cSrcweir } 1432*cdf0e10cSrcweir } 1433*cdf0e10cSrcweir 1434*cdf0e10cSrcweir ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh(); 1435*cdf0e10cSrcweir if (bIsDescriptorFillingPending && pDocShell!=NULL) 1436*cdf0e10cSrcweir { 1437*cdf0e10cSrcweir bIsDescriptorFillingPending = false; 1438*cdf0e10cSrcweir pDocShell->FillTransferableObjectDescriptor(aObjectDescriptor); 1439*cdf0e10cSrcweir } 1440*cdf0e10cSrcweir 1441*cdf0e10cSrcweir Point aDragPos (rObject.GetCurrentBoundRect().Center()); 1442*cdf0e10cSrcweir //Point aDragPos (0,0); 1443*cdf0e10cSrcweir aObjectDescriptor.maDragStartPos = aDragPos; 1444*cdf0e10cSrcweir // aObjectDescriptor.maSize = GetAllMarkedRect().GetSize(); 1445*cdf0e10cSrcweir if (pDocShell != NULL) 1446*cdf0e10cSrcweir aObjectDescriptor.maDisplayName = pDocShell->GetMedium()->GetURLObject().GetURLNoPass(); 1447*cdf0e10cSrcweir else 1448*cdf0e10cSrcweir aObjectDescriptor.maDisplayName = String(); 1449*cdf0e10cSrcweir aObjectDescriptor.mbCanLink = sal_False; 1450*cdf0e10cSrcweir 1451*cdf0e10cSrcweir rTransferable.SetStartPos(aDragPos); 1452*cdf0e10cSrcweir rTransferable.SetObjectDescriptor( aObjectDescriptor ); 1453*cdf0e10cSrcweir } 1454*cdf0e10cSrcweir 1455*cdf0e10cSrcweir 1456*cdf0e10cSrcweir 1457*cdf0e10cSrcweir 1458*cdf0e10cSrcweir ::sd::ViewShell* SdPageObjsTLB::GetViewShellForDocShell (::sd::DrawDocShell& rDocShell) 1459*cdf0e10cSrcweir { 1460*cdf0e10cSrcweir { 1461*cdf0e10cSrcweir ::sd::ViewShell* pViewShell = rDocShell.GetViewShell(); 1462*cdf0e10cSrcweir if (pViewShell != NULL) 1463*cdf0e10cSrcweir return pViewShell; 1464*cdf0e10cSrcweir } 1465*cdf0e10cSrcweir 1466*cdf0e10cSrcweir try 1467*cdf0e10cSrcweir { 1468*cdf0e10cSrcweir // Get a component enumeration from the desktop and search it for documents. 1469*cdf0e10cSrcweir uno::Reference<lang::XMultiServiceFactory> xFactory ( 1470*cdf0e10cSrcweir ::comphelper::getProcessServiceFactory ()); 1471*cdf0e10cSrcweir if ( ! xFactory.is()) 1472*cdf0e10cSrcweir return NULL; 1473*cdf0e10cSrcweir 1474*cdf0e10cSrcweir uno::Reference<frame::XDesktop> xDesktop (xFactory->createInstance ( 1475*cdf0e10cSrcweir ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), uno::UNO_QUERY); 1476*cdf0e10cSrcweir if ( ! xDesktop.is()) 1477*cdf0e10cSrcweir return NULL; 1478*cdf0e10cSrcweir 1479*cdf0e10cSrcweir uno::Reference<frame::XFramesSupplier> xFrameSupplier (xDesktop, uno::UNO_QUERY); 1480*cdf0e10cSrcweir if ( ! xFrameSupplier.is()) 1481*cdf0e10cSrcweir return NULL; 1482*cdf0e10cSrcweir 1483*cdf0e10cSrcweir uno::Reference<container::XIndexAccess> xFrameAccess (xFrameSupplier->getFrames(), uno::UNO_QUERY); 1484*cdf0e10cSrcweir if ( ! xFrameAccess.is()) 1485*cdf0e10cSrcweir return NULL; 1486*cdf0e10cSrcweir 1487*cdf0e10cSrcweir for (sal_Int32 nIndex=0,nCount=xFrameAccess->getCount(); nIndex<nCount; ++nIndex) 1488*cdf0e10cSrcweir { 1489*cdf0e10cSrcweir uno::Reference<frame::XFrame> xFrame; 1490*cdf0e10cSrcweir if ( ! (xFrameAccess->getByIndex(nIndex) >>= xFrame)) 1491*cdf0e10cSrcweir continue; 1492*cdf0e10cSrcweir 1493*cdf0e10cSrcweir ::sd::DrawController* pController = dynamic_cast<sd::DrawController*>(xFrame->getController().get()); 1494*cdf0e10cSrcweir if (pController == NULL) 1495*cdf0e10cSrcweir continue; 1496*cdf0e10cSrcweir ::sd::ViewShellBase* pBase = pController->GetViewShellBase(); 1497*cdf0e10cSrcweir if (pBase == NULL) 1498*cdf0e10cSrcweir continue; 1499*cdf0e10cSrcweir if (pBase->GetDocShell() != &rDocShell) 1500*cdf0e10cSrcweir continue; 1501*cdf0e10cSrcweir 1502*cdf0e10cSrcweir const ::boost::shared_ptr<sd::ViewShell> pViewShell (pBase->GetMainViewShell()); 1503*cdf0e10cSrcweir if (pViewShell) 1504*cdf0e10cSrcweir return pViewShell.get(); 1505*cdf0e10cSrcweir } 1506*cdf0e10cSrcweir } 1507*cdf0e10cSrcweir catch (uno::Exception e) 1508*cdf0e10cSrcweir { 1509*cdf0e10cSrcweir // When there is an exception then simply use the default value of 1510*cdf0e10cSrcweir // bIsEnabled and disable the controls. 1511*cdf0e10cSrcweir } 1512*cdf0e10cSrcweir return NULL; 1513*cdf0e10cSrcweir } 1514*cdf0e10cSrcweir 1515*cdf0e10cSrcweir 1516*cdf0e10cSrcweir 1517*cdf0e10cSrcweir 1518*cdf0e10cSrcweir //===== IconProvider ========================================================== 1519*cdf0e10cSrcweir 1520*cdf0e10cSrcweir SdPageObjsTLB::IconProvider::IconProvider (void) 1521*cdf0e10cSrcweir : maImgPage( BitmapEx( SdResId( BMP_PAGE ) ) ), 1522*cdf0e10cSrcweir maImgPageExcl( BitmapEx( SdResId( BMP_PAGE_EXCLUDED ) ) ), 1523*cdf0e10cSrcweir maImgPageObjsExcl( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED ) ) ), 1524*cdf0e10cSrcweir maImgPageObjs( BitmapEx( SdResId( BMP_PAGEOBJS ) ) ), 1525*cdf0e10cSrcweir maImgObjects( BitmapEx( SdResId( BMP_OBJECTS ) ) ), 1526*cdf0e10cSrcweir maImgGroup( BitmapEx( SdResId( BMP_GROUP ) ) ), 1527*cdf0e10cSrcweir 1528*cdf0e10cSrcweir maImgPageH( BitmapEx( SdResId( BMP_PAGE_H ) ) ), 1529*cdf0e10cSrcweir maImgPageExclH( BitmapEx( SdResId( BMP_PAGE_EXCLUDED_H ) ) ), 1530*cdf0e10cSrcweir maImgPageObjsExclH( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED_H ) ) ), 1531*cdf0e10cSrcweir maImgPageObjsH( BitmapEx( SdResId( BMP_PAGEOBJS_H ) ) ), 1532*cdf0e10cSrcweir maImgObjectsH( BitmapEx( SdResId( BMP_OBJECTS_H ) ) ), 1533*cdf0e10cSrcweir maImgGroupH( BitmapEx( SdResId( BMP_GROUP_H ) ) ) 1534*cdf0e10cSrcweir { 1535*cdf0e10cSrcweir } 1536