merged tag ooo/DEV300_m102
[LibreOffice.git] / configmgr / source / components.hxx
blob34b693c7e58559de3f91b2ce687924ad192bfccc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef INCLUDED_CONFIGMGR_SOURCE_COMPONENTS_HXX
29 #define INCLUDED_CONFIGMGR_SOURCE_COMPONENTS_HXX
31 #include "sal/config.h"
33 #include <map>
34 #include <set>
36 #include "boost/noncopyable.hpp"
37 #include "com/sun/star/beans/Optional.hpp"
38 #include "com/sun/star/uno/Reference.hxx"
39 #include "rtl/ref.hxx"
41 #include "additions.hxx"
42 #include "data.hxx"
43 #include "modifications.hxx"
44 #include "nodemap.hxx"
45 #include "path.hxx"
47 namespace com { namespace sun { namespace star {
48 namespace beans { class XPropertySet; }
49 namespace uno {
50 class Any;
51 class XComponentContext;
53 } } }
54 namespace rtl {
55 class Bootstrap;
56 class OUString;
59 namespace configmgr {
61 class Broadcaster;
62 class Node;
63 class Partial;
64 class RootAccess;
66 class Components: private boost::noncopyable {
67 public:
68 static Components & getSingleton(
69 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
70 const & context);
72 static bool allLocales(rtl::OUString const & locale);
74 rtl::Reference< Node > resolvePathRepresentation(
75 rtl::OUString const & pathRepresentation,
76 rtl::OUString * canonicRepresenation, Path * path, int * finalizedLayer)
77 const;
79 rtl::Reference< Node > getTemplate(
80 int layer, rtl::OUString const & fullName) const;
82 void addRootAccess(rtl::Reference< RootAccess > const & access);
84 void removeRootAccess(RootAccess * access);
86 void initGlobalBroadcaster(
87 Modifications const & modifications,
88 rtl::Reference< RootAccess > const & exclude,
89 Broadcaster * broadcaster);
91 void addModification(Path const & path);
93 void writeModifications();
95 void flushModifications();
96 // must be called with configmgr::lock unaquired; must be called before
97 // shutdown if writeModifications has ever been called (probably
98 // indirectly, via removeExtensionXcuFile)
100 void insertExtensionXcsFile(bool shared, rtl::OUString const & fileUri);
102 void insertExtensionXcuFile(
103 bool shared, rtl::OUString const & fileUri,
104 Modifications * modifications);
106 void removeExtensionXcuFile(
107 rtl::OUString const & fileUri, Modifications * modifications);
109 void insertModificationXcuFile(
110 rtl::OUString const & fileUri,
111 std::set< rtl::OUString > const & includedPaths,
112 std::set< rtl::OUString > const & excludedPaths,
113 Modifications * modifications);
115 com::sun::star::beans::Optional< com::sun::star::uno::Any >
116 getExternalValue(rtl::OUString const & descriptor);
118 private:
119 typedef void FileParser(
120 rtl::OUString const &, int, Data &, Partial const *, Modifications *,
121 Additions *);
123 Components(
124 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
125 const & context);
127 ~Components();
129 void parseFileLeniently(
130 FileParser * parseFile, rtl::OUString const & url, int layer,
131 Data & data, Partial const * partial, Modifications * modifications,
132 Additions * additions);
134 void parseFiles(
135 int layer, rtl::OUString const & extension, FileParser * parseFile,
136 rtl::OUString const & url, bool recursive);
138 void parseFileList(
139 int layer, FileParser * parseFile, rtl::OUString const & urls,
140 rtl::Bootstrap const & ini, bool recordAdditions);
142 void parseXcdFiles(int layer, rtl::OUString const & url);
144 void parseXcsXcuLayer(int layer, rtl::OUString const & url);
146 void parseXcsXcuIniLayer(
147 int layer, rtl::OUString const & url, bool recordAdditions);
149 void parseModuleLayer(int layer, rtl::OUString const & url);
151 void parseResLayer(int layer, rtl::OUString const & url);
153 rtl::OUString getModificationFileUrl() const;
155 void parseModificationLayer();
157 typedef std::set< RootAccess * > WeakRootSet;
159 typedef
160 std::map<
161 rtl::OUString,
162 com::sun::star::uno::Reference<
163 com::sun::star::beans::XPropertySet > >
164 ExternalServices;
166 class WriteThread;
168 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
169 context_;
170 Data data_;
171 WeakRootSet roots_;
172 ExternalServices externalServices_;
173 rtl::Reference< WriteThread > writeThread_;
178 #endif