Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / inc / WidgetDrawInterface.hxx
blob78d5d7625491f1680a36d4c81bf26684bc188274
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
11 #ifndef INCLUDED_VCL_INC_WIDGETDRAWINTERFACE_HXX
12 #define INCLUDED_VCL_INC_WIDGETDRAWINTERFACE_HXX
14 #include <vcl/dllapi.h>
15 #include <vcl/salnativewidgets.hxx>
16 #include <vcl/settings.hxx>
18 namespace vcl
20 class VCL_PLUGIN_PUBLIC WidgetDrawInterface
22 public:
23 virtual ~WidgetDrawInterface() COVERITY_NOEXCEPT_FALSE {}
25 /**
26 * Query the platform layer for native control support.
28 * @param [in] eType The widget type.
29 * @param [in] ePart The part of the widget.
30 * @return true if the platform supports native drawing of the widget type defined by part.
32 virtual inline bool isNativeControlSupported(ControlType eType, ControlPart ePart);
34 /**
35 * Query if a position is inside the native widget part.
37 * Mainly used for scrollbars.
39 * @param [in] eType The widget type.
40 * @param [in] ePart The part of the widget.
41 * @param [in] rBoundingControlRegion The bounding Rectangle of
42 the complete control in VCL frame coordinates.
43 * @param [in] aPos The position to check the hit.
44 * @param [out] rIsInside true, if \a aPos was inside the native widget.
45 * @return true, if the query was successful.
47 virtual inline bool hitTestNativeControl(ControlType eType, ControlPart ePart,
48 const tools::Rectangle& rBoundingControlRegion,
49 const Point& aPos, bool& rIsInside);
51 /**
52 * Draw the requested control.
54 * @param [in] eType The widget type.
55 * @param [in] ePart The part of the widget.
56 * @param [in] rBoundingControlRegion The bounding rectangle of
57 * the complete control in VCL frame coordinates.
58 * @param [in] eState The general state of the control (enabled, focused, etc.).
59 * @param [in] aValue Addition control specific information.
60 * @param [in] aCaption A caption or title string (like button text etc.).
61 * @param [in] rBackgroundColor Background color for the control (may be COL_AUTO)
62 * @return true, if the control could be drawn.
64 virtual inline bool drawNativeControl(ControlType eType, ControlPart ePart,
65 const tools::Rectangle& rBoundingControlRegion,
66 ControlState eState, const ImplControlValue& aValue,
67 const OUString& aCaptions, const Color& rBackgroundColor);
69 /**
70 * Get the native control regions for the control part.
72 * If the return value is true, \a rNativeBoundingRegion contains
73 * the true bounding region covered by the control including any
74 * adornment, while \a rNativeContentRegion contains the area
75 * within the control that can be safely drawn into without drawing over
76 * the borders of the control.
78 * @param [in] eType Type of the widget.
79 * @param [in] ePart Specification of the widget's part if it consists of more than one.
80 * @param [in] rBoundingControlRegion The bounding region of the control in VCL frame coordinates.
81 * @param [in] eState The general state of the control (enabled, focused, etc.).
82 * @param [in] aValue Addition control specific information.
83 * @param [in] aCaption A caption or title string (like button text etc.).
84 * @param [out] rNativeBoundingRegion The region covered by the control including any adornment.
85 * @param [out] rNativeContentRegion The region within the control that can be safely drawn into.
86 * @return true, if the regions are filled.
88 virtual inline bool getNativeControlRegion(ControlType eType, ControlPart ePart,
89 const tools::Rectangle& rBoundingControlRegion,
90 ControlState eState, const ImplControlValue& aValue,
91 const OUString& aCaption,
92 tools::Rectangle& rNativeBoundingRegion,
93 tools::Rectangle& rNativeContentRegion);
95 virtual inline bool updateSettings(AllSettings& rSettings);
98 bool WidgetDrawInterface::isNativeControlSupported(ControlType, ControlPart) { return false; }
100 bool WidgetDrawInterface::hitTestNativeControl(ControlType, ControlPart, const tools::Rectangle&,
101 const Point&, bool&)
103 return false;
106 bool WidgetDrawInterface::drawNativeControl(ControlType, ControlPart, const tools::Rectangle&,
107 ControlState, const ImplControlValue&, const OUString&,
108 const Color& /*rBackgroundColor*/)
110 return false;
113 bool WidgetDrawInterface::getNativeControlRegion(ControlType, ControlPart, const tools::Rectangle&,
114 ControlState, const ImplControlValue&,
115 const OUString&, tools::Rectangle&,
116 tools::Rectangle&)
118 return false;
121 bool WidgetDrawInterface::updateSettings(AllSettings&) { return false; }
124 #endif
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */