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 virtual bool IsSdrView() const final { return true; }
164
165 // The default value for all dispatchers is activated. If the app for example
166 // wants to intervene in MouseDispatcher for special treatment, you have to
167 // deactivate the MouseDispatcher with the help of the method below and you have
168 // to implement it yourself. Example for MouseButtonDown:
169 // SdrViewEvent aVEvt;
170 // SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SdrMouseEventKind::BUTTONDOWN,aVEvt);
171 // ... here application-specific intervention ...
172 // pSdrView->DoMouseEvent(aVEvt);
173 // SetPointer(GetPreferredPointer(...))
174 // CaptureMouse(...)
175 void EnableExtendedMouseEventDispatcher(bool bOn) { mbNoExtendedMouseDispatcher = !bOn; }
176 bool IsExtendedMouseEventDispatcherEnabled() const { return mbNoExtendedMouseDispatcher; }
177
178 void EnableExtendedKeyInputDispatcher(bool bOn) { mbNoExtendedKeyDispatcher=!bOn; }
179 bool IsExtendedKeyInputDispatcherEnabled() const { return mbNoExtendedKeyDispatcher; }
180
181 void SetMasterPagePaintCaching(bool bOn);
182 bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
183
184 bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) override;
185 virtual bool MouseButtonDown(const MouseEvent& rMEvt, OutputDevice* pWin) override;
186 virtual bool MouseButtonUp(const MouseEvent& rMEvt, OutputDevice* pWin) override;
187 virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override;
189 virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) override;
190
191 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
192
193 bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll=false) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
194
195 /* new interface src537 */
196 void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr=false) const;
197
198 // incomplete implementation:
199 // OutputDevice is necessary to determine HandleSize.
200 // If NULL the first signed on Win is used.
201 PointerStyle GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const;
202 SdrHitKind PickAnything(const MouseEvent& rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
203 SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
204 bool DoMouseEvent(const SdrViewEvent& rVEvt);
205 virtual SdrViewContext GetContext() const;
206
207 // The methods consider the particular context:
208 // - simple drawing
209 // - mode for editing points
210 // - mode for editing gluepoints
211 // - TextEdit
212 // - ... to be continued
213 void MarkAll();
214 void UnmarkAll();
215
216 const tools::Rectangle& GetMarkedRect() const;
217
218 virtual void DeleteMarked();
219
220 // Marking objects, traverse stations or gluepoints (depending on view-
221 // context) by enveloping the selection frame.
222 // bAddMark=TRUE: add to existing selection (->Shift)
223 // bUnmark=TRUE: remove objects from selection which are inside of
224 // the enveloped frame.
225 bool BegMark(const Point& rPnt, bool bAddMark, bool bUnmark);
226
227 // The following actions are possible:
228 // - ObjectCreating
229 // - ObjectMarking
230 // - Object-specific dragging
231 // - General dragging
232 // and more...
233 OUString GetStatusText();
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:866
sdr::overlay::OverlayObjectList maObjects
Definition: svdview.hxx:132
virtual bool RequestHelp(const HelpEvent &rHEvt) override
Definition: svdmrkv.cxx:1704
Abstract DrawObject.
Definition: svdobj.hxx:260
SvtAccessibilityOptions maAccessibilityOptions
Definition: svdview.hxx:154
void EnableExtendedMouseEventDispatcher(bool bOn)
Definition: svdview.hxx:175
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll=false)
Definition: svdview.hxx:193
bool mbNoExtendedMouseDispatcher
Definition: svdview.hxx:150
bool IsMasterPagePaintCaching() const
Definition: svdview.hxx:182
bool mbMasterPagePaintCaching
Definition: svdview.hxx:152
bool IsExtendedKeyInputDispatcherEnabled() const
Definition: svdview.hxx:179
bool IsExtendedMouseEventDispatcherEnabled() const
Definition: svdview.hxx:176
void EnableExtendedKeyInputDispatcher(bool bOn)
Definition: svdview.hxx:178
virtual bool IsSdrView() const final
Definition: svdview.hxx:163
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