Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SVDMRKV_HXX
21 : #define _SVDMRKV_HXX
22 :
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"
28 :
29 :
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 */
45 :
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)
49 :
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 */
56 :
57 : enum SdrHitKind {SDRHIT_NONE, // No hit
58 : SDRHIT_OBJECT, // 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)
79 :
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
83 :
84 : #define IMPSDR_MARKOBJDESCRIPTION 0x0000
85 : #define IMPSDR_POINTSDESCRIPTION 0x0001
86 : #define IMPSDR_GLUEPOINTSDESCRIPTION 0x0002
87 :
88 :
89 : class ImplMarkingOverlay;
90 :
91 : class SVX_DLLPUBLIC SdrMarkView : public SdrSnapView
92 : {
93 : friend class SdrPageView;
94 :
95 : // #114409#-3 Migrate selections
96 : ImplMarkingOverlay* mpMarkObjOverlay;
97 : ImplMarkingOverlay* mpMarkPointsOverlay;
98 : ImplMarkingOverlay* mpMarkGluePointsOverlay;
99 :
100 : protected:
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.
103 :
104 : Point aRef1; // Persistent - Rotation center / axis of reflection
105 : Point aRef2; // Persistent
106 : Point aLastCrookCenter; // Persistent
107 : SdrHdlList aHdl;
108 : sdr::ViewSelection* mpSdrViewSelection;
109 :
110 : Rectangle aMarkedObjRect;
111 : Rectangle aMarkedObjRectNoOffset;
112 : Rectangle aMarkedPointsRect;
113 : Rectangle aMarkedGluePointsRect;
114 :
115 : sal_uInt16 nFrameHandlesLimit;
116 : sal_uIntPtr mnInsPointNum; // Number of the InsPoint
117 : sal_uIntPtr nMarkableObjCount;
118 :
119 : SdrDragMode eDragMode; // Persistent
120 : SdrViewEditMode eEditMode; // Persistent
121 : SdrViewEditMode eEditMode0; // Persistent
122 :
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;
134 :
135 : // flag to completely disable handles at the view
136 : unsigned mbMarkHandlesHidden : 1;
137 :
138 : private:
139 : SVX_DLLPRIVATE void ImpClearVars();
140 : SVX_DLLPRIVATE void ImpSetPointsRects() const;
141 : void UndirtyMrkPnt() const;
142 :
143 : protected:
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);
151 :
152 : // add custom handles (used by other apps, e.g. AnchorPos)
153 : virtual void AddCustomHdl();
154 :
155 : void ForceRefToMarked();
156 4033 : void ForceUndirtyMrkPnt() const { if (bMrkPntDirty) UndirtyMrkPnt(); }
157 :
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, String& rStr, sal_uInt16 nVal=0, sal_uInt16 nOpt=0) const;
164 :
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);
169 :
170 : void SetMoveOutside(sal_Bool bOn);
171 :
172 : protected:
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();
176 :
177 : public:
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;
184 :
185 : virtual void ClearPageView();
186 : virtual void HideSdrPage();
187 : virtual sal_Bool IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const;
188 :
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 0 : sal_Bool IsMarking() const { return IsMarkObj() || IsMarkPoints() || IsMarkGluePoints(); }
192 :
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();
197 : void BrkMarkObj();
198 9571 : sal_Bool IsMarkObj() const { return (0L != mpMarkObjOverlay); }
199 :
200 : // DragModes: SDRDRAG_CREATE,SDRDRAG_MOVE,SDRDRAG_RESIZE,SDRDRAG_ROTATE,SDRDRAG_MIRROR,SDRDRAG_SHEAR,SDRDRAG_CROOK
201 : // Move==Resize
202 : // The interface might maybe be changed in the future because of Ortho-Drag
203 : void SetDragMode(SdrDragMode eMode);
204 471 : SdrDragMode GetDragMode() const { return eDragMode; }
205 : sal_Bool ChkDragMode(SdrDragMode eMode) const;
206 : void SetFrameHandles(sal_Bool bOn);
207 4085 : sal_Bool IsFrameHandles() const { return bForceFrameHandles; }
208 :
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; }
212 :
213 : void SetEditMode(SdrViewEditMode eMode);
214 0 : SdrViewEditMode GetEditMode() const { return eEditMode; }
215 :
216 0 : void SetEditMode(sal_Bool bOn=sal_True) { SetEditMode(bOn?SDREDITMODE_EDIT:SDREDITMODE_CREATE); }
217 203 : sal_Bool IsEditMode() const { return eEditMode==SDREDITMODE_EDIT; }
218 0 : void SetCreateMode(sal_Bool bOn=sal_True) { SetEditMode(bOn?SDREDITMODE_CREATE:SDREDITMODE_EDIT); }
219 539 : sal_Bool IsCreateMode() const { return eEditMode==SDREDITMODE_CREATE; }
220 0 : void SetGluePointEditMode(sal_Bool bOn=sal_True) { SetEditMode(bOn?SDREDITMODE_GLUEPOINTEDIT:eEditMode0); }
221 927 : sal_Bool IsGluePointEditMode() const { return eEditMode==SDREDITMODE_GLUEPOINTEDIT; }
222 :
223 : void SetDesignMode(sal_Bool bOn=sal_True);
224 10040 : sal_Bool IsDesignMode() const { return bDesignMode; }
225 :
226 1499 : void SetFrameDragSingles(sal_Bool bOn=sal_True) { SetFrameHandles(bOn); }
227 4085 : sal_Bool IsFrameDragSingles() const { return IsFrameHandles(); }
228 :
229 : ////////////////////////////////////////////////////////////////////////////////////////////////////
230 : // migrate selections
231 :
232 : protected:
233 : // all available changing methods
234 8335 : SdrMarkList& GetMarkedObjectListWriteAccess() { return mpSdrViewSelection->GetMarkedObjectListWriteAccess(); }
235 1397 : void SetEdgesOfMarkedNodesDirty() { mpSdrViewSelection->SetEdgesOfMarkedNodesDirty(); }
236 :
237 : public:
238 : // all available const methods for read access to selection
239 271084 : const SdrMarkList& GetMarkedObjectList() const { return mpSdrViewSelection->GetMarkedObjectList(); }
240 5 : sal_uIntPtr TryToFindMarkedObject(const SdrObject* pObj) const { return GetMarkedObjectList().FindObject(pObj); }
241 91 : SdrPageView* GetSdrPageViewOfMarkedByIndex(sal_uIntPtr nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetPageView(); }
242 1213 : SdrMark* GetSdrMarkByIndex(sal_uIntPtr nNum) const { return GetMarkedObjectList().GetMark(nNum); }
243 161 : SdrObject* GetMarkedObjectByIndex(sal_uIntPtr nNum) const { return (GetMarkedObjectList().GetMark(nNum))->GetMarkedSdrObj(); }
244 74792 : sal_uIntPtr GetMarkedObjectCount() const { return GetMarkedObjectList().GetMarkCount(); }
245 7717 : void SortMarkedObjects() const { GetMarkedObjectList().ForceSort(); }
246 10307 : sal_Bool AreObjectsMarked() const { return (0L != GetMarkedObjectList().GetMarkCount()); }
247 11 : String GetDescriptionOfMarkedObjects() const { return GetMarkedObjectList().GetMarkDescription(); }
248 0 : String GetDescriptionOfMarkedPoints() const { return GetMarkedObjectList().GetPointMarkDescription(); }
249 0 : String GetDescriptionOfMarkedGluePoints() const { return GetMarkedObjectList().GetGluePointMarkDescription(); }
250 8658 : sal_Bool GetBoundRectFromMarkedObjects(SdrPageView* pPageView, Rectangle& rRect) const { return GetMarkedObjectList().TakeBoundRect(pPageView, rRect); }
251 8658 : sal_Bool GetSnapRectFromMarkedObjects(SdrPageView* pPageView, Rectangle& rRect) const { return GetMarkedObjectList().TakeSnapRect(pPageView, rRect); }
252 :
253 : // Get a list of all those links which are connected to marked nodes,
254 : // but which are not marked themselves.
255 0 : const SdrMarkList& GetEdgesOfMarkedNodes() const { return mpSdrViewSelection->GetEdgesOfMarkedNodes(); }
256 23 : const SdrMarkList& GetMarkedEdgesOfMarkedNodes() const { return mpSdrViewSelection->GetMarkedEdgesOfMarkedNodes(); }
257 23 : const std::vector<SdrObject*>& GetTransitiveHullOfMarkedObjects() const { return mpSdrViewSelection->GetAllMarkedObjects(); }
258 :
259 : ////////////////////////////////////////////////////////////////////////////////////////////////////
260 :
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 33788 : bool areMarkHandlesHidden() const { return mbMarkHandlesHidden; }
267 :
268 0 : 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;
270 :
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;
273 :
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);
282 :
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;
285 :
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);
292 :
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);
299 :
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
306 :
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 0 : void UnMarkAll(SdrPageView* pPV=NULL) { UnmarkAllObj(pPV); }
311 :
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);
318 :
319 : virtual sal_Bool HasMarkablePoints() const;
320 : virtual sal_uIntPtr GetMarkablePointCount() const;
321 : virtual sal_Bool HasMarkedPoints() const;
322 : virtual sal_uIntPtr GetMarkedPointCount() const;
323 :
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);
327 :
328 : /** should only be used from outside svx for special ui elements */
329 : sal_Bool MarkPointHelper(SdrHdl* pHdl, SdrMark* pMark, sal_Bool bUnmark);
330 :
331 : // Mark all points within this rectangular alle Punkte (View coordinates)
332 0 : sal_Bool MarkPoints(const Rectangle& rRect, sal_Bool bUnmark=sal_False) { return MarkPoints(&rRect,bUnmark); }
333 0 : sal_Bool UnmarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,sal_True); }
334 : sal_Bool UnMarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,sal_True); }
335 0 : sal_Bool IsPointMarked(const SdrHdl& rHdl) const { ForceUndirtyMrkPnt(); return &rHdl!=NULL && rHdl.IsSelected(); }
336 0 : sal_Bool MarkAllPoints() { return MarkPoints(NULL,sal_False); }
337 65 : sal_Bool UnmarkAllPoints() { return MarkPoints(NULL,sal_True); }
338 : sal_Bool UnMarkAllPoints() { return MarkPoints(NULL,sal_True); }
339 :
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);
346 :
347 : // Search for the number of the suitable handle. In case of empty search result,
348 : // CONTAINER_ENTRY_NOTFOUND is returned.
349 0 : sal_uIntPtr GetHdlNum(SdrHdl* pHdl) const { return aHdl.GetHdlNum(pHdl); }
350 0 : SdrHdl* GetHdl(sal_uIntPtr nHdlNum) const { return aHdl.GetHdl(nHdlNum); }
351 66 : const SdrHdlList& GetHdlList() const { return aHdl; }
352 :
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 9571 : sal_Bool IsMarkPoints() const { return (0L != mpMarkPointsOverlay); }
360 :
361 : // Select that additional handles are displayed permanently.
362 : void SetPlusHandlesAlwaysVisible(sal_Bool bOn);
363 740 : sal_Bool IsPlusHandlesAlwaysVisible() const { return bPlusHdlAlways; }
364 :
365 : // Are Handles visible during TextEdit (in double size)?
366 : // Persistent, default=FALSE
367 198 : void SetMarkHdlWhenTextEdit(sal_Bool bOn) { bMarkHdlWhenTextEdit=bOn; }
368 : sal_Bool IsMarkHdlWhenTextEdit() const { return bMarkHdlWhenTextEdit; }
369 :
370 : sal_Bool HasMarkableGluePoints() const;
371 : sal_Bool HasMarkedGluePoints() const;
372 :
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 0 : 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;
388 :
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; }
393 :
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 0 : sal_Bool MarkAllGluePoints() { return MarkGluePoints(NULL,sal_False); }
398 0 : sal_Bool UnmarkAllGluePoints() { return MarkGluePoints(NULL,sal_True); }
399 :
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);
406 :
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 9571 : sal_Bool IsMarkGluePoints() const { return (0L != mpMarkGluePointsOverlay); }
416 :
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);
422 :
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 48 : const Rectangle& GetAllMarkedRect() const { return GetMarkedObjRect(); }
428 0 : Rectangle GetAllMarkedBoundRect() const { return GetMarkedObjBoundRect(); }
429 : const Rectangle& GetAllMarkedPointsRect() const { return GetMarkedPointsRect(); }
430 : Point GetGridOffset() const;
431 :
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();
436 :
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();
444 :
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; }
448 :
449 : // Is set by DragView automatically when finishing a Crook-Drag.
450 0 : void SetLastCrookCenter(const Point& rPt) { aLastCrookCenter=rPt; }
451 :
452 : // Rotation center point and start point of the axis of reflextion, respecively
453 0 : const Point& GetRef1() const { return aRef1; }
454 : void SetRef1(const Point& rPt);
455 :
456 : // End point of the axis of reflextion
457 0 : const Point& GetRef2() const { return aRef1; }
458 : void SetRef2(const Point& rPt);
459 : };
460 :
461 : ////////////////////////////////////////////////////////////////////////////////////////////////////
462 : //
463 : // - Hit tolarances:
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.
476 : //
477 : ////////////////////////////////////////////////////////////////////////////////////////////////////
478 :
479 : #endif //_SVDMRKV_HXX
480 :
481 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|