add some protocols that don't make sense as floating frame targets
[LibreOffice.git] / include / svx / svdhlpln.hxx
blobaa850773c4e2f51b1010bf1b14a00d19d46d37f8
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_SVDHLPLN_HXX
21 #define INCLUDED_SVX_SVDHLPLN_HXX
23 #include <sal/types.h>
24 #include <tools/gen.hxx>
26 #include <svx/svxdllapi.h>
28 #include <vector>
29 #include <memory>
31 class OutputDevice;
32 enum class PointerStyle;
34 enum class SdrHelpLineKind { Point, Vertical, Horizontal };
36 #define SDRHELPLINE_POINT_PIXELSIZE 15 /* actual size = PIXELSIZE*2+1 */
38 class SdrHelpLine {
39 Point aPos; // X or Y may be unimportant, depending on the value of eKind
40 SdrHelpLineKind eKind;
42 public:
43 explicit SdrHelpLine(SdrHelpLineKind eNewKind=SdrHelpLineKind::Point): eKind(eNewKind) {}
44 SdrHelpLine(SdrHelpLineKind eNewKind, const Point& rNewPos): aPos(rNewPos), eKind(eNewKind) {}
45 bool operator==(const SdrHelpLine& rCmp) const { return aPos==rCmp.aPos && eKind==rCmp.eKind; }
46 bool operator!=(const SdrHelpLine& rCmp) const { return !operator==(rCmp); }
48 void SetKind(SdrHelpLineKind eNewKind) { eKind=eNewKind; }
49 SdrHelpLineKind GetKind() const { return eKind; }
50 void SetPos(const Point& rPnt) { aPos=rPnt; }
51 const Point& GetPos() const { return aPos; }
53 PointerStyle GetPointer() const;
54 bool IsHit(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
55 // OutputDevice is required because capture points have a fixed pixel size
56 tools::Rectangle GetBoundRect(const OutputDevice& rOut) const;
59 #define SDRHELPLINE_NOTFOUND 0xFFFF
61 class SVXCORE_DLLPUBLIC SdrHelpLineList {
62 std::vector<std::unique_ptr<SdrHelpLine>> aList;
64 public:
65 SdrHelpLineList() {}
66 SdrHelpLineList(const SdrHelpLineList& rSrcList) { *this=rSrcList; }
67 SdrHelpLineList& operator=(const SdrHelpLineList& rSrcList);
68 bool operator==(const SdrHelpLineList& rCmp) const;
69 bool operator!=(const SdrHelpLineList& rCmp) const { return !operator==(rCmp); }
70 sal_uInt16 GetCount() const { return sal_uInt16(aList.size()); }
71 void Insert(const SdrHelpLine& rHL) { aList.emplace_back(new SdrHelpLine(rHL)); }
72 void Insert(const SdrHelpLine& rHL, sal_uInt16 nPos)
74 if(nPos==0xFFFF)
75 aList.emplace_back(new SdrHelpLine(rHL));
76 else
77 aList.emplace(aList.begin() + nPos, new SdrHelpLine(rHL));
79 void Delete(sal_uInt16 nPos)
81 aList.erase(aList.begin() + nPos);
83 SdrHelpLine& operator[](sal_uInt16 nPos) { return *aList[nPos]; }
84 const SdrHelpLine& operator[](sal_uInt16 nPos) const { return *aList[nPos]; }
85 sal_uInt16 HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
89 #endif // INCLUDED_SVX_SVDHLPLN_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */