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 .
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:
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
52 ////////////////////////////////////////////////////////////////////////////////////////////////////
54 //************************************************************
55 // Vorausdeklarationen
56 //************************************************************
60 //************************************************************
62 //************************************************************
64 enum SdrViewContext
{SDRCONTEXT_STANDARD
,
66 SDRCONTEXT_GLUEPOINTEDIT
,
71 enum SdrEventKind
{SDREVENT_NONE
,
81 SDREVENT_MARKGLUEPOINT
,
83 SDREVENT_BEGINSOBJPOINT
,
84 SDREVENT_ENDINSOBJPOINT
,
85 SDREVENT_BEGINSGLUEPOINT
,
86 SDREVENT_BEGDRAGHELPLINE
,
88 SDREVENT_BEGCREATEOBJ
,
95 #define SDRMOUSEBUTTONDOWN 1
96 #define SDRMOUSEMOVE 2
97 #define SDRMOUSEBUTTONUP 3
99 //************************************************************
100 // Hilfsklasse SdrViewEvent
101 //************************************************************
103 struct SVX_DLLPUBLIC SdrViewEvent
107 SdrObject
* pRootObj
; // Dieses Markieren bei SdrBeginTextEdit
109 const SvxURLField
* pURLField
;
115 SdrCreateCmd eEndCreateCmd
; // auch fuer EndInsPoint
117 sal_uInt16 nMouseClicks
;
118 sal_uInt16 nMouseMode
;
119 sal_uInt16 nMouseCode
;
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;
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
);
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 // @@ @@ @@ @@@@@ @@ @@
168 // @@ @@ @@ @@ @@ @ @@
169 // @@@@@ @@ @@@@ @@@@@@@
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;
188 SvtAccessibilityOptions maAccessibilityOptions
;
192 explicit SdrView(SdrModel
* pModel1
, OutputDevice
* pOut
= 0L);
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(...))
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
250 // - ... to be continued
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:
268 // - Object-specific dragging
269 // - General dragging
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.
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 // ~~~~~~~~~~~~~~~~~~~~
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);
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);
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: */