xref: /aoo41x/main/vcl/unx/kde4/KDESalGraphics.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #pragma once
29 
30 #include <rtl/string.hxx>
31 #include <unx/saldisp.hxx>
32 #include <unx/salgdi.h>
33 
34 #define Region QtXRegion
35 #include <QImage>
36 #undef Region
37 
38 /** handles graphics drawings requests and performs the needed drawing operations */
39 class KDESalGraphics : public X11SalGraphics
40 {
41     QImage* m_image;
42 
43 	public:
44         KDESalGraphics();
45         virtual ~KDESalGraphics();
46 
47 		/**
48 			What widgets can be drawn the native way.
49 			@param type Type of the widget.
50 			@param part Specification of the widget's part if it consists of more than one.
51 			@return true if the platform supports native drawing of the widget type defined by part.
52 		*/
53 		virtual sal_Bool IsNativeControlSupported( ControlType type, ControlPart part );
54 
55 		/** Test whether the position is in the native widget.
56 			If the return value is TRUE, bIsInside contains information whether
57 			aPos was or was not inside the native widget specified by the
58 			type/part combination.
59 		*/
60 		virtual sal_Bool hitTestNativeControl( ControlType type, ControlPart part,
61 										const Rectangle& rControlRegion, const Point& aPos,
62 										sal_Bool& rIsInside );
63 		/** Draw the requested control described by part/nControlState.
64 
65 			@param rControlRegion
66 			The bounding Rectangle of the complete control in VCL frame coordinates.
67 
68 			@param aValue
69 			An optional value (tristate/numerical/string).
70 
71 			@param aCaption
72 			A caption or title string (like button text etc.)
73 		*/
74 		virtual sal_Bool drawNativeControl( ControlType type, ControlPart part,
75 										const Rectangle& rControlRegion, ControlState nControlState,
76 										const ImplControlValue& aValue,
77 										const rtl::OUString& aCaption );
78 
79 		/** Draw text on the widget.
80 			OPTIONAL. Draws the requested text for the control described by part/nControlState.
81 			Used if text is not drawn by DrawNativeControl().
82 
83 			@param rControlRegion The bounding region of the complete control in VCL frame coordinates.
84 			@param aValue An optional value (tristate/numerical/string)
85 			@param aCaption	A caption or title string (like button text etc.)
86 		*/
87 		virtual sal_Bool drawNativeControlText( ControlType, ControlPart,
88 											const Rectangle&, ControlState,
89 											const ImplControlValue&,
90 											const rtl::OUString& ) { return false; }
91 		/** Check if the bounding regions match.
92 
93 			If the return value is TRUE, rNativeBoundingRegion
94 			contains the true bounding region covered by the control
95 			including any adornment, while rNativeContentRegion contains the area
96 			within the control that can be safely drawn into without drawing over
97 			the borders of the control.
98 
99 			@param rControlRegion
100 			The bounding region of the control in VCL frame coordinates.
101 
102 			@param aValue
103 			An optional value (tristate/numerical/string)
104 
105 			@param aCaption
106 			A caption or title string (like button text etc.)
107 		*/
108 		virtual sal_Bool getNativeControlRegion( ControlType type, ControlPart part,
109 											const Rectangle& rControlRegion, ControlState nControlState,
110 											const ImplControlValue& aValue,
111 											const rtl::OUString& aCaption,
112 											Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
113 };
114