Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / configmgr / source / childaccess.hxx
blobb453a6a76b7372d2fb4318ac39afc46d51dd746c
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_CHILDACCESS_HXX
21 #define INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
23 #include "sal/config.h"
25 #include <memory>
26 #include <vector>
28 #include "com/sun/star/container/XChild.hpp"
29 #include "com/sun/star/lang/NoSupportException.hpp"
30 #include "com/sun/star/lang/XUnoTunnel.hpp"
31 #include "com/sun/star/uno/Reference.hxx"
32 #include "com/sun/star/uno/RuntimeException.hpp"
33 #include "com/sun/star/uno/Sequence.hxx"
34 #include "boost/shared_ptr.hpp"
35 #include "rtl/ref.hxx"
36 #include "sal/types.h"
38 #include "access.hxx"
39 #include "path.hxx"
41 namespace com { namespace sun { namespace star { namespace uno {
42 class Any;
43 class Type;
44 class XInterface;
45 } } } }
47 namespace configmgr {
49 class Components;
50 class Modifications;
51 class Node;
52 class RootAccess;
54 class ChildAccess:
55 public Access, public com::sun::star::container::XChild,
56 public com::sun::star::lang::XUnoTunnel
58 public:
59 static com::sun::star::uno::Sequence< sal_Int8 > getTunnelId();
61 ChildAccess(
62 Components & components, rtl::Reference< RootAccess > const & root,
63 rtl::Reference< Access > const & parent, rtl::OUString const & name,
64 rtl::Reference< Node > const & node);
66 ChildAccess(
67 Components & components, rtl::Reference< RootAccess > const & root,
68 rtl::Reference< Node > const & node);
70 virtual Path getAbsolutePath();
71 virtual Path getRelativePath();
73 virtual rtl::OUString getRelativePathRepresentation();
74 virtual rtl::Reference< Node > getNode();
76 virtual bool isFinalized();
78 virtual rtl::OUString getNameInternal();
80 virtual rtl::Reference< RootAccess > getRootAccess();
81 virtual rtl::Reference< Access > getParentAccess();
83 virtual void SAL_CALL acquire() throw ();
84 virtual void SAL_CALL release() throw ();
86 virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
87 SAL_CALL getParent()
88 throw (com::sun::star::uno::RuntimeException);
90 virtual void SAL_CALL setParent(
91 com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
92 const &)
93 throw (
94 com::sun::star::lang::NoSupportException,
95 com::sun::star::uno::RuntimeException);
97 virtual sal_Int64 SAL_CALL getSomething(
98 com::sun::star::uno::Sequence< sal_Int8 > const & aIdentifier)
99 throw (com::sun::star::uno::RuntimeException);
101 void bind(
102 rtl::Reference< RootAccess > const & root,
103 rtl::Reference< Access > const & parent, rtl::OUString const & name)
104 throw ();
106 void unbind() throw ();
108 bool isInTransaction() const { return inTransaction_; }
109 void committed();
110 void setNode(rtl::Reference< Node > const & node);
112 void setProperty(
113 com::sun::star::uno::Any const & value,
114 Modifications * localModifications);
116 com::sun::star::uno::Any asValue();
118 void commitChanges(bool valid, Modifications * globalModifications);
120 private:
121 virtual ~ChildAccess();
123 virtual void addTypes(
124 std::vector< com::sun::star::uno::Type > * types) const;
126 virtual void addSupportedServiceNames(
127 std::vector< rtl::OUString > * services);
129 virtual com::sun::star::uno::Any SAL_CALL queryInterface(
130 com::sun::star::uno::Type const & aType)
131 throw (com::sun::star::uno::RuntimeException);
133 rtl::Reference< RootAccess > root_;
134 rtl::Reference< Access > parent_; // null iff free node
135 rtl::OUString name_;
136 rtl::Reference< Node > node_;
137 std::auto_ptr< com::sun::star::uno::Any > changedValue_;
138 bool inTransaction_;
139 // to determine if a free node can be inserted underneath some root
140 boost::shared_ptr<osl::Mutex> lock_;
145 #endif
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */