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