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