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_SVDMRKV_HXX
21 #define INCLUDED_SVX_SVDMRKV_HXX
23 #include <svx/svdmark.hxx>
24 #include <svx/svdhdl.hxx>
25 #include <svx/svdsnpv.hxx>
26 #include <svx/svdtypes.hxx>
27 #include <svx/svxdllapi.h>
30 // The following is not yet implemented, or just particially:
31 #define SDRSEARCH_DEEP 0x0001 /* recursive into group objects */
32 #define SDRSEARCH_ALSOONMASTER 0x0002 /* MasterPages are also scanned */
33 #define SDRSEARCH_WHOLEPAGE 0x0004 /* Not just the ObjList of PageView */
34 #define SDRSEARCH_TESTMARKABLE 0x0008 /* just markable Objekte/Punkte/Handles/... */
35 #define SDRSEARCH_TESTMACRO 0x0010 /* Just objects with macro */
36 #define SDRSEARCH_TESTTEXTEDIT 0x0020 /* Just TextEdit-enabed objects */
37 #define SDRSEARCH_WITHTEXT 0x0040 /* Just objects with text */
38 #define SDRSEARCH_TESTTEXTAREA 0x0080 /* The textarea of objects with text (TextEditHit) */
39 #define SDRSEARCH_BACKWARD 0x0100 /* Backwards search */
40 #define SDRSEARCH_NEXT 0x0200 /* Search starts behind the transfered object/point/... */
41 #define SDRSEARCH_MARKED 0x0400 /* Just marked objects/points/... */
42 #define SDRSEARCH_PASS2BOUND 0x0800 /* In case of empty search results, then 2nd. try with BoundRectHit */
43 #define SDRSEARCH_PASS3NEAREST 0x1000 /* In case of empty search results, then new 3rd. Try with NearestBoundRectHit */
44 #define SDRSEARCH_BEFOREMARK 0x2000 /* if one marked one found, ignore all behind that */
46 #define SDRSEARCH_PICKMARKABLE (SDRSEARCH_TESTMARKABLE)
47 #define SDRSEARCH_PICKTEXTEDIT (SDRSEARCH_DEEP|SDRSEARCH_TESTMARKABLE|SDRSEARCH_TESTTEXTEDIT)
48 #define SDRSEARCH_PICKMACRO (SDRSEARCH_DEEP|SDRSEARCH_ALSOONMASTER|SDRSEARCH_WHOLEPAGE|SDRSEARCH_TESTMACRO)
50 // SDRSEARCHPASS_... is return parameter value at PickObj().
51 #define SDRSEARCHPASS_DIRECT 0x0000 /* Object is hit by 'direct hit' */
52 #define SDRSEARCHPASS_INACTIVELIST 0x0001 /* Obj is on the page, but not in the AktGroup (at WHOLEPAGE) */
53 #define SDRSEARCHPASS_MASTERPAGE 0x0002 /* Object was found on the MasterPage */
54 #define SDRSEARCHPASS_BOUND 0x0010 /* Object found, butjust after Bound-Check gefunden */
55 #define SDRSEARCHPASS_NEAREST 0x0020 /* Object found, but just after Nearest-Check */
57 enum SdrHitKind
{SDRHIT_NONE
, // No hit
59 SDRHIT_BOUNDRECT
, // Hit at BoundRect
60 SDRHIT_BOUNDTL
, // Hit at BoundRect TopLeft
61 SDRHIT_BOUNDTC
, // Hit at BoundRect TopCenter
62 SDRHIT_BOUNDTR
, // Hit at BoundRect TopRight
63 SDRHIT_BOUNDCL
, // Hit at BoundRect CenterLeft
64 SDRHIT_BOUNDCR
, // Hit at BoundRect CenterRight
65 SDRHIT_BOUNDBL
, // Hit at BoundRect BottomLeft
66 SDRHIT_BOUNDBC
, // Hit at BoundRect BottomCenter
67 SDRHIT_BOUNDBR
,/*,*/ // Hit at BoundRect BottomRight
68 /*SDRHIT_REFPOINT*/ // Reference point (Rotation axis, axis of reflextion) hit
69 SDRHIT_HANDLE
, // Marking handle
70 SDRHIT_HELPLINE
, // Reference line
71 SDRHIT_GLUEPOINT
, // Glue point
72 SDRHIT_TEXTEDIT
, // Open OutlinerView was hit
73 SDRHIT_TEXTEDITOBJ
, // Object for SdrBeginTextEdit (Textbereich)
74 SDRHIT_URLFIELD
, // Field im TextObj was hit (while it is currently not edited)
75 SDRHIT_MACRO
, // Object for BegMacroObj
76 SDRHIT_MARKEDOBJECT
, // Marked object (e.g. for dragging)
77 SDRHIT_UNMARKEDOBJECT
, // non-marked Object (e.g. for marking)
78 SDRHIT_CELL
}; // hit on a cell inside a table shape (outside of the cells text area)
80 enum SdrViewEditMode
{SDREDITMODE_EDIT
, // Also known as arrow or pointer mode
81 SDREDITMODE_CREATE
, // Tool for object creation
82 SDREDITMODE_GLUEPOINTEDIT
}; // Glue point editing mode
84 #define IMPSDR_MARKOBJDESCRIPTION 0x0000
85 #define IMPSDR_POINTSDESCRIPTION 0x0001
86 #define IMPSDR_GLUEPOINTSDESCRIPTION 0x0002
89 class ImplMarkingOverlay
;
91 class SVX_DLLPUBLIC SdrMarkView
: public SdrSnapView
93 friend class SdrPageView
;
95 // #114409#-3 Migrate selections
96 ImplMarkingOverlay
* mpMarkObjOverlay
;
97 ImplMarkingOverlay
* mpMarkPointsOverlay
;
98 ImplMarkingOverlay
* mpMarkGluePointsOverlay
;
101 SdrObject
* pMarkedObj
; // If not just one object ( i.e. More than one object ) is marked.
102 SdrPageView
* pMarkedPV
; // If all marked obects are situated on the same PageView.
104 Point aRef1
; // Persistent - Rotation center / axis of reflection
105 Point aRef2
; // Persistent
106 Point aLastCrookCenter
; // Persistent
108 sdr::ViewSelection
* mpSdrViewSelection
;
110 Rectangle aMarkedObjRect
;
111 Rectangle aMarkedObjRectNoOffset
;
112 Rectangle aMarkedPointsRect
;
113 Rectangle aMarkedGluePointsRect
;
115 sal_uInt16 nFrameHandlesLimit
;
116 sal_uIntPtr mnInsPointNum
; // Number of the InsPoint
117 sal_uIntPtr nMarkableObjCount
;
119 SdrDragMode eDragMode
; // Persistent
120 SdrViewEditMode eEditMode
; // Persistent
121 SdrViewEditMode eEditMode0
; // Persistent
123 //HMHunsigned bHdlShown : 1;
124 unsigned bRefHdlShownOnly
: 1; // Axis of reflextion during dragging (ni)
125 unsigned bDesignMode
: 1; // DesignMode for SdrUnoObj
126 unsigned bForceFrameHandles
: 1; // Persistent - FrameDrag auch bei Einzelobjekten
127 unsigned bPlusHdlAlways
: 1; // Persistent
128 unsigned bMarkHdlWhenTextEdit
: 1; // Persistent, default=FALSE
129 unsigned bInsPolyPoint
: 1; // at this time InsPolyPointDragging
130 unsigned bMarkedObjRectDirty
: 1;
131 unsigned bMrkPntDirty
: 1;
132 unsigned bMarkedPointsRectsDirty
: 1;
133 unsigned bMarkableObjCountDirty
: 1;
135 // flag to completely disable handles at the view
136 unsigned mbMarkHandlesHidden
: 1;
139 SVX_DLLPRIVATE
void ImpClearVars();
140 SVX_DLLPRIVATE
void ImpSetPointsRects() const;
141 void UndirtyMrkPnt() const;
144 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
145 virtual void ModelHasChanged(); // Is called by the PaintView
146 virtual void SetMarkHandles(); // aHdl - fill (List of handles)
147 virtual void SetMarkRects(); // Rects at the PageViews
148 virtual void CheckMarked(); // Scan MarkList after Del and Lock Layer ...
149 virtual void AddDragModeHdl(SdrDragMode eMode
);
150 virtual sal_Bool
MouseMove(const MouseEvent
& rMEvt
, Window
* pWin
);
152 // add custom handles (used by other apps, e.g. AnchorPos)
153 virtual void AddCustomHdl();
155 void ForceRefToMarked();
156 void ForceUndirtyMrkPnt() const { if (bMrkPntDirty
) UndirtyMrkPnt(); }
158 //HMHvoid ImpShowMarkHdl(bool bNoRefHdl);
159 virtual SdrObject
* CheckSingleSdrObjectHit(const Point
& rPnt
, sal_uInt16 nTol
, SdrObject
* pObj
, SdrPageView
* pPV
, sal_uIntPtr nOptions
, const SetOfByte
* pMVisLay
) const;
160 virtual SdrObject
* CheckSingleSdrObjectHit(const Point
& rPnt
, sal_uInt16 nTol
, SdrObjList
* pOL
, SdrPageView
* pPV
, sal_uIntPtr nOptions
, const SetOfByte
* pMVisLay
, SdrObject
*& rpRootObj
) const;
161 virtual SdrObject
* CheckSingleSdrObjectHit(const Point
& rPnt
, sal_uInt16 nTol
, SdrObjList
* pOL
, SdrPageView
* pPV
, sal_uIntPtr nOptions
, const SetOfByte
* pMVisLay
, SdrObject
*& rpRootObj
,const SdrMarkList
* pMarkList
) const;
162 sal_Bool
ImpIsFrameHandles() const;
163 void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID
, OUString
& rStr
, sal_uInt16 nVal
=0, sal_uInt16 nOpt
=0) const;
165 // Generates a string including degrees symbol, from an angel specification in 1/100deg
166 sal_Bool
ImpMarkPoint(SdrHdl
* pHdl
, SdrMark
* pMark
, sal_Bool bUnmark
);
167 virtual sal_Bool
MarkPoints(const Rectangle
* pRect
, sal_Bool bUnmark
);
168 sal_Bool
MarkGluePoints(const Rectangle
* pRect
, sal_Bool bUnmark
);
170 void SetMoveOutside(sal_Bool bOn
);
173 // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
174 SdrMarkView(SdrModel
* pModel1
, OutputDevice
* pOut
= 0L);
175 virtual ~SdrMarkView();
178 virtual sal_Bool
IsAction() const;
179 virtual void MovAction(const Point
& rPnt
);
180 virtual void EndAction();
181 virtual void BckAction();
182 virtual void BrkAction();
183 virtual void TakeActionRect(Rectangle
& rRect
) const;
185 virtual void ClearPageView();
186 virtual void HideSdrPage();
187 virtual sal_Bool
IsObjMarkable(SdrObject
* pObj
, SdrPageView
* pPV
) const;
189 // Returns sal_True if objects, points or glue points are selected by drawing a frame
190 // (as long as the frame is drawn).
191 sal_Bool
IsMarking() const { return IsMarkObj() || IsMarkPoints() || IsMarkGluePoints(); }
193 // Marking objects by drawing of a selection frame
194 sal_Bool
BegMarkObj(const Point
& rPnt
, sal_Bool bUnmark
= sal_False
);
195 void MovMarkObj(const Point
& rPnt
);
196 sal_Bool
EndMarkObj();
198 sal_Bool
IsMarkObj() const { return (0L != mpMarkObjOverlay
); }
200 // DragModes: SDRDRAG_CREATE,SDRDRAG_MOVE,SDRDRAG_RESIZE,SDRDRAG_ROTATE,SDRDRAG_MIRROR,SDRDRAG_SHEAR,SDRDRAG_CROOK
202 // The interface might maybe be changed in the future because of Ortho-Drag
203 void SetDragMode(SdrDragMode eMode
);
204 SdrDragMode
GetDragMode() const { return eDragMode
; }
205 sal_Bool
ChkDragMode(SdrDragMode eMode
) const;
206 void SetFrameHandles(sal_Bool bOn
);
207 sal_Bool
IsFrameHandles() const { return bForceFrameHandles
; }
209 // Limit. Exceeding the limit causes an implicite switch to FrameHandles. default=50.
210 void SetFrameHandlesLimit(sal_uInt16 nAnz
) { nFrameHandlesLimit
=nAnz
; }
211 sal_uInt16
GetFrameHandlesLimit() const { return nFrameHandlesLimit
; }
213 void SetEditMode(SdrViewEditMode eMode
);
214 SdrViewEditMode
GetEditMode() const { return eEditMode
; }
216 void SetEditMode(sal_Bool bOn
=sal_True
) { SetEditMode(bOn
?SDREDITMODE_EDIT
:SDREDITMODE_CREATE
); }
217 sal_Bool
IsEditMode() const { return eEditMode
==SDREDITMODE_EDIT
; }
218 void SetCreateMode(sal_Bool bOn
=sal_True
) { SetEditMode(bOn
?SDREDITMODE_CREATE
:SDREDITMODE_EDIT
); }
219 sal_Bool
IsCreateMode() const { return eEditMode
==SDREDITMODE_CREATE
; }
220 void SetGluePointEditMode(sal_Bool bOn
=sal_True
) { SetEditMode(bOn
?SDREDITMODE_GLUEPOINTEDIT
:eEditMode0
); }
221 sal_Bool
IsGluePointEditMode() const { return eEditMode
==SDREDITMODE_GLUEPOINTEDIT
; }
223 void SetDesignMode(sal_Bool bOn
=sal_True
);
224 sal_Bool
IsDesignMode() const { return bDesignMode
; }
226 void SetFrameDragSingles(sal_Bool bOn
=sal_True
) { SetFrameHandles(bOn
); }
227 sal_Bool
IsFrameDragSingles() const { return IsFrameHandles(); }
229 ////////////////////////////////////////////////////////////////////////////////////////////////////
230 // migrate selections
233 // all available changing methods
234 SdrMarkList
& GetMarkedObjectListWriteAccess() { return mpSdrViewSelection
->GetMarkedObjectListWriteAccess(); }
235 void SetEdgesOfMarkedNodesDirty() { mpSdrViewSelection
->SetEdgesOfMarkedNodesDirty(); }
238 // all available const methods for read access to selection
239 const SdrMarkList
& GetMarkedObjectList() const { return mpSdrViewSelection
->GetMarkedObjectList(); }
240 sal_uIntPtr
TryToFindMarkedObject(const SdrObject
* pObj
) const { return GetMarkedObjectList().FindObject(pObj
); }
241 SdrPageView
* GetSdrPageViewOfMarkedByIndex(sal_uIntPtr nNum
) const { return GetMarkedObjectList().GetMark(nNum
)->GetPageView(); }
242 SdrMark
* GetSdrMarkByIndex(sal_uIntPtr nNum
) const { return GetMarkedObjectList().GetMark(nNum
); }
243 SdrObject
* GetMarkedObjectByIndex(sal_uIntPtr nNum
) const { return (GetMarkedObjectList().GetMark(nNum
))->GetMarkedSdrObj(); }
244 sal_uIntPtr
GetMarkedObjectCount() const { return GetMarkedObjectList().GetMarkCount(); }
245 void SortMarkedObjects() const { GetMarkedObjectList().ForceSort(); }
246 sal_Bool
AreObjectsMarked() const { return (0L != GetMarkedObjectList().GetMarkCount()); }
247 OUString
GetDescriptionOfMarkedObjects() const { return GetMarkedObjectList().GetMarkDescription(); }
248 OUString
GetDescriptionOfMarkedPoints() const { return GetMarkedObjectList().GetPointMarkDescription(); }
249 OUString
GetDescriptionOfMarkedGluePoints() const { return GetMarkedObjectList().GetGluePointMarkDescription(); }
250 sal_Bool
GetBoundRectFromMarkedObjects(SdrPageView
* pPageView
, Rectangle
& rRect
) const { return GetMarkedObjectList().TakeBoundRect(pPageView
, rRect
); }
251 sal_Bool
GetSnapRectFromMarkedObjects(SdrPageView
* pPageView
, Rectangle
& rRect
) const { return GetMarkedObjectList().TakeSnapRect(pPageView
, rRect
); }
253 // Get a list of all those links which are connected to marked nodes,
254 // but which are not marked themselves.
255 const SdrMarkList
& GetEdgesOfMarkedNodes() const { return mpSdrViewSelection
->GetEdgesOfMarkedNodes(); }
256 const SdrMarkList
& GetMarkedEdgesOfMarkedNodes() const { return mpSdrViewSelection
->GetMarkedEdgesOfMarkedNodes(); }
257 const std::vector
<SdrObject
*>& GetTransitiveHullOfMarkedObjects() const { return mpSdrViewSelection
->GetAllMarkedObjects(); }
259 ////////////////////////////////////////////////////////////////////////////////////////////////////
261 // mechanism to complete disable handles at the view. Handles will be hidden and deleted
262 // when set, no new ones created, no interaction allowed. Handles will be recreated and shown
263 // when reset. Default is false.
264 void hideMarkHandles();
265 void showMarkHandles();
266 bool areMarkHandlesHidden() const { return mbMarkHandlesHidden
; }
268 sal_Bool
IsMarkedHit(const Point
& rPnt
, short nTol
=-2) const { return IsMarkedObjHit(rPnt
,nTol
); }
269 sal_Bool
IsMarkedObjHit(const Point
& rPnt
, short nTol
=-2) const;
271 // Pick: Supported options for nOptions are SEARCH_NEXT, SEARCH_BACKWARD (ni)
272 SdrHdl
* PickHandle(const Point
& rPnt
, sal_uIntPtr nOptions
=0, SdrHdl
* pHdl0
=NULL
) const;
274 // Pick: Supported options for nOptions are:
275 // SDRSEARCH_DEEP SDRSEARCH_ALSOONMASTER SDRSEARCH_TESTMARKABLE SDRSEARCH_TESTTEXTEDIT
276 // SDRSEARCH_WITHTEXT SDRSEARCH_TESTTEXTAREA SDRSEARCH_BACKWARD SDRSEARCH_MARKED
277 // SDRSEARCH_WHOLEPAGE
278 virtual sal_Bool
PickObj(const Point
& rPnt
, short nTol
, SdrObject
*& rpObj
, SdrPageView
*& rpPV
, sal_uIntPtr nOptions
, SdrObject
** ppRootObj
, sal_uIntPtr
* pnMarkNum
=NULL
, sal_uInt16
* pnPassNum
=NULL
) const;
279 virtual sal_Bool
PickObj(const Point
& rPnt
, short nTol
, SdrObject
*& rpObj
, SdrPageView
*& rpPV
, sal_uIntPtr nOptions
=0) const;
280 // sal_Bool PickObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions=0) const { return PickObj(rPnt,nHitTolLog,rpObj,rpPV,nOptions); }
281 sal_Bool
MarkObj(const Point
& rPnt
, short nTol
=-2, sal_Bool bToggle
=sal_False
, sal_Bool bDeep
=sal_False
);
283 // Pick: Supported options for nOptions are SDRSEARCH_PASS2BOUND und SDRSEARCH_PASS3NEAREST
284 sal_Bool
PickMarkedObj(const Point
& rPnt
, SdrObject
*& rpObj
, SdrPageView
*& rpPV
, sal_uIntPtr
* pnMarkNum
=NULL
, sal_uIntPtr nOptions
=0) const;
286 // Selects the most upper of the marked objects (O1) and scans from there
287 // towards bottom direction, selecting the first non-marked object (O2).
288 // In case of success the marking of O1 is deleted, a marking is created at
289 // O2 and TRUE is returned. With the parameter bPrev=sal_True the scan
290 // direction is turned to the other direction.
291 sal_Bool
MarkNextObj(sal_Bool bPrev
=sal_False
);
293 // Selects the most upper of the marked objects which is hit by rPnt/nTol
294 // and scans from there to bottom direction, selecting the first non-marked
295 // object (O2). In case of success the marking of O1 is deleted, a marking
296 // is created at O2 and sal_True is returned. With the parameter
297 // bPrev=sal_True the scan direction is turned to the other direction.
298 sal_Bool
MarkNextObj(const Point
& rPnt
, short nTol
=-2, sal_Bool bPrev
=sal_False
);
300 // Mark all objects within a rectangular area
301 // Just objects are marked which are inclosed completely
302 sal_Bool
MarkObj(const Rectangle
& rRect
, sal_Bool bUnmark
=sal_False
);
303 void MarkObj(SdrObject
* pObj
, SdrPageView
* pPV
, sal_Bool bUnmark
=sal_False
, sal_Bool bImpNoSetMarkHdl
=sal_False
);
304 void MarkAllObj(SdrPageView
* pPV
=NULL
); // pPage=NULL => all displayed pages
305 void UnmarkAllObj(SdrPageView
* pPV
=NULL
); // pPage=NULL => all displayed pages
307 // This function is time-consuming intensive, as the MarkList has to be scanned.
308 sal_Bool
IsObjMarked(SdrObject
* pObj
) const;
309 // void MarkAll(SdrPageView* pPV=NULL) { MarkAllObj(pPV); } -> replace with inline
310 void UnMarkAll(SdrPageView
* pPV
=NULL
) { UnmarkAllObj(pPV
); }
312 // Request/set the size of the marking handles. Declaration in Pixel.
313 // The value is meant to be the edge length ( link length ).
314 // Pair values are round up to impair values: 3->3, 4->5, 5->5, 6->7, 7->7, ...
315 // Default value is 7, minimum value is 3 Pixels.
316 sal_uInt16
GetMarkHdlSizePixel() const;
317 void SetMarkHdlSizePixel(sal_uInt16 nSiz
);
319 virtual sal_Bool
HasMarkablePoints() const;
320 virtual sal_uIntPtr
GetMarkablePointCount() const;
321 virtual sal_Bool
HasMarkedPoints() const;
322 virtual sal_uIntPtr
GetMarkedPointCount() const;
324 // There might be points which can't be marked:
325 virtual sal_Bool
IsPointMarkable(const SdrHdl
& rHdl
) const;
326 virtual sal_Bool
MarkPoint(SdrHdl
& rHdl
, sal_Bool bUnmark
=sal_False
);
328 /** should only be used from outside svx for special ui elements */
329 sal_Bool
MarkPointHelper(SdrHdl
* pHdl
, SdrMark
* pMark
, sal_Bool bUnmark
);
331 // Mark all points within this rectangular alle Punkte (View coordinates)
332 sal_Bool
MarkPoints(const Rectangle
& rRect
, sal_Bool bUnmark
=sal_False
) { return MarkPoints(&rRect
,bUnmark
); }
333 sal_Bool
UnmarkPoint(SdrHdl
& rHdl
) { return MarkPoint(rHdl
,sal_True
); }
334 sal_Bool
UnMarkPoint(SdrHdl
& rHdl
) { return MarkPoint(rHdl
,sal_True
); }
335 sal_Bool
IsPointMarked(const SdrHdl
& rHdl
) const { ForceUndirtyMrkPnt(); return &rHdl
!=NULL
&& rHdl
.IsSelected(); }
336 sal_Bool
MarkAllPoints() { return MarkPoints(NULL
,sal_False
); }
337 sal_Bool
UnmarkAllPoints() { return MarkPoints(NULL
,sal_True
); }
338 sal_Bool
UnMarkAllPoints() { return MarkPoints(NULL
,sal_True
); }
340 // Selects the first marked point (P1) which is hit by rPnt
341 // and from there it searches the first non-marked point(P2).
342 // In case of success the marking of
343 // P1 is deleted, a mark is set at P2 and sal_True is returned.
344 // With the parameter bPrev=sal_True the scan direction is turned to the other direction.
345 sal_Bool
MarkNextPoint(const Point
& rPnt
, sal_Bool bPrev
=sal_False
);
347 // Search for the number of the suitable handle. In case of empty search result,
348 // CONTAINER_ENTRY_NOTFOUND is returned.
349 sal_uIntPtr
GetHdlNum(SdrHdl
* pHdl
) const { return aHdl
.GetHdlNum(pHdl
); }
350 SdrHdl
* GetHdl(sal_uIntPtr nHdlNum
) const { return aHdl
.GetHdl(nHdlNum
); }
351 const SdrHdlList
& GetHdlList() const { return aHdl
; }
353 // Draw a selection frame for marking of points.
354 // This routine will just be started in case that HasMarkablePoints() returns sal_True.
355 sal_Bool
BegMarkPoints(const Point
& rPnt
, sal_Bool bUnmark
= sal_False
);
356 void MovMarkPoints(const Point
& rPnt
);
357 sal_Bool
EndMarkPoints();
358 void BrkMarkPoints();
359 sal_Bool
IsMarkPoints() const { return (0L != mpMarkPointsOverlay
); }
361 // Select that additional handles are displayed permanently.
362 void SetPlusHandlesAlwaysVisible(sal_Bool bOn
);
363 sal_Bool
IsPlusHandlesAlwaysVisible() const { return bPlusHdlAlways
; }
365 // Are Handles visible during TextEdit (in double size)?
366 // Persistent, default=FALSE
367 void SetMarkHdlWhenTextEdit(sal_Bool bOn
) { bMarkHdlWhenTextEdit
=bOn
; }
368 sal_Bool
IsMarkHdlWhenTextEdit() const { return bMarkHdlWhenTextEdit
; }
370 sal_Bool
HasMarkableGluePoints() const;
371 sal_Bool
HasMarkedGluePoints() const;
373 // A gluepoint is clearly identified by the SdrObject
374 // (to which it belongs) as well as by a sal_uInt16 nId (as each SdrObject may consist of
375 // several glue points. Here at the View there is an additional
376 // SdrPageView, which should be defined correctly always.
377 // Alternatively a gluepoint may be characterized by a SdrHdl.
378 // In this case the SdrHdl instance consists of all required informations.
379 // And in this case, the glue point are always is marked by enforcment
380 // (Handlers are just situated at marked gluepoints )
381 // Attention: With each change of the glue point status the handle list is re-calculated.
382 // All previously saved SdrHdl* became invalid by this, the same with the point IDs!
383 // Pick: Supported options for nOptions are SEARCH_NEXT, SEARCH_BACKWARD
384 sal_Bool
PickGluePoint(const Point
& rPnt
, SdrObject
*& rpObj
, sal_uInt16
& rnId
, SdrPageView
*& rpPV
, sal_uIntPtr nOptions
=0) const;
385 sal_Bool
MarkGluePoint(const SdrObject
* pObj
, sal_uInt16 nId
, const SdrPageView
* pPV
, sal_Bool bUnmark
=sal_False
);
386 sal_Bool
UnmarkGluePoint(const SdrObject
* pObj
, sal_uInt16 nId
, const SdrPageView
* pPV
) { return MarkGluePoint(pObj
,nId
,pPV
,sal_True
); }
387 sal_Bool
IsGluePointMarked(const SdrObject
* pObj
, sal_uInt16 nId
) const;
389 // Get the Hdl (handle) of a marked GluePoint. Non-marked
390 // GluePoints don`t have handles
391 SdrHdl
* GetGluePointHdl(const SdrObject
* pObj
, sal_uInt16 nId
) const;
392 sal_Bool
IsGluePoint(const SdrHdl
& rHdl
) const { return &rHdl
!=NULL
&& rHdl
.GetKind()==HDL_GLUE
; }
394 // Mark all points within this rectangular (View coordinates)
395 sal_Bool
MarkGluePoints(const Rectangle
& rRect
) { return MarkGluePoints(&rRect
,sal_False
); }
396 sal_Bool
UnmarkGluePoints(const Rectangle
& rRect
) { return MarkGluePoints(&rRect
,sal_True
); }
397 sal_Bool
MarkAllGluePoints() { return MarkGluePoints(NULL
,sal_False
); }
398 sal_Bool
UnmarkAllGluePoints() { return MarkGluePoints(NULL
,sal_True
); }
400 // Selects the first marked point (P1) which is hit by rPnt
401 // and from there it searches the first non-marked point(P2).
402 // In case of success the marking of
403 // P1 is deleted, a mark is set at P2 and sal_True is returned.
404 // With the parameter bPrev=sal_True the scan direction is turned to the other direction.
405 sal_Bool
MarkNextGluePoint(const Point
& rPnt
, sal_Bool bPrev
=sal_False
);
407 // Draw a selection frame for glue point marking.
408 // This routine will just be started in case that HasMarkablePoints() returns sal_True.
409 // The GlueEditMode sal_True is disregarded.
410 // sal_Bool BegMarkGluePoints(const Point& rPnt, OutputDevice* pOut);
411 sal_Bool
BegMarkGluePoints(const Point
& rPnt
, sal_Bool bUnmark
= sal_False
);
412 void MovMarkGluePoints(const Point
& rPnt
);
413 sal_Bool
EndMarkGluePoints();
414 void BrkMarkGluePoints();
415 sal_Bool
IsMarkGluePoints() const { return (0L != mpMarkGluePointsOverlay
); }
417 // bRestraintPaint=sal_False causes the handles not to be drawn immediately.
418 // AdjustMarkHdl is just called in case of changes; usually this causes an Invalidate
419 // At the end of a redraw the handles are drawn automatically.
420 // The purpose is to avoid unnecessary flickering. -> This does not yet work, that's why sal_True!
421 void AdjustMarkHdl(); //HMHBOOL bRestraintPaint=sal_True);
423 const Rectangle
& GetMarkedObjRect() const; // SnapRects of Objects, without line width
424 Rectangle
GetMarkedObjBoundRect() const; // incl. line width, overlapping rags, ...
425 const Rectangle
& GetMarkedPointsRect() const; // Enclosing rectangle of all marked points
426 const Rectangle
& GetMarkedGluePointsRect() const; // Enclosing rectangle of all marked glue points
427 const Rectangle
& GetAllMarkedRect() const { return GetMarkedObjRect(); }
428 Rectangle
GetAllMarkedBoundRect() const { return GetMarkedObjBoundRect(); }
429 const Rectangle
& GetAllMarkedPointsRect() const { return GetMarkedPointsRect(); }
430 Point
GetGridOffset() const;
432 // Will be always called, if the list of marked objects might be changed.
433 // If you overload this method (as programmer), be shure that you call the
434 // methods of the base class!
435 virtual void MarkListHasChanged();
437 // Entering (Editing) of a maybe marked object group. If there are several
438 // object groups marked, the most upper group is selected. After that
439 // all member objects of the group are directly accessable. All other
440 // objects may not be processed in the meantime (until the next
441 // LeaveGroup()). With markings which overlaps pages, every page is processed
442 // separately. The method returns sal_True, if at least one group was entered.
443 sal_Bool
EnterMarkedGroup();
445 // Get the center point of the last Crook-Dragging. Den kann man
446 // bei einem anschliessenden Rotate sinnvoll als Drehmittelpunkt setzen.
447 const Point
& GetLastCrookCenter() const { return aLastCrookCenter
; }
449 // Is set by DragView automatically when finishing a Crook-Drag.
450 void SetLastCrookCenter(const Point
& rPt
) { aLastCrookCenter
=rPt
; }
452 // Rotation center point and start point of the axis of reflextion, respecively
453 const Point
& GetRef1() const { return aRef1
; }
454 void SetRef1(const Point
& rPt
);
456 // End point of the axis of reflextion
457 const Point
& GetRef2() const { return aRef1
; }
458 void SetRef2(const Point
& rPt
);
461 ////////////////////////////////////////////////////////////////////////////////////////////////////
464 // It have to be declared in logical coordinates. So please translate the
465 // wanted pixel value with PixelToLogic in Logical values.
466 // Taking as example a logical value of 100:
467 // - For a horizontal hairline (Object with height 0), the generated data is +/-100, i.e.
468 // a vertical area of 200 logical units is sensitive.
469 // - For a polygon, a rectangular of the size (200,200) is generated and a
470 // touch test between Poly and this Rect is processed.
471 // - Obects which respond SdrObject::HasEdit()==TRUE ( e.g. a text frame ),
472 // are specially treated: An additional sensitive area with a width of
473 // 2*Tol (200 units for this example) is created around the object.
474 // When an object is directly hit, the Edit method is called.
475 // In opposite, a hit in the surrounding sensitive area enables Dragging.
477 ////////////////////////////////////////////////////////////////////////////////////////////////////
479 #endif // INCLUDED_SVX_SVDMRKV_HXX
481 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */