xref: /trunk/main/sd/source/ui/inc/ShellFactory.hxx (revision 67e470da)
1 /**************************************************************
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
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
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.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SD_VIEW_SHELL_FACTORY_HXX
25 #define SD_VIEW_SHELL_FACTORY_HXX
26 
27 #include <sal/types.h>
28 #include <memory>
29 
30 class Window;
31 
32 namespace sd {
33 
34 class FrameView;
35 class ViewShell;
36 
37 typedef sal_Int32 ShellId;
38 // This shell id is a reserved value and does not specify any valid shell.
39 static const sal_Int32 snInvalidShellId = -1;
40 
41 template<class ShellType>
42 class ShellFactory
43 {
44 public:
45     /** This abstract virtual class needs a destructor so that the
46         destructors of derived classes are called.
47     */
~ShellFactory(void)48     virtual ~ShellFactory (void) {};
49 
50     /** Create a new instance of a view shell for the given id that will
51         be stacked onto the given view shell base.
52         @return
53             Return the new view shell or NULL when a creation is not
54             possible.
55         */
56     virtual ShellType* CreateShell (
57         ShellId nId,
58         ::Window* pParentWindow,
59         FrameView* pFrameView = NULL) = 0;
60 
61     /** Tell the factory that a shell is no longer in use.  It may destroy
62         it or put it for future use in a cache.
63     */
64     virtual void ReleaseShell (ShellType* pShell) = 0;
65 };
66 
67 } // end of namespace sd
68 
69 #endif
70