Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SFX2_DOCFAC_HXX
20 : #define INCLUDED_SFX2_DOCFAC_HXX
21 :
22 : #include <sal/config.h>
23 : #include <sfx2/dllapi.h>
24 : #include <sal/types.h>
25 : #include <tools/rtti.hxx>
26 :
27 : // SFX_IMPL_MODULE_LIB
28 : #include <osl/module.hxx>
29 : #include <rtl/ustring.hxx>
30 :
31 : #include <sfx2/objsh.hxx>
32 : #include <sfx2/sfxdefs.hxx>
33 :
34 : class SfxMedium;
35 : class SfxFilter;
36 : class SfxViewFactory;
37 : struct SfxObjectFactory_Impl;
38 : class SfxFilterContainer;
39 : class SfxBindings;
40 :
41 : typedef void (*SfxVoidFunc)();
42 :
43 : #define SDT_SDT_DOCFACTPRIO 10 // Explorer
44 : #define SDT_SW_DOCFACTPRIO 20 // Text Document
45 : #define SDT_SWW_DOCFACTPRIO 21 // Web Document
46 : #define SDT_SC_DOCFACTPRIO 30 // Table Document
47 : #define SDT_SI_DOCFACTPRIO 40 // Impress Document
48 : #define SDT_SD_DOCFACTPRIO 41 // Draw Document
49 : #define SDT_SCH_DOCFACTPRIO 50 // Chart Document
50 : #define SDT_SMA_DOCFACTPRIO 60 // Math Document
51 : #define SDT_SIM_DOCFACTPRIO 70 // Image Document
52 : #define SDT_FRM_DOCFACTPRIO 100 // Frame Document
53 : #define SDT_MSG_DOCFACTPRIO 110 // Message Document
54 : #define SDT_SDB_DOCFACTPRIO 200 // Database Document
55 :
56 : class SFX2_DLLPUBLIC SfxObjectFactory
57 : {
58 : private:
59 : const char* pShortName;
60 : SfxObjectFactory_Impl* pImpl; // Additional Data
61 : SfxObjectShellFlags nFlags;
62 : SAL_DLLPRIVATE void Construct();
63 :
64 : public:
65 : SfxObjectFactory( const SvGlobalName &rName, SfxObjectShellFlags nFlags, const char* pShortName );
66 : ~SfxObjectFactory();
67 :
68 : const SvGlobalName& GetClassId() const;
69 0 : SfxObjectShellFlags GetFlags() { return nFlags; }
70 0 : const char* GetShortName() const { return pShortName; }
71 : OUString GetFactoryURL() const; // shortcut for "private:factory/GetShortName()"
72 0 : OUString GetFactoryName() const { return OUString::createFromAscii(pShortName); }
73 : OUString GetModuleName() const;
74 : SfxFilterContainer *GetFilterContainer( bool bForceLoad = true) const;
75 :
76 : // Views
77 : void RegisterViewFactory(SfxViewFactory &rFactory);
78 : sal_uInt16 GetViewFactoryCount() const;
79 : SfxViewFactory& GetViewFactory(sal_uInt16 i = 0) const;
80 :
81 : /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name
82 : SfxViewFactory* GetViewFactoryByViewName( const OUString& i_rViewName ) const;
83 :
84 : // Filter
85 : const SfxFilter* GetTemplateFilter() const;
86 : static OUString GetStandardTemplate( const OUString& rServiceName );
87 : static void SetStandardTemplate( const OUString& rServiceName, const OUString& rTemplateName );
88 : static void SetSystemTemplate( const OUString& rServiceName, const OUString& rTemplateName );
89 :
90 : void SetDocumentServiceName( const OUString& rServiceName );
91 : const OUString& GetDocumentServiceName() const;
92 :
93 : SfxModule* GetModule() const;
94 :
95 : SAL_DLLPRIVATE void SetModule_Impl( SfxModule* );
96 : SAL_DLLPRIVATE static void UpdateFilterContainers_Impl();
97 : SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const;
98 :
99 : private:
100 : // Kopieren verboten
101 : SAL_DLLPRIVATE SfxObjectFactory(const SfxObjectFactory&);
102 : SAL_DLLPRIVATE const SfxObjectFactory& operator=(const SfxObjectFactory &);
103 : };
104 :
105 : #define SFX_DECL_OBJECTFACTORY() \
106 : public: \
107 : static SfxObjectFactory& Factory(); \
108 : virtual SfxObjectFactory& GetFactory() const SAL_OVERRIDE { return Factory(); }
109 :
110 : #define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,Flags,ShortName) \
111 : SfxObjectFactory& ClassName::Factory() \
112 : { \
113 : static SfxObjectFactory aObjectFactory(GlobName, Flags, ShortName); \
114 : return aObjectFactory; \
115 : }
116 : #endif // INCLUDED_SFX2_DOCFAC_HXX
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|