1*c45d927aSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*c45d927aSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*c45d927aSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*c45d927aSAndrew Rist * distributed with this work for additional information 6*c45d927aSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*c45d927aSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*c45d927aSAndrew Rist * "License"); you may not use this file except in compliance 9*c45d927aSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*c45d927aSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*c45d927aSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*c45d927aSAndrew Rist * software distributed under the License is distributed on an 15*c45d927aSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*c45d927aSAndrew Rist * KIND, either express or implied. See the License for the 17*c45d927aSAndrew Rist * specific language governing permissions and limitations 18*c45d927aSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*c45d927aSAndrew Rist *************************************************************/ 21*c45d927aSAndrew Rist 22*c45d927aSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SDTREELB_HXX 25cdf0e10cSrcweir #define _SDTREELB_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svtools/transfer.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #ifndef _SD_SDRESID_HXX 30cdf0e10cSrcweir #include "sdresid.hxx" 31cdf0e10cSrcweir #endif 32cdf0e10cSrcweir #include "pres.hxx" 33cdf0e10cSrcweir #include "sddllapi.h" 34cdf0e10cSrcweir #include <tools/string.hxx> 35cdf0e10cSrcweir #include <svtools/svtreebx.hxx> 36cdf0e10cSrcweir #include <svl/urlbmk.hxx> 37cdf0e10cSrcweir #include <tools/ref.hxx> 38cdf0e10cSrcweir #include "sdxfer.hxx" 39cdf0e10cSrcweir #include <boost/scoped_ptr.hpp> 40cdf0e10cSrcweir #include <boost/function.hpp> 41cdf0e10cSrcweir 42cdf0e10cSrcweir class SdDrawDocument; 43cdf0e10cSrcweir class SfxMedium; 44cdf0e10cSrcweir class SfxViewFrame; 45cdf0e10cSrcweir class SdNavigatorWin; 46cdf0e10cSrcweir class SdrObject; 47cdf0e10cSrcweir class SdrObjList; 48cdf0e10cSrcweir class SdPage; 49cdf0e10cSrcweir class SvLBoxEntry; 50cdf0e10cSrcweir 51cdf0e10cSrcweir namespace sd { 52cdf0e10cSrcweir class ViewShell; 53cdf0e10cSrcweir 54cdf0e10cSrcweir class DrawDocShell; 55cdf0e10cSrcweir #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED 56cdf0e10cSrcweir #define SV_DECL_DRAW_DOC_SHELL_DEFINED 57cdf0e10cSrcweir SV_DECL_REF(DrawDocShell) 58cdf0e10cSrcweir #endif 59cdf0e10cSrcweir } 60cdf0e10cSrcweir 61cdf0e10cSrcweir /************************************************************************* 62cdf0e10cSrcweir |* 63cdf0e10cSrcweir |* Effekte-Tab-Dialog 64cdf0e10cSrcweir |* 65cdf0e10cSrcweir \************************************************************************/ 66cdf0e10cSrcweir 67cdf0e10cSrcweir class SD_DLLPUBLIC SdPageObjsTLB : public SvTreeListBox 68cdf0e10cSrcweir { 69cdf0e10cSrcweir private: 70cdf0e10cSrcweir 71cdf0e10cSrcweir static sal_Bool SD_DLLPRIVATE bIsInDrag; // static, falls der Navigator im ExecuteDrag geloescht wird 72cdf0e10cSrcweir 73cdf0e10cSrcweir public: 74cdf0e10cSrcweir 75cdf0e10cSrcweir // nested class to implement the TransferableHelper 76cdf0e10cSrcweir class SdPageObjsTransferable : public SdTransferable 77cdf0e10cSrcweir { 78cdf0e10cSrcweir public: 79cdf0e10cSrcweir SdPageObjsTransferable( 80cdf0e10cSrcweir SdPageObjsTLB& rParent, 81cdf0e10cSrcweir const INetBookmark& rBookmark, 82cdf0e10cSrcweir ::sd::DrawDocShell& rDocShell, 83cdf0e10cSrcweir NavigatorDragType eDragType, 84cdf0e10cSrcweir const ::com::sun::star::uno::Any& rTreeListBoxData ); 85cdf0e10cSrcweir ::sd::DrawDocShell& GetDocShell() const; 86cdf0e10cSrcweir NavigatorDragType GetDragType() const; 87cdf0e10cSrcweir 88cdf0e10cSrcweir static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); 89cdf0e10cSrcweir static SdPageObjsTransferable* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw(); 90cdf0e10cSrcweir /** Return a temporary transferable data flavor that is used 91cdf0e10cSrcweir internally in the navigator for reordering entries. Its 92cdf0e10cSrcweir lifetime ends with the office application. 93cdf0e10cSrcweir */ 94cdf0e10cSrcweir static sal_uInt32 GetListBoxDropFormatId (void); 95cdf0e10cSrcweir 96cdf0e10cSrcweir private: 97cdf0e10cSrcweir /** Temporary drop flavor id that is used internally in the 98cdf0e10cSrcweir navigator. 99cdf0e10cSrcweir */ 100cdf0e10cSrcweir static sal_uInt32 mnListBoxDropFormatId; 101cdf0e10cSrcweir 102cdf0e10cSrcweir SdPageObjsTLB& mrParent; 103cdf0e10cSrcweir INetBookmark maBookmark; 104cdf0e10cSrcweir ::sd::DrawDocShell& mrDocShell; 105cdf0e10cSrcweir NavigatorDragType meDragType; 106cdf0e10cSrcweir const ::com::sun::star::uno::Any maTreeListBoxData; 107cdf0e10cSrcweir SD_DLLPRIVATE virtual ~SdPageObjsTransferable(); 108cdf0e10cSrcweir 109cdf0e10cSrcweir SD_DLLPRIVATE virtual void AddSupportedFormats(); 110cdf0e10cSrcweir SD_DLLPRIVATE virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); 111cdf0e10cSrcweir SD_DLLPRIVATE virtual void DragFinished( sal_Int8 nDropAction ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir SD_DLLPRIVATE virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException ); 114cdf0e10cSrcweir }; 115cdf0e10cSrcweir 116cdf0e10cSrcweir friend class SdPageObjsTLB::SdPageObjsTransferable; 117cdf0e10cSrcweir 118cdf0e10cSrcweir /** Determine whether the specified page belongs to the current show 119cdf0e10cSrcweir which is either the standard show or a custom show. 120cdf0e10cSrcweir @param pPage 121cdf0e10cSrcweir Pointer to the page for which to check whether it belongs to the 122cdf0e10cSrcweir show. 123cdf0e10cSrcweir @return 124cdf0e10cSrcweir Returns <FALSE/> if there is no custom show or if the current 125cdf0e10cSrcweir show does not contain the specified page at least once. 126cdf0e10cSrcweir */ 127cdf0e10cSrcweir bool PageBelongsToCurrentShow (const SdPage* pPage) const; 128cdf0e10cSrcweir 129cdf0e10cSrcweir protected: 130cdf0e10cSrcweir 131cdf0e10cSrcweir Window* mpParent; 132cdf0e10cSrcweir const SdDrawDocument* mpDoc; 133cdf0e10cSrcweir SdDrawDocument* mpBookmarkDoc; 134cdf0e10cSrcweir SfxMedium* mpMedium; 135cdf0e10cSrcweir SfxMedium* mpOwnMedium; 136cdf0e10cSrcweir Image maImgOle; 137cdf0e10cSrcweir Image maImgGraphic; 138cdf0e10cSrcweir Image maImgOleH; 139cdf0e10cSrcweir Image maImgGraphicH; 140cdf0e10cSrcweir sal_Bool mbLinkableSelected; 141cdf0e10cSrcweir sal_Bool mbDragEnabled; 142cdf0e10cSrcweir String maDocName; 143cdf0e10cSrcweir ::sd::DrawDocShellRef mxBookmarkDocShRef; // Zum Laden von Bookmarks 144cdf0e10cSrcweir ::sd::DrawDocShell* mpDropDocSh; 145cdf0e10cSrcweir SdNavigatorWin* mpDropNavWin; 146cdf0e10cSrcweir SfxViewFrame* mpFrame; 147cdf0e10cSrcweir 148cdf0e10cSrcweir // DragSourceHelper 149cdf0e10cSrcweir virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 150cdf0e10cSrcweir 151cdf0e10cSrcweir // DropTargetHelper 152cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 153cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 154cdf0e10cSrcweir 155cdf0e10cSrcweir virtual void RequestingChilds( SvLBoxEntry* pParent ); 156cdf0e10cSrcweir 157cdf0e10cSrcweir void DoDrag(); 158cdf0e10cSrcweir void OnDragFinished( sal_uInt8 nDropAction ); 159cdf0e10cSrcweir 160cdf0e10cSrcweir /** Return the name of the object. When the object has no user supplied 161cdf0e10cSrcweir name and the bCreate flag is <TRUE/> then a name is created 162cdf0e10cSrcweir automatically. Additionally the mbShowAllShapes flag is taken into 163cdf0e10cSrcweir account when there is no user supplied name. When this flag is 164cdf0e10cSrcweir <FALSE/> then no name is created. 165cdf0e10cSrcweir @param pObject 166cdf0e10cSrcweir When this is NULL then an empty string is returned, regardless 167cdf0e10cSrcweir of the value of bCreate. 168cdf0e10cSrcweir @param bCreate 169cdf0e10cSrcweir This flag controls for objects without user supplied name 170cdf0e10cSrcweir whether a name is created. When a name is created then this 171cdf0e10cSrcweir name is not stored in the object. 172cdf0e10cSrcweir */ 173cdf0e10cSrcweir String GetObjectName ( 174cdf0e10cSrcweir const SdrObject* pObject, 175cdf0e10cSrcweir const bool bCreate = true) const; 176cdf0e10cSrcweir void CloseBookmarkDoc(); 177cdf0e10cSrcweir DECL_STATIC_LINK(SdPageObjsTLB, ExecDragHdl, void*); 178cdf0e10cSrcweir 179cdf0e10cSrcweir /** Handle the reordering of entries in the navigator. This method 180cdf0e10cSrcweir reorders both the involved shapes in their page as well as the 181cdf0e10cSrcweir associated list box entries. 182cdf0e10cSrcweir */ 183cdf0e10cSrcweir virtual sal_Bool NotifyMoving( 184cdf0e10cSrcweir SvLBoxEntry* pTarget, 185cdf0e10cSrcweir SvLBoxEntry* pEntry, 186cdf0e10cSrcweir SvLBoxEntry*& rpNewParent, 187cdf0e10cSrcweir sal_uLong& rNewChildPos); 188cdf0e10cSrcweir 189cdf0e10cSrcweir using Window::GetDropTarget; 190cdf0e10cSrcweir virtual SvLBoxEntry* GetDropTarget (const Point& rLocation); 191cdf0e10cSrcweir 192cdf0e10cSrcweir public: 193cdf0e10cSrcweir 194cdf0e10cSrcweir SdPageObjsTLB( Window* pParent, const SdResId& rSdResId ); 195cdf0e10cSrcweir ~SdPageObjsTLB(); 196cdf0e10cSrcweir 197cdf0e10cSrcweir virtual void SelectHdl(); 198cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvt ); 199cdf0e10cSrcweir 200cdf0e10cSrcweir void SetViewFrame( SfxViewFrame* pViewFrame ) { mpFrame = pViewFrame; } 201cdf0e10cSrcweir SfxViewFrame* GetViewFrame() const { return mpFrame; } 202cdf0e10cSrcweir 203cdf0e10cSrcweir void Fill( const SdDrawDocument*, sal_Bool bAllPages, const String& rDocName ); 204cdf0e10cSrcweir void Fill( const SdDrawDocument*, SfxMedium* pSfxMedium, const String& rDocName ); 205cdf0e10cSrcweir void SetShowAllShapes (const bool bShowAllShapes, const bool bFill); 206cdf0e10cSrcweir bool GetShowAllShapes (void) const; 207cdf0e10cSrcweir sal_Bool IsEqualToDoc( const SdDrawDocument* pInDoc = NULL ); 208cdf0e10cSrcweir sal_Bool HasSelectedChilds( const String& rName ); 209cdf0e10cSrcweir sal_Bool SelectEntry( const String& rName ); 210cdf0e10cSrcweir String GetSelectEntry(); 211cdf0e10cSrcweir List* GetSelectEntryList( sal_uInt16 nDepth ); 212cdf0e10cSrcweir SdDrawDocument* GetBookmarkDoc(SfxMedium* pMedium = NULL); 213cdf0e10cSrcweir ::sd::DrawDocShell* GetDropDocSh() { return(mpDropDocSh); } 214cdf0e10cSrcweir 215cdf0e10cSrcweir sal_Bool IsLinkableSelected() const { return mbLinkableSelected; } 216cdf0e10cSrcweir 217cdf0e10cSrcweir static sal_Bool IsInDrag(); 218cdf0e10cSrcweir using SvLBox::ExecuteDrop; 219cdf0e10cSrcweir 220cdf0e10cSrcweir using SvTreeListBox::SelectEntry; 221cdf0e10cSrcweir 222cdf0e10cSrcweir /** Return the view shell that is linked to the given doc shell. 223cdf0e10cSrcweir Call this method when the there is a chance that the doc shell 224cdf0e10cSrcweir has been disconnected from the view shell (but not the other 225cdf0e10cSrcweir way round.) 226cdf0e10cSrcweir @return 227cdf0e10cSrcweir May return <NULL/> when the link between view shell and 228cdf0e10cSrcweir doc shell has been severed. 229cdf0e10cSrcweir */ 230cdf0e10cSrcweir static ::sd::ViewShell* GetViewShellForDocShell (::sd::DrawDocShell &rDocShell); 231cdf0e10cSrcweir 232cdf0e10cSrcweir private: 233cdf0e10cSrcweir /** This flag controls whether all shapes are shown as children of pages 234cdf0e10cSrcweir and group shapes or only the named shapes. 235cdf0e10cSrcweir */ 236cdf0e10cSrcweir bool mbShowAllShapes; 237cdf0e10cSrcweir /** This flag controls whether to show all pages. 238cdf0e10cSrcweir */ 239cdf0e10cSrcweir bool mbShowAllPages; 240cdf0e10cSrcweir 241cdf0e10cSrcweir /** Return <TRUE/> when the current transferable may be dropped at the 242cdf0e10cSrcweir given list box entry. 243cdf0e10cSrcweir */ 244cdf0e10cSrcweir bool IsDropAllowed (SvLBoxEntry* pEntry); 245cdf0e10cSrcweir 246cdf0e10cSrcweir /** This inner class is defined in sdtreelb.cxx and is basically a 247cdf0e10cSrcweir container for the icons used in the list box for the entries. 248cdf0e10cSrcweir */ 249cdf0e10cSrcweir class IconProvider; 250cdf0e10cSrcweir 251cdf0e10cSrcweir /** Add one list box entry for the parent of the given shapes and one child entry for 252cdf0e10cSrcweir each of the given shapes. 253cdf0e10cSrcweir @param rList 254cdf0e10cSrcweir The container of shapes that are to be inserted. 255cdf0e10cSrcweir @param pShape 256cdf0e10cSrcweir The parent shape or NULL when the parent is a page. 257cdf0e10cSrcweir @param rsName 258cdf0e10cSrcweir The name to be displayed for the new parent node. 259cdf0e10cSrcweir @param bIsExcluded 260cdf0e10cSrcweir Some pages can be excluded (from the show?). 261cdf0e10cSrcweir @param pParentEntry 262cdf0e10cSrcweir The parent entry of the new parent entry. 263cdf0e10cSrcweir @param rIconProvider 264cdf0e10cSrcweir Icons used to visualize the different shape and page types. 265cdf0e10cSrcweir */ 266cdf0e10cSrcweir void AddShapeList ( 267cdf0e10cSrcweir const SdrObjList& rList, 268cdf0e10cSrcweir SdrObject* pShape, 269cdf0e10cSrcweir const ::rtl::OUString& rsName, 270cdf0e10cSrcweir const bool bIsExcluded, 271cdf0e10cSrcweir SvLBoxEntry* pParentEntry, 272cdf0e10cSrcweir const IconProvider& rIconProvider); 273cdf0e10cSrcweir 274cdf0e10cSrcweir /** Add the given object to a transferable object so that the object can 275cdf0e10cSrcweir be dragged and dropped without having a name. 276cdf0e10cSrcweir */ 277cdf0e10cSrcweir void AddShapeToTransferable ( 278cdf0e10cSrcweir SdTransferable& rTransferable, 279cdf0e10cSrcweir SdrObject& rObject) const; 280cdf0e10cSrcweir }; 281cdf0e10cSrcweir 282cdf0e10cSrcweir #endif // _SDTREELB_HXX 283