1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: roottree.hxx,v $
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"
38 #include "boost/utility.hpp"
39 #include "rtl/ref.hxx"
41 #include "utility.hxx"
45 //-----------------------------------------------------------------------------
46 namespace sharable
{ union Node
; }
48 struct TreeChangeList
;
50 namespace configuration
52 //-----------------------------------------------------------------------------
55 class NodeChangesInformation
;
57 class TemplateProvider
;
59 //-----------------------------------------------------------------------------
61 rtl::Reference
< Tree
> createReadOnlyTree( AbsolutePath
const& aRootPath
,
62 sharable::Node
* _aCacheNode
,
64 TemplateProvider
const& aTemplateProvider
);
66 rtl::Reference
< Tree
> createUpdatableTree( AbsolutePath
const& aRootPath
,
67 sharable::Node
* _aCacheNode
,
69 TemplateProvider
const& aTemplateProvider
);
71 //-----------------------------------------------------------------------------
72 class CommitHelper
: private boost::noncopyable
76 std::auto_ptr
<Data
> m_pData
;
79 CommitHelper(rtl::Reference
< Tree
> const& aTree
);
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.
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.
99 the tree that contains (directly) the affected node of <var>aExternalChanges</var>.
101 a NodeRef referring to the (directly) affected node of <var>aExternalChanges</var>.
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_