Bump version to 4.1-6
[LibreOffice.git] / configmgr / source / components.hxx
blob6ecda33f7a9b145088146078839c851205eccf42
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
25 #include <map>
26 #include <set>
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"
35 #include "data.hxx"
36 #include "modifications.hxx"
37 #include "path.hxx"
39 namespace com { namespace sun { namespace star {
40 namespace beans { class XPropertySet; }
41 namespace uno {
42 class Any;
43 class XComponentContext;
45 } } }
47 namespace configmgr {
49 class Broadcaster;
50 class Node;
51 class Partial;
52 class RootAccess;
54 class Components: private boost::noncopyable {
55 public:
56 static Components & getSingleton(
57 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
58 const & context);
60 static bool allLocales(OUString const & locale);
62 rtl::Reference< Node > resolvePathRepresentation(
63 OUString const & pathRepresentation,
64 OUString * canonicRepresenation, Path * path, int * finalizedLayer)
65 const;
67 rtl::Reference< Node > getTemplate(
68 int layer, OUString const & fullName) const;
70 void addRootAccess(rtl::Reference< RootAccess > const & access);
72 void removeRootAccess(RootAccess * access);
74 void initGlobalBroadcaster(
75 Modifications const & modifications,
76 rtl::Reference< RootAccess > const & exclude,
77 Broadcaster * broadcaster);
79 void addModification(Path const & path);
81 void writeModifications();
83 bool hasModifications() const;
85 void flushModifications();
86 // must be called with configmgr::lock unaquired; must be called before
87 // shutdown if writeModifications has ever been called (probably
88 // indirectly, via removeExtensionXcuFile)
90 void insertExtensionXcsFile(bool shared, OUString const & fileUri);
92 void insertExtensionXcuFile(
93 bool shared, OUString const & fileUri,
94 Modifications * modifications);
96 void removeExtensionXcuFile(
97 OUString const & fileUri, Modifications * modifications);
99 void insertModificationXcuFile(
100 OUString const & fileUri,
101 std::set< OUString > const & includedPaths,
102 std::set< OUString > const & excludedPaths,
103 Modifications * modifications);
105 com::sun::star::beans::Optional< com::sun::star::uno::Any >
106 getExternalValue(OUString const & descriptor);
108 private:
109 typedef void FileParser(
110 OUString const &, int, Data &, Partial const *, Modifications *,
111 Additions *);
112 public:
113 Components(
114 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
115 const & context);
117 ~Components();
118 private:
120 void parseFileLeniently(
121 FileParser * parseFile, OUString const & url, int layer,
122 Data & data, Partial const * partial, Modifications * modifications,
123 Additions * additions);
125 void parseFiles(
126 int layer, OUString const & extension, FileParser * parseFile,
127 OUString const & url, bool recursive);
129 void parseFileList(
130 int layer, FileParser * parseFile, OUString const & urls,
131 bool recordAdditions);
133 void parseXcdFiles(int layer, OUString const & url);
135 void parseXcsXcuLayer(int layer, OUString const & url);
137 void parseXcsXcuIniLayer(
138 int layer, OUString const & url, bool recordAdditions);
140 void parseModuleLayer(int layer, OUString const & url);
142 void parseResLayer(int layer, OUString const & url);
144 void parseModificationLayer(OUString const & url);
146 int getExtensionLayer(bool shared);
148 typedef std::set< RootAccess * > WeakRootSet;
150 typedef
151 std::map<
152 OUString,
153 com::sun::star::uno::Reference<
154 com::sun::star::beans::XPropertySet > >
155 ExternalServices;
157 class WriteThread;
159 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
160 context_;
161 Data data_;
162 WeakRootSet roots_;
163 ExternalServices externalServices_;
164 rtl::Reference< WriteThread > writeThread_;
165 int sharedExtensionLayer_;
166 int userExtensionLayer_;
167 OUString modificationFileUrl_;
168 boost::shared_ptr<osl::Mutex> lock_;
173 #endif
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */