Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVDHLPLN_HXX
30 : : #define _SVDHLPLN_HXX
31 : :
32 : : #include <sal/types.h>
33 : : #include <tools/color.hxx>
34 : : #include <tools/gen.hxx>
35 : :
36 : : #include <vcl/pointr.hxx>
37 : : #include "svx/svxdllapi.h"
38 : :
39 : : class OutputDevice;
40 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
41 : :
42 : : enum SdrHelpLineKind {SDRHELPLINE_POINT,SDRHELPLINE_VERTICAL,SDRHELPLINE_HORIZONTAL};
43 : :
44 : : #define SDRHELPLINE_POINT_PIXELSIZE 15 /* Tatsaechliche Groesse= PIXELSIZE*2+1 */
45 : :
46 : : class SdrHelpLine {
47 : : Point aPos; // je nach Wert von eKind ist X oder Y evtl. belanglos
48 : : SdrHelpLineKind eKind;
49 : :
50 : : // #i27493#
51 : : // Helper method to draw a hor or ver two-colored dashed line
52 : : void ImpDrawDashedTwoColorLine(OutputDevice& rOut, sal_Int32 nStart, sal_Int32 nEnd, sal_Int32 nFixPos,
53 : : sal_Int32 nStepWidth, Color aColA, Color aColB, sal_Bool bHorizontal) const;
54 : :
55 : : public:
56 : 0 : explicit SdrHelpLine(SdrHelpLineKind eNewKind=SDRHELPLINE_POINT): eKind(eNewKind) {}
57 : 0 : SdrHelpLine(SdrHelpLineKind eNewKind, const Point& rNewPos): aPos(rNewPos), eKind(eNewKind) {}
58 : : bool operator==(const SdrHelpLine& rCmp) const { return aPos==rCmp.aPos && eKind==rCmp.eKind; }
59 : : bool operator!=(const SdrHelpLine& rCmp) const { return !operator==(rCmp); }
60 : :
61 : 0 : void SetKind(SdrHelpLineKind eNewKind) { eKind=eNewKind; }
62 : 0 : SdrHelpLineKind GetKind() const { return eKind; }
63 : 0 : void SetPos(const Point& rPnt) { aPos=rPnt; }
64 : 0 : const Point& GetPos() const { return aPos; }
65 : :
66 : : Pointer GetPointer() const;
67 : : bool IsHit(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
68 : : // OutputDevice wird benoetigt, da Fangpunkte eine feste Pixelgroesse haben
69 : : Rectangle GetBoundRect(const OutputDevice& rOut) const;
70 : : };
71 : :
72 : : #define SDRHELPLINE_NOTFOUND 0xFFFF
73 : :
74 : : class SVX_DLLPUBLIC SdrHelpLineList {
75 : : std::vector<SdrHelpLine*> aList;
76 : : protected:
77 : 0 : SdrHelpLine* GetObject(sal_uInt16 i) const { return aList[i]; }
78 : : public:
79 : 903 : SdrHelpLineList(): aList() {}
80 : : SdrHelpLineList(const SdrHelpLineList& rSrcList): aList() { *this=rSrcList; }
81 [ + - ]: 903 : ~SdrHelpLineList() { Clear(); }
82 : : void Clear();
83 : : void operator=(const SdrHelpLineList& rSrcList);
84 : : bool operator==(const SdrHelpLineList& rCmp) const;
85 : 405 : bool operator!=(const SdrHelpLineList& rCmp) const { return !operator==(rCmp); }
86 : 402 : sal_uInt16 GetCount() const { return sal_uInt16(aList.size()); }
87 [ # # ]: 0 : void Insert(const SdrHelpLine& rHL) { aList.push_back(new SdrHelpLine(rHL)); }
88 : : void Insert(const SdrHelpLine& rHL, sal_uInt16 nPos)
89 : : {
90 : : if(nPos==0xFFFF)
91 : : aList.push_back(new SdrHelpLine(rHL));
92 : : else
93 : : aList.insert(aList.begin() + nPos, new SdrHelpLine(rHL));
94 : : }
95 : : void Delete(sal_uInt16 nPos)
96 : : {
97 : : SdrHelpLine* p = aList[nPos];
98 : : delete p;
99 : : aList.erase(aList.begin() + nPos);
100 : : }
101 : : void Move(sal_uInt16 nPos, sal_uInt16 nNewPos)
102 : : {
103 : : SdrHelpLine* p = aList[nPos];
104 : : aList.erase(aList.begin() + nPos);
105 : : aList.insert(aList.begin() + nNewPos, p);
106 : : }
107 : : SdrHelpLine& operator[](sal_uInt16 nPos) { return *GetObject(nPos); }
108 : 0 : const SdrHelpLine& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); }
109 : : sal_uInt16 HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
110 : : };
111 : :
112 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
113 : :
114 : : #endif //_SVDHLPLN_HXX
115 : :
116 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|