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 .
22 #include <sal/config.h>
26 #include <com/sun/star/beans/Optional.hpp>
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <rtl/ref.hxx>
29 #include <o3tl/sorted_vector.hxx>
31 #include "additions.hxx"
33 #include "modifications.hxx"
35 namespace com::sun::star
{
36 namespace beans
{ class XPropertySet
; }
39 class XComponentContext
;
52 static Components
& getSingleton(
53 css::uno::Reference
< css::uno::XComponentContext
> const & context
);
55 static bool allLocales(OUString
const & locale
);
57 rtl::Reference
< Node
> resolvePathRepresentation(
58 OUString
const & pathRepresentation
,
59 OUString
* canonicRepresentation
, std::vector
<OUString
> * path
, int * finalizedLayer
)
62 rtl::Reference
< Node
> getTemplate( OUString
const & fullName
) const;
64 void addRootAccess(rtl::Reference
< RootAccess
> const & access
);
66 void removeRootAccess(RootAccess
* access
);
68 void initGlobalBroadcaster(
69 Modifications
const & modifications
,
70 rtl::Reference
< RootAccess
> const & exclude
,
71 Broadcaster
* broadcaster
);
73 void addModification(std::vector
<OUString
> const & path
);
75 void writeModifications();
77 void flushModifications();
78 // must be called with configmgr::lock unacquired; must be called before
79 // shutdown if writeModifications has ever been called (probably
80 // indirectly, via removeExtensionXcuFile)
82 void insertExtensionXcsFile(bool shared
, OUString
const & fileUri
);
84 void insertExtensionXcuFile(
85 bool shared
, OUString
const & fileUri
,
86 Modifications
* modifications
);
88 void removeExtensionXcuFile(
89 OUString
const & fileUri
, Modifications
* modifications
);
91 void insertModificationXcuFile(
92 OUString
const & fileUri
,
93 std::set
< OUString
> const & includedPaths
,
94 std::set
< OUString
> const & excludedPaths
,
95 Modifications
* modifications
);
97 css::beans::Optional
< css::uno::Any
>
98 getExternalValue(OUString
const & descriptor
);
101 Components(const Components
&) = delete;
102 Components
& operator=(const Components
&) = delete;
104 typedef void FileParser(
105 OUString
const &, int, Data
&, Partial
const *, Modifications
*,
109 css::uno::Reference
< css::uno::XComponentContext
> const & context
);
114 void parseFileLeniently(
115 FileParser
* parseFile
, OUString
const & url
, int layer
,
116 Partial
const * partial
, Modifications
* modifications
,
117 Additions
* additions
);
120 int layer
, OUString
const & extension
, FileParser
* parseFile
,
121 OUString
const & url
, bool recursive
);
124 int layer
, FileParser
* parseFile
, OUString
const & urls
,
125 bool recordAdditions
);
127 void parseXcdFiles(int layer
, OUString
const & url
);
129 void parseXcsXcuLayer(int layer
, OUString
const & url
);
131 void parseXcsXcuIniLayer(
132 int layer
, OUString
const & url
, bool recordAdditions
);
134 void parseResLayer(int layer
, OUString
const & url
);
136 void parseModificationLayer(int layer
, OUString
const & url
);
138 int getExtensionLayer(bool shared
) const;
143 css::beans::XPropertySet
> >
148 enum class ModificationTarget
{ None
, File
, Dconf
};
150 css::uno::Reference
< css::uno::XComponentContext
>
153 o3tl::sorted_vector
< RootAccess
* > roots_
;
154 ExternalServices externalServices_
;
155 rtl::Reference
< WriteThread
> writeThread_
;
156 int sharedExtensionLayer_
;
157 int userExtensionLayer_
;
158 ModificationTarget modificationTarget_
;
159 OUString modificationFileUrl_
;
160 std::shared_ptr
<osl::Mutex
> lock_
;
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */