Branch data 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 : :
21 : : #include <vcl/window.hxx>
22 : : #include <vcl/virdev.hxx>
23 : :
24 : : //......................................................................................................................
25 : : namespace svt
26 : : {
27 : : //......................................................................................................................
28 : :
29 : : class ToolPanelDrawer;
30 : : //==================================================================================================================
31 : : //= DrawerVisualization
32 : : //==================================================================================================================
33 : : /** serves a single purpose - let ZoomText read the drawers ...
34 : :
35 : : Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations
36 : : of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject"
37 : : such a child into the A11Y hierarchy, we use this window here.
38 : :
39 : : (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With
40 : : this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.)
41 : : */
42 : : class DrawerVisualization : public Window
43 : : {
44 : : public:
45 : : DrawerVisualization( ToolPanelDrawer& i_rParent );
46 : : ~DrawerVisualization();
47 : :
48 : : protected:
49 : : // Window overridables
50 : : virtual void Paint( const Rectangle& i_rBoundingBox );
51 : :
52 : : private:
53 : : ToolPanelDrawer& m_rDrawer;
54 : : };
55 : :
56 : : //==================================================================================================================
57 : : //= ToolPanelDrawer
58 : : //==================================================================================================================
59 : : //------------------------------------------------------------------------------------------------------------------
60 : : class ToolPanelDrawer : public Window
61 : : {
62 : : public:
63 : : ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle );
64 : : ~ToolPanelDrawer();
65 : :
66 : : long GetPreferredHeightPixel() const;
67 : : void SetExpanded( const bool i_bExpanded );
68 : 0 : bool IsExpanded() const { return m_bExpanded; }
69 : :
70 : : void Paint();
71 : :
72 : : protected:
73 : : // Window overridables
74 : : virtual void GetFocus();
75 : : virtual void LoseFocus();
76 : : virtual void Resize();
77 : : virtual void DataChanged( const DataChangedEvent& i_rEvent );
78 : : virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent );
79 : :
80 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
81 : : GetComponentInterface( sal_Bool i_bCreate );
82 : :
83 : : private:
84 : : Rectangle impl_calcTextBoundingBox() const;
85 : : Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const;
86 : : void impl_paintBackground( const Rectangle& i_rTitleBarBox );
87 : : sal_uInt16 impl_getTextStyle() const;
88 : : void impl_paintFocusIndicator( const Rectangle& i_rTextBox );
89 : : Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox );
90 : : Image impl_getExpansionIndicator() const;
91 : :
92 : : // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change.
93 : : using Window::SetText;
94 : : using Window::Paint;
95 : :
96 : : private:
97 : : ::std::auto_ptr< VirtualDevice > m_pPaintDevice;
98 : : DrawerVisualization m_aVisualization;
99 : : bool m_bFocused;
100 : : bool m_bExpanded;
101 : : };
102 : :
103 : : //......................................................................................................................
104 : : } // namespace svt
105 : : //......................................................................................................................
106 : :
107 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|