Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
21 : #define INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX
22 :
23 : #include "sal/config.h"
24 :
25 : #include <memory>
26 : #include <vector>
27 :
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"
37 :
38 : #include "access.hxx"
39 : #include "path.hxx"
40 :
41 : namespace com { namespace sun { namespace star { namespace uno {
42 : class Any;
43 : class Type;
44 : class XInterface;
45 : } } } }
46 :
47 : namespace configmgr {
48 :
49 : class Components;
50 : class Modifications;
51 : class Node;
52 : class RootAccess;
53 :
54 : class ChildAccess:
55 : public Access, public com::sun::star::container::XChild,
56 : public com::sun::star::lang::XUnoTunnel
57 : {
58 : public:
59 : static com::sun::star::uno::Sequence< sal_Int8 > getTunnelId();
60 :
61 : ChildAccess(
62 : Components & components, rtl::Reference< RootAccess > const & root,
63 : rtl::Reference< Access > const & parent, OUString const & name,
64 : rtl::Reference< Node > const & node);
65 :
66 : ChildAccess(
67 : Components & components, rtl::Reference< RootAccess > const & root,
68 : rtl::Reference< Node > const & node);
69 :
70 : virtual Path getAbsolutePath();
71 : virtual Path getRelativePath();
72 :
73 : virtual OUString getRelativePathRepresentation();
74 : virtual rtl::Reference< Node > getNode();
75 :
76 : virtual bool isFinalized();
77 :
78 : virtual OUString getNameInternal();
79 :
80 : virtual rtl::Reference< RootAccess > getRootAccess();
81 : virtual rtl::Reference< Access > getParentAccess();
82 :
83 : virtual void SAL_CALL acquire() throw ();
84 : virtual void SAL_CALL release() throw ();
85 :
86 : virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
87 : SAL_CALL getParent()
88 : throw (com::sun::star::uno::RuntimeException);
89 :
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);
96 :
97 : virtual sal_Int64 SAL_CALL getSomething(
98 : com::sun::star::uno::Sequence< sal_Int8 > const & aIdentifier)
99 : throw (com::sun::star::uno::RuntimeException);
100 :
101 : void bind(
102 : rtl::Reference< RootAccess > const & root,
103 : rtl::Reference< Access > const & parent, OUString const & name)
104 : throw ();
105 :
106 : void unbind() throw ();
107 :
108 1065 : bool isInTransaction() const { return inTransaction_; }
109 : void committed();
110 : void setNode(rtl::Reference< Node > const & node);
111 :
112 : void setProperty(
113 : com::sun::star::uno::Any const & value,
114 : Modifications * localModifications);
115 :
116 : com::sun::star::uno::Any asValue();
117 :
118 : void commitChanges(bool valid, Modifications * globalModifications);
119 :
120 : private:
121 : virtual ~ChildAccess();
122 :
123 : virtual void addTypes(
124 : std::vector< com::sun::star::uno::Type > * types) const;
125 :
126 : virtual void addSupportedServiceNames(
127 : std::vector< OUString > * services);
128 :
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);
132 :
133 : rtl::Reference< RootAccess > root_;
134 : rtl::Reference< Access > parent_; // null if free node
135 : 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_;
141 : };
142 :
143 : }
144 :
145 : #endif
146 :
147 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|