LibreOffice Module sd (master) 1
fupoor.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 <vcl/timer.hxx>
23#include <tools/link.hxx>
24#include <tools/gen.hxx>
25#include <vcl/vclptr.hxx>
26#include <svx/svdobj.hxx>
27
29
30class SdDrawDocument;
31class SfxRequest;
32class CommandEvent;
33class HelpEvent;
34class KeyEvent;
35class MouseEvent;
36
37namespace sd {
38
39class DrawDocShell;
40class View;
41class ViewShell;
42class Window;
43
48{
49public:
50 static const int HITPIX = 2; // hit tolerance in pixel
51 static const int HITLOG = 53; // hit tolerance in mm100
52 static const int DRGLOG = 53; // minimal drag move in mm100
53
54
55 virtual void DoExecute( SfxRequest& rReq );
56
57 void SetMouseButtonCode(sal_uInt16 nNew) { if(nNew != mnCode) mnCode = nNew; }
58 sal_uInt16 GetMouseButtonCode() const { return mnCode; }
59
61
62 virtual void DoCut();
63 virtual void DoCopy();
64 virtual void DoPaste();
65 virtual void DoPasteUnformatted();
66
67 // mouse & key events; return value = sal_True: event has been handled
68 virtual bool KeyInput(const KeyEvent& rKEvt);
69 virtual bool MouseMove(const MouseEvent& );
70 virtual bool MouseButtonUp(const MouseEvent& rMEvt);
71
72 // moved from inline to *.cxx
73 virtual bool MouseButtonDown(const MouseEvent& rMEvt);
74
75 virtual bool Command(const CommandEvent& rCEvt);
76 virtual bool RequestHelp(const HelpEvent& rHEvt);
77 virtual void ReceiveRequest(SfxRequest& rReq);
78
79 virtual void Activate();
80 virtual void Deactivate();
81
82 void SetWindow(::sd::Window* pWin);
83
84 virtual void SelectionHasChanged();
85
86 sal_uInt16 GetSlotID() const { return nSlotId; }
87
89
90 virtual rtl::Reference<SdrObject> CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle& rRectangle);
91
98 virtual bool cancel();
99
100 // #i33136#
108 virtual bool doConstructOrthogonal() const;
109
110protected:
115 FuPoor (ViewShell* pViewSh,
116 ::sd::Window* pWin,
117 ::sd::View* pView,
118 SdDrawDocument* pDoc,
119 SfxRequest& rReq);
120 virtual ~FuPoor() override;
121
122 DECL_LINK( DelayHdl, Timer *, void );
123
124 static void ImpForceQuadratic(::tools::Rectangle& rRect);
125
142 void SwitchLayer (sal_Int32 nOffset);
143
149
150 sal_uInt16 nSlotId;
151
153 DECL_LINK( ScrollHdl, Timer *, void );
154 void ForceScroll(const Point& aPixPos);
155
157 DECL_LINK(DragHdl, Timer *, void);
160
163
169
171
172private:
173 sal_uInt16 mnCode;
174
175};
176
177} // end of namespace sd
178
179/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class for all functions.
Definition: fupoor.hxx:48
bool bScrollable
Definition: fupoor.hxx:166
virtual bool doConstructOrthogonal() const
Decide if the object to be created should be created orthogonal.
Definition: fupoor.cxx:1082
virtual bool Command(const CommandEvent &rCEvt)
Definition: fupoor.cxx:945
DECL_LINK(DelayHdl, Timer *, void)
SdDrawDocument * mpDoc
Definition: fupoor.hxx:148
Timer aScrollTimer
for auto-scrolling
Definition: fupoor.hxx:152
virtual void DoCopy()
Copy object to clipboard.
Definition: fupoor.cxx:888
sal_uInt16 GetSlotID() const
Definition: fupoor.hxx:86
FuPoor(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fupoor.cxx:56
bool bDelayActive
Definition: fupoor.hxx:167
static const int HITLOG
Definition: fupoor.hxx:51
void SwitchLayer(sal_Int32 nOffset)
Switch to another layer.
Definition: fupoor.cxx:1034
virtual bool MouseButtonDown(const MouseEvent &rMEvt)
Definition: fupoor.cxx:975
DrawDocShell * GetDocSh()
Definition: fupoor.hxx:60
virtual bool MouseMove(const MouseEvent &)
Definition: fupoor.cxx:863
sal_uInt16 mnCode
member to hold state of the mouse buttons for creation of own MouseEvents (like in ScrollHdl)
Definition: fupoor.hxx:173
void StartDelayToScrollTimer()
Definition: fupoor.cxx:983
virtual bool MouseButtonUp(const MouseEvent &rMEvt)
Definition: fupoor.cxx:965
virtual bool RequestHelp(const HelpEvent &rHEvt)
Definition: fupoor.cxx:989
virtual bool KeyInput(const KeyEvent &rKEvt)
handle keyboard events
Definition: fupoor.cxx:175
void SetWindow(::sd::Window *pWin)
Definition: fupoor.cxx:113
virtual void Activate()
activates the function
Definition: fupoor.cxx:98
VclPtr< ::sd::Window > mpWindow
Definition: fupoor.hxx:146
Point aMDPos
position of MouseButtonDown
Definition: fupoor.hxx:159
static void ImpForceQuadratic(::tools::Rectangle &rRect)
Definition: fupoor.cxx:1018
virtual void DoCut()
Cut object to clipboard.
Definition: fupoor.cxx:877
virtual void DoPasteUnformatted()
Paste unformatted text from clipboard.
Definition: fupoor.cxx:910
ViewShell * mpViewShell
Definition: fupoor.hxx:145
bool bNoScrollUntilInside
Flag to prevent auto-scrolling until one drags from outside into the window.
Definition: fupoor.hxx:162
void SetMouseButtonCode(sal_uInt16 nNew)
Definition: fupoor.hxx:57
virtual void DoPaste()
Paste object from clipboard.
Definition: fupoor.cxx:899
virtual ~FuPoor() override
Definition: fupoor.cxx:91
virtual void SelectionHasChanged()
Definition: fupoor.cxx:868
sal_uInt16 nSlotId
Definition: fupoor.hxx:150
void ForceScroll(const Point &aPixPos)
scroll when approached the border of the window; is called by MouseMove
Definition: fupoor.cxx:121
virtual void Deactivate()
deactivates the function
Definition: fupoor.cxx:102
virtual void ReceiveRequest(SfxRequest &rReq)
Definition: fupoor.cxx:1008
bool bIsInDragMode
Definition: fupoor.hxx:158
Timer aDragTimer
for Drag&Drop
Definition: fupoor.hxx:156
virtual rtl::Reference< SdrObject > CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle &rRectangle)
Definition: fupoor.cxx:1012
static const int DRGLOG
Definition: fupoor.hxx:52
DrawDocShell * mpDocSh
Definition: fupoor.hxx:147
DECL_LINK(ScrollHdl, Timer *, void)
::sd::View * mpView
Definition: fupoor.hxx:144
virtual bool cancel()
is called when the current function should be aborted.
Definition: fupoor.cxx:1070
static const int HITPIX
Definition: fupoor.hxx:50
bool bFirstMouseMove
Definition: fupoor.hxx:168
virtual void DoExecute(SfxRequest &rReq)
Definition: fupoor.cxx:1129
Timer aDelayToScrollTimer
timer to delay scrolling (~ 1 sec) when dragging out of the window
Definition: fupoor.hxx:165
DECL_LINK(DragHdl, Timer *, void)
sal_uInt16 GetMouseButtonCode() const
Definition: fupoor.hxx:58
A simple base implementation for reference-counted components.
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45