1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
// HACK to avoid too deep includes and to have some
// levels free in svdmark itself (MS compiler include depth limit)
#include <svx/svdhdl.hxx>
#include <tools/weakbase.h>
#include <svtools/accessibilityoptions.hxx>
#include <svx/svxdllapi.h>
#include <svx/svdcrtv.hxx>
#include <vcl/event.hxx>
#include <unotools/options.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
// class hierarchy of View:
// SfxListener
// SdrPaintView PntV Action ModChg Attr Notify
// SdrSnapView SnpV Action
//
// SdrMarkView MrkV Action MrkChg ModChg Notify
//
// SdrEditView EdtV MrkChg ModChg Attr
// SdrPolyEditView PoEV
// SdrGlueEditView GlEV
// SdrObjEditView EdxV Action ModChg Attr Notify
//
// SdrExchangeView XcgV
// SdrDragView DrgV Action
//
// SdrCreateView CrtV Action
// SdrView View
class SvxURLField;
namespace sdr::contact { class ObjectContact; }
enum class SdrViewContext {
Standard,
PointEdit,
GluePointEdit,
Graphic,
Media,
Table
};
enum class SdrEventKind {
NONE,
TextEdit,
MoveAction,
EndAction,
BackAction,
EndCreate,
EndDrag,
MarkObj,
MarkPoint,
MarkGluePoint,
BeginMark,
BeginInsertObjPoint,
EndInsertObjPoint,
BeginInsertGluePoint,
BeginDragHelpline,
BeginDragObj,
BeginCreateObj,
BeginMacroObj,
BeginTextEdit,
EndMark,
BrkMark,
ExecuteUrl
};
/* for PickAnything() */
enum class SdrMouseEventKind
{
BUTTONDOWN = 1,
MOVE = 2,
BUTTONUP = 3,
};
// helper class SdrViewEvent
struct SVXCORE_DLLPUBLIC SdrViewEvent
{
SdrHdl* mpHdl;
SdrObject* mpObj;
SdrObject* mpRootObj; // mark this when SdrBeginTextEdit is executed
SdrPageView* mpPV;
const SvxURLField* mpURLField;
Point maLogicPos;
SdrHitKind meHit;
SdrEventKind meEvent;
sal_uInt16 mnMouseClicks;
MouseEventModifiers mnMouseMode;
sal_uInt16 mnMouseCode;
sal_uInt16 mnHlplIdx;
sal_uInt16 mnGlueId;
bool mbMouseDown : 1;
bool mbMouseUp : 1;
bool mbIsAction : 1; // Action is active
bool mbIsTextEdit : 1; // TextEdit runs currently
bool mbAddMark : 1;
bool mbUnmark : 1;
bool mbPrevNextMark : 1;
bool mbMarkPrev : 1;
public:
SdrViewEvent();
};
// helper class for all D&D overlays
class SVXCORE_DLLPUBLIC SdrDropMarkerOverlay
{
// The OverlayObjects
sdr::overlay::OverlayObjectList maObjects;
void ImplCreateOverlays(
const SdrView& rView,
const basegfx::B2DPolyPolygon& rLinePolyPolygon);
public:
SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject);
SdrDropMarkerOverlay(const SdrView& rView, const tools::Rectangle& rRectangle);
SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd);
~SdrDropMarkerOverlay();
};
class SVXCORE_DLLPUBLIC SdrView : public SdrCreateView, public tools::WeakBase
{
friend class SdrPageView;
bool mbNoExtendedMouseDispatcher : 1;
bool mbNoExtendedKeyDispatcher : 1;
bool mbMasterPagePaintCaching : 1;
SvtAccessibilityOptions maAccessibilityOptions;
public:
explicit SdrView(
SdrModel& rSdrModel,
OutputDevice* pOut = nullptr);
virtual ~SdrView() override;
virtual bool IsSdrView() const final { return true; }
// The default value for all dispatchers is activated. If the app for example
// wants to intervene in MouseDispatcher for special treatment, you have to
// deactivate the MouseDispatcher with the help of the method below and you have
// to implement it yourself. Example for MouseButtonDown:
// SdrViewEvent aVEvt;
// SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SdrMouseEventKind::BUTTONDOWN,aVEvt);
// ... here application-specific intervention ...
// pSdrView->DoMouseEvent(aVEvt);
// SetPointer(GetPreferredPointer(...))
// CaptureMouse(...)
void EnableExtendedMouseEventDispatcher(bool bOn) { mbNoExtendedMouseDispatcher = !bOn; }
bool IsExtendedMouseEventDispatcherEnabled() const { return mbNoExtendedMouseDispatcher; }
void EnableExtendedKeyInputDispatcher(bool bOn) { mbNoExtendedKeyDispatcher=!bOn; }
bool IsExtendedKeyInputDispatcherEnabled() const { return mbNoExtendedKeyDispatcher; }
void SetMasterPagePaintCaching(bool bOn);
bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override;
virtual bool MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) override;
virtual bool MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) override;
virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override;
using SdrCreateView::RequestHelp;
virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) override;
virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll=false) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
/* new interface src537 */
void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr=false) const;
// incomplete implementation:
// OutputDevice is necessary to determine HandleSize.
// If NULL the first signed on Win is used.
PointerStyle GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const;
SdrHitKind PickAnything(const MouseEvent& rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
bool DoMouseEvent(const SdrViewEvent& rVEvt);
virtual SdrViewContext GetContext() const;
// The methods consider the particular context:
// - simple drawing
// - mode for editing points
// - mode for editing gluepoints
// - TextEdit
// - ... to be continued
void MarkAll();
void UnmarkAll();
const tools::Rectangle& GetMarkedRect() const;
virtual void DeleteMarked();
// Marking objects, traverse stations or gluepoints (depending on view-
// context) by enveloping the selection frame.
// bAddMark=TRUE: add to existing selection (->Shift)
// bUnmark=TRUE: remove objects from selection which are inside of
// the enveloped frame.
bool BegMark(const Point& rPnt, bool bAddMark, bool bUnmark);
// The following actions are possible:
// - ObjectCreating
// - ObjectMarking
// - Object-specific dragging
// - General dragging
// and more...
OUString GetStatusText();
virtual void onAccessibilityOptionsChanged();
// Do not create ObjectContact locally, but offer a call to allow override
// and to create own derivations of ObjectContact
virtual sdr::contact::ObjectContact* createViewSpecificObjectContact(
SdrPageWindow& rPageWindow,
const char* pDebugName) const;
// Interactive Move Action programmatically
bool MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint, const sal_Int32 aObjectOrdNum = -1);
};
// First of all the app creates a SdrModel.
// Then it opens a Win and creates a SdrView.
// ShowSdrPage() announces a page at SdrView.
// It's possible to show SdrView in any Wins at once.
// internal:
// SdrView can show as many Wins as it wants at once. Pages are announced
// or checked out with the help of ShowSdrPage()/HideSdrPage(). For every announced
// page there is a SdrPageView instance in container aPages. If more than one page
// is showed, you have to pay attention that the offset parameter of ShowSdrPage()
// is conformed to the size of the page (to prevent overlapping of two pages).
//
// elementary methods:
// ~~~~~~~~~~~~~~~~~~~~
// simple events:
// ~~~~~~~~~~~~~~~~
// bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
// bool MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin);
// bool MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin);
// bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin);
// bool Command(const CommandEvent& rCEvt, vcl::Window* pWin);
//
// SfxItems:
// ~~~~~~~~~
// sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
// sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
// SfxStyleSheet* GetStyleSheet() const;
// sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
//
// others:
// ~~~~~~~~~~
// Pointer GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
// OUString GetStatusText();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|