1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDVIEW_HXX
21 #define INCLUDED_SVX_SVDVIEW_HXX
23 // HACK to avoid too deep includes and to have some
24 // levels free in svdmark itself (MS compiler include depth limit)
25 #include <svx/svdhdl.hxx>
26 #include <tools/weakbase.h>
27 #include <svtools/accessibilityoptions.hxx>
28 #include <svx/svxdllapi.h>
29 #include <svx/svdcrtv.hxx>
30 #include <vcl/event.hxx>
31 #include <unotools/options.hxx>
32 #include <basegfx/polygon/b2dpolypolygon.hxx>
34 // class hierarchy of View:
36 // SdrPaintView PntV Action ModChg Attr Notify
37 // SdrSnapView SnpV Action
39 // SdrMarkView MrkV Action MrkChg ModChg Notify
41 // SdrEditView EdtV MrkChg ModChg Attr
42 // SdrPolyEditView PoEV
43 // SdrGlueEditView GlEV
44 // SdrObjEditView EdxV Action ModChg Attr Notify
46 // SdrExchangeView XcgV
47 // SdrDragView DrgV Action
49 // SdrCreateView CrtV Action
53 namespace sdr
{ namespace contact
{ class ObjectContact
; }}
55 enum class SdrViewContext
{
64 enum class SdrEventKind
{
89 /* for PickAnything() */
90 enum class SdrMouseEventKind
97 // helper class SdrViewEvent
98 struct SVX_DLLPUBLIC SdrViewEvent
102 SdrObject
* pRootObj
; // mark this when SdrBeginTextEdit is executed
104 const SvxURLField
* pURLField
;
110 sal_uInt16 nMouseClicks
;
111 MouseEventModifiers nMouseMode
;
112 sal_uInt16 nMouseCode
;
118 bool bIsAction
: 1; // Action is active
119 bool bIsTextEdit
: 1; // TextEdit runs currently
122 bool bPrevNextMark
: 1;
130 // helper class for all D&D overlays
131 class SVX_DLLPUBLIC SdrDropMarkerOverlay
133 // The OverlayObjects
134 sdr::overlay::OverlayObjectList maObjects
;
136 void ImplCreateOverlays(
137 const SdrView
& rView
,
138 const basegfx::B2DPolyPolygon
& rLinePolyPolygon
);
141 SdrDropMarkerOverlay(const SdrView
& rView
, const SdrObject
& rObject
);
142 SdrDropMarkerOverlay(const SdrView
& rView
, const tools::Rectangle
& rRectangle
);
143 SdrDropMarkerOverlay(const SdrView
& rView
, const Point
& rStart
, const Point
& rEnd
);
144 ~SdrDropMarkerOverlay();
148 class SVX_DLLPUBLIC SdrView
: public SdrCreateView
, public tools::WeakBase
150 friend class SdrPageView
;
152 bool bNoExtendedMouseDispatcher
: 1;
153 bool bNoExtendedKeyDispatcher
: 1;
154 bool mbMasterPagePaintCaching
: 1;
156 SvtAccessibilityOptions maAccessibilityOptions
;
161 OutputDevice
* pOut
= nullptr);
163 virtual ~SdrView() override
;
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(...))
175 void EnableExtendedMouseEventDispatcher(bool bOn
) { bNoExtendedMouseDispatcher
= !bOn
; }
176 bool IsExtendedMouseEventDispatcherEnabled() const { return bNoExtendedMouseDispatcher
; }
178 void EnableExtendedKeyInputDispatcher(bool bOn
) { bNoExtendedKeyDispatcher
=!bOn
; }
179 bool IsExtendedKeyInputDispatcherEnabled() const { return bNoExtendedKeyDispatcher
; }
181 void SetMasterPagePaintCaching(bool bOn
);
182 bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching
; }
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
;
188 using SdrCreateView::RequestHelp
;
189 virtual bool Command(const CommandEvent
& rCEvt
, vcl::Window
* pWin
) override
;
191 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster
*, ConfigurationHints
) override
;
193 bool SetAttributes(const SfxItemSet
& rSet
, bool bReplaceAll
=false) { return SdrCreateView::SetAttributes(rSet
,bReplaceAll
); }
195 /* new interface src537 */
196 void GetAttributes(SfxItemSet
& rTargetSet
, bool bOnlyHardAttr
=false) const;
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;
207 // The methods consider the particular context:
209 // - mode for editing points
210 // - mode for editing glue points
212 // - ... to be continued
216 const tools::Rectangle
& GetMarkedRect() const;
218 virtual void DeleteMarked();
220 // Marking objects, traverse stations or glue points (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
);
227 // The following actions are possible:
230 // - Object-specific dragging
231 // - General dragging
233 OUString
GetStatusText();
235 SvtAccessibilityOptions
& getAccessibilityOptions() { return maAccessibilityOptions
;}
237 virtual void onAccessibilityOptionsChanged();
239 // Do not create ObjectContact locally, but offer a call to allow override
240 // and to create own derivations of ObjectContact
241 virtual sdr::contact::ObjectContact
* createViewSpecificObjectContact(
242 SdrPageWindow
& rPageWindow
,
243 const sal_Char
* pDebugName
) const;
246 // First of all the app creates a SdrModel.
247 // Then it opens a Win and creates a SdrView.
248 // ShowSdrPage() announces a page at SdrView.
249 // It's possible to show SdrView in any Wins at once.
251 // SdrView can show as many Wins as it wants at once. Pages are announced
252 // or checked out with the help of ShowSdrPage()/HideSdrPage(). For every announced
253 // page there is a SdrPageView instance in container aPages. If more than one page
254 // is showed, you have to pay attention that the offset parameter of ShowSdrPage()
255 // is conformed to the size of the page (to prevent overlapping of two pages).
257 // elementary methods:
258 // ~~~~~~~~~~~~~~~~~~~~
261 // bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
262 // bool MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin);
263 // bool MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin);
264 // bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin);
265 // bool Command(const CommandEvent& rCEvt, vcl::Window* pWin);
269 // sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
270 // sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
271 // SfxStyleSheet* GetStyleSheet() const;
272 // sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
276 // Pointer GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
277 // OUString GetStatusText();
279 #endif // INCLUDED_SVX_SVDVIEW_HXX
281 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */