Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
21 : #define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
22 :
23 : #include <vcl/window.hxx>
24 : #include <vcl/virdev.hxx>
25 :
26 :
27 : namespace svt
28 : {
29 :
30 :
31 : class ToolPanelDrawer;
32 :
33 : //= DrawerVisualization
34 :
35 : /** serves a single purpose - let ZoomText read the drawers ...
36 :
37 : Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations
38 : of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject"
39 : such a child into the A11Y hierarchy, we use this window here.
40 :
41 : (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With
42 : this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.)
43 : */
44 : class DrawerVisualization : public vcl::Window
45 : {
46 : public:
47 : DrawerVisualization( ToolPanelDrawer& i_rParent );
48 : virtual ~DrawerVisualization();
49 :
50 : protected:
51 : // Window overridables
52 : virtual void Paint( const Rectangle& i_rBoundingBox ) SAL_OVERRIDE;
53 :
54 : private:
55 : ToolPanelDrawer& m_rDrawer;
56 : };
57 :
58 :
59 : //= ToolPanelDrawer
60 :
61 :
62 : class ToolPanelDrawer : public vcl::Window
63 : {
64 : public:
65 : ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle );
66 : virtual ~ToolPanelDrawer();
67 :
68 : long GetPreferredHeightPixel() const;
69 : void SetExpanded( const bool i_bExpanded );
70 0 : bool IsExpanded() const { return m_bExpanded; }
71 :
72 : void Paint();
73 :
74 : protected:
75 : // Window overridables
76 : virtual void GetFocus() SAL_OVERRIDE;
77 : virtual void LoseFocus() SAL_OVERRIDE;
78 : virtual void Resize() SAL_OVERRIDE;
79 : virtual void DataChanged( const DataChangedEvent& i_rEvent ) SAL_OVERRIDE;
80 : virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ) SAL_OVERRIDE;
81 :
82 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
83 : GetComponentInterface( bool i_bCreate ) SAL_OVERRIDE;
84 :
85 : private:
86 : Rectangle impl_calcTextBoundingBox() const;
87 : Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const;
88 : void impl_paintBackground( const Rectangle& i_rTitleBarBox );
89 : sal_uInt16 impl_getTextStyle() const;
90 : void impl_paintFocusIndicator( const Rectangle& i_rTextBox );
91 : Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox );
92 : Image impl_getExpansionIndicator() const;
93 :
94 : // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change.
95 : using Window::SetText;
96 : using Window::Paint;
97 :
98 : private:
99 : ::std::unique_ptr< VirtualDevice > m_pPaintDevice;
100 : DrawerVisualization m_aVisualization;
101 : bool m_bFocused;
102 : bool m_bExpanded;
103 : };
104 :
105 :
106 : } // namespace svt
107 :
108 :
109 : #endif // INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_TOOLPANELDRAWER_HXX
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|