LibreOffice Module sd (master) 1
SlsSelectionFunction.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
23#include <fupoor.hxx>
24#include <memory>
25
26namespace sd::slidesorter
27{
28class SlideSorter;
29}
30
31struct AcceptDropEvent;
32
34{
35class SlideSorterController;
36
37class SelectionFunction final : public FuPoor
38{
39public:
42
43 static rtl::Reference<FuPoor> Create(SlideSorter& rSlideSorter, SfxRequest& rRequest);
44
45 // Mouse- & Key-Events
46 virtual bool KeyInput(const KeyEvent& rKEvt) override;
47 virtual bool MouseMove(const MouseEvent& rMEvt) override;
48 virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
49 virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
50
52 virtual void DoCut() override;
53
55 virtual void DoCopy() override;
56
58 virtual void DoPaste() override;
59
67 virtual bool cancel() override;
68
69 void MouseDragged(const AcceptDropEvent& rEvent, const sal_Int8 nDragAction);
70
73 void NotifyDragFinished();
74
75 class EventDescriptor;
76 class ModeHandler;
77 friend class ModeHandler;
78 enum Mode
79 {
83 };
84 void SwitchToNormalMode();
85 void SwitchToDragAndDropMode(const Point& rMousePosition);
86 void SwitchToMultiSelectionMode(const Point& rMousePosition, const sal_uInt32 nEventCode);
87
94 void ResetMouseAnchor();
95
96private:
99
100 SelectionFunction(SlideSorter& rSlideSorter, SfxRequest& rRequest);
101
102 virtual ~SelectionFunction() override;
103
108
112 std::shared_ptr<ModeHandler> mpModeHandler;
113
121 void GotoNextPage(int nOffset);
122
128 void GotoPage(int nIndex);
129
130 void ProcessMouseEvent(sal_uInt32 nEventType, const MouseEvent& rEvent);
131
132 // What follows are a couple of helper methods that are used by
133 // ProcessMouseEvent().
134
135 void ProcessEvent(EventDescriptor& rEvent);
136
137 void MoveFocus(const FocusManager::FocusMoveDirection eDirection, const bool bIsShiftDown,
138 const bool bIsControlDown);
139
140 void SwitchMode(const std::shared_ptr<ModeHandler>& rpHandler);
141};
142
143} // end of namespace ::sd::slidesorter::controller
144
145/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class for all functions.
Definition: fupoor.hxx:48
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
Definition: SlideSorter.hxx:62
void MoveFocus(const FocusManager::FocusMoveDirection eDirection, const bool bIsShiftDown, const bool bIsControlDown)
void GotoPage(int nIndex)
Make the slide with the given index the new current slide.
void SwitchToDragAndDropMode(const Point &rMousePosition)
std::shared_ptr< ModeHandler > mpModeHandler
The selection function can be in one of several mutually exclusive modes.
virtual void DoCopy() override
Forward to the clipboard manager.
sal_Int32 mnShiftKeySelectionAnchor
Remember the slide where the shift key was pressed and started a multiselection via keyboard.
void NotifyDragFinished()
Turn of substitution display and insertion indicator.
virtual void DoPaste() override
Forward to the clipboard manager.
void MouseDragged(const AcceptDropEvent &rEvent, const sal_Int8 nDragAction)
void ResetMouseAnchor()
Special case handling for when the context menu is hidden.
void GotoNextPage(int nOffset)
Make the slide nOffset slides away of the current one the new current slide.
virtual void DoCut() override
Forward to the clipboard manager.
void SwitchToMultiSelectionMode(const Point &rMousePosition, const sal_uInt32 nEventCode)
SelectionFunction(const SelectionFunction &)=delete
virtual bool KeyInput(const KeyEvent &rKEvt) override
handle keyboard events
static rtl::Reference< FuPoor > Create(SlideSorter &rSlideSorter, SfxRequest &rRequest)
void SwitchMode(const std::shared_ptr< ModeHandler > &rpHandler)
virtual bool MouseMove(const MouseEvent &rMEvt) override
virtual bool cancel() override
is called when the current function should be aborted.
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
void ProcessMouseEvent(sal_uInt32 nEventType, const MouseEvent &rEvent)
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
SelectionFunction & operator=(const SelectionFunction &)=delete
signed char sal_Int8