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