DrawHelper.cxx (ff12d537) DrawHelper.cxx (b9e67834)
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

--- 33 unchanged lines hidden (view full) ---

42 rBox.Left(),
43 rBox.Right(),
44 rBox.Top(),
45 aBorderSize.Top(),
46 rHorizontalPaint);
47 // Draw bottom line.
48 DrawHorizontalLine(
49 rDevice,
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

--- 33 unchanged lines hidden (view full) ---

42 rBox.Left(),
43 rBox.Right(),
44 rBox.Top(),
45 aBorderSize.Top(),
46 rHorizontalPaint);
47 // Draw bottom line.
48 DrawHorizontalLine(
49 rDevice,
50 rBox.Left(),
50 rBox.Left()+aBorderSize.Left(),
51 rBox.Right(),
52 rBox.Bottom()-aBorderSize.Bottom()+1,
53 aBorderSize.Bottom(),
54 rHorizontalPaint);
55 // Draw left line.
56 DrawVerticalLine(
57 rDevice,
58 rBox.Top()+aBorderSize.Top(),
51 rBox.Right(),
52 rBox.Bottom()-aBorderSize.Bottom()+1,
53 aBorderSize.Bottom(),
54 rHorizontalPaint);
55 // Draw left line.
56 DrawVerticalLine(
57 rDevice,
58 rBox.Top()+aBorderSize.Top(),
59 rBox.Bottom()-aBorderSize.Bottom()+1,
59 rBox.Bottom(),
60 rBox.Left(),
61 aBorderSize.Left(),
62 rVerticalPaint);
63 // Draw right line.
64 DrawVerticalLine(
65 rDevice,
60 rBox.Left(),
61 aBorderSize.Left(),
62 rVerticalPaint);
63 // Draw right line.
64 DrawVerticalLine(
65 rDevice,
66 rBox.Top(),
67 rBox.Bottom(),
66 rBox.Top()+aBorderSize.Top(),
67 rBox.Bottom()-aBorderSize.Bottom(),
68 rBox.Right()-aBorderSize.Right()+1,
69 aBorderSize.Right(),
70 rVerticalPaint);
71}
72
73
74
75
76void DrawHelper::DrawHorizontalLine(
77 OutputDevice& rDevice,
68 rBox.Right()-aBorderSize.Right()+1,
69 aBorderSize.Right(),
70 rVerticalPaint);
71}
72
73
74
75
76void DrawHelper::DrawHorizontalLine(
77 OutputDevice& rDevice,
78 const int nLeft,
79 const int nRight,
80 const int nY,
81 const int nHeight,
78 const sal_Int32 nLeft,
79 const sal_Int32 nRight,
80 const sal_Int32 nY,
81 const sal_Int32 nHeight,
82 const Paint& rPaint)
83{
84 switch (rPaint.GetType())
85 {
86 case Paint::NoPaint:
87 default:
88 break;
89
90 case Paint::ColorPaint:
82 const Paint& rPaint)
83{
84 switch (rPaint.GetType())
85 {
86 case Paint::NoPaint:
87 default:
88 break;
89
90 case Paint::ColorPaint:
91 rDevice.SetLineColor(rPaint.GetColor());
92 if (nHeight == 1)
91 {
92 const Color aColor (rPaint.GetColor());
93 rDevice.SetLineColor(aColor);
94 for (sal_Int32 nYOffset=0; nYOffset<nHeight; ++nYOffset)
93 rDevice.DrawLine(
95 rDevice.DrawLine(
94 Point(nLeft,nY),
95 Point(nRight,nY));
96 else
97 rDevice.DrawLine(
98 Point(nLeft,nY),
99 Point(nRight,nY),
100 LineInfo(LINE_SOLID,nHeight));
96 Point(nLeft,nY+nYOffset),
97 Point(nRight,nY+nYOffset));
101 break;
98 break;
102
99 }
103 case Paint::GradientPaint:
104 rDevice.DrawGradient(
105 Rectangle(
106 nLeft,
107 nY,
108 nRight,
109 nY+nHeight-1),
110 rPaint.GetGradient());
111 break;
112 }
113}
114
115
116
117
118void DrawHelper::DrawVerticalLine(
119 OutputDevice& rDevice,
100 case Paint::GradientPaint:
101 rDevice.DrawGradient(
102 Rectangle(
103 nLeft,
104 nY,
105 nRight,
106 nY+nHeight-1),
107 rPaint.GetGradient());
108 break;
109 }
110}
111
112
113
114
115void DrawHelper::DrawVerticalLine(
116 OutputDevice& rDevice,
120 const int nTop,
121 const int nBottom,
122 const int nX,
123 const int nWidth,
117 const sal_Int32 nTop,
118 const sal_Int32 nBottom,
119 const sal_Int32 nX,
120 const sal_Int32 nWidth,
124 const Paint& rPaint)
125{
126 switch (rPaint.GetType())
127 {
128 case Paint::NoPaint:
129 default:
130 break;
131
132 case Paint::ColorPaint:
121 const Paint& rPaint)
122{
123 switch (rPaint.GetType())
124 {
125 case Paint::NoPaint:
126 default:
127 break;
128
129 case Paint::ColorPaint:
133 rDevice.SetLineColor(rPaint.GetColor());
134 if (nWidth == 1)
130 {
131 const Color aColor (rPaint.GetColor());
132 rDevice.SetLineColor(aColor);
133 for (sal_Int32 nXOffset=0; nXOffset<nWidth; ++nXOffset)
135 rDevice.DrawLine(
134 rDevice.DrawLine(
136 Point(nX, nTop),
137 Point(nX, nBottom));
138 else
139 rDevice.DrawLine(
140 Point(nX, nTop),
141 Point(nX, nBottom),
142 LineInfo(LINE_SOLID, nWidth));
135 Point(nX+nXOffset, nTop),
136 Point(nX+nXOffset, nBottom));
143 break;
137 break;
144
138 }
145 case Paint::GradientPaint:
146 rDevice.DrawGradient(
147 Rectangle(
148 nX,
149 nTop,
150 nX+nWidth-1,
151 nBottom),
152 rPaint.GetGradient());
153 break;
154 }
155}
156
157
158
159
160void DrawHelper::DrawRoundedRectangle (
161 OutputDevice& rDevice,
162 const Rectangle& rBox,
139 case Paint::GradientPaint:
140 rDevice.DrawGradient(
141 Rectangle(
142 nX,
143 nTop,
144 nX+nWidth-1,
145 nBottom),
146 rPaint.GetGradient());
147 break;
148 }
149}
150
151
152
153
154void DrawHelper::DrawRoundedRectangle (
155 OutputDevice& rDevice,
156 const Rectangle& rBox,
163 const int nCornerRadius,
157 const sal_Int32 nCornerRadius,
164 const Color& rBorderColor,
165 const Paint& rFillPaint)
166{
167 rDevice.SetLineColor(rBorderColor);
168 switch(rFillPaint.GetType())
169 {
170 case Paint::NoPaint:
171 default:

--- 22 unchanged lines hidden ---
158 const Color& rBorderColor,
159 const Paint& rFillPaint)
160{
161 rDevice.SetLineColor(rBorderColor);
162 switch(rFillPaint.GetType())
163 {
164 case Paint::NoPaint:
165 default:

--- 22 unchanged lines hidden ---