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 #ifndef SVT_TOOLPANEL_HXX 28 #define SVT_TOOLPANEL_HXX 29 30 #include "svtools/svtdllapi.h" 31 #include "svtools/toolpanel/refbase.hxx" 32 33 #include <rtl/ustring.hxx> 34 #include <vcl/image.hxx> 35 36 #include <boost/noncopyable.hpp> 37 38 class Rectangle; 39 class Window; 40 namespace com { namespace sun { namespace star { namespace accessibility { 41 class XAccessible; 42 } } } } 43 44 //........................................................................ 45 namespace svt 46 { 47 //........................................................................ 48 49 //==================================================================== 50 //= IToolPanel 51 //==================================================================== 52 /** abstract interface for a single tool panel 53 */ 54 class SVT_DLLPUBLIC IToolPanel : public ::rtl::IReference 55 { 56 public: 57 /// retrieves the display name of the panel 58 virtual ::rtl::OUString GetDisplayName() const = 0; 59 60 /// retrieves the image associated with the panel, if any 61 virtual Image GetImage() const = 0; 62 63 /// retrieves the help ID associated with the panel, if any. 64 virtual rtl::OString GetHelpID() const = 0; 65 66 /** activates the panel 67 68 Usually, this means the panel's Window is created (if not previosly done so) and shown. 69 70 @param i_rParentWindow 71 the parent window to anchor the panel window at. Subsequent calls to the Activate 72 method will always get the same parent window. The complete area of this window is 73 available, and should be used, for the panel window. 74 */ 75 virtual void Activate( Window& i_rParentWindow ) = 0; 76 77 /** deactivates the panel 78 79 There are different ways how an implementation could deactivate a panel. The easiest way 80 would be to simply hide the associated Window. Alternatively, you could completely destroy it, 81 or decide to cache it by re-parenting it to another (temporary, invisible) window. 82 */ 83 virtual void Deactivate() = 0; 84 85 /** sets a new size for the panel's Window 86 87 The panel window is always expected to be positioned at (0,0), relative to the parent window 88 which was passed to the Activate member. Resizing the panel window is necessary when the size of 89 this parent window changes. Effectively, this method is a means of convenience, to relief panel 90 implementations from reacting on size changes of their parent window themselves. 91 */ 92 virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0; 93 94 /// sets the focus to the panel window 95 virtual void GrabFocus() = 0; 96 97 /** release any resources associated with the panel. 98 99 In particular, implementations should ultimately destroy the VCL window which implements the panel 100 window. No subsequent calls to any other method will happen after Destroy has been called. 101 */ 102 virtual void Dispose() = 0; 103 104 /** creates an XAccessible for the tool panel 105 106 Implementations are allowed to create a new instance each time this method is called, the caller 107 is responsible for caching the XAccessible implementation, if this is desired. 108 */ 109 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 110 CreatePanelAccessible( 111 const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible 112 ) = 0; 113 114 virtual ~IToolPanel() 115 { 116 } 117 }; 118 119 typedef ::rtl::Reference< IToolPanel > PToolPanel; 120 121 //==================================================================== 122 //= ToolPanelBase 123 //==================================================================== 124 /** base class for tool panel implementations, adding ref count implementation to the IToolPanel interface, 125 but still being abstract 126 */ 127 class SVT_DLLPUBLIC ToolPanelBase :public IToolPanel 128 ,public RefBase 129 ,public ::boost::noncopyable 130 { 131 protected: 132 ToolPanelBase(); 133 ~ToolPanelBase(); 134 135 public: 136 DECLARE_IREFERENCE() 137 138 private: 139 oslInterlockedCount m_refCount; 140 }; 141 142 //........................................................................ 143 } // namespace svt 144 //........................................................................ 145 146 #endif // SVT_TOOLPANEL_HXX 147