merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / toolpanel / ControlContainerDescriptor.hxx
blob56b248bb3d95e3c6a8ca46f9634f054083a5a697
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: ControlContainerDescriptor.hxx,v $
10 * $Revision: 1.7 $
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 ************************************************************************/
31 #ifndef SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
32 #define SD_TASKPANE_CONTROL_CONTAINER_DESCRIPTOR_HXX
34 #include "taskpane/ILayoutableWindow.hxx"
35 #include "taskpane/TitleBar.hxx"
36 #include <tools/string.hxx>
37 #include <tools/gen.hxx>
38 #ifndef SD_WINDOW_HXX
39 #include <vcl/window.hxx>
40 #endif
41 #include <memory>
43 class Window;
45 namespace sd { namespace toolpanel {
47 class ControlContainer;
49 /** Collection of information the describes entries of the tool
50 panel. A descriptor owns the control it is associated with.
52 class ControlContainerDescriptor
53 : public ::Window,
54 public virtual ILayoutableWindow
56 public:
57 /** Create a new descriptor for the given control.
58 @param rContainer
59 The container to inform about selection (caused by mouse
60 clicks or keyboard.)
61 @param pParent
62 The parent window of the new descriptor.
63 @param pControl
64 The control that is shown when being in the expanded
65 state.
66 @param rTitle
67 String that is shown as title in the title area above the
68 control.
69 @param eType
70 Type of the title bar. This specifies how the title bar
71 will be formated. For more information see TitleBar.
74 ControlContainerDescriptor (
75 ControlContainer& rContainer,
76 ::Window* pParent,
77 ::std::auto_ptr<ILayoutableWindow> pControl,
78 const String& rTitle,
79 TitleBar::TitleBarType eType);
81 virtual ~ControlContainerDescriptor (void);
84 virtual Size GetPreferredSize (void);
85 virtual int GetPreferredWidth (int nHeight);
86 virtual int GetPreferredHeight (int nWidth);
87 virtual bool IsResizable (void);
88 virtual ::Window* GetWindow (void);
90 virtual void Resize (void);
91 virtual void GetFocus (void);
92 virtual void LoseFocus (void);
93 virtual void MouseButtonUp (const MouseEvent& rMouseEvent);
94 virtual void KeyInput (const KeyEvent& rEvent);
96 void Select (bool bExpansionState);
98 // const Rectangle& GetTitleBarBox (void) const;
100 Window* GetControl (void) const;
101 const String& GetTitle (void) const;
103 void Expand (bool bExpanded = true);
104 void Collapse (void);
105 bool IsExpanded (void) const;
107 /** Ownership of the given data remains with the caller. The data
108 is thus not destroyed when the destructor of this class is
109 called.
111 void SetUserData (void* pUserData);
112 void* GetUserData (void) const;
114 bool IsVisible (void) const;
115 void SetVisible (bool bVisible);
117 using Window::GetWindow;
118 using sd::toolpanel::ILayoutableWindow::GetPreferredWidth;
119 using sd::toolpanel::ILayoutableWindow::GetPreferredHeight;
121 private:
122 ControlContainer& mrContainer;
123 ::std::auto_ptr<TitleBar> mpTitleBar;
124 ::std::auto_ptr<ILayoutableWindow> mpControl;
125 String msTitle;
126 bool mbExpanded;
127 bool mbVisible;
128 void* mpUserData;
129 bool mnVisible;
131 /// Do not use! Assignment operator is not supported.
132 const ControlContainerDescriptor& operator= (
133 const ControlContainerDescriptor& aDescriptor);
135 void UpdateStates (void);
137 DECL_LINK(WindowEventListener, VclSimpleEvent*);
140 } } // end of namespace ::sd::toolpanel
142 #endif