Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / configmgr / source / rootaccess.hxx
blob0d14a6b77e7840648a6ff14ec62e665417edd77e
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_ROOTACCESS_HXX
21 #define INCLUDED_CONFIGMGR_SOURCE_ROOTACCESS_HXX
23 #include "sal/config.h"
25 #include <set>
26 #include <vector>
28 #include "com/sun/star/lang/WrappedTargetException.hpp"
29 #include "com/sun/star/uno/RuntimeException.hpp"
30 #include "com/sun/star/util/ChangesSet.hpp"
31 #include "com/sun/star/util/XChangesBatch.hpp"
32 #include "com/sun/star/util/XChangesNotifier.hpp"
33 #include "boost/shared_ptr.hpp"
34 #include "rtl/ref.hxx"
35 #include "rtl/ustring.hxx"
36 #include "sal/types.h"
38 #include "access.hxx"
39 #include "modifications.hxx"
40 #include "path.hxx"
42 namespace com { namespace sun { namespace star {
43 namespace uno {
44 class Any;
45 class Type;
47 namespace util { class XChangesListener; }
48 } } }
50 namespace configmgr {
52 class Broadcaster;
53 class Components;
54 class Node;
56 class RootAccess:
57 public Access, public com::sun::star::util::XChangesNotifier,
58 public com::sun::star::util::XChangesBatch
60 public:
61 RootAccess(
62 Components & components, rtl::OUString const & pathRepresenation,
63 rtl::OUString const & locale, bool update);
65 virtual Path getAbsolutePath();
67 virtual void initBroadcaster(
68 Modifications::Node const & modifications, Broadcaster * broadcaster);
70 virtual void SAL_CALL acquire() throw ();
72 virtual void SAL_CALL release() throw ();
74 rtl::OUString getAbsolutePathRepresentation();
76 rtl::OUString getLocale() const;
78 bool isUpdate() const;
80 void setAlive(bool b);
82 virtual void SAL_CALL addChangesListener(
83 com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
84 const & aListener)
85 throw (com::sun::star::uno::RuntimeException);
87 virtual void SAL_CALL removeChangesListener(
88 com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
89 const & aListener)
90 throw (com::sun::star::uno::RuntimeException);
92 virtual void SAL_CALL commitChanges()
93 throw (
94 com::sun::star::lang::WrappedTargetException,
95 com::sun::star::uno::RuntimeException);
97 virtual sal_Bool SAL_CALL hasPendingChanges()
98 throw (com::sun::star::uno::RuntimeException);
100 virtual com::sun::star::util::ChangesSet SAL_CALL getPendingChanges()
101 throw (com::sun::star::uno::RuntimeException);
103 private:
104 virtual ~RootAccess();
106 virtual Path getRelativePath();
108 virtual rtl::OUString getRelativePathRepresentation();
110 virtual rtl::Reference< Node > getNode();
112 virtual bool isFinalized();
114 virtual rtl::OUString getNameInternal();
116 virtual rtl::Reference< RootAccess > getRootAccess();
118 virtual rtl::Reference< Access > getParentAccess();
120 virtual void addTypes(std::vector< com::sun::star::uno::Type > * types)
121 const;
123 virtual void addSupportedServiceNames(
124 std::vector< rtl::OUString > * services);
126 virtual void initDisposeBroadcaster(Broadcaster * broadcaster);
128 virtual void clearListeners() throw ();
130 virtual com::sun::star::uno::Any SAL_CALL queryInterface(
131 com::sun::star::uno::Type const & aType)
132 throw (com::sun::star::uno::RuntimeException);
134 virtual rtl::OUString SAL_CALL getImplementationName()
135 throw (com::sun::star::uno::RuntimeException);
137 typedef
138 std::multiset<
139 com::sun::star::uno::Reference<
140 com::sun::star::util::XChangesListener > >
141 ChangesListeners;
143 rtl::OUString pathRepresentation_;
144 rtl::OUString locale_;
145 Path path_;
146 rtl::Reference< Node > node_;
147 rtl::OUString name_;
148 ChangesListeners changesListeners_;
150 boost::shared_ptr<osl::Mutex> lock_;
152 bool update_:1;
153 bool finalized_:1;
154 bool alive_:1;
159 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */