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