Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _SD_SDXFER_HXX
21 : #define _SD_SDXFER_HXX
22 :
23 : #include <svtools/transfer.hxx>
24 : #include <vcl/graph.hxx>
25 : #include <sfx2/objsh.hxx>
26 : #include <svl/lstner.hxx>
27 :
28 : // ------------------
29 : // - SdTransferable -
30 : // ------------------
31 :
32 : class SdDrawDocument;
33 : class SdrObject;
34 : class INetBookmark;
35 : class ImageMap;
36 : class VirtualDevice;
37 :
38 : namespace sd {
39 : class DrawDocShell;
40 : class View;
41 : }
42 :
43 : class SfxObjectShellRef;
44 : class SdTransferable : public TransferableHelper, public SfxListener
45 : {
46 : public:
47 :
48 : SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, sal_Bool bInitOnGetData );
49 : ~SdTransferable();
50 :
51 0 : void SetDocShell( const SfxObjectShellRef& rRef ) { maDocShellRef = rRef; }
52 0 : const SfxObjectShellRef& GetDocShell() const { return maDocShellRef; }
53 :
54 0 : void SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = (SdDrawDocument*) pWorkDoc; }
55 0 : const SdDrawDocument* GetWorkDocument() const { return mpSdDrawDocument; }
56 :
57 0 : void SetView( const ::sd::View* pView ) { mpSdView = pView; }
58 0 : const ::sd::View* GetView() const { return mpSdView; }
59 :
60 : void SetObjectDescriptor( const TransferableObjectDescriptor& rObjDesc );
61 :
62 0 : void SetStartPos( const Point& rStartPos ) { maStartPos = rStartPos; }
63 0 : const Point& GetStartPos() const { return maStartPos; }
64 :
65 0 : void SetInternalMove( sal_Bool bSet ) { mbInternalMove = bSet; }
66 0 : sal_Bool IsInternalMove() const { return mbInternalMove; }
67 :
68 0 : sal_Bool HasSourceDoc( const SdDrawDocument* pDoc ) const { return( mpSourceDoc == pDoc ); }
69 :
70 : void SetPageBookmarks( const std::vector<rtl::OUString>& rPageBookmarks, sal_Bool bPersistent );
71 0 : sal_Bool IsPageTransferable() const { return mbPageTransferable; }
72 0 : sal_Bool HasPageBookmarks() const { return( mpPageDocShell && ( !maPageBookmarks.empty() ) ); }
73 0 : const std::vector<rtl::OUString>& GetPageBookmarks() const { return maPageBookmarks; }
74 0 : ::sd::DrawDocShell* GetPageDocShell() const { return mpPageDocShell; }
75 :
76 : sal_Bool SetTableRTF( SdDrawDocument*, const ::com::sun::star::datatransfer::DataFlavor& );
77 :
78 : static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
79 : static SdTransferable* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxData ) throw();
80 :
81 : // SfxListener
82 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
83 :
84 : virtual void DragFinished( sal_Int8 nDropAction );
85 : SdDrawDocument* GetSourceDoc (void) const;
86 :
87 : /** User data objects can be used to store information temporarily
88 : at the transferable. The slide sorter uses this to store
89 : previews of the slides that are referenced by the
90 : transferable.
91 : */
92 0 : class UserData {public:virtual~UserData(){}};
93 :
94 : /** Add a user data object. When it was added before (and not
95 : removed) then this call is ignored.
96 : */
97 : void AddUserData (const ::boost::shared_ptr<UserData>& rpData);
98 :
99 : /** Return the number of user data objects.
100 : */
101 : sal_Int32 GetUserDataCount (void) const;
102 :
103 : /** Return the specified user data object. When the index is not
104 : valid, ie not in the range [0,count) then an empty pointer is
105 : returned.
106 : */
107 : ::boost::shared_ptr<UserData> GetUserData (const sal_Int32 nIndex) const;
108 :
109 : protected:
110 :
111 : virtual void AddSupportedFormats();
112 : virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
113 : virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
114 : virtual void ObjectReleased();
115 :
116 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
117 :
118 : private:
119 :
120 : SfxObjectShellRef maDocShellRef;
121 : ::sd::DrawDocShell* mpPageDocShell;
122 : std::vector<rtl::OUString> maPageBookmarks;
123 : TransferableDataHelper* mpOLEDataHelper;
124 : TransferableObjectDescriptor* mpObjDesc;
125 : const ::sd::View* mpSdView;
126 : ::sd::View* mpSdViewIntern;
127 : SdDrawDocument* mpSdDrawDocument;
128 : SdDrawDocument* mpSdDrawDocumentIntern;
129 : SdDrawDocument* mpSourceDoc;
130 : VirtualDevice* mpVDev;
131 : INetBookmark* mpBookmark;
132 : Graphic* mpGraphic;
133 : ImageMap* mpImageMap;
134 : Rectangle maVisArea;
135 : Point maStartPos;
136 : sal_Bool mbInternalMove : 1;
137 : sal_Bool mbOwnDocument : 1;
138 : sal_Bool mbOwnView : 1;
139 : sal_Bool mbLateInit : 1;
140 : sal_Bool mbPageTransferable : 1;
141 : sal_Bool mbPageTransferablePersistent : 1;
142 : bool mbIsUnoObj : 1;
143 : ::std::vector<boost::shared_ptr<UserData> > maUserData;
144 :
145 : // not available
146 : SdTransferable();
147 : SdTransferable( const SdTransferable& );
148 : SdTransferable& operator=( const SdTransferable& );
149 :
150 : void CreateObjectReplacement( SdrObject* pObj );
151 : void CreateData();
152 :
153 : };
154 :
155 : #endif // _SD_SDXFER_HXX
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|