Update ooo320-m1
[ooovba.git] / sd / source / ui / dlg / sdtreelb.cxx
blob79b5fb8cd05a00b4890ac2a50f4cec2eed29955e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sdtreelb.cxx,v $
10 * $Revision: 1.32 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include <sal/types.h>
35 #include <sot/formats.hxx>
36 #include <sot/storage.hxx>
37 #include <vcl/msgbox.hxx>
38 #include <svtools/urihelper.hxx>
39 #include <svx/svditer.hxx>
40 #include <sfx2/docfile.hxx>
41 #include <svx/svdoole2.hxx>
42 #include <vcl/svapp.hxx>
43 #include "cusshow.hxx"
44 #include <sfx2/childwin.hxx>
46 #include <sfx2/viewfrm.hxx>
48 #include "strmname.h"
49 #include "sdtreelb.hxx"
50 #include "DrawDocShell.hxx"
51 #include "drawdoc.hxx"
52 #include "sdpage.hxx"
53 #include "sdresid.hxx"
54 #include "navigatr.hxx"
55 #ifndef _SD_CFGID_HXX
56 #include "strings.hrc"
57 #endif
58 #include "res_bmp.hrc"
60 #include <com/sun/star/embed/XEmbedPersist.hpp>
61 #include <svtools/embedtransfer.hxx>
62 #include <ViewShell.hxx>
64 using namespace com::sun::star;
66 class SdPageObjsTLB::IconProvider
68 public:
69 IconProvider (void);
71 // Regular icons.
72 Image maImgPage;
73 Image maImgPageExcl;
74 Image maImgPageObjsExcl;
75 Image maImgPageObjs;
76 Image maImgObjects;
77 Image maImgGroup;
79 // High contrast icons.
80 Image maImgPageH;
81 Image maImgPageExclH;
82 Image maImgPageObjsExclH;
83 Image maImgPageObjsH;
84 Image maImgObjectsH;
85 Image maImgGroupH;
89 BOOL SD_DLLPRIVATE SdPageObjsTLB::bIsInDrag = FALSE;
91 BOOL SdPageObjsTLB::IsInDrag()
93 return bIsInDrag;
96 sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::mnListBoxDropFormatId = SAL_MAX_UINT32;
98 // -----------------------------------------
99 // - SdPageObjsTLB::SdPageObjsTransferable -
100 // -----------------------------------------
102 SdPageObjsTLB::SdPageObjsTransferable::SdPageObjsTransferable(
103 SdPageObjsTLB& rParent,
104 const INetBookmark& rBookmark,
105 ::sd::DrawDocShell& rDocShell,
106 NavigatorDragType eDragType,
107 const ::com::sun::star::uno::Any& rTreeListBoxData )
108 : SdTransferable(rDocShell.GetDoc(), NULL, TRUE),
109 mrParent( rParent ),
110 maBookmark( rBookmark ),
111 mrDocShell( rDocShell ),
112 meDragType( eDragType ),
113 maTreeListBoxData( rTreeListBoxData )
120 SdPageObjsTLB::SdPageObjsTransferable::~SdPageObjsTransferable()
124 // -----------------------------------------------------------------------------
126 void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats()
128 AddFormat(SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK);
129 AddFormat(SOT_FORMATSTR_ID_TREELISTBOX);
130 AddFormat(GetListBoxDropFormatId());
133 // -----------------------------------------------------------------------------
135 sal_Bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
137 ULONG nFormatId = SotExchange::GetFormat( rFlavor );
138 switch (nFormatId)
140 case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
141 SetINetBookmark( maBookmark, rFlavor );
142 return sal_True;
144 case SOT_FORMATSTR_ID_TREELISTBOX:
145 SetAny(maTreeListBoxData, rFlavor);
146 return sal_True;
148 default:
149 return sal_False;
153 // -----------------------------------------------------------------------------
155 void SdPageObjsTLB::SdPageObjsTransferable::DragFinished( sal_Int8 nDropAction )
157 mrParent.OnDragFinished( nDropAction );
160 // -----------------------------------------------------------------------------
162 ::sd::DrawDocShell& SdPageObjsTLB::SdPageObjsTransferable::GetDocShell() const
164 return mrDocShell;
167 // -----------------------------------------------------------------------------
169 NavigatorDragType SdPageObjsTLB::SdPageObjsTransferable::GetDragType() const
171 return meDragType;
174 // -----------------------------------------------------------------------------
176 sal_Int64 SAL_CALL SdPageObjsTLB::SdPageObjsTransferable::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException )
178 sal_Int64 nRet;
180 if( ( rId.getLength() == 16 ) &&
181 ( 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
183 nRet = (sal_Int64)(sal_IntPtr)this;
185 else
186 nRet = SdTransferable::getSomething(rId);
188 return nRet;
191 // -----------------------------------------------------------------------------
193 const ::com::sun::star::uno::Sequence< sal_Int8 >& SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId()
195 static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
197 if( !aSeq.getLength() )
199 static osl::Mutex aCreateMutex;
200 osl::MutexGuard aGuard( aCreateMutex );
202 aSeq.realloc( 16 );
203 rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
206 return aSeq;
209 // -----------------------------------------------------------------------------
211 SdPageObjsTLB::SdPageObjsTransferable* SdPageObjsTLB::SdPageObjsTransferable::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData )
212 throw()
216 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( rxData, ::com::sun::star::uno::UNO_QUERY_THROW );
218 return reinterpret_cast<SdPageObjsTLB::SdPageObjsTransferable*>(
219 sal::static_int_cast<sal_uIntPtr>(
220 xUnoTunnel->getSomething( SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId()) ) );
222 catch( const ::com::sun::star::uno::Exception& )
225 return 0;
229 sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId (void)
231 if (mnListBoxDropFormatId == SAL_MAX_UINT32)
232 mnListBoxDropFormatId = SotExchange::RegisterFormatMimeType(
233 ::rtl::OUString::createFromAscii(
234 "application/x-openoffice-treelistbox-moveonly;"
235 "windows_formatname=\"SV_LBOX_DD_FORMAT_MOVE\""));
236 return mnListBoxDropFormatId;
239 /*************************************************************************
241 |* Ctor1 SdPageObjsTLB
243 \************************************************************************/
245 SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId )
246 : SvTreeListBox ( pParentWin, rSdResId )
247 , mpParent ( pParentWin )
248 , mpDoc ( NULL )
249 , mpBookmarkDoc ( NULL )
250 , mpMedium ( NULL )
251 , mpOwnMedium ( NULL )
252 , maImgOle ( BitmapEx( SdResId( BMP_OLE ) ) )
253 , maImgGraphic ( BitmapEx( SdResId( BMP_GRAPHIC ) ) )
254 , maImgOleH ( BitmapEx( SdResId( BMP_OLE_H ) ) )
255 , maImgGraphicH ( BitmapEx( SdResId( BMP_GRAPHIC_H ) ) )
256 , mbLinkableSelected ( FALSE )
257 , mpDropNavWin ( NULL )
258 , mbShowAllShapes ( false )
259 , mbShowAllPages ( false )
262 // Tree-ListBox mit Linien versehen
263 SetWindowBits( WinBits( WB_TABSTOP | WB_BORDER | WB_HASLINES |
264 WB_HASBUTTONS | // WB_HASLINESATROOT |
265 WB_HSCROLL | // #31562#
266 WB_HASBUTTONSATROOT ) );
267 SetNodeBitmaps( Bitmap( SdResId( BMP_EXPAND ) ),
268 Bitmap( SdResId( BMP_COLLAPSE ) ) );
270 SetNodeBitmaps( Bitmap( SdResId( BMP_EXPAND_H ) ),
271 Bitmap( SdResId( BMP_COLLAPSE_H ) ),
272 BMP_COLOR_HIGHCONTRAST );
274 SetDragDropMode(
275 SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY |
276 SV_DRAGDROP_APP_MOVE | SV_DRAGDROP_APP_COPY | SV_DRAGDROP_APP_DROP );
279 /*************************************************************************
281 |* Dtor SdPageObjsTLB
283 \************************************************************************/
285 SdPageObjsTLB::~SdPageObjsTLB()
287 if ( mpBookmarkDoc )
288 CloseBookmarkDoc();
289 else
290 // no document was created from mpMedium, so this object is still the owner of it
291 delete mpMedium;
294 /*************************************************************************
296 |* return name of object
298 \************************************************************************/
300 String SdPageObjsTLB::GetObjectName(
301 const SdrObject* pObject,
302 const bool bCreate) const
304 String aRet;
306 if ( pObject )
308 aRet = pObject->GetName();
310 if( !aRet.Len() && pObject->ISA( SdrOle2Obj ) )
311 aRet = static_cast< const SdrOle2Obj* >( pObject )->GetPersistName();
314 if (bCreate
315 && mbShowAllShapes
316 && aRet.Len() == 0
317 && pObject!=NULL)
319 aRet = SdResId(STR_NAVIGATOR_SHAPE_BASE_NAME);
320 aRet.SearchAndReplaceAscii("%1", String::CreateFromInt32(pObject->GetOrdNum() + 1));
323 return aRet;
326 /*************************************************************************
328 |* In TreeLB Eintrag selektieren
330 \************************************************************************/
332 BOOL SdPageObjsTLB::SelectEntry( const String& rName )
334 BOOL bFound = FALSE;
336 if( rName.Len() )
338 SvLBoxEntry* pEntry = NULL;
339 String aTmp;
341 for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) )
343 aTmp = GetEntryText( pEntry );
344 if( aTmp == rName )
346 bFound = TRUE;
347 SetCurEntry( pEntry );
351 return( bFound );
354 /*************************************************************************
356 |* Gibt zurueck, ob Childs des uebergebenen Strings selektiert sind
358 \************************************************************************/
360 BOOL SdPageObjsTLB::HasSelectedChilds( const String& rName )
362 BOOL bFound = FALSE;
363 BOOL bChilds = FALSE;
365 if( rName.Len() )
367 SvLBoxEntry* pEntry = NULL;
368 String aTmp;
370 for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) )
372 aTmp = GetEntryText( pEntry );
373 if( aTmp == rName )
375 bFound = TRUE;
376 BOOL bExpanded = IsExpanded( pEntry );
377 long nCount = GetChildSelectionCount( pEntry );
378 if( bExpanded && nCount > 0 )
379 bChilds = TRUE;
383 return( bChilds );
387 /*************************************************************************
389 |* TreeLB mit Seiten und Objekten fuellen
391 \************************************************************************/
393 void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, BOOL bAllPages,
394 const String& rDocName)
396 String aSelection;
397 if( GetSelectionCount() > 0 )
399 aSelection = GetSelectEntry();
400 Clear();
403 mpDoc = pInDoc;
404 maDocName = rDocName;
405 mbShowAllPages = (bAllPages == TRUE);
406 mpMedium = NULL;
408 SdPage* pPage = NULL;
410 IconProvider aIconProvider;
412 // first insert all pages including objects
413 USHORT nPage = 0;
414 const USHORT nMaxPages = mpDoc->GetPageCount();
416 while( nPage < nMaxPages )
418 pPage = (SdPage*) mpDoc->GetPage( nPage );
419 if( (mbShowAllPages || pPage->GetPageKind() == PK_STANDARD)
420 && !(pPage->GetPageKind()==PK_HANDOUT) ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
422 BOOL bPageExluded = pPage->IsExcluded();
424 bool bPageBelongsToShow = PageBelongsToCurrentShow (pPage);
425 bPageExluded |= !bPageBelongsToShow;
427 AddShapeList(*pPage, NULL, pPage->GetName(), bPageExluded, NULL, aIconProvider);
429 nPage++;
432 // dann alle MasterPages incl. Objekte einfuegen
433 if( mbShowAllPages )
435 nPage = 0;
436 const USHORT nMaxMasterPages = mpDoc->GetMasterPageCount();
438 while( nPage < nMaxMasterPages )
440 pPage = (SdPage*) mpDoc->GetMasterPage( nPage );
441 AddShapeList(*pPage, NULL, pPage->GetName(), false, NULL, aIconProvider);
442 nPage++;
445 if( aSelection.Len() )
446 SelectEntry( aSelection );
449 /*************************************************************************
451 |* Es wird nur der erste Eintrag eingefuegt. Childs werden OnDemand erzeugt
453 \************************************************************************/
455 void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium,
456 const String& rDocName )
458 mpDoc = pInDoc;
460 // this object now owns the Medium
461 mpMedium = pInMedium;
462 maDocName = rDocName;
464 Image aImgDocOpen=Image( BitmapEx( SdResId( BMP_DOC_OPEN ) ) );
465 Image aImgDocClosed=Image( BitmapEx( SdResId( BMP_DOC_CLOSED ) ) );
466 Image aImgDocOpenH=Image( BitmapEx( SdResId( BMP_DOC_OPEN_H ) ) );
467 Image aImgDocClosedH=Image( BitmapEx( SdResId( BMP_DOC_CLOSED_H ) ) );
469 // Dokumentnamen einfuegen
470 SvLBoxEntry* pFileEntry = InsertEntry( maDocName,
471 aImgDocOpen,
472 aImgDocClosed,
473 NULL,
474 TRUE,
475 LIST_APPEND,
476 reinterpret_cast< void* >( 1 ) );
478 SetExpandedEntryBmp( pFileEntry, aImgDocOpenH, BMP_COLOR_HIGHCONTRAST );
479 SetCollapsedEntryBmp( pFileEntry, aImgDocClosedH, BMP_COLOR_HIGHCONTRAST );
485 void SdPageObjsTLB::AddShapeList (
486 const SdrObjList& rList,
487 SdrObject* pShape,
488 const ::rtl::OUString& rsName,
489 const bool bIsExcluded,
490 SvLBoxEntry* pParentEntry,
491 const IconProvider& rIconProvider)
493 Image aIcon (rIconProvider.maImgPage);
494 if (bIsExcluded)
495 aIcon = rIconProvider.maImgPageExcl;
496 else if (pShape != NULL)
497 aIcon = rIconProvider.maImgGroup;
499 void* pUserData (reinterpret_cast<void*>(1));
500 if (pShape != NULL)
501 pUserData = pShape;
503 SvLBoxEntry* pEntry = InsertEntry(
504 rsName,
505 aIcon,
506 aIcon,
507 pParentEntry,
508 FALSE,
509 LIST_APPEND,
510 pUserData);
512 SetExpandedEntryBmp(
513 pEntry,
514 bIsExcluded ? rIconProvider.maImgPageExclH : rIconProvider.maImgPageH,
515 BMP_COLOR_HIGHCONTRAST );
516 SetCollapsedEntryBmp(
517 pEntry,
518 bIsExcluded ? rIconProvider.maImgPageExclH : rIconProvider.maImgPageH,
519 BMP_COLOR_HIGHCONTRAST );
521 SdrObjListIter aIter(
522 rList,
523 !rList.HasObjectNavigationOrder() /* use navigation order, if available */,
524 IM_FLAT,
525 FALSE /*not reverse*/);
527 while( aIter.IsMore() )
529 SdrObject* pObj = aIter.Next();
530 OSL_ASSERT(pObj!=NULL);
532 // Get the shape name.
533 String aStr (GetObjectName( pObj ) );
535 if( aStr.Len() )
537 if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 )
539 SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgOle, maImgOle, pEntry,
540 FALSE, LIST_APPEND, pObj);
542 SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
543 SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
545 else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF )
547 SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgGraphic, maImgGraphic, pEntry,
548 FALSE, LIST_APPEND, pObj );
550 SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
551 SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
553 else if (pObj->IsGroupObject())
555 AddShapeList(
556 *pObj->GetSubList(),
557 pObj,
558 aStr,
559 false,
560 pEntry,
561 rIconProvider);
563 else
565 SvLBoxEntry* pNewEntry = InsertEntry( aStr, rIconProvider.maImgObjects, rIconProvider.maImgObjects, pEntry,
566 FALSE, LIST_APPEND, pObj );
568 SetExpandedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST );
569 SetCollapsedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST );
574 if( pEntry->HasChilds() )
576 SetExpandedEntryBmp(
577 pEntry,
578 bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs);
579 SetCollapsedEntryBmp(
580 pEntry,
581 bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs);
582 SetExpandedEntryBmp(
583 pEntry,
584 bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH,
585 BMP_COLOR_HIGHCONTRAST);
586 SetCollapsedEntryBmp(
587 pEntry,
588 bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH,
589 BMP_COLOR_HIGHCONTRAST);
596 void SdPageObjsTLB::SetShowAllShapes (
597 const bool bShowAllShapes,
598 const bool bFillList)
600 mbShowAllShapes = bShowAllShapes;
601 if (bFillList)
603 if (mpMedium == NULL)
604 Fill(mpDoc, mbShowAllPages, maDocName);
605 else
606 Fill(mpDoc, mpMedium, maDocName);
613 bool SdPageObjsTLB::GetShowAllShapes (void) const
615 return mbShowAllShapes;
621 /*************************************************************************
623 |* Prueft, ob die Seiten (PK_STANDARD) und die darauf befindlichen Objekte
624 |* des Docs und der TreeLB identisch sind.
625 |* Wird ein Doc uebergeben, wird dieses zum aktuellem Doc (Wichtig bei
626 |* mehreren Documenten).
628 \************************************************************************/
630 BOOL SdPageObjsTLB::IsEqualToDoc( const SdDrawDocument* pInDoc )
632 if( pInDoc )
633 mpDoc = pInDoc;
635 if( !mpDoc )
636 return( FALSE );
638 SdrObject* pObj = NULL;
639 SdPage* pPage = NULL;
640 SvLBoxEntry* pEntry = First();
641 String aName;
643 // Alle Pages incl. Objekte vergleichen
644 USHORT nPage = 0;
645 const USHORT nMaxPages = mpDoc->GetPageCount();
647 while( nPage < nMaxPages )
649 pPage = (SdPage*) mpDoc->GetPage( nPage );
650 if( pPage->GetPageKind() == PK_STANDARD )
652 if( !pEntry )
653 return( FALSE );
654 aName = GetEntryText( pEntry );
656 if( pPage->GetName() != aName )
657 return( FALSE );
659 pEntry = Next( pEntry );
661 SdrObjListIter aIter(
662 *pPage,
663 !pPage->HasObjectNavigationOrder() /* use navigation order, if available */,
664 IM_DEEPWITHGROUPS );
666 while( aIter.IsMore() )
668 pObj = aIter.Next();
670 const String aObjectName( GetObjectName( pObj ) );
672 if( aObjectName.Len() )
674 if( !pEntry )
675 return( FALSE );
677 aName = GetEntryText( pEntry );
679 if( aObjectName != aName )
680 return( FALSE );
682 pEntry = Next( pEntry );
686 nPage++;
688 // Wenn noch Eintraege in der Listbox vorhanden sind, wurden
689 // Objekte (mit Namen) oder Seiten geloescht
690 return( !pEntry );
693 /*************************************************************************
695 |* Selectierten String zurueckgeben
697 \************************************************************************/
699 String SdPageObjsTLB::GetSelectEntry()
701 return( GetEntryText( GetCurEntry() ) );
704 /*************************************************************************
706 |* Selektierte Eintrage zurueckgeben
707 |* nDepth == 0 -> Seiten
708 |* nDepth == 1 -> Objekte
710 \************************************************************************/
712 List* SdPageObjsTLB::GetSelectEntryList( USHORT nDepth )
714 List* pList = NULL;
715 SvLBoxEntry* pEntry = FirstSelected();
717 while( pEntry )
719 USHORT nListDepth = GetModel()->GetDepth( pEntry );
720 if( nListDepth == nDepth )
722 if( !pList )
723 pList = new List();
725 const String aEntryText( GetEntryText( pEntry ) );
726 pList->Insert( new String( aEntryText ), LIST_APPEND );
728 pEntry = NextSelected( pEntry );
731 return( pList );
734 /*************************************************************************
736 |* Alle Pages (und Objekte) des Docs zurueckgeben
737 |* nType == 0 -> Seiten
738 |* nType == 1 -> Objekte
740 \************************************************************************/
742 List* SdPageObjsTLB::GetBookmarkList( USHORT nType )
744 List* pList = NULL;
746 if( GetBookmarkDoc() )
748 SdPage* pPage = NULL;
749 String* pName = NULL;
750 USHORT nPage = 0;
751 const USHORT nMaxPages = mpBookmarkDoc->GetSdPageCount( PK_STANDARD );
753 while( nPage < nMaxPages )
755 pPage = mpBookmarkDoc->GetSdPage( nPage, PK_STANDARD );
757 if( nType == 0 ) // Seitennamen einfuegen
759 if( !pList )
760 pList = new List();
762 pName = new String( pPage->GetRealName() );
763 pList->Insert( pName, LIST_APPEND );
765 else // Objektnamen einfuegen
767 // Ueber Objekte der Seite iterieren
768 SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
769 while( aIter.IsMore() )
771 SdrObject* pObj = aIter.Next();
772 String aStr( GetObjectName( pObj ) );
773 if( aStr.Len() )
775 if( !pList )
776 pList = new List();
778 pName = new String( aStr );
779 pList->Insert( pName, LIST_APPEND );
783 nPage++;
786 return( pList );
789 /*************************************************************************
791 |* Eintraege werden erst auf Anforderung (Doppelklick) eingefuegt
793 \************************************************************************/
795 void SdPageObjsTLB::RequestingChilds( SvLBoxEntry* pFileEntry )
797 if( !pFileEntry->HasChilds() )
799 if( GetBookmarkDoc() )
801 SdrObject* pObj = NULL;
802 SdPage* pPage = NULL;
803 SvLBoxEntry* pPageEntry = NULL;
805 Image aImgPage=Image( BitmapEx( SdResId( BMP_PAGE ) ) );
806 Image aImgPageObjs=Image( BitmapEx( SdResId( BMP_PAGEOBJS ) ) );
807 Image aImgObjects=Image( BitmapEx( SdResId( BMP_OBJECTS ) ) );
808 Image aImgPageH=Image( BitmapEx( SdResId( BMP_PAGE_H ) ) );
809 Image aImgPageObjsH=Image( BitmapEx( SdResId( BMP_PAGEOBJS_H ) ) );
810 Image aImgObjectsH=Image( BitmapEx( SdResId( BMP_OBJECTS_H ) ) );
812 // document name already inserted
814 // only insert all "normal" ? slides with objects
815 USHORT nPage = 0;
816 const USHORT nMaxPages = mpBookmarkDoc->GetPageCount();
818 while( nPage < nMaxPages )
820 pPage = (SdPage*) mpBookmarkDoc->GetPage( nPage );
821 if( pPage->GetPageKind() == PK_STANDARD )
823 pPageEntry = InsertEntry( pPage->GetName(),
824 aImgPage,
825 aImgPage,
826 pFileEntry,
827 FALSE,
828 LIST_APPEND,
829 reinterpret_cast< void* >( 1 ) );
831 SetExpandedEntryBmp( pPageEntry, aImgPageH, BMP_COLOR_HIGHCONTRAST );
832 SetCollapsedEntryBmp( pPageEntry, aImgPageH, BMP_COLOR_HIGHCONTRAST );
834 SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
836 while( aIter.IsMore() )
838 pObj = aIter.Next();
839 String aStr( GetObjectName( pObj ) );
840 if( aStr.Len() )
842 if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 )
844 SvLBoxEntry* pNewEntry = InsertEntry(aStr, maImgOle, maImgOle, pPageEntry);
847 SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
848 SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
850 else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF )
852 SvLBoxEntry* pNewEntry = InsertEntry(aStr, maImgGraphic, maImgGraphic, pPageEntry);
854 SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
855 SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
857 else
859 SvLBoxEntry* pNewEntry = InsertEntry(aStr, aImgObjects, aImgObjects, pPageEntry);
861 SetExpandedEntryBmp( pNewEntry, aImgObjectsH, BMP_COLOR_HIGHCONTRAST );
862 SetCollapsedEntryBmp( pNewEntry, aImgObjectsH, BMP_COLOR_HIGHCONTRAST );
866 if( pPageEntry->HasChilds() )
868 SetExpandedEntryBmp( pPageEntry, aImgPageObjs );
869 SetCollapsedEntryBmp( pPageEntry, aImgPageObjs );
870 SetExpandedEntryBmp( pPageEntry, aImgPageObjsH, BMP_COLOR_HIGHCONTRAST );
871 SetCollapsedEntryBmp( pPageEntry, aImgPageObjsH, BMP_COLOR_HIGHCONTRAST );
874 nPage++;
878 else
879 SvTreeListBox::RequestingChilds( pFileEntry );
882 /*************************************************************************
884 |* Prueft, ob es sich um eine Draw-Datei handelt und oeffnet anhand des
885 |* uebergebenen Docs das BookmarkDoc
887 \************************************************************************/
889 SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed)
891 if (
892 !mpBookmarkDoc ||
893 (pMed && (!mpOwnMedium || mpOwnMedium->GetName() != pMed->GetName()))
896 // create a new BookmarkDoc if now one exists or if a new Medium is provided
897 if (mpOwnMedium != pMed)
899 CloseBookmarkDoc();
902 if (pMed)
904 // it looks that it is undefined if a Medium was set by Fill() allready
905 DBG_ASSERT( !mpMedium, "SfxMedium confusion!" );
906 delete mpMedium;
907 mpMedium = NULL;
909 // take over this Medium (currently used only be Navigator)
910 mpOwnMedium = pMed;
913 DBG_ASSERT( mpMedium || pMed, "No SfxMedium provided!" );
915 if( pMed )
917 // in this mode the document is also owned and controlled by this instance
918 mxBookmarkDocShRef = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD, TRUE);
919 if (mxBookmarkDocShRef->DoLoad(pMed))
920 mpBookmarkDoc = mxBookmarkDocShRef->GetDoc();
921 else
922 mpBookmarkDoc = NULL;
924 else if ( mpMedium )
925 // in this mode the document is owned and controlled by the SdDrawDocument
926 // it can be released by calling the corresponding CloseBookmarkDoc method
927 // successfull creation of a document makes this the owner of the medium
928 mpBookmarkDoc = ((SdDrawDocument*) mpDoc)->OpenBookmarkDoc(*mpMedium);
930 if ( !mpBookmarkDoc )
932 ErrorBox aErrorBox( this, WB_OK, String( SdResId( STR_READ_DATA_ERROR ) ) );
933 aErrorBox.Execute();
934 mpMedium = 0; //On failure the SfxMedium is invalid
938 return( mpBookmarkDoc );
941 /*************************************************************************
943 |* Bookmark-Dokument schlieáen und loeschen
945 \************************************************************************/
947 void SdPageObjsTLB::CloseBookmarkDoc()
949 if (mxBookmarkDocShRef.Is())
951 mxBookmarkDocShRef->DoClose();
952 mxBookmarkDocShRef.Clear();
954 // Medium is owned by document, so it's destroyed already
955 mpOwnMedium = 0;
957 else if ( mpBookmarkDoc )
959 DBG_ASSERT( !mpOwnMedium, "SfxMedium confusion!" );
960 if ( mpDoc )
962 // The document owns the Medium, so the Medium will be invalid after closing the document
963 ((SdDrawDocument*) mpDoc)->CloseBookmarkDoc();
964 mpMedium = 0;
967 else
969 // perhaps mpOwnMedium provided, but no successfull creation of BookmarkDoc
970 delete mpOwnMedium;
971 mpOwnMedium = NULL;
974 mpBookmarkDoc = NULL;
977 /*************************************************************************
981 \************************************************************************/
983 void SdPageObjsTLB::SelectHdl()
985 SvLBoxEntry* pEntry = FirstSelected();
987 mbLinkableSelected = TRUE;
989 while( pEntry && mbLinkableSelected )
991 if( NULL == pEntry->GetUserData() )
992 mbLinkableSelected = FALSE;
994 pEntry = NextSelected( pEntry );
997 SvTreeListBox::SelectHdl();
1000 /*************************************************************************
1002 |* Ueberlaedt RETURN mit der Funktionsweise von DoubleClick
1004 \************************************************************************/
1006 void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt )
1008 if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN )
1010 // Auskommentierter Code aus svtools/source/contnr/svimpbox.cxx
1011 SvLBoxEntry* pCursor = GetCurEntry();
1012 if( pCursor->HasChilds() || pCursor->HasChildsOnDemand() )
1014 if( IsExpanded( pCursor ) )
1015 Collapse( pCursor );
1016 else
1017 Expand( pCursor );
1020 DoubleClickHdl();
1022 else
1023 SvTreeListBox::KeyInput( rKEvt );
1026 /*************************************************************************
1028 |* StartDrag-Request
1030 \************************************************************************/
1032 void SdPageObjsTLB::StartDrag( sal_Int8 nAction, const Point& rPosPixel)
1034 (void)nAction;
1035 (void)rPosPixel;
1037 SdNavigatorWin* pNavWin = NULL;
1038 SvLBoxEntry* pEntry = GetEntry(rPosPixel);
1040 if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
1041 pNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) );
1043 if (pEntry != NULL
1044 && pNavWin !=NULL
1045 && pNavWin == mpParent
1046 && pNavWin->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE )
1048 // Mark only the children of the page under the mouse as drop
1049 // targets. This prevents moving shapes from one page to another.
1051 // Select all entries and disable them as drop targets.
1052 SetSelectionMode(MULTIPLE_SELECTION);
1053 SetCursor(NULL, FALSE);
1054 SelectAll(TRUE, FALSE);
1055 EnableSelectionAsDropTarget(FALSE, TRUE);
1057 // Enable only the entries as drop targets that are children of the
1058 // page under the mouse.
1059 SvLBoxEntry* pParent = GetRootLevelParent(pEntry);
1060 if (pParent != NULL)
1062 SelectAll(FALSE, FALSE);
1063 Select(pParent, TRUE);
1064 // for (SvLBoxEntry*pChild=FirstChild(pParent); pChild!=NULL; pChild=NextSibling(pChild))
1065 // Select(pChild, TRUE);
1066 EnableSelectionAsDropTarget(TRUE, TRUE);//FALSE);
1069 // Set selection back to the entry under the mouse.
1070 SelectAll(FALSE,FALSE);
1071 SetSelectionMode(SINGLE_SELECTION);
1072 Select(pEntry, TRUE);
1074 // Aus dem ExecuteDrag heraus kann der Navigator geloescht werden
1075 // (beim Umschalten auf einen anderen Dokument-Typ), das wuerde aber
1076 // den StarView MouseMove-Handler, der Command() aufruft, umbringen.
1077 // Deshalb Drag&Drop asynchron:
1078 Application::PostUserEvent( STATIC_LINK( this, SdPageObjsTLB, ExecDragHdl ) );
1082 /*************************************************************************
1084 |* Begin drag
1086 \************************************************************************/
1088 void SdPageObjsTLB::DoDrag()
1090 mpDropNavWin = ( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) ?
1091 (SdNavigatorWin*)( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ) :
1092 NULL;
1094 if( mpDropNavWin )
1096 ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
1097 String aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INET_PROT_FILE ).GetMainURL( INetURLObject::NO_DECODE );
1098 NavigatorDragType eDragType = mpDropNavWin->GetNavigatorDragType();
1100 aURL.Append( '#' );
1101 aURL.Append( GetSelectEntry() );
1103 INetBookmark aBookmark( aURL, GetSelectEntry() );
1104 sal_Int8 nDNDActions = DND_ACTION_COPYMOVE;
1106 if( eDragType == NAVIGATOR_DRAGTYPE_LINK )
1107 nDNDActions = DND_ACTION_LINK; // #93240# Either COPY *or* LINK, never both!
1109 SvTreeListBox::ReleaseMouse();
1111 bIsInDrag = TRUE;
1113 SvLBoxDDInfo aDDInfo;
1114 memset(&aDDInfo,0,sizeof(SvLBoxDDInfo));
1115 aDDInfo.pApp = GetpApp();
1116 aDDInfo.pSource = this;
1117 // aDDInfo.pDDStartEntry = pEntry;
1118 ::com::sun::star::uno::Sequence<sal_Int8> aSequence (sizeof(SvLBoxDDInfo));
1119 memcpy(aSequence.getArray(), (sal_Char*)&aDDInfo, sizeof(SvLBoxDDInfo));
1120 ::com::sun::star::uno::Any aTreeListBoxData (aSequence);
1122 // object is destroyed by internal reference mechanism
1123 SdTransferable* pTransferable = new SdPageObjsTLB::SdPageObjsTransferable(
1124 *this, aBookmark, *pDocShell, eDragType, aTreeListBoxData);
1125 OSL_TRACE("created new SdPageObjsTransferable at %x", pTransferable);
1127 // Get the view.
1128 sd::View* pView = NULL;
1129 if (pDocShell != NULL)
1131 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
1132 if (pViewShell != NULL)
1133 pView = pViewShell->GetView();
1135 if (pView == NULL)
1137 OSL_ASSERT(pView!=NULL);
1138 return;
1141 SdrObject* pObject = NULL;
1142 void* pUserData = GetCurEntry()->GetUserData();
1143 if (pUserData != NULL && pUserData != (void*)1)
1144 pObject = reinterpret_cast<SdrObject*>(pUserData);
1145 if (pObject == NULL)
1146 return;
1148 // For shapes without a user supplied name (the automatically
1149 // created name does not count), a different drag and drop technique
1150 // is used.
1151 if (GetObjectName(pObject, false).Len() == 0)
1153 AddShapeToTransferable(*pTransferable, *pObject);
1154 pTransferable->SetView(pView);
1155 SD_MOD()->pTransferDrag = pTransferable;
1158 // Unnamed shapes have to be selected to be recognized by the
1159 // current drop implementation. In order to have a consistent
1160 // behaviour for all shapes, every shape that is to be dragged is
1161 // selected first.
1162 SdrPageView* pPageView = pView->GetSdrPageView();
1163 pView->UnmarkAllObj(pPageView);
1164 pView->MarkObj(pObject, pPageView);
1166 pTransferable->StartDrag( this, nDNDActions );
1170 /*************************************************************************
1172 |* Drag finished
1174 \************************************************************************/
1176 void SdPageObjsTLB::OnDragFinished( sal_uInt8 )
1178 if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
1180 SdNavigatorWin* pNewNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) );
1182 if( mpDropNavWin == pNewNavWin)
1184 MouseEvent aMEvt( mpDropNavWin->GetPointerPosPixel() );
1185 SvTreeListBox::MouseButtonUp( aMEvt );
1189 mpDropNavWin = NULL;
1190 bIsInDrag = FALSE;
1193 /*************************************************************************
1195 |* AcceptDrop-Event
1197 \************************************************************************/
1199 sal_Int8 SdPageObjsTLB::AcceptDrop (const AcceptDropEvent& rEvent)
1201 sal_Int8 nResult (DND_ACTION_NONE);
1203 if ( !bIsInDrag && IsDropFormatSupported( FORMAT_FILE ) )
1205 nResult = rEvent.mnAction;
1207 else
1209 SvLBoxEntry* pEntry = GetDropTarget(rEvent.maPosPixel);
1210 if (rEvent.mbLeaving || !CheckDragAndDropMode( this, rEvent.mnAction ))
1212 ImplShowTargetEmphasis( pTargetEntry, FALSE );
1214 else if( !nDragDropMode )
1216 DBG_ERRORFILE( "SdPageObjsTLB::AcceptDrop(): no target" );
1218 else if (IsDropAllowed(pEntry))
1220 nResult = DND_ACTION_MOVE;
1222 // Draw emphasis.
1223 if (pEntry != pTargetEntry || !(nImpFlags & SVLBOX_TARGEMPH_VIS))
1225 ImplShowTargetEmphasis( pTargetEntry, FALSE );
1226 pTargetEntry = pEntry;
1227 ImplShowTargetEmphasis( pTargetEntry, TRUE );
1232 // Hide emphasis when there is no valid drop action.
1233 if (nResult == DND_ACTION_NONE)
1234 ImplShowTargetEmphasis(pTargetEntry, FALSE);
1236 return nResult;
1239 /*************************************************************************
1241 |* ExecuteDrop-Event
1243 \************************************************************************/
1245 sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt )
1247 sal_Int8 nRet = DND_ACTION_NONE;
1251 if( !bIsInDrag )
1253 SdNavigatorWin* pNavWin = NULL;
1254 USHORT nId = SID_NAVIGATOR;
1256 if( mpFrame->HasChildWindow( nId ) )
1257 pNavWin = (SdNavigatorWin*)( mpFrame->GetChildWindow( nId )->GetContextWindow( SD_MOD() ) );
1259 if( pNavWin && ( pNavWin == mpParent ) )
1261 TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
1262 String aFile;
1264 if( aDataHelper.GetString( FORMAT_FILE, aFile ) &&
1265 ( (SdNavigatorWin*) mpParent)->InsertFile( aFile ) )
1267 nRet = rEvt.mnAction;
1272 catch (com::sun::star::uno::Exception&)
1274 OSL_ASSERT(false);
1277 if (nRet == DND_ACTION_NONE)
1278 SvTreeListBox::ExecuteDrop(rEvt, this);
1281 return nRet;
1284 /*************************************************************************
1286 |* Handler fuers Dragging
1288 \************************************************************************/
1290 IMPL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*, EMPTYARG)
1292 // als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch der
1293 // Navigator geloescht werden darf
1294 pThis->DoDrag();
1295 return 0;
1299 bool SdPageObjsTLB::PageBelongsToCurrentShow (const SdPage* pPage) const
1301 // Return <TRUE/> as default when there is no custom show or when none
1302 // is used. The page does then belong to the standard show.
1303 bool bBelongsToShow = true;
1305 if (mpDoc->getPresentationSettings().mbCustomShow)
1307 // Get the current custom show.
1308 SdCustomShow* pCustomShow = NULL;
1309 List* pShowList = const_cast<SdDrawDocument*>(mpDoc)->GetCustomShowList();
1310 if (pShowList != NULL)
1312 ULONG nCurrentShowIndex = pShowList->GetCurPos();
1313 void* pObject = pShowList->GetObject(nCurrentShowIndex);
1314 pCustomShow = static_cast<SdCustomShow*>(pObject);
1317 // Check whether the given page is part of that custom show.
1318 if (pCustomShow != NULL)
1320 bBelongsToShow = false;
1321 ULONG nPageCount = pCustomShow->Count();
1322 for (USHORT i=0; i<nPageCount && !bBelongsToShow; i++)
1323 if (pPage == static_cast<SdPage*>(pCustomShow->GetObject (i)))
1324 bBelongsToShow = true;
1328 return bBelongsToShow;
1334 BOOL SdPageObjsTLB::NotifyMoving(
1335 SvLBoxEntry* pTarget,
1336 SvLBoxEntry* pEntry,
1337 SvLBoxEntry*& rpNewParent,
1338 ULONG& rNewChildPos)
1340 SvLBoxEntry* pDestination = pTarget;
1341 while (GetParent(pDestination) != NULL && GetParent(GetParent(pDestination)) != NULL)
1342 pDestination = GetParent(pDestination);
1344 SdrObject* pTargetObject = reinterpret_cast<SdrObject*>(pDestination->GetUserData());
1345 SdrObject* pSourceObject = reinterpret_cast<SdrObject*>(pEntry->GetUserData());
1346 if (pSourceObject == reinterpret_cast<SdrObject*>(1))
1347 pSourceObject = NULL;
1349 if (pTargetObject != NULL && pSourceObject != NULL)
1351 SdrPage* pObjectList = pSourceObject->GetPage();
1352 if (pObjectList != NULL)
1354 sal_uInt32 nNewPosition;
1355 if (pTargetObject == reinterpret_cast<SdrObject*>(1))
1356 nNewPosition = 0;
1357 else
1358 nNewPosition = pTargetObject->GetNavigationPosition() + 1;
1359 pObjectList->SetObjectNavigationPosition(*pSourceObject, nNewPosition);
1362 // Update the tree list.
1363 if (pTarget == NULL)
1365 rpNewParent = 0;
1366 rNewChildPos = 0;
1367 return TRUE;
1369 else if (GetParent(pDestination) == NULL)
1371 rpNewParent = pDestination;
1372 rNewChildPos = 0;
1374 else
1376 rpNewParent = GetParent(pDestination);
1377 rNewChildPos = pModel->GetRelPos(pDestination) + 1;
1378 rNewChildPos += nCurEntrySelPos;
1379 nCurEntrySelPos++;
1381 return TRUE;
1383 else
1384 return FALSE;
1390 SvLBoxEntry* SdPageObjsTLB::GetDropTarget (const Point& rLocation)
1392 SvLBoxEntry* pEntry = SvTreeListBox::GetDropTarget(rLocation);
1393 if (pEntry == NULL)
1394 return NULL;
1396 OSL_TRACE("entry is %s",
1397 ::rtl::OUStringToOString(GetEntryText(pEntry), RTL_TEXTENCODING_UTF8).getStr());
1398 if (GetParent(pEntry) == NULL)
1400 // Use page entry as insertion position.
1402 else
1404 // Go to second hierarchy level, i.e. top level shapes,
1405 // i.e. children of pages.
1406 while (GetParent(pEntry) != NULL && GetParent(GetParent(pEntry)) != NULL)
1407 pEntry = GetParent(pEntry);
1409 // Advance to next sibling.
1410 SvLBoxEntry* pNext;
1411 sal_uInt16 nDepth (0);
1412 while (pEntry != NULL)
1414 pNext = dynamic_cast<SvLBoxEntry*>(NextVisible(pEntry, &nDepth));
1415 if (pNext != NULL && nDepth > 0 && nDepth!=0xffff)
1416 pEntry = pNext;
1417 else
1418 break;
1420 OSL_TRACE("returning %s",
1421 ::rtl::OUStringToOString(GetEntryText(pEntry), RTL_TEXTENCODING_UTF8).getStr());
1424 return pEntry;
1430 bool SdPageObjsTLB::IsDropAllowed (SvLBoxEntry* pEntry)
1432 if (pEntry == NULL)
1433 return false;
1435 if ( ! IsDropFormatSupported(SdPageObjsTransferable::GetListBoxDropFormatId()))
1436 return false;
1438 if ((pEntry->GetFlags() & SV_ENTRYFLAG_DISABLE_DROP) != 0)
1439 return false;
1441 return true;
1447 void SdPageObjsTLB::AddShapeToTransferable (
1448 SdTransferable& rTransferable,
1449 SdrObject& rObject) const
1451 TransferableObjectDescriptor aObjectDescriptor;
1452 bool bIsDescriptorFillingPending (true);
1454 const SdrOle2Obj* pOleObject = dynamic_cast<const SdrOle2Obj*>(&rObject);
1455 if (pOleObject != NULL && pOleObject->GetObjRef().is())
1457 // If object has no persistence it must be copied as part of the document
1460 uno::Reference< embed::XEmbedPersist > xPersObj (pOleObject->GetObjRef(), uno::UNO_QUERY );
1461 if (xPersObj.is() && xPersObj->hasEntry())
1463 SvEmbedTransferHelper::FillTransferableObjectDescriptor(
1464 aObjectDescriptor,
1465 pOleObject->GetObjRef(),
1466 pOleObject->GetGraphic(),
1467 pOleObject->GetAspect());
1468 bIsDescriptorFillingPending = false;
1471 catch( uno::Exception& )
1476 ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
1477 if (bIsDescriptorFillingPending && pDocShell!=NULL)
1479 bIsDescriptorFillingPending = false;
1480 pDocShell->FillTransferableObjectDescriptor(aObjectDescriptor);
1483 Point aDragPos (rObject.GetCurrentBoundRect().Center());
1484 //Point aDragPos (0,0);
1485 aObjectDescriptor.maDragStartPos = aDragPos;
1486 // aObjectDescriptor.maSize = GetAllMarkedRect().GetSize();
1487 if (pDocShell != NULL)
1488 aObjectDescriptor.maDisplayName = pDocShell->GetMedium()->GetURLObject().GetURLNoPass();
1489 else
1490 aObjectDescriptor.maDisplayName = String();
1491 aObjectDescriptor.mbCanLink = FALSE;
1493 rTransferable.SetStartPos(aDragPos);
1494 rTransferable.SetObjectDescriptor( aObjectDescriptor );
1500 //===== IconProvider ==========================================================
1502 SdPageObjsTLB::IconProvider::IconProvider (void)
1503 : maImgPage( BitmapEx( SdResId( BMP_PAGE ) ) ),
1504 maImgPageExcl( BitmapEx( SdResId( BMP_PAGE_EXCLUDED ) ) ),
1505 maImgPageObjsExcl( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED ) ) ),
1506 maImgPageObjs( BitmapEx( SdResId( BMP_PAGEOBJS ) ) ),
1507 maImgObjects( BitmapEx( SdResId( BMP_OBJECTS ) ) ),
1508 maImgGroup( BitmapEx( SdResId( BMP_GROUP ) ) ),
1510 maImgPageH( BitmapEx( SdResId( BMP_PAGE_H ) ) ),
1511 maImgPageExclH( BitmapEx( SdResId( BMP_PAGE_EXCLUDED_H ) ) ),
1512 maImgPageObjsExclH( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED_H ) ) ),
1513 maImgPageObjsH( BitmapEx( SdResId( BMP_PAGEOBJS_H ) ) ),
1514 maImgObjectsH( BitmapEx( SdResId( BMP_OBJECTS_H ) ) ),
1515 maImgGroupH( BitmapEx( SdResId( BMP_GROUP_H ) ) )