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 INCLUDED_SVX_SVDMRKV_HXX
21 : #define INCLUDED_SVX_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 : //HMHbool bHdlShown : 1;
124 : bool bRefHdlShownOnly : 1; // Axis of reflextion during dragging (ni)
125 : bool bDesignMode : 1; // DesignMode for SdrUnoObj
126 : bool bForceFrameHandles : 1; // Persistent - FrameDrag auch bei Einzelobjekten
127 : bool bPlusHdlAlways : 1; // Persistent
128 : bool bMarkHdlWhenTextEdit : 1; // Persistent, default=FALSE
129 : bool bInsPolyPoint : 1; // at this time InsPolyPointDragging
130 : bool bMarkedObjRectDirty : 1;
131 : bool bMrkPntDirty : 1;
132 : bool bMarkedPointsRectsDirty : 1;
133 : bool bMarkableObjCountDirty : 1;
134 :
135 : // flag to completely disable handles at the view
136 : bool 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) SAL_OVERRIDE;
145 : virtual void ModelHasChanged() SAL_OVERRIDE; // 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 bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
151 :
152 : // add custom handles (used by other apps, e.g. AnchorPos)
153 : virtual void AddCustomHdl();
154 :
155 : void ForceRefToMarked();
156 10788 : 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 : bool ImpIsFrameHandles() const;
163 : void ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, OUString& 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 : bool ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark);
167 : virtual bool MarkPoints(const Rectangle* pRect, bool bUnmark);
168 : bool MarkGluePoints(const Rectangle* pRect, bool bUnmark);
169 :
170 : void SetMoveOutside(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 bool IsAction() const SAL_OVERRIDE;
179 : virtual void MovAction(const Point& rPnt) SAL_OVERRIDE;
180 : virtual void EndAction() SAL_OVERRIDE;
181 : virtual void BckAction() SAL_OVERRIDE;
182 : virtual void BrkAction() SAL_OVERRIDE;
183 : virtual void TakeActionRect(Rectangle& rRect) const SAL_OVERRIDE;
184 :
185 : virtual void ClearPageView() SAL_OVERRIDE;
186 : virtual void HideSdrPage() SAL_OVERRIDE;
187 : virtual 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 : bool IsMarking() const { return IsMarkObj() || IsMarkPoints() || IsMarkGluePoints(); }
192 :
193 : // Marking objects by drawing of a selection frame
194 : bool BegMarkObj(const Point& rPnt, bool bUnmark = false);
195 : void MovMarkObj(const Point& rPnt);
196 : bool EndMarkObj();
197 : void BrkMarkObj();
198 45007 : 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 1312 : SdrDragMode GetDragMode() const { return eDragMode; }
205 : bool ChkDragMode(SdrDragMode eMode) const;
206 : void SetFrameHandles(bool bOn);
207 7503 : bool IsFrameHandles() const { return bForceFrameHandles; }
208 :
209 : sal_uIntPtr GetMarkableObjCount() const;
210 :
211 : // Limit. Exceeding the limit causes an implicite switch to FrameHandles. default=50.
212 : void SetFrameHandlesLimit(sal_uInt16 nAnz) { nFrameHandlesLimit=nAnz; }
213 : sal_uInt16 GetFrameHandlesLimit() const { return nFrameHandlesLimit; }
214 :
215 : void SetEditMode(SdrViewEditMode eMode);
216 0 : SdrViewEditMode GetEditMode() const { return eEditMode; }
217 :
218 0 : void SetEditMode(bool bOn=true) { SetEditMode(bOn?SDREDITMODE_EDIT:SDREDITMODE_CREATE); }
219 550 : bool IsEditMode() const { return eEditMode==SDREDITMODE_EDIT; }
220 0 : void SetCreateMode(bool bOn=true) { SetEditMode(bOn?SDREDITMODE_CREATE:SDREDITMODE_EDIT); }
221 1542 : bool IsCreateMode() const { return eEditMode==SDREDITMODE_CREATE; }
222 0 : void SetGluePointEditMode(bool bOn=true) { SetEditMode(bOn?SDREDITMODE_GLUEPOINTEDIT:eEditMode0); }
223 3829 : bool IsGluePointEditMode() const { return eEditMode==SDREDITMODE_GLUEPOINTEDIT; }
224 :
225 : void SetDesignMode(bool bOn = true);
226 44585 : bool IsDesignMode() const { return bDesignMode; }
227 :
228 8238 : void SetFrameDragSingles(bool bOn=true) { SetFrameHandles(bOn); }
229 7503 : bool IsFrameDragSingles() const { return IsFrameHandles(); }
230 :
231 : bool HasMarkableObj() const;
232 :
233 :
234 : // migrate selections
235 :
236 : protected:
237 : // all available changing methods
238 33409 : SdrMarkList& GetMarkedObjectListWriteAccess() { return mpSdrViewSelection->GetMarkedObjectListWriteAccess(); }
239 8078 : void SetEdgesOfMarkedNodesDirty() { mpSdrViewSelection->SetEdgesOfMarkedNodesDirty(); }
240 :
241 : public:
242 : // all available const methods for read access to selection
243 1031251 : const SdrMarkList& GetMarkedObjectList() const { return mpSdrViewSelection->GetMarkedObjectList(); }
244 : // returns SAL_MAX_SIZE if not found
245 30 : size_t TryToFindMarkedObject(const SdrObject* pObj) const { return GetMarkedObjectList().FindObject(pObj); }
246 474 : SdrPageView* GetSdrPageViewOfMarkedByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetPageView(); }
247 8967 : SdrMark* GetSdrMarkByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum); }
248 1476 : SdrObject* GetMarkedObjectByIndex(size_t nNum) const { return (GetMarkedObjectList().GetMark(nNum))->GetMarkedSdrObj(); }
249 336263 : size_t GetMarkedObjectCount() const { return GetMarkedObjectList().GetMarkCount(); }
250 18149 : void SortMarkedObjects() const { GetMarkedObjectList().ForceSort(); }
251 26364 : bool AreObjectsMarked() const { return 0 != GetMarkedObjectList().GetMarkCount(); }
252 80 : OUString GetDescriptionOfMarkedObjects() const { return GetMarkedObjectList().GetMarkDescription(); }
253 0 : OUString GetDescriptionOfMarkedPoints() const { return GetMarkedObjectList().GetPointMarkDescription(); }
254 0 : OUString GetDescriptionOfMarkedGluePoints() const { return GetMarkedObjectList().GetGluePointMarkDescription(); }
255 74506 : bool GetBoundRectFromMarkedObjects(SdrPageView* pPageView, Rectangle& rRect) const { return GetMarkedObjectList().TakeBoundRect(pPageView, rRect); }
256 74506 : bool GetSnapRectFromMarkedObjects(SdrPageView* pPageView, Rectangle& rRect) const { return GetMarkedObjectList().TakeSnapRect(pPageView, rRect); }
257 :
258 : // Get a list of all those links which are connected to marked nodes,
259 : // but which are not marked themselves.
260 0 : const SdrMarkList& GetEdgesOfMarkedNodes() const { return mpSdrViewSelection->GetEdgesOfMarkedNodes(); }
261 104 : const SdrMarkList& GetMarkedEdgesOfMarkedNodes() const { return mpSdrViewSelection->GetMarkedEdgesOfMarkedNodes(); }
262 104 : const std::vector<SdrObject*>& GetTransitiveHullOfMarkedObjects() const { return mpSdrViewSelection->GetAllMarkedObjects(); }
263 :
264 :
265 :
266 : // mechanism to complete disable handles at the view. Handles will be hidden and deleted
267 : // when set, no new ones created, no interaction allowed. Handles will be recreated and shown
268 : // when reset. Default is false.
269 : void hideMarkHandles();
270 : void showMarkHandles();
271 190144 : bool areMarkHandlesHidden() const { return mbMarkHandlesHidden; }
272 :
273 0 : bool IsMarkedHit(const Point& rPnt, short nTol=-2) const { return IsMarkedObjHit(rPnt,nTol); }
274 : bool IsMarkedObjHit(const Point& rPnt, short nTol=-2) const;
275 :
276 : // Pick: Supported options for nOptions are SEARCH_NEXT, SEARCH_BACKWARD (ni)
277 : SdrHdl* PickHandle(const Point& rPnt, sal_uIntPtr nOptions=0, SdrHdl* pHdl0=NULL) const;
278 :
279 : // Pick: Supported options for nOptions are:
280 : // SDRSEARCH_DEEP SDRSEARCH_ALSOONMASTER SDRSEARCH_TESTMARKABLE SDRSEARCH_TESTTEXTEDIT
281 : // SDRSEARCH_WITHTEXT SDRSEARCH_TESTTEXTAREA SDRSEARCH_BACKWARD SDRSEARCH_MARKED
282 : // SDRSEARCH_WHOLEPAGE
283 : bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions, SdrObject** ppRootObj, sal_uInt16* pnPassNum=NULL) const;
284 : bool PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions=0) const;
285 : bool MarkObj(const Point& rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false);
286 :
287 : // Pick: Supported options for nOptions are SDRSEARCH_PASS2BOUND und SDRSEARCH_PASS3NEAREST
288 : bool PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions=0) const;
289 :
290 : // Selects the most upper of the marked objects (O1) and scans from there
291 : // towards bottom direction, selecting the first non-marked object (O2).
292 : // In case of success the marking of O1 is deleted, a marking is created at
293 : // O2 and TRUE is returned. With the parameter bPrev=sal_True the scan
294 : // direction is turned to the other direction.
295 : bool MarkNextObj(bool bPrev=false);
296 :
297 : // Selects the most upper of the marked objects which is hit by rPnt/nTol
298 : // and scans from there to bottom direction, selecting the first non-marked
299 : // object (O2). In case of success the marking of O1 is deleted, a marking
300 : // is created at O2 and sal_True is returned. With the parameter
301 : // bPrev=sal_True the scan direction is turned to the other direction.
302 : bool MarkNextObj(const Point& rPnt, short nTol=-2, bool bPrev=false);
303 :
304 : // Mark all objects within a rectangular area
305 : // Just objects are marked which are inclosed completely
306 : bool MarkObj(const Rectangle& rRect, bool bUnmark=false);
307 : void MarkObj(SdrObject* pObj, SdrPageView* pPV, bool bUnmark=false, bool bImpNoSetMarkHdl=false);
308 : void MarkAllObj(SdrPageView* pPV=NULL); // pPage=NULL => all displayed pages
309 : void UnmarkAllObj(SdrPageView* pPV=NULL); // pPage=NULL => all displayed pages
310 :
311 : // This function is time-consuming intensive, as the MarkList has to be scanned.
312 : bool IsObjMarked(SdrObject* pObj) const;
313 : // void MarkAll(SdrPageView* pPV=NULL) { MarkAllObj(pPV); } -> replace with inline
314 0 : void UnMarkAll(SdrPageView* pPV=NULL) { UnmarkAllObj(pPV); }
315 :
316 : // Request/set the size of the marking handles. Declaration in Pixel.
317 : // The value is meant to be the edge length ( link length ).
318 : // Pair values are round up to impair values: 3->3, 4->5, 5->5, 6->7, 7->7, ...
319 : // Default value is 7, minimum value is 3 Pixels.
320 : sal_uInt16 GetMarkHdlSizePixel() const;
321 : void SetMarkHdlSizePixel(sal_uInt16 nSiz);
322 :
323 : virtual bool HasMarkablePoints() const;
324 : virtual sal_uIntPtr GetMarkablePointCount() const;
325 : virtual bool HasMarkedPoints() const;
326 : virtual sal_uIntPtr GetMarkedPointCount() const;
327 :
328 : // There might be points which can't be marked:
329 : virtual bool IsPointMarkable(const SdrHdl& rHdl) const;
330 : virtual bool MarkPoint(SdrHdl& rHdl, bool bUnmark=false);
331 :
332 : /** should only be used from outside svx for special ui elements */
333 : bool MarkPointHelper(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark);
334 :
335 : // Mark all points within this rectangular alle Punkte (View coordinates)
336 0 : bool MarkPoints(const Rectangle& rRect, bool bUnmark=false) { return MarkPoints(&rRect,bUnmark); }
337 0 : bool UnmarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,true); }
338 : bool UnMarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,true); }
339 0 : bool IsPointMarked(const SdrHdl& rHdl) const { ForceUndirtyMrkPnt(); return rHdl.IsSelected(); }
340 0 : bool MarkAllPoints() { return MarkPoints(NULL,false); }
341 212 : bool UnmarkAllPoints() { return MarkPoints(NULL,true); }
342 : bool UnMarkAllPoints() { return MarkPoints(NULL,true); }
343 :
344 : // Selects the first marked point (P1) which is hit by rPnt
345 : // and from there it searches the first non-marked point(P2).
346 : // In case of success the marking of
347 : // P1 is deleted, a mark is set at P2 and sal_True is returned.
348 : // With the parameter bPrev=sal_True the scan direction is turned to the other direction.
349 : bool MarkNextPoint(const Point& rPnt, bool bPrev=false);
350 :
351 : // Search for the number of the suitable handle. In case of empty search result,
352 : // SAL_MAX_SIZE is returned.
353 0 : size_t GetHdlNum(SdrHdl* pHdl) const { return aHdl.GetHdlNum(pHdl); }
354 0 : SdrHdl* GetHdl(size_t nHdlNum) const { return aHdl.GetHdl(nHdlNum); }
355 214 : const SdrHdlList& GetHdlList() const { return aHdl; }
356 :
357 : // Draw a selection frame for marking of points.
358 : // This routine will just be started in case that HasMarkablePoints() returns sal_True.
359 : bool BegMarkPoints(const Point& rPnt, bool bUnmark = false);
360 : void MovMarkPoints(const Point& rPnt);
361 : bool EndMarkPoints();
362 : void BrkMarkPoints();
363 45007 : bool IsMarkPoints() const { return (0L != mpMarkPointsOverlay); }
364 :
365 : // Select that additional handles are displayed permanently.
366 : void SetPlusHandlesAlwaysVisible(bool bOn);
367 3070 : bool IsPlusHandlesAlwaysVisible() const { return bPlusHdlAlways; }
368 :
369 : // Are Handles visible during TextEdit (in double size)?
370 : // Persistent, default=FALSE
371 568 : void SetMarkHdlWhenTextEdit(bool bOn) { bMarkHdlWhenTextEdit=bOn; }
372 : bool IsMarkHdlWhenTextEdit() const { return bMarkHdlWhenTextEdit; }
373 :
374 : bool HasMarkableGluePoints() const;
375 : bool HasMarkedGluePoints() const;
376 :
377 : // A gluepoint is clearly identified by the SdrObject
378 : // (to which it belongs) as well as by a sal_uInt16 nId (as each SdrObject may consist of
379 : // several glue points. Here at the View there is an additional
380 : // SdrPageView, which should be defined correctly always.
381 : // Alternatively a gluepoint may be characterized by a SdrHdl.
382 : // In this case the SdrHdl instance consists of all required informations.
383 : // And in this case, the glue point are always is marked by enforcment
384 : // (Handlers are just situated at marked gluepoints )
385 : // Attention: With each change of the glue point status the handle list is re-calculated.
386 : // All previously saved SdrHdl* became invalid by this, the same with the point IDs!
387 : // Pick: Supported options for nOptions are SEARCH_NEXT, SEARCH_BACKWARD
388 : bool PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16& rnId, SdrPageView*& rpPV, sal_uIntPtr nOptions=0) const;
389 : bool MarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, const SdrPageView* pPV, bool bUnmark=false);
390 0 : bool UnmarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, const SdrPageView* pPV) { return MarkGluePoint(pObj,nId,pPV,true); }
391 : bool IsGluePointMarked(const SdrObject* pObj, sal_uInt16 nId) const;
392 :
393 : // Get the Hdl (handle) of a marked GluePoint. Non-marked
394 : // GluePoints don`t have handles
395 : SdrHdl* GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) const;
396 : bool IsGluePoint(const SdrHdl& rHdl) const { return rHdl.GetKind()==HDL_GLUE; }
397 :
398 : // Mark all points within this rectangular (View coordinates)
399 : bool MarkGluePoints(const Rectangle& rRect) { return MarkGluePoints(&rRect,false); }
400 : bool UnmarkGluePoints(const Rectangle& rRect) { return MarkGluePoints(&rRect,true); }
401 0 : bool MarkAllGluePoints() { return MarkGluePoints(NULL,false); }
402 0 : bool UnmarkAllGluePoints() { return MarkGluePoints(NULL,true); }
403 :
404 : // Selects the first marked point (P1) which is hit by rPnt
405 : // and from there it searches the first non-marked point(P2).
406 : // In case of success the marking of
407 : // P1 is deleted, a mark is set at P2 and sal_True is returned.
408 : // With the parameter bPrev=sal_True the scan direction is turned to the other direction.
409 : bool MarkNextGluePoint(const Point& rPnt, bool bPrev=false);
410 :
411 : // Draw a selection frame for glue point marking.
412 : // This routine will just be started in case that HasMarkablePoints() returns sal_True.
413 : // The GlueEditMode sal_True is disregarded.
414 : // bool BegMarkGluePoints(const Point& rPnt, OutputDevice* pOut);
415 : bool BegMarkGluePoints(const Point& rPnt, bool bUnmark = false);
416 : void MovMarkGluePoints(const Point& rPnt);
417 : bool EndMarkGluePoints();
418 : void BrkMarkGluePoints();
419 45007 : bool IsMarkGluePoints() const { return (0L != mpMarkGluePointsOverlay); }
420 :
421 : // bRestraintPaint=sal_False causes the handles not to be drawn immediately.
422 : // AdjustMarkHdl is just called in case of changes; usually this causes an Invalidate
423 : // At the end of a redraw the handles are drawn automatically.
424 : // The purpose is to avoid unnecessary flickering. -> This does not yet work, that's why sal_True!
425 : void AdjustMarkHdl(); //HMHBOOL bRestraintPaint=sal_True);
426 :
427 : const Rectangle& GetMarkedObjRect() const; // SnapRects of Objects, without line width
428 : Rectangle GetMarkedObjBoundRect() const; // incl. line width, overlapping rags, ...
429 : const Rectangle& GetMarkedPointsRect() const; // Enclosing rectangle of all marked points
430 : const Rectangle& GetMarkedGluePointsRect() const; // Enclosing rectangle of all marked glue points
431 59 : const Rectangle& GetAllMarkedRect() const { return GetMarkedObjRect(); }
432 0 : Rectangle GetAllMarkedBoundRect() const { return GetMarkedObjBoundRect(); }
433 : const Rectangle& GetAllMarkedPointsRect() const { return GetMarkedPointsRect(); }
434 : Point GetGridOffset() const;
435 :
436 : // Will be always called, if the list of marked objects might be changed.
437 : // If you overload this method (as programmer), be sure that you call the
438 : // methods of the base class!
439 : virtual void MarkListHasChanged();
440 :
441 : // Entering (Editing) of a maybe marked object group. If there are several
442 : // object groups marked, the most upper group is selected. After that
443 : // all member objects of the group are directly accessable. All other
444 : // objects may not be processed in the meantime (until the next
445 : // LeaveGroup()). With markings which overlaps pages, every page is processed
446 : // separately. The method returns sal_True, if at least one group was entered.
447 : bool EnterMarkedGroup();
448 :
449 : // Get the center point of the last Crook-Dragging. Den kann man
450 : // bei einem anschliessenden Rotate sinnvoll als Drehmittelpunkt setzen.
451 : const Point& GetLastCrookCenter() const { return aLastCrookCenter; }
452 :
453 : // Is set by DragView automatically when finishing a Crook-Drag.
454 0 : void SetLastCrookCenter(const Point& rPt) { aLastCrookCenter=rPt; }
455 :
456 : // Rotation center point and start point of the axis of reflextion, respecively
457 0 : const Point& GetRef1() const { return aRef1; }
458 : void SetRef1(const Point& rPt);
459 :
460 : // End point of the axis of reflextion
461 0 : const Point& GetRef2() const { return aRef1; }
462 : void SetRef2(const Point& rPt);
463 : void UnmarkObj(SdrObject* pObj);
464 : };
465 :
466 :
467 :
468 : // - Hit tolarances:
469 : // It have to be declared in logical coordinates. So please translate the
470 : // wanted pixel value with PixelToLogic in Logical values.
471 : // Taking as example a logical value of 100:
472 : // - For a horizontal hairline (Object with height 0), the generated data is +/-100, i.e.
473 : // a vertical area of 200 logical units is sensitive.
474 : // - For a polygon, a rectangular of the size (200,200) is generated and a
475 : // touch test between Poly and this Rect is processed.
476 : // - Obects which respond SdrObject::HasEdit()==TRUE ( e.g. a text frame ),
477 : // are specially treated: An additional sensitive area with a width of
478 : // 2*Tol (200 units for this example) is created around the object.
479 : // When an object is directly hit, the Edit method is called.
480 : // In opposite, a hit in the surrounding sensitive area enables Dragging.
481 :
482 :
483 :
484 : #endif // INCLUDED_SVX_SVDMRKV_HXX
485 :
486 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|