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