1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SD_SLIDESORTER_TRANSFERABLE_DATA_HXX
25 #define SD_SLIDESORTER_TRANSFERABLE_DATA_HXX
26 
27 #include "sdxfer.hxx"
28 #include <boost/function.hpp>
29 #include <vector>
30 
31 class SdDrawDocument;
32 namespace sd { namespace slidesorter {
33 class SlideSorterViewShell;
34 } }
35 
36 namespace sd { namespace slidesorter { namespace controller {
37 
38 /** Represent previews and other information so that they can be
39     attached to an existing transferable.
40 */
41 class TransferableData
42     : public SdTransferable::UserData,
43       public SfxListener
44 {
45 public:
46     class Representative
47     {
48     public:
Representative(const Bitmap & rBitmap,const bool bIsExcluded)49         Representative (const Bitmap& rBitmap, const bool bIsExcluded)
50             : maBitmap(rBitmap), mbIsExcluded(bIsExcluded) {}
Representative(const Representative & rOther)51         Representative (const Representative& rOther)
52             : maBitmap(rOther.maBitmap), mbIsExcluded(rOther.mbIsExcluded) {}
operator =(const Representative & rOther)53         Representative operator=( const Representative& rOther)
54         {   if (&rOther != this) {maBitmap = rOther.maBitmap; mbIsExcluded = rOther.mbIsExcluded; }
55             return *this;
56         }
57 
58         Bitmap maBitmap;
59         bool mbIsExcluded;
60     };
61 
62     static SdTransferable* CreateTransferable (
63         SdDrawDocument* pSrcDoc,
64         ::sd::View* pWorkView,
65         sal_Bool bInitOnGetData,
66         SlideSorterViewShell* pViewShell,
67         const ::std::vector<TransferableData::Representative>& rRepresentatives);
68 
69     static ::boost::shared_ptr<TransferableData> GetFromTransferable (const SdTransferable* pTransferable);
70 
71     TransferableData (
72         SlideSorterViewShell* pViewShell,
73         const ::std::vector<TransferableData::Representative>& rRepresentatives);
74     ~TransferableData (void);
75 
76 	virtual void DragFinished (sal_Int8 nDropAction);
77 
78     const ::std::vector<Representative>& GetRepresentatives (void) const;
79 
80     /** Return the view shell for which the transferable was created.
81     */
82     SlideSorterViewShell* GetSourceViewShell (void) const;
83 
84 private:
85     SlideSorterViewShell* mpViewShell;
86     const ::std::vector<Representative> maRepresentatives;
87     typedef ::std::vector<boost::function<void(sal_uInt8)> > CallbackContainer;
88 
89     virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
90 };
91 
92 } } } // end of namespace ::sd::slidesorter::controller
93 
94 #endif
95