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