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>
28 #include <com/sun/star/beans/Optional.hpp>
29 #include <com/sun/star/uno/Reference.hxx>
30 #include <rtl/ref.hxx>
32 #include "additions.hxx"
34 #include "modifications.hxx"
36 namespace com
{ namespace sun
{ namespace star
{
37 namespace beans
{ class XPropertySet
; }
40 class XComponentContext
;
53 static Components
& getSingleton(
54 css::uno::Reference
< css::uno::XComponentContext
> const & context
);
56 static bool allLocales(OUString
const & locale
);
58 rtl::Reference
< Node
> resolvePathRepresentation(
59 OUString
const & pathRepresentation
,
60 OUString
* canonicRepresenation
, std::vector
<OUString
> * path
, int * finalizedLayer
)
63 rtl::Reference
< Node
> getTemplate( OUString
const & fullName
) const;
65 void addRootAccess(rtl::Reference
< RootAccess
> const & access
);
67 void removeRootAccess(RootAccess
* access
);
69 void initGlobalBroadcaster(
70 Modifications
const & modifications
,
71 rtl::Reference
< RootAccess
> const & exclude
,
72 Broadcaster
* broadcaster
);
74 void addModification(std::vector
<OUString
> const & path
);
76 void writeModifications();
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)
83 void insertExtensionXcsFile(bool shared
, OUString
const & fileUri
);
85 void insertExtensionXcuFile(
86 bool shared
, OUString
const & fileUri
,
87 Modifications
* modifications
);
89 void removeExtensionXcuFile(
90 OUString
const & fileUri
, Modifications
* modifications
);
92 void insertModificationXcuFile(
93 OUString
const & fileUri
,
94 std::set
< OUString
> const & includedPaths
,
95 std::set
< OUString
> const & excludedPaths
,
96 Modifications
* modifications
);
98 css::beans::Optional
< css::uno::Any
>
99 getExternalValue(OUString
const & descriptor
);
102 Components(const Components
&) = delete;
103 Components
& operator=(const Components
&) = delete;
105 typedef void FileParser(
106 OUString
const &, int, Data
&, Partial
const *, Modifications
*,
110 css::uno::Reference
< css::uno::XComponentContext
> const & context
);
115 void parseFileLeniently(
116 FileParser
* parseFile
, OUString
const & url
, int layer
,
117 Partial
const * partial
, Modifications
* modifications
,
118 Additions
* additions
);
121 int layer
, OUString
const & extension
, FileParser
* parseFile
,
122 OUString
const & url
, bool recursive
);
125 int layer
, FileParser
* parseFile
, OUString
const & urls
,
126 bool recordAdditions
);
128 void parseXcdFiles(int layer
, OUString
const & url
);
130 void parseXcsXcuLayer(int layer
, OUString
const & url
);
132 void parseXcsXcuIniLayer(
133 int layer
, OUString
const & url
, bool recordAdditions
);
135 void parseModuleLayer(int layer
, OUString
const & url
);
137 void parseResLayer(int layer
, OUString
const & url
);
139 void parseModificationLayer(int layer
, OUString
const & url
);
141 int getExtensionLayer(bool shared
) const;
143 typedef std::set
< RootAccess
* > WeakRootSet
;
148 css::beans::XPropertySet
> >
153 enum class ModificationTarget
{ None
, File
, Dconf
};
155 css::uno::Reference
< css::uno::XComponentContext
>
159 ExternalServices externalServices_
;
160 rtl::Reference
< WriteThread
> writeThread_
;
161 int sharedExtensionLayer_
;
162 int userExtensionLayer_
;
163 ModificationTarget modificationTarget_
;
164 OUString modificationFileUrl_
;
165 std::shared_ptr
<osl::Mutex
> lock_
;
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */