tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / svx / svdmark.hxx
blob3d09b0c4c224a9401dbf26777c7df201cde96fb3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_SVDMARK_HXX
21 #define INCLUDED_SVX_SVDMARK_HXX
23 #include <config_options.h>
24 #include <o3tl/sorted_vector.hxx>
25 #include <rtl/ustring.hxx>
26 #include <svx/svxdllapi.h>
27 #include <svx/sdrobjectuser.hxx>
29 #include <memory>
30 #include <vector>
32 namespace tools { class Rectangle; }
33 class SdrPage;
34 class SdrObjList;
35 class SdrObject;
36 class SdrPageView;
38 typedef o3tl::sorted_vector<sal_uInt16> SdrUShortCont;
41 /**
42 * Everything a View needs to know about a selected object
44 class SVXCORE_DLLPUBLIC SdrMark final : public sdr::ObjectUser
46 sal_Int64 mnTimeStamp;
47 SdrObject* mpSelectedSdrObject; // the selected object
48 SdrPageView* mpPageView;
49 SdrUShortCont maPoints; // Selected Points
50 SdrUShortCont maGluePoints; // Selected Gluepoints (their Id's)
51 bool mbCon1; // for Connectors
52 bool mbCon2; // for Connectors
53 sal_uInt16 mnUser; // E.g. for CopyObjects, also copy Edges
55 SAL_DLLPRIVATE void setTime();
57 public:
58 explicit SdrMark(SdrObject* pNewObj = nullptr, SdrPageView* pNewPageView = nullptr);
59 SAL_DLLPRIVATE SdrMark(const SdrMark& rMark);
60 virtual ~SdrMark();
62 // Derived from ObjectUser
63 SAL_DLLPRIVATE virtual void ObjectInDestruction(const SdrObject& rObject) override;
65 SAL_DLLPRIVATE SdrMark& operator=(const SdrMark& rMark);
67 SAL_DLLPRIVATE void SetMarkedSdrObj(SdrObject* pNewObj);
68 SdrObject* GetMarkedSdrObj() const { return mpSelectedSdrObject;}
70 SdrPageView* GetPageView() const
72 return mpPageView;
75 void SetPageView(SdrPageView* pNewPageView)
77 mpPageView = pNewPageView;
80 void SetCon1(bool bOn)
82 mbCon1 = bOn;
85 bool IsCon1() const
87 return mbCon1;
90 void SetCon2(bool bOn)
92 mbCon2 = bOn;
95 bool IsCon2() const
97 return mbCon2;
100 void SetUser(sal_uInt16 nVal)
102 mnUser = nVal;
105 sal_uInt16 GetUser() const
107 return mnUser;
110 const SdrUShortCont& GetMarkedPoints() const
112 return maPoints;
115 const SdrUShortCont& GetMarkedGluePoints() const
117 return maGluePoints;
120 SdrUShortCont& GetMarkedPoints()
122 return maPoints;
125 SdrUShortCont& GetMarkedGluePoints()
127 return maGluePoints;
130 sal_Int64 getTimeStamp() const
132 return mnTimeStamp;
136 class SVXCORE_DLLPUBLIC SdrMarkList final
138 std::vector<std::unique_ptr<SdrMark>> maList;
140 OUString maMarkName;
141 OUString maPointName;
142 OUString maGluePointName;
144 bool mbPointNameOk;
145 bool mbGluePointNameOk;
146 bool mbNameOk;
147 bool mbSorted;
149 SVX_DLLPRIVATE void ImpForceSort();
150 SVX_DLLPRIVATE const OUString& GetPointMarkDescription(bool bGlue) const;
152 public:
153 SdrMarkList()
154 : mbPointNameOk(false),
155 mbGluePointNameOk(false),
156 mbNameOk(false),
157 mbSorted(true)
161 SdrMarkList(const SdrMarkList& rLst)
163 *this = rLst;
166 ~SdrMarkList()
168 Clear();
171 void Clear();
172 void ForceSort() const;
173 void SetUnsorted()
175 mbSorted = false;
178 size_t GetMarkCount() const
180 return maList.size();
183 SdrMark* GetMark(size_t nNum) const;
184 // returns SAL_MAX_SIZE if not found
185 size_t FindObject(const SdrObject* pObj) const;
186 void InsertEntry(const SdrMark& rMark, bool bChkSort = true);
187 void DeleteMark(size_t nNum);
188 SAL_DLLPRIVATE void ReplaceMark(const SdrMark& rNewMark, size_t nNum);
189 SAL_DLLPRIVATE void Merge(const SdrMarkList& rSrcList, bool bReverse = false);
190 SAL_DLLPRIVATE bool DeletePageView(const SdrPageView& rPV);
191 SAL_DLLPRIVATE bool InsertPageView(const SdrPageView& rPV);
193 void SetNameDirty()
195 mbNameOk = false;
196 mbPointNameOk = false;
197 mbGluePointNameOk = false;
200 // A verbal description of selected objects e.g.:
201 // "27 Lines", "12 Objects", "Polygon" or even "Not an object"
202 const OUString& GetMarkDescription() const;
203 const OUString& GetPointMarkDescription() const
205 return GetPointMarkDescription(false);
208 const OUString& GetGluePointMarkDescription() const
210 return GetPointMarkDescription(true);
213 // pPage=0: Selection of everything! Respect Pages
214 bool TakeBoundRect(SdrPageView const * pPageView, tools::Rectangle& rRect) const;
215 SAL_DLLPRIVATE bool TakeSnapRect(SdrPageView const * pPageView, tools::Rectangle& rRect) const;
217 // All Entries are copied!
218 SdrMarkList& operator=(const SdrMarkList& rLst);
222 // migrate selections
224 namespace sdr
226 class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) ViewSelection
228 SdrMarkList maMarkedObjectList;
229 SdrMarkList maEdgesOfMarkedNodes;
230 SdrMarkList maMarkedEdgesOfMarkedNodes;
231 std::vector<SdrObject*> maAllMarkedObjects;
233 bool mbEdgesOfMarkedNodesDirty : 1;
235 SVX_DLLPRIVATE void ImpForceEdgesOfMarkedNodes();
236 SVX_DLLPRIVATE void ImplCollectCompleteSelection(SdrObject* pObj);
238 public:
239 ViewSelection();
241 void SetEdgesOfMarkedNodesDirty();
243 const SdrMarkList& GetMarkedObjectList() const
245 return maMarkedObjectList;
248 const SdrMarkList& GetEdgesOfMarkedNodes() const;
249 const SdrMarkList& GetMarkedEdgesOfMarkedNodes() const;
250 const std::vector<SdrObject*>& GetAllMarkedObjects() const;
252 SdrMarkList& GetMarkedObjectListWriteAccess()
254 return maMarkedObjectList;
257 } // end of namespace sdr
259 #endif // INCLUDED_SVX_SVDMARK_HXX
261 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */