xref: /AOO41X/main/sd/source/ui/inc/sdxfer.hxx (revision c45d927ae478a6b27be268f8970f881a09d05b3f)
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 _SD_SDXFER_HXX
25cdf0e10cSrcweir #define _SD_SDXFER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svtools/transfer.hxx>
28cdf0e10cSrcweir #include <vcl/graph.hxx>
29cdf0e10cSrcweir #include <sfx2/objsh.hxx>
30cdf0e10cSrcweir #include <svl/lstner.hxx>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir // ------------------
33cdf0e10cSrcweir // - SdTransferable -
34cdf0e10cSrcweir // ------------------
35cdf0e10cSrcweir 
36cdf0e10cSrcweir class SdDrawDocument;
37cdf0e10cSrcweir class SdrObject;
38cdf0e10cSrcweir class INetBookmark;
39cdf0e10cSrcweir class ImageMap;
40cdf0e10cSrcweir class VirtualDevice;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace sd {
43cdf0e10cSrcweir class DrawDocShell;
44cdf0e10cSrcweir class View;
45cdf0e10cSrcweir }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class SfxObjectShellRef;
48cdf0e10cSrcweir class SdTransferable : public TransferableHelper, public SfxListener
49cdf0e10cSrcweir {
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 									SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, sal_Bool bInitOnGetData );
53cdf0e10cSrcweir 									~SdTransferable();
54cdf0e10cSrcweir 
55cdf0e10cSrcweir     void                            SetDocShell( const SfxObjectShellRef& rRef ) { maDocShellRef = rRef; }
56cdf0e10cSrcweir     const SfxObjectShellRef&        GetDocShell() const { return maDocShellRef; }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     void							SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = (SdDrawDocument*) pWorkDoc; }
59cdf0e10cSrcweir 	const SdDrawDocument*			GetWorkDocument() const { return mpSdDrawDocument; }
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	void							SetView( const ::sd::View* pView ) { mpSdView = pView; }
62cdf0e10cSrcweir 	const ::sd::View*					GetView() const { return mpSdView; }
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	void							SetObjectDescriptor( const TransferableObjectDescriptor& rObjDesc );
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	void							SetStartPos( const Point& rStartPos ) { maStartPos = rStartPos; }
67cdf0e10cSrcweir 	const Point&					GetStartPos() const { return maStartPos; }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	void							SetInternalMove( sal_Bool bSet ) { mbInternalMove = bSet; }
70cdf0e10cSrcweir 	sal_Bool							IsInternalMove() const { return mbInternalMove; }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	sal_Bool							HasSourceDoc( const SdDrawDocument* pDoc ) const { return( mpSourceDoc == pDoc ); }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	void							SetPageBookmarks( const List& rPageBookmarks, sal_Bool bPersistent );
75cdf0e10cSrcweir     sal_Bool                            IsPageTransferable() const { return mbPageTransferable; }
76cdf0e10cSrcweir     sal_Bool                            HasPageBookmarks() const { return( mpPageDocShell && ( maPageBookmarks.Count() > 0 ) ); }
77cdf0e10cSrcweir     const List&                     GetPageBookmarks() const { return maPageBookmarks; }
78cdf0e10cSrcweir 	::sd::DrawDocShell*         		GetPageDocShell() const { return mpPageDocShell; }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	sal_Bool						SetTableRTF( SdDrawDocument*, const ::com::sun::star::datatransfer::DataFlavor& );
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
83cdf0e10cSrcweir     static SdTransferable*          getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	// SfxListener
86cdf0e10cSrcweir 	virtual void			Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     virtual void					DragFinished( sal_Int8 nDropAction );
89cdf0e10cSrcweir     SdDrawDocument*					GetSourceDoc (void) const;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     /** User data objects can be used to store information temporarily
92cdf0e10cSrcweir         at the transferable.  The slide sorter uses this to store
93cdf0e10cSrcweir         previews of the slides that are referenced by the
94cdf0e10cSrcweir         transferable.
95cdf0e10cSrcweir     */
96cdf0e10cSrcweir     class UserData {public:virtual~UserData(){}};
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     /** Add a user data object.  When it was added before (and not
99cdf0e10cSrcweir         removed) then this call is ignored.
100cdf0e10cSrcweir     */
101cdf0e10cSrcweir     void AddUserData (const ::boost::shared_ptr<UserData>& rpData);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     /** Remove a previously added user data object.  When the object
104cdf0e10cSrcweir         was never added or removed before then this call is ignored.
105cdf0e10cSrcweir     */
106cdf0e10cSrcweir     void RemoveUserData (const ::boost::shared_ptr<UserData>& rpData);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     /** Return the number of user data objects.
109cdf0e10cSrcweir     */
110cdf0e10cSrcweir     sal_Int32 GetUserDataCount (void) const;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir     /** Return the specified user data object.  When the index is not
113cdf0e10cSrcweir         valid, ie not in the range [0,count) then an empty pointer is
114cdf0e10cSrcweir         returned.
115cdf0e10cSrcweir     */
116cdf0e10cSrcweir     ::boost::shared_ptr<UserData> GetUserData (const sal_Int32 nIndex) const;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir protected:
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	virtual void					AddSupportedFormats();
121cdf0e10cSrcweir 	virtual sal_Bool				GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
122cdf0e10cSrcweir 	virtual sal_Bool				WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
123cdf0e10cSrcweir 	virtual void					ObjectReleased();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL      getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir private:
128cdf0e10cSrcweir 
129cdf0e10cSrcweir     SfxObjectShellRef				maDocShellRef;
130cdf0e10cSrcweir     ::sd::DrawDocShell*				mpPageDocShell;
131cdf0e10cSrcweir     List                            maPageBookmarks;
132cdf0e10cSrcweir 	TransferableDataHelper*			mpOLEDataHelper;
133cdf0e10cSrcweir 	TransferableObjectDescriptor*	mpObjDesc;
134cdf0e10cSrcweir 	const ::sd::View*				mpSdView;
135cdf0e10cSrcweir 	::sd::View*						mpSdViewIntern;
136cdf0e10cSrcweir 	SdDrawDocument* 				mpSdDrawDocument;
137cdf0e10cSrcweir 	SdDrawDocument* 				mpSdDrawDocumentIntern;
138cdf0e10cSrcweir 	SdDrawDocument* 				mpSourceDoc;
139cdf0e10cSrcweir 	VirtualDevice*					mpVDev;
140cdf0e10cSrcweir 	INetBookmark*	  				mpBookmark;
141cdf0e10cSrcweir 	Graphic*						mpGraphic;
142cdf0e10cSrcweir 	ImageMap*						mpImageMap;
143cdf0e10cSrcweir 	Rectangle						maVisArea;
144cdf0e10cSrcweir 	Point							maStartPos;
145cdf0e10cSrcweir 	sal_Bool							mbInternalMove               : 1;
146cdf0e10cSrcweir 	sal_Bool							mbOwnDocument                : 1;
147cdf0e10cSrcweir 	sal_Bool							mbOwnView                    : 1;
148cdf0e10cSrcweir 	sal_Bool							mbLateInit                   : 1;
149cdf0e10cSrcweir     sal_Bool                            mbPageTransferable           : 1;
150cdf0e10cSrcweir     sal_Bool                            mbPageTransferablePersistent : 1;
151cdf0e10cSrcweir 	bool							mbIsUnoObj					: 1;
152cdf0e10cSrcweir     ::std::vector<boost::shared_ptr<UserData> > maUserData;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 									// not available
155cdf0e10cSrcweir 									SdTransferable();
156cdf0e10cSrcweir 									SdTransferable( const SdTransferable& );
157cdf0e10cSrcweir 	SdTransferable&					operator=( const SdTransferable& );
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	void							CreateObjectReplacement( SdrObject* pObj );
160cdf0e10cSrcweir 	void							CreateData();
161cdf0e10cSrcweir 
162cdf0e10cSrcweir };
163cdf0e10cSrcweir 
164cdf0e10cSrcweir #endif // _SD_SDXFER_HXX
165