LibreOffice Module configmgr (master) 1
components.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#pragma once
21
22#include <sal/config.h>
23
24#include <set>
25#include <string_view>
26
27#include <com/sun/star/beans/Optional.hpp>
28#include <com/sun/star/uno/Reference.hxx>
29#include <rtl/ref.hxx>
31
32#include "additions.hxx"
33#include "data.hxx"
34#include "modifications.hxx"
35
36namespace com::sun::star {
37 namespace beans { class XPropertySet; }
38 namespace uno {
39 class Any;
40 class XComponentContext;
41 }
42}
43
44namespace configmgr {
45
46class Broadcaster;
47class Node;
48class Partial;
49class RootAccess;
50
52public:
53 static Components & getSingleton(
54 css::uno::Reference< css::uno::XComponentContext > const & context);
55
56 static bool allLocales(std::u16string_view locale);
57
59 OUString const & pathRepresentation,
60 OUString * canonicRepresentation, std::vector<OUString> * path, int * finalizedLayer)
61 const;
62
63 rtl::Reference< Node > getTemplate( OUString const & fullName) const;
64
66
67 void removeRootAccess(RootAccess * access);
68
70 Modifications const & modifications,
71 rtl::Reference< RootAccess > const & exclude,
72 Broadcaster * broadcaster);
73
74 void addModification(std::vector<OUString> const & path);
75
76 void writeModifications();
77
78 void flushModifications();
79 // must be called with configmgr::lock unacquired; must be called before
80 // shutdown if writeModifications has ever been called (probably
81 // indirectly, via removeExtensionXcuFile)
82
83 void insertExtensionXcsFile(bool shared, OUString const & fileUri);
84
86 bool shared, OUString const & fileUri,
87 Modifications * modifications);
88
90 OUString const & fileUri, Modifications * modifications);
91
93 OUString const & fileUri,
94 std::set< OUString > const & includedPaths,
95 std::set< OUString > const & excludedPaths,
96 Modifications * modifications);
97
98 css::beans::Optional< css::uno::Any >
99 getExternalValue(std::u16string_view descriptor);
100
101private:
102 Components(const Components&) = delete;
103 Components& operator=(const Components&) = delete;
104
105 typedef void FileParser(
106 OUString const &, int, Data &, Partial const *, Modifications *,
107 Additions *);
108public:
109 explicit Components(
110 css::uno::Reference< css::uno::XComponentContext > const & context);
111
112 ~Components();
113private:
114
116 FileParser * parseFile, OUString const & url, int layer,
117 Partial const * partial, Modifications * modifications,
118 Additions * additions);
119
120 void parseFiles(
121 int layer, OUString const & extension, FileParser * parseFile,
122 OUString const & url, bool recursive);
123
124 void parseFileList(
125 int layer, FileParser * parseFile, std::u16string_view urls,
126 bool recordAdditions);
127
128 void parseXcdFiles(int layer, OUString const & url);
129
130 void parseXcsXcuLayer(int layer, OUString const & url);
131
133 int layer, OUString const & url, bool recordAdditions);
134
135 void parseResLayer(int layer, std::u16string_view url);
136
137 void parseModificationLayer(int layer, OUString const & url);
138
139 int getExtensionLayer(bool shared) const;
140
141 typedef
143 css::uno::Reference<
144 css::beans::XPropertySet > >
146
147 class WriteThread;
148
149 enum class ModificationTarget { None, File, Dconf };
150
151 css::uno::Reference< css::uno::XComponentContext >
161 std::shared_ptr<osl::Mutex> lock_;
162};
163
164}
165
166/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void parseFileList(int layer, FileParser *parseFile, std::u16string_view urls, bool recordAdditions)
Definition: components.cxx:719
void insertModificationXcuFile(OUString const &fileUri, std::set< OUString > const &includedPaths, std::set< OUString > const &excludedPaths, Modifications *modifications)
Definition: components.cxx:390
void removeRootAccess(RootAccess *access)
Definition: components.cxx:229
void initGlobalBroadcaster(Modifications const &modifications, rtl::Reference< RootAccess > const &exclude, Broadcaster *broadcaster)
Definition: components.cxx:233
Components(const Components &)=delete
static bool allLocales(std::u16string_view locale)
Definition: components.cxx:207
void removeExtensionXcuFile(OUString const &fileUri, Modifications *modifications)
Definition: components.cxx:336
void addModification(std::vector< OUString > const &path)
Definition: components.cxx:270
void parseXcdFiles(int layer, OUString const &url)
Definition: components.cxx:745
void parseResLayer(int layer, std::u16string_view url)
Definition: components.cxx:860
rtl::Reference< Node > resolvePathRepresentation(OUString const &pathRepresentation, OUString *canonicRepresentation, std::vector< OUString > *path, int *finalizedLayer) const
Definition: components.cxx:211
config_map< css::uno::Reference< css::beans::XPropertySet > > ExternalServices
Definition: components.hxx:145
OUString modificationFileUrl_
Definition: components.hxx:160
std::shared_ptr< osl::Mutex > lock_
Definition: components.hxx:161
void insertExtensionXcsFile(bool shared, OUString const &fileUri)
Definition: components.cxx:309
void parseModificationLayer(int layer, OUString const &url)
Definition: components.cxx:866
css::uno::Reference< css::uno::XComponentContext > context_
Definition: components.hxx:152
int getExtensionLayer(bool shared) const
Definition: components.cxx:884
o3tl::sorted_vector< RootAccess * > roots_
Definition: components.hxx:154
void parseFileLeniently(FileParser *parseFile, OUString const &url, int layer, Partial const *partial, Modifications *modifications, Additions *additions)
Definition: components.cxx:645
rtl::Reference< WriteThread > writeThread_
Definition: components.hxx:156
Components & operator=(const Components &)=delete
void addRootAccess(rtl::Reference< RootAccess > const &access)
Definition: components.cxx:225
void FileParser(OUString const &, int, Data &, Partial const *, Modifications *, Additions *)
Definition: components.hxx:105
rtl::Reference< Node > getTemplate(OUString const &fullName) const
Definition: components.cxx:220
void parseXcsXcuIniLayer(int layer, OUString const &url, bool recordAdditions)
Definition: components.cxx:826
ModificationTarget modificationTarget_
Definition: components.hxx:159
void insertExtensionXcuFile(bool shared, OUString const &fileUri, Modifications *modifications)
Definition: components.cxx:321
void parseFiles(int layer, OUString const &extension, FileParser *parseFile, OUString const &url, bool recursive)
Definition: components.cxx:664
ExternalServices externalServices_
Definition: components.hxx:155
void parseXcsXcuLayer(int layer, OUString const &url)
Definition: components.cxx:820
css::beans::Optional< css::uno::Any > getExternalValue(std::u16string_view descriptor)
Definition: components.cxx:408
static Components & getSingleton(css::uno::Reference< css::uno::XComponentContext > const &context)
Definition: components.cxx:199
std::set< OUString > includedPaths
std::set< OUString > excludedPaths
class SAL_NO_VTABLE XPropertySet
std::vector< std::vector< OUString > > Additions
Definition: additions.hxx:31
None