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