update credits
[LibreOffice.git] / include / svx / svdview.hxx
blobef28a17f45131a0045c382475ecca8a366f245a9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _SVDVIEW_HXX
21 #define _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>
32 ////////////////////////////////////////////////////////////////////////////////////////////////////
34 // Klassenhierarchie der View:
35 // SfxListener
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
50 // SdrView View
52 ////////////////////////////////////////////////////////////////////////////////////////////////////
54 //************************************************************
55 // Vorausdeklarationen
56 //************************************************************
58 class SvxURLField;
60 //************************************************************
61 // Defines
62 //************************************************************
64 enum SdrViewContext {SDRCONTEXT_STANDARD,
65 SDRCONTEXT_POINTEDIT,
66 SDRCONTEXT_GLUEPOINTEDIT,
67 SDRCONTEXT_GRAPHIC,
68 SDRCONTEXT_MEDIA,
69 SDRCONTEXT_TABLE};
71 enum SdrEventKind {SDREVENT_NONE,
72 SDREVENT_TEXTEDIT,
73 SDREVENT_MOVACTION,
74 SDREVENT_ENDACTION,
75 SDREVENT_BCKACTION,
76 SDREVENT_BRKACTION,
77 SDREVENT_ENDCREATE,
78 SDREVENT_ENDDRAG,
79 SDREVENT_MARKOBJ,
80 SDREVENT_MARKPOINT,
81 SDREVENT_MARKGLUEPOINT,
82 SDREVENT_BEGMARK,
83 SDREVENT_BEGINSOBJPOINT,
84 SDREVENT_ENDINSOBJPOINT,
85 SDREVENT_BEGINSGLUEPOINT,
86 SDREVENT_BEGDRAGHELPLINE,
87 SDREVENT_BEGDRAGOBJ,
88 SDREVENT_BEGCREATEOBJ,
89 SDREVENT_BEGMACROOBJ,
90 SDREVENT_BEGTEXTEDIT,
91 SDREVENT_ENDMARK,
92 SDREVENT_BRKMARK,
93 SDREVENT_EXECUTEURL};
95 #define SDRMOUSEBUTTONDOWN 1
96 #define SDRMOUSEMOVE 2
97 #define SDRMOUSEBUTTONUP 3
99 //************************************************************
100 // Hilfsklasse SdrViewEvent
101 //************************************************************
103 struct SVX_DLLPUBLIC SdrViewEvent
105 SdrHdl* pHdl;
106 SdrObject* pObj;
107 SdrObject* pRootObj; // Dieses Markieren bei SdrBeginTextEdit
108 SdrPageView* pPV;
109 const SvxURLField* pURLField;
111 Point aLogicPos;
112 SdrHitKind eHit;
113 SdrEventKind eEvent;
114 SdrHdlKind eHdlKind;
115 SdrCreateCmd eEndCreateCmd; // auch fuer EndInsPoint
117 sal_uInt16 nMouseClicks;
118 sal_uInt16 nMouseMode;
119 sal_uInt16 nMouseCode;
120 sal_uInt16 nHlplIdx;
121 sal_uInt16 nGlueId;
123 unsigned bMouseDown : 1;
124 unsigned bMouseUp : 1;
125 unsigned bDoubleHdlSize : 1; // Doppelte Handlegroesse wg. TextEdit
126 unsigned bIsAction : 1; // Action ist aktiv
127 unsigned bIsTextEdit : 1; // TextEdit laeuft zur Zeit
128 unsigned bTextEditHit : 1; // offene OutlinerView getroffen
129 unsigned bAddMark : 1;
130 unsigned bUnmark : 1;
131 unsigned bPrevNextMark : 1;
132 unsigned bMarkPrev : 1;
133 unsigned bInsPointNewObj : 1;
134 unsigned bDragWithCopy : 1;
135 unsigned bCaptureMouse : 1;
136 unsigned bReleaseMouse : 1;
138 public:
139 SdrViewEvent();
140 ~SdrViewEvent();
142 // nEventKind ist SDRMOUSEBUTTONDOWN, SDRMOUSEMOVE oder SDRMOUSEBUTTONUP
143 void SetMouseEvent(const MouseEvent& rMEvt, sal_uInt16 nEventKind);
146 ////////////////////////////////////////////////////////////////////////////////////////////////////
147 // helper class for all D&D overlays
149 class SVX_DLLPUBLIC SdrDropMarkerOverlay
151 // The OverlayObjects
152 ::sdr::overlay::OverlayObjectList maObjects;
154 void ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon);
156 public:
157 SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject);
158 SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle);
159 SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd);
160 ~SdrDropMarkerOverlay();
163 ////////////////////////////////////////////////////////////////////////////////////////////////////
164 ////////////////////////////////////////////////////////////////////////////////////////////////////
166 // @@ @@ @@ @@@@@ @@ @@
167 // @@ @@ @@ @@ @@ @@
168 // @@ @@ @@ @@ @@ @ @@
169 // @@@@@ @@ @@@@ @@@@@@@
170 // @@@ @@ @@ @@@@@@@
171 // @@@ @@ @@ @@@ @@@
172 // @ @@ @@@@@ @@ @@
174 ////////////////////////////////////////////////////////////////////////////////////////////////////
175 ////////////////////////////////////////////////////////////////////////////////////////////////////
177 class SVX_DLLPUBLIC SdrView: public SdrCreateView, public tools::WeakBase< SdrView >
179 friend class SdrPageView;
181 unsigned bNoExtendedMouseDispatcher : 1;
182 unsigned bNoExtendedKeyDispatcher : 1;
183 unsigned bNoExtendedCommandDispatcher : 1;
184 unsigned bTextEditOnObjectsWithoutTextIfTextTool : 1;
185 unsigned mbMasterPagePaintCaching : 1;
187 protected:
188 SvtAccessibilityOptions maAccessibilityOptions;
190 public:
191 TYPEINFO();
192 explicit SdrView(SdrModel* pModel1, OutputDevice* pOut = 0L);
193 virtual ~SdrView();
195 // Default sind alle Dispatcher aktiviert. Will die App z.B. fuer
196 // Sonderbehandlungen im MouseDispatcher eingreifen, so muss sie
197 // den erweiterten MouseDispather mit unten stehender Methode deaktivieren
198 // und selbst nachimplementieren. Beispiel fuer MouseButtonDown:
199 // SdrViewEvent aVEvt;
200 // SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt);
201 // ... hier Applikationsspezifischer Eingriff ...
202 // pSdrView->DoMouseEvent(aVEvt);
203 // SetPointer(GetPreferedPointer(...))
204 // CaptureMouse(...)
205 void EnableExtendedMouseEventDispatcher(sal_Bool bOn) { bNoExtendedMouseDispatcher = !bOn; }
206 sal_Bool IsExtendedMouseEventDispatcherEnabled() const { return bNoExtendedMouseDispatcher; }
208 void EnableExtendedKeyInputDispatcher(sal_Bool bOn) { bNoExtendedKeyDispatcher=!bOn; }
209 sal_Bool IsExtendedKeyInputDispatcherEnabled() const { return bNoExtendedKeyDispatcher; }
211 void EnableExtendedCommandEventDispatcher(sal_Bool bOn) { bNoExtendedCommandDispatcher=!bOn; }
212 sal_Bool IsExtendedCommandEventDispatcherEnabled() const { return bNoExtendedCommandDispatcher; }
214 void EnableTextEditOnObjectsWithoutTextIfTextTool(sal_Bool bOn) { bTextEditOnObjectsWithoutTextIfTextTool=bOn; }
215 sal_Bool IsEnableTextEditOnObjectsWithoutTextIfTextToolEnabled() const { return bTextEditOnObjectsWithoutTextIfTextTool; }
217 void SetMasterPagePaintCaching(sal_Bool bOn);
218 sal_Bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
220 sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
221 virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
222 virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
223 virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
224 virtual sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
226 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
228 sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll=sal_False) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
229 sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr=sal_False) { return SdrCreateView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); }
231 /* new interface src537 */
232 sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
234 SfxStyleSheet* GetStyleSheet() const;
236 // unvollstaendige Implementation:
237 // Das OutputDevice ist notwendig, damit ich die HandleSize ermitteln kann.
238 // Bei NULL wird das 1. angemeldete Win verwendet.
239 Pointer GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, sal_Bool bLeftDown=sal_False) const;
240 SdrHitKind PickAnything(const MouseEvent& rMEvt, sal_uInt16 nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
241 SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
242 sal_Bool DoMouseEvent(const SdrViewEvent& rVEvt);
243 virtual SdrViewContext GetContext() const;
245 // Die Methoden beruecksichtigen den jeweiligen Kontex:
246 // - Einfaches Zeichnen
247 // - Punktbearbeitungs-Mode
248 // - Klebepunkt-Editmode
249 // - TextEdit
250 // - ... to be continued
251 void MarkAll();
252 void UnmarkAll();
254 const Rectangle& GetMarkedRect() const;
256 virtual void DeleteMarked();
258 // Markieren von Objekten, Polygonpunkten oder Klebepunkten (je nach View-
259 // Kontext) durch Aufziehen eines Selektionsrahmens.
260 // bAddMark=TRUE: zur bestehenden Selektion hinzumarkieren (->Shift)
261 // bUnmark=TRUE: Bereits selektierte Objekte/Punkte/Klebepunkte die innerhalb
262 // des aufgezogenen Rahmens liegen werden deselektiert.
263 sal_Bool BegMark(const Point& rPnt, sal_Bool bAddMark=sal_False, sal_Bool bUnmark=sal_False);
265 // Folgende Actions sind moeglich:
266 // - ObjectCreating
267 // - ObjectMarking
268 // - Object-specific dragging
269 // - General dragging
270 // und mehr...
271 String GetStatusText();
273 SvtAccessibilityOptions& getAccessibilityOptions();
275 virtual void onAccessibilityOptionsChanged();
278 #endif //_SVDVIEW_HXX
280 ////////////////////////////////////////////////////////////////////////////////////////////////////
282 // Die App macht sich zunaechst ein SdrModel.
283 // Anschliessend oeffnet sie ein Win und erzeugt dann eine SdrView.
284 // An der SdrView meldet sie dann mit der Methode ShowSdrPage() eine Seite an.
285 // Eine SdrView kann in beliebig vielen Fenstern gleichzeitig angezeigt werden.
286 // Intern:
287 // Eine SdrView kann beliebig viele Seiten gleichzeitig anzeigen. Seiten
288 // werden an- und abgemeldet mit ShowSdrPage()/HideSdrPage(). Fuer jede angemeldete
289 // Seite wird eine SdrPageView-Instanz im Container aPages angelegt. Bei
290 // gleichzeitiger Anzeige mehrerer Seiten ist darauf zu achten, dass der Offset-
291 // Parameter von ShowSdrPage() der Seitengroesse angepasst ist, da sich sonst die
292 // Seiten ueberlappen koennten.
294 // Elementare Methoden:
295 // ~~~~~~~~~~~~~~~~~~~~
296 // Einfache Events:
297 // ~~~~~~~~~~~~~~~~
298 // sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
299 // sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
300 // sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
301 // sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
302 // sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
304 // Exchange (Clipboard derzeit noch ohne SdrPrivateData):
305 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
306 // sal_Bool Cut(sal_uIntPtr nFormat=SDR_ANYFORMAT);
307 // sal_Bool Yank(sal_uIntPtr nFormat=SDR_ANYFORMAT);
308 // sal_Bool Paste(Window* pWin=NULL, sal_uIntPtr nFormat=SDR_ANYFORMAT);
310 // SfxItems:
311 // ~~~~~~~~~
312 // sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
313 // sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
314 // SfxStyleSheet* GetStyleSheet() const;
315 // sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
317 // Sonstiges:
318 // ~~~~~~~~~~
319 // Pointer GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
320 // String GetStatusText();
322 ///////////////////////////////////////////////////////////////////////////////////////////////// */
324 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */