LibreOffice Module sd (master) 1
SlsClipboard.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <memory>
23#include <ViewClipboard.hxx>
25#include <sdxfer.hxx>
26
27#include <sal/types.h>
28#include <o3tl/deleter.hxx>
29#include <svx/svdtypes.hxx>
30
31#include <sddllapi.h>
32
33class SfxRequest;
34struct AcceptDropEvent;
35class DropTargetHelper;
36struct ExecuteDropEvent;
37struct ImplSVEvent;
38class Point;
39class SdPage;
40namespace vcl { class Window; }
41
42namespace sd {
43class Window;
44}
45
46namespace sd::slidesorter { class SlideSorter; }
47
49
50class SlideSorterController;
51
52class SAL_DLLPUBLIC_RTTI Clipboard final
53 : public ViewClipboard
54{
55public:
56 Clipboard (SlideSorter& rSlideSorter);
57 virtual ~Clipboard() override;
58
63 static std::shared_ptr<SdTransferable::UserData> CreateTransferableUserData (SdTransferable* pTransferable);
64
65 void HandleSlotCall (SfxRequest& rRequest);
66
67 void DoCut ();
68 // Exported for unit test
69 SD_DLLPUBLIC void DoCopy();
70 // Exported for unit test
71 SD_DLLPUBLIC void DoPaste();
72 void DoDelete ();
73
74 void StartDrag (
75 const Point& rDragPt,
76 vcl::Window* pWindow );
77
78 void DragFinished (
79 sal_Int8 nDropAction);
80
81 sal_Int8 AcceptDrop (
82 const AcceptDropEvent& rEvt,
83 DropTargetHelper& rTargetHelper,
84 ::sd::Window* pTargetWindow,
85 sal_uInt16 nPage,
86 SdrLayerID nLayer );
87
88 sal_Int8 ExecuteDrop (
89 const ExecuteDropEvent& rEvt,
90 DropTargetHelper& rTargetHelper,
91 ::sd::Window* pTargetWindow,
92 sal_uInt16 nPage,
93 SdrLayerID nLayer );
94
95 void Abort();
96
97private:
98 virtual sal_uInt16 DetermineInsertPosition () override;
99
102
103 typedef ::std::vector<SdPage*> PageList;
109
113 class UndoContext;
114 std::unique_ptr<UndoContext> mxUndoContext;
115
116 std::unique_ptr<SelectionObserver::Context, o3tl::default_delete<SelectionObserver::Context>> mxSelectionObserverContext;
118
119 void CreateSlideTransferable (
120 vcl::Window* pWindow,
121 bool bDrag);
122
129 sal_Int32 GetInsertionPosition ();
130
140 sal_Int32 PasteTransferable (sal_Int32 nInsertPosition);
141
149 void SelectPageRange (sal_Int32 nFirstIndex, sal_Int32 nPageCount);
150
161 enum DropType { DT_PAGE, DT_PAGE_FROM_NAVIGATOR, DT_SHAPE, DT_NONE };
162 DropType IsDropAccepted() const;
163
183 enum DropCommand { DC_ACCEPT, DC_EXECUTE };
184 sal_Int8 ExecuteOrAcceptShapeDrop (
185 DropCommand eCommand,
186 const Point& rPosition,
187 const void* pDropEvent ,
188 DropTargetHelper& rTargetHelper,
189 ::sd::Window* pTargetWindow,
190 sal_uInt16 nPage,
191 SdrLayerID nLayer);
192
196 bool IsInsertionTrivial (
197 SdTransferable const * pTransferable,
198 const sal_Int8 nDndAction) const;
199
203 DECL_DLLPRIVATE_LINK(ProcessDragFinished, void*, void);
204};
205
206} // end of namespace ::sd::slidesorter::controller
207
208/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Handle clipboard related tasks for the draw view.
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
Definition: SlideSorter.hxx:62
PageList maPagesToRemove
Remember the pages that are dragged to another document or to another place in the same document so t...
SlideSorterController & mrController
std::unique_ptr< UndoContext > mxUndoContext
::std::vector< SdPage * > PageList
DropCommand
This method contains the code for AcceptDrop() and ExecuteDrop() shapes.
DropType
Return <TRUE> when the current transferable in the current state of the slidesorter is acceptable to ...
std::unique_ptr< SelectionObserver::Context, o3tl::default_delete< SelectionObserver::Context > > mxSelectionObserverContext
DECL_DLLPRIVATE_LINK(ProcessDragFinished, void *, void)
Asynchronous part of DragFinished.
#define SD_DLLPUBLIC
Definition: sddllapi.h:27
signed char sal_Int8