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_CONFIGMGR_SOURCE_COMPONENTS_HXX
21 #define INCLUDED_CONFIGMGR_SOURCE_COMPONENTS_HXX
23 #include <sal/config.h>
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"
35 #include "modifications.hxx"
37 namespace com
{ namespace sun
{ namespace star
{
38 namespace beans
{ class XPropertySet
; }
41 class XComponentContext
;
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
)
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
);
103 Components(const Components
&) = delete;
104 Components
& operator=(const Components
&) = delete;
106 typedef void FileParser(
107 OUString
const &, int, Data
&, Partial
const *, Modifications
*,
111 css::uno::Reference
< css::uno::XComponentContext
> const & context
);
116 void parseFileLeniently(
117 FileParser
* parseFile
, OUString
const & url
, int layer
,
118 Partial
const * partial
, Modifications
* modifications
,
119 Additions
* additions
);
122 int layer
, OUString
const & extension
, FileParser
* parseFile
,
123 OUString
const & url
, bool recursive
);
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
;
149 css::beans::XPropertySet
> >
154 enum class ModificationTarget
{ None
, File
, Dconf
};
156 css::uno::Reference
< css::uno::XComponentContext
>
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_
;
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */