Branch libreoffice-5-0-4
[LibreOffice.git] / include / svtools / toolpanel / toolpanel.hxx
blobfafeb3981e11b6458555d711525495a928ea28ff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVTOOLS_TOOLPANEL_TOOLPANEL_HXX
21 #define INCLUDED_SVTOOLS_TOOLPANEL_TOOLPANEL_HXX
23 #include <svtools/svtdllapi.h>
24 #include <salhelper/simplereferenceobject.hxx>
26 #include <rtl/ref.hxx>
27 #include <rtl/ustring.hxx>
28 #include <vcl/image.hxx>
30 #include <boost/noncopyable.hpp>
32 class Rectangle;
33 namespace vcl { class Window; }
34 namespace com { namespace sun { namespace star { namespace accessibility {
35 class XAccessible;
36 } } } }
39 namespace svt
44 //= IToolPanel
46 /** abstract interface for a single tool panel
48 class SVT_DLLPUBLIC IToolPanel : public salhelper::SimpleReferenceObject
50 public:
51 /// retrieves the display name of the panel
52 virtual OUString GetDisplayName() const = 0;
54 /// retrieves the image associated with the panel, if any
55 virtual Image GetImage() const = 0;
57 /// retrieves the help ID associated with the panel, if any.
58 virtual OString GetHelpID() const = 0;
60 /** activates the panel
62 Usually, this means the panel's Window is created (if not previosly done so) and shown.
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.
69 virtual void Activate( vcl::Window& i_rParentWindow ) = 0;
71 /** deactivates the panel
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.
77 virtual void Deactivate() = 0;
79 /** sets a new size for the panel's Window
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.
86 virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0;
88 /// sets the focus to the panel window
89 virtual void GrabFocus() = 0;
91 /** release any resources associated with the panel.
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.
96 virtual void Dispose() = 0;
98 /** creates an XAccessible for the tool panel
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.
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;
108 virtual ~IToolPanel()
113 typedef ::rtl::Reference< IToolPanel > PToolPanel;
116 //= ToolPanelBase
118 /** base class for tool panel implementations, adding ref count implementation to the IToolPanel interface,
119 but still being abstract
121 class SVT_DLLPUBLIC ToolPanelBase :public IToolPanel
122 ,public ::boost::noncopyable
124 protected:
125 ToolPanelBase();
126 virtual ~ToolPanelBase();
130 } // namespace svt
133 #endif // INCLUDED_SVTOOLS_TOOLPANEL_TOOLPANEL_HXX
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */