1*9f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*9f62ea84SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*9f62ea84SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*9f62ea84SAndrew Rist * distributed with this work for additional information
6*9f62ea84SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*9f62ea84SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*9f62ea84SAndrew Rist * "License"); you may not use this file except in compliance
9*9f62ea84SAndrew Rist * with the License. You may obtain a copy of the License at
10*9f62ea84SAndrew Rist *
11*9f62ea84SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*9f62ea84SAndrew Rist *
13*9f62ea84SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*9f62ea84SAndrew Rist * software distributed under the License is distributed on an
15*9f62ea84SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9f62ea84SAndrew Rist * KIND, either express or implied. See the License for the
17*9f62ea84SAndrew Rist * specific language governing permissions and limitations
18*9f62ea84SAndrew Rist * under the License.
19*9f62ea84SAndrew Rist *
20*9f62ea84SAndrew Rist *************************************************************/
21*9f62ea84SAndrew Rist
22*9f62ea84SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir #include <vcl/settings.hxx>
27cdf0e10cSrcweir #include <tools/poly.hxx>
28cdf0e10cSrcweir #include <vcl/outdev.hxx>
29cdf0e10cSrcweir #include <vcl/bmpacc.hxx>
30cdf0e10cSrcweir #include <vcl/decoview.hxx>
31cdf0e10cSrcweir #include <vcl/window.hxx>
32cdf0e10cSrcweir #include <vcl/ctrl.hxx>
33cdf0e10cSrcweir
34cdf0e10cSrcweir // =======================================================================
35cdf0e10cSrcweir
36cdf0e10cSrcweir #define BUTTON_DRAW_FLATTEST (BUTTON_DRAW_FLAT | \
37cdf0e10cSrcweir BUTTON_DRAW_PRESSED | \
38cdf0e10cSrcweir BUTTON_DRAW_CHECKED | \
39cdf0e10cSrcweir BUTTON_DRAW_HIGHLIGHT)
40cdf0e10cSrcweir
41cdf0e10cSrcweir // =======================================================================
42cdf0e10cSrcweir
ImplDrawSymbol(OutputDevice * pDev,const Rectangle & rRect,SymbolType eType)43cdf0e10cSrcweir static void ImplDrawSymbol( OutputDevice* pDev, const Rectangle& rRect,
44cdf0e10cSrcweir SymbolType eType )
45cdf0e10cSrcweir {
46cdf0e10cSrcweir // Groessen vorberechnen
47cdf0e10cSrcweir long nMin = Min( rRect.GetWidth(), rRect.GetHeight() );
48cdf0e10cSrcweir long nSize = nMin;
49cdf0e10cSrcweir
50cdf0e10cSrcweir if ( nMin & 0x01 )
51cdf0e10cSrcweir nMin--;
52cdf0e10cSrcweir Point aCenter = rRect.Center();
53cdf0e10cSrcweir long nCenterX = aCenter.X();
54cdf0e10cSrcweir long nCenterY = aCenter.Y();
55cdf0e10cSrcweir long n2 = nMin / 2;
56cdf0e10cSrcweir long n4 = nMin / 4;
57cdf0e10cSrcweir long nLeft;
58cdf0e10cSrcweir long nTop;
59cdf0e10cSrcweir long nRight;
60cdf0e10cSrcweir long nBottom;
61cdf0e10cSrcweir long nTemp;
62cdf0e10cSrcweir long i;
63cdf0e10cSrcweir
64cdf0e10cSrcweir switch ( eType )
65cdf0e10cSrcweir {
66cdf0e10cSrcweir case SYMBOL_ARROW_UP:
67cdf0e10cSrcweir {
68cdf0e10cSrcweir if ( !(nMin & 0x01) )
69cdf0e10cSrcweir {
70cdf0e10cSrcweir n2--;
71cdf0e10cSrcweir n4--;
72cdf0e10cSrcweir }
73cdf0e10cSrcweir nTop = nCenterY-n2;
74cdf0e10cSrcweir nBottom = nCenterY;
75cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
76cdf0e10cSrcweir i = 1;
77cdf0e10cSrcweir while ( i <= n2 )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir nTop++;
80cdf0e10cSrcweir nTemp = nCenterX-i;
81cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
82cdf0e10cSrcweir nTemp = nCenterX+i;
83cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
84cdf0e10cSrcweir i++;
85cdf0e10cSrcweir }
86cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX-n4, nBottom,
87cdf0e10cSrcweir nCenterX+n4, nBottom+n2 ) );
88cdf0e10cSrcweir }
89cdf0e10cSrcweir break;
90cdf0e10cSrcweir
91cdf0e10cSrcweir case SYMBOL_ARROW_DOWN:
92cdf0e10cSrcweir {
93cdf0e10cSrcweir if ( !(nMin & 0x01) )
94cdf0e10cSrcweir {
95cdf0e10cSrcweir n2--;
96cdf0e10cSrcweir n4--;
97cdf0e10cSrcweir }
98cdf0e10cSrcweir nTop = nCenterY;
99cdf0e10cSrcweir nBottom = nCenterY+n2;
100cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
101cdf0e10cSrcweir i = 1;
102cdf0e10cSrcweir while ( i <= n2 )
103cdf0e10cSrcweir {
104cdf0e10cSrcweir nBottom--;
105cdf0e10cSrcweir nTemp = nCenterX-i;
106cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
107cdf0e10cSrcweir nTemp = nCenterX+i;
108cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
109cdf0e10cSrcweir i++;
110cdf0e10cSrcweir }
111cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX-n4, nTop-n2,
112cdf0e10cSrcweir nCenterX+n4, nTop ) );
113cdf0e10cSrcweir }
114cdf0e10cSrcweir break;
115cdf0e10cSrcweir
116cdf0e10cSrcweir case SYMBOL_ARROW_LEFT:
117cdf0e10cSrcweir {
118cdf0e10cSrcweir if ( !(nMin & 0x01) )
119cdf0e10cSrcweir {
120cdf0e10cSrcweir n2--;
121cdf0e10cSrcweir n4--;
122cdf0e10cSrcweir }
123cdf0e10cSrcweir nLeft = nCenterX-n2;
124cdf0e10cSrcweir nRight = nCenterX;
125cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
126cdf0e10cSrcweir i = 1;
127cdf0e10cSrcweir while ( i <= n2 )
128cdf0e10cSrcweir {
129cdf0e10cSrcweir nLeft++;
130cdf0e10cSrcweir nTemp = nCenterY-i;
131cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
132cdf0e10cSrcweir nTemp = nCenterY+i;
133cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
134cdf0e10cSrcweir i++;
135cdf0e10cSrcweir }
136cdf0e10cSrcweir pDev->DrawRect( Rectangle( nRight, nCenterY-n4,
137cdf0e10cSrcweir nRight+n2, nCenterY+n4 ) );
138cdf0e10cSrcweir }
139cdf0e10cSrcweir break;
140cdf0e10cSrcweir
141cdf0e10cSrcweir case SYMBOL_ARROW_RIGHT:
142cdf0e10cSrcweir {
143cdf0e10cSrcweir if ( !(nMin & 0x01) )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir n2--;
146cdf0e10cSrcweir n4--;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir nLeft = nCenterX;
149cdf0e10cSrcweir nRight = nCenterX+n2;
150cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
151cdf0e10cSrcweir i = 1;
152cdf0e10cSrcweir while ( i <= n2 )
153cdf0e10cSrcweir {
154cdf0e10cSrcweir nRight--;
155cdf0e10cSrcweir nTemp = nCenterY-i;
156cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
157cdf0e10cSrcweir nTemp = nCenterY+i;
158cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
159cdf0e10cSrcweir i++;
160cdf0e10cSrcweir }
161cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft-n2, nCenterY-n4,
162cdf0e10cSrcweir nLeft, nCenterY+n4 ) );
163cdf0e10cSrcweir }
164cdf0e10cSrcweir break;
165cdf0e10cSrcweir
166cdf0e10cSrcweir
167cdf0e10cSrcweir case SYMBOL_SPIN_UP:
168cdf0e10cSrcweir {
169cdf0e10cSrcweir if ( !(nMin & 0x01) )
170cdf0e10cSrcweir n2--;
171cdf0e10cSrcweir nTop = nCenterY-n4;
172cdf0e10cSrcweir nBottom = nTop+n2;
173cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
174cdf0e10cSrcweir i = 1;
175cdf0e10cSrcweir while ( i <= n2 )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir nTop++;
178cdf0e10cSrcweir nTemp = nCenterX-i;
179cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
180cdf0e10cSrcweir nTemp = nCenterX+i;
181cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
182cdf0e10cSrcweir i++;
183cdf0e10cSrcweir }
184cdf0e10cSrcweir }
185cdf0e10cSrcweir break;
186cdf0e10cSrcweir
187cdf0e10cSrcweir case SYMBOL_SPIN_DOWN:
188cdf0e10cSrcweir {
189cdf0e10cSrcweir if ( !(nMin & 0x01) )
190cdf0e10cSrcweir n2--;
191cdf0e10cSrcweir nTop = nCenterY-n4;
192cdf0e10cSrcweir nBottom = nTop+n2;
193cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
194cdf0e10cSrcweir i = 1;
195cdf0e10cSrcweir while ( i <= n2 )
196cdf0e10cSrcweir {
197cdf0e10cSrcweir nBottom--;
198cdf0e10cSrcweir nTemp = nCenterX-i;
199cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
200cdf0e10cSrcweir nTemp = nCenterX+i;
201cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
202cdf0e10cSrcweir i++;
203cdf0e10cSrcweir }
204cdf0e10cSrcweir }
205cdf0e10cSrcweir break;
206cdf0e10cSrcweir
207cdf0e10cSrcweir case SYMBOL_SPIN_LEFT:
208cdf0e10cSrcweir case SYMBOL_FIRST:
209cdf0e10cSrcweir case SYMBOL_PREV:
210cdf0e10cSrcweir case SYMBOL_REVERSEPLAY:
211cdf0e10cSrcweir {
212cdf0e10cSrcweir if ( !(nMin & 0x01) )
213cdf0e10cSrcweir n2--;
214cdf0e10cSrcweir nLeft = nCenterX-n4;
215cdf0e10cSrcweir if ( eType == SYMBOL_FIRST )
216cdf0e10cSrcweir nLeft++;
217cdf0e10cSrcweir nRight = nLeft+n2;
218cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
219cdf0e10cSrcweir i = 1;
220cdf0e10cSrcweir while ( i <= n2 )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir nLeft++;
223cdf0e10cSrcweir nTemp = nCenterY-i;
224cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
225cdf0e10cSrcweir nTemp = nCenterY+i;
226cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
227cdf0e10cSrcweir i++;
228cdf0e10cSrcweir }
229cdf0e10cSrcweir if ( eType == SYMBOL_FIRST )
230cdf0e10cSrcweir {
231cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX-n4-1, nCenterY-n2,
232cdf0e10cSrcweir nCenterX-n4-1, nCenterY+n2 ) );
233cdf0e10cSrcweir }
234cdf0e10cSrcweir }
235cdf0e10cSrcweir break;
236cdf0e10cSrcweir
237cdf0e10cSrcweir case SYMBOL_SPIN_RIGHT:
238cdf0e10cSrcweir case SYMBOL_LAST:
239cdf0e10cSrcweir case SYMBOL_NEXT:
240cdf0e10cSrcweir case SYMBOL_PLAY:
241cdf0e10cSrcweir {
242cdf0e10cSrcweir if ( !(nMin & 0x01) )
243cdf0e10cSrcweir n2--;
244cdf0e10cSrcweir nLeft = nCenterX-n4;
245cdf0e10cSrcweir if ( eType == SYMBOL_LAST )
246cdf0e10cSrcweir nLeft--;
247cdf0e10cSrcweir nRight = nLeft+n2;
248cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
249cdf0e10cSrcweir i = 1;
250cdf0e10cSrcweir while ( i <= n2 )
251cdf0e10cSrcweir {
252cdf0e10cSrcweir nRight--;
253cdf0e10cSrcweir nTemp = nCenterY-i;
254cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
255cdf0e10cSrcweir nTemp = nCenterY+i;
256cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
257cdf0e10cSrcweir i++;
258cdf0e10cSrcweir }
259cdf0e10cSrcweir if ( eType == SYMBOL_LAST )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX+n4+1, nCenterY-n2,
262cdf0e10cSrcweir nCenterX+n4+1, nCenterY+n2 ) );
263cdf0e10cSrcweir }
264cdf0e10cSrcweir }
265cdf0e10cSrcweir break;
266cdf0e10cSrcweir
267cdf0e10cSrcweir case SYMBOL_PAGEUP:
268cdf0e10cSrcweir case SYMBOL_PAGEDOWN:
269cdf0e10cSrcweir {
270cdf0e10cSrcweir if ( !( nSize & 0x01 ))
271cdf0e10cSrcweir {
272cdf0e10cSrcweir // An even rectangle size means we have to use a smaller size for
273cdf0e10cSrcweir // our arrows as we want to use one pixel for the spearhead! Otherwise
274cdf0e10cSrcweir // it will be clipped!
275cdf0e10cSrcweir nCenterX++;
276cdf0e10cSrcweir n2 = ( nMin-1 ) / 2;
277cdf0e10cSrcweir n4 = ( nMin-1 ) / 4;
278cdf0e10cSrcweir }
279cdf0e10cSrcweir
280cdf0e10cSrcweir nTop = nCenterY-n2;
281cdf0e10cSrcweir nBottom = nCenterY-1;
282cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
283cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX, nTop+n2+1, nCenterX, nBottom+n2+1 ) );
284cdf0e10cSrcweir i = 1;
285cdf0e10cSrcweir while ( i < n2 )
286cdf0e10cSrcweir {
287cdf0e10cSrcweir ( eType == SYMBOL_PAGEUP ) ? nTop++ : nBottom--;
288cdf0e10cSrcweir nTemp = nCenterX-i;
289cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
290cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop+n2+1, nTemp, nBottom+n2+1 ) );
291cdf0e10cSrcweir nTemp = nCenterX+i;
292cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
293cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop+n2+1, nTemp, nBottom+n2+1 ) );
294cdf0e10cSrcweir i++;
295cdf0e10cSrcweir }
296cdf0e10cSrcweir }
297cdf0e10cSrcweir break;
298cdf0e10cSrcweir
299cdf0e10cSrcweir case SYMBOL_RADIOCHECKMARK:
300cdf0e10cSrcweir case SYMBOL_RECORD:
301cdf0e10cSrcweir {
302cdf0e10cSrcweir const long nExt = ( n2 << 1 ) + 1;
303cdf0e10cSrcweir Bitmap aBmp( Size( nExt, nExt ), 1 );
304cdf0e10cSrcweir BitmapWriteAccess* pWAcc = aBmp.AcquireWriteAccess();
305cdf0e10cSrcweir
306cdf0e10cSrcweir if( pWAcc )
307cdf0e10cSrcweir {
308cdf0e10cSrcweir const Color aWhite( COL_WHITE );
309cdf0e10cSrcweir const Color aBlack( COL_BLACK );
310cdf0e10cSrcweir
311cdf0e10cSrcweir pWAcc->Erase( aWhite );
312cdf0e10cSrcweir pWAcc->SetLineColor( aBlack );
313cdf0e10cSrcweir pWAcc->SetFillColor( aBlack );
314cdf0e10cSrcweir pWAcc->DrawPolygon( Polygon( Point( n2, n2 ), n2, n2 ) );
315cdf0e10cSrcweir aBmp.ReleaseAccess( pWAcc );
316cdf0e10cSrcweir pDev->DrawMask( Point( nCenterX - n2, nCenterY - n2 ), aBmp, pDev->GetFillColor() );
317cdf0e10cSrcweir }
318cdf0e10cSrcweir else
319cdf0e10cSrcweir pDev->DrawPolygon( Polygon( Point( nCenterX, nCenterY ), n2, n2 ) );
320cdf0e10cSrcweir }
321cdf0e10cSrcweir break;
322cdf0e10cSrcweir
323cdf0e10cSrcweir case SYMBOL_STOP:
324cdf0e10cSrcweir {
325cdf0e10cSrcweir nLeft = nCenterX-n2;
326cdf0e10cSrcweir nRight = nCenterX+n2;
327cdf0e10cSrcweir nTop = nCenterY-n2;
328cdf0e10cSrcweir nBottom = nCenterY+n2;
329cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTop, nRight, nBottom ) );
330cdf0e10cSrcweir }
331cdf0e10cSrcweir break;
332cdf0e10cSrcweir
333cdf0e10cSrcweir case SYMBOL_PAUSE:
334cdf0e10cSrcweir {
335cdf0e10cSrcweir nLeft = nCenterX-n2;
336cdf0e10cSrcweir nRight = nCenterX+n2-1;
337cdf0e10cSrcweir nTop = nCenterY-n2;
338cdf0e10cSrcweir nBottom = nCenterY+n2;
339cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTop, nCenterX-2, nBottom ) );
340cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX+1, nTop, nRight, nBottom ) );
341cdf0e10cSrcweir }
342cdf0e10cSrcweir break;
343cdf0e10cSrcweir
344cdf0e10cSrcweir case SYMBOL_WINDSTART:
345cdf0e10cSrcweir case SYMBOL_WINDBACKWARD:
346cdf0e10cSrcweir {
347cdf0e10cSrcweir nLeft = nCenterX-n2+1;
348cdf0e10cSrcweir nRight = nCenterX;
349cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
350cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft+n2, nCenterY, nRight+n2, nCenterY ) );
351cdf0e10cSrcweir i = 1;
352cdf0e10cSrcweir while ( i < n2 )
353cdf0e10cSrcweir {
354cdf0e10cSrcweir nLeft++;
355cdf0e10cSrcweir nTemp = nCenterY-i;
356cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
357cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
358cdf0e10cSrcweir nTemp = nCenterY+i;
359cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
360cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
361cdf0e10cSrcweir i++;
362cdf0e10cSrcweir }
363cdf0e10cSrcweir if ( eType == SYMBOL_WINDSTART )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX-n2, nCenterY-n2,
366cdf0e10cSrcweir nCenterX-n2, nCenterY+n2 ) );
367cdf0e10cSrcweir }
368cdf0e10cSrcweir }
369cdf0e10cSrcweir break;
370cdf0e10cSrcweir
371cdf0e10cSrcweir case SYMBOL_WINDEND:
372cdf0e10cSrcweir case SYMBOL_WINDFORWARD:
373cdf0e10cSrcweir {
374cdf0e10cSrcweir nLeft = nCenterX-n2;
375cdf0e10cSrcweir nRight = nCenterX-1;
376cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nCenterY, nRight, nCenterY ) );
377cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft+n2, nCenterY, nRight+n2, nCenterY ) );
378cdf0e10cSrcweir i = 1;
379cdf0e10cSrcweir while ( i < n2 )
380cdf0e10cSrcweir {
381cdf0e10cSrcweir nRight--;
382cdf0e10cSrcweir nTemp = nCenterY-i;
383cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
384cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
385cdf0e10cSrcweir nTemp = nCenterY+i;
386cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft, nTemp, nRight, nTemp ) );
387cdf0e10cSrcweir pDev->DrawRect( Rectangle( nLeft+n2, nTemp, nRight+n2, nTemp ) );
388cdf0e10cSrcweir i++;
389cdf0e10cSrcweir }
390cdf0e10cSrcweir if ( eType == SYMBOL_WINDEND )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX+n2, nCenterY-n2,
393cdf0e10cSrcweir nCenterX+n2, nCenterY+n2 ) );
394cdf0e10cSrcweir }
395cdf0e10cSrcweir }
396cdf0e10cSrcweir break;
397cdf0e10cSrcweir
398cdf0e10cSrcweir case SYMBOL_CLOSE:
399cdf0e10cSrcweir {
400cdf0e10cSrcweir Size aRectSize( 2, 1 );
401cdf0e10cSrcweir if ( nMin < 8 )
402cdf0e10cSrcweir aRectSize.Width() = 1;
403cdf0e10cSrcweir else if ( nMin > 20 )
404cdf0e10cSrcweir aRectSize.Width() = nMin/10;
405cdf0e10cSrcweir nLeft = nCenterX-n2+1;
406cdf0e10cSrcweir nTop = nCenterY-n2+1;
407cdf0e10cSrcweir nBottom = nCenterY-n2+nMin-aRectSize.Width()+1;
408cdf0e10cSrcweir i = 0;
409cdf0e10cSrcweir while ( i < nMin-aRectSize.Width()+1 )
410cdf0e10cSrcweir {
411cdf0e10cSrcweir pDev->DrawRect( Rectangle( Point( nLeft+i, nTop+i ), aRectSize ) );
412cdf0e10cSrcweir pDev->DrawRect( Rectangle( Point( nLeft+i, nBottom-i ), aRectSize ) );
413cdf0e10cSrcweir i++;
414cdf0e10cSrcweir }
415cdf0e10cSrcweir }
416cdf0e10cSrcweir break;
417cdf0e10cSrcweir
418cdf0e10cSrcweir case SYMBOL_ROLLUP:
419cdf0e10cSrcweir case SYMBOL_ROLLDOWN:
420cdf0e10cSrcweir {
421cdf0e10cSrcweir Rectangle aRect( nCenterX-n2, nCenterY-n2,
422cdf0e10cSrcweir nCenterX+n2, nCenterY-n2+1 );
423cdf0e10cSrcweir pDev->DrawRect( aRect );
424cdf0e10cSrcweir if ( eType == SYMBOL_ROLLDOWN )
425cdf0e10cSrcweir {
426cdf0e10cSrcweir Rectangle aTempRect = aRect;
427cdf0e10cSrcweir aTempRect.Bottom() = nCenterY+n2;
428cdf0e10cSrcweir aTempRect.Right() = aRect.Left();
429cdf0e10cSrcweir pDev->DrawRect( aTempRect );
430cdf0e10cSrcweir aTempRect.Left() = aRect.Right();
431cdf0e10cSrcweir aTempRect.Right() = aRect.Right();
432cdf0e10cSrcweir pDev->DrawRect( aTempRect );
433cdf0e10cSrcweir aTempRect.Top() = aTempRect.Bottom();
434cdf0e10cSrcweir aTempRect.Left() = aRect.Left();
435cdf0e10cSrcweir pDev->DrawRect( aTempRect );
436cdf0e10cSrcweir }
437cdf0e10cSrcweir }
438cdf0e10cSrcweir break;
439cdf0e10cSrcweir case SYMBOL_CHECKMARK:
440cdf0e10cSrcweir {
441cdf0e10cSrcweir // #106953# never mirror checkmarks
442cdf0e10cSrcweir sal_Bool bRTL = pDev->ImplHasMirroredGraphics() && pDev->IsRTLEnabled();
443cdf0e10cSrcweir Point aPos1( bRTL ? rRect.Right() : rRect.Left(),
444cdf0e10cSrcweir rRect.Bottom() - rRect.GetHeight() / 3 );
445cdf0e10cSrcweir Point aPos2( bRTL ? rRect.Right() - rRect.GetWidth()/3 : rRect.Left() + rRect.GetWidth()/3,
446cdf0e10cSrcweir rRect.Bottom() );
447cdf0e10cSrcweir Point aPos3( bRTL ? rRect.TopLeft() : rRect.TopRight() );
448cdf0e10cSrcweir Size aRectSize( 1, 2 );
449cdf0e10cSrcweir long nStepsY = aPos2.Y()-aPos1.Y();
450cdf0e10cSrcweir long nX = aPos1.X();
451cdf0e10cSrcweir long nY = aPos1.Y();
452cdf0e10cSrcweir long n;
453cdf0e10cSrcweir for ( n = 0; n <= nStepsY; n++ )
454cdf0e10cSrcweir {
455cdf0e10cSrcweir if( bRTL )
456cdf0e10cSrcweir nX--;
457cdf0e10cSrcweir pDev->DrawRect( Rectangle( Point( nX, nY++ ), aRectSize ) );
458cdf0e10cSrcweir if( !bRTL )
459cdf0e10cSrcweir nX++;
460cdf0e10cSrcweir }
461cdf0e10cSrcweir nStepsY = aPos2.Y()-aPos3.Y();
462cdf0e10cSrcweir nX = aPos2.X();
463cdf0e10cSrcweir nY = aPos2.Y();
464cdf0e10cSrcweir for ( n = 0; n <= nStepsY; n++ )
465cdf0e10cSrcweir {
466cdf0e10cSrcweir if( bRTL )
467cdf0e10cSrcweir if ( --nX < rRect.Left() )
468cdf0e10cSrcweir break;
469cdf0e10cSrcweir pDev->DrawRect( Rectangle( Point( nX, nY-- ), aRectSize ) );
470cdf0e10cSrcweir if( !bRTL )
471cdf0e10cSrcweir if ( ++nX > rRect.Right() )
472cdf0e10cSrcweir break;
473cdf0e10cSrcweir }
474cdf0e10cSrcweir }
475cdf0e10cSrcweir break;
476cdf0e10cSrcweir
477cdf0e10cSrcweir case SYMBOL_SPIN_UPDOWN:
478cdf0e10cSrcweir {
479cdf0e10cSrcweir nTop = nCenterY-n2-1;
480cdf0e10cSrcweir nBottom = nTop+n2;
481cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
482cdf0e10cSrcweir i = 1;
483cdf0e10cSrcweir while ( i <= n2 )
484cdf0e10cSrcweir {
485cdf0e10cSrcweir nTop++;
486cdf0e10cSrcweir nTemp = nCenterX-i;
487cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
488cdf0e10cSrcweir nTemp = nCenterX+i;
489cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
490cdf0e10cSrcweir i++;
491cdf0e10cSrcweir }
492cdf0e10cSrcweir nTop = nCenterY+1;
493cdf0e10cSrcweir nBottom = nTop+n2;
494cdf0e10cSrcweir pDev->DrawRect( Rectangle( nCenterX, nTop, nCenterX, nBottom ) );
495cdf0e10cSrcweir i = 1;
496cdf0e10cSrcweir while ( i <= n2 )
497cdf0e10cSrcweir {
498cdf0e10cSrcweir nBottom--;
499cdf0e10cSrcweir nTemp = nCenterX-i;
500cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
501cdf0e10cSrcweir nTemp = nCenterX+i;
502cdf0e10cSrcweir pDev->DrawRect( Rectangle( nTemp, nTop, nTemp, nBottom ) );
503cdf0e10cSrcweir i++;
504cdf0e10cSrcweir }
505cdf0e10cSrcweir }
506cdf0e10cSrcweir break;
507cdf0e10cSrcweir
508cdf0e10cSrcweir
509cdf0e10cSrcweir case SYMBOL_FLOAT:
510cdf0e10cSrcweir {
511cdf0e10cSrcweir Rectangle aRect( nCenterX-n2, nCenterY-n2+3,
512cdf0e10cSrcweir nCenterX+n2-2, nCenterY-n2+4 );
513cdf0e10cSrcweir pDev->DrawRect( aRect );
514cdf0e10cSrcweir Rectangle aTempRect = aRect;
515cdf0e10cSrcweir aTempRect.Bottom() = nCenterY+n2;
516cdf0e10cSrcweir aTempRect.Right() = aRect.Left();
517cdf0e10cSrcweir pDev->DrawRect( aTempRect );
518cdf0e10cSrcweir aTempRect.Left() = aRect.Right();
519cdf0e10cSrcweir aTempRect.Right() = aRect.Right();
520cdf0e10cSrcweir pDev->DrawRect( aTempRect );
521cdf0e10cSrcweir aTempRect.Top() = aTempRect.Bottom();
522cdf0e10cSrcweir aTempRect.Left() = aRect.Left();
523cdf0e10cSrcweir pDev->DrawRect( aTempRect );
524cdf0e10cSrcweir aRect = Rectangle( nCenterX-n2+2, nCenterY-n2,
525cdf0e10cSrcweir nCenterX+n2, nCenterY-n2+1 );
526cdf0e10cSrcweir pDev->DrawRect( aRect );
527cdf0e10cSrcweir aTempRect = aRect;
528cdf0e10cSrcweir aTempRect.Bottom() = nCenterY+n2-3;
529cdf0e10cSrcweir aTempRect.Right() = aRect.Left();
530cdf0e10cSrcweir pDev->DrawRect( aTempRect );
531cdf0e10cSrcweir aTempRect.Left() = aRect.Right();
532cdf0e10cSrcweir aTempRect.Right() = aRect.Right();
533cdf0e10cSrcweir pDev->DrawRect( aTempRect );
534cdf0e10cSrcweir aTempRect.Top() = aTempRect.Bottom();
535cdf0e10cSrcweir aTempRect.Left() = aRect.Left();
536cdf0e10cSrcweir pDev->DrawRect( aTempRect );
537cdf0e10cSrcweir }
538cdf0e10cSrcweir break;
539cdf0e10cSrcweir case SYMBOL_DOCK:
540cdf0e10cSrcweir {
541cdf0e10cSrcweir Rectangle aRect( nCenterX-n2, nCenterY-n2,
542cdf0e10cSrcweir nCenterX+n2, nCenterY-n2 );
543cdf0e10cSrcweir pDev->DrawRect( aRect );
544cdf0e10cSrcweir Rectangle aTempRect = aRect;
545cdf0e10cSrcweir aTempRect.Bottom() = nCenterY+n2;
546cdf0e10cSrcweir aTempRect.Right() = aRect.Left();
547cdf0e10cSrcweir pDev->DrawRect( aTempRect );
548cdf0e10cSrcweir aTempRect.Left() = aRect.Right();
549cdf0e10cSrcweir aTempRect.Right() = aRect.Right();
550cdf0e10cSrcweir pDev->DrawRect( aTempRect );
551cdf0e10cSrcweir aTempRect.Top() = aTempRect.Bottom();
552cdf0e10cSrcweir aTempRect.Left() = aRect.Left();
553cdf0e10cSrcweir pDev->DrawRect( aTempRect );
554cdf0e10cSrcweir }
555cdf0e10cSrcweir break;
556cdf0e10cSrcweir case SYMBOL_HIDE:
557cdf0e10cSrcweir {
558cdf0e10cSrcweir long nExtra = nMin / 8;
559cdf0e10cSrcweir Rectangle aRect( nCenterX-n2+nExtra, nCenterY+n2-1,
560cdf0e10cSrcweir nCenterX+n2-nExtra, nCenterY+n2 );
561cdf0e10cSrcweir pDev->DrawRect( aRect );
562cdf0e10cSrcweir }
563cdf0e10cSrcweir break;
564cdf0e10cSrcweir }
565cdf0e10cSrcweir }
566cdf0e10cSrcweir
567cdf0e10cSrcweir // -----------------------------------------------------------------------
568cdf0e10cSrcweir
DrawSymbol(const Rectangle & rRect,SymbolType eType,const Color & rColor,sal_uInt16 nStyle)569cdf0e10cSrcweir void DecorationView::DrawSymbol( const Rectangle& rRect, SymbolType eType,
570cdf0e10cSrcweir const Color& rColor, sal_uInt16 nStyle )
571cdf0e10cSrcweir {
572cdf0e10cSrcweir const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
573cdf0e10cSrcweir Rectangle aRect = mpOutDev->LogicToPixel( rRect );
574cdf0e10cSrcweir Color aOldLineColor = mpOutDev->GetLineColor();
575cdf0e10cSrcweir Color aOldFillColor = mpOutDev->GetFillColor();
576cdf0e10cSrcweir sal_Bool bOldMapMode = mpOutDev->IsMapModeEnabled();
577cdf0e10cSrcweir mpOutDev->SetLineColor();
578cdf0e10cSrcweir mpOutDev->SetFillColor( rColor );
579cdf0e10cSrcweir mpOutDev->EnableMapMode( sal_False );
580cdf0e10cSrcweir
581cdf0e10cSrcweir if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
582cdf0e10cSrcweir (mpOutDev->GetOutDevType() == OUTDEV_PRINTER) )
583cdf0e10cSrcweir nStyle |= BUTTON_DRAW_MONO;
584cdf0e10cSrcweir
585cdf0e10cSrcweir if ( nStyle & SYMBOL_DRAW_MONO )
586cdf0e10cSrcweir {
587cdf0e10cSrcweir if ( nStyle & SYMBOL_DRAW_DISABLE )
588cdf0e10cSrcweir mpOutDev->SetFillColor( Color( COL_GRAY ) );
589cdf0e10cSrcweir else
590cdf0e10cSrcweir mpOutDev->SetFillColor( Color( COL_BLACK ) );
591cdf0e10cSrcweir }
592cdf0e10cSrcweir else
593cdf0e10cSrcweir {
594cdf0e10cSrcweir if ( nStyle & SYMBOL_DRAW_DISABLE )
595cdf0e10cSrcweir {
596cdf0e10cSrcweir // Als Embosed ausgeben
597cdf0e10cSrcweir mpOutDev->SetFillColor( rStyleSettings.GetLightColor() );
598cdf0e10cSrcweir Rectangle aTempRect = aRect;
599cdf0e10cSrcweir aTempRect.Move( 1, 1 );
600cdf0e10cSrcweir ImplDrawSymbol( mpOutDev, aTempRect, eType );
601cdf0e10cSrcweir mpOutDev->SetFillColor( rStyleSettings.GetShadowColor() );
602cdf0e10cSrcweir }
603cdf0e10cSrcweir else
604cdf0e10cSrcweir mpOutDev->SetFillColor( rColor );
605cdf0e10cSrcweir }
606cdf0e10cSrcweir
607cdf0e10cSrcweir ImplDrawSymbol( mpOutDev, aRect, eType );
608cdf0e10cSrcweir
609cdf0e10cSrcweir mpOutDev->SetLineColor( aOldLineColor );
610cdf0e10cSrcweir mpOutDev->SetFillColor( aOldFillColor );
611cdf0e10cSrcweir mpOutDev->EnableMapMode( bOldMapMode );
612cdf0e10cSrcweir }
613cdf0e10cSrcweir
614cdf0e10cSrcweir // =======================================================================
615cdf0e10cSrcweir
DrawFrame(const Rectangle & rRect,const Color & rLeftTopColor,const Color & rRightBottomColor)616cdf0e10cSrcweir void DecorationView::DrawFrame( const Rectangle& rRect,
617cdf0e10cSrcweir const Color& rLeftTopColor,
618cdf0e10cSrcweir const Color& rRightBottomColor )
619cdf0e10cSrcweir {
620cdf0e10cSrcweir Rectangle aRect = mpOutDev->LogicToPixel( rRect );
621cdf0e10cSrcweir Color aOldLineColor = mpOutDev->GetLineColor();
622cdf0e10cSrcweir Color aOldFillColor = mpOutDev->GetFillColor();
623cdf0e10cSrcweir sal_Bool bOldMapMode = mpOutDev->IsMapModeEnabled();
624cdf0e10cSrcweir mpOutDev->EnableMapMode( sal_False );
625cdf0e10cSrcweir mpOutDev->SetLineColor();
626cdf0e10cSrcweir mpOutDev->ImplDraw2ColorFrame( aRect, rLeftTopColor, rRightBottomColor );
627cdf0e10cSrcweir mpOutDev->SetLineColor( aOldLineColor );
628cdf0e10cSrcweir mpOutDev->SetFillColor( aOldFillColor );
629cdf0e10cSrcweir mpOutDev->EnableMapMode( bOldMapMode );
630cdf0e10cSrcweir }
631cdf0e10cSrcweir
632cdf0e10cSrcweir // =======================================================================
633cdf0e10cSrcweir
DrawHighlightFrame(const Rectangle & rRect,sal_uInt16 nStyle)634cdf0e10cSrcweir void DecorationView::DrawHighlightFrame( const Rectangle& rRect,
635cdf0e10cSrcweir sal_uInt16 nStyle )
636cdf0e10cSrcweir {
637cdf0e10cSrcweir const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
638cdf0e10cSrcweir Color aLightColor = rStyleSettings.GetLightColor();
639cdf0e10cSrcweir Color aShadowColor = rStyleSettings.GetShadowColor();
640cdf0e10cSrcweir
641cdf0e10cSrcweir if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
642cdf0e10cSrcweir (mpOutDev->GetOutDevType() == OUTDEV_PRINTER) )
643cdf0e10cSrcweir {
644cdf0e10cSrcweir aLightColor = Color( COL_BLACK );
645cdf0e10cSrcweir aShadowColor = Color( COL_BLACK );
646cdf0e10cSrcweir }
647cdf0e10cSrcweir else if ( nStyle & FRAME_HIGHLIGHT_TESTBACKGROUND )
648cdf0e10cSrcweir {
649cdf0e10cSrcweir Wallpaper aBackground = mpOutDev->GetBackground();
650cdf0e10cSrcweir if ( aBackground.IsBitmap() || aBackground.IsGradient() )
651cdf0e10cSrcweir {
652cdf0e10cSrcweir aLightColor = rStyleSettings.GetFaceColor();
653cdf0e10cSrcweir aShadowColor = Color( COL_BLACK );
654cdf0e10cSrcweir }
655cdf0e10cSrcweir else
656cdf0e10cSrcweir {
657cdf0e10cSrcweir Color aBackColor = aBackground.GetColor();
658cdf0e10cSrcweir if ( (aLightColor.GetColorError( aBackColor ) < 32) ||
659cdf0e10cSrcweir (aShadowColor.GetColorError( aBackColor ) < 32) )
660cdf0e10cSrcweir {
661cdf0e10cSrcweir aLightColor = Color( COL_WHITE );
662cdf0e10cSrcweir aShadowColor = Color( COL_BLACK );
663cdf0e10cSrcweir
664cdf0e10cSrcweir if ( aLightColor.GetColorError( aBackColor ) < 32 )
665cdf0e10cSrcweir aLightColor.DecreaseLuminance( 64 );
666cdf0e10cSrcweir if ( aShadowColor.GetColorError( aBackColor ) < 32 )
667cdf0e10cSrcweir aShadowColor.IncreaseLuminance( 64 );
668cdf0e10cSrcweir }
669cdf0e10cSrcweir }
670cdf0e10cSrcweir }
671cdf0e10cSrcweir
672cdf0e10cSrcweir if ( (nStyle & FRAME_HIGHLIGHT_STYLE) == FRAME_HIGHLIGHT_IN )
673cdf0e10cSrcweir {
674cdf0e10cSrcweir Color aTempColor = aLightColor;
675cdf0e10cSrcweir aLightColor = aShadowColor;
676cdf0e10cSrcweir aShadowColor = aTempColor;
677cdf0e10cSrcweir }
678cdf0e10cSrcweir
679cdf0e10cSrcweir DrawFrame( rRect, aLightColor, aShadowColor );
680cdf0e10cSrcweir }
681cdf0e10cSrcweir
682cdf0e10cSrcweir // =======================================================================
683cdf0e10cSrcweir
ImplDrawDPILineRect(OutputDevice * pDev,Rectangle & rRect,const Color * pColor,sal_Bool bRound=sal_False)684cdf0e10cSrcweir static void ImplDrawDPILineRect( OutputDevice* pDev, Rectangle& rRect,
685cdf0e10cSrcweir const Color* pColor, sal_Bool bRound = sal_False )
686cdf0e10cSrcweir {
687cdf0e10cSrcweir long nLineWidth = pDev->ImplGetDPIX()/300;
688cdf0e10cSrcweir long nLineHeight = pDev->ImplGetDPIY()/300;
689cdf0e10cSrcweir if ( !nLineWidth )
690cdf0e10cSrcweir nLineWidth = 1;
691cdf0e10cSrcweir if ( !nLineHeight )
692cdf0e10cSrcweir nLineHeight = 1;
693cdf0e10cSrcweir
694cdf0e10cSrcweir if ( pColor )
695cdf0e10cSrcweir {
696cdf0e10cSrcweir if ( (nLineWidth == 1) && (nLineHeight == 1) )
697cdf0e10cSrcweir {
698cdf0e10cSrcweir pDev->SetLineColor( *pColor );
699cdf0e10cSrcweir pDev->SetFillColor();
700cdf0e10cSrcweir if( bRound )
701cdf0e10cSrcweir {
702cdf0e10cSrcweir pDev->DrawLine( Point( rRect.Left()+1, rRect.Top()), Point( rRect.Right()-1, rRect.Top()) );
703cdf0e10cSrcweir pDev->DrawLine( Point( rRect.Left()+1, rRect.Bottom()), Point( rRect.Right()-1, rRect.Bottom()) );
704cdf0e10cSrcweir pDev->DrawLine( Point( rRect.Left(), rRect.Top()+1), Point( rRect.Left(), rRect.Bottom()-1) );
705cdf0e10cSrcweir pDev->DrawLine( Point( rRect.Right(), rRect.Top()+1), Point( rRect.Right(), rRect.Bottom()-1) );
706cdf0e10cSrcweir }
707cdf0e10cSrcweir else
708cdf0e10cSrcweir pDev->DrawRect( rRect );
709cdf0e10cSrcweir }
710cdf0e10cSrcweir else
711cdf0e10cSrcweir {
712cdf0e10cSrcweir long nWidth = rRect.GetWidth();
713cdf0e10cSrcweir long nHeight = rRect.GetHeight();
714cdf0e10cSrcweir pDev->SetLineColor();
715cdf0e10cSrcweir pDev->SetFillColor( *pColor );
716cdf0e10cSrcweir pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nWidth, nLineHeight ) ) );
717cdf0e10cSrcweir pDev->DrawRect( Rectangle( rRect.TopLeft(), Size( nLineWidth, nHeight ) ) );
718cdf0e10cSrcweir pDev->DrawRect( Rectangle( Point( rRect.Left(), rRect.Bottom()-nLineHeight ),
719cdf0e10cSrcweir Size( nWidth, nLineHeight ) ) );
720cdf0e10cSrcweir pDev->DrawRect( Rectangle( Point( rRect.Right()-nLineWidth, rRect.Top() ),
721cdf0e10cSrcweir Size( nLineWidth, nHeight ) ) );
722cdf0e10cSrcweir }
723cdf0e10cSrcweir }
724cdf0e10cSrcweir
725cdf0e10cSrcweir rRect.Left() += nLineWidth;
726cdf0e10cSrcweir rRect.Top() += nLineHeight;
727cdf0e10cSrcweir rRect.Right() -= nLineWidth;
728cdf0e10cSrcweir rRect.Bottom() -= nLineHeight;
729cdf0e10cSrcweir }
730cdf0e10cSrcweir
731cdf0e10cSrcweir // =======================================================================
732cdf0e10cSrcweir
ImplDrawFrame(OutputDevice * pDev,Rectangle & rRect,const StyleSettings & rStyleSettings,sal_uInt16 nStyle)733cdf0e10cSrcweir static void ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect,
734cdf0e10cSrcweir const StyleSettings& rStyleSettings, sal_uInt16 nStyle )
735cdf0e10cSrcweir {
736cdf0e10cSrcweir // mask menu style
737cdf0e10cSrcweir sal_Bool bMenuStyle = (nStyle & FRAME_DRAW_MENU) ? sal_True : sal_False;
738cdf0e10cSrcweir nStyle &= ~FRAME_DRAW_MENU;
739cdf0e10cSrcweir
740cdf0e10cSrcweir Window *pWin = NULL;
741cdf0e10cSrcweir if( pDev->GetOutDevType() == OUTDEV_WINDOW )
742cdf0e10cSrcweir pWin = (Window*) pDev;
743cdf0e10cSrcweir
744cdf0e10cSrcweir // UseFlatBorders disables 3D style for all frames except menus
745cdf0e10cSrcweir // menus may use different border colors (eg on XP)
746cdf0e10cSrcweir // normal frames will be drawn using the shadow color
747cdf0e10cSrcweir // whereas window frame borders will use black
748cdf0e10cSrcweir sal_Bool bFlatBorders = ( !bMenuStyle && rStyleSettings.GetUseFlatBorders() );
749cdf0e10cSrcweir
750cdf0e10cSrcweir // no flat borders for standard VCL controls (ie formcontrols that keep their classic look)
751cdf0e10cSrcweir // will not affect frame windows (like dropdowns)
752cdf0e10cSrcweir if( bFlatBorders && pWin && pWin->GetType() == WINDOW_BORDERWINDOW && (pWin != pWin->ImplGetFrameWindow()) )
753cdf0e10cSrcweir {
754cdf0e10cSrcweir // check for formcontrol, i.e., a control without NWF enabled
755cdf0e10cSrcweir Control *pControl = dynamic_cast< Control* >( pWin->GetWindow( WINDOW_CLIENT ) );
756cdf0e10cSrcweir if( pControl && pControl->IsNativeWidgetEnabled() )
757cdf0e10cSrcweir bFlatBorders = sal_True;
758cdf0e10cSrcweir else
759cdf0e10cSrcweir bFlatBorders = sal_False;
760cdf0e10cSrcweir }
761cdf0e10cSrcweir
762cdf0e10cSrcweir // no round corners for window frame borders
763cdf0e10cSrcweir sal_Bool bRound = (bFlatBorders && !(nStyle & FRAME_DRAW_WINDOWBORDER));
764cdf0e10cSrcweir
765cdf0e10cSrcweir if ( (rStyleSettings.GetOptions() & STYLE_OPTION_MONO) ||
766cdf0e10cSrcweir (pDev->GetOutDevType() == OUTDEV_PRINTER) ||
767cdf0e10cSrcweir bFlatBorders )
768cdf0e10cSrcweir nStyle |= FRAME_DRAW_MONO;
769cdf0e10cSrcweir
770cdf0e10cSrcweir if ( nStyle & FRAME_DRAW_NODRAW )
771cdf0e10cSrcweir {
772cdf0e10cSrcweir sal_uInt16 nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : nStyle;
773cdf0e10cSrcweir if( pWin->GetType() == WINDOW_BORDERWINDOW )
774cdf0e10cSrcweir nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER;
775cdf0e10cSrcweir ImplControlValue aControlValue( nValueStyle );
776cdf0e10cSrcweir Rectangle aBound, aContent;
777cdf0e10cSrcweir Rectangle aNatRgn( rRect );
778cdf0e10cSrcweir if(pWin && pWin->GetNativeControlRegion(CTRL_FRAME, PART_BORDER,
779cdf0e10cSrcweir aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) )
780cdf0e10cSrcweir {
781cdf0e10cSrcweir rRect = aContent;
782cdf0e10cSrcweir }
783cdf0e10cSrcweir else if ( nStyle & FRAME_DRAW_MONO )
784cdf0e10cSrcweir ImplDrawDPILineRect( pDev, rRect, NULL, bRound );
785cdf0e10cSrcweir else
786cdf0e10cSrcweir {
787cdf0e10cSrcweir sal_uInt16 nFrameStyle = nStyle & FRAME_DRAW_STYLE;
788cdf0e10cSrcweir
789cdf0e10cSrcweir if ( nFrameStyle == FRAME_DRAW_GROUP )
790cdf0e10cSrcweir {
791cdf0e10cSrcweir rRect.Left() += 2;
792cdf0e10cSrcweir rRect.Top() += 2;
793cdf0e10cSrcweir rRect.Right() -= 2;
794cdf0e10cSrcweir rRect.Bottom() -= 2;
795cdf0e10cSrcweir }
796cdf0e10cSrcweir else if ( (nFrameStyle == FRAME_DRAW_IN) ||
797cdf0e10cSrcweir (nFrameStyle == FRAME_DRAW_OUT) )
798cdf0e10cSrcweir {
799cdf0e10cSrcweir rRect.Left()++;
800cdf0e10cSrcweir rRect.Top()++;
801cdf0e10cSrcweir rRect.Right()--;
802cdf0e10cSrcweir rRect.Bottom()--;
803cdf0e10cSrcweir }
804cdf0e10cSrcweir else // FRAME_DRAW_DOUBLEIN || FRAME_DRAW_DOUBLEOUT
805cdf0e10cSrcweir {
806cdf0e10cSrcweir rRect.Left() += 2;
807cdf0e10cSrcweir rRect.Top() += 2;
808cdf0e10cSrcweir rRect.Right() -= 2;
809cdf0e10cSrcweir rRect.Bottom() -= 2;
810cdf0e10cSrcweir }
811cdf0e10cSrcweir }
812cdf0e10cSrcweir }
813cdf0e10cSrcweir else
814cdf0e10cSrcweir {
815cdf0e10cSrcweir if( pWin && pWin->IsNativeControlSupported(CTRL_FRAME, PART_BORDER) )
816cdf0e10cSrcweir {
817cdf0e10cSrcweir sal_uInt16 nValueStyle = bMenuStyle ? nStyle | FRAME_DRAW_MENU : nStyle;
818cdf0e10cSrcweir if( pWin->GetType() == WINDOW_BORDERWINDOW )
819cdf0e10cSrcweir nValueStyle |= FRAME_DRAW_BORDERWINDOWBORDER;
820cdf0e10cSrcweir ImplControlValue aControlValue( nValueStyle );
821cdf0e10cSrcweir Rectangle aBound, aContent;
822cdf0e10cSrcweir Rectangle aNatRgn( rRect );
823cdf0e10cSrcweir if( pWin->GetNativeControlRegion(CTRL_FRAME, PART_BORDER,
824cdf0e10cSrcweir aNatRgn, 0, aControlValue, rtl::OUString(), aBound, aContent) )
825cdf0e10cSrcweir {
826cdf0e10cSrcweir if( pWin->DrawNativeControl( CTRL_FRAME, PART_BORDER, aContent, CTRL_STATE_ENABLED,
827cdf0e10cSrcweir aControlValue, rtl::OUString()) )
828cdf0e10cSrcweir {
829cdf0e10cSrcweir rRect = aContent;
830cdf0e10cSrcweir return;
831cdf0e10cSrcweir }
832cdf0e10cSrcweir }
833cdf0e10cSrcweir }
834cdf0e10cSrcweir
835cdf0e10cSrcweir if ( nStyle & FRAME_DRAW_MONO )
836cdf0e10cSrcweir {
837cdf0e10cSrcweir Color aColor = bRound ? rStyleSettings.GetShadowColor()
838cdf0e10cSrcweir : pDev->GetSettings().GetStyleSettings().GetMonoColor();
839cdf0e10cSrcweir // when the MonoColor wasn't set, check face color
840cdf0e10cSrcweir if (
841cdf0e10cSrcweir (bRound && aColor.IsDark()) ||
842cdf0e10cSrcweir (
843cdf0e10cSrcweir (aColor == Color(COL_BLACK)) &&
844cdf0e10cSrcweir (pDev->GetSettings().GetStyleSettings().GetFaceColor().IsDark())
845cdf0e10cSrcweir )
846cdf0e10cSrcweir )
847cdf0e10cSrcweir {
848cdf0e10cSrcweir aColor = Color( COL_WHITE );
849cdf0e10cSrcweir }
850cdf0e10cSrcweir ImplDrawDPILineRect( pDev, rRect, &aColor, bRound );
851cdf0e10cSrcweir }
852cdf0e10cSrcweir else
853cdf0e10cSrcweir {
854cdf0e10cSrcweir sal_uInt16 nFrameStyle = nStyle & FRAME_DRAW_STYLE;
855cdf0e10cSrcweir if ( nFrameStyle == FRAME_DRAW_GROUP )
856cdf0e10cSrcweir {
857cdf0e10cSrcweir pDev->SetFillColor();
858cdf0e10cSrcweir pDev->SetLineColor( rStyleSettings.GetLightColor() );
859cdf0e10cSrcweir rRect.Top()++;
860cdf0e10cSrcweir rRect.Left()++;
861cdf0e10cSrcweir pDev->DrawRect( rRect );
862cdf0e10cSrcweir rRect.Top()--;
863cdf0e10cSrcweir rRect.Left()--;
864cdf0e10cSrcweir pDev->SetLineColor( rStyleSettings.GetShadowColor() );
865cdf0e10cSrcweir rRect.Right()--;
866cdf0e10cSrcweir rRect.Bottom()--;
867cdf0e10cSrcweir pDev->DrawRect( rRect );
868cdf0e10cSrcweir rRect.Right()++;
869cdf0e10cSrcweir rRect.Bottom()++;
870cdf0e10cSrcweir }
871cdf0e10cSrcweir else
872cdf0e10cSrcweir {
873cdf0e10cSrcweir pDev->SetLineColor();
874cdf0e10cSrcweir
875cdf0e10cSrcweir if ( (nFrameStyle == FRAME_DRAW_IN) ||
876cdf0e10cSrcweir (nFrameStyle == FRAME_DRAW_OUT) )
877cdf0e10cSrcweir {
878cdf0e10cSrcweir if ( nFrameStyle == FRAME_DRAW_IN )
879cdf0e10cSrcweir {
880cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
881cdf0e10cSrcweir rStyleSettings.GetShadowColor(),
882cdf0e10cSrcweir rStyleSettings.GetLightColor() );
883cdf0e10cSrcweir }
884cdf0e10cSrcweir else
885cdf0e10cSrcweir {
886cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
887cdf0e10cSrcweir rStyleSettings.GetLightColor(),
888cdf0e10cSrcweir rStyleSettings.GetShadowColor() );
889cdf0e10cSrcweir }
890cdf0e10cSrcweir
891cdf0e10cSrcweir rRect.Left()++;
892cdf0e10cSrcweir rRect.Top()++;
893cdf0e10cSrcweir rRect.Right()--;
894cdf0e10cSrcweir rRect.Bottom()--;
895cdf0e10cSrcweir }
896cdf0e10cSrcweir else // FRAME_DRAW_DOUBLEIN || FRAME_DRAW_DOUBLEOUT
897cdf0e10cSrcweir {
898cdf0e10cSrcweir if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
899cdf0e10cSrcweir {
900cdf0e10cSrcweir if( bFlatBorders ) // no 3d effect
901cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
902cdf0e10cSrcweir rStyleSettings.GetShadowColor(),
903cdf0e10cSrcweir rStyleSettings.GetShadowColor() );
904cdf0e10cSrcweir else
905cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
906cdf0e10cSrcweir rStyleSettings.GetShadowColor(),
907cdf0e10cSrcweir rStyleSettings.GetLightColor() );
908cdf0e10cSrcweir }
909cdf0e10cSrcweir else
910cdf0e10cSrcweir {
911cdf0e10cSrcweir if( bMenuStyle )
912cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
913cdf0e10cSrcweir rStyleSettings.GetMenuBorderColor(),
914cdf0e10cSrcweir rStyleSettings.GetDarkShadowColor() );
915cdf0e10cSrcweir else
916cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
917cdf0e10cSrcweir bFlatBorders ? // no 3d effect
918cdf0e10cSrcweir rStyleSettings.GetDarkShadowColor() :
919cdf0e10cSrcweir rStyleSettings.GetLightBorderColor(),
920cdf0e10cSrcweir rStyleSettings.GetDarkShadowColor() );
921cdf0e10cSrcweir
922cdf0e10cSrcweir }
923cdf0e10cSrcweir
924cdf0e10cSrcweir rRect.Left()++;
925cdf0e10cSrcweir rRect.Top()++;
926cdf0e10cSrcweir rRect.Right()--;
927cdf0e10cSrcweir rRect.Bottom()--;
928cdf0e10cSrcweir
929cdf0e10cSrcweir sal_Bool bDrawn = sal_True;
930cdf0e10cSrcweir if ( nFrameStyle == FRAME_DRAW_DOUBLEIN )
931cdf0e10cSrcweir {
932cdf0e10cSrcweir if( bFlatBorders ) // no 3d effect
933cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
934cdf0e10cSrcweir rStyleSettings.GetFaceColor(),
935cdf0e10cSrcweir rStyleSettings.GetFaceColor() );
936cdf0e10cSrcweir else
937cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
938cdf0e10cSrcweir rStyleSettings.GetDarkShadowColor(),
939cdf0e10cSrcweir rStyleSettings.GetLightBorderColor() );
940cdf0e10cSrcweir }
941cdf0e10cSrcweir else
942cdf0e10cSrcweir {
943cdf0e10cSrcweir // flat menues have no shadow border
944cdf0e10cSrcweir if( !bMenuStyle || !rStyleSettings.GetUseFlatMenues() )
945cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( rRect,
946cdf0e10cSrcweir rStyleSettings.GetLightColor(),
947cdf0e10cSrcweir rStyleSettings.GetShadowColor() );
948cdf0e10cSrcweir else
949cdf0e10cSrcweir bDrawn = sal_False;
950cdf0e10cSrcweir }
951cdf0e10cSrcweir if( bDrawn )
952cdf0e10cSrcweir {
953cdf0e10cSrcweir rRect.Left()++;
954cdf0e10cSrcweir rRect.Top()++;
955cdf0e10cSrcweir rRect.Right()--;
956cdf0e10cSrcweir rRect.Bottom()--;
957cdf0e10cSrcweir }
958cdf0e10cSrcweir }
959cdf0e10cSrcweir }
960cdf0e10cSrcweir }
961cdf0e10cSrcweir }
962cdf0e10cSrcweir }
963cdf0e10cSrcweir
964cdf0e10cSrcweir // -----------------------------------------------------------------------
965cdf0e10cSrcweir
DrawFrame(const Rectangle & rRect,sal_uInt16 nStyle)966cdf0e10cSrcweir Rectangle DecorationView::DrawFrame( const Rectangle& rRect, sal_uInt16 nStyle )
967cdf0e10cSrcweir {
968cdf0e10cSrcweir Rectangle aRect = rRect;
969cdf0e10cSrcweir sal_Bool bOldMap = mpOutDev->IsMapModeEnabled();
970cdf0e10cSrcweir if ( bOldMap )
971cdf0e10cSrcweir {
972cdf0e10cSrcweir aRect = mpOutDev->LogicToPixel( aRect );
973cdf0e10cSrcweir mpOutDev->EnableMapMode( sal_False );
974cdf0e10cSrcweir }
975cdf0e10cSrcweir
976cdf0e10cSrcweir if ( !rRect.IsEmpty() )
977cdf0e10cSrcweir {
978cdf0e10cSrcweir if ( nStyle & FRAME_DRAW_NODRAW )
979cdf0e10cSrcweir ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle );
980cdf0e10cSrcweir else
981cdf0e10cSrcweir {
982cdf0e10cSrcweir Color maOldLineColor = mpOutDev->GetLineColor();
983cdf0e10cSrcweir Color maOldFillColor = mpOutDev->GetFillColor();
984cdf0e10cSrcweir ImplDrawFrame( mpOutDev, aRect, mpOutDev->GetSettings().GetStyleSettings(), nStyle );
985cdf0e10cSrcweir mpOutDev->SetLineColor( maOldLineColor );
986cdf0e10cSrcweir mpOutDev->SetFillColor( maOldFillColor );
987cdf0e10cSrcweir }
988cdf0e10cSrcweir }
989cdf0e10cSrcweir
990cdf0e10cSrcweir if ( bOldMap )
991cdf0e10cSrcweir {
992cdf0e10cSrcweir mpOutDev->EnableMapMode( bOldMap );
993cdf0e10cSrcweir aRect = mpOutDev->PixelToLogic( aRect );
994cdf0e10cSrcweir }
995cdf0e10cSrcweir
996cdf0e10cSrcweir return aRect;
997cdf0e10cSrcweir }
998cdf0e10cSrcweir
999cdf0e10cSrcweir // =======================================================================
1000cdf0e10cSrcweir
ImplDrawButton(OutputDevice * pDev,Rectangle & rRect,const StyleSettings & rStyleSettings,sal_uInt16 nStyle)1001cdf0e10cSrcweir static void ImplDrawButton( OutputDevice* pDev, Rectangle& rRect,
1002cdf0e10cSrcweir const StyleSettings& rStyleSettings, sal_uInt16 nStyle )
1003cdf0e10cSrcweir {
1004cdf0e10cSrcweir Rectangle aFillRect = rRect;
1005cdf0e10cSrcweir
1006cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_MONO )
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir if ( !(nStyle & BUTTON_DRAW_NODRAW) )
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir Color aBlackColor( COL_BLACK );
1011cdf0e10cSrcweir
1012cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_DEFAULT )
1013cdf0e10cSrcweir ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
1014cdf0e10cSrcweir
1015cdf0e10cSrcweir ImplDrawDPILineRect( pDev, aFillRect, &aBlackColor );
1016cdf0e10cSrcweir
1017cdf0e10cSrcweir Size aBrdSize( 1, 1 );
1018cdf0e10cSrcweir if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
1019cdf0e10cSrcweir {
1020cdf0e10cSrcweir MapMode aResMapMode( MAP_100TH_MM );
1021cdf0e10cSrcweir aBrdSize = pDev->LogicToPixel( Size( 20, 20 ), aResMapMode );
1022cdf0e10cSrcweir if ( !aBrdSize.Width() )
1023cdf0e10cSrcweir aBrdSize.Width() = 1;
1024cdf0e10cSrcweir if ( !aBrdSize.Height() )
1025cdf0e10cSrcweir aBrdSize.Height() = 1;
1026cdf0e10cSrcweir }
1027cdf0e10cSrcweir pDev->SetLineColor();
1028cdf0e10cSrcweir pDev->SetFillColor( aBlackColor );
1029cdf0e10cSrcweir Rectangle aRect1;
1030cdf0e10cSrcweir Rectangle aRect2;
1031cdf0e10cSrcweir aRect1.Left() = aFillRect.Left();
1032cdf0e10cSrcweir aRect1.Right() = aFillRect.Right(),
1033cdf0e10cSrcweir aRect2.Top() = aFillRect.Top();
1034cdf0e10cSrcweir aRect2.Bottom() = aFillRect.Bottom();
1035cdf0e10cSrcweir if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
1036cdf0e10cSrcweir {
1037cdf0e10cSrcweir aRect1.Top() = aFillRect.Top();
1038cdf0e10cSrcweir aRect1.Bottom() = aBrdSize.Height()-1;
1039cdf0e10cSrcweir aRect2.Left() = aFillRect.Left();
1040cdf0e10cSrcweir aRect2.Right() = aFillRect.Left()+aBrdSize.Width()-1;
1041cdf0e10cSrcweir aFillRect.Left() += aBrdSize.Width();
1042cdf0e10cSrcweir aFillRect.Top() += aBrdSize.Height();
1043cdf0e10cSrcweir }
1044cdf0e10cSrcweir else
1045cdf0e10cSrcweir {
1046cdf0e10cSrcweir aRect1.Top() = aFillRect.Bottom()-aBrdSize.Height()+1;
1047cdf0e10cSrcweir aRect1.Bottom() = aFillRect.Bottom();
1048cdf0e10cSrcweir aRect2.Left() = aFillRect.Right()-aBrdSize.Width()+1;
1049cdf0e10cSrcweir aRect2.Right() = aFillRect.Right(),
1050cdf0e10cSrcweir aFillRect.Right() -= aBrdSize.Width();
1051cdf0e10cSrcweir aFillRect.Bottom() -= aBrdSize.Height();
1052cdf0e10cSrcweir }
1053cdf0e10cSrcweir pDev->DrawRect( aRect1 );
1054cdf0e10cSrcweir pDev->DrawRect( aRect2 );
1055cdf0e10cSrcweir }
1056cdf0e10cSrcweir }
1057cdf0e10cSrcweir else
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir if ( !(nStyle & BUTTON_DRAW_NODRAW) )
1060cdf0e10cSrcweir {
1061cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_DEFAULT )
1062cdf0e10cSrcweir {
1063cdf0e10cSrcweir Color aDefBtnColor = rStyleSettings.GetDarkShadowColor();
1064cdf0e10cSrcweir ImplDrawDPILineRect( pDev, aFillRect, &aDefBtnColor );
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir
1068cdf0e10cSrcweir if ( !(nStyle & BUTTON_DRAW_NODRAW) )
1069cdf0e10cSrcweir {
1070cdf0e10cSrcweir pDev->SetLineColor();
1071cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
1072cdf0e10cSrcweir {
1073cdf0e10cSrcweir pDev->SetFillColor( rStyleSettings.GetLightBorderColor() );
1074cdf0e10cSrcweir pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
1075cdf0e10cSrcweir aFillRect.Left(), aFillRect.Bottom() ) );
1076cdf0e10cSrcweir aFillRect.Left()++;
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir if ( (nStyle & BUTTON_DRAW_NOTOPLIGHTBORDER) &&
1079cdf0e10cSrcweir !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED)) )
1080cdf0e10cSrcweir {
1081cdf0e10cSrcweir pDev->SetFillColor( rStyleSettings.GetLightBorderColor() );
1082cdf0e10cSrcweir pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Top(),
1083cdf0e10cSrcweir aFillRect.Right(), aFillRect.Top() ) );
1084cdf0e10cSrcweir aFillRect.Top()++;
1085cdf0e10cSrcweir }
1086cdf0e10cSrcweir if ( (( (nStyle & BUTTON_DRAW_NOBOTTOMSHADOWBORDER) | BUTTON_DRAW_FLAT) == (BUTTON_DRAW_NOBOTTOMSHADOWBORDER | BUTTON_DRAW_FLAT)) &&
1087cdf0e10cSrcweir !(nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED | BUTTON_DRAW_HIGHLIGHT)) )
1088cdf0e10cSrcweir {
1089cdf0e10cSrcweir pDev->SetFillColor( rStyleSettings.GetDarkShadowColor() );
1090cdf0e10cSrcweir pDev->DrawRect( Rectangle( aFillRect.Left(), aFillRect.Bottom(),
1091cdf0e10cSrcweir aFillRect.Right(), aFillRect.Bottom() ) );
1092cdf0e10cSrcweir aFillRect.Bottom()--;
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir
1095cdf0e10cSrcweir Color aColor1;
1096cdf0e10cSrcweir Color aColor2;
1097cdf0e10cSrcweir if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
1098cdf0e10cSrcweir {
1099cdf0e10cSrcweir aColor1 = rStyleSettings.GetDarkShadowColor();
1100cdf0e10cSrcweir aColor2 = rStyleSettings.GetLightColor();
1101cdf0e10cSrcweir }
1102cdf0e10cSrcweir else
1103cdf0e10cSrcweir {
1104cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
1105cdf0e10cSrcweir aColor1 = rStyleSettings.GetLightBorderColor();
1106cdf0e10cSrcweir else
1107cdf0e10cSrcweir aColor1 = rStyleSettings.GetLightColor();
1108cdf0e10cSrcweir if ( (nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT )
1109cdf0e10cSrcweir aColor2 = rStyleSettings.GetShadowColor();
1110cdf0e10cSrcweir else
1111cdf0e10cSrcweir aColor2 = rStyleSettings.GetDarkShadowColor();
1112cdf0e10cSrcweir }
1113cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
1114cdf0e10cSrcweir aFillRect.Left()++;
1115cdf0e10cSrcweir aFillRect.Top()++;
1116cdf0e10cSrcweir aFillRect.Right()--;
1117cdf0e10cSrcweir aFillRect.Bottom()--;
1118cdf0e10cSrcweir
1119cdf0e10cSrcweir if ( !((nStyle & BUTTON_DRAW_FLATTEST) == BUTTON_DRAW_FLAT) )
1120cdf0e10cSrcweir {
1121cdf0e10cSrcweir if ( nStyle & (BUTTON_DRAW_PRESSED | BUTTON_DRAW_CHECKED) )
1122cdf0e10cSrcweir {
1123cdf0e10cSrcweir aColor1 = rStyleSettings.GetShadowColor();
1124cdf0e10cSrcweir aColor2 = rStyleSettings.GetLightBorderColor();
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir else
1127cdf0e10cSrcweir {
1128cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
1129cdf0e10cSrcweir aColor1 = rStyleSettings.GetLightColor();
1130cdf0e10cSrcweir else
1131cdf0e10cSrcweir aColor1 = rStyleSettings.GetLightBorderColor();
1132cdf0e10cSrcweir aColor2 = rStyleSettings.GetShadowColor();
1133cdf0e10cSrcweir }
1134cdf0e10cSrcweir pDev->ImplDraw2ColorFrame( aFillRect, aColor1, aColor2 );
1135cdf0e10cSrcweir aFillRect.Left()++;
1136cdf0e10cSrcweir aFillRect.Top()++;
1137cdf0e10cSrcweir aFillRect.Right()--;
1138cdf0e10cSrcweir aFillRect.Bottom()--;
1139cdf0e10cSrcweir }
1140cdf0e10cSrcweir }
1141cdf0e10cSrcweir }
1142cdf0e10cSrcweir
1143cdf0e10cSrcweir if ( !(nStyle & (BUTTON_DRAW_NOFILL | BUTTON_DRAW_NODRAW)) )
1144cdf0e10cSrcweir {
1145cdf0e10cSrcweir pDev->SetLineColor();
1146cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_MONO )
1147cdf0e10cSrcweir {
1148cdf0e10cSrcweir // Hack: Auf Druckern wollen wir im MonoChrom-Modus trotzdem
1149cdf0e10cSrcweir // erstmal graue Buttons haben
1150cdf0e10cSrcweir if ( pDev->GetOutDevType() == OUTDEV_PRINTER )
1151cdf0e10cSrcweir pDev->SetFillColor( Color( COL_LIGHTGRAY ) );
1152cdf0e10cSrcweir else
1153cdf0e10cSrcweir pDev->SetFillColor( Color( COL_WHITE ) );
1154cdf0e10cSrcweir }
1155cdf0e10cSrcweir else
1156cdf0e10cSrcweir {
1157cdf0e10cSrcweir if ( nStyle & (BUTTON_DRAW_CHECKED | BUTTON_DRAW_DONTKNOW) )
1158cdf0e10cSrcweir pDev->SetFillColor( rStyleSettings.GetCheckedColor() );
1159cdf0e10cSrcweir else
1160cdf0e10cSrcweir pDev->SetFillColor( rStyleSettings.GetFaceColor() );
1161cdf0e10cSrcweir }
1162cdf0e10cSrcweir pDev->DrawRect( aFillRect );
1163cdf0e10cSrcweir }
1164cdf0e10cSrcweir
1165cdf0e10cSrcweir // Ein Border freilassen, der jedoch bei Default-Darstellung
1166cdf0e10cSrcweir // mitbenutzt wird
1167cdf0e10cSrcweir rRect.Left()++;
1168cdf0e10cSrcweir rRect.Top()++;
1169cdf0e10cSrcweir rRect.Right()--;
1170cdf0e10cSrcweir rRect.Bottom()--;
1171cdf0e10cSrcweir
1172cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_NOLIGHTBORDER )
1173cdf0e10cSrcweir {
1174cdf0e10cSrcweir rRect.Left()++;
1175cdf0e10cSrcweir rRect.Top()++;
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir else if ( nStyle & BUTTON_DRAW_NOLEFTLIGHTBORDER )
1178cdf0e10cSrcweir rRect.Left()++;
1179cdf0e10cSrcweir
1180cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_PRESSED )
1181cdf0e10cSrcweir {
1182cdf0e10cSrcweir if ( (rRect.GetHeight() > 10) && (rRect.GetWidth() > 10) )
1183cdf0e10cSrcweir {
1184cdf0e10cSrcweir rRect.Left() += 4;
1185cdf0e10cSrcweir rRect.Top() += 4;
1186cdf0e10cSrcweir rRect.Right() -= 1;
1187cdf0e10cSrcweir rRect.Bottom() -= 1;
1188cdf0e10cSrcweir }
1189cdf0e10cSrcweir else
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir rRect.Left() += 3;
1192cdf0e10cSrcweir rRect.Top() += 3;
1193cdf0e10cSrcweir rRect.Right() -= 2;
1194cdf0e10cSrcweir rRect.Bottom() -= 2;
1195cdf0e10cSrcweir }
1196cdf0e10cSrcweir }
1197cdf0e10cSrcweir else if ( nStyle & BUTTON_DRAW_CHECKED )
1198cdf0e10cSrcweir {
1199cdf0e10cSrcweir rRect.Left() += 3;
1200cdf0e10cSrcweir rRect.Top() += 3;
1201cdf0e10cSrcweir rRect.Right() -= 2;
1202cdf0e10cSrcweir rRect.Bottom() -= 2;
1203cdf0e10cSrcweir }
1204cdf0e10cSrcweir else
1205cdf0e10cSrcweir {
1206cdf0e10cSrcweir rRect.Left() += 2;
1207cdf0e10cSrcweir rRect.Top() += 2;
1208cdf0e10cSrcweir rRect.Right() -= 3;
1209cdf0e10cSrcweir rRect.Bottom() -= 3;
1210cdf0e10cSrcweir }
1211cdf0e10cSrcweir }
1212cdf0e10cSrcweir
1213cdf0e10cSrcweir // -----------------------------------------------------------------------
1214cdf0e10cSrcweir
DrawButton(const Rectangle & rRect,sal_uInt16 nStyle)1215cdf0e10cSrcweir Rectangle DecorationView::DrawButton( const Rectangle& rRect, sal_uInt16 nStyle )
1216cdf0e10cSrcweir {
1217cdf0e10cSrcweir Rectangle aRect = rRect;
1218cdf0e10cSrcweir sal_Bool bOldMap = mpOutDev->IsMapModeEnabled();
1219cdf0e10cSrcweir if ( bOldMap )
1220cdf0e10cSrcweir {
1221cdf0e10cSrcweir aRect = mpOutDev->LogicToPixel( aRect );
1222cdf0e10cSrcweir mpOutDev->EnableMapMode( sal_False );
1223cdf0e10cSrcweir }
1224cdf0e10cSrcweir
1225cdf0e10cSrcweir if ( !rRect.IsEmpty() )
1226cdf0e10cSrcweir {
1227cdf0e10cSrcweir const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
1228cdf0e10cSrcweir
1229cdf0e10cSrcweir if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
1230cdf0e10cSrcweir nStyle |= BUTTON_DRAW_MONO;
1231cdf0e10cSrcweir
1232cdf0e10cSrcweir if ( nStyle & BUTTON_DRAW_NODRAW )
1233cdf0e10cSrcweir ImplDrawButton( mpOutDev, aRect, rStyleSettings, nStyle );
1234cdf0e10cSrcweir else
1235cdf0e10cSrcweir {
1236cdf0e10cSrcweir Color maOldLineColor = mpOutDev->GetLineColor();
1237cdf0e10cSrcweir Color maOldFillColor = mpOutDev->GetFillColor();
1238cdf0e10cSrcweir ImplDrawButton( mpOutDev, aRect, rStyleSettings, nStyle );
1239cdf0e10cSrcweir mpOutDev->SetLineColor( maOldLineColor );
1240cdf0e10cSrcweir mpOutDev->SetFillColor( maOldFillColor );
1241cdf0e10cSrcweir }
1242cdf0e10cSrcweir }
1243cdf0e10cSrcweir
1244cdf0e10cSrcweir if ( bOldMap )
1245cdf0e10cSrcweir {
1246cdf0e10cSrcweir mpOutDev->EnableMapMode( bOldMap );
1247cdf0e10cSrcweir aRect = mpOutDev->PixelToLogic( aRect );
1248cdf0e10cSrcweir }
1249cdf0e10cSrcweir
1250cdf0e10cSrcweir return aRect;
1251cdf0e10cSrcweir }
1252cdf0e10cSrcweir
1253cdf0e10cSrcweir // -----------------------------------------------------------------------
1254cdf0e10cSrcweir
DrawSeparator(const Point & rStart,const Point & rStop,bool bVertical)1255cdf0e10cSrcweir void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, bool bVertical )
1256cdf0e10cSrcweir {
1257cdf0e10cSrcweir Point aStart( rStart ), aStop( rStop );
1258cdf0e10cSrcweir const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
1259cdf0e10cSrcweir
1260cdf0e10cSrcweir mpOutDev->Push( PUSH_LINECOLOR );
1261cdf0e10cSrcweir if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
1262cdf0e10cSrcweir mpOutDev->SetLineColor( Color( COL_BLACK ) );
1263cdf0e10cSrcweir else
1264cdf0e10cSrcweir mpOutDev->SetLineColor( rStyleSettings.GetShadowColor() );
1265cdf0e10cSrcweir
1266cdf0e10cSrcweir mpOutDev->DrawLine( aStart, aStop );
1267cdf0e10cSrcweir if ( !(rStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
1268cdf0e10cSrcweir {
1269cdf0e10cSrcweir mpOutDev->SetLineColor( rStyleSettings.GetLightColor() );
1270cdf0e10cSrcweir if( bVertical )
1271cdf0e10cSrcweir {
1272cdf0e10cSrcweir aStart.X()++;
1273cdf0e10cSrcweir aStop.X()++;
1274cdf0e10cSrcweir }
1275cdf0e10cSrcweir else
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir aStart.Y()++;
1278cdf0e10cSrcweir aStop.Y()++;
1279cdf0e10cSrcweir }
1280cdf0e10cSrcweir mpOutDev->DrawLine( aStart, aStop );
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir mpOutDev->Pop();
1283cdf0e10cSrcweir }
1284cdf0e10cSrcweir
1285