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_ROOTACCESS_HXX 25 #define INCLUDED_CONFIGMGR_SOURCE_ROOTACCESS_HXX 26 27 #include "sal/config.h" 28 29 #include <set> 30 #include <vector> 31 32 #include "com/sun/star/lang/WrappedTargetException.hpp" 33 #include "com/sun/star/uno/RuntimeException.hpp" 34 #include "com/sun/star/util/ChangesSet.hpp" 35 #include "com/sun/star/util/XChangesBatch.hpp" 36 #include "com/sun/star/util/XChangesNotifier.hpp" 37 #include "rtl/ref.hxx" 38 #include "rtl/ustring.hxx" 39 #include "sal/types.h" 40 41 #include "access.hxx" 42 #include "modifications.hxx" 43 #include "path.hxx" 44 45 namespace com { namespace sun { namespace star { 46 namespace uno { 47 class Any; 48 class Type; 49 } 50 namespace util { class XChangesListener; } 51 } } } 52 53 namespace configmgr { 54 55 class Broadcaster; 56 class Components; 57 class Node; 58 59 class RootAccess: 60 public Access, public com::sun::star::util::XChangesNotifier, 61 public com::sun::star::util::XChangesBatch 62 { 63 public: 64 RootAccess( 65 Components & components, rtl::OUString const & pathRepresenation, 66 rtl::OUString const & locale, bool update); 67 68 virtual Path getAbsolutePath(); 69 70 virtual void initBroadcaster( 71 Modifications::Node const & modifications, Broadcaster * broadcaster); 72 73 virtual void SAL_CALL acquire() throw (); 74 75 virtual void SAL_CALL release() throw (); 76 77 rtl::OUString getAbsolutePathRepresentation(); 78 79 rtl::OUString getLocale() const; 80 81 bool isUpdate() const; 82 83 private: 84 virtual ~RootAccess(); 85 86 virtual Path getRelativePath(); 87 88 virtual rtl::OUString getRelativePathRepresentation(); 89 90 virtual rtl::Reference< Node > getNode(); 91 92 virtual bool isFinalized(); 93 94 virtual rtl::OUString getNameInternal(); 95 96 virtual rtl::Reference< RootAccess > getRootAccess(); 97 98 virtual rtl::Reference< Access > getParentAccess(); 99 100 virtual void addTypes(std::vector< com::sun::star::uno::Type > * types) 101 const; 102 103 virtual void addSupportedServiceNames( 104 std::vector< rtl::OUString > * services); 105 106 virtual void initDisposeBroadcaster(Broadcaster * broadcaster); 107 108 virtual void clearListeners() throw (); 109 110 virtual com::sun::star::uno::Any SAL_CALL queryInterface( 111 com::sun::star::uno::Type const & aType) 112 throw (com::sun::star::uno::RuntimeException); 113 114 virtual void SAL_CALL addChangesListener( 115 com::sun::star::uno::Reference< com::sun::star::util::XChangesListener > 116 const & aListener) 117 throw (com::sun::star::uno::RuntimeException); 118 119 virtual void SAL_CALL removeChangesListener( 120 com::sun::star::uno::Reference< com::sun::star::util::XChangesListener > 121 const & aListener) 122 throw (com::sun::star::uno::RuntimeException); 123 124 virtual void SAL_CALL commitChanges() 125 throw ( 126 com::sun::star::lang::WrappedTargetException, 127 com::sun::star::uno::RuntimeException); 128 129 virtual sal_Bool SAL_CALL hasPendingChanges() 130 throw (com::sun::star::uno::RuntimeException); 131 132 virtual com::sun::star::util::ChangesSet SAL_CALL getPendingChanges() 133 throw (com::sun::star::uno::RuntimeException); 134 135 typedef 136 std::multiset< 137 com::sun::star::uno::Reference< 138 com::sun::star::util::XChangesListener > > 139 ChangesListeners; 140 141 rtl::OUString pathRepresentation_; 142 rtl::OUString locale_; 143 bool update_; 144 Path path_; 145 rtl::Reference< Node > node_; 146 rtl::OUString name_; 147 bool finalized_; 148 ChangesListeners changesListeners_; 149 }; 150 151 } 152 153 #endif 154