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 .
20 #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
21 #define INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
23 #include "unotools/unotoolsdllapi.h"
24 #include <salhelper/singletonref.hxx>
25 #include <com/sun/star/frame/XModel.hpp>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <rtl/ustring.hxx>
28 #include <sal/types.h>
29 #include <osl/mutex.hxx>
30 #include <unotools/options.hxx>
32 #define FEATUREFLAG_BASICIDE 0x00000020
33 #define FEATUREFLAG_MATH 0x00000100
34 #define FEATUREFLAG_CHART 0x00000200
35 #define FEATUREFLAG_CALC 0x00000800
36 #define FEATUREFLAG_DRAW 0x00001000
37 #define FEATUREFLAG_WRITER 0x00002000
38 #define FEATUREFLAG_IMPRESS 0x00008000
39 #define FEATUREFLAG_INSIGHT 0x00010000
41 /*-************************************************************************************************************//**
42 @short forward declaration to our private date container implementation
43 @descr We use these class as internal member to support small memory requirements.
44 You can create the container if it is neccessary. The class which use these mechanism
45 is faster and smaller then a complete implementation!
46 *//*-*************************************************************************************************************/
47 class SvtModuleOptions_Impl
;
49 /*-************************************************************************************************************//**
50 @short collect information about installation state of modules
51 @descr Use these class to get installation state of different office modules like writer, calc etc
52 Further you can ask for additional information; e.g. name of standard template file, which
53 should be used by corresponding module; or short/long name of these module factory.
58 @devstatus ready to use
60 *//*-*************************************************************************************************************/
61 class UNOTOOLS_DLLPUBLIC SAL_WARN_UNUSED SvtModuleOptions
: public utl::detail::Options
81 If you change these enum ... don't forget to change reading/writing and order of configuration values too!
82 See "SvtModuleOptions_Impl::impl_GetSetNames()" and his ctor for further information.
86 E_UNKNOWN_FACTORY
= -1,
104 virtual ~SvtModuleOptions();
106 sal_Bool
IsModuleInstalled ( EModule eModule
) const;
107 OUString
GetModuleName ( EModule eModule
) const;
108 OUString
GetFactoryName ( EFactory eFactory
) const;
109 OUString
GetFactoryStandardTemplate( EFactory eFactory
) const;
110 OUString
GetFactoryEmptyDocumentURL( EFactory eFactory
) const;
111 OUString
GetFactoryDefaultFilter ( EFactory eFactory
) const;
112 sal_Bool
IsDefaultFilterReadonly ( EFactory eFactory
) const;
113 sal_Int32
GetFactoryIcon ( EFactory eFactory
) const;
114 static sal_Bool
ClassifyFactoryByName ( const OUString
& sName
,
115 EFactory
& eFactory
);
116 void SetFactoryStandardTemplate( EFactory eFactory
,
117 const OUString
& sTemplate
);
118 void SetFactoryDefaultFilter ( EFactory eFactory
,
119 const OUString
& sFilter
);
121 //_______________________________________
123 /** @short return the corresponding application ID for the given
124 document service name.
126 static EFactory
ClassifyFactoryByServiceName(const OUString
& sName
);
128 //_______________________________________
130 /** @short return the corresponding application ID for the given
133 static EFactory
ClassifyFactoryByShortName(const OUString
& sName
);
135 //_______________________________________
137 /** @short return the corresponding application ID for the given properties.
139 @descr Because this search base on filters currently (till we have a better solution)
140 a result is not guaranteed everytimes. May a filter does not exists for the specified
141 content (but a FrameLoader which is not bound to any application!) ... or
142 the given properties describe a stream (and we make no deep detection inside here!).
144 @attention The module BASIC cant be detected here. Because it does not
145 has an own URL schema.
150 @param lMediaDescriptor
151 additional information
153 @return A suitable enum value. See EFactory above.
155 static EFactory
ClassifyFactoryByURL(const OUString
& sURL
,
156 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& lMediaDescriptor
);
158 //_______________________________________
160 /** @short return the corresponding application ID for the given properties.
162 @descr Here we try to use the list of supported service names of the given model
163 to find out the right application module.
165 @attention The module BASIC cant be detected here. Because it does not
166 support any model/ctrl/view paradigm.
171 @return A suitable enum value. See EFactory above.
173 static EFactory
ClassifyFactoryByModel(const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>& xModel
);
175 OUString
GetDefaultModuleName();
177 sal_Bool
IsMath () const;
178 sal_Bool
IsChart () const;
179 sal_Bool
IsCalc () const;
180 sal_Bool
IsDraw () const;
181 sal_Bool
IsWriter () const;
182 sal_Bool
IsImpress () const;
183 sal_Bool
IsBasicIDE () const;
184 sal_Bool
IsDataBase () const;
186 ::com::sun::star::uno::Sequence
< OUString
> GetAllServiceNames();
189 UNOTOOLS_DLLPRIVATE
static ::osl::Mutex
& impl_GetOwnStaticMutex();
193 Don't initialize these static member in these header!
194 a) Double defined symbols will be detected ...
195 b) and unresolved externals exist at linking time.
196 Do it in your source only.
199 static SvtModuleOptions_Impl
* m_pDataContainer
; /// impl. data container as dynamic pointer for smaller memory requirements!
200 static sal_Int32 m_nRefCount
; /// internal ref count mechanism
202 }; // class SvtModuleOptions
204 #endif // #ifndef INCLUDED_SVTOOLS_MODULEOPTIONS_HXX
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */