bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / slidesorter / inc / controller / SlsSelectionFunction.hxx
blob9516e3d60bdb0f63cf785426b56f5ffd8ea3701b
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 INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_CONTROLLER_SLSSELECTIONFUNCTION_HXX
21 #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_CONTROLLER_SLSSELECTIONFUNCTION_HXX
23 #include <controller/SlsFocusManager.hxx>
24 #include <fupoor.hxx>
25 #include <memory>
27 namespace sd { namespace slidesorter {
28 class SlideSorter;
29 } }
31 struct AcceptDropEvent;
33 namespace sd { namespace slidesorter { namespace controller {
35 class SlideSorterController;
37 class SelectionFunction final
38 : public FuPoor
40 public:
41 SelectionFunction(const SelectionFunction&) = delete;
42 SelectionFunction& operator=(const SelectionFunction&) = delete;
44 static rtl::Reference<FuPoor> Create( SlideSorter& rSlideSorter, SfxRequest& rRequest );
46 // Mouse- & Key-Events
47 virtual bool KeyInput(const KeyEvent& rKEvt) override;
48 virtual bool MouseMove(const MouseEvent& rMEvt) override;
49 virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
50 virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
52 /// Forward to the clipboard manager.
53 virtual void DoCut() override;
55 /// Forward to the clipboard manager.
56 virtual void DoCopy() override;
58 /// Forward to the clipboard manager.
59 virtual void DoPaste() override;
61 /** is called when the current function should be aborted. <p>
62 This is used when a function gets a KEY_ESCAPE but can also
63 be called directly.
65 @returns
66 true if a active function was aborted
68 virtual bool cancel() override;
70 void MouseDragged (
71 const AcceptDropEvent& rEvent,
72 const sal_Int8 nDragAction);
74 /** Turn of substitution display and insertion indicator.
76 void NotifyDragFinished();
78 class EventDescriptor;
79 class ModeHandler;
80 friend class ModeHandler;
81 enum Mode
83 NormalMode,
84 MultiSelectionMode,
85 DragAndDropMode
87 void SwitchToNormalMode();
88 void SwitchToDragAndDropMode(const Point& rMousePosition);
89 void SwitchToMultiSelectionMode (const Point& rMousePosition, const sal_uInt32 nEventCode);
91 void ResetShiftKeySelectionAnchor();
92 /** Special case handling for when the context menu is hidden. This
93 method will reinitialize the current mouse position to prevent the
94 mouse motion during the time the context menu is displayed from
95 being interpreted as drag-and-drop start.
97 void ResetMouseAnchor();
99 private:
100 SlideSorter& mrSlideSorter;
101 SlideSorterController& mrController;
103 SelectionFunction (
104 SlideSorter& rSlideSorter,
105 SfxRequest& rRequest);
107 virtual ~SelectionFunction() override;
109 /** Remember the slide where the shift key was pressed and started a
110 multiselection via keyboard.
112 sal_Int32 mnShiftKeySelectionAnchor;
114 /** The selection function can be in one of several mutually
115 exclusive modes.
117 std::shared_ptr<ModeHandler> mpModeHandler;
119 /** Make the slide nOffset slides away of the current one the new
120 current slide. When the new index is outside the range of valid
121 page numbers it is clipped to that range.
122 @param nOffset
123 When nOffset is negative then go back. When nOffset if positive go
124 forward. When it is zero then ignore the call.
126 void GotoNextPage (int nOffset);
128 /** Make the slide with the given index the new current slide.
129 @param nIndex
130 Index of the new current slide. When the new index is outside
131 the range of valid page numbers it is clipped to that range.
133 void GotoPage (int nIndex);
135 void ProcessMouseEvent (sal_uInt32 nEventType, const MouseEvent& rEvent);
137 // What follows are a couple of helper methods that are used by
138 // ProcessMouseEvent().
140 void ProcessEvent (EventDescriptor& rEvent);
142 void MoveFocus (
143 const FocusManager::FocusMoveDirection eDirection,
144 const bool bIsShiftDown,
145 const bool bIsControlDown);
147 void SwitchMode (const std::shared_ptr<ModeHandler>& rpHandler);
150 } } } // end of namespace ::sd::slidesorter::controller
152 #endif
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */