merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / backend / layerupdate.cxx
blob8bbb401b39ebd55226f0e8979e612f6efd19ec04
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: layerupdate.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 "layerupdate.hxx"
35 #include "updatedata.hxx"
36 #include "configpath.hxx"
38 namespace configmgr
40 // -----------------------------------------------------------------------------
41 namespace backend
43 // -----------------------------------------------------------------------------
45 LayerUpdate::LayerUpdate()
46 : m_xContextNode()
49 // -----------------------------------------------------------------------------
51 LayerUpdate::LayerUpdate(LayerUpdate const & _aOther)
52 : m_xContextNode(_aOther.m_xContextNode)
53 , m_aContextPath(_aOther.m_aContextPath)
56 // -----------------------------------------------------------------------------
58 LayerUpdate::~LayerUpdate()
61 // -----------------------------------------------------------------------------
63 LayerUpdate & LayerUpdate::operator =(LayerUpdate const & _aOther)
65 m_xContextNode = _aOther.m_xContextNode;
66 return *this;
68 // -----------------------------------------------------------------------------
70 void LayerUpdate::setContextNode(rtl::Reference<NodeUpdate> const & _xContextNode)
72 m_xContextNode = _xContextNode;
73 if (_xContextNode.is())
74 makeContextPath(_xContextNode->getName());
76 else
77 m_aContextPath.clear();
79 // -----------------------------------------------------------------------------
81 void LayerUpdate::makeContextPath(rtl::OUString const & _aPath)
83 configuration::AbsolutePath const aParsedPath = configuration::AbsolutePath::parse(_aPath);
85 m_aContextPath.clear();
86 m_aContextPath.reserve( aParsedPath.getDepth() );
87 for (std::vector<configuration::Path::Component>::const_reverse_iterator it = aParsedPath.begin(); it != aParsedPath.end(); ++it)
89 m_aContextPath.push_back( it->getName() );
92 // -----------------------------------------------------------------------------
94 rtl::Reference<NodeUpdate> LayerUpdate::getContextNode() const
96 return m_xContextNode;
98 // -----------------------------------------------------------------------------
100 std::vector<rtl::OUString> const & LayerUpdate::getContextPath() const
102 OSL_PRECOND( m_xContextNode.is(), "Cannot get context path without context node" );
104 return m_aContextPath;
106 // -----------------------------------------------------------------------------
108 // -----------------------------------------------------------------------------
109 // -----------------------------------------------------------------------------
110 } // namespace backend
112 // -------------------------------------------------------------------------
113 } // namespace configmgr