merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / inc / taskpane / ToolPanel.hxx
blob301fba6bb50f96d526d2d32f184a95fa2b0497cb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ToolPanel.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef SD_TOOL_PANEL_HXX
31 #define SD_TOOL_PANEL_HXX
33 #include "taskpane/TaskPaneTreeNode.hxx"
34 #include "taskpane/TitledControl.hxx"
35 #include <vcl/ctrl.hxx>
37 #include <vector>
38 #include <memory>
40 class Window;
42 namespace sd { namespace toolpanel {
44 class TaskPaneViewShell;
45 class ControlFactory;
47 /** This control is basically a layout manager for the vertical
48 stacking of controls. At any one time there is exactly one of
49 them visible. For the others only their title bar is shown.
51 <p>Each control is independant of both other controls and the tool
52 panel itself. To be usable by the tool panel they only have to be
53 derived from the vcl Window class.</p>
55 class ToolPanel
56 : public Control,
57 public TreeNode
59 public:
60 /** Create a new tool panel with the given window as its parent.
61 This will usually be a child window.
63 ToolPanel (
64 ::Window* pParentWindow,
65 TaskPaneViewShell& rViewShell);
67 virtual ~ToolPanel (void);
69 /** Append the given control to the end of the list of controls that are
70 managed by the tool panel.
71 @param pControlFactory
72 Factory that provides the control on demand, typically when it
73 is expanded the first time.
74 @param rTitle
75 The string that is displayed in the title bar above the control.
76 @param nHelpId
77 The help id is set at the title bar not the actual control.
78 @param rClickHandler
79 The click handler typically expands a control when the user has
80 clicked on its title.
82 sal_uInt32 AddControl (
83 ::std::auto_ptr<ControlFactory> pControlFactory,
84 const String& rTitle,
85 ULONG nHelpId,
86 const TitledControl::ClickHandler& rClickHandler);
88 virtual void Resize (void);
90 virtual Size GetPreferredSize (void);
91 virtual sal_Int32 GetPreferredWidth (sal_Int32 nHeight);
92 virtual sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
93 virtual bool IsResizable (void);
94 virtual ::Window* GetWindow (void);
96 virtual void RequestResize (void);
98 virtual TaskPaneShellManager* GetShellManager (void);
100 virtual ::com::sun::star::uno::Reference<
101 ::com::sun::star::accessibility::XAccessible> CreateAccessibleObject (
102 const ::com::sun::star::uno::Reference<
103 ::com::sun::star::accessibility::XAccessible>& rxParent);
105 using Window::GetWindow;
107 protected:
108 /** Initiate a rearrangement of the controls.
110 void ListHasChanged (void);
112 private:
113 TaskPaneViewShell& mrViewShell;
115 /// Guard against recursive calls or Rearrange().
116 bool mbRearrangeActive;
118 /** Calculate position, size, and visibility of the controls.
119 Call this method after the list of controls has changed.
121 void Rearrange (void);
126 } } // end of namespace ::sd::toolpanel
128 #endif