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