build fix
[LibreOffice.git] / include / sfx2 / docfac.hxx
blob547ad584b19a29709b7a01365346a6aaa048e80c
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 .
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>
26 // SFX_IMPL_MODULE_LIB
27 #include <osl/module.hxx>
28 #include <rtl/ustring.hxx>
30 #include <sfx2/objsh.hxx>
31 #include <memory>
33 class SfxMedium;
34 class SfxFilter;
35 class SfxViewFactory;
36 struct SfxObjectFactory_Impl;
37 class SfxFilterContainer;
38 class SfxBindings;
40 typedef void (*SfxVoidFunc)();
43 class SFX2_DLLPUBLIC SfxObjectFactory
45 private:
46 const char* pShortName;
47 std::unique_ptr<SfxObjectFactory_Impl> pImpl; // Additional Data
48 SfxObjectShellFlags nFlags;
50 public:
51 SfxObjectFactory( const SvGlobalName &rName, SfxObjectShellFlags nFlags, const char* pShortName );
52 ~SfxObjectFactory();
54 const SvGlobalName& GetClassId() const;
55 SfxObjectShellFlags GetFlags() { return nFlags; }
56 const char* GetShortName() const { return pShortName; }
57 OUString GetFactoryURL() const; // shortcut for "private:factory/GetShortName()"
58 OUString GetFactoryName() const { return OUString::createFromAscii(pShortName); }
59 OUString GetModuleName() const;
60 SfxFilterContainer *GetFilterContainer() const;
62 // Views
63 void RegisterViewFactory(SfxViewFactory &rFactory);
64 sal_uInt16 GetViewFactoryCount() const;
65 SfxViewFactory& GetViewFactory(sal_uInt16 i = 0) const;
67 /// returns the view factory whose GetAPIViewName or GetLegacyViewName delivers the requested logical name
68 SfxViewFactory* GetViewFactoryByViewName( const OUString& i_rViewName ) const;
70 // Filter
71 std::shared_ptr<const SfxFilter> GetTemplateFilter() const;
72 static OUString GetStandardTemplate( const OUString& rServiceName );
73 static void SetStandardTemplate( const OUString& rServiceName, const OUString& rTemplateName );
74 static void SetSystemTemplate( const OUString& rServiceName, const OUString& rTemplateName );
76 void SetDocumentServiceName( const OUString& rServiceName );
77 const OUString& GetDocumentServiceName() const;
79 SfxModule* GetModule() const;
81 SAL_DLLPRIVATE void SetModule_Impl( SfxModule* );
82 SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const;
84 private:
85 SfxObjectFactory(const SfxObjectFactory&) = delete;
86 const SfxObjectFactory& operator=(const SfxObjectFactory &) = delete;
89 #define SFX_DECL_OBJECTFACTORY() \
90 public: \
91 static SfxObjectFactory& Factory(); \
92 virtual SfxObjectFactory& GetFactory() const override { return Factory(); }
94 #define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,Flags,ShortName) \
95 SfxObjectFactory& ClassName::Factory() \
96 { \
97 static SfxObjectFactory aObjectFactory(GlobName, Flags, ShortName); \
98 return aObjectFactory; \
100 #endif // INCLUDED_SFX2_DOCFAC_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */