xref: /trunk/main/sd/source/ui/dlg/sdtreelb.cxx (revision 5133a0b6c3d4f5a724ce23eb9b4d0cc4961fa174)
15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
35b190011SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
55b190011SAndrew Rist  * distributed with this work for additional information
65b190011SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
75b190011SAndrew Rist  * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist  * "License"); you may not use this file except in compliance
95b190011SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
115b190011SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
135b190011SAndrew Rist  * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist  * software distributed under the License is distributed on an
155b190011SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist  * KIND, either express or implied.  See the License for the
175b190011SAndrew Rist  * specific language governing permissions and limitations
185b190011SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
205b190011SAndrew Rist  *************************************************************/
215b190011SAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_sd.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <sal/types.h>
26cdf0e10cSrcweir #include <sot/formats.hxx>
27cdf0e10cSrcweir #include <sot/storage.hxx>
28cdf0e10cSrcweir #include <vcl/msgbox.hxx>
29cdf0e10cSrcweir #include <svl/urihelper.hxx>
30cdf0e10cSrcweir #include <svx/svditer.hxx>
31cdf0e10cSrcweir #include <sfx2/docfile.hxx>
32cdf0e10cSrcweir #include <svx/svdoole2.hxx>
33cdf0e10cSrcweir #include <vcl/svapp.hxx>
34cdf0e10cSrcweir #include "cusshow.hxx"
35cdf0e10cSrcweir #include <sfx2/childwin.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include "strmname.h"
40cdf0e10cSrcweir #include "sdtreelb.hxx"
41cdf0e10cSrcweir #include "DrawDocShell.hxx"
42cdf0e10cSrcweir #include "drawdoc.hxx"
43cdf0e10cSrcweir #include "sdpage.hxx"
44cdf0e10cSrcweir #include "sdresid.hxx"
45cdf0e10cSrcweir #include "navigatr.hxx"
46cdf0e10cSrcweir #ifndef _SD_CFGID_HXX
47cdf0e10cSrcweir #include "strings.hrc"
48cdf0e10cSrcweir #endif
49cdf0e10cSrcweir #include "res_bmp.hrc"
50cdf0e10cSrcweir #include "ViewShell.hxx"
51cdf0e10cSrcweir #include "DrawController.hxx"
52cdf0e10cSrcweir #include "ViewShellBase.hxx"
53cdf0e10cSrcweir 
54cdf0e10cSrcweir #include <com/sun/star/embed/XEmbedPersist.hpp>
55cdf0e10cSrcweir #include <com/sun/star/frame/XDesktop.hpp>
56cdf0e10cSrcweir #include <com/sun/star/frame/XFramesSupplier.hpp>
57cdf0e10cSrcweir #include <svtools/embedtransfer.hxx>
58cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
59cdf0e10cSrcweir #include <tools/diagnose_ex.h>
60cdf0e10cSrcweir 
61cdf0e10cSrcweir using namespace com::sun::star;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir class SdPageObjsTLB::IconProvider
64cdf0e10cSrcweir {
65cdf0e10cSrcweir public:
66cdf0e10cSrcweir     IconProvider (void);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     // Regular icons.
69cdf0e10cSrcweir     Image maImgPage;
70cdf0e10cSrcweir     Image maImgPageExcl;
71cdf0e10cSrcweir     Image maImgPageObjsExcl;
72cdf0e10cSrcweir     Image maImgPageObjs;
73cdf0e10cSrcweir     Image maImgObjects;
74cdf0e10cSrcweir     Image maImgGroup;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     // High contrast icons.
77cdf0e10cSrcweir     Image maImgPageH;
78cdf0e10cSrcweir     Image maImgPageExclH;
79cdf0e10cSrcweir     Image maImgPageObjsExclH;
80cdf0e10cSrcweir     Image maImgPageObjsH;
81cdf0e10cSrcweir     Image maImgObjectsH;
82cdf0e10cSrcweir     Image maImgGroupH;
83cdf0e10cSrcweir };
84cdf0e10cSrcweir 
85cdf0e10cSrcweir sal_Bool SD_DLLPRIVATE SdPageObjsTLB::bIsInDrag = sal_False;
86cdf0e10cSrcweir 
IsInDrag()87cdf0e10cSrcweir sal_Bool SdPageObjsTLB::IsInDrag()
88cdf0e10cSrcweir {
89cdf0e10cSrcweir     return bIsInDrag;
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::mnListBoxDropFormatId = SAL_MAX_UINT32;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir // -----------------------------------------
95cdf0e10cSrcweir // - SdPageObjsTLB::SdPageObjsTransferable -
96cdf0e10cSrcweir // -----------------------------------------
97cdf0e10cSrcweir 
SdPageObjsTransferable(SdPageObjsTLB & rParent,const INetBookmark & rBookmark,::sd::DrawDocShell & rDocShell,NavigatorDragType eDragType,const::com::sun::star::uno::Any & rTreeListBoxData)98cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable::SdPageObjsTransferable(
99cdf0e10cSrcweir     SdPageObjsTLB& rParent,
100cdf0e10cSrcweir         const INetBookmark& rBookmark,
101cdf0e10cSrcweir     ::sd::DrawDocShell& rDocShell,
102cdf0e10cSrcweir     NavigatorDragType eDragType,
103cdf0e10cSrcweir     const ::com::sun::star::uno::Any& rTreeListBoxData )
104cdf0e10cSrcweir     : SdTransferable(rDocShell.GetDoc(), NULL, sal_True),
105cdf0e10cSrcweir       mrParent( rParent ),
106cdf0e10cSrcweir       maBookmark( rBookmark ),
107cdf0e10cSrcweir       mrDocShell( rDocShell ),
108cdf0e10cSrcweir       meDragType( eDragType ),
109cdf0e10cSrcweir       maTreeListBoxData( rTreeListBoxData )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
~SdPageObjsTransferable()113cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable::~SdPageObjsTransferable()
114cdf0e10cSrcweir {
115cdf0e10cSrcweir }
116cdf0e10cSrcweir 
117cdf0e10cSrcweir // -----------------------------------------------------------------------------
118cdf0e10cSrcweir 
AddSupportedFormats()119cdf0e10cSrcweir void SdPageObjsTLB::SdPageObjsTransferable::AddSupportedFormats()
120cdf0e10cSrcweir {
121cdf0e10cSrcweir     AddFormat(SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK);
122cdf0e10cSrcweir     AddFormat(SOT_FORMATSTR_ID_TREELISTBOX);
123cdf0e10cSrcweir     AddFormat(GetListBoxDropFormatId());
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
126cdf0e10cSrcweir // -----------------------------------------------------------------------------
127cdf0e10cSrcweir 
GetData(const::com::sun::star::datatransfer::DataFlavor & rFlavor)128cdf0e10cSrcweir sal_Bool SdPageObjsTLB::SdPageObjsTransferable::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
129cdf0e10cSrcweir {
130cdf0e10cSrcweir     sal_uLong nFormatId = SotExchange::GetFormat( rFlavor );
131cdf0e10cSrcweir     switch (nFormatId)
132cdf0e10cSrcweir     {
133cdf0e10cSrcweir         case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK:
134cdf0e10cSrcweir             SetINetBookmark( maBookmark, rFlavor );
135cdf0e10cSrcweir             return sal_True;
136cdf0e10cSrcweir 
137cdf0e10cSrcweir         case SOT_FORMATSTR_ID_TREELISTBOX:
138cdf0e10cSrcweir             SetAny(maTreeListBoxData, rFlavor);
139cdf0e10cSrcweir             return sal_True;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir         default:
142cdf0e10cSrcweir             return sal_False;
143cdf0e10cSrcweir     }
144cdf0e10cSrcweir }
145cdf0e10cSrcweir 
146cdf0e10cSrcweir // -----------------------------------------------------------------------------
147cdf0e10cSrcweir 
DragFinished(sal_Int8 nDropAction)148cdf0e10cSrcweir void SdPageObjsTLB::SdPageObjsTransferable::DragFinished( sal_Int8 nDropAction )
149cdf0e10cSrcweir {
150cdf0e10cSrcweir     mrParent.OnDragFinished( nDropAction );
151cdf0e10cSrcweir     SdTransferable::DragFinished(nDropAction);
152cdf0e10cSrcweir }
153cdf0e10cSrcweir 
154cdf0e10cSrcweir // -----------------------------------------------------------------------------
155cdf0e10cSrcweir 
GetDocShell() const156cdf0e10cSrcweir ::sd::DrawDocShell& SdPageObjsTLB::SdPageObjsTransferable::GetDocShell() const
157cdf0e10cSrcweir {
158cdf0e10cSrcweir     return mrDocShell;
159cdf0e10cSrcweir }
160cdf0e10cSrcweir 
161cdf0e10cSrcweir // -----------------------------------------------------------------------------
162cdf0e10cSrcweir 
GetDragType() const163cdf0e10cSrcweir NavigatorDragType SdPageObjsTLB::SdPageObjsTransferable::GetDragType() const
164cdf0e10cSrcweir {
165cdf0e10cSrcweir     return meDragType;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir 
168cdf0e10cSrcweir // -----------------------------------------------------------------------------
169cdf0e10cSrcweir 
getSomething(const::com::sun::star::uno::Sequence<sal_Int8> & rId)170cdf0e10cSrcweir sal_Int64 SAL_CALL SdPageObjsTLB::SdPageObjsTransferable::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException )
171cdf0e10cSrcweir {
172cdf0e10cSrcweir     sal_Int64 nRet;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     if( ( rId.getLength() == 16 ) &&
175cdf0e10cSrcweir         ( 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
176cdf0e10cSrcweir     {
177cdf0e10cSrcweir         nRet = (sal_Int64)(sal_IntPtr)this;
178cdf0e10cSrcweir     }
179cdf0e10cSrcweir     else
180cdf0e10cSrcweir         nRet = SdTransferable::getSomething(rId);
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     return nRet;
183cdf0e10cSrcweir }
184cdf0e10cSrcweir 
185cdf0e10cSrcweir // -----------------------------------------------------------------------------
186cdf0e10cSrcweir 
getUnoTunnelId()187cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< sal_Int8 >& SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId()
188cdf0e10cSrcweir {
189cdf0e10cSrcweir     static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq;
190cdf0e10cSrcweir 
191cdf0e10cSrcweir     if( !aSeq.getLength() )
192cdf0e10cSrcweir     {
193cdf0e10cSrcweir         static osl::Mutex   aCreateMutex;
194cdf0e10cSrcweir         osl::MutexGuard     aGuard( aCreateMutex );
195cdf0e10cSrcweir 
196cdf0e10cSrcweir         aSeq.realloc( 16 );
197cdf0e10cSrcweir         rtl_createUuid( reinterpret_cast< sal_uInt8* >( aSeq.getArray() ), 0, sal_True );
198cdf0e10cSrcweir     }
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     return aSeq;
201cdf0e10cSrcweir }
202cdf0e10cSrcweir 
203cdf0e10cSrcweir // -----------------------------------------------------------------------------
204cdf0e10cSrcweir 
getImplementation(const::com::sun::star::uno::Reference<::com::sun::star::uno::XInterface> & rxData)205cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTransferable* SdPageObjsTLB::SdPageObjsTransferable::getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData )
206cdf0e10cSrcweir     throw()
207cdf0e10cSrcweir {
208cdf0e10cSrcweir     try
209cdf0e10cSrcweir     {
210cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUnoTunnel( rxData, ::com::sun::star::uno::UNO_QUERY_THROW );
211cdf0e10cSrcweir 
212cdf0e10cSrcweir         return reinterpret_cast<SdPageObjsTLB::SdPageObjsTransferable*>(
213cdf0e10cSrcweir                 sal::static_int_cast<sal_uIntPtr>(
214cdf0e10cSrcweir                     xUnoTunnel->getSomething( SdPageObjsTLB::SdPageObjsTransferable::getUnoTunnelId()) ) );
215cdf0e10cSrcweir     }
216cdf0e10cSrcweir     catch( const ::com::sun::star::uno::Exception& )
217cdf0e10cSrcweir     {
218cdf0e10cSrcweir     }
219cdf0e10cSrcweir     return 0;
220cdf0e10cSrcweir }
221cdf0e10cSrcweir 
GetListBoxDropFormatId(void)222cdf0e10cSrcweir sal_uInt32 SdPageObjsTLB::SdPageObjsTransferable::GetListBoxDropFormatId (void)
223cdf0e10cSrcweir {
224cdf0e10cSrcweir     if (mnListBoxDropFormatId == SAL_MAX_UINT32)
225cdf0e10cSrcweir         mnListBoxDropFormatId = SotExchange::RegisterFormatMimeType(
226cdf0e10cSrcweir             ::rtl::OUString::createFromAscii(
227cdf0e10cSrcweir                 "application/x-openoffice-treelistbox-moveonly;"
228cdf0e10cSrcweir                     "windows_formatname=\"SV_LBOX_DD_FORMAT_MOVE\""));
229cdf0e10cSrcweir     return mnListBoxDropFormatId;
230cdf0e10cSrcweir }
231cdf0e10cSrcweir 
232cdf0e10cSrcweir /*************************************************************************
233cdf0e10cSrcweir |* Ctor1 SdPageObjsTLB
234cdf0e10cSrcweir \************************************************************************/
235cdf0e10cSrcweir 
SdPageObjsTLB(Window * pParentWin,const SdResId & rSdResId)236cdf0e10cSrcweir SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId )
237cdf0e10cSrcweir :   SvTreeListBox       ( pParentWin, rSdResId )
2380deba7fbSSteve Yin ,   bisInSdNavigatorWin ( sal_False )
239cdf0e10cSrcweir ,   mpParent            ( pParentWin )
240cdf0e10cSrcweir ,   mpDoc               ( NULL )
241cdf0e10cSrcweir ,   mpBookmarkDoc       ( NULL )
242cdf0e10cSrcweir ,   mpMedium            ( NULL )
243cdf0e10cSrcweir ,   mpOwnMedium         ( NULL )
244cdf0e10cSrcweir ,   maImgOle            ( BitmapEx( SdResId( BMP_OLE ) ) )
245cdf0e10cSrcweir ,   maImgGraphic        ( BitmapEx( SdResId( BMP_GRAPHIC ) ) )
246cdf0e10cSrcweir ,   maImgOleH           ( BitmapEx( SdResId( BMP_OLE_H ) ) )
247cdf0e10cSrcweir ,   maImgGraphicH       ( BitmapEx( SdResId( BMP_GRAPHIC_H ) ) )
248cdf0e10cSrcweir ,   mbLinkableSelected  ( sal_False )
249cdf0e10cSrcweir ,   mpDropNavWin        ( NULL )
250cdf0e10cSrcweir ,   mbShowAllShapes     ( false )
251cdf0e10cSrcweir ,   mbShowAllPages      ( false )
252cdf0e10cSrcweir {
253cdf0e10cSrcweir     // Tree-ListBox mit Linien versehen
254cdf0e10cSrcweir     SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES |
255cdf0e10cSrcweir                            WB_HASBUTTONS | // WB_HASLINESATROOT |
256cdf0e10cSrcweir                            WB_HSCROLL | // #31562#
257cdf0e10cSrcweir                            WB_HASBUTTONSATROOT |
258cdf0e10cSrcweir                            WB_QUICK_SEARCH /* i31275 */ );
259cdf0e10cSrcweir     SetNodeBitmaps( Bitmap( SdResId( BMP_EXPAND ) ),
260cdf0e10cSrcweir                     Bitmap( SdResId( BMP_COLLAPSE ) ) );
261cdf0e10cSrcweir 
262cdf0e10cSrcweir     SetNodeBitmaps( Bitmap( SdResId( BMP_EXPAND_H ) ),
263cdf0e10cSrcweir                     Bitmap( SdResId( BMP_COLLAPSE_H ) ),
264cdf0e10cSrcweir                     BMP_COLOR_HIGHCONTRAST );
265cdf0e10cSrcweir 
266cdf0e10cSrcweir     SetDragDropMode(
267cdf0e10cSrcweir         SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY |
268cdf0e10cSrcweir             SV_DRAGDROP_APP_MOVE | SV_DRAGDROP_APP_COPY | SV_DRAGDROP_APP_DROP );
269cdf0e10cSrcweir }
270cdf0e10cSrcweir 
271cdf0e10cSrcweir /*************************************************************************
272cdf0e10cSrcweir |* Dtor SdPageObjsTLB
273cdf0e10cSrcweir \************************************************************************/
274cdf0e10cSrcweir 
~SdPageObjsTLB()275cdf0e10cSrcweir SdPageObjsTLB::~SdPageObjsTLB()
276cdf0e10cSrcweir {
277cdf0e10cSrcweir     if ( mpBookmarkDoc )
278cdf0e10cSrcweir         CloseBookmarkDoc();
279cdf0e10cSrcweir     else
280cdf0e10cSrcweir         // no document was created from mpMedium, so this object is still the owner of it
281cdf0e10cSrcweir         delete mpMedium;
282cdf0e10cSrcweir }
283cdf0e10cSrcweir 
2840deba7fbSSteve Yin // helper function for  GetEntryAltText and GetEntryLongDescription
getAltLongDescText(SvLBoxEntry * pEntry,sal_Bool isAltText) const2850deba7fbSSteve Yin String SdPageObjsTLB::getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const
2860deba7fbSSteve Yin {
2870deba7fbSSteve Yin     sal_uInt16 maxPages = mpDoc->GetPageCount();
2880deba7fbSSteve Yin     sal_uInt16 pageNo;
2890deba7fbSSteve Yin     SdrObject*   pObj = NULL;
2900deba7fbSSteve Yin     SdPage* pPage = NULL;
2910deba7fbSSteve Yin 
2920deba7fbSSteve Yin     String ParentName = GetEntryText( GetRootLevelParent( pEntry ) );
2930deba7fbSSteve Yin 
2940deba7fbSSteve Yin     for( pageNo = 0; pageNo < maxPages; pageNo++ )
2950deba7fbSSteve Yin     {
2960deba7fbSSteve Yin         pPage = (SdPage*) mpDoc->GetPage( pageNo );
2970deba7fbSSteve Yin         if( pPage->GetPageKind() != PK_STANDARD ) continue;
2980deba7fbSSteve Yin         if( pPage->GetName() != ParentName ) continue;
2990deba7fbSSteve Yin         SdrObjListIter aIter( *pPage, IM_FLAT );
3000deba7fbSSteve Yin         while( aIter.IsMore() )
3010deba7fbSSteve Yin         {
3020deba7fbSSteve Yin             pObj = aIter.Next();
3030deba7fbSSteve Yin             if( GetEntryText(pEntry) == GetObjectName( pObj ) )
3040deba7fbSSteve Yin             {
3050deba7fbSSteve Yin                 if( isAltText )
3060deba7fbSSteve Yin                     return pObj->GetTitle();
3070deba7fbSSteve Yin                 else
3080deba7fbSSteve Yin                     return pObj->GetDescription();
3090deba7fbSSteve Yin             }
3100deba7fbSSteve Yin         }
3110deba7fbSSteve Yin     }
3120deba7fbSSteve Yin     return String();
3130deba7fbSSteve Yin 
3140deba7fbSSteve Yin }
3150deba7fbSSteve Yin 
GetEntryAltText(SvLBoxEntry * pEntry) const3160deba7fbSSteve Yin String SdPageObjsTLB::GetEntryAltText( SvLBoxEntry* pEntry ) const
3170deba7fbSSteve Yin {
3180deba7fbSSteve Yin     return getAltLongDescText( pEntry, sal_True );
3190deba7fbSSteve Yin }
3200deba7fbSSteve Yin 
GetEntryLongDescription(SvLBoxEntry * pEntry) const3210deba7fbSSteve Yin String SdPageObjsTLB::GetEntryLongDescription( SvLBoxEntry* pEntry ) const
3220deba7fbSSteve Yin {
3230deba7fbSSteve Yin     return getAltLongDescText( pEntry, sal_False);
3240deba7fbSSteve Yin }
3250deba7fbSSteve Yin 
MarkCurEntry(const String & rName)3260deba7fbSSteve Yin void SdPageObjsTLB::MarkCurEntry( const String& rName )
3270deba7fbSSteve Yin {
3280deba7fbSSteve Yin 
3290deba7fbSSteve Yin     if( rName.Len() )
3300deba7fbSSteve Yin     {
3310deba7fbSSteve Yin         SvLBoxEntry* pCurEntry =GetCurEntry();
3320deba7fbSSteve Yin         SvLBoxEntry* pEntry =NULL;
3330deba7fbSSteve Yin         String aTmp1;
3340deba7fbSSteve Yin         String aTmp2;
3350deba7fbSSteve Yin 
3360deba7fbSSteve Yin            if( GetParent(pCurEntry)==NULL )
3370deba7fbSSteve Yin            {
3380deba7fbSSteve Yin                   aTmp1 = GetEntryText( pCurEntry );
3390deba7fbSSteve Yin                for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
3400deba7fbSSteve Yin             {
3410deba7fbSSteve Yin                    if(GetParent( pEntry )==NULL)
3420deba7fbSSteve Yin                          continue;
3430deba7fbSSteve Yin                 aTmp2 = GetEntryText( GetParent( pEntry ));
3440deba7fbSSteve Yin                 if( aTmp1 != aTmp2)
3450deba7fbSSteve Yin                 {
3460deba7fbSSteve Yin                     // IA2 CWS. MT: Removed in SvLBoxEntry for now - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
3470deba7fbSSteve Yin                     pEntry->SetMarked(sal_False);
3480deba7fbSSteve Yin                 }
3490deba7fbSSteve Yin             }
3500deba7fbSSteve Yin 
3510deba7fbSSteve Yin            }
3520deba7fbSSteve Yin               else
3530deba7fbSSteve Yin               {
3540deba7fbSSteve Yin                   for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
3550deba7fbSSteve Yin             {
3560deba7fbSSteve Yin                 aTmp2 = GetEntryText( pEntry );
3570deba7fbSSteve Yin                 if( aTmp2 == rName)
3580deba7fbSSteve Yin                 {
3590deba7fbSSteve Yin                     pEntry->SetMarked(sal_True);
3600deba7fbSSteve Yin                 }
3610deba7fbSSteve Yin                 else
3620deba7fbSSteve Yin                 {
3630deba7fbSSteve Yin                         pEntry->SetMarked(sal_False);
3640deba7fbSSteve Yin                 }
3650deba7fbSSteve Yin             }
3660deba7fbSSteve Yin               }
3670deba7fbSSteve Yin     }
3680deba7fbSSteve Yin     Invalidate();
3690deba7fbSSteve Yin }
3700deba7fbSSteve Yin 
FreshCurEntry()3710deba7fbSSteve Yin void SdPageObjsTLB:: FreshCurEntry()
3720deba7fbSSteve Yin {
3730deba7fbSSteve Yin         SvLBoxEntry* pEntry =NULL;
3740deba7fbSSteve Yin         for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
3750deba7fbSSteve Yin     {
3760deba7fbSSteve Yin                 pEntry->SetMarked(sal_False);
3770deba7fbSSteve Yin     }
3780deba7fbSSteve Yin     Invalidate();
3790deba7fbSSteve Yin }
3800deba7fbSSteve Yin 
3810deba7fbSSteve Yin class SdContentLBoxString : public SvLBoxString
3820deba7fbSSteve Yin {
3830deba7fbSSteve Yin public:
SdContentLBoxString(SvLBoxEntry * pEntry,sal_uInt16 nFlags,const String & rStr)3840deba7fbSSteve Yin     SdContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags,
3850deba7fbSSteve Yin         const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {}
3860deba7fbSSteve Yin 
3870deba7fbSSteve Yin     virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
3880deba7fbSSteve Yin         SvLBoxEntry* pEntry);
3890deba7fbSSteve Yin };
3900deba7fbSSteve Yin 
InitEntry(SvLBoxEntry * pEntry,const XubString & rStr,const Image & rImg1,const Image & rImg2,SvLBoxButtonKind eButtonKind)3910deba7fbSSteve Yin void SdPageObjsTLB::InitEntry(SvLBoxEntry* pEntry,
3920deba7fbSSteve Yin         const XubString& rStr ,const Image& rImg1,const Image& rImg2,SvLBoxButtonKind eButtonKind)
3930deba7fbSSteve Yin {
3940deba7fbSSteve Yin     sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
3950deba7fbSSteve Yin     SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
3960deba7fbSSteve Yin     SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
3970deba7fbSSteve Yin     SdContentLBoxString* pStr = new SdContentLBoxString( pEntry, 0, pCol->GetText() );
3980deba7fbSSteve Yin     pEntry->ReplaceItem( pStr, nColToHilite );
3990deba7fbSSteve Yin }
4000deba7fbSSteve Yin 
Paint(const Point & rPos,SvLBox & rDev,sal_uInt16 nFlags,SvLBoxEntry * pEntry)4010deba7fbSSteve Yin void SdContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
4020deba7fbSSteve Yin     SvLBoxEntry* pEntry )
4030deba7fbSSteve Yin {
4040deba7fbSSteve Yin     // IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
4050deba7fbSSteve Yin     /*
4060deba7fbSSteve Yin     if (pEntry->IsMarked())
4070deba7fbSSteve Yin     {
4080deba7fbSSteve Yin             rDev.DrawText( rPos, GetText() );
4090deba7fbSSteve Yin             XubString str;
4100deba7fbSSteve Yin             str = XubString::CreateFromAscii("*");
4110deba7fbSSteve Yin             Point rPosStar(rPos.X()-6,rPos.Y());
4120deba7fbSSteve Yin             Font aOldFont( rDev.GetFont());
4130deba7fbSSteve Yin             Font aFont(aOldFont);
4140deba7fbSSteve Yin             Color aCol( aOldFont.GetColor() );
4150deba7fbSSteve Yin             aCol.DecreaseLuminance( 200 );
4160deba7fbSSteve Yin             aFont.SetColor( aCol );
4170deba7fbSSteve Yin             rDev.SetFont( aFont );
4180deba7fbSSteve Yin             rDev.DrawText( rPosStar, str);
4190deba7fbSSteve Yin             rDev.SetFont( aOldFont );
4200deba7fbSSteve Yin     }
4210deba7fbSSteve Yin     else
4220deba7fbSSteve Yin     */
4230deba7fbSSteve Yin         SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
4240deba7fbSSteve Yin 
4250deba7fbSSteve Yin }
4260deba7fbSSteve Yin 
SaveExpandedTreeItemState(SvLBoxEntry * pEntry,vector<String> & vectTreeItem)4270deba7fbSSteve Yin void SdPageObjsTLB::SaveExpandedTreeItemState(SvLBoxEntry* pEntry, vector<String>& vectTreeItem)
4280deba7fbSSteve Yin {
4290deba7fbSSteve Yin     if (pEntry)
4300deba7fbSSteve Yin     {
4310deba7fbSSteve Yin         SvLBoxEntry* pListEntry = pEntry;
4320deba7fbSSteve Yin         while (pListEntry)
4330deba7fbSSteve Yin         {
4340deba7fbSSteve Yin             if (pListEntry->HasChilds())
4350deba7fbSSteve Yin             {
4360deba7fbSSteve Yin                 if (IsExpanded(pListEntry))
4370deba7fbSSteve Yin                     vectTreeItem.push_back(GetEntryText(pListEntry));
4380deba7fbSSteve Yin                 SvLBoxEntry* pChildEntry = FirstChild(pListEntry);
4390deba7fbSSteve Yin                 SaveExpandedTreeItemState(pChildEntry, vectTreeItem);
4400deba7fbSSteve Yin             }
4410deba7fbSSteve Yin             pListEntry = NextSibling(pListEntry);
4420deba7fbSSteve Yin         }
4430deba7fbSSteve Yin     }
4440deba7fbSSteve Yin }
Clear()4450deba7fbSSteve Yin void SdPageObjsTLB::Clear()
4460deba7fbSSteve Yin {
4470deba7fbSSteve Yin     // Save the expanded tree item
4480deba7fbSSteve Yin     if (mbSaveTreeItemState)
4490deba7fbSSteve Yin     {
4500deba7fbSSteve Yin         maSelectionEntryText = String();
4510deba7fbSSteve Yin         maTreeItem.clear();
4520deba7fbSSteve Yin         if (GetCurEntry())
4530deba7fbSSteve Yin             maSelectionEntryText = GetSelectEntry();
4540deba7fbSSteve Yin         SvLBoxEntry* pEntry = FirstChild(NULL);
4550deba7fbSSteve Yin         SaveExpandedTreeItemState(pEntry, maTreeItem);
4560deba7fbSSteve Yin     }
4570deba7fbSSteve Yin     return SvTreeListBox::Clear();
4580deba7fbSSteve Yin }
459cdf0e10cSrcweir /*************************************************************************
460cdf0e10cSrcweir |* return name of object
461cdf0e10cSrcweir \************************************************************************/
462cdf0e10cSrcweir 
GetObjectName(const SdrObject * pObject,const bool bCreate) const463cdf0e10cSrcweir String SdPageObjsTLB::GetObjectName(
464cdf0e10cSrcweir     const SdrObject* pObject,
465cdf0e10cSrcweir     const bool bCreate) const
466cdf0e10cSrcweir {
467cdf0e10cSrcweir     String aRet;
468cdf0e10cSrcweir 
469cdf0e10cSrcweir     if ( pObject )
470cdf0e10cSrcweir     {
471cdf0e10cSrcweir         aRet = pObject->GetName();
472cdf0e10cSrcweir 
473cdf0e10cSrcweir         if( !aRet.Len() && pObject->ISA( SdrOle2Obj ) )
474cdf0e10cSrcweir             aRet = static_cast< const SdrOle2Obj* >( pObject )->GetPersistName();
475cdf0e10cSrcweir     }
476cdf0e10cSrcweir 
477cdf0e10cSrcweir     if (bCreate
478cdf0e10cSrcweir         && mbShowAllShapes
479cdf0e10cSrcweir         && aRet.Len() == 0
480cdf0e10cSrcweir         && pObject!=NULL)
481cdf0e10cSrcweir     {
482cdf0e10cSrcweir         aRet = SdResId(STR_NAVIGATOR_SHAPE_BASE_NAME);
483cdf0e10cSrcweir         aRet.SearchAndReplaceAscii("%1", String::CreateFromInt32(pObject->GetOrdNum() + 1));
484cdf0e10cSrcweir     }
485cdf0e10cSrcweir 
486cdf0e10cSrcweir     return aRet;
487cdf0e10cSrcweir }
488cdf0e10cSrcweir 
489cdf0e10cSrcweir /*************************************************************************
490cdf0e10cSrcweir |* In TreeLB Eintrag selektieren
491cdf0e10cSrcweir \************************************************************************/
492cdf0e10cSrcweir 
SelectEntry(const String & rName)493cdf0e10cSrcweir sal_Bool SdPageObjsTLB::SelectEntry( const String& rName )
494cdf0e10cSrcweir {
495cdf0e10cSrcweir     sal_Bool bFound = sal_False;
496cdf0e10cSrcweir 
497cdf0e10cSrcweir     if( rName.Len() )
498cdf0e10cSrcweir     {
499cdf0e10cSrcweir         SvLBoxEntry* pEntry = NULL;
500cdf0e10cSrcweir         String aTmp;
501cdf0e10cSrcweir 
502cdf0e10cSrcweir         for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) )
503cdf0e10cSrcweir         {
504cdf0e10cSrcweir             aTmp = GetEntryText( pEntry );
505cdf0e10cSrcweir             if( aTmp == rName )
506cdf0e10cSrcweir             {
507cdf0e10cSrcweir                 bFound = sal_True;
508cdf0e10cSrcweir                 SetCurEntry( pEntry );
509cdf0e10cSrcweir             }
510cdf0e10cSrcweir         }
511cdf0e10cSrcweir     }
512cdf0e10cSrcweir     return( bFound );
513cdf0e10cSrcweir }
514cdf0e10cSrcweir 
515cdf0e10cSrcweir /*************************************************************************
516*5133a0b6Smseidel |* Gibt zurück, ob Childs des übergebenen Strings selektiert sind
517cdf0e10cSrcweir \************************************************************************/
518cdf0e10cSrcweir 
HasSelectedChilds(const String & rName)519cdf0e10cSrcweir sal_Bool SdPageObjsTLB::HasSelectedChilds( const String& rName )
520cdf0e10cSrcweir {
521cdf0e10cSrcweir     sal_Bool bFound  = sal_False;
522cdf0e10cSrcweir     sal_Bool bChilds = sal_False;
523cdf0e10cSrcweir 
524cdf0e10cSrcweir     if( rName.Len() )
525cdf0e10cSrcweir     {
526cdf0e10cSrcweir         SvLBoxEntry* pEntry = NULL;
527cdf0e10cSrcweir         String aTmp;
528cdf0e10cSrcweir 
529cdf0e10cSrcweir         for( pEntry = First(); pEntry && !bFound; pEntry = Next( pEntry ) )
530cdf0e10cSrcweir         {
531cdf0e10cSrcweir             aTmp = GetEntryText( pEntry );
532cdf0e10cSrcweir             if( aTmp == rName )
533cdf0e10cSrcweir             {
534cdf0e10cSrcweir                 bFound = sal_True;
535cdf0e10cSrcweir                 sal_Bool bExpanded = IsExpanded( pEntry );
536cdf0e10cSrcweir                 long nCount = GetChildSelectionCount( pEntry );
537cdf0e10cSrcweir                 if( bExpanded && nCount > 0 )
538cdf0e10cSrcweir                     bChilds = sal_True;
539cdf0e10cSrcweir             }
540cdf0e10cSrcweir         }
541cdf0e10cSrcweir     }
542cdf0e10cSrcweir     return( bChilds );
543cdf0e10cSrcweir }
544cdf0e10cSrcweir 
545cdf0e10cSrcweir /*************************************************************************
546*5133a0b6Smseidel |* TreeLB mit Seiten und Objekten füllen
547cdf0e10cSrcweir \************************************************************************/
548cdf0e10cSrcweir 
Fill(const SdDrawDocument * pInDoc,sal_Bool bAllPages,const String & rDocName)549cdf0e10cSrcweir void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, sal_Bool bAllPages,
550cdf0e10cSrcweir                           const String& rDocName)
551cdf0e10cSrcweir {
552cdf0e10cSrcweir     String aSelection;
553cdf0e10cSrcweir     if( GetSelectionCount() > 0 )
554cdf0e10cSrcweir     {
555cdf0e10cSrcweir         aSelection = GetSelectEntry();
556cdf0e10cSrcweir         Clear();
557cdf0e10cSrcweir     }
558cdf0e10cSrcweir 
559cdf0e10cSrcweir     mpDoc = pInDoc;
560cdf0e10cSrcweir     maDocName = rDocName;
561cdf0e10cSrcweir     mbShowAllPages = (bAllPages == sal_True);
562cdf0e10cSrcweir     mpMedium = NULL;
563cdf0e10cSrcweir 
564cdf0e10cSrcweir     SdPage*      pPage = NULL;
565cdf0e10cSrcweir 
566cdf0e10cSrcweir     IconProvider aIconProvider;
567cdf0e10cSrcweir 
568cdf0e10cSrcweir     // first insert all pages including objects
569cdf0e10cSrcweir     sal_uInt16 nPage = 0;
570cdf0e10cSrcweir     const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
571cdf0e10cSrcweir 
572cdf0e10cSrcweir     while( nPage < nMaxPages )
573cdf0e10cSrcweir     {
574cdf0e10cSrcweir         pPage = (SdPage*) mpDoc->GetPage( nPage );
575cdf0e10cSrcweir         if( (mbShowAllPages || pPage->GetPageKind() == PK_STANDARD)
576cdf0e10cSrcweir              && !(pPage->GetPageKind()==PK_HANDOUT) ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
577cdf0e10cSrcweir         {
578cdf0e10cSrcweir             sal_Bool bPageExluded = pPage->IsExcluded();
579cdf0e10cSrcweir 
580cdf0e10cSrcweir             bool bPageBelongsToShow = PageBelongsToCurrentShow (pPage);
581cdf0e10cSrcweir             bPageExluded |= !bPageBelongsToShow;
582cdf0e10cSrcweir 
583cdf0e10cSrcweir             AddShapeList(*pPage, NULL, pPage->GetName(), bPageExluded, NULL, aIconProvider);
584cdf0e10cSrcweir         }
585cdf0e10cSrcweir         nPage++;
586cdf0e10cSrcweir     }
587cdf0e10cSrcweir 
588*5133a0b6Smseidel     // dann alle MasterPages incl. Objekte einfügen
589cdf0e10cSrcweir     if( mbShowAllPages )
590cdf0e10cSrcweir     {
591cdf0e10cSrcweir         nPage = 0;
592cdf0e10cSrcweir         const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount();
593cdf0e10cSrcweir 
594cdf0e10cSrcweir         while( nPage < nMaxMasterPages )
595cdf0e10cSrcweir         {
596cdf0e10cSrcweir             pPage = (SdPage*) mpDoc->GetMasterPage( nPage );
597cdf0e10cSrcweir             AddShapeList(*pPage, NULL, pPage->GetName(), false, NULL, aIconProvider);
598cdf0e10cSrcweir             nPage++;
599cdf0e10cSrcweir         }
600cdf0e10cSrcweir     }
601cdf0e10cSrcweir     if( aSelection.Len() )
602cdf0e10cSrcweir         SelectEntry( aSelection );
6030deba7fbSSteve Yin     else if (mbSaveTreeItemState && maSelectionEntryText.Len())
6040deba7fbSSteve Yin     {
6050deba7fbSSteve Yin         SelectEntry(maSelectionEntryText);
6060deba7fbSSteve Yin     }
607cdf0e10cSrcweir }
608cdf0e10cSrcweir 
609cdf0e10cSrcweir /*************************************************************************
610*5133a0b6Smseidel |* Es wird nur der erste Eintrag eingefügt. Childs werden OnDemand erzeugt
611cdf0e10cSrcweir \************************************************************************/
612cdf0e10cSrcweir 
Fill(const SdDrawDocument * pInDoc,SfxMedium * pInMedium,const String & rDocName)613cdf0e10cSrcweir void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, SfxMedium* pInMedium,
614cdf0e10cSrcweir                           const String& rDocName )
615cdf0e10cSrcweir {
616cdf0e10cSrcweir     mpDoc = pInDoc;
617cdf0e10cSrcweir 
618cdf0e10cSrcweir     // this object now owns the Medium
619cdf0e10cSrcweir     mpMedium = pInMedium;
620cdf0e10cSrcweir     maDocName = rDocName;
621cdf0e10cSrcweir 
622cdf0e10cSrcweir     Image aImgDocOpen=Image( BitmapEx( SdResId( BMP_DOC_OPEN ) ) );
623cdf0e10cSrcweir     Image aImgDocClosed=Image( BitmapEx( SdResId( BMP_DOC_CLOSED ) ) );
624cdf0e10cSrcweir     Image aImgDocOpenH=Image( BitmapEx( SdResId( BMP_DOC_OPEN_H ) ) );
625cdf0e10cSrcweir     Image aImgDocClosedH=Image( BitmapEx( SdResId( BMP_DOC_CLOSED_H ) ) );
626cdf0e10cSrcweir 
627*5133a0b6Smseidel     // Dokumentnamen einfügen
628cdf0e10cSrcweir     SvLBoxEntry* pFileEntry = InsertEntry( maDocName,
629cdf0e10cSrcweir                               aImgDocOpen,
630cdf0e10cSrcweir                               aImgDocClosed,
631cdf0e10cSrcweir                               NULL,
632cdf0e10cSrcweir                               sal_True,
633cdf0e10cSrcweir                               LIST_APPEND,
634cdf0e10cSrcweir                               reinterpret_cast< void* >( 1 ) );
635cdf0e10cSrcweir 
636cdf0e10cSrcweir     SetExpandedEntryBmp( pFileEntry, aImgDocOpenH, BMP_COLOR_HIGHCONTRAST );
637cdf0e10cSrcweir     SetCollapsedEntryBmp( pFileEntry, aImgDocClosedH, BMP_COLOR_HIGHCONTRAST );
638cdf0e10cSrcweir }
639cdf0e10cSrcweir 
AddShapeList(const SdrObjList & rList,SdrObject * pShape,const::rtl::OUString & rsName,const bool bIsExcluded,SvLBoxEntry * pParentEntry,const IconProvider & rIconProvider)640cdf0e10cSrcweir void SdPageObjsTLB::AddShapeList (
641cdf0e10cSrcweir     const SdrObjList& rList,
642cdf0e10cSrcweir     SdrObject* pShape,
643cdf0e10cSrcweir     const ::rtl::OUString& rsName,
644cdf0e10cSrcweir     const bool bIsExcluded,
645cdf0e10cSrcweir     SvLBoxEntry* pParentEntry,
646cdf0e10cSrcweir     const IconProvider& rIconProvider)
647cdf0e10cSrcweir {
648cdf0e10cSrcweir     Image aIcon (rIconProvider.maImgPage);
649cdf0e10cSrcweir     if (bIsExcluded)
650cdf0e10cSrcweir         aIcon = rIconProvider.maImgPageExcl;
651cdf0e10cSrcweir     else if (pShape != NULL)
652cdf0e10cSrcweir         aIcon = rIconProvider.maImgGroup;
653cdf0e10cSrcweir 
654cdf0e10cSrcweir     void* pUserData (reinterpret_cast<void*>(1));
655cdf0e10cSrcweir     if (pShape != NULL)
656cdf0e10cSrcweir         pUserData = pShape;
657cdf0e10cSrcweir 
658cdf0e10cSrcweir     SvLBoxEntry* pEntry = InsertEntry(
659cdf0e10cSrcweir         rsName,
660cdf0e10cSrcweir         aIcon,
661cdf0e10cSrcweir         aIcon,
662cdf0e10cSrcweir         pParentEntry,
663cdf0e10cSrcweir         sal_False,
664cdf0e10cSrcweir         LIST_APPEND,
665cdf0e10cSrcweir         pUserData);
666cdf0e10cSrcweir 
667cdf0e10cSrcweir     SetExpandedEntryBmp(
668cdf0e10cSrcweir         pEntry,
669cdf0e10cSrcweir         bIsExcluded ? rIconProvider.maImgPageExclH : rIconProvider.maImgPageH,
670cdf0e10cSrcweir         BMP_COLOR_HIGHCONTRAST );
671cdf0e10cSrcweir     SetCollapsedEntryBmp(
672cdf0e10cSrcweir         pEntry,
673cdf0e10cSrcweir         bIsExcluded ? rIconProvider.maImgPageExclH : rIconProvider.maImgPageH,
674cdf0e10cSrcweir         BMP_COLOR_HIGHCONTRAST );
675cdf0e10cSrcweir 
676cdf0e10cSrcweir     SdrObjListIter aIter(
677cdf0e10cSrcweir         rList,
678cdf0e10cSrcweir         !rList.HasObjectNavigationOrder() /* use navigation order, if available */,
679cdf0e10cSrcweir         IM_FLAT,
680cdf0e10cSrcweir         sal_False /*not reverse*/);
681cdf0e10cSrcweir 
6820deba7fbSSteve Yin     sal_Bool bMarked=sal_False;
6830deba7fbSSteve Yin     if(bisInSdNavigatorWin)
6840deba7fbSSteve Yin     {
6850deba7fbSSteve Yin         Window* pWindow=NULL;
6860deba7fbSSteve Yin         SdNavigatorWin* pSdNavigatorWin=NULL;
6870deba7fbSSteve Yin         sd::DrawDocShell* pSdDrawDocShell = NULL;
6880deba7fbSSteve Yin         if(pEntry)
6890deba7fbSSteve Yin             pWindow=(Window*)GetParent(pEntry);
6900deba7fbSSteve Yin         if(pWindow)
6910deba7fbSSteve Yin             pSdNavigatorWin = (SdNavigatorWin*)pWindow;
6920deba7fbSSteve Yin         if( pSdNavigatorWin )
6930deba7fbSSteve Yin             pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
6940deba7fbSSteve Yin         if(pSdDrawDocShell)
6950deba7fbSSteve Yin             bMarked=pSdDrawDocShell->IsMarked(pShape);
6960deba7fbSSteve Yin         if(pEntry)
6970deba7fbSSteve Yin         {
6980deba7fbSSteve Yin             if(bMarked)
6990deba7fbSSteve Yin                 pEntry->SetMarked(sal_True);
7000deba7fbSSteve Yin             else
7010deba7fbSSteve Yin                 pEntry->SetMarked( sal_False );
7020deba7fbSSteve Yin         }
7030deba7fbSSteve Yin     }
704cdf0e10cSrcweir     while( aIter.IsMore() )
705cdf0e10cSrcweir     {
706cdf0e10cSrcweir         SdrObject* pObj = aIter.Next();
707cdf0e10cSrcweir         OSL_ASSERT(pObj!=NULL);
708cdf0e10cSrcweir 
709cdf0e10cSrcweir         // Get the shape name.
710cdf0e10cSrcweir         String aStr (GetObjectName( pObj ) );
711cdf0e10cSrcweir 
712cdf0e10cSrcweir         if( aStr.Len() )
713cdf0e10cSrcweir         {
714cdf0e10cSrcweir             if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 )
715cdf0e10cSrcweir             {
716cdf0e10cSrcweir                 SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgOle, maImgOle, pEntry,
717cdf0e10cSrcweir                     sal_False, LIST_APPEND, pObj);
7180deba7fbSSteve Yin                 if(bisInSdNavigatorWin)
7190deba7fbSSteve Yin                 {
7200deba7fbSSteve Yin                     Window* pWindow=NULL;
7210deba7fbSSteve Yin                     SdNavigatorWin* pSdNavigatorWin=NULL;
7220deba7fbSSteve Yin                     sd::DrawDocShell* pSdDrawDocShell = NULL;
7230deba7fbSSteve Yin                     if(pNewEntry)
7240deba7fbSSteve Yin                         pWindow=(Window*)GetParent(pNewEntry);
7250deba7fbSSteve Yin                     if(pWindow)
7260deba7fbSSteve Yin                         pSdNavigatorWin = (SdNavigatorWin*)pWindow;
7270deba7fbSSteve Yin                     if( pSdNavigatorWin )
7280deba7fbSSteve Yin                         pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
7290deba7fbSSteve Yin                     if(pSdDrawDocShell)
7300deba7fbSSteve Yin                         bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
7310deba7fbSSteve Yin                     if(pNewEntry)
7320deba7fbSSteve Yin                     {
7330deba7fbSSteve Yin                         if(bMarked)
7340deba7fbSSteve Yin                             pNewEntry->SetMarked(sal_True);
7350deba7fbSSteve Yin                         else
7360deba7fbSSteve Yin                             pNewEntry->SetMarked( sal_False );
7370deba7fbSSteve Yin                     }
7380deba7fbSSteve Yin                 }
739cdf0e10cSrcweir                 SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
740cdf0e10cSrcweir                 SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
741cdf0e10cSrcweir             }
742cdf0e10cSrcweir             else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF )
743cdf0e10cSrcweir             {
744cdf0e10cSrcweir                 SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgGraphic, maImgGraphic, pEntry,
745cdf0e10cSrcweir                     sal_False, LIST_APPEND, pObj );
7460deba7fbSSteve Yin                 if(bisInSdNavigatorWin)
7470deba7fbSSteve Yin                 {
7480deba7fbSSteve Yin                     Window* pWindow=NULL;
7490deba7fbSSteve Yin                     SdNavigatorWin* pSdNavigatorWin=NULL;
7500deba7fbSSteve Yin                     sd::DrawDocShell* pSdDrawDocShell = NULL;
7510deba7fbSSteve Yin                     if(pNewEntry)
7520deba7fbSSteve Yin                         pWindow=(Window*)GetParent(pNewEntry);
7530deba7fbSSteve Yin                     if(pWindow)
7540deba7fbSSteve Yin                         pSdNavigatorWin = (SdNavigatorWin*)pWindow;
7550deba7fbSSteve Yin                     if( pSdNavigatorWin )
7560deba7fbSSteve Yin                         pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
7570deba7fbSSteve Yin                     if(pSdDrawDocShell)
7580deba7fbSSteve Yin                         bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
7590deba7fbSSteve Yin                     if(pNewEntry)
7600deba7fbSSteve Yin                     {
7610deba7fbSSteve Yin                         if(bMarked)
7620deba7fbSSteve Yin                         {
7630deba7fbSSteve Yin                             pNewEntry->SetMarked(sal_True);
7640deba7fbSSteve Yin                         }
7650deba7fbSSteve Yin                         else
7660deba7fbSSteve Yin                         {
7670deba7fbSSteve Yin                             pNewEntry->SetMarked( sal_False );
7680deba7fbSSteve Yin                         }
7690deba7fbSSteve Yin                     }
7700deba7fbSSteve Yin                 }
771cdf0e10cSrcweir                 SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
772cdf0e10cSrcweir                 SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
773cdf0e10cSrcweir             }
774cdf0e10cSrcweir             else if (pObj->IsGroupObject())
775cdf0e10cSrcweir             {
776cdf0e10cSrcweir                 AddShapeList(
777cdf0e10cSrcweir                     *pObj->GetSubList(),
778cdf0e10cSrcweir                     pObj,
779cdf0e10cSrcweir                     aStr,
780cdf0e10cSrcweir                     false,
781cdf0e10cSrcweir                     pEntry,
782cdf0e10cSrcweir                     rIconProvider);
783cdf0e10cSrcweir             }
784cdf0e10cSrcweir             else
785cdf0e10cSrcweir             {
786cdf0e10cSrcweir                 SvLBoxEntry* pNewEntry = InsertEntry( aStr, rIconProvider.maImgObjects, rIconProvider.maImgObjects, pEntry,
787cdf0e10cSrcweir                     sal_False, LIST_APPEND, pObj );
7880deba7fbSSteve Yin                 if(bisInSdNavigatorWin)
7890deba7fbSSteve Yin                 {
7900deba7fbSSteve Yin                     Window* pWindow=NULL;
7910deba7fbSSteve Yin                     SdNavigatorWin* pSdNavigatorWin=NULL;
7920deba7fbSSteve Yin                     sd::DrawDocShell* pSdDrawDocShell = NULL;
7930deba7fbSSteve Yin                     if(pNewEntry)
7940deba7fbSSteve Yin                         pWindow=(Window*)GetParent(pNewEntry);
7950deba7fbSSteve Yin                     if(pWindow)
7960deba7fbSSteve Yin                         pSdNavigatorWin = (SdNavigatorWin*)pWindow;
7970deba7fbSSteve Yin                     if( pSdNavigatorWin )
7980deba7fbSSteve Yin                         pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
7990deba7fbSSteve Yin                     if(pSdDrawDocShell)
8000deba7fbSSteve Yin                         bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
8010deba7fbSSteve Yin                     if(pNewEntry)
8020deba7fbSSteve Yin                     {
8030deba7fbSSteve Yin                         if(bMarked)
8040deba7fbSSteve Yin                         {
8050deba7fbSSteve Yin                             pNewEntry->SetMarked(sal_True);
8060deba7fbSSteve Yin                         }
8070deba7fbSSteve Yin                         else
8080deba7fbSSteve Yin                         {
8090deba7fbSSteve Yin                             pNewEntry->SetMarked( sal_False );
8100deba7fbSSteve Yin                         }
8110deba7fbSSteve Yin                     }
8120deba7fbSSteve Yin                 }
813cdf0e10cSrcweir                 SetExpandedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST );
814cdf0e10cSrcweir                 SetCollapsedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST );
815cdf0e10cSrcweir             }
816cdf0e10cSrcweir         }
817cdf0e10cSrcweir     }
818cdf0e10cSrcweir 
819cdf0e10cSrcweir     if( pEntry->HasChilds() )
820cdf0e10cSrcweir     {
821cdf0e10cSrcweir         SetExpandedEntryBmp(
822cdf0e10cSrcweir             pEntry,
823cdf0e10cSrcweir             bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs);
824cdf0e10cSrcweir         SetCollapsedEntryBmp(
825cdf0e10cSrcweir             pEntry,
826cdf0e10cSrcweir             bIsExcluded ? rIconProvider.maImgPageObjsExcl : rIconProvider.maImgPageObjs);
827cdf0e10cSrcweir         SetExpandedEntryBmp(
828cdf0e10cSrcweir             pEntry,
829cdf0e10cSrcweir             bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH,
830cdf0e10cSrcweir             BMP_COLOR_HIGHCONTRAST);
831cdf0e10cSrcweir         SetCollapsedEntryBmp(
832cdf0e10cSrcweir             pEntry,
833cdf0e10cSrcweir             bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH,
834cdf0e10cSrcweir             BMP_COLOR_HIGHCONTRAST);
8350deba7fbSSteve Yin         if (mbSaveTreeItemState)
8360deba7fbSSteve Yin         {
8370deba7fbSSteve Yin             vector<String>:: iterator iteStart = maTreeItem.begin();
8380deba7fbSSteve Yin             while (iteStart != maTreeItem.end())
8390deba7fbSSteve Yin             {
8400deba7fbSSteve Yin                 String strEntry = GetEntryText(pEntry);
8410deba7fbSSteve Yin                 if (*iteStart == strEntry)
8420deba7fbSSteve Yin                 {
8430deba7fbSSteve Yin                     Expand( pEntry );
8440deba7fbSSteve Yin                     break;
8450deba7fbSSteve Yin                 }
8460deba7fbSSteve Yin                 ++iteStart;
8470deba7fbSSteve Yin             }
8480deba7fbSSteve Yin         }
8490deba7fbSSteve Yin         else
8500deba7fbSSteve Yin             Expand( pEntry );
851cdf0e10cSrcweir     }
852cdf0e10cSrcweir }
853cdf0e10cSrcweir 
SetShowAllShapes(const bool bShowAllShapes,const bool bFillList)854cdf0e10cSrcweir void SdPageObjsTLB::SetShowAllShapes (
855cdf0e10cSrcweir     const bool bShowAllShapes,
856cdf0e10cSrcweir     const bool bFillList)
857cdf0e10cSrcweir {
858cdf0e10cSrcweir     mbShowAllShapes = bShowAllShapes;
859cdf0e10cSrcweir     if (bFillList)
860cdf0e10cSrcweir     {
861cdf0e10cSrcweir         if (mpMedium == NULL)
862cdf0e10cSrcweir             Fill(mpDoc, mbShowAllPages, maDocName);
863cdf0e10cSrcweir         else
864cdf0e10cSrcweir             Fill(mpDoc, mpMedium, maDocName);
865cdf0e10cSrcweir     }
866cdf0e10cSrcweir }
867cdf0e10cSrcweir 
GetShowAllShapes(void) const868cdf0e10cSrcweir bool SdPageObjsTLB::GetShowAllShapes (void) const
869cdf0e10cSrcweir {
870cdf0e10cSrcweir     return mbShowAllShapes;
871cdf0e10cSrcweir }
872cdf0e10cSrcweir 
873cdf0e10cSrcweir /*************************************************************************
874*5133a0b6Smseidel |* Prüft, ob die Seiten (PK_STANDARD) und die darauf befindlichen Objekte
875cdf0e10cSrcweir |* des Docs und der TreeLB identisch sind.
876*5133a0b6Smseidel |* Wird ein Doc übergeben, wird dieses zum aktuellem Doc (Wichtig bei
877*5133a0b6Smseidel |* mehreren Dokumenten).
878cdf0e10cSrcweir \************************************************************************/
879cdf0e10cSrcweir 
IsEqualToDoc(const SdDrawDocument * pInDoc)880cdf0e10cSrcweir sal_Bool SdPageObjsTLB::IsEqualToDoc( const SdDrawDocument* pInDoc )
881cdf0e10cSrcweir {
882cdf0e10cSrcweir     if( pInDoc )
883cdf0e10cSrcweir         mpDoc = pInDoc;
884cdf0e10cSrcweir 
885cdf0e10cSrcweir     if( !mpDoc )
886cdf0e10cSrcweir         return( sal_False );
887cdf0e10cSrcweir 
888cdf0e10cSrcweir     SdrObject*   pObj = NULL;
889cdf0e10cSrcweir     SdPage*      pPage = NULL;
890cdf0e10cSrcweir     SvLBoxEntry* pEntry = First();
891cdf0e10cSrcweir     String       aName;
892cdf0e10cSrcweir 
893cdf0e10cSrcweir     // Alle Pages incl. Objekte vergleichen
894cdf0e10cSrcweir     sal_uInt16 nPage = 0;
895cdf0e10cSrcweir     const sal_uInt16 nMaxPages = mpDoc->GetPageCount();
896cdf0e10cSrcweir 
897cdf0e10cSrcweir     while( nPage < nMaxPages )
898cdf0e10cSrcweir     {
899cdf0e10cSrcweir         pPage = (SdPage*) mpDoc->GetPage( nPage );
900cdf0e10cSrcweir         if( pPage->GetPageKind() == PK_STANDARD )
901cdf0e10cSrcweir         {
902cdf0e10cSrcweir             if( !pEntry )
903cdf0e10cSrcweir                 return( sal_False );
904cdf0e10cSrcweir             aName = GetEntryText( pEntry );
905cdf0e10cSrcweir 
906cdf0e10cSrcweir             if( pPage->GetName() != aName )
907cdf0e10cSrcweir                 return( sal_False );
908cdf0e10cSrcweir 
909cdf0e10cSrcweir             pEntry = Next( pEntry );
910cdf0e10cSrcweir 
911cdf0e10cSrcweir             SdrObjListIter aIter(
912cdf0e10cSrcweir                 *pPage,
913cdf0e10cSrcweir                 !pPage->HasObjectNavigationOrder() /* use navigation order, if available */,
914cdf0e10cSrcweir                 IM_DEEPWITHGROUPS );
915cdf0e10cSrcweir 
916cdf0e10cSrcweir             while( aIter.IsMore() )
917cdf0e10cSrcweir             {
918cdf0e10cSrcweir                 pObj = aIter.Next();
919cdf0e10cSrcweir 
920cdf0e10cSrcweir                 const String aObjectName( GetObjectName( pObj ) );
921cdf0e10cSrcweir 
922cdf0e10cSrcweir                 if( aObjectName.Len() )
923cdf0e10cSrcweir                 {
924cdf0e10cSrcweir                     if( !pEntry )
925cdf0e10cSrcweir                         return( sal_False );
926cdf0e10cSrcweir 
927cdf0e10cSrcweir                     aName = GetEntryText( pEntry );
928cdf0e10cSrcweir 
929cdf0e10cSrcweir                     if( aObjectName != aName )
930cdf0e10cSrcweir                         return( sal_False );
931cdf0e10cSrcweir 
932cdf0e10cSrcweir                     pEntry = Next( pEntry );
933cdf0e10cSrcweir                 }
934cdf0e10cSrcweir             }
935cdf0e10cSrcweir         }
936cdf0e10cSrcweir         nPage++;
937cdf0e10cSrcweir     }
938*5133a0b6Smseidel     // Wenn noch Einträge in der Listbox vorhanden sind, wurden
939*5133a0b6Smseidel     // Objekte (mit Namen) oder Seiten gelöscht
940cdf0e10cSrcweir     return( !pEntry );
941cdf0e10cSrcweir }
942cdf0e10cSrcweir 
943cdf0e10cSrcweir /*************************************************************************
944*5133a0b6Smseidel |* Selectierten String zurückgeben
945cdf0e10cSrcweir \************************************************************************/
946cdf0e10cSrcweir 
GetSelectEntry()947cdf0e10cSrcweir String SdPageObjsTLB::GetSelectEntry()
948cdf0e10cSrcweir {
949cdf0e10cSrcweir     return( GetEntryText( GetCurEntry() ) );
950cdf0e10cSrcweir }
951cdf0e10cSrcweir 
952cdf0e10cSrcweir /*************************************************************************
953*5133a0b6Smseidel |* Selektierte Eintrage zurückgeben
954cdf0e10cSrcweir |* nDepth == 0 -> Seiten
955cdf0e10cSrcweir |* nDepth == 1 -> Objekte
956cdf0e10cSrcweir \************************************************************************/
957cdf0e10cSrcweir 
GetSelectEntryList(sal_uInt16 nDepth)958cdf0e10cSrcweir List* SdPageObjsTLB::GetSelectEntryList( sal_uInt16 nDepth )
959cdf0e10cSrcweir {
960cdf0e10cSrcweir     List*        pList  = NULL;
961cdf0e10cSrcweir     SvLBoxEntry* pEntry = FirstSelected();
962cdf0e10cSrcweir 
963cdf0e10cSrcweir     while( pEntry )
964cdf0e10cSrcweir     {
965cdf0e10cSrcweir         sal_uInt16 nListDepth = GetModel()->GetDepth( pEntry );
966cdf0e10cSrcweir         if( nListDepth == nDepth )
967cdf0e10cSrcweir         {
968cdf0e10cSrcweir             if( !pList )
969cdf0e10cSrcweir                 pList = new List();
970cdf0e10cSrcweir 
971cdf0e10cSrcweir             const String aEntryText( GetEntryText( pEntry ) );
972cdf0e10cSrcweir             pList->Insert( new String( aEntryText ), LIST_APPEND );
973cdf0e10cSrcweir         }
974cdf0e10cSrcweir         pEntry = NextSelected( pEntry );
975cdf0e10cSrcweir     }
976cdf0e10cSrcweir 
977cdf0e10cSrcweir     return( pList );
978cdf0e10cSrcweir }
979cdf0e10cSrcweir 
980cdf0e10cSrcweir /*************************************************************************
981*5133a0b6Smseidel |* Einträge werden erst auf Anforderung (Doppelklick) eingefügt
982cdf0e10cSrcweir \************************************************************************/
983cdf0e10cSrcweir 
RequestingChilds(SvLBoxEntry * pFileEntry)984cdf0e10cSrcweir void SdPageObjsTLB::RequestingChilds( SvLBoxEntry* pFileEntry )
985cdf0e10cSrcweir {
986cdf0e10cSrcweir     if( !pFileEntry->HasChilds() )
987cdf0e10cSrcweir     {
988cdf0e10cSrcweir         if( GetBookmarkDoc() )
989cdf0e10cSrcweir         {
990cdf0e10cSrcweir             SdrObject*   pObj = NULL;
991cdf0e10cSrcweir             SdPage*      pPage = NULL;
992cdf0e10cSrcweir             SvLBoxEntry* pPageEntry = NULL;
993cdf0e10cSrcweir 
994cdf0e10cSrcweir             Image aImgPage=Image( BitmapEx( SdResId( BMP_PAGE ) ) );
995cdf0e10cSrcweir             Image aImgPageObjs=Image( BitmapEx( SdResId( BMP_PAGEOBJS ) ) );
996cdf0e10cSrcweir             Image aImgObjects=Image( BitmapEx( SdResId( BMP_OBJECTS ) ) );
997cdf0e10cSrcweir             Image aImgPageH=Image( BitmapEx( SdResId( BMP_PAGE_H ) ) );
998cdf0e10cSrcweir             Image aImgPageObjsH=Image( BitmapEx( SdResId( BMP_PAGEOBJS_H ) ) );
999cdf0e10cSrcweir             Image aImgObjectsH=Image( BitmapEx( SdResId( BMP_OBJECTS_H ) ) );
1000cdf0e10cSrcweir 
1001cdf0e10cSrcweir             // document name already inserted
1002cdf0e10cSrcweir 
1003cdf0e10cSrcweir             // only insert all "normal" ? slides with objects
1004cdf0e10cSrcweir             sal_uInt16 nPage = 0;
1005cdf0e10cSrcweir             const sal_uInt16 nMaxPages = mpBookmarkDoc->GetPageCount();
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir             while( nPage < nMaxPages )
1008cdf0e10cSrcweir             {
1009cdf0e10cSrcweir                 pPage = (SdPage*) mpBookmarkDoc->GetPage( nPage );
1010cdf0e10cSrcweir                 if( pPage->GetPageKind() == PK_STANDARD )
1011cdf0e10cSrcweir                 {
1012cdf0e10cSrcweir                     pPageEntry = InsertEntry( pPage->GetName(),
1013cdf0e10cSrcweir                                               aImgPage,
1014cdf0e10cSrcweir                                               aImgPage,
1015cdf0e10cSrcweir                                               pFileEntry,
1016cdf0e10cSrcweir                                               sal_False,
1017cdf0e10cSrcweir                                               LIST_APPEND,
1018cdf0e10cSrcweir                                               reinterpret_cast< void* >( 1 ) );
1019cdf0e10cSrcweir 
1020cdf0e10cSrcweir                     SetExpandedEntryBmp( pPageEntry, aImgPageH, BMP_COLOR_HIGHCONTRAST );
1021cdf0e10cSrcweir                     SetCollapsedEntryBmp( pPageEntry, aImgPageH, BMP_COLOR_HIGHCONTRAST );
1022cdf0e10cSrcweir 
1023cdf0e10cSrcweir                     SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir                     while( aIter.IsMore() )
1026cdf0e10cSrcweir                     {
1027cdf0e10cSrcweir                         pObj = aIter.Next();
1028cdf0e10cSrcweir                         String aStr( GetObjectName( pObj ) );
1029cdf0e10cSrcweir                         if( aStr.Len() )
1030cdf0e10cSrcweir                         {
1031cdf0e10cSrcweir                             if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_OLE2 )
1032cdf0e10cSrcweir                             {
1033cdf0e10cSrcweir                                 SvLBoxEntry* pNewEntry = InsertEntry(aStr, maImgOle, maImgOle, pPageEntry);
1034cdf0e10cSrcweir 
1035cdf0e10cSrcweir                                 SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
1036cdf0e10cSrcweir                                 SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
1037cdf0e10cSrcweir                             }
1038cdf0e10cSrcweir                             else if( pObj->GetObjInventor() == SdrInventor && pObj->GetObjIdentifier() == OBJ_GRAF )
1039cdf0e10cSrcweir                             {
1040cdf0e10cSrcweir                                 SvLBoxEntry* pNewEntry = InsertEntry(aStr, maImgGraphic, maImgGraphic, pPageEntry);
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir                                 SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
1043cdf0e10cSrcweir                                 SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
1044cdf0e10cSrcweir                             }
1045cdf0e10cSrcweir                             else
1046cdf0e10cSrcweir                             {
1047cdf0e10cSrcweir                                 SvLBoxEntry* pNewEntry = InsertEntry(aStr, aImgObjects, aImgObjects, pPageEntry);
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir                                 SetExpandedEntryBmp( pNewEntry, aImgObjectsH, BMP_COLOR_HIGHCONTRAST );
1050cdf0e10cSrcweir                                 SetCollapsedEntryBmp( pNewEntry, aImgObjectsH, BMP_COLOR_HIGHCONTRAST );
1051cdf0e10cSrcweir                             }
1052cdf0e10cSrcweir                         }
1053cdf0e10cSrcweir                     }
1054cdf0e10cSrcweir                     if( pPageEntry->HasChilds() )
1055cdf0e10cSrcweir                     {
1056cdf0e10cSrcweir                         SetExpandedEntryBmp( pPageEntry, aImgPageObjs );
1057cdf0e10cSrcweir                         SetCollapsedEntryBmp( pPageEntry, aImgPageObjs );
1058cdf0e10cSrcweir                         SetExpandedEntryBmp( pPageEntry, aImgPageObjsH, BMP_COLOR_HIGHCONTRAST );
1059cdf0e10cSrcweir                         SetCollapsedEntryBmp( pPageEntry, aImgPageObjsH, BMP_COLOR_HIGHCONTRAST );
1060cdf0e10cSrcweir                     }
1061cdf0e10cSrcweir                 }
1062cdf0e10cSrcweir                 nPage++;
1063cdf0e10cSrcweir             }
1064cdf0e10cSrcweir         }
1065cdf0e10cSrcweir     }
1066cdf0e10cSrcweir     else
1067cdf0e10cSrcweir         SvTreeListBox::RequestingChilds( pFileEntry );
1068cdf0e10cSrcweir }
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir /*************************************************************************
1071*5133a0b6Smseidel |*  Prüft, ob es sich um eine Draw-Datei handelt und öffnet anhand des
1072*5133a0b6Smseidel |*  übergebenen Docs das BookmarkDoc
1073cdf0e10cSrcweir \************************************************************************/
1074cdf0e10cSrcweir 
GetBookmarkDoc(SfxMedium * pMed)1075cdf0e10cSrcweir SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed)
1076cdf0e10cSrcweir {
1077cdf0e10cSrcweir     if (
1078cdf0e10cSrcweir        !mpBookmarkDoc ||
1079cdf0e10cSrcweir          (pMed && (!mpOwnMedium || mpOwnMedium->GetName() != pMed->GetName()))
1080cdf0e10cSrcweir       )
1081cdf0e10cSrcweir     {
1082cdf0e10cSrcweir         // create a new BookmarkDoc if now one exists or if a new Medium is provided
1083cdf0e10cSrcweir         if (mpOwnMedium != pMed)
1084cdf0e10cSrcweir         {
1085cdf0e10cSrcweir             CloseBookmarkDoc();
1086cdf0e10cSrcweir         }
1087cdf0e10cSrcweir 
1088cdf0e10cSrcweir         if (pMed)
1089cdf0e10cSrcweir         {
1090*5133a0b6Smseidel             // it looks like it is undefined if a Medium was set by Fill() already
1091cdf0e10cSrcweir             DBG_ASSERT( !mpMedium, "SfxMedium confusion!" );
1092cdf0e10cSrcweir             delete mpMedium;
1093cdf0e10cSrcweir             mpMedium = NULL;
1094cdf0e10cSrcweir 
1095cdf0e10cSrcweir             // take over this Medium (currently used only be Navigator)
1096cdf0e10cSrcweir             mpOwnMedium = pMed;
1097cdf0e10cSrcweir         }
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir         DBG_ASSERT( mpMedium || pMed, "No SfxMedium provided!" );
1100cdf0e10cSrcweir 
1101cdf0e10cSrcweir         if( pMed )
1102cdf0e10cSrcweir         {
1103cdf0e10cSrcweir             // in this mode the document is also owned and controlled by this instance
1104cdf0e10cSrcweir             mxBookmarkDocShRef = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD, sal_True);
1105cdf0e10cSrcweir             if (mxBookmarkDocShRef->DoLoad(pMed))
1106cdf0e10cSrcweir                 mpBookmarkDoc = mxBookmarkDocShRef->GetDoc();
1107cdf0e10cSrcweir             else
1108cdf0e10cSrcweir                 mpBookmarkDoc = NULL;
1109cdf0e10cSrcweir         }
1110cdf0e10cSrcweir         else if ( mpMedium )
1111cdf0e10cSrcweir             // in this mode the document is owned and controlled by the SdDrawDocument
1112cdf0e10cSrcweir             // it can be released by calling the corresponding CloseBookmarkDoc method
111386e1cf34SPedro Giffuni             // successful creation of a document makes this the owner of the medium
1114cdf0e10cSrcweir             mpBookmarkDoc = ((SdDrawDocument*) mpDoc)->OpenBookmarkDoc(*mpMedium);
1115cdf0e10cSrcweir 
1116cdf0e10cSrcweir         if ( !mpBookmarkDoc )
1117cdf0e10cSrcweir         {
1118cdf0e10cSrcweir             ErrorBox aErrorBox( this, WB_OK, String( SdResId( STR_READ_DATA_ERROR ) ) );
1119cdf0e10cSrcweir             aErrorBox.Execute();
1120cdf0e10cSrcweir             mpMedium = 0; //On failure the SfxMedium is invalid
1121cdf0e10cSrcweir         }
1122cdf0e10cSrcweir     }
1123cdf0e10cSrcweir 
1124cdf0e10cSrcweir     return( mpBookmarkDoc );
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir 
1127cdf0e10cSrcweir /*************************************************************************
1128*5133a0b6Smseidel |* Bookmark-Dokument schließen und löschen
1129cdf0e10cSrcweir \************************************************************************/
1130cdf0e10cSrcweir 
CloseBookmarkDoc()1131cdf0e10cSrcweir void SdPageObjsTLB::CloseBookmarkDoc()
1132cdf0e10cSrcweir {
1133cdf0e10cSrcweir     if (mxBookmarkDocShRef.Is())
1134cdf0e10cSrcweir     {
1135cdf0e10cSrcweir         mxBookmarkDocShRef->DoClose();
1136cdf0e10cSrcweir         mxBookmarkDocShRef.Clear();
1137cdf0e10cSrcweir 
1138cdf0e10cSrcweir         // Medium is owned by document, so it's destroyed already
1139cdf0e10cSrcweir         mpOwnMedium = 0;
1140cdf0e10cSrcweir     }
1141cdf0e10cSrcweir     else if ( mpBookmarkDoc )
1142cdf0e10cSrcweir     {
1143cdf0e10cSrcweir         DBG_ASSERT( !mpOwnMedium, "SfxMedium confusion!" );
1144cdf0e10cSrcweir         if ( mpDoc )
1145cdf0e10cSrcweir         {
1146cdf0e10cSrcweir             // The document owns the Medium, so the Medium will be invalid after closing the document
1147cdf0e10cSrcweir             ((SdDrawDocument*) mpDoc)->CloseBookmarkDoc();
1148cdf0e10cSrcweir             mpMedium = 0;
1149cdf0e10cSrcweir         }
1150cdf0e10cSrcweir     }
1151cdf0e10cSrcweir     else
1152cdf0e10cSrcweir     {
115386e1cf34SPedro Giffuni         // perhaps mpOwnMedium provided, but no successful creation of BookmarkDoc
1154cdf0e10cSrcweir         delete mpOwnMedium;
1155cdf0e10cSrcweir         mpOwnMedium = NULL;
1156cdf0e10cSrcweir     }
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir     mpBookmarkDoc = NULL;
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir 
1161cdf0e10cSrcweir /*************************************************************************
1162cdf0e10cSrcweir |*
1163cdf0e10cSrcweir \************************************************************************/
1164cdf0e10cSrcweir 
SelectHdl()1165cdf0e10cSrcweir void SdPageObjsTLB::SelectHdl()
1166cdf0e10cSrcweir {
1167cdf0e10cSrcweir     SvLBoxEntry* pEntry = FirstSelected();
1168cdf0e10cSrcweir 
1169cdf0e10cSrcweir     mbLinkableSelected = sal_True;
1170cdf0e10cSrcweir 
1171cdf0e10cSrcweir     while( pEntry && mbLinkableSelected )
1172cdf0e10cSrcweir     {
1173cdf0e10cSrcweir         if( NULL == pEntry->GetUserData() )
1174cdf0e10cSrcweir             mbLinkableSelected = sal_False;
1175cdf0e10cSrcweir 
1176cdf0e10cSrcweir         pEntry = NextSelected( pEntry );
1177cdf0e10cSrcweir     }
1178cdf0e10cSrcweir 
1179cdf0e10cSrcweir     SvTreeListBox::SelectHdl();
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir /*************************************************************************
1183*5133a0b6Smseidel |* Überlädt RETURN mit der Funktionsweise von DoubleClick
1184cdf0e10cSrcweir \************************************************************************/
1185cdf0e10cSrcweir 
KeyInput(const KeyEvent & rKEvt)1186cdf0e10cSrcweir void SdPageObjsTLB::KeyInput( const KeyEvent& rKEvt )
1187cdf0e10cSrcweir {
1188cdf0e10cSrcweir     if( rKEvt.GetKeyCode().GetCode() == KEY_RETURN )
1189cdf0e10cSrcweir     {
1190cdf0e10cSrcweir         // Auskommentierter Code aus svtools/source/contnr/svimpbox.cxx
1191cdf0e10cSrcweir         SvLBoxEntry* pCursor = GetCurEntry();
1192cdf0e10cSrcweir         if( pCursor->HasChilds() || pCursor->HasChildsOnDemand() )
1193cdf0e10cSrcweir         {
1194cdf0e10cSrcweir             if( IsExpanded( pCursor ) )
1195cdf0e10cSrcweir                 Collapse( pCursor );
1196cdf0e10cSrcweir             else
1197cdf0e10cSrcweir                 Expand( pCursor );
1198cdf0e10cSrcweir         }
1199cdf0e10cSrcweir 
1200cdf0e10cSrcweir         DoubleClickHdl();
1201cdf0e10cSrcweir     }
12020deba7fbSSteve Yin     else if (rKEvt.GetKeyCode().GetCode() == KEY_SPACE)
12030deba7fbSSteve Yin     {
12040deba7fbSSteve Yin        if(bisInSdNavigatorWin)
12050deba7fbSSteve Yin        {
12060deba7fbSSteve Yin            sal_Bool bMarked=sal_False;
12070deba7fbSSteve Yin            SvLBoxEntry* pNewEntry = GetCurEntry();
12080deba7fbSSteve Yin            if( GetParent(pNewEntry) == NULL )
12090deba7fbSSteve Yin                return;
12100deba7fbSSteve Yin            String  aStr=GetSelectEntry();
12110deba7fbSSteve Yin            Window* pWindow=NULL;
12120deba7fbSSteve Yin            SdNavigatorWin* pSdNavigatorWin=NULL;
12130deba7fbSSteve Yin            sd::DrawDocShell* pSdDrawDocShell = NULL;
12140deba7fbSSteve Yin            if(pNewEntry)
12150deba7fbSSteve Yin                pWindow=(Window*)GetParent(pNewEntry);
12160deba7fbSSteve Yin            if(pWindow)
12170deba7fbSSteve Yin                pSdNavigatorWin = (SdNavigatorWin*)pWindow;
12180deba7fbSSteve Yin            if( pSdNavigatorWin )
12190deba7fbSSteve Yin                pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);
12200deba7fbSSteve Yin            if(pSdDrawDocShell)
12210deba7fbSSteve Yin            {
12220deba7fbSSteve Yin                pSdDrawDocShell->GotoTreeBookmark(aStr);
12230deba7fbSSteve Yin                bMarked=pSdDrawDocShell->GetObjectIsmarked(aStr);
12240deba7fbSSteve Yin            }
12250deba7fbSSteve Yin            // Removed by yanjun for sym2_6385
1226*5133a0b6Smseidel            // The symphony2.0 can support more than one level tree list, also support to select tow or more items in different level.
12270deba7fbSSteve Yin            /*
12280deba7fbSSteve Yin            SvLBoxEntry* pBeginEntry = First();
12290deba7fbSSteve Yin            if( pBeginEntry )
12300deba7fbSSteve Yin            {
12310deba7fbSSteve Yin                if( GetParent(pBeginEntry) !=  GetParent(pNewEntry) )
12320deba7fbSSteve Yin                    pBeginEntry->SetMarked( sal_False );
12330deba7fbSSteve Yin                SvLBoxEntry* pNextEntry = Next( pBeginEntry );
12340deba7fbSSteve Yin                while( pNextEntry )
12350deba7fbSSteve Yin                {
12360deba7fbSSteve Yin                    if( GetParent(pNextEntry) !=  GetParent(pNewEntry) )
12370deba7fbSSteve Yin                        pNextEntry->SetMarked( sal_False );
12380deba7fbSSteve Yin                    pNextEntry =  Next( pNextEntry );
12390deba7fbSSteve Yin                }
12400deba7fbSSteve Yin            }
12410deba7fbSSteve Yin            End*/
12420deba7fbSSteve Yin            if(pNewEntry)
12430deba7fbSSteve Yin            {
12440deba7fbSSteve Yin                if(bMarked)
12450deba7fbSSteve Yin                {
12460deba7fbSSteve Yin                    pNewEntry->SetMarked(sal_True);
12470deba7fbSSteve Yin                }
12480deba7fbSSteve Yin                else
12490deba7fbSSteve Yin                {
12500deba7fbSSteve Yin                    pNewEntry->SetMarked( sal_False );
12510deba7fbSSteve Yin                }
12520deba7fbSSteve Yin            }
12530deba7fbSSteve Yin            Invalidate();
12540deba7fbSSteve Yin        }
12550deba7fbSSteve Yin     }
1256cdf0e10cSrcweir     else
1257cdf0e10cSrcweir         SvTreeListBox::KeyInput( rKEvt );
1258cdf0e10cSrcweir }
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir /*************************************************************************
1261cdf0e10cSrcweir |* StartDrag-Request
1262cdf0e10cSrcweir \************************************************************************/
1263cdf0e10cSrcweir 
StartDrag(sal_Int8 nAction,const Point & rPosPixel)1264cdf0e10cSrcweir void SdPageObjsTLB::StartDrag( sal_Int8 nAction, const Point& rPosPixel)
1265cdf0e10cSrcweir {
1266cdf0e10cSrcweir     (void)nAction;
1267cdf0e10cSrcweir     (void)rPosPixel;
1268cdf0e10cSrcweir 
1269cdf0e10cSrcweir     SdNavigatorWin* pNavWin = NULL;
1270cdf0e10cSrcweir     SvLBoxEntry* pEntry = GetEntry(rPosPixel);
1271cdf0e10cSrcweir 
1272cdf0e10cSrcweir     if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
1273cdf0e10cSrcweir         pNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) );
1274cdf0e10cSrcweir 
1275cdf0e10cSrcweir     if (pEntry != NULL
1276cdf0e10cSrcweir         && pNavWin !=NULL
1277cdf0e10cSrcweir         && pNavWin == mpParent
1278cdf0e10cSrcweir         && pNavWin->GetNavigatorDragType() != NAVIGATOR_DRAGTYPE_NONE )
1279cdf0e10cSrcweir     {
1280cdf0e10cSrcweir         // Mark only the children of the page under the mouse as drop
1281cdf0e10cSrcweir         // targets. This prevents moving shapes from one page to another.
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir         // Select all entries and disable them as drop targets.
1284cdf0e10cSrcweir         SetSelectionMode(MULTIPLE_SELECTION);
1285cdf0e10cSrcweir         SetCursor(NULL, sal_False);
1286cdf0e10cSrcweir         SelectAll(sal_True, sal_False);
1287cdf0e10cSrcweir         EnableSelectionAsDropTarget(sal_False, sal_True);
1288cdf0e10cSrcweir 
1289cdf0e10cSrcweir         // Enable only the entries as drop targets that are children of the
1290cdf0e10cSrcweir         // page under the mouse.
1291cdf0e10cSrcweir         SvLBoxEntry* pParent = GetRootLevelParent(pEntry);
1292cdf0e10cSrcweir         if (pParent != NULL)
1293cdf0e10cSrcweir         {
1294cdf0e10cSrcweir             SelectAll(sal_False, sal_False);
1295cdf0e10cSrcweir             Select(pParent, sal_True);
1296cdf0e10cSrcweir             //for (SvLBoxEntry*pChild=FirstChild(pParent); pChild!=NULL; pChild=NextSibling(pChild))
1297cdf0e10cSrcweir             //Select(pChild, sal_True);
1298cdf0e10cSrcweir             EnableSelectionAsDropTarget(sal_True, sal_True);//sal_False);
1299cdf0e10cSrcweir         }
1300cdf0e10cSrcweir 
1301cdf0e10cSrcweir         // Set selection back to the entry under the mouse.
1302cdf0e10cSrcweir         SelectAll(sal_False,sal_False);
1303cdf0e10cSrcweir         SetSelectionMode(SINGLE_SELECTION);
1304cdf0e10cSrcweir         Select(pEntry, sal_True);
1305cdf0e10cSrcweir 
1306*5133a0b6Smseidel         // Aus dem ExecuteDrag heraus kann der Navigator gelöscht werden
1307*5133a0b6Smseidel         // (beim Umschalten auf einen anderen Dokument-Typ), das würde aber
1308cdf0e10cSrcweir         // den StarView MouseMove-Handler, der Command() aufruft, umbringen.
1309cdf0e10cSrcweir         // Deshalb Drag&Drop asynchron:
1310cdf0e10cSrcweir         Application::PostUserEvent( STATIC_LINK( this, SdPageObjsTLB, ExecDragHdl ) );
1311cdf0e10cSrcweir     }
1312cdf0e10cSrcweir }
1313cdf0e10cSrcweir 
1314cdf0e10cSrcweir /*************************************************************************
1315cdf0e10cSrcweir |* Begin drag
1316cdf0e10cSrcweir \************************************************************************/
1317cdf0e10cSrcweir 
DoDrag()1318cdf0e10cSrcweir void SdPageObjsTLB::DoDrag()
1319cdf0e10cSrcweir {
1320cdf0e10cSrcweir     mpDropNavWin = ( mpFrame->HasChildWindow( SID_NAVIGATOR ) ) ?
1321cdf0e10cSrcweir                   (SdNavigatorWin*)( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) ) :
1322cdf0e10cSrcweir                   NULL;
1323cdf0e10cSrcweir 
1324cdf0e10cSrcweir     if( mpDropNavWin )
1325cdf0e10cSrcweir     {
1326cdf0e10cSrcweir         ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
1327cdf0e10cSrcweir         String aURL = INetURLObject( pDocShell->GetMedium()->GetPhysicalName(), INET_PROT_FILE ).GetMainURL( INetURLObject::NO_DECODE );
1328cdf0e10cSrcweir         NavigatorDragType   eDragType = mpDropNavWin->GetNavigatorDragType();
1329cdf0e10cSrcweir 
1330cdf0e10cSrcweir         aURL.Append( '#' );
1331cdf0e10cSrcweir         aURL.Append( GetSelectEntry() );
1332cdf0e10cSrcweir 
1333cdf0e10cSrcweir         INetBookmark    aBookmark( aURL, GetSelectEntry() );
1334cdf0e10cSrcweir         sal_Int8        nDNDActions = DND_ACTION_COPYMOVE;
1335cdf0e10cSrcweir 
1336cdf0e10cSrcweir         if( eDragType == NAVIGATOR_DRAGTYPE_LINK )
1337cdf0e10cSrcweir             nDNDActions = DND_ACTION_LINK;  // #93240# Either COPY *or* LINK, never both!
1338cdf0e10cSrcweir         else if (mpDoc->GetSdPageCount(PK_STANDARD) == 1)
1339cdf0e10cSrcweir         {
1340cdf0e10cSrcweir             // Can not move away the last slide in a document.
1341cdf0e10cSrcweir             nDNDActions = DND_ACTION_COPY;
1342cdf0e10cSrcweir         }
1343cdf0e10cSrcweir 
1344cdf0e10cSrcweir         SvTreeListBox::ReleaseMouse();
1345cdf0e10cSrcweir 
1346cdf0e10cSrcweir         bIsInDrag = sal_True;
1347cdf0e10cSrcweir 
1348cdf0e10cSrcweir         SvLBoxDDInfo aDDInfo;
1349cdf0e10cSrcweir         memset(&aDDInfo,0,sizeof(SvLBoxDDInfo));
1350cdf0e10cSrcweir         aDDInfo.pApp = GetpApp();
1351cdf0e10cSrcweir         aDDInfo.pSource = this;
1352cdf0e10cSrcweir         // aDDInfo.pDDStartEntry = pEntry;
1353cdf0e10cSrcweir         ::com::sun::star::uno::Sequence<sal_Int8> aSequence (sizeof(SvLBoxDDInfo));
1354cdf0e10cSrcweir         memcpy(aSequence.getArray(), (sal_Char*)&aDDInfo, sizeof(SvLBoxDDInfo));
1355cdf0e10cSrcweir         ::com::sun::star::uno::Any aTreeListBoxData (aSequence);
1356cdf0e10cSrcweir 
1357cdf0e10cSrcweir         // object is destroyed by internal reference mechanism
1358cdf0e10cSrcweir         SdTransferable* pTransferable = new SdPageObjsTLB::SdPageObjsTransferable(
1359cdf0e10cSrcweir             *this, aBookmark, *pDocShell, eDragType, aTreeListBoxData);
1360cdf0e10cSrcweir 
1361cdf0e10cSrcweir         // Get the view.
1362cdf0e10cSrcweir         ::sd::ViewShell* pViewShell = GetViewShellForDocShell(*pDocShell);
1363cdf0e10cSrcweir         if (pViewShell == NULL)
1364cdf0e10cSrcweir         {
1365cdf0e10cSrcweir             OSL_ASSERT(pViewShell!=NULL);
1366cdf0e10cSrcweir             return;
1367cdf0e10cSrcweir         }
1368cdf0e10cSrcweir         sd::View* pView = pViewShell->GetView();
1369cdf0e10cSrcweir         if (pView == NULL)
1370cdf0e10cSrcweir         {
1371cdf0e10cSrcweir             OSL_ASSERT(pView!=NULL);
1372cdf0e10cSrcweir             return;
1373cdf0e10cSrcweir         }
1374cdf0e10cSrcweir 
1375cdf0e10cSrcweir         SdrObject* pObject = NULL;
1376cdf0e10cSrcweir         void* pUserData = GetCurEntry()->GetUserData();
1377cdf0e10cSrcweir         if (pUserData != NULL && pUserData != (void*)1)
1378cdf0e10cSrcweir             pObject = reinterpret_cast<SdrObject*>(pUserData);
1379cdf0e10cSrcweir         if (pObject != NULL)
1380cdf0e10cSrcweir         {
1381cdf0e10cSrcweir             // For shapes without a user supplied name (the automatically
1382cdf0e10cSrcweir             // created name does not count), a different drag and drop technique
1383cdf0e10cSrcweir             // is used.
1384cdf0e10cSrcweir             if (GetObjectName(pObject, false).Len() == 0)
1385cdf0e10cSrcweir             {
1386cdf0e10cSrcweir                 AddShapeToTransferable(*pTransferable, *pObject);
1387cdf0e10cSrcweir                 pTransferable->SetView(pView);
1388cdf0e10cSrcweir                 SD_MOD()->pTransferDrag = pTransferable;
1389cdf0e10cSrcweir             }
1390cdf0e10cSrcweir 
1391cdf0e10cSrcweir             // Unnamed shapes have to be selected to be recognized by the
1392cdf0e10cSrcweir             // current drop implementation. In order to have a consistent
1393*5133a0b6Smseidel             // behavior for all shapes, every shape that is to be dragged is
1394cdf0e10cSrcweir             // selected first.
1395cdf0e10cSrcweir             SdrPageView* pPageView = pView->GetSdrPageView();
1396cdf0e10cSrcweir             pView->UnmarkAllObj(pPageView);
1397cdf0e10cSrcweir             pView->MarkObj(pObject, pPageView);
1398cdf0e10cSrcweir         }
1399cdf0e10cSrcweir         else
1400cdf0e10cSrcweir         {
1401cdf0e10cSrcweir             pTransferable->SetView(pView);
1402cdf0e10cSrcweir             SD_MOD()->pTransferDrag = pTransferable;
1403cdf0e10cSrcweir         }
1404cdf0e10cSrcweir 
1405cdf0e10cSrcweir         pTransferable->StartDrag( this, nDNDActions );
1406cdf0e10cSrcweir     }
1407cdf0e10cSrcweir }
1408cdf0e10cSrcweir 
1409cdf0e10cSrcweir /*************************************************************************
1410cdf0e10cSrcweir |* Drag finished
1411cdf0e10cSrcweir \************************************************************************/
1412cdf0e10cSrcweir 
OnDragFinished(sal_uInt8)1413cdf0e10cSrcweir void SdPageObjsTLB::OnDragFinished( sal_uInt8 )
1414cdf0e10cSrcweir {
1415cdf0e10cSrcweir     if( mpFrame->HasChildWindow( SID_NAVIGATOR ) )
1416cdf0e10cSrcweir     {
1417cdf0e10cSrcweir         SdNavigatorWin* pNewNavWin = (SdNavigatorWin*) ( mpFrame->GetChildWindow( SID_NAVIGATOR )->GetContextWindow( SD_MOD() ) );
1418cdf0e10cSrcweir 
1419cdf0e10cSrcweir         if( mpDropNavWin == pNewNavWin)
1420cdf0e10cSrcweir         {
1421cdf0e10cSrcweir             MouseEvent aMEvt( mpDropNavWin->GetPointerPosPixel() );
1422cdf0e10cSrcweir             SvTreeListBox::MouseButtonUp( aMEvt );
1423cdf0e10cSrcweir         }
1424cdf0e10cSrcweir     }
1425cdf0e10cSrcweir 
1426cdf0e10cSrcweir     mpDropNavWin = NULL;
1427cdf0e10cSrcweir     bIsInDrag = sal_False;
1428cdf0e10cSrcweir }
1429cdf0e10cSrcweir 
1430cdf0e10cSrcweir /*************************************************************************
1431cdf0e10cSrcweir |* AcceptDrop-Event
1432cdf0e10cSrcweir \************************************************************************/
1433cdf0e10cSrcweir 
AcceptDrop(const AcceptDropEvent & rEvent)1434cdf0e10cSrcweir sal_Int8 SdPageObjsTLB::AcceptDrop (const AcceptDropEvent& rEvent)
1435cdf0e10cSrcweir {
1436cdf0e10cSrcweir     sal_Int8 nResult (DND_ACTION_NONE);
1437cdf0e10cSrcweir 
1438cdf0e10cSrcweir     if ( !bIsInDrag && IsDropFormatSupported( FORMAT_FILE ) )
1439cdf0e10cSrcweir     {
1440cdf0e10cSrcweir         nResult = rEvent.mnAction;
1441cdf0e10cSrcweir     }
1442cdf0e10cSrcweir     else
1443cdf0e10cSrcweir     {
1444cdf0e10cSrcweir         SvLBoxEntry* pEntry = GetDropTarget(rEvent.maPosPixel);
1445cdf0e10cSrcweir         if (rEvent.mbLeaving || !CheckDragAndDropMode( this, rEvent.mnAction ))
1446cdf0e10cSrcweir         {
1447cdf0e10cSrcweir             ImplShowTargetEmphasis( pTargetEntry, sal_False );
1448cdf0e10cSrcweir         }
1449cdf0e10cSrcweir         else if( !nDragDropMode )
1450cdf0e10cSrcweir         {
1451cdf0e10cSrcweir             DBG_ERRORFILE( "SdPageObjsTLB::AcceptDrop(): no target" );
1452cdf0e10cSrcweir         }
1453cdf0e10cSrcweir         else if (IsDropAllowed(pEntry))
1454cdf0e10cSrcweir         {
1455cdf0e10cSrcweir             nResult = DND_ACTION_MOVE;
1456cdf0e10cSrcweir 
1457cdf0e10cSrcweir             // Draw emphasis.
1458cdf0e10cSrcweir             if (pEntry != pTargetEntry || !(nImpFlags & SVLBOX_TARGEMPH_VIS))
1459cdf0e10cSrcweir             {
1460cdf0e10cSrcweir                 ImplShowTargetEmphasis( pTargetEntry, sal_False );
1461cdf0e10cSrcweir                 pTargetEntry = pEntry;
1462cdf0e10cSrcweir                 ImplShowTargetEmphasis( pTargetEntry, sal_True );
1463cdf0e10cSrcweir             }
1464cdf0e10cSrcweir         }
1465cdf0e10cSrcweir     }
1466cdf0e10cSrcweir 
1467cdf0e10cSrcweir     // Hide emphasis when there is no valid drop action.
1468cdf0e10cSrcweir     if (nResult == DND_ACTION_NONE)
1469cdf0e10cSrcweir         ImplShowTargetEmphasis(pTargetEntry, sal_False);
1470cdf0e10cSrcweir 
1471cdf0e10cSrcweir     return nResult;
1472cdf0e10cSrcweir }
1473cdf0e10cSrcweir 
1474cdf0e10cSrcweir /*************************************************************************
1475cdf0e10cSrcweir |* ExecuteDrop-Event
1476cdf0e10cSrcweir \************************************************************************/
1477cdf0e10cSrcweir 
ExecuteDrop(const ExecuteDropEvent & rEvt)1478cdf0e10cSrcweir sal_Int8 SdPageObjsTLB::ExecuteDrop( const ExecuteDropEvent& rEvt )
1479cdf0e10cSrcweir {
1480cdf0e10cSrcweir     sal_Int8 nRet = DND_ACTION_NONE;
1481cdf0e10cSrcweir 
1482cdf0e10cSrcweir     try
1483cdf0e10cSrcweir     {
1484cdf0e10cSrcweir         if( !bIsInDrag )
1485cdf0e10cSrcweir         {
1486cdf0e10cSrcweir             SdNavigatorWin* pNavWin = NULL;
1487cdf0e10cSrcweir             sal_uInt16          nId = SID_NAVIGATOR;
1488cdf0e10cSrcweir 
1489cdf0e10cSrcweir             if( mpFrame->HasChildWindow( nId ) )
1490cdf0e10cSrcweir                 pNavWin = (SdNavigatorWin*)( mpFrame->GetChildWindow( nId )->GetContextWindow( SD_MOD() ) );
1491cdf0e10cSrcweir 
1492cdf0e10cSrcweir             if( pNavWin && ( pNavWin == mpParent ) )
1493cdf0e10cSrcweir             {
1494cdf0e10cSrcweir                 TransferableDataHelper  aDataHelper( rEvt.maDropEvent.Transferable );
1495cdf0e10cSrcweir                 String                  aFile;
1496cdf0e10cSrcweir 
1497cdf0e10cSrcweir                 if( aDataHelper.GetString( FORMAT_FILE, aFile ) &&
1498cdf0e10cSrcweir                     ( (SdNavigatorWin*) mpParent)->InsertFile( aFile ) )
1499cdf0e10cSrcweir                 {
1500cdf0e10cSrcweir                     nRet = rEvt.mnAction;
1501cdf0e10cSrcweir                 }
1502cdf0e10cSrcweir             }
1503cdf0e10cSrcweir         }
1504cdf0e10cSrcweir     }
1505cdf0e10cSrcweir     catch (com::sun::star::uno::Exception&)
1506cdf0e10cSrcweir     {
1507cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
1508cdf0e10cSrcweir     }
1509cdf0e10cSrcweir 
1510cdf0e10cSrcweir     if (nRet == DND_ACTION_NONE)
1511cdf0e10cSrcweir         SvTreeListBox::ExecuteDrop(rEvt, this);
1512cdf0e10cSrcweir 
1513cdf0e10cSrcweir     return nRet;
1514cdf0e10cSrcweir }
1515cdf0e10cSrcweir 
1516cdf0e10cSrcweir /*************************************************************************
1517*5133a0b6Smseidel |* Handler for dragging
1518cdf0e10cSrcweir \************************************************************************/
1519cdf0e10cSrcweir 
IMPL_STATIC_LINK(SdPageObjsTLB,ExecDragHdl,void *,EMPTYARG)1520cdf0e10cSrcweir IMPL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*, EMPTYARG)
1521cdf0e10cSrcweir {
1522cdf0e10cSrcweir     //  als Link, damit asynchron ohne ImpMouseMoveMsg auf dem Stack auch der
1523*5133a0b6Smseidel     //  Navigator gelöscht werden darf
1524cdf0e10cSrcweir     pThis->DoDrag();
1525cdf0e10cSrcweir     return 0;
1526cdf0e10cSrcweir }
1527cdf0e10cSrcweir 
PageBelongsToCurrentShow(const SdPage * pPage) const1528cdf0e10cSrcweir bool SdPageObjsTLB::PageBelongsToCurrentShow (const SdPage* pPage) const
1529cdf0e10cSrcweir {
1530cdf0e10cSrcweir     // Return <TRUE/> as default when there is no custom show or when none
1531cdf0e10cSrcweir     // is used. The page does then belong to the standard show.
1532cdf0e10cSrcweir     bool bBelongsToShow = true;
1533cdf0e10cSrcweir 
1534cdf0e10cSrcweir     if (mpDoc->getPresentationSettings().mbCustomShow)
1535cdf0e10cSrcweir     {
1536cdf0e10cSrcweir         // Get the current custom show.
1537cdf0e10cSrcweir         SdCustomShow* pCustomShow = NULL;
1538cdf0e10cSrcweir         List* pShowList = const_cast<SdDrawDocument*>(mpDoc)->GetCustomShowList();
1539cdf0e10cSrcweir         if (pShowList != NULL)
1540cdf0e10cSrcweir         {
1541cdf0e10cSrcweir             sal_uLong nCurrentShowIndex = pShowList->GetCurPos();
1542cdf0e10cSrcweir             void* pObject = pShowList->GetObject(nCurrentShowIndex);
1543cdf0e10cSrcweir             pCustomShow = static_cast<SdCustomShow*>(pObject);
1544cdf0e10cSrcweir         }
1545cdf0e10cSrcweir 
1546cdf0e10cSrcweir         // Check whether the given page is part of that custom show.
1547cdf0e10cSrcweir         if (pCustomShow != NULL)
1548cdf0e10cSrcweir         {
1549cdf0e10cSrcweir             bBelongsToShow = false;
1550cdf0e10cSrcweir             sal_uLong nPageCount = pCustomShow->Count();
1551cdf0e10cSrcweir             for (sal_uInt16 i=0; i<nPageCount && !bBelongsToShow; i++)
1552cdf0e10cSrcweir                 if (pPage == static_cast<SdPage*>(pCustomShow->GetObject (i)))
1553cdf0e10cSrcweir                     bBelongsToShow = true;
1554cdf0e10cSrcweir         }
1555cdf0e10cSrcweir     }
1556cdf0e10cSrcweir 
1557cdf0e10cSrcweir     return bBelongsToShow;
1558cdf0e10cSrcweir }
1559cdf0e10cSrcweir 
NotifyMoving(SvLBoxEntry * pTarget,SvLBoxEntry * pEntry,SvLBoxEntry * & rpNewParent,sal_uLong & rNewChildPos)1560cdf0e10cSrcweir sal_Bool SdPageObjsTLB::NotifyMoving(
1561cdf0e10cSrcweir     SvLBoxEntry* pTarget,
1562cdf0e10cSrcweir     SvLBoxEntry* pEntry,
1563cdf0e10cSrcweir     SvLBoxEntry*& rpNewParent,
1564cdf0e10cSrcweir     sal_uLong& rNewChildPos)
1565cdf0e10cSrcweir {
1566cdf0e10cSrcweir     SvLBoxEntry* pDestination = pTarget;
1567cdf0e10cSrcweir     while (GetParent(pDestination) != NULL && GetParent(GetParent(pDestination)) != NULL)
1568cdf0e10cSrcweir         pDestination = GetParent(pDestination);
1569cdf0e10cSrcweir 
1570cdf0e10cSrcweir     SdrObject* pTargetObject = reinterpret_cast<SdrObject*>(pDestination->GetUserData());
1571cdf0e10cSrcweir     SdrObject* pSourceObject = reinterpret_cast<SdrObject*>(pEntry->GetUserData());
1572cdf0e10cSrcweir     if (pSourceObject == reinterpret_cast<SdrObject*>(1))
1573cdf0e10cSrcweir         pSourceObject = NULL;
1574cdf0e10cSrcweir 
1575cdf0e10cSrcweir     if (pTargetObject != NULL && pSourceObject != NULL)
1576cdf0e10cSrcweir     {
1577cdf0e10cSrcweir         SdrPage* pObjectList = pSourceObject->GetPage();
1578cdf0e10cSrcweir         if (pObjectList != NULL)
1579cdf0e10cSrcweir         {
1580cdf0e10cSrcweir             sal_uInt32 nNewPosition;
1581cdf0e10cSrcweir             if (pTargetObject == reinterpret_cast<SdrObject*>(1))
1582cdf0e10cSrcweir                 nNewPosition = 0;
1583cdf0e10cSrcweir             else
1584cdf0e10cSrcweir                 nNewPosition = pTargetObject->GetNavigationPosition() + 1;
1585cdf0e10cSrcweir             pObjectList->SetObjectNavigationPosition(*pSourceObject, nNewPosition);
1586cdf0e10cSrcweir         }
1587cdf0e10cSrcweir 
1588cdf0e10cSrcweir         // Update the tree list.
1589cdf0e10cSrcweir         if (pTarget == NULL)
1590cdf0e10cSrcweir         {
1591cdf0e10cSrcweir             rpNewParent = 0;
1592cdf0e10cSrcweir             rNewChildPos = 0;
1593cdf0e10cSrcweir             return sal_True;
1594cdf0e10cSrcweir         }
1595cdf0e10cSrcweir         else if (GetParent(pDestination) == NULL)
1596cdf0e10cSrcweir         {
1597cdf0e10cSrcweir             rpNewParent = pDestination;
1598cdf0e10cSrcweir             rNewChildPos = 0;
1599cdf0e10cSrcweir         }
1600cdf0e10cSrcweir         else
1601cdf0e10cSrcweir         {
1602cdf0e10cSrcweir             rpNewParent = GetParent(pDestination);
1603cdf0e10cSrcweir             rNewChildPos = pModel->GetRelPos(pDestination) + 1;
1604cdf0e10cSrcweir             rNewChildPos += nCurEntrySelPos;
1605cdf0e10cSrcweir             nCurEntrySelPos++;
1606cdf0e10cSrcweir         }
1607cdf0e10cSrcweir         return sal_True;
1608cdf0e10cSrcweir     }
1609cdf0e10cSrcweir     else
1610cdf0e10cSrcweir         return sal_False;
1611cdf0e10cSrcweir }
1612cdf0e10cSrcweir 
GetDropTarget(const Point & rLocation)1613cdf0e10cSrcweir SvLBoxEntry* SdPageObjsTLB::GetDropTarget (const Point& rLocation)
1614cdf0e10cSrcweir {
1615cdf0e10cSrcweir     SvLBoxEntry* pEntry = SvTreeListBox::GetDropTarget(rLocation);
1616cdf0e10cSrcweir     if (pEntry == NULL)
1617cdf0e10cSrcweir         return NULL;
1618cdf0e10cSrcweir 
1619cdf0e10cSrcweir     if (GetParent(pEntry) == NULL)
1620cdf0e10cSrcweir     {
1621cdf0e10cSrcweir         // Use page entry as insertion position.
1622cdf0e10cSrcweir     }
1623cdf0e10cSrcweir     else
1624cdf0e10cSrcweir     {
1625cdf0e10cSrcweir         // Go to second hierarchy level, i.e. top level shapes,
1626cdf0e10cSrcweir         // i.e. children of pages.
1627cdf0e10cSrcweir         while (GetParent(pEntry) != NULL && GetParent(GetParent(pEntry)) != NULL)
1628cdf0e10cSrcweir             pEntry = GetParent(pEntry);
1629cdf0e10cSrcweir 
1630cdf0e10cSrcweir         // Advance to next sibling.
1631cdf0e10cSrcweir         SvLBoxEntry* pNext;
1632cdf0e10cSrcweir         sal_uInt16 nDepth (0);
1633cdf0e10cSrcweir         while (pEntry != NULL)
1634cdf0e10cSrcweir         {
1635cdf0e10cSrcweir             pNext = dynamic_cast<SvLBoxEntry*>(NextVisible(pEntry, &nDepth));
1636cdf0e10cSrcweir             if (pNext != NULL && nDepth > 0 && nDepth!=0xffff)
1637cdf0e10cSrcweir                 pEntry = pNext;
1638cdf0e10cSrcweir             else
1639cdf0e10cSrcweir                 break;
1640cdf0e10cSrcweir         }
1641cdf0e10cSrcweir     }
1642cdf0e10cSrcweir 
1643cdf0e10cSrcweir     return pEntry;
1644cdf0e10cSrcweir }
1645cdf0e10cSrcweir 
IsDropAllowed(SvLBoxEntry * pEntry)1646cdf0e10cSrcweir bool SdPageObjsTLB::IsDropAllowed (SvLBoxEntry* pEntry)
1647cdf0e10cSrcweir {
1648cdf0e10cSrcweir     if (pEntry == NULL)
1649cdf0e10cSrcweir         return false;
1650cdf0e10cSrcweir 
1651cdf0e10cSrcweir     if ( ! IsDropFormatSupported(SdPageObjsTransferable::GetListBoxDropFormatId()))
1652cdf0e10cSrcweir         return false;
1653cdf0e10cSrcweir 
1654cdf0e10cSrcweir     if ((pEntry->GetFlags() & SV_ENTRYFLAG_DISABLE_DROP) != 0)
1655cdf0e10cSrcweir         return false;
1656cdf0e10cSrcweir 
1657cdf0e10cSrcweir     return true;
1658cdf0e10cSrcweir }
1659cdf0e10cSrcweir 
AddShapeToTransferable(SdTransferable & rTransferable,SdrObject & rObject) const1660cdf0e10cSrcweir void SdPageObjsTLB::AddShapeToTransferable (
1661cdf0e10cSrcweir     SdTransferable& rTransferable,
1662cdf0e10cSrcweir     SdrObject& rObject) const
1663cdf0e10cSrcweir {
1664cdf0e10cSrcweir     TransferableObjectDescriptor aObjectDescriptor;
1665cdf0e10cSrcweir     bool bIsDescriptorFillingPending (true);
1666cdf0e10cSrcweir 
1667cdf0e10cSrcweir     const SdrOle2Obj* pOleObject = dynamic_cast<const SdrOle2Obj*>(&rObject);
1668cdf0e10cSrcweir     if (pOleObject != NULL && pOleObject->GetObjRef().is())
1669cdf0e10cSrcweir     {
1670cdf0e10cSrcweir         // If object has no persistence it must be copied as part of the document
1671cdf0e10cSrcweir         try
1672cdf0e10cSrcweir         {
1673cdf0e10cSrcweir             uno::Reference< embed::XEmbedPersist > xPersObj (pOleObject->GetObjRef(), uno::UNO_QUERY );
1674cdf0e10cSrcweir             if (xPersObj.is() && xPersObj->hasEntry())
1675cdf0e10cSrcweir             {
1676cdf0e10cSrcweir                 SvEmbedTransferHelper::FillTransferableObjectDescriptor(
1677cdf0e10cSrcweir                     aObjectDescriptor,
1678cdf0e10cSrcweir                     pOleObject->GetObjRef(),
1679cdf0e10cSrcweir                     pOleObject->GetGraphic(),
1680cdf0e10cSrcweir                     pOleObject->GetAspect());
1681cdf0e10cSrcweir                 bIsDescriptorFillingPending = false;
1682cdf0e10cSrcweir             }
1683cdf0e10cSrcweir         }
1684cdf0e10cSrcweir         catch( uno::Exception& )
1685cdf0e10cSrcweir         {
1686cdf0e10cSrcweir         }
1687cdf0e10cSrcweir     }
1688cdf0e10cSrcweir 
1689cdf0e10cSrcweir     ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
1690cdf0e10cSrcweir     if (bIsDescriptorFillingPending && pDocShell!=NULL)
1691cdf0e10cSrcweir     {
1692cdf0e10cSrcweir         bIsDescriptorFillingPending = false;
1693cdf0e10cSrcweir         pDocShell->FillTransferableObjectDescriptor(aObjectDescriptor);
1694cdf0e10cSrcweir     }
1695cdf0e10cSrcweir 
1696cdf0e10cSrcweir     Point aDragPos (rObject.GetCurrentBoundRect().Center());
1697cdf0e10cSrcweir     //Point aDragPos (0,0);
1698cdf0e10cSrcweir     aObjectDescriptor.maDragStartPos = aDragPos;
1699cdf0e10cSrcweir     //  aObjectDescriptor.maSize = GetAllMarkedRect().GetSize();
1700cdf0e10cSrcweir     if (pDocShell != NULL)
1701cdf0e10cSrcweir         aObjectDescriptor.maDisplayName = pDocShell->GetMedium()->GetURLObject().GetURLNoPass();
1702cdf0e10cSrcweir     else
1703cdf0e10cSrcweir         aObjectDescriptor.maDisplayName = String();
1704cdf0e10cSrcweir     aObjectDescriptor.mbCanLink = sal_False;
1705cdf0e10cSrcweir 
1706cdf0e10cSrcweir     rTransferable.SetStartPos(aDragPos);
1707cdf0e10cSrcweir     rTransferable.SetObjectDescriptor( aObjectDescriptor );
1708cdf0e10cSrcweir }
1709cdf0e10cSrcweir 
GetViewShellForDocShell(::sd::DrawDocShell & rDocShell)1710cdf0e10cSrcweir ::sd::ViewShell* SdPageObjsTLB::GetViewShellForDocShell (::sd::DrawDocShell& rDocShell)
1711cdf0e10cSrcweir {
1712cdf0e10cSrcweir     {
1713cdf0e10cSrcweir         ::sd::ViewShell* pViewShell = rDocShell.GetViewShell();
1714cdf0e10cSrcweir         if (pViewShell != NULL)
1715cdf0e10cSrcweir             return pViewShell;
1716cdf0e10cSrcweir     }
1717cdf0e10cSrcweir 
1718cdf0e10cSrcweir     try
1719cdf0e10cSrcweir     {
1720cdf0e10cSrcweir         // Get a component enumeration from the desktop and search it for documents.
1721cdf0e10cSrcweir         uno::Reference<lang::XMultiServiceFactory> xFactory (
1722cdf0e10cSrcweir             ::comphelper::getProcessServiceFactory ());
1723cdf0e10cSrcweir         if ( ! xFactory.is())
1724cdf0e10cSrcweir             return NULL;
1725cdf0e10cSrcweir 
1726cdf0e10cSrcweir         uno::Reference<frame::XDesktop> xDesktop (xFactory->createInstance (
1727cdf0e10cSrcweir                 ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), uno::UNO_QUERY);
1728cdf0e10cSrcweir         if ( ! xDesktop.is())
1729cdf0e10cSrcweir             return NULL;
1730cdf0e10cSrcweir 
1731cdf0e10cSrcweir         uno::Reference<frame::XFramesSupplier> xFrameSupplier (xDesktop, uno::UNO_QUERY);
1732cdf0e10cSrcweir         if ( ! xFrameSupplier.is())
1733cdf0e10cSrcweir             return NULL;
1734cdf0e10cSrcweir 
1735cdf0e10cSrcweir         uno::Reference<container::XIndexAccess> xFrameAccess (xFrameSupplier->getFrames(), uno::UNO_QUERY);
1736cdf0e10cSrcweir         if ( ! xFrameAccess.is())
1737cdf0e10cSrcweir             return NULL;
1738cdf0e10cSrcweir 
1739cdf0e10cSrcweir         for (sal_Int32 nIndex=0,nCount=xFrameAccess->getCount(); nIndex<nCount; ++nIndex)
1740cdf0e10cSrcweir         {
1741cdf0e10cSrcweir             uno::Reference<frame::XFrame> xFrame;
1742cdf0e10cSrcweir             if ( ! (xFrameAccess->getByIndex(nIndex) >>= xFrame))
1743cdf0e10cSrcweir                 continue;
1744cdf0e10cSrcweir 
1745cdf0e10cSrcweir             ::sd::DrawController* pController = dynamic_cast<sd::DrawController*>(xFrame->getController().get());
1746cdf0e10cSrcweir             if (pController == NULL)
1747cdf0e10cSrcweir                 continue;
1748cdf0e10cSrcweir             ::sd::ViewShellBase* pBase = pController->GetViewShellBase();
1749cdf0e10cSrcweir             if (pBase == NULL)
1750cdf0e10cSrcweir                 continue;
1751cdf0e10cSrcweir             if (pBase->GetDocShell() != &rDocShell)
1752cdf0e10cSrcweir                 continue;
1753cdf0e10cSrcweir 
1754cdf0e10cSrcweir             const ::boost::shared_ptr<sd::ViewShell> pViewShell (pBase->GetMainViewShell());
1755cdf0e10cSrcweir             if (pViewShell)
1756cdf0e10cSrcweir                 return pViewShell.get();
1757cdf0e10cSrcweir         }
1758cdf0e10cSrcweir     }
1759cdf0e10cSrcweir     catch (uno::Exception e)
1760cdf0e10cSrcweir     {
1761cdf0e10cSrcweir         // When there is an exception then simply use the default value of
1762cdf0e10cSrcweir         // bIsEnabled and disable the controls.
1763cdf0e10cSrcweir     }
1764cdf0e10cSrcweir     return NULL;
1765cdf0e10cSrcweir }
1766cdf0e10cSrcweir 
1767cdf0e10cSrcweir //===== IconProvider ==========================================================
1768cdf0e10cSrcweir 
IconProvider(void)1769cdf0e10cSrcweir SdPageObjsTLB::IconProvider::IconProvider (void)
1770cdf0e10cSrcweir     : maImgPage( BitmapEx( SdResId( BMP_PAGE ) ) ),
1771cdf0e10cSrcweir       maImgPageExcl( BitmapEx( SdResId( BMP_PAGE_EXCLUDED ) ) ),
1772cdf0e10cSrcweir       maImgPageObjsExcl( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED ) ) ),
1773cdf0e10cSrcweir       maImgPageObjs( BitmapEx( SdResId( BMP_PAGEOBJS ) ) ),
1774cdf0e10cSrcweir       maImgObjects( BitmapEx( SdResId( BMP_OBJECTS ) ) ),
1775cdf0e10cSrcweir       maImgGroup( BitmapEx( SdResId( BMP_GROUP ) ) ),
1776cdf0e10cSrcweir 
1777cdf0e10cSrcweir       maImgPageH( BitmapEx( SdResId( BMP_PAGE_H ) ) ),
1778cdf0e10cSrcweir       maImgPageExclH( BitmapEx( SdResId( BMP_PAGE_EXCLUDED_H ) ) ),
1779cdf0e10cSrcweir       maImgPageObjsExclH( BitmapEx( SdResId( BMP_PAGEOBJS_EXCLUDED_H ) ) ),
1780cdf0e10cSrcweir       maImgPageObjsH( BitmapEx( SdResId( BMP_PAGEOBJS_H ) ) ),
1781cdf0e10cSrcweir       maImgObjectsH( BitmapEx( SdResId( BMP_OBJECTS_H ) ) ),
1782cdf0e10cSrcweir       maImgGroupH( BitmapEx( SdResId( BMP_GROUP_H ) ) )
1783cdf0e10cSrcweir {
1784cdf0e10cSrcweir }
1785*5133a0b6Smseidel 
1786*5133a0b6Smseidel /* vim: set noet sw=4 ts=4: */
1787