1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX 25 #define INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX 26 27 #include "sal/config.h" 28 29 #include <memory> 30 #include <vector> 31 32 #include "com/sun/star/container/XChild.hpp" 33 #include "com/sun/star/lang/NoSupportException.hpp" 34 #include "com/sun/star/lang/XUnoTunnel.hpp" 35 #include "com/sun/star/uno/Reference.hxx" 36 #include "com/sun/star/uno/RuntimeException.hpp" 37 #include "com/sun/star/uno/Sequence.hxx" 38 #include "rtl/ref.hxx" 39 #include "sal/types.h" 40 41 #include "access.hxx" 42 #include "path.hxx" 43 44 namespace com { namespace sun { namespace star { namespace uno { 45 class Any; 46 class Type; 47 class XInterface; 48 } } } } 49 50 namespace configmgr { 51 52 class Components; 53 class Modifications; 54 class Node; 55 class RootAccess; 56 57 class ChildAccess: 58 public Access, public com::sun::star::container::XChild, 59 public com::sun::star::lang::XUnoTunnel 60 { 61 public: 62 static com::sun::star::uno::Sequence< sal_Int8 > getTunnelId(); 63 64 ChildAccess( 65 Components & components, rtl::Reference< RootAccess > const & root, 66 rtl::Reference< Access > const & parent, rtl::OUString const & name, 67 rtl::Reference< Node > const & node); 68 69 ChildAccess( 70 Components & components, rtl::Reference< RootAccess > const & root, 71 rtl::Reference< Node > const & node); 72 73 virtual Path getAbsolutePath(); 74 75 virtual Path getRelativePath(); 76 77 virtual rtl::OUString getRelativePathRepresentation(); 78 79 virtual rtl::Reference< Node > getNode(); 80 81 virtual bool isFinalized(); 82 83 virtual rtl::OUString getNameInternal(); 84 85 virtual rtl::Reference< RootAccess > getRootAccess(); 86 87 virtual rtl::Reference< Access > getParentAccess(); 88 89 virtual void SAL_CALL acquire() throw (); 90 91 virtual void SAL_CALL release() throw (); 92 93 virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 94 SAL_CALL getParent() 95 throw (com::sun::star::uno::RuntimeException); 96 97 virtual void SAL_CALL setParent( 98 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 99 const &) 100 throw ( 101 com::sun::star::lang::NoSupportException, 102 com::sun::star::uno::RuntimeException); 103 104 virtual sal_Int64 SAL_CALL getSomething( 105 com::sun::star::uno::Sequence< sal_Int8 > const & aIdentifier) 106 throw (com::sun::star::uno::RuntimeException); 107 108 void bind( 109 rtl::Reference< RootAccess > const & root, 110 rtl::Reference< Access > const & parent, rtl::OUString const & name) 111 throw (); 112 113 void unbind() throw (); 114 isInTransaction() const115 bool isInTransaction() const { return inTransaction_; } 116 117 void committed(); 118 119 void setNode(rtl::Reference< Node > const & node); 120 121 void setProperty( 122 com::sun::star::uno::Any const & value, 123 Modifications * localModifications); 124 125 com::sun::star::uno::Any asValue(); 126 127 void commitChanges(bool valid, Modifications * globalModifications); 128 129 private: 130 virtual ~ChildAccess(); 131 132 virtual void addTypes( 133 std::vector< com::sun::star::uno::Type > * types) const; 134 135 virtual void addSupportedServiceNames( 136 std::vector< rtl::OUString > * services); 137 138 virtual com::sun::star::uno::Any SAL_CALL queryInterface( 139 com::sun::star::uno::Type const & aType) 140 throw (com::sun::star::uno::RuntimeException); 141 142 rtl::Reference< RootAccess > root_; 143 rtl::Reference< Access > parent_; // null iff free node 144 rtl::OUString name_; 145 rtl::Reference< Node > node_; 146 std::auto_ptr< com::sun::star::uno::Any > changedValue_; 147 bool inTransaction_; 148 // to determine if a free node can be inserted underneath some root 149 }; 150 151 } 152 153 #endif 154