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