15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
55b190011SAndrew Rist * distributed with this work for additional information
65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist * "License"); you may not use this file except in compliance
95b190011SAndrew Rist * with the License. You may obtain a copy of the License at
105b190011SAndrew Rist *
115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist *
135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist * software distributed under the License is distributed on an
155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist * KIND, either express or implied. See the License for the
175b190011SAndrew Rist * specific language governing permissions and limitations
185b190011SAndrew Rist * under the License.
195b190011SAndrew Rist *
205b190011SAndrew Rist *************************************************************/
215b190011SAndrew Rist
225b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #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
IsInDrag()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
SdPageObjsTransferable(SdPageObjsTLB & rParent,const INetBookmark & rBookmark,::sd::DrawDocShell & rDocShell,NavigatorDragType eDragType,const::com::sun::star::uno::Any & rTreeListBoxData)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
~SdPageObjsTransferable()119cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable::~SdPageObjsTransferable()
120cdf0e10cSrcweir {
121cdf0e10cSrcweir }
122cdf0e10cSrcweir
123cdf0e10cSrcweir // -----------------------------------------------------------------------------
124cdf0e10cSrcweir
AddSupportedFormats()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
GetData(const::com::sun::star::datatransfer::DataFlavor & rFlavor)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
DragFinished(sal_Int8 nDropAction)154cdf0e10cSrcweir void SdPageObjsTLB::SdPageObjsTransferable::DragFinished( sal_Int8 nDropAction )
155cdf0e10cSrcweir {
156cdf0e10cSrcweir mrParent.OnDragFinished( nDropAction );
157cdf0e10cSrcweir SdTransferable::DragFinished(nDropAction);
158cdf0e10cSrcweir }
159cdf0e10cSrcweir
160cdf0e10cSrcweir // -----------------------------------------------------------------------------
161cdf0e10cSrcweir
GetDocShell() const162cdf0e10cSrcweir ::sd::DrawDocShell& SdPageObjsTLB::SdPageObjsTransferable::GetDocShell() const
163cdf0e10cSrcweir {
164cdf0e10cSrcweir return mrDocShell;
165cdf0e10cSrcweir }
166cdf0e10cSrcweir
167cdf0e10cSrcweir // -----------------------------------------------------------------------------
168cdf0e10cSrcweir
GetDragType() const169cdf0e10cSrcweir NavigatorDragType SdPageObjsTLB::SdPageObjsTransferable::GetDragType() const
170cdf0e10cSrcweir {
171cdf0e10cSrcweir return meDragType;
172cdf0e10cSrcweir }
173cdf0e10cSrcweir
174cdf0e10cSrcweir // -----------------------------------------------------------------------------
175cdf0e10cSrcweir
getSomething(const::com::sun::star::uno::Sequence<sal_Int8> & rId)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
getUnoTunnelId()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
getImplementation(const::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> & rxData)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
GetListBoxDropFormatId(void)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
SdPageObjsTLB(Window * pParentWin,const SdResId & rSdResId)248cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId )
249cdf0e10cSrcweir : SvTreeListBox ( pParentWin, rSdResId )
250*0deba7fbSSteve Yin , bisInSdNavigatorWin ( sal_False )
251cdf0e10cSrcweir , mpParent ( pParentWin )
252cdf0e10cSrcweir , mpDoc ( NULL )
253cdf0e10cSrcweir , mpBookmarkDoc ( NULL )
254cdf0e10cSrcweir , mpMedium ( NULL )
255cdf0e10cSrcweir , mpOwnMedium ( NULL )
256cdf0e10cSrcweir , maImgOle ( BitmapEx( SdResId( BMP_OLE ) ) )
257cdf0e10cSrcweir , maImgGraphic ( BitmapEx( SdResId( BMP_GRAPHIC ) ) )
258cdf0e10cSrcweir , maImgOleH ( BitmapEx( SdResId( BMP_OLE_H ) ) )
259cdf0e10cSrcweir , maImgGraphicH ( BitmapEx( SdResId( BMP_GRAPHIC_H ) ) )
260cdf0e10cSrcweir , mbLinkableSelected ( sal_False )
261cdf0e10cSrcweir , mpDropNavWin ( NULL )
262cdf0e10cSrcweir , mbShowAllShapes ( false )
263cdf0e10cSrcweir , mbShowAllPages ( false )
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
~SdPageObjsTLB()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
298*0deba7fbSSteve Yin // helper function for GetEntryAltText and GetEntryLongDescription
getAltLongDescText(SvLBoxEntry * pEntry,sal_Bool isAltText) const299*0deba7fbSSteve Yin String SdPageObjsTLB::getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const
300*0deba7fbSSteve Yin {
301*0deba7fbSSteve Yin sal_uInt16 maxPages = mpDoc->GetPageCount();
302*0deba7fbSSteve Yin sal_uInt16 pageNo;
303*0deba7fbSSteve Yin SdrObject* pObj = NULL;
304*0deba7fbSSteve Yin SdPage* pPage = NULL;
305*0deba7fbSSteve Yin
306*0deba7fbSSteve Yin
307*0deba7fbSSteve Yin String ParentName = GetEntryText( GetRootLevelParent( pEntry ) );
308*0deba7fbSSteve Yin
309*0deba7fbSSteve Yin for( pageNo = 0; pageNo < maxPages; pageNo++ )
310*0deba7fbSSteve Yin {
311*0deba7fbSSteve Yin pPage = (SdPage*) mpDoc->GetPage( pageNo );
312*0deba7fbSSteve Yin if( pPage->GetPageKind() != PK_STANDARD ) continue;
313*0deba7fbSSteve Yin if( pPage->GetName() != ParentName ) continue;
314*0deba7fbSSteve Yin SdrObjListIter aIter( *pPage, IM_FLAT );
315*0deba7fbSSteve Yin while( aIter.IsMore() )
316*0deba7fbSSteve Yin {
317*0deba7fbSSteve Yin pObj = aIter.Next();
318*0deba7fbSSteve Yin if( GetEntryText(pEntry) == GetObjectName( pObj ) )
319*0deba7fbSSteve Yin {
320*0deba7fbSSteve Yin if( isAltText )
321*0deba7fbSSteve Yin return pObj->GetTitle();
322*0deba7fbSSteve Yin else
323*0deba7fbSSteve Yin return pObj->GetDescription();
324*0deba7fbSSteve Yin }
325*0deba7fbSSteve Yin }
326*0deba7fbSSteve Yin }
327*0deba7fbSSteve Yin return String();
328*0deba7fbSSteve Yin
329*0deba7fbSSteve Yin }
330*0deba7fbSSteve Yin
GetEntryAltText(SvLBoxEntry * pEntry) const331*0deba7fbSSteve Yin String SdPageObjsTLB::GetEntryAltText( SvLBoxEntry* pEntry ) const
332*0deba7fbSSteve Yin {
333*0deba7fbSSteve Yin return getAltLongDescText( pEntry, sal_True );
334*0deba7fbSSteve Yin }
335*0deba7fbSSteve Yin
GetEntryLongDescription(SvLBoxEntry * pEntry) const336*0deba7fbSSteve Yin String SdPageObjsTLB::GetEntryLongDescription( SvLBoxEntry* pEntry ) const
337*0deba7fbSSteve Yin {
338*0deba7fbSSteve Yin return getAltLongDescText( pEntry, sal_False);
339*0deba7fbSSteve Yin }
340*0deba7fbSSteve Yin
MarkCurEntry(const String & rName)341*0deba7fbSSteve Yin void SdPageObjsTLB::MarkCurEntry( const String& rName )
342*0deba7fbSSteve Yin {
343*0deba7fbSSteve Yin
344*0deba7fbSSteve Yin if( rName.Len() )
345*0deba7fbSSteve Yin {
346*0deba7fbSSteve Yin SvLBoxEntry* pCurEntry =GetCurEntry();
347*0deba7fbSSteve Yin SvLBoxEntry* pEntry =NULL;
348*0deba7fbSSteve Yin String aTmp1;
349*0deba7fbSSteve Yin String aTmp2;
350*0deba7fbSSteve Yin
351*0deba7fbSSteve Yin if( GetParent(pCurEntry)==NULL )
352*0deba7fbSSteve Yin {
353*0deba7fbSSteve Yin aTmp1 = GetEntryText( pCurEntry );
354*0deba7fbSSteve Yin for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
355*0deba7fbSSteve Yin {
356*0deba7fbSSteve Yin if(GetParent( pEntry )==NULL)
357*0deba7fbSSteve Yin continue;
358*0deba7fbSSteve Yin aTmp2 = GetEntryText( GetParent( pEntry ));
359*0deba7fbSSteve Yin if( aTmp1 != aTmp2)
360*0deba7fbSSteve Yin {
361*0deba7fbSSteve Yin // IA2 CWS. MT: Removed in SvLBoxEntry for now - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
362*0deba7fbSSteve Yin pEntry->SetMarked(sal_False);
363*0deba7fbSSteve Yin }
364*0deba7fbSSteve Yin }
365*0deba7fbSSteve Yin
366*0deba7fbSSteve Yin }
367*0deba7fbSSteve Yin else
368*0deba7fbSSteve Yin {
369*0deba7fbSSteve Yin for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
370*0deba7fbSSteve Yin {
371*0deba7fbSSteve Yin aTmp2 = GetEntryText( pEntry );
372*0deba7fbSSteve Yin if( aTmp2 == rName)
373*0deba7fbSSteve Yin {
374*0deba7fbSSteve Yin pEntry->SetMarked(sal_True);
375*0deba7fbSSteve Yin }
376*0deba7fbSSteve Yin else
377*0deba7fbSSteve Yin {
378*0deba7fbSSteve Yin pEntry->SetMarked(sal_False);
379*0deba7fbSSteve Yin }
380*0deba7fbSSteve Yin }
381*0deba7fbSSteve Yin }
382*0deba7fbSSteve Yin }
383*0deba7fbSSteve Yin Invalidate();
384*0deba7fbSSteve Yin }
385*0deba7fbSSteve Yin
FreshCurEntry()386*0deba7fbSSteve Yin void SdPageObjsTLB:: FreshCurEntry()
387*0deba7fbSSteve Yin {
388*0deba7fbSSteve Yin SvLBoxEntry* pEntry =NULL;
389*0deba7fbSSteve Yin for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
390*0deba7fbSSteve Yin {
391*0deba7fbSSteve Yin pEntry->SetMarked(sal_False);
392*0deba7fbSSteve Yin }
393*0deba7fbSSteve Yin Invalidate();
394*0deba7fbSSteve Yin }
395*0deba7fbSSteve Yin
396*0deba7fbSSteve Yin class SdContentLBoxString : public SvLBoxString
397*0deba7fbSSteve Yin {
398*0deba7fbSSteve Yin public:
SdContentLBoxString(SvLBoxEntry * pEntry,sal_uInt16 nFlags,const String & rStr)399*0deba7fbSSteve Yin SdContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags,
400*0deba7fbSSteve Yin const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {}
401*0deba7fbSSteve Yin
402*0deba7fbSSteve Yin virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
403*0deba7fbSSteve Yin SvLBoxEntry* pEntry);
404*0deba7fbSSteve Yin };
405*0deba7fbSSteve Yin
InitEntry(SvLBoxEntry * pEntry,const XubString & rStr,const Image & rImg1,const Image & rImg2,SvLBoxButtonKind eButtonKind)406*0deba7fbSSteve Yin void SdPageObjsTLB::InitEntry(SvLBoxEntry* pEntry,
407*0deba7fbSSteve Yin const XubString& rStr ,const Image& rImg1,const Image& rImg2,SvLBoxButtonKind eButtonKind)
408*0deba7fbSSteve Yin {
409*0deba7fbSSteve Yin sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
410*0deba7fbSSteve Yin SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
411*0deba7fbSSteve Yin SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
412*0deba7fbSSteve Yin SdContentLBoxString* pStr = new SdContentLBoxString( pEntry, 0, pCol->GetText() );
413*0deba7fbSSteve Yin pEntry->ReplaceItem( pStr, nColToHilite );
414*0deba7fbSSteve Yin }
415*0deba7fbSSteve Yin
Paint(const Point & rPos,SvLBox & rDev,sal_uInt16 nFlags,SvLBoxEntry * pEntry)416*0deba7fbSSteve Yin void SdContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
417*0deba7fbSSteve Yin SvLBoxEntry* pEntry )
418*0deba7fbSSteve Yin {
419*0deba7fbSSteve Yin // IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
420*0deba7fbSSteve Yin /*
421*0deba7fbSSteve Yin if (pEntry->IsMarked())
422*0deba7fbSSteve Yin {
423*0deba7fbSSteve Yin rDev.DrawText( rPos, GetText() );
424*0deba7fbSSteve Yin XubString str;
425*0deba7fbSSteve Yin str = XubString::CreateFromAscii("*");
426*0deba7fbSSteve Yin Point rPosStar(rPos.X()-6,rPos.Y());
427*0deba7fbSSteve Yin Font aOldFont( rDev.GetFont());
428*0deba7fbSSteve Yin Font aFont(aOldFont);
429*0deba7fbSSteve Yin Color aCol( aOldFont.GetColor() );
430*0deba7fbSSteve Yin aCol.DecreaseLuminance( 200 );
431*0deba7fbSSteve Yin aFont.SetColor( aCol );
432*0deba7fbSSteve Yin rDev.SetFont( aFont );
433*0deba7fbSSteve Yin rDev.DrawText( rPosStar, str);
434*0deba7fbSSteve Yin rDev.SetFont( aOldFont );
435*0deba7fbSSteve Yin }
436*0deba7fbSSteve Yin else
437*0deba7fbSSteve Yin */
438*0deba7fbSSteve Yin SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
439*0deba7fbSSteve Yin
440*0deba7fbSSteve Yin }
441*0deba7fbSSteve Yin
SaveExpandedTreeItemState(SvLBoxEntry * pEntry,vector<String> & vectTreeItem)442*0deba7fbSSteve Yin void SdPageObjsTLB::SaveExpandedTreeItemState(SvLBoxEntry* pEntry, vector<String>& vectTreeItem)
443*0deba7fbSSteve Yin {
444*0deba7fbSSteve Yin if (pEntry)
445*0deba7fbSSteve Yin {
446*0deba7fbSSteve Yin SvLBoxEntry* pListEntry = pEntry;
447*0deba7fbSSteve Yin while (pListEntry)
448*0deba7fbSSteve Yin {
449*0deba7fbSSteve Yin if (pListEntry->HasChilds())
450*0deba7fbSSteve Yin {
451*0deba7fbSSteve Yin if (IsExpanded(pListEntry))
452*0deba7fbSSteve Yin vectTreeItem.push_back(GetEntryText(pListEntry));
453*0deba7fbSSteve Yin SvLBoxEntry* pChildEntry = FirstChild(pListEntry);
454*0deba7fbSSteve Yin SaveExpandedTreeItemState(pChildEntry, vectTreeItem);
455*0deba7fbSSteve Yin }
456*0deba7fbSSteve Yin pListEntry = NextSibling(pListEntry);
457*0deba7fbSSteve Yin }
458*0deba7fbSSteve Yin }
459*0deba7fbSSteve Yin }
Clear()460*0deba7fbSSteve Yin void SdPageObjsTLB::Clear()
461*0deba7fbSSteve Yin {
462*0deba7fbSSteve Yin //Save the expanded tree item
463*0deba7fbSSteve Yin if (mbSaveTreeItemState)
464*0deba7fbSSteve Yin {
465*0deba7fbSSteve Yin maSelectionEntryText = String();
466*0deba7fbSSteve Yin maTreeItem.clear();
467*0deba7fbSSteve Yin if (GetCurEntry())
468*0deba7fbSSteve Yin maSelectionEntryText = GetSelectEntry();
469*0deba7fbSSteve Yin SvLBoxEntry* pEntry = FirstChild(NULL);
470*0deba7fbSSteve Yin SaveExpandedTreeItemState(pEntry, maTreeItem);
471*0deba7fbSSteve Yin }
472*0deba7fbSSteve Yin return SvTreeListBox::Clear();
473*0deba7fbSSteve Yin }
474cdf0e10cSrcweir /*************************************************************************
475cdf0e10cSrcweir |*
476cdf0e10cSrcweir |* return name of object
477cdf0e10cSrcweir |*
478cdf0e10cSrcweir \************************************************************************/
479cdf0e10cSrcweir
GetObjectName(const SdrObject * pObject,const bool bCreate) const480cdf0e10cSrcweir String SdPageObjsTLB::GetObjectName(
481cdf0e10cSrcweir const SdrObject* pObject,
482cdf0e10cSrcweir const bool bCreate) const
483cdf0e10cSrcweir {
484cdf0e10cSrcweir String aRet;
485cdf0e10cSrcweir
486cdf0e10cSrcweir if ( pObject )
487cdf0e10cSrcweir {
488cdf0e10cSrcweir aRet = pObject->GetName();
489cdf0e10cSrcweir
490cdf0e10cSrcweir if( !aRet.Len() && pObject->ISA( SdrOle2Obj ) )
491cdf0e10cSrcweir aRet = static_cast< const SdrOle2Obj* >( pObject )->GetPersistName();
492cdf0e10cSrcweir }
493cdf0e10cSrcweir
494cdf0e10cSrcweir if (bCreate
495cdf0e10cSrcweir && mbShowAllShapes
496cdf0e10cSrcweir && aRet.Len() == 0
497cdf0e10cSrcweir && pObject!=NULL)
498cdf0e10cSrcweir {
499cdf0e10cSrcweir aRet = SdResId(STR_NAVIGATOR_SHAPE_BASE_NAME);
500cdf0e10cSrcweir aRet.SearchAndReplaceAscii("%1", String::CreateFromInt32(pObject->GetOrdNum() + 1));
501cdf0e10cSrcweir }
502cdf0e10cSrcweir
503cdf0e10cSrcweir return aRet;
504cdf0e10cSrcweir }
505cdf0e10cSrcweir
506cdf0e10cSrcweir /*************************************************************************
507cdf0e10cSrcweir |*
508cdf0e10cSrcweir |* In TreeLB Eintrag selektieren
509cdf0e10cSrcweir |*
510cdf0e10cSrcweir \************************************************************************/
511cdf0e10cSrcweir
SelectEntry(const String & rName)512cdf0e10cSrcweir sal_Bool SdPageObjsTLB::SelectEntry( const String& rName )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir sal_Bool bFound = sal_False;
515cdf0e10cSrcweir
516cdf0e10cSrcweir if( rName.Len() )
517cdf0e10cSrcweir {
518cdf0e10cSrcweir SvLBoxEntry* pEntry = NULL;
519cdf0e10cSrcweir String aTmp;
520cdf0e10cSrcweir
521cdf0e10cSrcweir for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) )
522cdf0e10cSrcweir {
523cdf0e10cSrcweir aTmp = GetEntryText( pEntry );
524cdf0e10cSrcweir if( aTmp == rName )
525cdf0e10cSrcweir {
526cdf0e10cSrcweir bFound = sal_True;
527cdf0e10cSrcweir SetCurEntry( pEntry );
528cdf0e10cSrcweir }
529cdf0e10cSrcweir }
530cdf0e10cSrcweir }
531cdf0e10cSrcweir return( bFound );
532cdf0e10cSrcweir }
533cdf0e10cSrcweir
534cdf0e10cSrcweir /*************************************************************************
535cdf0e10cSrcweir |*
536cdf0e10cSrcweir |* Gibt zurueck, ob Childs des uebergebenen Strings selektiert sind
537cdf0e10cSrcweir |*
538cdf0e10cSrcweir \************************************************************************/
539cdf0e10cSrcweir
HasSelectedChilds(const String & rName)540cdf0e10cSrcweir sal_Bool SdPageObjsTLB::HasSelectedChilds( const String& rName )
541cdf0e10cSrcweir {
542cdf0e10cSrcweir sal_Bool bFound = sal_False;
543cdf0e10cSrcweir sal_Bool bChilds = sal_False;
544cdf0e10cSrcweir
545cdf0e10cSrcweir if( rName.Len() )
546cdf0e10cSrcweir {
547cdf0e10cSrcweir SvLBoxEntry* pEntry = NULL;
548cdf0e10cSrcweir String aTmp;
549cdf0e10cSrcweir
550cdf0e10cSrcweir for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) )
551cdf0e10cSrcweir {
552cdf0e10cSrcweir aTmp = GetEntryText( pEntry );
553cdf0e10cSrcweir if( aTmp == rName )
554cdf0e10cSrcweir {
555cdf0e10cSrcweir bFound = sal_True;
556cdf0e10cSrcweir sal_Bool bExpanded = IsExpanded( pEntry );
557cdf0e10cSrcweir long nCount = GetChildSelectionCount( pEntry );
558cdf0e10cSrcweir if( bExpanded && nCount > 0 )
559cdf0e10cSrcweir bChilds = sal_True;
560cdf0e10cSrcweir }
561cdf0e10cSrcweir }
562cdf0e10cSrcweir }
563cdf0e10cSrcweir return( bChilds );
564cdf0e10cSrcweir }
565cdf0e10cSrcweir
566cdf0e10cSrcweir
567cdf0e10cSrcweir /*************************************************************************
568cdf0e10cSrcweir |*
569cdf0e10cSrcweir |* TreeLB mit Seiten und Objekten fuellen
570cdf0e10cSrcweir |*
571cdf0e10cSrcweir \************************************************************************/
572cdf0e10cSrcweir
Fill(const SdDrawDocument * pInDoc,sal_Bool bAllPages,const String & rDocName)573cdf0e10cSrcweir void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, sal_Bool bAllPages,
574cdf0e10cSrcweir const String& rDocName)
575cdf0e10cSrcweir {
576cdf0e10cSrcweir String aSelection;
577cdf0e10cSrcweir if( GetSelectionCount() > 0 )
578cdf0e10cSrcweir {
579cdf0e10cSrcweir aSelection = GetSelectEntry();
580cdf0e10cSrcweir Clear();
581cdf0e10cSrcweir }
582cdf0e10cSrcweir
583cdf0e10cSrcweir mpDoc = pInDoc;
584cdf0e10cSrcweir maDocName = rDocName;
585cdf0e10cSrcweir mbShowAllPages = (bAllPages == sal_True);
586cdf0e10cSrcweir mpMedium = NULL;
587cdf0e10cSrcweir
588cdf0e10cSrcweir SdPage* pPage = NULL;
589cdf0e10cSrcweir
590cdf0e10cSrcweir IconProvider aIconProvider;
591cdf0e10cSrcweir
592cdf0e10cSrcweir // first insert all pages including objects
593cdf0e10cSrcweir sal_uInt16 nPage = 0;
594cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
595cdf0e10cSrcweir
596cdf0e10cSrcweir while( nPage < nMaxPages )
597cdf0e10cSrcweir {
598cdf0e10cSrcweir pPage = (SdPage*) mpDoc->GetPage( nPage );
599cdf0e10cSrcweir if( (mbShowAllPages || pPage->GetPageKind() == PK_STANDARD)
600cdf0e10cSrcweir && !(pPage->GetPageKind()==PK_HANDOUT) ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
601cdf0e10cSrcweir {
602cdf0e10cSrcweir sal_Bool bPageExluded = pPage->IsExcluded();
603cdf0e10cSrcweir
604cdf0e10cSrcweir bool bPageBelongsToShow = PageBelongsToCurrentShow (pPage);
605cdf0e10cSrcweir bPageExluded |= !bPageBelongsToShow;
606cdf0e10cSrcweir
607cdf0e10cSrcweir AddShapeList(*pPage, NULL, pPage->GetName(), bPageExluded, NULL, aIconProvider);
608cdf0e10cSrcweir }
609cdf0e10cSrcweir nPage++;
610cdf0e10cSrcweir }
611cdf0e10cSrcweir
612cdf0e10cSrcweir // dann alle MasterPages incl. Objekte einfuegen
613cdf0e10cSrcweir if( mbShowAllPages )
614cdf0e10cSrcweir {
615cdf0e10cSrcweir nPage = 0;
616cdf0e10cSrcweir const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
617cdf0e10cSrcweir
618cdf0e10cSrcweir while( nPage < nMaxMasterPages )
619cdf0e10cSrcweir {
620cdf0e10cSrcweir pPage = (SdPage*) mpDoc->GetMasterPage( nPage );
621cdf0e10cSrcweir AddShapeList(*pPage, NULL, pPage->GetName(), false, NULL, aIconProvider);
622cdf0e10cSrcweir nPage++;
623cdf0e10cSrcweir }
624cdf0e10cSrcweir }
625cdf0e10cSrcweir if( aSelection.Len() )
626cdf0e10cSrcweir SelectEntry( aSelection );
627*0deba7fbSSteve Yin else if (mbSaveTreeItemState && maSelectionEntryText.Len())
628*0deba7fbSSteve Yin {
629*0deba7fbSSteve Yin SelectEntry(maSelectionEntryText);
630*0deba7fbSSteve Yin }
631cdf0e10cSrcweir }
632cdf0e10cSrcweir
633cdf0e10cSrcweir /*************************************************************************
634cdf0e10cSrcweir |*
635cdf0e10cSrcweir |* Es wird nur der erste Eintrag eingefuegt. Childs werden OnDemand erzeugt
636cdf0e10cSrcweir |*
637cdf0e10cSrcweir \************************************************************************/
638cdf0e10cSrcweir
Fill(const SdDrawDocument * pInDoc,SfxMedium * pInMedium,const String & rDocName)639cdf0e10cSrcweir void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium,
640cdf0e10cSrcweir const String& rDocName )
641cdf0e10cSrcweir {
642cdf0e10cSrcweir mpDoc = pInDoc;
643cdf0e10cSrcweir
644cdf0e10cSrcweir // this object now owns the Medium
645cdf0e10cSrcweir mpMedium = pInMedium;
646cdf0e10cSrcweir maDocName = rDocName;
647cdf0e10cSrcweir
648cdf0e10cSrcweir Image aImgDocOpen=Image( BitmapEx( SdResId( BMP_DOC_OPEN ) ) );
649cdf0e10cSrcweir Image aImgDocClosed=Image( BitmapEx( SdResId( BMP_DOC_CLOSED ) ) );
650cdf0e10cSrcweir Image aImgDocOpenH=Image( BitmapEx( SdResId( BMP_DOC_OPEN_H ) ) );
651cdf0e10cSrcweir Image aImgDocClosedH=Image( BitmapEx( SdResId( BMP_DOC_CLOSED_H ) ) );
652cdf0e10cSrcweir
653cdf0e10cSrcweir // Dokumentnamen einfuegen
654cdf0e10cSrcweir SvLBoxEntry* pFileEntry = InsertEntry( maDocName,
655cdf0e10cSrcweir aImgDocOpen,
656cdf0e10cSrcweir aImgDocClosed,
657cdf0e10cSrcweir NULL,
658cdf0e10cSrcweir sal_True,
659cdf0e10cSrcweir LIST_APPEND,
660cdf0e10cSrcweir reinterpret_cast< void* >( 1 ) );
661cdf0e10cSrcweir
662cdf0e10cSrcweir SetExpandedEntryBmp( pFileEntry, aImgDocOpenH, BMP_COLOR_HIGHCONTRAST );
663cdf0e10cSrcweir SetCollapsedEntryBmp( pFileEntry, aImgDocClosedH, BMP_COLOR_HIGHCONTRAST );
664cdf0e10cSrcweir }
665cdf0e10cSrcweir
666cdf0e10cSrcweir
667cdf0e10cSrcweir
668cdf0e10cSrcweir
AddShapeList(const SdrObjList & rList,SdrObject * pShape,const::rtl::OUString & rsName,const bool bIsExcluded,SvLBoxEntry * pParentEntry,const IconProvider & rIconProvider)669cdf0e10cSrcweir void SdPageObjsTLB::AddShapeList (
670cdf0e10cSrcweir const SdrObjList& rList,
671cdf0e10cSrcweir SdrObject* pShape,
672cdf0e10cSrcweir const ::rtl::OUString& rsName,
673cdf0e10cSrcweir const bool bIsExcluded,
674cdf0e10cSrcweir SvLBoxEntry* pParentEntry,
675cdf0e10cSrcweir const IconProvider& rIconProvider)
676cdf0e10cSrcweir {
677cdf0e10cSrcweir Image aIcon (rIconProvider.maImgPage);
678cdf0e10cSrcweir if (bIsExcluded)
679cdf0e10cSrcweir aIcon = rIconProvider.maImgPageExcl;
680cdf0e10cSrcweir else if (pShape != NULL)
681cdf0e10cSrcweir aIcon = rIconProvider.maImgGroup;
682cdf0e10cSrcweir
683cdf0e10cSrcweir void* pUserData (reinterpret_cast<void*>(1));
684cdf0e10cSrcweir if (pShape != NULL)
685cdf0e10cSrcweir pUserData = pShape;
686cdf0e10cSrcweir
687cdf0e10cSrcweir SvLBoxEntry* pEntry = InsertEntry(
688cdf0e10cSrcweir rsName,
689cdf0e10cSrcweir aIcon,
690cdf0e10cSrcweir aIcon,
691cdf0e10cSrcweir pParentEntry,
692cdf0e10cSrcweir sal_False,
693cdf0e10cSrcweir LIST_APPEND,
694cdf0e10cSrcweir pUserData);
695cdf0e10cSrcweir
696cdf0e10cSrcweir SetExpandedEntryBmp(
697cdf0e10cSrcweir pEntry,
698cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageExclH : rIconProvider.maImgPageH,
699cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST );
700cdf0e10cSrcweir SetCollapsedEntryBmp(
701cdf0e10cSrcweir pEntry,
702cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageExclH : rIconProvider.maImgPageH,
703cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST );
704cdf0e10cSrcweir
705cdf0e10cSrcweir SdrObjListIter aIter(
706cdf0e10cSrcweir rList,
707cdf0e10cSrcweir !rList.HasObjectNavigationOrder() /* use navigation order, if available */,
708cdf0e10cSrcweir IM_FLAT,
709cdf0e10cSrcweir sal_False /*not reverse*/);
710cdf0e10cSrcweir
711*0deba7fbSSteve Yin sal_Bool bMarked=sal_False;
712*0deba7fbSSteve Yin if(bisInSdNavigatorWin)
713*0deba7fbSSteve Yin {
714*0deba7fbSSteve Yin Window* pWindow=NULL;
715*0deba7fbSSteve Yin SdNavigatorWin* pSdNavigatorWin=NULL;
716*0deba7fbSSteve Yin sd::DrawDocShell* pSdDrawDocShell = NULL;
717*0deba7fbSSteve Yin if(pEntry)
718*0deba7fbSSteve Yin pWindow=(Window*)GetParent(pEntry);
719*0deba7fbSSteve Yin if(pWindow)
720*0deba7fbSSteve Yin pSdNavigatorWin = (SdNavigatorWin*)pWindow;
721*0deba7fbSSteve Yin if( pSdNavigatorWin )
722*0deba7fbSSteve Yin pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
723*0deba7fbSSteve Yin if(pSdDrawDocShell)
724*0deba7fbSSteve Yin bMarked=pSdDrawDocShell->IsMarked(pShape);
725*0deba7fbSSteve Yin if(pEntry)
726*0deba7fbSSteve Yin {
727*0deba7fbSSteve Yin if(bMarked)
728*0deba7fbSSteve Yin pEntry->SetMarked(sal_True);
729*0deba7fbSSteve Yin else
730*0deba7fbSSteve Yin pEntry->SetMarked( sal_False );
731*0deba7fbSSteve Yin }
732*0deba7fbSSteve Yin }
733cdf0e10cSrcweir while( aIter.IsMore() )
734cdf0e10cSrcweir {
735cdf0e10cSrcweir SdrObject* pObj = aIter.Next();
736cdf0e10cSrcweir OSL_ASSERT(pObj!=NULL);
737cdf0e10cSrcweir
738cdf0e10cSrcweir // Get the shape name.
739cdf0e10cSrcweir String aStr (GetObjectName( pObj ) );
740cdf0e10cSrcweir
741cdf0e10cSrcweir if( aStr.Len() )
742cdf0e10cSrcweir {
743cdf0e10cSrcweir if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 )
744cdf0e10cSrcweir {
745cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgOle, maImgOle, pEntry,
746cdf0e10cSrcweir sal_False, LIST_APPEND, pObj);
747*0deba7fbSSteve Yin if(bisInSdNavigatorWin)
748*0deba7fbSSteve Yin {
749*0deba7fbSSteve Yin Window* pWindow=NULL;
750*0deba7fbSSteve Yin SdNavigatorWin* pSdNavigatorWin=NULL;
751*0deba7fbSSteve Yin sd::DrawDocShell* pSdDrawDocShell = NULL;
752*0deba7fbSSteve Yin if(pNewEntry)
753*0deba7fbSSteve Yin pWindow=(Window*)GetParent(pNewEntry);
754*0deba7fbSSteve Yin if(pWindow)
755*0deba7fbSSteve Yin pSdNavigatorWin = (SdNavigatorWin*)pWindow;
756*0deba7fbSSteve Yin if( pSdNavigatorWin )
757*0deba7fbSSteve Yin pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
758*0deba7fbSSteve Yin if(pSdDrawDocShell)
759*0deba7fbSSteve Yin bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
760*0deba7fbSSteve Yin if(pNewEntry)
761*0deba7fbSSteve Yin {
762*0deba7fbSSteve Yin if(bMarked)
763*0deba7fbSSteve Yin pNewEntry->SetMarked(sal_True);
764*0deba7fbSSteve Yin else
765*0deba7fbSSteve Yin pNewEntry->SetMarked( sal_False );
766*0deba7fbSSteve Yin }
767*0deba7fbSSteve Yin }
768cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
769cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
770cdf0e10cSrcweir }
771cdf0e10cSrcweir else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF )
772cdf0e10cSrcweir {
773cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgGraphic, maImgGraphic, pEntry,
774cdf0e10cSrcweir sal_False, LIST_APPEND, pObj );
775*0deba7fbSSteve Yin if(bisInSdNavigatorWin)
776*0deba7fbSSteve Yin {
777*0deba7fbSSteve Yin Window* pWindow=NULL;
778*0deba7fbSSteve Yin SdNavigatorWin* pSdNavigatorWin=NULL;
779*0deba7fbSSteve Yin sd::DrawDocShell* pSdDrawDocShell = NULL;
780*0deba7fbSSteve Yin if(pNewEntry)
781*0deba7fbSSteve Yin pWindow=(Window*)GetParent(pNewEntry);
782*0deba7fbSSteve Yin if(pWindow)
783*0deba7fbSSteve Yin pSdNavigatorWin = (SdNavigatorWin*)pWindow;
784*0deba7fbSSteve Yin if( pSdNavigatorWin )
785*0deba7fbSSteve Yin pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
786*0deba7fbSSteve Yin if(pSdDrawDocShell)
787*0deba7fbSSteve Yin bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
788*0deba7fbSSteve Yin if(pNewEntry)
789*0deba7fbSSteve Yin {
790*0deba7fbSSteve Yin if(bMarked)
791*0deba7fbSSteve Yin {
792*0deba7fbSSteve Yin pNewEntry->SetMarked(sal_True);
793*0deba7fbSSteve Yin }
794*0deba7fbSSteve Yin else
795*0deba7fbSSteve Yin {
796*0deba7fbSSteve Yin pNewEntry->SetMarked( sal_False );
797*0deba7fbSSteve Yin }
798*0deba7fbSSteve Yin }
799*0deba7fbSSteve Yin }
800cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
801cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
802cdf0e10cSrcweir }
803cdf0e10cSrcweir else if (pObj->IsGroupObject())
804cdf0e10cSrcweir {
805cdf0e10cSrcweir AddShapeList(
806cdf0e10cSrcweir *pObj->GetSubList(),
807cdf0e10cSrcweir pObj,
808cdf0e10cSrcweir aStr,
809cdf0e10cSrcweir false,
810cdf0e10cSrcweir pEntry,
811cdf0e10cSrcweir rIconProvider);
812cdf0e10cSrcweir }
813cdf0e10cSrcweir else
814cdf0e10cSrcweir {
815cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry( aStr, rIconProvider.maImgObjects, rIconProvider.maImgObjects, pEntry,
816cdf0e10cSrcweir sal_False, LIST_APPEND, pObj );
817*0deba7fbSSteve Yin if(bisInSdNavigatorWin)
818*0deba7fbSSteve Yin {
819*0deba7fbSSteve Yin Window* pWindow=NULL;
820*0deba7fbSSteve Yin SdNavigatorWin* pSdNavigatorWin=NULL;
821*0deba7fbSSteve Yin sd::DrawDocShell* pSdDrawDocShell = NULL;
822*0deba7fbSSteve Yin if(pNewEntry)
823*0deba7fbSSteve Yin pWindow=(Window*)GetParent(pNewEntry);
824*0deba7fbSSteve Yin if(pWindow)
825*0deba7fbSSteve Yin pSdNavigatorWin = (SdNavigatorWin*)pWindow;
826*0deba7fbSSteve Yin if( pSdNavigatorWin )
827*0deba7fbSSteve Yin pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
828*0deba7fbSSteve Yin if(pSdDrawDocShell)
829*0deba7fbSSteve Yin bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
830*0deba7fbSSteve Yin if(pNewEntry)
831*0deba7fbSSteve Yin {
832*0deba7fbSSteve Yin if(bMarked)
833*0deba7fbSSteve Yin {
834*0deba7fbSSteve Yin pNewEntry->SetMarked(sal_True);
835*0deba7fbSSteve Yin }
836*0deba7fbSSteve Yin else
837*0deba7fbSSteve Yin {
838*0deba7fbSSteve Yin pNewEntry->SetMarked( sal_False );
839*0deba7fbSSteve Yin }
840*0deba7fbSSteve Yin }
841*0deba7fbSSteve Yin }
842cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST );
843cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST );
844cdf0e10cSrcweir }
845cdf0e10cSrcweir }
846cdf0e10cSrcweir }
847cdf0e10cSrcweir
848cdf0e10cSrcweir if( pEntry->HasChilds() )
849cdf0e10cSrcweir {
850cdf0e10cSrcweir SetExpandedEntryBmp(
851cdf0e10cSrcweir pEntry,
852cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs);
853cdf0e10cSrcweir SetCollapsedEntryBmp(
854cdf0e10cSrcweir pEntry,
855cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs);
856cdf0e10cSrcweir SetExpandedEntryBmp(
857cdf0e10cSrcweir pEntry,
858cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH,
859cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST);
860cdf0e10cSrcweir SetCollapsedEntryBmp(
861cdf0e10cSrcweir pEntry,
862cdf0e10cSrcweir bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH,
863cdf0e10cSrcweir BMP_COLOR_HIGHCONTRAST);
864*0deba7fbSSteve Yin if (mbSaveTreeItemState)
865*0deba7fbSSteve Yin {
866*0deba7fbSSteve Yin vector<String>:: iterator iteStart = maTreeItem.begin();
867*0deba7fbSSteve Yin while (iteStart != maTreeItem.end())
868*0deba7fbSSteve Yin {
869*0deba7fbSSteve Yin String strEntry = GetEntryText(pEntry);
870*0deba7fbSSteve Yin if (*iteStart == strEntry)
871*0deba7fbSSteve Yin {
872*0deba7fbSSteve Yin Expand( pEntry );
873*0deba7fbSSteve Yin break;
874*0deba7fbSSteve Yin }
875*0deba7fbSSteve Yin ++iteStart;
876*0deba7fbSSteve Yin }
877*0deba7fbSSteve Yin }
878*0deba7fbSSteve Yin else
879*0deba7fbSSteve Yin Expand( pEntry );
880cdf0e10cSrcweir }
881cdf0e10cSrcweir }
882cdf0e10cSrcweir
883cdf0e10cSrcweir
884cdf0e10cSrcweir
885cdf0e10cSrcweir
SetShowAllShapes(const bool bShowAllShapes,const bool bFillList)886cdf0e10cSrcweir void SdPageObjsTLB::SetShowAllShapes (
887cdf0e10cSrcweir const bool bShowAllShapes,
888cdf0e10cSrcweir const bool bFillList)
889cdf0e10cSrcweir {
890cdf0e10cSrcweir mbShowAllShapes = bShowAllShapes;
891cdf0e10cSrcweir if (bFillList)
892cdf0e10cSrcweir {
893cdf0e10cSrcweir if (mpMedium == NULL)
894cdf0e10cSrcweir Fill(mpDoc, mbShowAllPages, maDocName);
895cdf0e10cSrcweir else
896cdf0e10cSrcweir Fill(mpDoc, mpMedium, maDocName);
897cdf0e10cSrcweir }
898cdf0e10cSrcweir }
899cdf0e10cSrcweir
900cdf0e10cSrcweir
901cdf0e10cSrcweir
902cdf0e10cSrcweir
GetShowAllShapes(void) const903cdf0e10cSrcweir bool SdPageObjsTLB::GetShowAllShapes (void) const
904cdf0e10cSrcweir {
905cdf0e10cSrcweir return mbShowAllShapes;
906cdf0e10cSrcweir }
907cdf0e10cSrcweir
908cdf0e10cSrcweir
909cdf0e10cSrcweir
910cdf0e10cSrcweir
911cdf0e10cSrcweir /*************************************************************************
912cdf0e10cSrcweir |*
913cdf0e10cSrcweir |* Prueft, ob die Seiten (PK_STANDARD) und die darauf befindlichen Objekte
914cdf0e10cSrcweir |* des Docs und der TreeLB identisch sind.
915cdf0e10cSrcweir |* Wird ein Doc uebergeben, wird dieses zum aktuellem Doc (Wichtig bei
916cdf0e10cSrcweir |* mehreren Documenten).
917cdf0e10cSrcweir |*
918cdf0e10cSrcweir \************************************************************************/
919cdf0e10cSrcweir
IsEqualToDoc(const SdDrawDocument * pInDoc)920cdf0e10cSrcweir sal_Bool SdPageObjsTLB::IsEqualToDoc( const SdDrawDocument* pInDoc )
921cdf0e10cSrcweir {
922cdf0e10cSrcweir if( pInDoc )
923cdf0e10cSrcweir mpDoc = pInDoc;
924cdf0e10cSrcweir
925cdf0e10cSrcweir if( !mpDoc )
926cdf0e10cSrcweir return( sal_False );
927cdf0e10cSrcweir
928cdf0e10cSrcweir SdrObject* pObj = NULL;
929cdf0e10cSrcweir SdPage* pPage = NULL;
930cdf0e10cSrcweir SvLBoxEntry* pEntry = First();
931cdf0e10cSrcweir String aName;
932cdf0e10cSrcweir
933cdf0e10cSrcweir // Alle Pages incl. Objekte vergleichen
934cdf0e10cSrcweir sal_uInt16 nPage = 0;
935cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
936cdf0e10cSrcweir
937cdf0e10cSrcweir while( nPage < nMaxPages )
938cdf0e10cSrcweir {
939cdf0e10cSrcweir pPage = (SdPage*) mpDoc->GetPage( nPage );
940cdf0e10cSrcweir if( pPage->GetPageKind() == PK_STANDARD )
941cdf0e10cSrcweir {
942cdf0e10cSrcweir if( !pEntry )
943cdf0e10cSrcweir return( sal_False );
944cdf0e10cSrcweir aName = GetEntryText( pEntry );
945cdf0e10cSrcweir
946cdf0e10cSrcweir if( pPage->GetName() != aName )
947cdf0e10cSrcweir return( sal_False );
948cdf0e10cSrcweir
949cdf0e10cSrcweir pEntry = Next( pEntry );
950cdf0e10cSrcweir
951cdf0e10cSrcweir SdrObjListIter aIter(
952cdf0e10cSrcweir *pPage,
953cdf0e10cSrcweir !pPage->HasObjectNavigationOrder() /* use navigation order, if available */,
954cdf0e10cSrcweir IM_DEEPWITHGROUPS );
955cdf0e10cSrcweir
956cdf0e10cSrcweir while( aIter.IsMore() )
957cdf0e10cSrcweir {
958cdf0e10cSrcweir pObj = aIter.Next();
959cdf0e10cSrcweir
960cdf0e10cSrcweir const String aObjectName( GetObjectName( pObj ) );
961cdf0e10cSrcweir
962cdf0e10cSrcweir if( aObjectName.Len() )
963cdf0e10cSrcweir {
964cdf0e10cSrcweir if( !pEntry )
965cdf0e10cSrcweir return( sal_False );
966cdf0e10cSrcweir
967cdf0e10cSrcweir aName = GetEntryText( pEntry );
968cdf0e10cSrcweir
969cdf0e10cSrcweir if( aObjectName != aName )
970cdf0e10cSrcweir return( sal_False );
971cdf0e10cSrcweir
972cdf0e10cSrcweir pEntry = Next( pEntry );
973cdf0e10cSrcweir }
974cdf0e10cSrcweir }
975cdf0e10cSrcweir }
976cdf0e10cSrcweir nPage++;
977cdf0e10cSrcweir }
978cdf0e10cSrcweir // Wenn noch Eintraege in der Listbox vorhanden sind, wurden
979cdf0e10cSrcweir // Objekte (mit Namen) oder Seiten geloescht
980cdf0e10cSrcweir return( !pEntry );
981cdf0e10cSrcweir }
982cdf0e10cSrcweir
983cdf0e10cSrcweir /*************************************************************************
984cdf0e10cSrcweir |*
985cdf0e10cSrcweir |* Selectierten String zurueckgeben
986cdf0e10cSrcweir |*
987cdf0e10cSrcweir \************************************************************************/
988cdf0e10cSrcweir
GetSelectEntry()989cdf0e10cSrcweir String SdPageObjsTLB::GetSelectEntry()
990cdf0e10cSrcweir {
991cdf0e10cSrcweir return( GetEntryText( GetCurEntry() ) );
992cdf0e10cSrcweir }
993cdf0e10cSrcweir
994cdf0e10cSrcweir /*************************************************************************
995cdf0e10cSrcweir |*
996cdf0e10cSrcweir |* Selektierte Eintrage zurueckgeben
997cdf0e10cSrcweir |* nDepth == 0 -> Seiten
998cdf0e10cSrcweir |* nDepth == 1 -> Objekte
999cdf0e10cSrcweir |*
1000cdf0e10cSrcweir \************************************************************************/
1001cdf0e10cSrcweir
GetSelectEntryList(sal_uInt16 nDepth)1002cdf0e10cSrcweir List* SdPageObjsTLB::GetSelectEntryList( sal_uInt16 nDepth )
1003cdf0e10cSrcweir {
1004cdf0e10cSrcweir List* pList = NULL;
1005cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstSelected();
1006cdf0e10cSrcweir
1007cdf0e10cSrcweir while( pEntry )
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir sal_uInt16 nListDepth = GetModel()->GetDepth( pEntry );
1010cdf0e10cSrcweir if( nListDepth == nDepth )
1011cdf0e10cSrcweir {
1012cdf0e10cSrcweir if( !pList )
1013cdf0e10cSrcweir pList = new List();
1014cdf0e10cSrcweir
1015cdf0e10cSrcweir const String aEntryText( GetEntryText( pEntry ) );
1016cdf0e10cSrcweir pList->Insert( new String( aEntryText ), LIST_APPEND );
1017cdf0e10cSrcweir }
1018cdf0e10cSrcweir pEntry = NextSelected( pEntry );
1019cdf0e10cSrcweir }
1020cdf0e10cSrcweir
1021cdf0e10cSrcweir return( pList );
1022cdf0e10cSrcweir }
1023cdf0e10cSrcweir
1024cdf0e10cSrcweir /*************************************************************************
1025cdf0e10cSrcweir |*
1026cdf0e10cSrcweir |* Eintraege werden erst auf Anforderung (Doppelklick) eingefuegt
1027cdf0e10cSrcweir |*
1028cdf0e10cSrcweir \************************************************************************/
1029cdf0e10cSrcweir
RequestingChilds(SvLBoxEntry * pFileEntry)1030cdf0e10cSrcweir void SdPageObjsTLB::RequestingChilds( SvLBoxEntry* pFileEntry )
1031cdf0e10cSrcweir {
1032cdf0e10cSrcweir if( !pFileEntry->HasChilds() )
1033cdf0e10cSrcweir {
1034cdf0e10cSrcweir if( GetBookmarkDoc() )
1035cdf0e10cSrcweir {
1036cdf0e10cSrcweir SdrObject* pObj = NULL;
1037cdf0e10cSrcweir SdPage* pPage = NULL;
1038cdf0e10cSrcweir SvLBoxEntry* pPageEntry = NULL;
1039cdf0e10cSrcweir
1040cdf0e10cSrcweir Image aImgPage=Image( BitmapEx( SdResId( BMP_PAGE ) ) );
1041cdf0e10cSrcweir Image aImgPageObjs=Image( BitmapEx( SdResId( BMP_PAGEOBJS ) ) );
1042cdf0e10cSrcweir Image aImgObjects=Image( BitmapEx( SdResId( BMP_OBJECTS ) ) );
1043cdf0e10cSrcweir Image aImgPageH=Image( BitmapEx( SdResId( BMP_PAGE_H ) ) );
1044cdf0e10cSrcweir Image aImgPageObjsH=Image( BitmapEx( SdResId( BMP_PAGEOBJS_H ) ) );
1045cdf0e10cSrcweir Image aImgObjectsH=Image( BitmapEx( SdResId( BMP_OBJECTS_H ) ) );
1046cdf0e10cSrcweir
1047cdf0e10cSrcweir // document name already inserted
1048cdf0e10cSrcweir
1049cdf0e10cSrcweir // only insert all "normal" ? slides with objects
1050cdf0e10cSrcweir sal_uInt16 nPage = 0;
1051cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpBookmarkDoc->GetPageCount();
1052cdf0e10cSrcweir
1053cdf0e10cSrcweir while( nPage < nMaxPages )
1054cdf0e10cSrcweir {
1055cdf0e10cSrcweir pPage = (SdPage*) mpBookmarkDoc->GetPage( nPage );
1056cdf0e10cSrcweir if( pPage->GetPageKind() == PK_STANDARD )
1057cdf0e10cSrcweir {
1058cdf0e10cSrcweir pPageEntry = InsertEntry( pPage->GetName(),
1059cdf0e10cSrcweir aImgPage,
1060cdf0e10cSrcweir aImgPage,
1061cdf0e10cSrcweir pFileEntry,
1062cdf0e10cSrcweir sal_False,
1063cdf0e10cSrcweir LIST_APPEND,
1064cdf0e10cSrcweir reinterpret_cast< void* >( 1 ) );
1065cdf0e10cSrcweir
1066cdf0e10cSrcweir SetExpandedEntryBmp( pPageEntry, aImgPageH, BMP_COLOR_HIGHCONTRAST );
1067cdf0e10cSrcweir SetCollapsedEntryBmp( pPageEntry, aImgPageH, BMP_COLOR_HIGHCONTRAST );
1068cdf0e10cSrcweir
1069cdf0e10cSrcweir SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
1070cdf0e10cSrcweir
1071cdf0e10cSrcweir while( aIter.IsMore() )
1072cdf0e10cSrcweir {
1073cdf0e10cSrcweir pObj = aIter.Next();
1074cdf0e10cSrcweir String aStr( GetObjectName( pObj ) );
1075cdf0e10cSrcweir if( aStr.Len() )
1076cdf0e10cSrcweir {
1077cdf0e10cSrcweir if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 )
1078cdf0e10cSrcweir {
1079cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry(aStr, maImgOle, maImgOle, pPageEntry);
1080cdf0e10cSrcweir
1081cdf0e10cSrcweir
1082cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
1083cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
1084cdf0e10cSrcweir }
1085cdf0e10cSrcweir else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF )
1086cdf0e10cSrcweir {
1087cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry(aStr, maImgGraphic, maImgGraphic, pPageEntry);
1088cdf0e10cSrcweir
1089cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
1090cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
1091cdf0e10cSrcweir }
1092cdf0e10cSrcweir else
1093cdf0e10cSrcweir {
1094cdf0e10cSrcweir SvLBoxEntry* pNewEntry = InsertEntry(aStr, aImgObjects, aImgObjects, pPageEntry);
1095cdf0e10cSrcweir
1096cdf0e10cSrcweir SetExpandedEntryBmp( pNewEntry, aImgObjectsH, BMP_COLOR_HIGHCONTRAST );
1097cdf0e10cSrcweir SetCollapsedEntryBmp( pNewEntry, aImgObjectsH, BMP_COLOR_HIGHCONTRAST );
1098cdf0e10cSrcweir }
1099cdf0e10cSrcweir }
1100cdf0e10cSrcweir }
1101cdf0e10cSrcweir if( pPageEntry->HasChilds() )
1102cdf0e10cSrcweir {
1103cdf0e10cSrcweir SetExpandedEntryBmp( pPageEntry, aImgPageObjs );
1104cdf0e10cSrcweir SetCollapsedEntryBmp( pPageEntry, aImgPageObjs );
1105cdf0e10cSrcweir SetExpandedEntryBmp( pPageEntry, aImgPageObjsH, BMP_COLOR_HIGHCONTRAST );
1106cdf0e10cSrcweir SetCollapsedEntryBmp( pPageEntry, aImgPageObjsH, BMP_COLOR_HIGHCONTRAST );
1107cdf0e10cSrcweir }
1108cdf0e10cSrcweir }
1109cdf0e10cSrcweir nPage++;
1110cdf0e10cSrcweir }
1111cdf0e10cSrcweir }
1112cdf0e10cSrcweir }
1113cdf0e10cSrcweir else
1114cdf0e10cSrcweir SvTreeListBox::RequestingChilds( pFileEntry );
1115cdf0e10cSrcweir }
1116cdf0e10cSrcweir
1117cdf0e10cSrcweir /*************************************************************************
1118cdf0e10cSrcweir |*
1119cdf0e10cSrcweir |* Prueft, ob es sich um eine Draw-Datei handelt und oeffnet anhand des
1120cdf0e10cSrcweir |* uebergebenen Docs das BookmarkDoc
1121cdf0e10cSrcweir |*
1122cdf0e10cSrcweir \************************************************************************/
1123cdf0e10cSrcweir
GetBookmarkDoc(SfxMedium * pMed)1124cdf0e10cSrcweir SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed)
1125cdf0e10cSrcweir {
1126cdf0e10cSrcweir if (
1127cdf0e10cSrcweir !mpBookmarkDoc ||
1128cdf0e10cSrcweir (pMed && (!mpOwnMedium || mpOwnMedium->GetName() != pMed->GetName()))
1129cdf0e10cSrcweir )
1130cdf0e10cSrcweir {
1131cdf0e10cSrcweir // create a new BookmarkDoc if now one exists or if a new Medium is provided
1132cdf0e10cSrcweir if (mpOwnMedium != pMed)
1133cdf0e10cSrcweir {
1134cdf0e10cSrcweir CloseBookmarkDoc();
1135cdf0e10cSrcweir }
1136cdf0e10cSrcweir
1137cdf0e10cSrcweir if (pMed)
1138cdf0e10cSrcweir {
1139cdf0e10cSrcweir // it looks that it is undefined if a Medium was set by Fill() allready
1140cdf0e10cSrcweir DBG_ASSERT( !mpMedium, "SfxMedium confusion!" );
1141cdf0e10cSrcweir delete mpMedium;
1142cdf0e10cSrcweir mpMedium = NULL;
1143cdf0e10cSrcweir
1144cdf0e10cSrcweir // take over this Medium (currently used only be Navigator)
1145cdf0e10cSrcweir mpOwnMedium = pMed;
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir
1148cdf0e10cSrcweir DBG_ASSERT( mpMedium || pMed, "No SfxMedium provided!" );
1149cdf0e10cSrcweir
1150cdf0e10cSrcweir if( pMed )
1151cdf0e10cSrcweir {
1152cdf0e10cSrcweir // in this mode the document is also owned and controlled by this instance
1153cdf0e10cSrcweir mxBookmarkDocShRef = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_True);
1154cdf0e10cSrcweir if (mxBookmarkDocShRef->DoLoad(pMed))
1155cdf0e10cSrcweir mpBookmarkDoc = mxBookmarkDocShRef->GetDoc();
1156cdf0e10cSrcweir else
1157cdf0e10cSrcweir mpBookmarkDoc = NULL;
1158cdf0e10cSrcweir }
1159cdf0e10cSrcweir else if ( mpMedium )
1160cdf0e10cSrcweir // in this mode the document is owned and controlled by the SdDrawDocument
1161cdf0e10cSrcweir // it can be released by calling the corresponding CloseBookmarkDoc method
1162cdf0e10cSrcweir // successfull creation of a document makes this the owner of the medium
1163cdf0e10cSrcweir mpBookmarkDoc = ((SdDrawDocument*) mpDoc)->OpenBookmarkDoc(*mpMedium);
1164cdf0e10cSrcweir
1165cdf0e10cSrcweir if ( !mpBookmarkDoc )
1166cdf0e10cSrcweir {
1167cdf0e10cSrcweir ErrorBox aErrorBox( this, WB_OK, String( SdResId( STR_READ_DATA_ERROR ) ) );
1168cdf0e10cSrcweir aErrorBox.Execute();
1169cdf0e10cSrcweir mpMedium = 0; //On failure the SfxMedium is invalid
1170cdf0e10cSrcweir }
1171cdf0e10cSrcweir }
1172cdf0e10cSrcweir
1173cdf0e10cSrcweir return( mpBookmarkDoc );
1174cdf0e10cSrcweir }
1175cdf0e10cSrcweir
1176cdf0e10cSrcweir /*************************************************************************
1177cdf0e10cSrcweir |*
1178cdf0e10cSrcweir |* Bookmark-Dokument schlie�en und loeschen
1179cdf0e10cSrcweir |*
1180cdf0e10cSrcweir \************************************************************************/
1181cdf0e10cSrcweir
CloseBookmarkDoc()1182cdf0e10cSrcweir void SdPageObjsTLB::CloseBookmarkDoc()
1183cdf0e10cSrcweir {
1184cdf0e10cSrcweir if (mxBookmarkDocShRef.Is())
1185cdf0e10cSrcweir {
1186cdf0e10cSrcweir mxBookmarkDocShRef->DoClose();
1187cdf0e10cSrcweir mxBookmarkDocShRef.Clear();
1188cdf0e10cSrcweir
1189cdf0e10cSrcweir // Medium is owned by document, so it's destroyed already
1190cdf0e10cSrcweir mpOwnMedium = 0;
1191cdf0e10cSrcweir }
1192cdf0e10cSrcweir else if ( mpBookmarkDoc )
1193cdf0e10cSrcweir {
1194cdf0e10cSrcweir DBG_ASSERT( !mpOwnMedium, "SfxMedium confusion!" );
1195cdf0e10cSrcweir if ( mpDoc )
1196cdf0e10cSrcweir {
1197cdf0e10cSrcweir // The document owns the Medium, so the Medium will be invalid after closing the document
1198cdf0e10cSrcweir ((SdDrawDocument*) mpDoc)->CloseBookmarkDoc();
1199cdf0e10cSrcweir mpMedium = 0;
1200cdf0e10cSrcweir }
1201cdf0e10cSrcweir }
1202cdf0e10cSrcweir else
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir // perhaps mpOwnMedium provided, but no successfull creation of BookmarkDoc
1205cdf0e10cSrcweir delete mpOwnMedium;
1206cdf0e10cSrcweir mpOwnMedium = NULL;
1207cdf0e10cSrcweir }
1208cdf0e10cSrcweir
1209cdf0e10cSrcweir mpBookmarkDoc = NULL;
1210cdf0e10cSrcweir }
1211cdf0e10cSrcweir
1212cdf0e10cSrcweir /*************************************************************************
1213cdf0e10cSrcweir |*
1214cdf0e10cSrcweir |*
1215cdf0e10cSrcweir |*
1216cdf0e10cSrcweir \************************************************************************/
1217cdf0e10cSrcweir
SelectHdl()1218cdf0e10cSrcweir void SdPageObjsTLB::SelectHdl()
1219cdf0e10cSrcweir {
1220cdf0e10cSrcweir SvLBoxEntry* pEntry = FirstSelected();
1221cdf0e10cSrcweir
1222cdf0e10cSrcweir mbLinkableSelected = sal_True;
1223cdf0e10cSrcweir
1224cdf0e10cSrcweir while( pEntry && mbLinkableSelected )
1225cdf0e10cSrcweir {
1226cdf0e10cSrcweir if( NULL == pEntry->GetUserData() )
1227cdf0e10cSrcweir mbLinkableSelected = sal_False;
1228cdf0e10cSrcweir
1229cdf0e10cSrcweir pEntry = NextSelected( pEntry );
1230cdf0e10cSrcweir }
1231cdf0e10cSrcweir
1232cdf0e10cSrcweir SvTreeListBox::SelectHdl();
1233cdf0e10cSrcweir }
1234cdf0e10cSrcweir
1235cdf0e10cSrcweir /*************************************************************************
1236cdf0e10cSrcweir |*
1237cdf0e10cSrcweir |* Ueberlaedt RETURN mit der Funktionsweise von DoubleClick
1238cdf0e10cSrcweir |*
1239cdf0e10cSrcweir \************************************************************************/
1240cdf0e10cSrcweir
KeyInput(const KeyEvent & rKEvt)1241cdf0e10cSrcweir void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt )
1242cdf0e10cSrcweir {
1243cdf0e10cSrcweir if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN )
1244cdf0e10cSrcweir {
1245cdf0e10cSrcweir // Auskommentierter Code aus svtools/source/contnr/svimpbox.cxx
1246cdf0e10cSrcweir SvLBoxEntry* pCursor = GetCurEntry();
1247cdf0e10cSrcweir if( pCursor->HasChilds() || pCursor->HasChildsOnDemand() )
1248cdf0e10cSrcweir {
1249cdf0e10cSrcweir if( IsExpanded( pCursor ) )
1250cdf0e10cSrcweir Collapse( pCursor );
1251cdf0e10cSrcweir else
1252cdf0e10cSrcweir Expand( pCursor );
1253cdf0e10cSrcweir }
1254cdf0e10cSrcweir
1255cdf0e10cSrcweir DoubleClickHdl();
1256cdf0e10cSrcweir }
1257*0deba7fbSSteve Yin else if (rKEvt.GetKeyCode().GetCode() == KEY_SPACE)
1258*0deba7fbSSteve Yin {
1259*0deba7fbSSteve Yin if(bisInSdNavigatorWin)
1260*0deba7fbSSteve Yin {
1261*0deba7fbSSteve Yin sal_Bool bMarked=sal_False;
1262*0deba7fbSSteve Yin SvLBoxEntry* pNewEntry = GetCurEntry();
1263*0deba7fbSSteve Yin if( GetParent(pNewEntry) == NULL )
1264*0deba7fbSSteve Yin return;
1265*0deba7fbSSteve Yin String aStr=GetSelectEntry();
1266*0deba7fbSSteve Yin Window* pWindow=NULL;
1267*0deba7fbSSteve Yin SdNavigatorWin* pSdNavigatorWin=NULL;
1268*0deba7fbSSteve Yin sd::DrawDocShell* pSdDrawDocShell = NULL;
1269*0deba7fbSSteve Yin if(pNewEntry)
1270*0deba7fbSSteve Yin pWindow=(Window*)GetParent(pNewEntry);
1271*0deba7fbSSteve Yin if(pWindow)
1272*0deba7fbSSteve Yin pSdNavigatorWin = (SdNavigatorWin*)pWindow;
1273*0deba7fbSSteve Yin if( pSdNavigatorWin )
1274*0deba7fbSSteve Yin pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
1275*0deba7fbSSteve Yin if(pSdDrawDocShell)
1276*0deba7fbSSteve Yin {
1277*0deba7fbSSteve Yin pSdDrawDocShell->GotoTreeBookmark(aStr);
1278*0deba7fbSSteve Yin bMarked=pSdDrawDocShell->GetObjectIsmarked(aStr);
1279*0deba7fbSSteve Yin }
1280*0deba7fbSSteve Yin //Removed by yanjun for sym2_6385
1281*0deba7fbSSteve Yin //The symphony2.0 can support morn than one level tree list, also support to select tow or more items in different level.
1282*0deba7fbSSteve Yin /*
1283*0deba7fbSSteve Yin SvLBoxEntry* pBeginEntry = First();
1284*0deba7fbSSteve Yin if( pBeginEntry )
1285*0deba7fbSSteve Yin {
1286*0deba7fbSSteve Yin if( GetParent(pBeginEntry) != GetParent(pNewEntry) )
1287*0deba7fbSSteve Yin pBeginEntry->SetMarked( sal_False );
1288*0deba7fbSSteve Yin SvLBoxEntry* pNextEntry = Next( pBeginEntry );
1289*0deba7fbSSteve Yin while( pNextEntry )
1290*0deba7fbSSteve Yin {
1291*0deba7fbSSteve Yin if( GetParent(pNextEntry) != GetParent(pNewEntry) )
1292*0deba7fbSSteve Yin pNextEntry->SetMarked( sal_False );
1293*0deba7fbSSteve Yin pNextEntry = Next( pNextEntry );
1294*0deba7fbSSteve Yin }
1295*0deba7fbSSteve Yin }
1296*0deba7fbSSteve Yin End*/
1297*0deba7fbSSteve Yin if(pNewEntry)
1298*0deba7fbSSteve Yin {
1299*0deba7fbSSteve Yin if(bMarked)
1300*0deba7fbSSteve Yin {
1301*0deba7fbSSteve Yin pNewEntry->SetMarked(sal_True);
1302*0deba7fbSSteve Yin }
1303*0deba7fbSSteve Yin else
1304*0deba7fbSSteve Yin {
1305*0deba7fbSSteve Yin pNewEntry->SetMarked( sal_False );
1306*0deba7fbSSteve Yin }
1307*0deba7fbSSteve Yin }
1308*0deba7fbSSteve Yin Invalidate();
1309*0deba7fbSSteve Yin }
1310*0deba7fbSSteve Yin }
1311cdf0e10cSrcweir else
1312cdf0e10cSrcweir SvTreeListBox::KeyInput( rKEvt );
1313cdf0e10cSrcweir }
1314cdf0e10cSrcweir
1315cdf0e10cSrcweir /*************************************************************************
1316cdf0e10cSrcweir |*
1317cdf0e10cSrcweir |* StartDrag-Request
1318cdf0e10cSrcweir |*
1319cdf0e10cSrcweir \************************************************************************/
1320cdf0e10cSrcweir
StartDrag(sal_Int8 nAction,const Point & rPosPixel)1321cdf0e10cSrcweir void SdPageObjsTLB::StartDrag( sal_Int8 nAction, const Point& rPosPixel)
1322cdf0e10cSrcweir {
1323cdf0e10cSrcweir (void)nAction;
1324cdf0e10cSrcweir (void)rPosPixel;
1325cdf0e10cSrcweir
1326cdf0e10cSrcweir SdNavigatorWin* pNavWin = NULL;
1327cdf0e10cSrcweir SvLBoxEntry* pEntry = GetEntry(rPosPixel);
1328cdf0e10cSrcweir
1329cdf0e10cSrcweir if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
1330cdf0e10cSrcweir pNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) );
1331cdf0e10cSrcweir
1332cdf0e10cSrcweir if (pEntry != NULL
1333cdf0e10cSrcweir && pNavWin !=NULL
1334cdf0e10cSrcweir && pNavWin == mpParent
1335cdf0e10cSrcweir && pNavWin->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE )
1336cdf0e10cSrcweir {
1337cdf0e10cSrcweir // Mark only the children of the page under the mouse as drop
1338cdf0e10cSrcweir // targets. This prevents moving shapes from one page to another.
1339cdf0e10cSrcweir
1340cdf0e10cSrcweir // Select all entries and disable them as drop targets.
1341cdf0e10cSrcweir SetSelectionMode(MULTIPLE_SELECTION);
1342cdf0e10cSrcweir SetCursor(NULL, sal_False);
1343cdf0e10cSrcweir SelectAll(sal_True, sal_False);
1344cdf0e10cSrcweir EnableSelectionAsDropTarget(sal_False, sal_True);
1345cdf0e10cSrcweir
1346cdf0e10cSrcweir // Enable only the entries as drop targets that are children of the
1347cdf0e10cSrcweir // page under the mouse.
1348cdf0e10cSrcweir SvLBoxEntry* pParent = GetRootLevelParent(pEntry);
1349cdf0e10cSrcweir if (pParent != NULL)
1350cdf0e10cSrcweir {
1351cdf0e10cSrcweir SelectAll(sal_False, sal_False);
1352cdf0e10cSrcweir Select(pParent, sal_True);
1353cdf0e10cSrcweir // for (SvLBoxEntry*pChild=FirstChild(pParent); pChild!=NULL; pChild=NextSibling(pChild))
1354cdf0e10cSrcweir // Select(pChild, sal_True);
1355cdf0e10cSrcweir EnableSelectionAsDropTarget(sal_True, sal_True);//sal_False);
1356cdf0e10cSrcweir }
1357cdf0e10cSrcweir
1358cdf0e10cSrcweir // Set selection back to the entry under the mouse.
1359cdf0e10cSrcweir SelectAll(sal_False,sal_False);
1360cdf0e10cSrcweir SetSelectionMode(SINGLE_SELECTION);
1361cdf0e10cSrcweir Select(pEntry, sal_True);
1362cdf0e10cSrcweir
1363cdf0e10cSrcweir // Aus dem ExecuteDrag heraus kann der Navigator geloescht werden
1364cdf0e10cSrcweir // (beim Umschalten auf einen anderen Dokument-Typ), das wuerde aber
1365cdf0e10cSrcweir // den StarView MouseMove-Handler, der Command() aufruft, umbringen.
1366cdf0e10cSrcweir // Deshalb Drag&Drop asynchron:
1367cdf0e10cSrcweir Application::PostUserEvent( STATIC_LINK( this, SdPageObjsTLB, ExecDragHdl ) );
1368cdf0e10cSrcweir }
1369cdf0e10cSrcweir }
1370cdf0e10cSrcweir
1371cdf0e10cSrcweir /*************************************************************************
1372cdf0e10cSrcweir |*
1373cdf0e10cSrcweir |* Begin drag
1374cdf0e10cSrcweir |*
1375cdf0e10cSrcweir \************************************************************************/
1376cdf0e10cSrcweir
DoDrag()1377cdf0e10cSrcweir void SdPageObjsTLB::DoDrag()
1378cdf0e10cSrcweir {
1379cdf0e10cSrcweir mpDropNavWin = ( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) ?
1380cdf0e10cSrcweir (SdNavigatorWin*)( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ) :
1381cdf0e10cSrcweir NULL;
1382cdf0e10cSrcweir
1383cdf0e10cSrcweir if( mpDropNavWin )
1384cdf0e10cSrcweir {
1385cdf0e10cSrcweir ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
1386cdf0e10cSrcweir String aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INET_PROT_FILE ).GetMainURL( INetURLObject::NO_DECODE );
1387cdf0e10cSrcweir NavigatorDragType eDragType = mpDropNavWin->GetNavigatorDragType();
1388cdf0e10cSrcweir
1389cdf0e10cSrcweir aURL.Append( '#' );
1390cdf0e10cSrcweir aURL.Append( GetSelectEntry() );
1391cdf0e10cSrcweir
1392cdf0e10cSrcweir INetBookmark aBookmark( aURL, GetSelectEntry() );
1393cdf0e10cSrcweir sal_Int8 nDNDActions = DND_ACTION_COPYMOVE;
1394cdf0e10cSrcweir
1395cdf0e10cSrcweir if( eDragType == NAVIGATOR_DRAGTYPE_LINK )
1396cdf0e10cSrcweir nDNDActions = DND_ACTION_LINK; // #93240# Either COPY *or* LINK, never both!
1397cdf0e10cSrcweir else if (mpDoc->GetSdPageCount(PK_STANDARD) == 1)
1398cdf0e10cSrcweir {
1399cdf0e10cSrcweir // Can not move away the last slide in a document.
1400cdf0e10cSrcweir nDNDActions = DND_ACTION_COPY;
1401cdf0e10cSrcweir }
1402cdf0e10cSrcweir
1403cdf0e10cSrcweir SvTreeListBox::ReleaseMouse();
1404cdf0e10cSrcweir
1405cdf0e10cSrcweir bIsInDrag = sal_True;
1406cdf0e10cSrcweir
1407cdf0e10cSrcweir SvLBoxDDInfo aDDInfo;
1408cdf0e10cSrcweir memset(&aDDInfo,0,sizeof(SvLBoxDDInfo));
1409cdf0e10cSrcweir aDDInfo.pApp = GetpApp();
1410cdf0e10cSrcweir aDDInfo.pSource = this;
1411cdf0e10cSrcweir // aDDInfo.pDDStartEntry = pEntry;
1412cdf0e10cSrcweir ::com::sun::star::uno::Sequence<sal_Int8> aSequence (sizeof(SvLBoxDDInfo));
1413cdf0e10cSrcweir memcpy(aSequence.getArray(), (sal_Char*)&aDDInfo, sizeof(SvLBoxDDInfo));
1414cdf0e10cSrcweir ::com::sun::star::uno::Any aTreeListBoxData (aSequence);
1415cdf0e10cSrcweir
1416cdf0e10cSrcweir // object is destroyed by internal reference mechanism
1417cdf0e10cSrcweir SdTransferable* pTransferable = new SdPageObjsTLB::SdPageObjsTransferable(
1418cdf0e10cSrcweir *this, aBookmark, *pDocShell, eDragType, aTreeListBoxData);
1419cdf0e10cSrcweir
1420cdf0e10cSrcweir // Get the view.
1421cdf0e10cSrcweir ::sd::ViewShell* pViewShell = GetViewShellForDocShell(*pDocShell);
1422cdf0e10cSrcweir if (pViewShell == NULL)
1423cdf0e10cSrcweir {
1424cdf0e10cSrcweir OSL_ASSERT(pViewShell!=NULL);
1425cdf0e10cSrcweir return;
1426cdf0e10cSrcweir }
1427cdf0e10cSrcweir sd::View* pView = pViewShell->GetView();
1428cdf0e10cSrcweir if (pView == NULL)
1429cdf0e10cSrcweir {
1430cdf0e10cSrcweir OSL_ASSERT(pView!=NULL);
1431cdf0e10cSrcweir return;
1432cdf0e10cSrcweir }
1433cdf0e10cSrcweir
1434cdf0e10cSrcweir SdrObject* pObject = NULL;
1435cdf0e10cSrcweir void* pUserData = GetCurEntry()->GetUserData();
1436cdf0e10cSrcweir if (pUserData != NULL && pUserData != (void*)1)
1437cdf0e10cSrcweir pObject = reinterpret_cast<SdrObject*>(pUserData);
1438cdf0e10cSrcweir if (pObject != NULL)
1439cdf0e10cSrcweir {
1440cdf0e10cSrcweir // For shapes without a user supplied name (the automatically
1441cdf0e10cSrcweir // created name does not count), a different drag and drop technique
1442cdf0e10cSrcweir // is used.
1443cdf0e10cSrcweir if (GetObjectName(pObject, false).Len() == 0)
1444cdf0e10cSrcweir {
1445cdf0e10cSrcweir AddShapeToTransferable(*pTransferable, *pObject);
1446cdf0e10cSrcweir pTransferable->SetView(pView);
1447cdf0e10cSrcweir SD_MOD()->pTransferDrag = pTransferable;
1448cdf0e10cSrcweir }
1449cdf0e10cSrcweir
1450cdf0e10cSrcweir // Unnamed shapes have to be selected to be recognized by the
1451cdf0e10cSrcweir // current drop implementation. In order to have a consistent
1452cdf0e10cSrcweir // behaviour for all shapes, every shape that is to be dragged is
1453cdf0e10cSrcweir // selected first.
1454cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1455cdf0e10cSrcweir pView->UnmarkAllObj(pPageView);
1456cdf0e10cSrcweir pView->MarkObj(pObject, pPageView);
1457cdf0e10cSrcweir }
1458cdf0e10cSrcweir else
1459cdf0e10cSrcweir {
1460cdf0e10cSrcweir pTransferable->SetView(pView);
1461cdf0e10cSrcweir SD_MOD()->pTransferDrag = pTransferable;
1462cdf0e10cSrcweir }
1463cdf0e10cSrcweir
1464cdf0e10cSrcweir pTransferable->StartDrag( this, nDNDActions );
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir }
1467cdf0e10cSrcweir
1468cdf0e10cSrcweir /*************************************************************************
1469cdf0e10cSrcweir |*
1470cdf0e10cSrcweir |* Drag finished
1471cdf0e10cSrcweir |*
1472cdf0e10cSrcweir \************************************************************************/
1473cdf0e10cSrcweir
OnDragFinished(sal_uInt8)1474cdf0e10cSrcweir void SdPageObjsTLB::OnDragFinished( sal_uInt8 )
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
1477cdf0e10cSrcweir {
1478cdf0e10cSrcweir SdNavigatorWin* pNewNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) );
1479cdf0e10cSrcweir
1480cdf0e10cSrcweir if( mpDropNavWin == pNewNavWin)
1481cdf0e10cSrcweir {
1482cdf0e10cSrcweir MouseEvent aMEvt( mpDropNavWin->GetPointerPosPixel() );
1483cdf0e10cSrcweir SvTreeListBox::MouseButtonUp( aMEvt );
1484cdf0e10cSrcweir }
1485cdf0e10cSrcweir }
1486cdf0e10cSrcweir
1487cdf0e10cSrcweir mpDropNavWin = NULL;
1488cdf0e10cSrcweir bIsInDrag = sal_False;
1489cdf0e10cSrcweir }
1490cdf0e10cSrcweir
1491cdf0e10cSrcweir /*************************************************************************
1492cdf0e10cSrcweir |*
1493cdf0e10cSrcweir |* AcceptDrop-Event
1494cdf0e10cSrcweir |*
1495cdf0e10cSrcweir \************************************************************************/
1496cdf0e10cSrcweir
AcceptDrop(const AcceptDropEvent & rEvent)1497cdf0e10cSrcweir sal_Int8 SdPageObjsTLB::AcceptDrop (const AcceptDropEvent& rEvent)
1498cdf0e10cSrcweir {
1499cdf0e10cSrcweir sal_Int8 nResult (DND_ACTION_NONE);
1500cdf0e10cSrcweir
1501cdf0e10cSrcweir if ( !bIsInDrag && IsDropFormatSupported( FORMAT_FILE ) )
1502cdf0e10cSrcweir {
1503cdf0e10cSrcweir nResult = rEvent.mnAction;
1504cdf0e10cSrcweir }
1505cdf0e10cSrcweir else
1506cdf0e10cSrcweir {
1507cdf0e10cSrcweir SvLBoxEntry* pEntry = GetDropTarget(rEvent.maPosPixel);
1508cdf0e10cSrcweir if (rEvent.mbLeaving || !CheckDragAndDropMode( this, rEvent.mnAction ))
1509cdf0e10cSrcweir {
1510cdf0e10cSrcweir ImplShowTargetEmphasis( pTargetEntry, sal_False );
1511cdf0e10cSrcweir }
1512cdf0e10cSrcweir else if( !nDragDropMode )
1513cdf0e10cSrcweir {
1514cdf0e10cSrcweir DBG_ERRORFILE( "SdPageObjsTLB::AcceptDrop(): no target" );
1515cdf0e10cSrcweir }
1516cdf0e10cSrcweir else if (IsDropAllowed(pEntry))
1517cdf0e10cSrcweir {
1518cdf0e10cSrcweir nResult = DND_ACTION_MOVE;
1519cdf0e10cSrcweir
1520cdf0e10cSrcweir // Draw emphasis.
1521cdf0e10cSrcweir if (pEntry != pTargetEntry || !(nImpFlags & SVLBOX_TARGEMPH_VIS))
1522cdf0e10cSrcweir {
1523cdf0e10cSrcweir ImplShowTargetEmphasis( pTargetEntry, sal_False );
1524cdf0e10cSrcweir pTargetEntry = pEntry;
1525cdf0e10cSrcweir ImplShowTargetEmphasis( pTargetEntry, sal_True );
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir }
1528cdf0e10cSrcweir }
1529cdf0e10cSrcweir
1530cdf0e10cSrcweir // Hide emphasis when there is no valid drop action.
1531cdf0e10cSrcweir if (nResult == DND_ACTION_NONE)
1532cdf0e10cSrcweir ImplShowTargetEmphasis(pTargetEntry, sal_False);
1533cdf0e10cSrcweir
1534cdf0e10cSrcweir return nResult;
1535cdf0e10cSrcweir }
1536cdf0e10cSrcweir
1537cdf0e10cSrcweir /*************************************************************************
1538cdf0e10cSrcweir |*
1539cdf0e10cSrcweir |* ExecuteDrop-Event
1540cdf0e10cSrcweir |*
1541cdf0e10cSrcweir \************************************************************************/
1542cdf0e10cSrcweir
ExecuteDrop(const ExecuteDropEvent & rEvt)1543cdf0e10cSrcweir sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt )
1544cdf0e10cSrcweir {
1545cdf0e10cSrcweir sal_Int8 nRet = DND_ACTION_NONE;
1546cdf0e10cSrcweir
1547cdf0e10cSrcweir try
1548cdf0e10cSrcweir {
1549cdf0e10cSrcweir if( !bIsInDrag )
1550cdf0e10cSrcweir {
1551cdf0e10cSrcweir SdNavigatorWin* pNavWin = NULL;
1552cdf0e10cSrcweir sal_uInt16 nId = SID_NAVIGATOR;
1553cdf0e10cSrcweir
1554cdf0e10cSrcweir if( mpFrame->HasChildWindow( nId ) )
1555cdf0e10cSrcweir pNavWin = (SdNavigatorWin*)( mpFrame->GetChildWindow( nId )->GetContextWindow( SD_MOD() ) );
1556cdf0e10cSrcweir
1557cdf0e10cSrcweir if( pNavWin && ( pNavWin == mpParent ) )
1558cdf0e10cSrcweir {
1559cdf0e10cSrcweir TransferableDataHelper aDataHelper( rEvt.maDropEvent.Transferable );
1560cdf0e10cSrcweir String aFile;
1561cdf0e10cSrcweir
1562cdf0e10cSrcweir if( aDataHelper.GetString( FORMAT_FILE, aFile ) &&
1563cdf0e10cSrcweir ( (SdNavigatorWin*) mpParent)->InsertFile( aFile ) )
1564cdf0e10cSrcweir {
1565cdf0e10cSrcweir nRet = rEvt.mnAction;
1566cdf0e10cSrcweir }
1567cdf0e10cSrcweir }
1568cdf0e10cSrcweir }
1569cdf0e10cSrcweir }
1570cdf0e10cSrcweir catch (com::sun::star::uno::Exception&)
1571cdf0e10cSrcweir {
1572cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
1573cdf0e10cSrcweir }
1574cdf0e10cSrcweir
1575cdf0e10cSrcweir if (nRet == DND_ACTION_NONE)
1576cdf0e10cSrcweir SvTreeListBox::ExecuteDrop(rEvt, this);
1577cdf0e10cSrcweir
1578cdf0e10cSrcweir
1579cdf0e10cSrcweir return nRet;
1580cdf0e10cSrcweir }
1581cdf0e10cSrcweir
1582cdf0e10cSrcweir /*************************************************************************
1583cdf0e10cSrcweir |*
1584cdf0e10cSrcweir |* Handler fuers Dragging
1585cdf0e10cSrcweir |*
1586cdf0e10cSrcweir \************************************************************************/
1587cdf0e10cSrcweir
IMPL_STATIC_LINK(SdPageObjsTLB,ExecDragHdl,void *,EMPTYARG)1588cdf0e10cSrcweir IMPL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*, EMPTYARG)
1589cdf0e10cSrcweir {
1590cdf0e10cSrcweir // als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch der
1591cdf0e10cSrcweir // Navigator geloescht werden darf
1592cdf0e10cSrcweir pThis->DoDrag();
1593cdf0e10cSrcweir return 0;
1594cdf0e10cSrcweir }
1595cdf0e10cSrcweir
1596cdf0e10cSrcweir
PageBelongsToCurrentShow(const SdPage * pPage) const1597cdf0e10cSrcweir bool SdPageObjsTLB::PageBelongsToCurrentShow (const SdPage* pPage) const
1598cdf0e10cSrcweir {
1599cdf0e10cSrcweir // Return <TRUE/> as default when there is no custom show or when none
1600cdf0e10cSrcweir // is used. The page does then belong to the standard show.
1601cdf0e10cSrcweir bool bBelongsToShow = true;
1602cdf0e10cSrcweir
1603cdf0e10cSrcweir if (mpDoc->getPresentationSettings().mbCustomShow)
1604cdf0e10cSrcweir {
1605cdf0e10cSrcweir // Get the current custom show.
1606cdf0e10cSrcweir SdCustomShow* pCustomShow = NULL;
1607cdf0e10cSrcweir List* pShowList = const_cast<SdDrawDocument*>(mpDoc)->GetCustomShowList();
1608cdf0e10cSrcweir if (pShowList != NULL)
1609cdf0e10cSrcweir {
1610cdf0e10cSrcweir sal_uLong nCurrentShowIndex = pShowList->GetCurPos();
1611cdf0e10cSrcweir void* pObject = pShowList->GetObject(nCurrentShowIndex);
1612cdf0e10cSrcweir pCustomShow = static_cast<SdCustomShow*>(pObject);
1613cdf0e10cSrcweir }
1614cdf0e10cSrcweir
1615cdf0e10cSrcweir // Check whether the given page is part of that custom show.
1616cdf0e10cSrcweir if (pCustomShow != NULL)
1617cdf0e10cSrcweir {
1618cdf0e10cSrcweir bBelongsToShow = false;
1619cdf0e10cSrcweir sal_uLong nPageCount = pCustomShow->Count();
1620cdf0e10cSrcweir for (sal_uInt16 i=0; i<nPageCount && !bBelongsToShow; i++)
1621cdf0e10cSrcweir if (pPage == static_cast<SdPage*>(pCustomShow->GetObject (i)))
1622cdf0e10cSrcweir bBelongsToShow = true;
1623cdf0e10cSrcweir }
1624cdf0e10cSrcweir }
1625cdf0e10cSrcweir
1626cdf0e10cSrcweir return bBelongsToShow;
1627cdf0e10cSrcweir }
1628cdf0e10cSrcweir
1629cdf0e10cSrcweir
1630cdf0e10cSrcweir
1631cdf0e10cSrcweir
NotifyMoving(SvLBoxEntry * pTarget,SvLBoxEntry * pEntry,SvLBoxEntry * & rpNewParent,sal_uLong & rNewChildPos)1632cdf0e10cSrcweir sal_Bool SdPageObjsTLB::NotifyMoving(
1633cdf0e10cSrcweir SvLBoxEntry* pTarget,
1634cdf0e10cSrcweir SvLBoxEntry* pEntry,
1635cdf0e10cSrcweir SvLBoxEntry*& rpNewParent,
1636cdf0e10cSrcweir sal_uLong& rNewChildPos)
1637cdf0e10cSrcweir {
1638cdf0e10cSrcweir SvLBoxEntry* pDestination = pTarget;
1639cdf0e10cSrcweir while (GetParent(pDestination) != NULL && GetParent(GetParent(pDestination)) != NULL)
1640cdf0e10cSrcweir pDestination = GetParent(pDestination);
1641cdf0e10cSrcweir
1642cdf0e10cSrcweir SdrObject* pTargetObject = reinterpret_cast<SdrObject*>(pDestination->GetUserData());
1643cdf0e10cSrcweir SdrObject* pSourceObject = reinterpret_cast<SdrObject*>(pEntry->GetUserData());
1644cdf0e10cSrcweir if (pSourceObject == reinterpret_cast<SdrObject*>(1))
1645cdf0e10cSrcweir pSourceObject = NULL;
1646cdf0e10cSrcweir
1647cdf0e10cSrcweir if (pTargetObject != NULL && pSourceObject != NULL)
1648cdf0e10cSrcweir {
1649cdf0e10cSrcweir SdrPage* pObjectList = pSourceObject->GetPage();
1650cdf0e10cSrcweir if (pObjectList != NULL)
1651cdf0e10cSrcweir {
1652cdf0e10cSrcweir sal_uInt32 nNewPosition;
1653cdf0e10cSrcweir if (pTargetObject == reinterpret_cast<SdrObject*>(1))
1654cdf0e10cSrcweir nNewPosition = 0;
1655cdf0e10cSrcweir else
1656cdf0e10cSrcweir nNewPosition = pTargetObject->GetNavigationPosition() + 1;
1657cdf0e10cSrcweir pObjectList->SetObjectNavigationPosition(*pSourceObject, nNewPosition);
1658cdf0e10cSrcweir }
1659cdf0e10cSrcweir
1660cdf0e10cSrcweir // Update the tree list.
1661cdf0e10cSrcweir if (pTarget == NULL)
1662cdf0e10cSrcweir {
1663cdf0e10cSrcweir rpNewParent = 0;
1664cdf0e10cSrcweir rNewChildPos = 0;
1665cdf0e10cSrcweir return sal_True;
1666cdf0e10cSrcweir }
1667cdf0e10cSrcweir else if (GetParent(pDestination) == NULL)
1668cdf0e10cSrcweir {
1669cdf0e10cSrcweir rpNewParent = pDestination;
1670cdf0e10cSrcweir rNewChildPos = 0;
1671cdf0e10cSrcweir }
1672cdf0e10cSrcweir else
1673cdf0e10cSrcweir {
1674cdf0e10cSrcweir rpNewParent = GetParent(pDestination);
1675cdf0e10cSrcweir rNewChildPos = pModel->GetRelPos(pDestination) + 1;
1676cdf0e10cSrcweir rNewChildPos += nCurEntrySelPos;
1677cdf0e10cSrcweir nCurEntrySelPos++;
1678cdf0e10cSrcweir }
1679cdf0e10cSrcweir return sal_True;
1680cdf0e10cSrcweir }
1681cdf0e10cSrcweir else
1682cdf0e10cSrcweir return sal_False;
1683cdf0e10cSrcweir }
1684cdf0e10cSrcweir
1685cdf0e10cSrcweir
1686cdf0e10cSrcweir
1687cdf0e10cSrcweir
GetDropTarget(const Point & rLocation)1688cdf0e10cSrcweir SvLBoxEntry* SdPageObjsTLB::GetDropTarget (const Point& rLocation)
1689cdf0e10cSrcweir {
1690cdf0e10cSrcweir SvLBoxEntry* pEntry = SvTreeListBox::GetDropTarget(rLocation);
1691cdf0e10cSrcweir if (pEntry == NULL)
1692cdf0e10cSrcweir return NULL;
1693cdf0e10cSrcweir
1694cdf0e10cSrcweir if (GetParent(pEntry) == NULL)
1695cdf0e10cSrcweir {
1696cdf0e10cSrcweir // Use page entry as insertion position.
1697cdf0e10cSrcweir }
1698cdf0e10cSrcweir else
1699cdf0e10cSrcweir {
1700cdf0e10cSrcweir // Go to second hierarchy level, i.e. top level shapes,
1701cdf0e10cSrcweir // i.e. children of pages.
1702cdf0e10cSrcweir while (GetParent(pEntry) != NULL && GetParent(GetParent(pEntry)) != NULL)
1703cdf0e10cSrcweir pEntry = GetParent(pEntry);
1704cdf0e10cSrcweir
1705cdf0e10cSrcweir // Advance to next sibling.
1706cdf0e10cSrcweir SvLBoxEntry* pNext;
1707cdf0e10cSrcweir sal_uInt16 nDepth (0);
1708cdf0e10cSrcweir while (pEntry != NULL)
1709cdf0e10cSrcweir {
1710cdf0e10cSrcweir pNext = dynamic_cast<SvLBoxEntry*>(NextVisible(pEntry, &nDepth));
1711cdf0e10cSrcweir if (pNext != NULL && nDepth > 0 && nDepth!=0xffff)
1712cdf0e10cSrcweir pEntry = pNext;
1713cdf0e10cSrcweir else
1714cdf0e10cSrcweir break;
1715cdf0e10cSrcweir }
1716cdf0e10cSrcweir }
1717cdf0e10cSrcweir
1718cdf0e10cSrcweir return pEntry;
1719cdf0e10cSrcweir }
1720cdf0e10cSrcweir
1721cdf0e10cSrcweir
1722cdf0e10cSrcweir
1723cdf0e10cSrcweir
IsDropAllowed(SvLBoxEntry * pEntry)1724cdf0e10cSrcweir bool SdPageObjsTLB::IsDropAllowed (SvLBoxEntry* pEntry)
1725cdf0e10cSrcweir {
1726cdf0e10cSrcweir if (pEntry == NULL)
1727cdf0e10cSrcweir return false;
1728cdf0e10cSrcweir
1729cdf0e10cSrcweir if ( ! IsDropFormatSupported(SdPageObjsTransferable::GetListBoxDropFormatId()))
1730cdf0e10cSrcweir return false;
1731cdf0e10cSrcweir
1732cdf0e10cSrcweir if ((pEntry->GetFlags() & SV_ENTRYFLAG_DISABLE_DROP) != 0)
1733cdf0e10cSrcweir return false;
1734cdf0e10cSrcweir
1735cdf0e10cSrcweir return true;
1736cdf0e10cSrcweir }
1737cdf0e10cSrcweir
1738cdf0e10cSrcweir
1739cdf0e10cSrcweir
1740cdf0e10cSrcweir
AddShapeToTransferable(SdTransferable & rTransferable,SdrObject & rObject) const1741cdf0e10cSrcweir void SdPageObjsTLB::AddShapeToTransferable (
1742cdf0e10cSrcweir SdTransferable& rTransferable,
1743cdf0e10cSrcweir SdrObject& rObject) const
1744cdf0e10cSrcweir {
1745cdf0e10cSrcweir TransferableObjectDescriptor aObjectDescriptor;
1746cdf0e10cSrcweir bool bIsDescriptorFillingPending (true);
1747cdf0e10cSrcweir
1748cdf0e10cSrcweir const SdrOle2Obj* pOleObject = dynamic_cast<const SdrOle2Obj*>(&rObject);
1749cdf0e10cSrcweir if (pOleObject != NULL && pOleObject->GetObjRef().is())
1750cdf0e10cSrcweir {
1751cdf0e10cSrcweir // If object has no persistence it must be copied as part of the document
1752cdf0e10cSrcweir try
1753cdf0e10cSrcweir {
1754cdf0e10cSrcweir uno::Reference< embed::XEmbedPersist > xPersObj (pOleObject->GetObjRef(), uno::UNO_QUERY );
1755cdf0e10cSrcweir if (xPersObj.is() && xPersObj->hasEntry())
1756cdf0e10cSrcweir {
1757cdf0e10cSrcweir SvEmbedTransferHelper::FillTransferableObjectDescriptor(
1758cdf0e10cSrcweir aObjectDescriptor,
1759cdf0e10cSrcweir pOleObject->GetObjRef(),
1760cdf0e10cSrcweir pOleObject->GetGraphic(),
1761cdf0e10cSrcweir pOleObject->GetAspect());
1762cdf0e10cSrcweir bIsDescriptorFillingPending = false;
1763cdf0e10cSrcweir }
1764cdf0e10cSrcweir }
1765cdf0e10cSrcweir catch( uno::Exception& )
1766cdf0e10cSrcweir {
1767cdf0e10cSrcweir }
1768cdf0e10cSrcweir }
1769cdf0e10cSrcweir
1770cdf0e10cSrcweir ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
1771cdf0e10cSrcweir if (bIsDescriptorFillingPending && pDocShell!=NULL)
1772cdf0e10cSrcweir {
1773cdf0e10cSrcweir bIsDescriptorFillingPending = false;
1774cdf0e10cSrcweir pDocShell->FillTransferableObjectDescriptor(aObjectDescriptor);
1775cdf0e10cSrcweir }
1776cdf0e10cSrcweir
1777cdf0e10cSrcweir Point aDragPos (rObject.GetCurrentBoundRect().Center());
1778cdf0e10cSrcweir //Point aDragPos (0,0);
1779cdf0e10cSrcweir aObjectDescriptor.maDragStartPos = aDragPos;
1780cdf0e10cSrcweir // aObjectDescriptor.maSize = GetAllMarkedRect().GetSize();
1781cdf0e10cSrcweir if (pDocShell != NULL)
1782cdf0e10cSrcweir aObjectDescriptor.maDisplayName = pDocShell->GetMedium()->GetURLObject().GetURLNoPass();
1783cdf0e10cSrcweir else
1784cdf0e10cSrcweir aObjectDescriptor.maDisplayName = String();
1785cdf0e10cSrcweir aObjectDescriptor.mbCanLink = sal_False;
1786cdf0e10cSrcweir
1787cdf0e10cSrcweir rTransferable.SetStartPos(aDragPos);
1788cdf0e10cSrcweir rTransferable.SetObjectDescriptor( aObjectDescriptor );
1789cdf0e10cSrcweir }
1790cdf0e10cSrcweir
1791cdf0e10cSrcweir
1792cdf0e10cSrcweir
1793cdf0e10cSrcweir
GetViewShellForDocShell(::sd::DrawDocShell & rDocShell)1794cdf0e10cSrcweir ::sd::ViewShell* SdPageObjsTLB::GetViewShellForDocShell (::sd::DrawDocShell& rDocShell)
1795cdf0e10cSrcweir {
1796cdf0e10cSrcweir {
1797cdf0e10cSrcweir ::sd::ViewShell* pViewShell = rDocShell.GetViewShell();
1798cdf0e10cSrcweir if (pViewShell != NULL)
1799cdf0e10cSrcweir return pViewShell;
1800cdf0e10cSrcweir }
1801cdf0e10cSrcweir
1802cdf0e10cSrcweir try
1803cdf0e10cSrcweir {
1804cdf0e10cSrcweir // Get a component enumeration from the desktop and search it for documents.
1805cdf0e10cSrcweir uno::Reference<lang::XMultiServiceFactory> xFactory (
1806cdf0e10cSrcweir ::comphelper::getProcessServiceFactory ());
1807cdf0e10cSrcweir if ( ! xFactory.is())
1808cdf0e10cSrcweir return NULL;
1809cdf0e10cSrcweir
1810cdf0e10cSrcweir uno::Reference<frame::XDesktop> xDesktop (xFactory->createInstance (
1811cdf0e10cSrcweir ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), uno::UNO_QUERY);
1812cdf0e10cSrcweir if ( ! xDesktop.is())
1813cdf0e10cSrcweir return NULL;
1814cdf0e10cSrcweir
1815cdf0e10cSrcweir uno::Reference<frame::XFramesSupplier> xFrameSupplier (xDesktop, uno::UNO_QUERY);
1816cdf0e10cSrcweir if ( ! xFrameSupplier.is())
1817cdf0e10cSrcweir return NULL;
1818cdf0e10cSrcweir
1819cdf0e10cSrcweir uno::Reference<container::XIndexAccess> xFrameAccess (xFrameSupplier->getFrames(), uno::UNO_QUERY);
1820cdf0e10cSrcweir if ( ! xFrameAccess.is())
1821cdf0e10cSrcweir return NULL;
1822cdf0e10cSrcweir
1823cdf0e10cSrcweir for (sal_Int32 nIndex=0,nCount=xFrameAccess->getCount(); nIndex<nCount; ++nIndex)
1824cdf0e10cSrcweir {
1825cdf0e10cSrcweir uno::Reference<frame::XFrame> xFrame;
1826cdf0e10cSrcweir if ( ! (xFrameAccess->getByIndex(nIndex) >>= xFrame))
1827cdf0e10cSrcweir continue;
1828cdf0e10cSrcweir
1829cdf0e10cSrcweir ::sd::DrawController* pController = dynamic_cast<sd::DrawController*>(xFrame->getController().get());
1830cdf0e10cSrcweir if (pController == NULL)
1831cdf0e10cSrcweir continue;
1832cdf0e10cSrcweir ::sd::ViewShellBase* pBase = pController->GetViewShellBase();
1833cdf0e10cSrcweir if (pBase == NULL)
1834cdf0e10cSrcweir continue;
1835cdf0e10cSrcweir if (pBase->GetDocShell() != &rDocShell)
1836cdf0e10cSrcweir continue;
1837cdf0e10cSrcweir
1838cdf0e10cSrcweir const ::boost::shared_ptr<sd::ViewShell> pViewShell (pBase->GetMainViewShell());
1839cdf0e10cSrcweir if (pViewShell)
1840cdf0e10cSrcweir return pViewShell.get();
1841cdf0e10cSrcweir }
1842cdf0e10cSrcweir }
1843cdf0e10cSrcweir catch (uno::Exception e)
1844cdf0e10cSrcweir {
1845cdf0e10cSrcweir // When there is an exception then simply use the default value of
1846cdf0e10cSrcweir // bIsEnabled and disable the controls.
1847cdf0e10cSrcweir }
1848cdf0e10cSrcweir return NULL;
1849cdf0e10cSrcweir }
1850cdf0e10cSrcweir
1851cdf0e10cSrcweir
1852cdf0e10cSrcweir
1853cdf0e10cSrcweir
1854cdf0e10cSrcweir //===== IconProvider ==========================================================
1855cdf0e10cSrcweir
IconProvider(void)1856cdf0e10cSrcweir SdPageObjsTLB::IconProvider::IconProvider (void)
1857cdf0e10cSrcweir : maImgPage( BitmapEx( SdResId( BMP_PAGE ) ) ),
1858cdf0e10cSrcweir maImgPageExcl( BitmapEx( SdResId( BMP_PAGE_EXCLUDED ) ) ),
1859cdf0e10cSrcweir maImgPageObjsExcl( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED ) ) ),
1860cdf0e10cSrcweir maImgPageObjs( BitmapEx( SdResId( BMP_PAGEOBJS ) ) ),
1861cdf0e10cSrcweir maImgObjects( BitmapEx( SdResId( BMP_OBJECTS ) ) ),
1862cdf0e10cSrcweir maImgGroup( BitmapEx( SdResId( BMP_GROUP ) ) ),
1863cdf0e10cSrcweir
1864cdf0e10cSrcweir maImgPageH( BitmapEx( SdResId( BMP_PAGE_H ) ) ),
1865cdf0e10cSrcweir maImgPageExclH( BitmapEx( SdResId( BMP_PAGE_EXCLUDED_H ) ) ),
1866cdf0e10cSrcweir maImgPageObjsExclH( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED_H ) ) ),
1867cdf0e10cSrcweir maImgPageObjsH( BitmapEx( SdResId( BMP_PAGEOBJS_H ) ) ),
1868cdf0e10cSrcweir maImgObjectsH( BitmapEx( SdResId( BMP_OBJECTS_H ) ) ),
1869cdf0e10cSrcweir maImgGroupH( BitmapEx( SdResId( BMP_GROUP_H ) ) )
1870cdf0e10cSrcweir {
1871cdf0e10cSrcweir }
1872