xref: /trunk/main/svtools/source/toolpanel/toolpaneldrawer.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*01aa44aaSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*01aa44aaSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*01aa44aaSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*01aa44aaSAndrew Rist  * distributed with this work for additional information
6*01aa44aaSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*01aa44aaSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*01aa44aaSAndrew Rist  * "License"); you may not use this file except in compliance
9*01aa44aaSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*01aa44aaSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*01aa44aaSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*01aa44aaSAndrew Rist  * software distributed under the License is distributed on an
15*01aa44aaSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*01aa44aaSAndrew Rist  * KIND, either express or implied.  See the License for the
17*01aa44aaSAndrew Rist  * specific language governing permissions and limitations
18*01aa44aaSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*01aa44aaSAndrew Rist  *************************************************************/
21*01aa44aaSAndrew Rist 
22*01aa44aaSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "precompiled_svtools.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <vcl/window.hxx>
27cdf0e10cSrcweir #include <vcl/virdev.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir //......................................................................................................................
30cdf0e10cSrcweir namespace svt
31cdf0e10cSrcweir {
32cdf0e10cSrcweir //......................................................................................................................
33cdf0e10cSrcweir 
34cdf0e10cSrcweir     class ToolPanelDrawer;
35cdf0e10cSrcweir     //==================================================================================================================
36cdf0e10cSrcweir     //= DrawerVisualization
37cdf0e10cSrcweir     //==================================================================================================================
38cdf0e10cSrcweir     /** serves a single purpose - let ZoomText read the drawers ...
39cdf0e10cSrcweir 
40cdf0e10cSrcweir         Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations
41cdf0e10cSrcweir         of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject"
42cdf0e10cSrcweir         such a child into the A11Y hierarchy, we use this window here.
43cdf0e10cSrcweir 
44cdf0e10cSrcweir         (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With
45cdf0e10cSrcweir         this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.)
46cdf0e10cSrcweir     */
47cdf0e10cSrcweir     class DrawerVisualization : public Window
48cdf0e10cSrcweir     {
49cdf0e10cSrcweir     public:
50cdf0e10cSrcweir         DrawerVisualization( ToolPanelDrawer& i_rParent );
51cdf0e10cSrcweir         ~DrawerVisualization();
52cdf0e10cSrcweir 
53cdf0e10cSrcweir     protected:
54cdf0e10cSrcweir         // Window overridables
55cdf0e10cSrcweir         virtual void Paint( const Rectangle& i_rBoundingBox );
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     private:
58cdf0e10cSrcweir         ToolPanelDrawer&    m_rDrawer;
59cdf0e10cSrcweir     };
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     //==================================================================================================================
62cdf0e10cSrcweir     //= ToolPanelDrawer
63cdf0e10cSrcweir     //==================================================================================================================
64cdf0e10cSrcweir     //------------------------------------------------------------------------------------------------------------------
65cdf0e10cSrcweir     class ToolPanelDrawer : public Window
66cdf0e10cSrcweir     {
67cdf0e10cSrcweir     public:
68cdf0e10cSrcweir         ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle );
69cdf0e10cSrcweir         ~ToolPanelDrawer();
70cdf0e10cSrcweir 
71cdf0e10cSrcweir         long    GetPreferredHeightPixel() const;
72cdf0e10cSrcweir         void    SetExpanded( const bool i_bExpanded );
IsExpanded() const73cdf0e10cSrcweir         bool    IsExpanded() const { return m_bExpanded; }
74cdf0e10cSrcweir 
75cdf0e10cSrcweir         void    Paint();
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     protected:
78cdf0e10cSrcweir         // Window overridables
79cdf0e10cSrcweir         virtual void GetFocus();
80cdf0e10cSrcweir         virtual void LoseFocus();
81cdf0e10cSrcweir         virtual void Resize();
82cdf0e10cSrcweir         virtual void DataChanged( const DataChangedEvent& i_rEvent );
83cdf0e10cSrcweir         virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent );
84cdf0e10cSrcweir 
85cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
86cdf0e10cSrcweir                      GetComponentInterface( sal_Bool i_bCreate );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     private:
89cdf0e10cSrcweir         Rectangle   impl_calcTextBoundingBox() const;
90cdf0e10cSrcweir         Rectangle   impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const;
91cdf0e10cSrcweir         void        impl_paintBackground( const Rectangle& i_rTitleBarBox );
92cdf0e10cSrcweir         sal_uInt16      impl_getTextStyle() const;
93cdf0e10cSrcweir         void        impl_paintFocusIndicator( const Rectangle& i_rTextBox );
94cdf0e10cSrcweir         Rectangle   impl_paintExpansionIndicator( const Rectangle& i_rTextBox );
95cdf0e10cSrcweir         Image       impl_getExpansionIndicator() const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir         // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change.
98cdf0e10cSrcweir         using Window::SetText;
99cdf0e10cSrcweir         using Window::Paint;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     private:
102cdf0e10cSrcweir         ::std::auto_ptr< VirtualDevice >    m_pPaintDevice;
103cdf0e10cSrcweir         DrawerVisualization                 m_aVisualization;
104cdf0e10cSrcweir         bool                                m_bFocused;
105cdf0e10cSrcweir         bool                                m_bExpanded;
106cdf0e10cSrcweir     };
107cdf0e10cSrcweir 
108cdf0e10cSrcweir //......................................................................................................................
109cdf0e10cSrcweir } // namespace svt
110cdf0e10cSrcweir //......................................................................................................................
111