bump product version to 6.3.0.0.beta1
[LibreOffice.git] / configmgr / source / components.hxx
blob5006c864acdc64dc0185db4ad53849fa137a73bf
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"
37 namespace com { namespace sun { namespace star {
38 namespace beans { class XPropertySet; }
39 namespace uno {
40 class Any;
41 class XComponentContext;
43 } } }
45 namespace configmgr {
47 class Broadcaster;
48 class Node;
49 class Partial;
50 class RootAccess;
52 class Components {
53 public:
54 static Components & getSingleton(
55 css::uno::Reference< css::uno::XComponentContext > const & context);
57 static bool allLocales(OUString const & locale);
59 rtl::Reference< Node > resolvePathRepresentation(
60 OUString const & pathRepresentation,
61 OUString * canonicRepresenation, std::vector<OUString> * path, int * finalizedLayer)
62 const;
64 rtl::Reference< Node > getTemplate( OUString const & fullName) const;
66 void addRootAccess(rtl::Reference< RootAccess > const & access);
68 void removeRootAccess(RootAccess * access);
70 void initGlobalBroadcaster(
71 Modifications const & modifications,
72 rtl::Reference< RootAccess > const & exclude,
73 Broadcaster * broadcaster);
75 void addModification(std::vector<OUString> const & path);
77 void writeModifications();
79 void flushModifications();
80 // must be called with configmgr::lock unacquired; must be called before
81 // shutdown if writeModifications has ever been called (probably
82 // indirectly, via removeExtensionXcuFile)
84 void insertExtensionXcsFile(bool shared, OUString const & fileUri);
86 void insertExtensionXcuFile(
87 bool shared, OUString const & fileUri,
88 Modifications * modifications);
90 void removeExtensionXcuFile(
91 OUString const & fileUri, Modifications * modifications);
93 void insertModificationXcuFile(
94 OUString const & fileUri,
95 std::set< OUString > const & includedPaths,
96 std::set< OUString > const & excludedPaths,
97 Modifications * modifications);
99 css::beans::Optional< css::uno::Any >
100 getExternalValue(OUString const & descriptor);
102 private:
103 Components(const Components&) = delete;
104 Components& operator=(const Components&) = delete;
106 typedef void FileParser(
107 OUString const &, int, Data &, Partial const *, Modifications *,
108 Additions *);
109 public:
110 explicit Components(
111 css::uno::Reference< css::uno::XComponentContext > const & context);
113 ~Components();
114 private:
116 void parseFileLeniently(
117 FileParser * parseFile, OUString const & url, int layer,
118 Partial const * partial, Modifications * modifications,
119 Additions * additions);
121 void parseFiles(
122 int layer, OUString const & extension, FileParser * parseFile,
123 OUString const & url, bool recursive);
125 void parseFileList(
126 int layer, FileParser * parseFile, OUString const & urls,
127 bool recordAdditions);
129 void parseXcdFiles(int layer, OUString const & url);
131 void parseXcsXcuLayer(int layer, OUString const & url);
133 void parseXcsXcuIniLayer(
134 int layer, OUString const & url, bool recordAdditions);
136 void parseModuleLayer(int layer, OUString const & url);
138 void parseResLayer(int layer, OUString const & url);
140 void parseModificationLayer(int layer, OUString const & url);
142 int getExtensionLayer(bool shared) const;
144 typedef std::set< RootAccess * > WeakRootSet;
146 typedef
147 config_map<
148 css::uno::Reference<
149 css::beans::XPropertySet > >
150 ExternalServices;
152 class WriteThread;
154 enum class ModificationTarget { None, File, Dconf };
156 css::uno::Reference< css::uno::XComponentContext >
157 context_;
158 Data data_;
159 WeakRootSet roots_;
160 ExternalServices externalServices_;
161 rtl::Reference< WriteThread > writeThread_;
162 int sharedExtensionLayer_;
163 int userExtensionLayer_;
164 ModificationTarget modificationTarget_;
165 OUString modificationFileUrl_;
166 std::shared_ptr<osl::Mutex> lock_;
171 #endif
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */