TaskPaneControlFactory.hxx (398d7a35) TaskPaneControlFactory.hxx (69cb9f15)
1/**************************************************************
1/**************************************************************
2 *
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
19 *
20 *************************************************************/
21
22
23
24#ifndef SD_TASKPANE_CONTROL_FACTORY_HXX
25#define SD_TASKPANE_CONTROL_FACTORY_HXX
26
27#include "taskpane/TaskPaneTreeNode.hxx"

--- 9 unchanged lines hidden (view full) ---

37} }
38
39
40
41
42namespace sd { namespace toolpanel {
43
44/** A simple factory base class defines the interface that is used by
20 *************************************************************/
21
22
23
24#ifndef SD_TASKPANE_CONTROL_FACTORY_HXX
25#define SD_TASKPANE_CONTROL_FACTORY_HXX
26
27#include "taskpane/TaskPaneTreeNode.hxx"

--- 9 unchanged lines hidden (view full) ---

37} }
38
39
40
41
42namespace sd { namespace toolpanel {
43
44/** A simple factory base class defines the interface that is used by
45 some of the control containers of the task pane to create controls on
46 demand when they are about to be displayed for the first time.
45 some of the control containers of the task pane to create controls on
46 demand when they are about to be displayed for the first time.
47
47
48 It provides the InternalCreateControl() method as hook that can be
49 overloaded by derived classes to provide a new control.
48 It provides the InternalCreateControl() method as hook that can be
49 overloaded by derived classes to provide a new control.
50*/
51class ControlFactory
52{
53public:
50*/
51class ControlFactory
52{
53public:
54 ControlFactory (void);
55 virtual ~ControlFactory (void);
54 ControlFactory (void);
55 virtual ~ControlFactory (void);
56
56
57 /** creates a tree node which acts as root of an own tree
57 /** creates a tree node which acts as root of an own tree
58
58
59 Derived classes should overload InternalCreateControl.
60 */
61 ::std::auto_ptr<TreeNode> CreateControl( ::Window& i_rParent );
59 Derived classes should overload InternalCreateControl.
60 */
61 ::std::auto_ptr<TreeNode> CreateControl( ::Window& i_rParent );
62
63protected:
62
63protected:
64 virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) = 0;
64 virtual TreeNode* InternalCreateControl( ::Window& i_rParent ) = 0;
65};
66
67
68
69/** A simple helper class that realizes a ControlFactory that is able to create root controls, providing
65};
66
67
68
69/** A simple helper class that realizes a ControlFactory that is able to create root controls, providing
70 the to-be-created control with an additional parameter.
70 the to-be-created control with an additional parameter.
71*/
72template<class ControlType, class ArgumentType>
73class RootControlFactoryWithArg
71*/
72template<class ControlType, class ArgumentType>
73class RootControlFactoryWithArg
74 : public ControlFactory
74 : public ControlFactory
75{
76public:
75{
76public:
77 RootControlFactoryWithArg (ArgumentType& rArgument)
78 : mrArgument(rArgument)
79 {}
77 RootControlFactoryWithArg (ArgumentType& rArgument)
78 : mrArgument(rArgument)
79 {}
80
81protected:
80
81protected:
82 virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
83 {
84 return new ControlType( i_rParent, mrArgument );
85 }
82 virtual TreeNode* InternalCreateControl( ::Window& i_rParent )
83 {
84 return new ControlType( i_rParent, mrArgument );
85 }
86
87private:
86
87private:
88 ArgumentType& mrArgument;
88 ArgumentType& mrArgument;
89};
90
91
92} } // end of namespace ::sd::toolpanel
93
94#endif
89};
90
91
92} } // end of namespace ::sd::toolpanel
93
94#endif