bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / inc / sdxfer.hxx
blobb09056f2832e4eae76884c8a65c65cf63a04a022
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SD_SDXFER_HXX
21 #define _SD_SDXFER_HXX
23 #include <svtools/transfer.hxx>
24 #include <vcl/graph.hxx>
25 #include <sfx2/objsh.hxx>
26 #include <svl/lstner.hxx>
28 // ------------------
29 // - SdTransferable -
30 // ------------------
32 class SdDrawDocument;
33 class SdrObject;
34 class INetBookmark;
35 class ImageMap;
36 class VirtualDevice;
38 namespace sd {
39 class DrawDocShell;
40 class View;
43 class SfxObjectShellRef;
44 class SdTransferable : public TransferableHelper, public SfxListener
46 public:
48 SdTransferable( SdDrawDocument* pSrcDoc, ::sd::View* pWorkView, sal_Bool bInitOnGetData );
49 ~SdTransferable();
51 void SetDocShell( const SfxObjectShellRef& rRef ) { maDocShellRef = rRef; }
52 const SfxObjectShellRef& GetDocShell() const { return maDocShellRef; }
54 void SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = (SdDrawDocument*) pWorkDoc; }
55 const SdDrawDocument* GetWorkDocument() const { return mpSdDrawDocument; }
57 void SetView( const ::sd::View* pView ) { mpSdView = pView; }
58 const ::sd::View* GetView() const { return mpSdView; }
60 void SetObjectDescriptor( const TransferableObjectDescriptor& rObjDesc );
62 void SetStartPos( const Point& rStartPos ) { maStartPos = rStartPos; }
63 const Point& GetStartPos() const { return maStartPos; }
65 void SetInternalMove( sal_Bool bSet ) { mbInternalMove = bSet; }
66 sal_Bool IsInternalMove() const { return mbInternalMove; }
68 sal_Bool HasSourceDoc( const SdDrawDocument* pDoc ) const { return( mpSourceDoc == pDoc ); }
70 void SetPageBookmarks( const std::vector<OUString>& rPageBookmarks, sal_Bool bPersistent );
71 sal_Bool IsPageTransferable() const { return mbPageTransferable; }
72 sal_Bool HasPageBookmarks() const { return( mpPageDocShell && ( !maPageBookmarks.empty() ) ); }
73 const std::vector<OUString>& GetPageBookmarks() const { return maPageBookmarks; }
74 ::sd::DrawDocShell* GetPageDocShell() const { return mpPageDocShell; }
76 sal_Bool SetTableRTF( SdDrawDocument*, const ::com::sun::star::datatransfer::DataFlavor& );
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();
81 // SfxListener
82 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
84 virtual void DragFinished( sal_Int8 nDropAction );
85 SdDrawDocument* GetSourceDoc (void) const;
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.
92 class UserData {public:virtual~UserData(){}};
94 /** Add a user data object. When it was added before (and not
95 removed) then this call is ignored.
97 void AddUserData (const ::boost::shared_ptr<UserData>& rpData);
99 /** Return the number of user data objects.
101 sal_Int32 GetUserDataCount (void) const;
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.
107 ::boost::shared_ptr<UserData> GetUserData (const sal_Int32 nIndex) const;
109 protected:
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();
116 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw( ::com::sun::star::uno::RuntimeException );
118 private:
120 SfxObjectShellRef maDocShellRef;
121 ::sd::DrawDocShell* mpPageDocShell;
122 std::vector<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;
145 // not available
146 SdTransferable();
147 SdTransferable( const SdTransferable& );
148 SdTransferable& operator=( const SdTransferable& );
150 void CreateObjectReplacement( SdrObject* pObj );
151 void CreateData();
155 #endif // _SD_SDXFER_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */