LibreOffice Module unotools (master) 1
moduleoptions.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
20#ifndef INCLUDED_UNOTOOLS_MODULEOPTIONS_HXX
21#define INCLUDED_UNOTOOLS_MODULEOPTIONS_HXX
22
24#include <com/sun/star/uno/Sequence.hxx>
25#include <rtl/ustring.hxx>
26#include <sal/types.h>
27#include <unotools/options.hxx>
28#include <memory>
29
30namespace com::sun::star::frame { class XModel; }
31namespace com::sun::star::beans { struct PropertyValue; }
32
33/*-************************************************************************************************************
34 @short forward declaration to our private date container implementation
35 @descr We use these class as internal member to support small memory requirements.
36 You can create the container if it is necessary. The class which use these mechanism
37 is faster and smaller then a complete implementation!
38*//*-*************************************************************************************************************/
40
41/*-************************************************************************************************************
42 @short collect information about installation state of modules
43 @descr Use these class to get installation state of different office modules like writer, calc etc
44 Further you can ask for additional information; e.g. name of standard template file, which
45 should be used by corresponding module; or short/long name of these module factory.
46 @devstatus ready to use
47 @threadsafe yes
48*//*-*************************************************************************************************************/
50{
51 public:
52
53 enum class EModule
54 {
55 WRITER = 0,
56 CALC = 1,
57 DRAW = 2,
58 IMPRESS = 3,
59 MATH = 4,
60 CHART = 5,
61 STARTMODULE = 6,
62 BASIC = 7,
63 DATABASE = 8,
64 WEB = 9,
65 GLOBAL = 10
66 };
67
68 /*ATTENTION:
69 If you change these enum ... don't forget to change reading/writing and order of configuration values too!
70 See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further information.
71 */
72 enum class EFactory
73 {
74 UNKNOWN_FACTORY = -1,
75 WRITER = 0,
76 WRITERWEB = 1,
77 WRITERGLOBAL = 2,
78 CALC = 3,
79 DRAW = 4,
80 IMPRESS = 5,
81 MATH = 6,
82 CHART = 7,
83 STARTMODULE = 8,
84 DATABASE = 9,
85 BASIC = 10,
86 LAST = BASIC
87 };
88
89 public:
91 virtual ~SvtModuleOptions() override;
92
93 bool IsModuleInstalled ( EModule eModule ) const;
94 OUString GetModuleName ( EModule eModule ) const;
95 const OUString & GetFactoryName ( EFactory eFactory ) const;
96 OUString GetFactoryStandardTemplate( EFactory eFactory ) const;
97 OUString GetFactoryEmptyDocumentURL( EFactory eFactory ) const;
98 OUString GetFactoryDefaultFilter ( EFactory eFactory ) const;
99 bool IsDefaultFilterReadonly ( EFactory eFactory ) const;
100 sal_Int32 GetFactoryIcon ( EFactory eFactory ) const;
101 static bool ClassifyFactoryByName ( std::u16string_view sName ,
102 EFactory& eFactory );
103 void SetFactoryStandardTemplate( EFactory eFactory ,
104 const OUString& sTemplate );
105 void SetFactoryDefaultFilter ( EFactory eFactory ,
106 const OUString& sFilter );
107
111 static EFactory ClassifyFactoryByServiceName(std::u16string_view sName);
112
116 static EFactory ClassifyFactoryByShortName(std::u16string_view sName);
117
136 static EFactory ClassifyFactoryByURL(const OUString& sURL ,
137 const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor);
138
152 static EFactory ClassifyFactoryByModel(const css::uno::Reference< css::frame::XModel >& xModel);
153
154 static OUString GetFactoryShortName(EFactory eFactory);
155
156 OUString GetDefaultModuleName() const;
157
158 bool IsMath () const;
159 bool IsChart () const;
160 bool IsCalc () const;
161 bool IsDraw () const;
162 bool IsWriter () const;
163 bool IsImpress () const;
164 static bool IsBasicIDE () { return true; }
165 bool IsDataBase () const;
166
167 css::uno::Sequence < OUString > GetAllServiceNames();
168
169 private:
170 std::shared_ptr<SvtModuleOptions_Impl> m_pImpl;
171
172}; // class SvtModuleOptions
173
174#endif // INCLUDED_UNOTOOLS_MODULEOPTIONS_HXX
175
176/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool IsBasicIDE()
std::shared_ptr< SvtModuleOptions_Impl > m_pImpl
GLOBAL
WRITER
IMPRESS
WEB
DRAW
DATABASE
CALC
MATH
#define SAL_WARN_UNUSED
#define UNOTOOLS_DLLPUBLIC