xref: /aoo42x/main/configmgr/source/components.hxx (revision a2faadff)
1*a2faadffSAndrew Rist /**************************************************************
2*a2faadffSAndrew Rist  *
3*a2faadffSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*a2faadffSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*a2faadffSAndrew Rist  * distributed with this work for additional information
6*a2faadffSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*a2faadffSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*a2faadffSAndrew Rist  * "License"); you may not use this file except in compliance
9*a2faadffSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*a2faadffSAndrew Rist  *
11*a2faadffSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*a2faadffSAndrew Rist  *
13*a2faadffSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*a2faadffSAndrew Rist  * software distributed under the License is distributed on an
15*a2faadffSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*a2faadffSAndrew Rist  * KIND, either express or implied.  See the License for the
17*a2faadffSAndrew Rist  * specific language governing permissions and limitations
18*a2faadffSAndrew Rist  * under the License.
19*a2faadffSAndrew Rist  *
20*a2faadffSAndrew Rist  *************************************************************/
21*a2faadffSAndrew Rist 
22*a2faadffSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_CONFIGMGR_SOURCE_COMPONENTS_HXX
25cdf0e10cSrcweir #define INCLUDED_CONFIGMGR_SOURCE_COMPONENTS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "sal/config.h"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <map>
30cdf0e10cSrcweir #include <set>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include "boost/noncopyable.hpp"
33cdf0e10cSrcweir #include "com/sun/star/beans/Optional.hpp"
34cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx"
35cdf0e10cSrcweir #include "rtl/ref.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include "additions.hxx"
38cdf0e10cSrcweir #include "data.hxx"
39cdf0e10cSrcweir #include "modifications.hxx"
40cdf0e10cSrcweir #include "nodemap.hxx"
41cdf0e10cSrcweir #include "path.hxx"
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace com { namespace sun { namespace star {
44cdf0e10cSrcweir     namespace beans { class XPropertySet; }
45cdf0e10cSrcweir     namespace uno {
46cdf0e10cSrcweir         class Any;
47cdf0e10cSrcweir         class XComponentContext;
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir } } }
50cdf0e10cSrcweir namespace rtl {
51cdf0e10cSrcweir     class Bootstrap;
52cdf0e10cSrcweir     class OUString;
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir namespace configmgr {
56cdf0e10cSrcweir 
57cdf0e10cSrcweir class Broadcaster;
58cdf0e10cSrcweir class Node;
59cdf0e10cSrcweir class Partial;
60cdf0e10cSrcweir class RootAccess;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class Components: private boost::noncopyable {
63cdf0e10cSrcweir public:
64cdf0e10cSrcweir     static Components & getSingleton(
65cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
66cdf0e10cSrcweir             const & context);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     static bool allLocales(rtl::OUString const & locale);
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     rtl::Reference< Node > resolvePathRepresentation(
71cdf0e10cSrcweir         rtl::OUString const & pathRepresentation,
72cdf0e10cSrcweir         rtl::OUString * canonicRepresenation, Path * path, int * finalizedLayer)
73cdf0e10cSrcweir         const;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     rtl::Reference< Node > getTemplate(
76cdf0e10cSrcweir         int layer, rtl::OUString const & fullName) const;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     void addRootAccess(rtl::Reference< RootAccess > const & access);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     void removeRootAccess(RootAccess * access);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     void initGlobalBroadcaster(
83cdf0e10cSrcweir         Modifications const & modifications,
84cdf0e10cSrcweir         rtl::Reference< RootAccess > const & exclude,
85cdf0e10cSrcweir         Broadcaster * broadcaster);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     void addModification(Path const & path);
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     void writeModifications();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     void flushModifications();
92cdf0e10cSrcweir         // must be called with configmgr::lock unaquired; must be called before
93cdf0e10cSrcweir         // shutdown if writeModifications has ever been called (probably
94cdf0e10cSrcweir         // indirectly, via removeExtensionXcuFile)
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     void insertExtensionXcsFile(bool shared, rtl::OUString const & fileUri);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     void insertExtensionXcuFile(
99cdf0e10cSrcweir         bool shared, rtl::OUString const & fileUri,
100cdf0e10cSrcweir         Modifications * modifications);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     void removeExtensionXcuFile(
103cdf0e10cSrcweir         rtl::OUString const & fileUri, Modifications * modifications);
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     void insertModificationXcuFile(
106cdf0e10cSrcweir         rtl::OUString const & fileUri,
107cdf0e10cSrcweir         std::set< rtl::OUString > const & includedPaths,
108cdf0e10cSrcweir         std::set< rtl::OUString > const & excludedPaths,
109cdf0e10cSrcweir         Modifications * modifications);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     com::sun::star::beans::Optional< com::sun::star::uno::Any >
112cdf0e10cSrcweir     getExternalValue(rtl::OUString const & descriptor);
113cdf0e10cSrcweir 
114cdf0e10cSrcweir private:
115cdf0e10cSrcweir     typedef void FileParser(
116cdf0e10cSrcweir         rtl::OUString const &, int, Data &, Partial const *, Modifications *,
117cdf0e10cSrcweir         Additions *);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     Components(
120cdf0e10cSrcweir         com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
121cdf0e10cSrcweir             const & context);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     ~Components();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     void parseFileLeniently(
126cdf0e10cSrcweir         FileParser * parseFile, rtl::OUString const & url, int layer,
127cdf0e10cSrcweir         Data & data, Partial const * partial, Modifications * modifications,
128cdf0e10cSrcweir         Additions * additions);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     void parseFiles(
131cdf0e10cSrcweir         int layer, rtl::OUString const & extension, FileParser * parseFile,
132cdf0e10cSrcweir         rtl::OUString const & url, bool recursive);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     void parseFileList(
135cdf0e10cSrcweir         int layer, FileParser * parseFile, rtl::OUString const & urls,
136cdf0e10cSrcweir         rtl::Bootstrap const & ini, bool recordAdditions);
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     void parseXcdFiles(int layer, rtl::OUString const & url);
139cdf0e10cSrcweir 
140cdf0e10cSrcweir     void parseXcsXcuLayer(int layer, rtl::OUString const & url);
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     void parseXcsXcuIniLayer(
143cdf0e10cSrcweir         int layer, rtl::OUString const & url, bool recordAdditions);
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     void parseModuleLayer(int layer, rtl::OUString const & url);
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     void parseResLayer(int layer, rtl::OUString const & url);
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     rtl::OUString getModificationFileUrl() const;
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     void parseModificationLayer();
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     typedef std::set< RootAccess * > WeakRootSet;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     typedef
156cdf0e10cSrcweir         std::map<
157cdf0e10cSrcweir             rtl::OUString,
158cdf0e10cSrcweir             com::sun::star::uno::Reference<
159cdf0e10cSrcweir                 com::sun::star::beans::XPropertySet > >
160cdf0e10cSrcweir         ExternalServices;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     class WriteThread;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
165cdf0e10cSrcweir         context_;
166cdf0e10cSrcweir     Data data_;
167cdf0e10cSrcweir     WeakRootSet roots_;
168cdf0e10cSrcweir     ExternalServices externalServices_;
169cdf0e10cSrcweir     rtl::Reference< WriteThread > writeThread_;
170cdf0e10cSrcweir };
171cdf0e10cSrcweir 
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir #endif
175