update dev300-m58
[ooovba.git] / configmgr / source / treemgr / defaultproviderproxy.cxx
blob89a0fdf00dd85b88ff8cf5705a157b036d2ae4ad
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: defaultproviderproxy.cxx,v $
10 * $Revision: 1.10 $
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 "defaultproviderproxy.hxx"
35 #include "defaultprovider.hxx"
36 #include "treemanager.hxx"
37 #include "valuenode.hxx"
38 #include "options.hxx"
40 namespace configmgr
42 //-----------------------------------------------------------------------------
43 namespace configuration
45 //-----------------------------------------------------------------------------
47 DefaultProviderProxy::DefaultProviderProxy(
48 rtl::Reference< TreeManager > const & _xDefaultTreeProvider,
49 IDefaultableTreeManager * _pDefaultTreeManager,
50 AbsolutePath const& _aBaseLocation,
51 RequestOptions const& _aOptions
53 : m_aBaseLocation(_aBaseLocation)
54 , m_aOptions(_aOptions)
55 , m_xDefaultTreeProvider(_xDefaultTreeProvider)
56 , m_pDefaultTreeManager(_pDefaultTreeManager)
59 //-----------------------------------------------------------------------------
61 DefaultProviderProxy::~DefaultProviderProxy()
64 //-----------------------------------------------------------------------------
66 /// tries to load a default instance of the specified node (which must be within the request range owned)
67 std::auto_ptr<ISubtree> DefaultProviderProxy::getDefaultTree(
68 AbsolutePath const& _aLocation
69 ) const SAL_THROW((com::sun::star::uno::Exception))
71 OSL_ENSURE( Path::hasPrefix(_aLocation,m_aBaseLocation),
72 "ERROR: DefaultProviderProxy called for out-of-scope location" );
74 std::auto_ptr<ISubtree> aRet;
76 if (m_xDefaultTreeProvider.is())
77 aRet = m_xDefaultTreeProvider->requestDefaultData(_aLocation, m_aOptions);
79 return aRet;
82 //-----------------------------------------------------------------------------
83 /// tries to load default data into the specified tree
84 bool DefaultProviderProxy::fetchDefaultData() SAL_THROW((com::sun::star::uno::Exception))
86 OSL_PRECOND(m_pDefaultTreeManager, "No tree to fetch defaults into");
87 if (!m_pDefaultTreeManager) return false;
89 return !! m_pDefaultTreeManager->fetchDefaultData(m_aBaseLocation,m_aOptions);
91 //-----------------------------------------------------------------------------