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