xref: /trunk/main/editeng/inc/editeng/borderline.hxx (revision 4c5491ea)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SVX_BORDERLINE_HXX
25 #define SVX_BORDERLINE_HXX
26 
27 #include <tools/color.hxx>
28 #include <svl/poolitem.hxx>
29 #include <editeng/editengdllapi.h>
30 
31 // Line defaults in twips (former Writer defaults):
32 
33 #define DEF_LINE_WIDTH_0        1
34 #define DEF_LINE_WIDTH_1        20
35 #define DEF_LINE_WIDTH_2        50
36 #define DEF_LINE_WIDTH_3        80
37 #define DEF_LINE_WIDTH_4        100
38 #define DEF_LINE_WIDTH_5        10
39 
40 #define DEF_MAX_LINE_WIDHT      DEF_LINE_WIDTH_4
41 #define DEF_MAX_LINE_DIST       DEF_LINE_WIDTH_2
42 
43 #define DEF_DOUBLE_LINE0_OUT    DEF_LINE_WIDTH_0
44 #define DEF_DOUBLE_LINE0_IN     DEF_LINE_WIDTH_0
45 #define DEF_DOUBLE_LINE0_DIST   DEF_LINE_WIDTH_1
46 
47 #define DEF_DOUBLE_LINE1_OUT    DEF_LINE_WIDTH_1
48 #define DEF_DOUBLE_LINE1_IN     DEF_LINE_WIDTH_1
49 #define DEF_DOUBLE_LINE1_DIST   DEF_LINE_WIDTH_1
50 
51 #define DEF_DOUBLE_LINE2_OUT    DEF_LINE_WIDTH_2
52 #define DEF_DOUBLE_LINE2_IN     DEF_LINE_WIDTH_2
53 #define DEF_DOUBLE_LINE2_DIST   DEF_LINE_WIDTH_2
54 
55 #define DEF_DOUBLE_LINE3_OUT    DEF_LINE_WIDTH_2
56 #define DEF_DOUBLE_LINE3_IN     DEF_LINE_WIDTH_1
57 #define DEF_DOUBLE_LINE3_DIST   DEF_LINE_WIDTH_2
58 
59 #define DEF_DOUBLE_LINE4_OUT    DEF_LINE_WIDTH_1
60 #define DEF_DOUBLE_LINE4_IN     DEF_LINE_WIDTH_2
61 #define DEF_DOUBLE_LINE4_DIST   DEF_LINE_WIDTH_1
62 
63 #define DEF_DOUBLE_LINE5_OUT    DEF_LINE_WIDTH_3
64 #define DEF_DOUBLE_LINE5_IN     DEF_LINE_WIDTH_2
65 #define DEF_DOUBLE_LINE5_DIST   DEF_LINE_WIDTH_2
66 
67 #define DEF_DOUBLE_LINE6_OUT    DEF_LINE_WIDTH_2
68 #define DEF_DOUBLE_LINE6_IN     DEF_LINE_WIDTH_3
69 #define DEF_DOUBLE_LINE6_DIST   DEF_LINE_WIDTH_2
70 
71 #define DEF_DOUBLE_LINE7_OUT    DEF_LINE_WIDTH_0
72 #define DEF_DOUBLE_LINE7_IN     DEF_LINE_WIDTH_0
73 #define DEF_DOUBLE_LINE7_DIST   DEF_LINE_WIDTH_2
74 
75 #define DEF_DOUBLE_LINE8_OUT    DEF_LINE_WIDTH_1
76 #define DEF_DOUBLE_LINE8_IN     DEF_LINE_WIDTH_0
77 #define DEF_DOUBLE_LINE8_DIST   DEF_LINE_WIDTH_2
78 
79 #define DEF_DOUBLE_LINE9_OUT    DEF_LINE_WIDTH_2
80 #define DEF_DOUBLE_LINE9_IN     DEF_LINE_WIDTH_0
81 #define DEF_DOUBLE_LINE9_DIST   DEF_LINE_WIDTH_2
82 
83 #define DEF_DOUBLE_LINE10_OUT	DEF_LINE_WIDTH_3
84 #define DEF_DOUBLE_LINE10_IN	DEF_LINE_WIDTH_0
85 #define DEF_DOUBLE_LINE10_DIST	DEF_LINE_WIDTH_2
86 
87 // ============================================================================
88 
89 class EDITENG_DLLPUBLIC SvxBorderLine
90 {
91 protected:
92 	Color  aColor;
93 	sal_uInt16 nOutWidth;
94 	sal_uInt16 nInWidth;
95 	sal_uInt16 nDistance;
96 
97 public:
98 	SvxBorderLine( const Color *pCol = 0, sal_uInt16 nOut = 0, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 );
99 	SvxBorderLine( const SvxBorderLine& r );
100 
101 	SvxBorderLine& operator=( const SvxBorderLine& r );
102 
GetColor() const103 	const Color&	GetColor() const { return aColor; }
GetOutWidth() const104 	sal_uInt16 			GetOutWidth() const { return nOutWidth; }
GetInWidth() const105 	sal_uInt16 			GetInWidth() const { return nInWidth; }
GetDistance() const106 	sal_uInt16 			GetDistance() const { return nDistance; }
107 
SetColor(const Color & rColor)108 	void 			SetColor( const Color &rColor ) { aColor = rColor; }
SetOutWidth(sal_uInt16 nNew)109 	void			SetOutWidth( sal_uInt16 nNew ) { nOutWidth = nNew; }
SetInWidth(sal_uInt16 nNew)110 	void			SetInWidth( sal_uInt16 nNew ) { nInWidth = nNew;  }
SetDistance(sal_uInt16 nNew)111 	void			SetDistance( sal_uInt16 nNew ) { nDistance = nNew; }
112 	void			ScaleMetrics( long nMult, long nDiv );
113 
114 	sal_Bool			operator==( const SvxBorderLine &rCmp ) const;
115 
116     String          GetValueString( SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit,
117                                     const IntlWrapper* pIntl,
118 									sal_Bool bMetricStr = sal_False ) const;
119 
120 	bool			HasPriority( const SvxBorderLine& rOtherLine ) const;
121 
isEmpty() const122 	bool isEmpty() const { return (0 == nOutWidth && 0 == nInWidth && 0 == nDistance); }
isDouble() const123 	bool isDouble() const { return (0 != nOutWidth && 0 != nInWidth); }
getWidth() const124 	sal_uInt16 getWidth() const { return nOutWidth + nInWidth + nDistance; }
125 };
126 
127 // ============================================================================
128 
129 #endif
130 
131