1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SlsClipboard.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef SD_SLIDESORTER_CLIPBOARD
31 #define SD_SLIDESORTER_CLIPBOARD
33 #include "ViewClipboard.hxx"
35 #include <sal/types.h>
36 #include <tools/solar.h>
37 #include <svx/svdpage.hxx>
44 struct AcceptDropEvent
;
45 class DropTargetHelper
;
46 struct ExecuteDropEvent
;
55 namespace sd
{ namespace slidesorter
{
59 namespace sd
{ namespace slidesorter
{ namespace model
{
63 namespace sd
{ namespace slidesorter
{ namespace controller
{
65 class SlideSorterController
;
68 : public ViewClipboard
71 Clipboard (SlideSorter
& rSlideSorter
);
74 void HandleSlotCall (SfxRequest
& rRequest
);
76 void DoCut (::Window
* pWindow
= 0);
77 void DoCopy (::Window
* pWindow
= 0);
78 void DoPaste (::Window
* pWindow
= 0);
79 void DoDelete (::Window
* pWindow
= 0);
86 sal_Int8 nDropAction
);
89 const AcceptDropEvent
& rEvt
,
90 DropTargetHelper
& rTargetHelper
,
91 ::sd::Window
* pTargetWindow
= NULL
,
92 USHORT nPage
= SDRPAGE_NOTFOUND
,
93 USHORT nLayer
= SDRPAGE_NOTFOUND
);
95 sal_Int8
ExecuteDrop (
96 const ExecuteDropEvent
& rEvt
,
97 DropTargetHelper
& rTargetHelper
,
98 ::sd::Window
* pTargetWindow
= NULL
,
99 USHORT nPage
= SDRPAGE_NOTFOUND
,
100 USHORT nLayer
= SDRPAGE_NOTFOUND
);
103 virtual USHORT
DetermineInsertPosition (
104 const SdTransferable
& rTransferable
);
106 virtual USHORT
InsertSlides (
107 const SdTransferable
& rTransferable
,
108 USHORT nInsertPosition
);
111 SlideSorter
& mrSlideSorter
;
112 SlideSorterController
& mrController
;
114 typedef ::std::vector
<SdPage
*> PageList
;
115 /** Remember the pages that are dragged to another document or to
116 another place in the same document so that they can be removed after
119 PageList maPagesToRemove
;
121 /** Remember the pages inserted from another document or another place
122 in the same document so that they can be selected after the
123 drag-and-drop operation is completed.
125 PageList maPagesToSelect
;
127 /** When pages are moved or copied then the selection of the slide
128 sorter has to be updated. This flag is used to remember whether the
129 selection has to be updated or can stay as it is (FALSE).
131 bool mbUpdateSelectionPending
;
133 void CreateSlideTransferable (
137 /** Select the pages stored in the maPagesToSelect member. The list in
138 the member is cleared afterwards.
140 void SelectPages (void);
142 /** Determine the position of where to insert the pages in the current
143 transferable of the sd module.
145 This window is used as parent for dialogs that have to be shown
148 The index in the range [0,n] (both inclusive) with n the number
149 of pages is returned.
151 sal_Int32
GetInsertionPosition (::Window
* pWindow
);
153 /** Paste the pages of the transferable of the sd module at the given
155 @param nInsertPosition
156 The position at which to insert the pages. The valid range is
157 [0,n] (both inclusive) with n the number of pages in the
160 The number of inserted pages is returned.
162 sal_Int32
PasteTransferable (sal_Int32 nInsertPosition
);
164 /** Select a range of pages of the model. Typicall usage is the
165 selection of newly inserted pages.
167 The index of the first page to select.
169 The number of pages to select.
171 void SelectPageRange (sal_Int32 nFirstIndex
, sal_Int32 nPageCount
);
173 /** Return <TRUE/> when the current transferable in the current state of
174 the slidesorter is acceptable to be pasted. For this the
177 b) contain one or more regular draw pages, no master pages.
178 When master pages are involved, either in the transferable or in the
179 slide sorter (by it displaying master pages) the drop of the
180 transferable is not accepted. The reason is the missing
181 implementation of proper handling master pages copy-and-paste.
183 enum DropType
{ DT_PAGE
, DT_SHAPE
, DT_NONE
};
184 DropType
IsDropAccepted (void) const;
186 /** This method contains the code for AcceptDrop() and ExecuteDrop() shapes.
187 There are only minor differences for the two cases at this level.
189 This parameter specifies whether to do a AcceptDrop() or
192 Since the event is given as void pointer we can not take the
193 mouse position from it. The caller has to supply it in this
196 Event though the AcceptDropEvent and ExecuteDropEvent are very
197 similar they do not have a common base class. Because of that
198 we have to use a void* to pase these structs.
200 When the page number is given as 0xffff then it is replaced by
201 the number of the page at the mouse position. If the mouse is
202 not over a page then neither AcceptDrop() nor ExecuteDrop() are
205 enum DropCommand
{ DC_ACCEPT
, DC_EXECUTE
};
206 sal_Int8
ExecuteOrAcceptShapeDrop (
207 DropCommand eCommand
,
208 const Point
& rPosition
,
209 const void* pDropEvent
,
210 DropTargetHelper
& rTargetHelper
,
211 ::sd::Window
* pTargetWindow
,
216 } } } // end of namespace ::sd::slidesorter::controller