bump product version to 5.0.4.1
[LibreOffice.git] / configmgr / source / components.hxx
blob249507efeb953cd462732ac7915a655198034797
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 .
20 #ifndef INCLUDED_CONFIGMGR_SOURCE_COMPONENTS_HXX
21 #define INCLUDED_CONFIGMGR_SOURCE_COMPONENTS_HXX
23 #include <sal/config.h>
25 #include <map>
26 #include <memory>
27 #include <set>
29 #include <com/sun/star/beans/Optional.hpp>
30 #include <com/sun/star/uno/Reference.hxx>
31 #include <rtl/ref.hxx>
33 #include "additions.hxx"
34 #include "data.hxx"
35 #include "modifications.hxx"
36 #include "path.hxx"
38 namespace com { namespace sun { namespace star {
39 namespace beans { class XPropertySet; }
40 namespace uno {
41 class Any;
42 class XComponentContext;
44 } } }
46 namespace configmgr {
48 class Broadcaster;
49 class Node;
50 class Partial;
51 class RootAccess;
53 class Components {
54 public:
55 static Components & getSingleton(
56 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
57 const & context);
59 static bool allLocales(OUString const & locale);
61 rtl::Reference< Node > resolvePathRepresentation(
62 OUString const & pathRepresentation,
63 OUString * canonicRepresenation, Path * path, int * finalizedLayer)
64 const;
66 rtl::Reference< Node > getTemplate(
67 int layer, OUString const & fullName) const;
69 void addRootAccess(rtl::Reference< RootAccess > const & access);
71 void removeRootAccess(RootAccess * access);
73 void initGlobalBroadcaster(
74 Modifications const & modifications,
75 rtl::Reference< RootAccess > const & exclude,
76 Broadcaster * broadcaster);
78 void addModification(Path const & path);
80 void writeModifications();
82 bool hasModifications() const;
84 void flushModifications();
85 // must be called with configmgr::lock unaquired; must be called before
86 // shutdown if writeModifications has ever been called (probably
87 // indirectly, via removeExtensionXcuFile)
89 void insertExtensionXcsFile(bool shared, OUString const & fileUri);
91 void insertExtensionXcuFile(
92 bool shared, OUString const & fileUri,
93 Modifications * modifications);
95 void removeExtensionXcuFile(
96 OUString const & fileUri, Modifications * modifications);
98 void insertModificationXcuFile(
99 OUString const & fileUri,
100 std::set< OUString > const & includedPaths,
101 std::set< OUString > const & excludedPaths,
102 Modifications * modifications);
104 com::sun::star::beans::Optional< com::sun::star::uno::Any >
105 getExternalValue(OUString const & descriptor);
107 private:
108 Components(const Components&) SAL_DELETED_FUNCTION;
109 Components& operator=(const Components&) SAL_DELETED_FUNCTION;
111 typedef void FileParser(
112 OUString const &, int, Data &, Partial const *, Modifications *,
113 Additions *);
114 public:
115 Components(
116 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
117 const & context);
119 ~Components();
120 private:
122 static void parseFileLeniently(
123 FileParser * parseFile, OUString const & url, int layer,
124 Data & data, Partial const * partial, Modifications * modifications,
125 Additions * additions);
127 void parseFiles(
128 int layer, OUString const & extension, FileParser * parseFile,
129 OUString const & url, bool recursive);
131 void parseFileList(
132 int layer, FileParser * parseFile, OUString const & urls,
133 bool recordAdditions);
135 void parseXcdFiles(int layer, OUString const & url);
137 void parseXcsXcuLayer(int layer, OUString const & url);
139 void parseXcsXcuIniLayer(
140 int layer, OUString const & url, bool recordAdditions);
142 void parseModuleLayer(int layer, OUString const & url);
144 void parseResLayer(int layer, OUString const & url);
146 void parseModificationLayer(OUString const & url);
148 int getExtensionLayer(bool shared);
150 typedef std::set< RootAccess * > WeakRootSet;
152 typedef
153 config_map<
154 com::sun::star::uno::Reference<
155 com::sun::star::beans::XPropertySet > >
156 ExternalServices;
158 class WriteThread;
160 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
161 context_;
162 Data data_;
163 WeakRootSet roots_;
164 ExternalServices externalServices_;
165 rtl::Reference< WriteThread > writeThread_;
166 int sharedExtensionLayer_;
167 int userExtensionLayer_;
168 OUString modificationFileUrl_;
169 std::shared_ptr<osl::Mutex> lock_;
174 #endif
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */