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.hxx>
27 #include <svtools/accessibilityoptions.hxx>
28 #include <svx/svxdllapi.h>
29 #include <svx/svdcrtv.hxx>
30 #include <unotools/options.hxx>
31 #include <basegfx/polygon/b2dpolypolygon.hxx>
32 #include <basegfx/polygon/b2dpolygon.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
54 enum class SdrViewContext
{
63 enum class SdrEventKind
{
88 /* for PickAnything() */
89 enum class SdrMouseEventKind
96 // helper class SdrViewEvent
97 struct SVX_DLLPUBLIC SdrViewEvent
101 SdrObject
* pRootObj
; // mark this when SdrBeginTextEdit is executed
103 const SvxURLField
* pURLField
;
108 SdrCreateCmd eEndCreateCmd
; // for EndInsPoint too
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
120 bool bTextEditHit
: 1; // hit open OutlinerView?
123 bool bPrevNextMark
: 1;
125 bool bInsPointNewObj
: 1;
126 bool bDragWithCopy
: 1;
127 bool bCaptureMouse
: 1;
128 bool bReleaseMouse
: 1;
135 // helper class for all D&D overlays
136 class SVX_DLLPUBLIC SdrDropMarkerOverlay
138 // The OverlayObjects
139 sdr::overlay::OverlayObjectList maObjects
;
141 void ImplCreateOverlays(
142 const SdrView
& rView
,
143 const basegfx::B2DPolyPolygon
& rLinePolyPolygon
);
146 SdrDropMarkerOverlay(const SdrView
& rView
, const SdrObject
& rObject
);
147 SdrDropMarkerOverlay(const SdrView
& rView
, const tools::Rectangle
& rRectangle
);
148 SdrDropMarkerOverlay(const SdrView
& rView
, const Point
& rStart
, const Point
& rEnd
);
149 ~SdrDropMarkerOverlay();
156 class SVX_DLLPUBLIC SdrView
: public SdrCreateView
, public tools::WeakBase
< SdrView
>
158 friend class SdrPageView
;
160 bool bNoExtendedMouseDispatcher
: 1;
161 bool bNoExtendedKeyDispatcher
: 1;
162 bool bNoExtendedCommandDispatcher
: 1;
163 bool bTextEditOnObjectsWithoutTextIfTextTool
: 1;
164 bool mbMasterPagePaintCaching
: 1;
167 SvtAccessibilityOptions maAccessibilityOptions
;
170 explicit SdrView(SdrModel
* pModel1
, OutputDevice
* pOut
= nullptr);
171 virtual ~SdrView() override
;
173 // The default value for all dispatchers is activated. If the app for example
174 // wants to intervene in MouseDispatcher for special treatment, you have to
175 // deactivate the MouseDispatcher with the help of the method below and you have
176 // to implement it yourself. Example for MouseButtonDown:
177 // SdrViewEvent aVEvt;
178 // SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SdrMouseEventKind::BUTTONDOWN,aVEvt);
179 // ... hier Applikationsspezifischer Eingriff ...
180 // pSdrView->DoMouseEvent(aVEvt);
181 // SetPointer(GetPreferredPointer(...))
183 void EnableExtendedMouseEventDispatcher(bool bOn
) { bNoExtendedMouseDispatcher
= !bOn
; }
184 bool IsExtendedMouseEventDispatcherEnabled() const { return bNoExtendedMouseDispatcher
; }
186 void EnableExtendedKeyInputDispatcher(bool bOn
) { bNoExtendedKeyDispatcher
=!bOn
; }
187 bool IsExtendedKeyInputDispatcherEnabled() const { return bNoExtendedKeyDispatcher
; }
189 void EnableExtendedCommandEventDispatcher(bool bOn
) { bNoExtendedCommandDispatcher
=!bOn
; }
191 void EnableTextEditOnObjectsWithoutTextIfTextTool(bool bOn
) { bTextEditOnObjectsWithoutTextIfTextTool
=bOn
; }
193 void SetMasterPagePaintCaching(bool bOn
);
194 bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching
; }
196 bool KeyInput(const KeyEvent
& rKEvt
, vcl::Window
* pWin
) override
;
197 virtual bool MouseButtonDown(const MouseEvent
& rMEvt
, vcl::Window
* pWin
) override
;
198 virtual bool MouseButtonUp(const MouseEvent
& rMEvt
, vcl::Window
* pWin
) override
;
199 virtual bool MouseMove(const MouseEvent
& rMEvt
, vcl::Window
* pWin
) override
;
200 virtual bool Command(const CommandEvent
& rCEvt
, vcl::Window
* pWin
) override
;
202 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster
*, ConfigurationHints
) override
;
204 bool SetAttributes(const SfxItemSet
& rSet
, bool bReplaceAll
=false) { return SdrCreateView::SetAttributes(rSet
,bReplaceAll
); }
205 bool SetStyleSheet(SfxStyleSheet
* pStyleSheet
, bool bDontRemoveHardAttr
) { return SdrCreateView::SetStyleSheet(pStyleSheet
,bDontRemoveHardAttr
); }
207 /* new interface src537 */
208 bool GetAttributes(SfxItemSet
& rTargetSet
, bool bOnlyHardAttr
=false) const;
210 SfxStyleSheet
* GetStyleSheet() const;
212 // incomplete implementation:
213 // OutputDevice is necessary to determine HandleSize.
214 // If NULL the first signed on Win is used.
215 Pointer
GetPreferredPointer(const Point
& rMousePos
, const OutputDevice
* pOut
, sal_uInt16 nModifier
=0, bool bLeftDown
=false) const;
216 SdrHitKind
PickAnything(const MouseEvent
& rMEvt
, SdrMouseEventKind nMouseDownOrMoveOrUp
, SdrViewEvent
& rVEvt
) const;
217 SdrHitKind
PickAnything(const Point
& rLogicPos
, SdrViewEvent
& rVEvt
) const;
218 bool DoMouseEvent(const SdrViewEvent
& rVEvt
);
219 virtual SdrViewContext
GetContext() const;
221 // The methods consider the particular context:
223 // - mode for editing points
224 // - mode for editing glue points
226 // - ... to be continued
230 const tools::Rectangle
& GetMarkedRect() const;
232 virtual void DeleteMarked();
234 // Marking objects, traverse stations or glue points (depending on view-
235 // context) by enveloping the selection frame.
236 // bAddMark=TRUE: add to existing selection (->Shift)
237 // bUnmark=TRUE: remove objects from selection which are inside of
238 // the enveloped frame.
239 bool BegMark(const Point
& rPnt
, bool bAddMark
, bool bUnmark
);
241 // The following actions are possible:
244 // - Object-specific dragging
245 // - General dragging
247 OUString
GetStatusText();
249 SvtAccessibilityOptions
& getAccessibilityOptions() { return maAccessibilityOptions
;}
251 virtual void onAccessibilityOptionsChanged();
254 #endif // INCLUDED_SVX_SVDVIEW_HXX
256 // First of all the app creates a SdrModel.
257 // Then it opens a Win and creates a SdrView.
258 // ShowSdrPage() announces a page at SdrView.
259 // It's possible to show SdrView in any Wins at once.
261 // SdrView can show as many Wins as it wants at once. Pages are announced
262 // or checked out with the help of ShowSdrPage()/HideSdrPage(). For every announced
263 // page there is a SdrPageView instance in container aPages. If more than one page
264 // is showed, you have to pay attention that the offset parameter of ShowSdrPage()
265 // is conformed to the size of the page (to prevent overlapping of two pages).
267 // elementary methods:
268 // ~~~~~~~~~~~~~~~~~~~~
271 // bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
272 // bool MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin);
273 // bool MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin);
274 // bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin);
275 // bool Command(const CommandEvent& rCEvt, vcl::Window* pWin);
277 // Exchange (Clipboard currently without SdrPrivateData):
278 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
279 // sal_Bool Cut(sal_uIntPtr nFormat=SDR_ANYFORMAT);
280 // sal_Bool Yank(sal_uIntPtr nFormat=SDR_ANYFORMAT);
281 // sal_Bool Paste(vcl::Window* pWin=NULL, sal_uIntPtr nFormat=SDR_ANYFORMAT);
285 // sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
286 // sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
287 // SfxStyleSheet* GetStyleSheet() const;
288 // sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
292 // Pointer GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
293 // OUString GetStatusText();
295 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */