LibreOffice Module sfx2 (master) 1
docfac.hxx
Go to the documentation of this file.
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
26#include <rtl/ustring.hxx>
27#include <sfx2/shell.hxx>
28#include <memory>
29
30class SfxFilter;
31class SfxViewFactory;
34class SvGlobalName;
35class SfxModule;
36
37typedef void (*SfxVoidFunc)();
38
39
41{
42private:
43 const OUString m_sFactoryName;
44 std::unique_ptr<SfxObjectFactory_Impl> pImpl; // Additional Data
45
46public:
47 SfxObjectFactory( const SvGlobalName &rName, OUString sFactoryName );
49
50 const SvGlobalName& GetClassId() const;
51 OUString GetFactoryURL() const; // shortcut for "private:factory/GetShortName()"
52 const OUString& GetFactoryName() const { return m_sFactoryName; }
53 OUString GetModuleName() const;
54 SfxFilterContainer *GetFilterContainer() const;
55
56 // Views
57 void RegisterViewFactory(SfxViewFactory &rFactory);
58 sal_uInt16 GetViewFactoryCount() const;
59 SfxViewFactory& GetViewFactory(sal_uInt16 i = 0) const;
60
62 SfxViewFactory* GetViewFactoryByViewName( std::u16string_view i_rViewName ) const;
63
64 // Filter
65 std::shared_ptr<const SfxFilter> GetTemplateFilter() const;
66 static OUString GetStandardTemplate( std::u16string_view rServiceName );
67 static void SetStandardTemplate( const OUString& rServiceName, const OUString& rTemplateName );
68 static void SetSystemTemplate( const OUString& rServiceName, const OUString& rTemplateName );
69
70 void SetDocumentServiceName( const OUString& rServiceName );
71 const OUString& GetDocumentServiceName() const;
72
73 SfxModule* GetModule() const;
74
75 SAL_DLLPRIVATE void SetModule_Impl( SfxModule* );
76 SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const SfxInterfaceId i_nViewId, const sal_uInt16 i_nFallback ) const;
77
78private:
81};
82
83#define SFX_DECL_OBJECTFACTORY() \
84public: \
85 static SfxObjectFactory& Factory(); \
86 virtual SfxObjectFactory& GetFactory() const override { return Factory(); }
87
88#define SFX_IMPL_OBJECTFACTORY(ClassName,GlobName,ShortName) \
89 SfxObjectFactory& ClassName::Factory() \
90 { \
91 static SfxObjectFactory aObjectFactory(GlobName, ShortName); \
92 return aObjectFactory; \
93 }
94#endif // INCLUDED_SFX2_DOCFAC_HXX
95
96/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetFactoryName() const
Definition: docfac.hxx:52
SfxObjectFactory(const SfxObjectFactory &)=delete
const SfxObjectFactory & operator=(const SfxObjectFactory &)=delete
const OUString m_sFactoryName
Definition: docfac.hxx:43
std::unique_ptr< SfxObjectFactory_Impl > pImpl
Definition: docfac.hxx:44
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
void(* SfxVoidFunc)()
Definition: docfac.hxx:37