/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "components.hxx" #include "lock.hxx" #include "readonlyaccess.hxx" #include "rootaccess.hxx" namespace configmgr { namespace read_only_access { namespace { class Service: public cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XInitialization, css::container::XHierarchicalNameAccess > { public: explicit Service( css::uno::Reference< css::uno::XComponentContext > const & context): context_(context) {} private: Service(const Service&) = delete; Service& operator=(const Service&) = delete; virtual ~Service() override {} virtual OUString SAL_CALL getImplementationName() override { return read_only_access::getImplementationName(); } virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override { return cppu::supportsService(this, ServiceName); } virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override { return read_only_access::getSupportedServiceNames(); } virtual void SAL_CALL initialize( css::uno::Sequence< css::uno::Any > const & aArguments) override; virtual css::uno::Any SAL_CALL getByHierarchicalName( OUString const & aName) override { return getRoot()->getByHierarchicalName(aName); } virtual sal_Bool SAL_CALL hasByHierarchicalName(OUString const & aName) override { return getRoot()->hasByHierarchicalName(aName); } rtl::Reference< RootAccess > getRoot(); css::uno::Reference< css::uno::XComponentContext > context_; osl::Mutex mutex_; rtl::Reference< RootAccess > root_; }; void Service::initialize(css::uno::Sequence< css::uno::Any > const & aArguments) { OUString locale; if (aArguments.getLength() != 1 || !(aArguments[0] >>= locale)) { throw css::lang::IllegalArgumentException( "not exactly one string argument", static_cast< cppu::OWeakObject * >(this), -1); } osl::MutexGuard g1(mutex_); if (root_.is()) { throw css::uno::RuntimeException( "already initialized", static_cast< cppu::OWeakObject * >(this)); } osl::MutexGuard g2(*lock()); Components & components = Components::getSingleton(context_); root_ = new RootAccess(components, "/", locale, false); components.addRootAccess(root_); } rtl::Reference< RootAccess > Service::getRoot() { osl::MutexGuard g(mutex_); if (!root_.is()) { throw css::lang::NotInitializedException( "not initialized", static_cast< cppu::OWeakObject * >(this)); } return root_; } } css::uno::Reference< css::uno::XInterface > create( css::uno::Reference< css::uno::XComponentContext > const & context) { return static_cast< cppu::OWeakObject * >(new Service(context)); } OUString getImplementationName() { return OUString("com.sun.star.comp.configuration.ReadOnlyAccess"); } css::uno::Sequence< OUString > getSupportedServiceNames() { return css::uno::Sequence< OUString > { "com.sun.star.configuration.ReadOnlyAccess" }; } } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ collabora/lov-4.4'>distro/collabora/lov-4.4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2012-03-07remove various unused methods and source filesCaolán McNamara
2012-02-02fdo#45534: ODF export: fix draw:fit-to-sizeMichael Stahl
2012-01-25Fix for fdo43460 Part XLVII getLength() to isEmpty()Olivier Hallot
2011-11-27remove include of pch header from xmloffNorbert Thiebaud
2011-10-11#i108468#: clean up xmluconv code duplication, part 1:Michael Stahl
2011-09-05callcatcher: drop some Impl methods, regenerate listCaolán McNamara
2011-09-05callcatcher: some more unused codeCaolán McNamara
2011-03-29drop bogus executable flag from [ch]xx/bas/asm filesFrancisco Saito
2011-03-12Merge commit 'ooo/DEV300_m101' into integration/dev300_m101Thorsten Behrens
2011-02-17Remove dead codesBálint Dózsa
2011-01-06removetooltypes01: rebase to DEV300_m96Mikhail Voytenko
2010-12-12change of __READONLY_DATA define to constGert Faller
2010-11-10 removetooltypes01: #i112600# resync to DEV300_m92; remove tooltypes from xml...Xiaofei Zhang
2010-10-13Add vim/emacs modelines to all source filesSebastian Spaeth
2010-10-05remove include guards using fixguard.pyPetr Mladek
2010-09-17fit-list-to-size.diff: Shrink font automatically when text overflows.Thorsten Behrens
2010-07-13CWS gnumake2: resync to DEV300_m84Bjoern Michaelsen
2010-04-17CWS gnumake2: rebase to DEV300_m76; fix build problemsMathias Bauer
2010-04-16CWS gnumake2: move delivered header files from xmloff/inc to xmloff/inc/xmlof...Mathias Bauer
2010-03-09rebase to m73Christian Lippka
2010-02-22#i109103# fixed missing gradient step count and hatch fill color for page/sli...Christian Lippka
2010-02-12changefileheader2: #i109125#: change source file copyright notice from Sun Mi...Jens-Heiner Rechtien
2009-07-06CWS-TOOLING: integrate CWS impress173_DEV300Vladimir Glazounov
2009-01-29CWS-TOOLING: integrate CWS cmcfixes52Kurt Zenker
2009-01-21CWS-TOOLING: integrate CWS sjfixes10Vladimir Glazounov
2008-12-16CWS-TOOLING: integrate CWS rtlcontrolsRüdiger Timm
2008-12-01CWS-TOOLING: integrate CWS dba31eRelease Engineers
2008-07-07INTEGRATION: CWS mib08 (1.100.12); FILE MERGEDRüdiger Timm
2008-07-02INTEGRATION: CWS chart27 (1.100.6); FILE MERGEDVladimir Glazounov
2008-06-06INTEGRATION: CWS impressodf12 (1.98.20); FILE MERGEDRüdiger Timm
2008-06-04INTEGRATION: CWS odfversionedexport (1.98.22); FILE MERGEDVladimir Glazounov
2008-04-10INTEGRATION: CWS changefileheader (1.97.18); FILE MERGEDRüdiger Timm
2008-03-12INTEGRATION: CWS impresstables2 (1.95.12); FILE MERGEDRüdiger Timm
2007-06-27INTEGRATION: CWS vgbugs07 (1.95.30); FILE MERGEDJens-Heiner Rechtien
2007-04-16INTEGRATION: CWS impressrng01_SRC680 (1.93.28.1.8); FILE MERGEDIvo Hinkelmann
2007-01-29INTEGRATION: CWS impress116 (1.93.34); FILE MERGEDRüdiger Timm
2006-11-21INTEGRATION: CWS pj65 (1.92.12); FILE MERGEDVladimir Glazounov
2006-10-13INTEGRATION: CWS opofxmlstorage (1.88.14); FILE MERGEDOliver Bolte
2006-10-12INTEGRATION: CWS sb59 (1.88.6); FILE MERGEDOliver Bolte
2006-09-17INTEGRATION: CWS pchfix02 (1.88.18); FILE MERGEDOliver Bolte