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 "boost/noncopyable.hpp"
29 #include "boost/shared_ptr.hpp"
30 #include "com/sun/star/beans/Optional.hpp"
31 #include "com/sun/star/uno/Reference.hxx"
32 #include "rtl/ref.hxx"
34 #include "additions.hxx"
36 #include "modifications.hxx"
39 namespace com
{ namespace sun
{ namespace star
{
40 namespace beans
{ class XPropertySet
; }
43 class XComponentContext
;
46 namespace rtl
{ class OUString
; }
55 class Components
: private boost::noncopyable
{
57 static Components
& getSingleton(
58 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>
61 static bool allLocales(rtl::OUString
const & locale
);
63 rtl::Reference
< Node
> resolvePathRepresentation(
64 rtl::OUString
const & pathRepresentation
,
65 rtl::OUString
* canonicRepresenation
, Path
* path
, int * finalizedLayer
)
68 rtl::Reference
< Node
> getTemplate(
69 int layer
, rtl::OUString
const & fullName
) const;
71 void addRootAccess(rtl::Reference
< RootAccess
> const & access
);
73 void removeRootAccess(RootAccess
* access
);
75 void initGlobalBroadcaster(
76 Modifications
const & modifications
,
77 rtl::Reference
< RootAccess
> const & exclude
,
78 Broadcaster
* broadcaster
);
80 void addModification(Path
const & path
);
82 void writeModifications();
84 bool hasModifications() const;
86 void flushModifications();
87 // must be called with configmgr::lock unaquired; must be called before
88 // shutdown if writeModifications has ever been called (probably
89 // indirectly, via removeExtensionXcuFile)
91 void insertExtensionXcsFile(bool shared
, rtl::OUString
const & fileUri
);
93 void insertExtensionXcuFile(
94 bool shared
, rtl::OUString
const & fileUri
,
95 Modifications
* modifications
);
97 void removeExtensionXcuFile(
98 rtl::OUString
const & fileUri
, Modifications
* modifications
);
100 void insertModificationXcuFile(
101 rtl::OUString
const & fileUri
,
102 std::set
< rtl::OUString
> const & includedPaths
,
103 std::set
< rtl::OUString
> const & excludedPaths
,
104 Modifications
* modifications
);
106 com::sun::star::beans::Optional
< com::sun::star::uno::Any
>
107 getExternalValue(rtl::OUString
const & descriptor
);
110 typedef void FileParser(
111 rtl::OUString
const &, int, Data
&, Partial
const *, Modifications
*,
115 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>
121 void parseFileLeniently(
122 FileParser
* parseFile
, rtl::OUString
const & url
, int layer
,
123 Data
& data
, Partial
const * partial
, Modifications
* modifications
,
124 Additions
* additions
);
127 int layer
, rtl::OUString
const & extension
, FileParser
* parseFile
,
128 rtl::OUString
const & url
, bool recursive
);
131 int layer
, FileParser
* parseFile
, rtl::OUString
const & urls
,
132 bool recordAdditions
);
134 void parseXcdFiles(int layer
, rtl::OUString
const & url
);
136 void parseXcsXcuLayer(int layer
, rtl::OUString
const & url
);
138 void parseXcsXcuIniLayer(
139 int layer
, rtl::OUString
const & url
, bool recordAdditions
);
141 void parseModuleLayer(int layer
, rtl::OUString
const & url
);
143 void parseResLayer(int layer
, rtl::OUString
const & url
);
145 void parseModificationLayer(rtl::OUString
const & url
);
147 int getExtensionLayer(bool shared
);
149 typedef std::set
< RootAccess
* > WeakRootSet
;
154 com::sun::star::uno::Reference
<
155 com::sun::star::beans::XPropertySet
> >
160 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>
164 ExternalServices externalServices_
;
165 rtl::Reference
< WriteThread
> writeThread_
;
166 int sharedExtensionLayer_
;
167 int userExtensionLayer_
;
168 rtl::OUString modificationFileUrl_
;
169 boost::shared_ptr
<osl::Mutex
> lock_
;
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */