1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _SOT_FACTORY_HXX
21 #define _SOT_FACTORY_HXX
23 #include <tools/globname.hxx>
24 #include <tools/rtti.hxx>
25 #include "sot/sotdllapi.h"
28 /*************************************************************************
29 *************************************************************************/
33 typedef ::std::vector
< SotFactory
* > SotFactoryList
;
34 typedef void * (*CreateInstanceType
)( SotObject
** );
36 //==================class SotFactory=======================================
37 class SOT_DLLPUBLIC SotFactory
: public SvGlobalName
39 sal_uInt16 nSuperCount
; // Anzahl der Superklassen
40 const SotFactory
** pSuperClasses
; // Superklassen
41 CreateInstanceType pCreateFunc
;
45 static sal_Bool
ExistTest( const SvGlobalName
& );
47 virtual ~SotFactory();
50 static void IncSvObjectCount( SotObject
* = NULL
);
51 static void DecSvObjectCount( SotObject
* = NULL
);
53 static const SotFactory
* Find( const SvGlobalName
& );
55 SotFactory( const SvGlobalName
&,
56 const String
& rClassName
, CreateInstanceType
);
58 void PutSuperClass( const SotFactory
* );
59 virtual void * CreateInstance( SotObject
** ppObj
= NULL
) const;
61 sal_Bool
Is( const SotFactory
* pSuperClass
) const;
62 const SotFactory
* GetSuper( sal_uInt16 nPos
) const
64 return nPos
< nSuperCount
?
70 SOT_DLLPRIVATE
SotFactory( const SotFactory
& );
71 SOT_DLLPRIVATE SotFactory
& operator = ( const SotFactory
& );
74 #endif // _FACTORY_HXX
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */