1 /************************************************************************* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * 4 * Copyright 2000, 2010 Oracle and/or its affiliates. 5 * 6 * OpenOffice.org - a multi-platform office productivity suite 7 * 8 * This file is part of OpenOffice.org. 9 * 10 * OpenOffice.org is free software: you can redistribute it and/or modify 11 * it under the terms of the GNU Lesser General Public License version 3 12 * only, as published by the Free Software Foundation. 13 * 14 * OpenOffice.org is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU Lesser General Public License version 3 for more details 18 * (a copy is included in the LICENSE file that accompanied this code). 19 * 20 * You should have received a copy of the GNU Lesser General Public License 21 * version 3 along with OpenOffice.org. If not, see 22 * <http://www.openoffice.org/license.html> 23 * for a copy of the LGPLv3 License. 24 * 25 ************************************************************************/ 26 27 #include "precompiled_svtools.hxx" 28 29 #include <vcl/window.hxx> 30 #include <vcl/virdev.hxx> 31 32 //...................................................................................................................... 33 namespace svt 34 { 35 //...................................................................................................................... 36 37 class ToolPanelDrawer; 38 //================================================================================================================== 39 //= DrawerVisualization 40 //================================================================================================================== 41 /** serves a single purpose - let ZoomText read the drawers ... 42 43 Strange enough, ZoomText does not read the drawers when they get the focus (in none of the combinations 44 of AccessibleRoles I tried), except when it does have an AccessibleChild with the role LABEL. To "inject" 45 such a child into the A11Y hierarchy, we use this window here. 46 47 (We could also inject the A11Y component on the A11Y level only, but this would mean additional code. With 48 this approach here, VCL/toolkit will take care of creating and maintaining the A11Y component for us.) 49 */ 50 class DrawerVisualization : public Window 51 { 52 public: 53 DrawerVisualization( ToolPanelDrawer& i_rParent ); 54 ~DrawerVisualization(); 55 56 protected: 57 // Window overridables 58 virtual void Paint( const Rectangle& i_rBoundingBox ); 59 60 private: 61 ToolPanelDrawer& m_rDrawer; 62 }; 63 64 //================================================================================================================== 65 //= ToolPanelDrawer 66 //================================================================================================================== 67 //------------------------------------------------------------------------------------------------------------------ 68 class ToolPanelDrawer : public Window 69 { 70 public: 71 ToolPanelDrawer( Window& i_rParent, const ::rtl::OUString& i_rTitle ); 72 ~ToolPanelDrawer(); 73 74 long GetPreferredHeightPixel() const; 75 void SetExpanded( const bool i_bExpanded ); 76 bool IsExpanded() const { return m_bExpanded; } 77 78 void Paint(); 79 80 protected: 81 // Window overridables 82 virtual void GetFocus(); 83 virtual void LoseFocus(); 84 virtual void Resize(); 85 virtual void DataChanged( const DataChangedEvent& i_rEvent ); 86 virtual void MouseButtonDown( const MouseEvent& i_rMouseEvent ); 87 88 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > 89 GetComponentInterface( sal_Bool i_bCreate ); 90 91 private: 92 Rectangle impl_calcTextBoundingBox() const; 93 Rectangle impl_calcTitleBarBox( const Rectangle& i_rTextBox ) const; 94 void impl_paintBackground( const Rectangle& i_rTitleBarBox ); 95 sal_uInt16 impl_getTextStyle() const; 96 void impl_paintFocusIndicator( const Rectangle& i_rTextBox ); 97 Rectangle impl_paintExpansionIndicator( const Rectangle& i_rTextBox ); 98 Image impl_getExpansionIndicator() const; 99 100 // don't expose SetText. Our text is used as AccessibleName/Desc, and those are not expected to change. 101 using Window::SetText; 102 using Window::Paint; 103 104 private: 105 ::std::auto_ptr< VirtualDevice > m_pPaintDevice; 106 DrawerVisualization m_aVisualization; 107 bool m_bFocused; 108 bool m_bExpanded; 109 }; 110 111 //...................................................................................................................... 112 } // namespace svt 113 //...................................................................................................................... 114