Update ooo320-m1
[ooovba.git] / configmgr / source / api2 / apitreeaccess.cxx
blob14c222618d00410eefe537d1bf0b0b693b77c6b7
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: apitreeaccess.cxx,v $
10 * $Revision: 1.12 $
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"
33 #include <stdio.h>
34 #include "apitreeaccess.hxx"
36 #include "apitreeimplobj.hxx"
37 #include "configset.hxx"
38 #include "confignotifier.hxx"
39 #include "committer.hxx"
40 #include "apinodeaccess.hxx"
42 namespace configmgr
44 //-----------------------------------------------------------------------------
45 namespace configapi
47 //-----------------------------------------------------------------------------
49 // self-locked methods for dispose handling
50 void NodeElement::checkAlive() const
52 getApiTree().checkAlive();
54 //-----------------------------------------------------------------------------
56 rtl::Reference< configuration::Tree > TreeElement::getTree() const
58 return getTreeRef();
60 //-----------------------------------------------------------------------------
62 rtl::Reference< configuration::Tree > TreeElement::getTreeRef() const
64 return getApiTree().getTree();
66 //-----------------------------------------------------------------------------
67 // self-locked methods for dispose handling
68 bool SetElement::disposeTree(bool bForce)
70 return getApiTree().disposeTree(bForce);
72 //-----------------------------------------------------------------------------
73 Factory& TreeElement::getFactory()
75 return getApiTree().getFactory();
77 //-----------------------------------------------------------------------------
79 rtl::Reference< configuration::ElementTree > SetElement::getElementRef() const
81 return dynamic_cast< configuration::ElementTree * >(getTreeRef().get());
83 //-----------------------------------------------------------------------------
85 rtl::Reference< configuration::Template > SetElement::getTemplateInfo() const
87 rtl::Reference< configuration::ElementTree > aTree(dynamic_cast< configuration::ElementTree * >(getTreeRef().get()));
88 OSL_ENSURE(aTree.is(), "This really must be a set element");
89 return aTree->getTemplate();
91 //-----------------------------------------------------------------------------
93 void SetElement::haveNewParent(NodeSetInfoAccess* pNewParent)
95 ApiTreeImpl* pNewParentImpl = pNewParent ? &pNewParent->getApiTree() : 0;
97 this->getApiTree().haveNewParent( pNewParentImpl );
99 //-----------------------------------------------------------------------------
101 bool RootElement::disposeTree()
103 return getRootTree().disposeTree();
105 //-----------------------------------------------------------------------------
107 Committer UpdateRootElement::getCommitter()
109 return Committer(getRootTree());