Branch libreoffice-5-0-4
[LibreOffice.git] / include / sot / factory.hxx
blobd5a4f2ac457d6fe74ff17c7dab061ca4c59bf3fa
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SOT_FACTORY_HXX
21 #define INCLUDED_SOT_FACTORY_HXX
23 #include <tools/globname.hxx>
24 #include <tools/rtti.hxx>
25 #include <sot/sotdllapi.h>
26 #include <vector>
28 /*************************************************************************
29 *************************************************************************/
30 class SotObject;
31 class SotFactory;
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;
43 OUString aClassName;
45 static bool ExistTest( const SvGlobalName & );
46 protected:
47 virtual ~SotFactory();
48 public:
49 TYPEINFO();
50 static void IncSvObjectCount( SotObject * = NULL );
51 static void DecSvObjectCount( SotObject * = NULL );
53 #ifdef DBG_UTIL
54 static const SotFactory * Find( const SvGlobalName & );
55 #endif
57 SotFactory( const SvGlobalName &,
58 const OUString & rClassName, CreateInstanceType );
60 void PutSuperClass( const SotFactory * );
62 bool Is( const SotFactory * pSuperClass ) const;
63 const SotFactory * GetSuper( sal_uInt16 nPos ) const
65 return nPos < nSuperCount ?
66 pSuperClasses[ nPos ]
67 : NULL;
70 private:
71 SotFactory( const SotFactory & ) SAL_DELETED_FUNCTION;
72 SotFactory & operator = ( const SotFactory & ) SAL_DELETED_FUNCTION;
75 #endif // _FACTORY_HXX
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */