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 .
19 #ifndef INCLUDED_SFX2_DOCFAC_HXX
20 #define INCLUDED_SFX2_DOCFAC_HXX
22 #include <sal/config.h>
23 #include <sfx2/dllapi.h>
24 #include <sal/types.h>
25 #include <tools/rtti.hxx>
27 // SFX_IMPL_MODULE_LIB
28 #include <osl/module.hxx>
29 #include <rtl/ustring.hxx>
31 #include <sfx2/objsh.hxx>
36 struct SfxObjectFactory_Impl
;
37 class SfxFilterContainer
;
40 typedef void (*SfxVoidFunc
)();
43 class SFX2_DLLPUBLIC SfxObjectFactory
46 const char* pShortName
;
47 SfxObjectFactory_Impl
* pImpl
; // Additional Data
48 SfxObjectShellFlags nFlags
;
49 SAL_DLLPRIVATE
void Construct();
52 SfxObjectFactory( const SvGlobalName
&rName
, SfxObjectShellFlags nFlags
, const char* pShortName
);
55 const SvGlobalName
& GetClassId() const;
56 SfxObjectShellFlags
GetFlags() { return nFlags
; }
57 const char* GetShortName() const { return pShortName
; }
58 OUString
GetFactoryURL() const; // shortcut for "private:factory/GetShortName()"
59 OUString
GetFactoryName() const { return OUString::createFromAscii(pShortName
); }
60 OUString
GetModuleName() const;
61 SfxFilterContainer
*GetFilterContainer( bool bForceLoad
= true) const;
64 void RegisterViewFactory(SfxViewFactory
&rFactory
);
65 sal_uInt16
GetViewFactoryCount() const;
66 SfxViewFactory
& GetViewFactory(sal_uInt16 i
= 0) const;
68 /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name
69 SfxViewFactory
* GetViewFactoryByViewName( const OUString
& i_rViewName
) const;
72 const SfxFilter
* GetTemplateFilter() const;
73 static OUString
GetStandardTemplate( const OUString
& rServiceName
);
74 static void SetStandardTemplate( const OUString
& rServiceName
, const OUString
& rTemplateName
);
75 static void SetSystemTemplate( const OUString
& rServiceName
, const OUString
& rTemplateName
);
77 void SetDocumentServiceName( const OUString
& rServiceName
);
78 const OUString
& GetDocumentServiceName() const;
80 SfxModule
* GetModule() const;
82 SAL_DLLPRIVATE
void SetModule_Impl( SfxModule
* );
83 SAL_DLLPRIVATE
static void UpdateFilterContainers_Impl();
84 SAL_DLLPRIVATE sal_uInt16
GetViewNo_Impl( const sal_uInt16 i_nViewId
, const sal_uInt16 i_nFallback
) const;
87 SfxObjectFactory(const SfxObjectFactory
&) SAL_DELETED_FUNCTION
;
88 const SfxObjectFactory
& operator=(const SfxObjectFactory
&) SAL_DELETED_FUNCTION
;
91 #define SFX_DECL_OBJECTFACTORY() \
93 static SfxObjectFactory& Factory(); \
94 virtual SfxObjectFactory& GetFactory() const SAL_OVERRIDE { return Factory(); }
96 #define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,Flags,ShortName) \
97 SfxObjectFactory& ClassName::Factory() \
99 static SfxObjectFactory aObjectFactory(GlobName, Flags, ShortName); \
100 return aObjectFactory; \
102 #endif // INCLUDED_SFX2_DOCFAC_HXX
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */