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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
35 : : #include <basegfx/color/bcolor.hxx>
36 : : #include <basegfx/matrix/b2dhommatrix.hxx>
37 : : #include <basegfx/polygon/b2dpolypolygon.hxx>
38 : : #include <svtools/ctrlbox.hxx>
39 : :
40 : : //////////////////////////////////////////////////////////////////////////////
41 : :
42 : : namespace drawinglayer
43 : : {
44 : : namespace primitive2d
45 : : {
46 : : /** BorderLinePrimitive2D class
47 : :
48 : : This is the basic primitive to build frames around objects, e.g. tables.
49 : : It defines a single or double line from Start to nd using the LeftWidth,
50 : : Distance and RightWidth definitions.
51 : : The LineStart/End overlap is defined by the Extend(Inner|Outer)(Start|End)
52 : : definitions.
53 : : */
54 [ - + ]: 21596 : class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D : public BufferedDecompositionPrimitive2D
55 : : {
56 : : private:
57 : : /// the line definition
58 : : basegfx::B2DPoint maStart;
59 : : basegfx::B2DPoint maEnd;
60 : :
61 : : /// the widths of single/double line
62 : : double mfLeftWidth;
63 : : double mfDistance;
64 : : double mfRightWidth;
65 : :
66 : : /// edge overlap sizes
67 : : double mfExtendLeftStart;
68 : : double mfExtendLeftEnd;
69 : : double mfExtendRightStart;
70 : : double mfExtendRightEnd;
71 : :
72 : : /// the line colors
73 : : basegfx::BColor maRGBColorRight;
74 : : basegfx::BColor maRGBColorLeft;
75 : : basegfx::BColor maRGBColorGap;
76 : : bool mbHasGapColor;
77 : :
78 : : short mnStyle;
79 : :
80 : : /// local helpers
81 : : double getWidth(
82 : : const geometry::ViewInformation2D& rViewInformation) const;
83 : :
84 : 10731 : bool isSolidLine() const
85 : : {
86 : 10731 : return (mnStyle==STYLE_SOLID);
87 : : }
88 : :
89 : 11371 : bool isInsideUsed() const
90 : : {
91 : 11371 : return !basegfx::fTools::equalZero(mfLeftWidth);
92 : : }
93 : :
94 : 11316 : bool isOutsideUsed() const
95 : : {
96 : 11316 : return !basegfx::fTools::equalZero(mfRightWidth);
97 : : }
98 : :
99 : : protected:
100 : : virtual basegfx::B2DPolyPolygon getClipPolygon(
101 : : const geometry::ViewInformation2D& rViewInformation) const;
102 : :
103 : : /// create local decomposition
104 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
105 : :
106 : : public:
107 : : /// constructor
108 : : BorderLinePrimitive2D(
109 : : const basegfx::B2DPoint& rStart,
110 : : const basegfx::B2DPoint& rEnd,
111 : : double fLeftWidth,
112 : : double fDistance,
113 : : double fRightWidth,
114 : : double fExtendLeftStart,
115 : : double fExtendLeftEnd,
116 : : double fExtendRightStart,
117 : : double fExtendRightEnd,
118 : : const basegfx::BColor& rRGBColorRight,
119 : : const basegfx::BColor& rRGBColorLeft,
120 : : const basegfx::BColor& rRGBColorGap,
121 : : bool bHasGapColor,
122 : : const short nStyle );
123 : :
124 : : /// data read access
125 : 211015 : const basegfx::B2DPoint& getStart() const { return maStart; }
126 : 211015 : const basegfx::B2DPoint& getEnd() const { return maEnd; }
127 : 11779 : double getLeftWidth() const { return mfLeftWidth; }
128 : 0 : double getDistance() const { return mfDistance; }
129 : 530 : double getRightWidth() const { return mfRightWidth; }
130 : 10811 : double getExtendLeftStart() const { return mfExtendLeftStart; }
131 : 10811 : double getExtendLeftEnd() const { return mfExtendLeftEnd; }
132 : 10811 : double getExtendRightStart() const { return mfExtendRightStart; }
133 : 10811 : double getExtendRightEnd() const { return mfExtendRightEnd; }
134 : 585 : const basegfx::BColor& getRGBColorRight () const { return maRGBColorRight; }
135 : 10786 : const basegfx::BColor& getRGBColorLeft () const { return maRGBColorLeft; }
136 : 7 : const basegfx::BColor& getRGBColorGap () const { return maRGBColorGap; }
137 : 55 : bool hasGapColor( ) const { return mbHasGapColor; }
138 : 439 : short getStyle () const { return mnStyle; }
139 : :
140 : : /// compare operator
141 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
142 : :
143 : : /// provide unique ID
144 : : DeclPrimitrive2DIDBlock()
145 : : };
146 : : } // end of namespace primitive2d
147 : : } // end of namespace drawinglayer
148 : :
149 : : //////////////////////////////////////////////////////////////////////////////
150 : :
151 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
152 : :
153 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|