1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef _SD_SDXFER_HXX 29*cdf0e10cSrcweir #define _SD_SDXFER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <svtools/transfer.hxx> 32*cdf0e10cSrcweir #include <vcl/graph.hxx> 33*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 34*cdf0e10cSrcweir #include <svl/lstner.hxx> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir // ------------------ 37*cdf0e10cSrcweir // - SdTransferable - 38*cdf0e10cSrcweir // ------------------ 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir class SdDrawDocument; 41*cdf0e10cSrcweir class SdrObject; 42*cdf0e10cSrcweir class INetBookmark; 43*cdf0e10cSrcweir class ImageMap; 44*cdf0e10cSrcweir class VirtualDevice; 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir namespace sd { 47*cdf0e10cSrcweir class DrawDocShell; 48*cdf0e10cSrcweir class View; 49*cdf0e10cSrcweir } 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir class SfxObjectShellRef; 52*cdf0e10cSrcweir class SdTransferable : public TransferableHelper, public SfxListener 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir public: 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, sal_Bool bInitOnGetData ); 57*cdf0e10cSrcweir ~SdTransferable(); 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir void SetDocShell( const SfxObjectShellRef& rRef ) { maDocShellRef = rRef; } 60*cdf0e10cSrcweir const SfxObjectShellRef& GetDocShell() const { return maDocShellRef; } 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir void SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = (SdDrawDocument*) pWorkDoc; } 63*cdf0e10cSrcweir const SdDrawDocument* GetWorkDocument() const { return mpSdDrawDocument; } 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir void SetView( const ::sd::View* pView ) { mpSdView = pView; } 66*cdf0e10cSrcweir const ::sd::View* GetView() const { return mpSdView; } 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir void SetObjectDescriptor( const TransferableObjectDescriptor& rObjDesc ); 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir void SetStartPos( const Point& rStartPos ) { maStartPos = rStartPos; } 71*cdf0e10cSrcweir const Point& GetStartPos() const { return maStartPos; } 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir void SetInternalMove( sal_Bool bSet ) { mbInternalMove = bSet; } 74*cdf0e10cSrcweir sal_Bool IsInternalMove() const { return mbInternalMove; } 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir sal_Bool HasSourceDoc( const SdDrawDocument* pDoc ) const { return( mpSourceDoc == pDoc ); } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir void SetPageBookmarks( const List& rPageBookmarks, sal_Bool bPersistent ); 79*cdf0e10cSrcweir sal_Bool IsPageTransferable() const { return mbPageTransferable; } 80*cdf0e10cSrcweir sal_Bool HasPageBookmarks() const { return( mpPageDocShell && ( maPageBookmarks.Count() > 0 ) ); } 81*cdf0e10cSrcweir const List& GetPageBookmarks() const { return maPageBookmarks; } 82*cdf0e10cSrcweir ::sd::DrawDocShell* GetPageDocShell() const { return mpPageDocShell; } 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir sal_Bool SetTableRTF( SdDrawDocument*, const ::com::sun::star::datatransfer::DataFlavor& ); 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); 87*cdf0e10cSrcweir static SdTransferable* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw(); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir // SfxListener 90*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir virtual void DragFinished( sal_Int8 nDropAction ); 93*cdf0e10cSrcweir SdDrawDocument* GetSourceDoc (void) const; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir /** User data objects can be used to store information temporarily 96*cdf0e10cSrcweir at the transferable. The slide sorter uses this to store 97*cdf0e10cSrcweir previews of the slides that are referenced by the 98*cdf0e10cSrcweir transferable. 99*cdf0e10cSrcweir */ 100*cdf0e10cSrcweir class UserData {public:virtual~UserData(){}}; 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir /** Add a user data object. When it was added before (and not 103*cdf0e10cSrcweir removed) then this call is ignored. 104*cdf0e10cSrcweir */ 105*cdf0e10cSrcweir void AddUserData (const ::boost::shared_ptr<UserData>& rpData); 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir /** Remove a previously added user data object. When the object 108*cdf0e10cSrcweir was never added or removed before then this call is ignored. 109*cdf0e10cSrcweir */ 110*cdf0e10cSrcweir void RemoveUserData (const ::boost::shared_ptr<UserData>& rpData); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir /** Return the number of user data objects. 113*cdf0e10cSrcweir */ 114*cdf0e10cSrcweir sal_Int32 GetUserDataCount (void) const; 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir /** Return the specified user data object. When the index is not 117*cdf0e10cSrcweir valid, ie not in the range [0,count) then an empty pointer is 118*cdf0e10cSrcweir returned. 119*cdf0e10cSrcweir */ 120*cdf0e10cSrcweir ::boost::shared_ptr<UserData> GetUserData (const sal_Int32 nIndex) const; 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir protected: 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir virtual void AddSupportedFormats(); 125*cdf0e10cSrcweir virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); 126*cdf0e10cSrcweir virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); 127*cdf0e10cSrcweir virtual void ObjectReleased(); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException ); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir private: 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir SfxObjectShellRef maDocShellRef; 134*cdf0e10cSrcweir ::sd::DrawDocShell* mpPageDocShell; 135*cdf0e10cSrcweir List maPageBookmarks; 136*cdf0e10cSrcweir TransferableDataHelper* mpOLEDataHelper; 137*cdf0e10cSrcweir TransferableObjectDescriptor* mpObjDesc; 138*cdf0e10cSrcweir const ::sd::View* mpSdView; 139*cdf0e10cSrcweir ::sd::View* mpSdViewIntern; 140*cdf0e10cSrcweir SdDrawDocument* mpSdDrawDocument; 141*cdf0e10cSrcweir SdDrawDocument* mpSdDrawDocumentIntern; 142*cdf0e10cSrcweir SdDrawDocument* mpSourceDoc; 143*cdf0e10cSrcweir VirtualDevice* mpVDev; 144*cdf0e10cSrcweir INetBookmark* mpBookmark; 145*cdf0e10cSrcweir Graphic* mpGraphic; 146*cdf0e10cSrcweir ImageMap* mpImageMap; 147*cdf0e10cSrcweir Rectangle maVisArea; 148*cdf0e10cSrcweir Point maStartPos; 149*cdf0e10cSrcweir sal_Bool mbInternalMove : 1; 150*cdf0e10cSrcweir sal_Bool mbOwnDocument : 1; 151*cdf0e10cSrcweir sal_Bool mbOwnView : 1; 152*cdf0e10cSrcweir sal_Bool mbLateInit : 1; 153*cdf0e10cSrcweir sal_Bool mbPageTransferable : 1; 154*cdf0e10cSrcweir sal_Bool mbPageTransferablePersistent : 1; 155*cdf0e10cSrcweir bool mbIsUnoObj : 1; 156*cdf0e10cSrcweir ::std::vector<boost::shared_ptr<UserData> > maUserData; 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir // not available 159*cdf0e10cSrcweir SdTransferable(); 160*cdf0e10cSrcweir SdTransferable( const SdTransferable& ); 161*cdf0e10cSrcweir SdTransferable& operator=( const SdTransferable& ); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir void CreateObjectReplacement( SdrObject* pObj ); 164*cdf0e10cSrcweir void CreateData(); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir }; 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir #endif // _SD_SDXFER_HXX 169