bump product version to 4.2.0.1
[LibreOffice.git] / include / svx / svdview.hxx
blobd136870ba5daf281ddcbc88d6bd344f21ad3ceb9
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 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 ////////////////////////////////////////////////////////////////////////////////////////////////////
36 // Klassenhierarchie der View:
37 // SfxListener
38 // SdrPaintView PntV Action ModChg Attr Notify
39 // SdrSnapView SnpV Action
41 // SdrMarkView MrkV Action MrkChg ModChg Notify
43 // SdrEditView EdtV MrkChg ModChg Attr
44 // SdrPolyEditView PoEV
45 // SdrGlueEditView GlEV
46 // SdrObjEditView EdxV Action ModChg Attr Notify
48 // SdrExchangeView XcgV
49 // SdrDragView DrgV Action
51 // SdrCreateView CrtV Action
52 // SdrView View
54 ////////////////////////////////////////////////////////////////////////////////////////////////////
56 class SvxURLField;
58 enum SdrViewContext {SDRCONTEXT_STANDARD,
59 SDRCONTEXT_POINTEDIT,
60 SDRCONTEXT_GLUEPOINTEDIT,
61 SDRCONTEXT_GRAPHIC,
62 SDRCONTEXT_MEDIA,
63 SDRCONTEXT_TABLE};
65 enum SdrEventKind {SDREVENT_NONE,
66 SDREVENT_TEXTEDIT,
67 SDREVENT_MOVACTION,
68 SDREVENT_ENDACTION,
69 SDREVENT_BCKACTION,
70 SDREVENT_BRKACTION,
71 SDREVENT_ENDCREATE,
72 SDREVENT_ENDDRAG,
73 SDREVENT_MARKOBJ,
74 SDREVENT_MARKPOINT,
75 SDREVENT_MARKGLUEPOINT,
76 SDREVENT_BEGMARK,
77 SDREVENT_BEGINSOBJPOINT,
78 SDREVENT_ENDINSOBJPOINT,
79 SDREVENT_BEGINSGLUEPOINT,
80 SDREVENT_BEGDRAGHELPLINE,
81 SDREVENT_BEGDRAGOBJ,
82 SDREVENT_BEGCREATEOBJ,
83 SDREVENT_BEGMACROOBJ,
84 SDREVENT_BEGTEXTEDIT,
85 SDREVENT_ENDMARK,
86 SDREVENT_BRKMARK,
87 SDREVENT_EXECUTEURL};
89 #define SDRMOUSEBUTTONDOWN 1
90 #define SDRMOUSEMOVE 2
91 #define SDRMOUSEBUTTONUP 3
93 // helper class SdrViewEvent
94 struct SVX_DLLPUBLIC SdrViewEvent
96 SdrHdl* pHdl;
97 SdrObject* pObj;
98 SdrObject* pRootObj; // Dieses Markieren bei SdrBeginTextEdit
99 SdrPageView* pPV;
100 const SvxURLField* pURLField;
102 Point aLogicPos;
103 SdrHitKind eHit;
104 SdrEventKind eEvent;
105 SdrHdlKind eHdlKind;
106 SdrCreateCmd eEndCreateCmd; // auch fuer EndInsPoint
108 sal_uInt16 nMouseClicks;
109 sal_uInt16 nMouseMode;
110 sal_uInt16 nMouseCode;
111 sal_uInt16 nHlplIdx;
112 sal_uInt16 nGlueId;
114 unsigned bMouseDown : 1;
115 unsigned bMouseUp : 1;
116 unsigned bDoubleHdlSize : 1; // Doppelte Handlegroesse wg. TextEdit
117 unsigned bIsAction : 1; // Action ist aktiv
118 unsigned bIsTextEdit : 1; // TextEdit laeuft zur Zeit
119 unsigned bTextEditHit : 1; // offene OutlinerView getroffen
120 unsigned bAddMark : 1;
121 unsigned bUnmark : 1;
122 unsigned bPrevNextMark : 1;
123 unsigned bMarkPrev : 1;
124 unsigned bInsPointNewObj : 1;
125 unsigned bDragWithCopy : 1;
126 unsigned bCaptureMouse : 1;
127 unsigned bReleaseMouse : 1;
129 public:
130 SdrViewEvent();
131 ~SdrViewEvent();
133 // nEventKind ist SDRMOUSEBUTTONDOWN, SDRMOUSEMOVE oder SDRMOUSEBUTTONUP
134 void SetMouseEvent(const MouseEvent& rMEvt, sal_uInt16 nEventKind);
137 // helper class for all D&D overlays
138 class SVX_DLLPUBLIC SdrDropMarkerOverlay
140 // The OverlayObjects
141 ::sdr::overlay::OverlayObjectList maObjects;
143 void ImplCreateOverlays(
144 const SdrView& rView,
145 const basegfx::B2DPolyPolygon& rLinePolyPolygon);
147 public:
148 SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject);
149 SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle);
150 SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd);
151 ~SdrDropMarkerOverlay();
156 * View
158 class SVX_DLLPUBLIC SdrView: public SdrCreateView, public tools::WeakBase< SdrView >
160 friend class SdrPageView;
162 unsigned bNoExtendedMouseDispatcher : 1;
163 unsigned bNoExtendedKeyDispatcher : 1;
164 unsigned bNoExtendedCommandDispatcher : 1;
165 unsigned bTextEditOnObjectsWithoutTextIfTextTool : 1;
166 unsigned mbMasterPagePaintCaching : 1;
168 protected:
169 SvtAccessibilityOptions maAccessibilityOptions;
171 public:
172 TYPEINFO();
173 explicit SdrView(SdrModel* pModel1, OutputDevice* pOut = 0L);
174 virtual ~SdrView();
176 // Default sind alle Dispatcher aktiviert. Will die App z.B. fuer
177 // Sonderbehandlungen im MouseDispatcher eingreifen, so muss sie
178 // den erweiterten MouseDispather mit unten stehender Methode deaktivieren
179 // und selbst nachimplementieren. Beispiel fuer MouseButtonDown:
180 // SdrViewEvent aVEvt;
181 // SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt);
182 // ... hier Applikationsspezifischer Eingriff ...
183 // pSdrView->DoMouseEvent(aVEvt);
184 // SetPointer(GetPreferedPointer(...))
185 // CaptureMouse(...)
186 void EnableExtendedMouseEventDispatcher(sal_Bool bOn) { bNoExtendedMouseDispatcher = !bOn; }
187 sal_Bool IsExtendedMouseEventDispatcherEnabled() const { return bNoExtendedMouseDispatcher; }
189 void EnableExtendedKeyInputDispatcher(sal_Bool bOn) { bNoExtendedKeyDispatcher=!bOn; }
190 sal_Bool IsExtendedKeyInputDispatcherEnabled() const { return bNoExtendedKeyDispatcher; }
192 void EnableExtendedCommandEventDispatcher(sal_Bool bOn) { bNoExtendedCommandDispatcher=!bOn; }
193 sal_Bool IsExtendedCommandEventDispatcherEnabled() const { return bNoExtendedCommandDispatcher; }
195 void EnableTextEditOnObjectsWithoutTextIfTextTool(sal_Bool bOn) { bTextEditOnObjectsWithoutTextIfTextTool=bOn; }
196 sal_Bool IsEnableTextEditOnObjectsWithoutTextIfTextToolEnabled() const { return bTextEditOnObjectsWithoutTextIfTextTool; }
198 void SetMasterPagePaintCaching(sal_Bool bOn);
199 sal_Bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
201 sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
202 virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
203 virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
204 virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
205 virtual sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
207 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
209 sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll=sal_False) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
210 sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr=sal_False) { return SdrCreateView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); }
212 /* new interface src537 */
213 sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
215 SfxStyleSheet* GetStyleSheet() const;
217 // unvollstaendige Implementation:
218 // Das OutputDevice ist notwendig, damit ich die HandleSize ermitteln kann.
219 // Bei NULL wird das 1. angemeldete Win verwendet.
220 Pointer GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, sal_Bool bLeftDown=sal_False) const;
221 SdrHitKind PickAnything(const MouseEvent& rMEvt, sal_uInt16 nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
222 SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
223 sal_Bool DoMouseEvent(const SdrViewEvent& rVEvt);
224 virtual SdrViewContext GetContext() const;
226 // Die Methoden beruecksichtigen den jeweiligen Kontex:
227 // - Einfaches Zeichnen
228 // - Punktbearbeitungs-Mode
229 // - Klebepunkt-Editmode
230 // - TextEdit
231 // - ... to be continued
232 void MarkAll();
233 void UnmarkAll();
235 const Rectangle& GetMarkedRect() const;
237 virtual void DeleteMarked();
239 // Markieren von Objekten, Polygonpunkten oder Klebepunkten (je nach View-
240 // Kontext) durch Aufziehen eines Selektionsrahmens.
241 // bAddMark=TRUE: zur bestehenden Selektion hinzumarkieren (->Shift)
242 // bUnmark=TRUE: Bereits selektierte Objekte/Punkte/Klebepunkte die innerhalb
243 // des aufgezogenen Rahmens liegen werden deselektiert.
244 sal_Bool BegMark(const Point& rPnt, sal_Bool bAddMark=sal_False, sal_Bool bUnmark=sal_False);
246 // Folgende Actions sind moeglich:
247 // - ObjectCreating
248 // - ObjectMarking
249 // - Object-specific dragging
250 // - General dragging
251 // und mehr...
252 OUString GetStatusText();
254 SvtAccessibilityOptions& getAccessibilityOptions();
256 virtual void onAccessibilityOptionsChanged();
259 #endif // INCLUDED_SVX_SVDVIEW_HXX
261 ////////////////////////////////////////////////////////////////////////////////////////////////////
263 // Die App macht sich zunaechst ein SdrModel.
264 // Anschliessend oeffnet sie ein Win und erzeugt dann eine SdrView.
265 // An der SdrView meldet sie dann mit der Methode ShowSdrPage() eine Seite an.
266 // Eine SdrView kann in beliebig vielen Fenstern gleichzeitig angezeigt werden.
267 // Intern:
268 // Eine SdrView kann beliebig viele Seiten gleichzeitig anzeigen. Seiten
269 // werden an- und abgemeldet mit ShowSdrPage()/HideSdrPage(). Fuer jede angemeldete
270 // Seite wird eine SdrPageView-Instanz im Container aPages angelegt. Bei
271 // gleichzeitiger Anzeige mehrerer Seiten ist darauf zu achten, dass der Offset-
272 // Parameter von ShowSdrPage() der Seitengroesse angepasst ist, da sich sonst die
273 // Seiten ueberlappen koennten.
275 // Elementare Methoden:
276 // ~~~~~~~~~~~~~~~~~~~~
277 // Einfache Events:
278 // ~~~~~~~~~~~~~~~~
279 // sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
280 // sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
281 // sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
282 // sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
283 // sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
285 // Exchange (Clipboard derzeit noch ohne SdrPrivateData):
286 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
287 // sal_Bool Cut(sal_uIntPtr nFormat=SDR_ANYFORMAT);
288 // sal_Bool Yank(sal_uIntPtr nFormat=SDR_ANYFORMAT);
289 // sal_Bool Paste(Window* pWin=NULL, sal_uIntPtr nFormat=SDR_ANYFORMAT);
291 // SfxItems:
292 // ~~~~~~~~~
293 // sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
294 // sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
295 // SfxStyleSheet* GetStyleSheet() const;
296 // sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
298 // Sonstiges:
299 // ~~~~~~~~~~
300 // Pointer GetPreferedPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
301 // OUString GetStatusText();
303 ///////////////////////////////////////////////////////////////////////////////////////////////// */
305 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */