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