merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / inc / roottree.hxx
blob7e6cee11dc6d56a0cd104c5e78d22a30feb34b9a
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: roottree.hxx,v $
10 * $Revision: 1.15 $
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 #ifndef CONFIGMGR_ROOTTREE_HXX_
32 #define CONFIGMGR_ROOTTREE_HXX_
34 #include "sal/config.h"
36 #include <memory>
38 #include "boost/utility.hpp"
39 #include "rtl/ref.hxx"
41 #include "utility.hxx"
43 namespace configmgr
45 //-----------------------------------------------------------------------------
46 namespace sharable { union Node; }
47 class SubtreeChange;
48 struct TreeChangeList;
50 namespace configuration
52 //-----------------------------------------------------------------------------
53 class Tree;
54 class NodeRef;
55 class NodeChangesInformation;
56 class AbsolutePath;
57 class TemplateProvider;
59 //-----------------------------------------------------------------------------
61 rtl::Reference< Tree > createReadOnlyTree( AbsolutePath const& aRootPath,
62 sharable::Node * _aCacheNode,
63 unsigned int nDepth,
64 TemplateProvider const& aTemplateProvider);
66 rtl::Reference< Tree > createUpdatableTree( AbsolutePath const& aRootPath,
67 sharable::Node * _aCacheNode,
68 unsigned int nDepth,
69 TemplateProvider const& aTemplateProvider);
71 //-----------------------------------------------------------------------------
72 class CommitHelper: private boost::noncopyable
74 struct Data;
76 std::auto_ptr<Data> m_pData;
77 Tree* m_pTree;
78 public:
79 CommitHelper(rtl::Reference< Tree > const& aTree);
80 ~CommitHelper();
82 // collect all changes into rChangeList
83 bool prepareCommit(TreeChangeList& rChangeList);
85 // finish and clean up the changes in rChangeList after they are integrated
86 void finishCommit(TreeChangeList& rChangeList);
87 // throw away and clean up the changes in rChangeList after a commit failed
88 void failedCommit(TreeChangeList& rChangeList);
91 //-----------------------------------------------------------------------------
92 /** adjusts <var>aTree</var> tree to the (externally produced) changes under <var>aExternalChanges</var>
93 and collects the changes this induces locally.
94 @param rLocalChanges
95 a collection that will hold the changes induced by <var>aExternalChanges</var>.
96 @param aExternalChanges
97 a structured change that has already been applied to the master tree.
98 @param aBaseTree
99 the tree that contains (directly) the affected node of <var>aExternalChanges</var>.
100 @param aBaseNode
101 a NodeRef referring to the (directly) affected node of <var>aExternalChanges</var>.
102 @return
103 <TRUE/> if any changes occur in this tree (so rLocalChanges is not empty), <FALSE/> otherwise.
106 bool adjustToChanges( NodeChangesInformation& rLocalChanges,
107 rtl::Reference< Tree > const& aBaseTree, NodeRef const& aBaseNode,
108 SubtreeChange const& aExternalChange) ;
111 //-----------------------------------------------------------------------------
115 #endif // CONFIGMGR_ROOTTREE_HXX_