update dev300-m58
[ooovba.git] / configmgr / source / api2 / groupupdate.cxx
blob15ce940d4d170b9f8f71ff675a976e04b00cce85
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: groupupdate.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_configmgr.hxx"
34 #include "groupupdate.hxx"
35 #include "updateimpl.hxx"
36 #include "apinodeaccess.hxx"
37 #include "apitypes.hxx"
39 #include <cppuhelper/queryinterface.hxx>
40 #include <cppuhelper/typeprovider.hxx>
42 namespace configmgr
44 //////////////////////////////////////////////////////////////////////////////////
45 // class BasicGroup
46 //////////////////////////////////////////////////////////////////////////////////
48 // XInterface joining
49 //////////////////////////////////////////////////////////////////////////////////
50 uno::Any SAL_CALL BasicGroup::queryInterface( uno::Type const& rType ) throw (uno::RuntimeException )
52 uno::Any aRet = BasicGroupAccess::queryInterface( rType );
53 if (!aRet.hasValue())
55 aRet = cppu::queryInterface(rType
56 , static_cast< css::container::XNameReplace *>(this)
59 return aRet;
62 // XTypeProvider joining
63 //////////////////////////////////////////////////////////////////////////////////
64 uno::Sequence< uno::Type > SAL_CALL BasicGroup::getTypes( ) throw (uno::RuntimeException )
66 /*static ?*/
67 cppu::OTypeCollection aTypes(
68 configapi::getReferenceType(static_cast< css::container::XNameReplace *>(this)),
69 BasicGroupAccess::getTypes());
71 return aTypes.getTypes();
74 //uno::Sequence< sal_Int8 > SAL_CALL BasicGroup::getImplementationId( ) throw (uno::RuntimeException ) = 0;
76 //////////////////////////////////////////////////////////////////////////////////
78 // safe write access
79 /////////////////////////////////////////////////////////////
80 configapi::NodeGroupAccess& BasicGroup::getGroupNode()
82 configapi::NodeGroupAccess* pAccess = maybeGetUpdateAccess();
83 OSL_ENSURE(pAccess, "Write operation invoked on a read-only node access - failing with RuntimeException");
85 if (!pAccess)
87 throw uno::RuntimeException(
88 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: Invalid Object - internal update interface missing.")),
89 static_cast< css::container::XNameReplace * >(this)
92 return *pAccess;
95 // New Interface methods
96 // XNameReplace
97 //////////////////////////////////////////////////////////////////////////////////
98 void SAL_CALL BasicGroup::replaceByName( const rtl::OUString& rName, const uno::Any& rElement )
99 throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
101 configapi::implReplaceByName( getGroupNode(), rName, rElement );
104 //-----------------------------------------------------------------------------------
105 } // namespace configmgr