1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX 29 #define INCLUDED_CONFIGMGR_SOURCE_CHILDACCESS_HXX 30 31 #include "sal/config.h" 32 33 #include <memory> 34 #include <vector> 35 36 #include "com/sun/star/container/XChild.hpp" 37 #include "com/sun/star/lang/NoSupportException.hpp" 38 #include "com/sun/star/lang/XUnoTunnel.hpp" 39 #include "com/sun/star/uno/Reference.hxx" 40 #include "com/sun/star/uno/RuntimeException.hpp" 41 #include "com/sun/star/uno/Sequence.hxx" 42 #include "rtl/ref.hxx" 43 #include "sal/types.h" 44 45 #include "access.hxx" 46 #include "path.hxx" 47 48 namespace com { namespace sun { namespace star { namespace uno { 49 class Any; 50 class Type; 51 class XInterface; 52 } } } } 53 54 namespace configmgr { 55 56 class Components; 57 class Modifications; 58 class Node; 59 class RootAccess; 60 61 class ChildAccess: 62 public Access, public com::sun::star::container::XChild, 63 public com::sun::star::lang::XUnoTunnel 64 { 65 public: 66 static com::sun::star::uno::Sequence< sal_Int8 > getTunnelId(); 67 68 ChildAccess( 69 Components & components, rtl::Reference< RootAccess > const & root, 70 rtl::Reference< Access > const & parent, rtl::OUString const & name, 71 rtl::Reference< Node > const & node); 72 73 ChildAccess( 74 Components & components, rtl::Reference< RootAccess > const & root, 75 rtl::Reference< Node > const & node); 76 77 virtual Path getAbsolutePath(); 78 79 virtual Path getRelativePath(); 80 81 virtual rtl::OUString getRelativePathRepresentation(); 82 83 virtual rtl::Reference< Node > getNode(); 84 85 virtual bool isFinalized(); 86 87 virtual rtl::OUString getNameInternal(); 88 89 virtual rtl::Reference< RootAccess > getRootAccess(); 90 91 virtual rtl::Reference< Access > getParentAccess(); 92 93 virtual void SAL_CALL acquire() throw (); 94 95 virtual void SAL_CALL release() throw (); 96 97 virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 98 SAL_CALL getParent() 99 throw (com::sun::star::uno::RuntimeException); 100 101 virtual void SAL_CALL setParent( 102 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > 103 const &) 104 throw ( 105 com::sun::star::lang::NoSupportException, 106 com::sun::star::uno::RuntimeException); 107 108 virtual sal_Int64 SAL_CALL getSomething( 109 com::sun::star::uno::Sequence< sal_Int8 > const & aIdentifier) 110 throw (com::sun::star::uno::RuntimeException); 111 112 void bind( 113 rtl::Reference< RootAccess > const & root, 114 rtl::Reference< Access > const & parent, rtl::OUString const & name) 115 throw (); 116 117 void unbind() throw (); 118 119 bool isInTransaction() const { return inTransaction_; } 120 121 void committed(); 122 123 void setNode(rtl::Reference< Node > const & node); 124 125 void setProperty( 126 com::sun::star::uno::Any const & value, 127 Modifications * localModifications); 128 129 com::sun::star::uno::Any asValue(); 130 131 void commitChanges(bool valid, Modifications * globalModifications); 132 133 private: 134 virtual ~ChildAccess(); 135 136 virtual void addTypes( 137 std::vector< com::sun::star::uno::Type > * types) const; 138 139 virtual void addSupportedServiceNames( 140 std::vector< rtl::OUString > * services); 141 142 virtual com::sun::star::uno::Any SAL_CALL queryInterface( 143 com::sun::star::uno::Type const & aType) 144 throw (com::sun::star::uno::RuntimeException); 145 146 rtl::Reference< RootAccess > root_; 147 rtl::Reference< Access > parent_; // null iff free node 148 rtl::OUString name_; 149 rtl::Reference< Node > node_; 150 std::auto_ptr< com::sun::star::uno::Any > changedValue_; 151 bool inTransaction_; 152 // to determine if a free node can be inserted underneath some root 153 }; 154 155 } 156 157 #endif 158