Update ooo320-m1
[ooovba.git] / configmgr / source / backend / updatedispatch.hxx
blob642f8e1a9ceabb759c78b1f5f1c60557d24346c3
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: updatedispatch.hxx,v $
10 * $Revision: 1.9 $
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_BACKEND_UPDATEDISPATCH_HXX
32 #define CONFIGMGR_BACKEND_UPDATEDISPATCH_HXX
34 #include "change.hxx"
35 #include "nodevisitor.hxx"
36 #include "utility.hxx"
37 #include <boost/utility.hpp>
38 #include <com/sun/star/uno/Reference.hxx>
40 namespace com { namespace sun { namespace star { namespace configuration { namespace backend {
41 class XUpdateHandler;
42 } } } } }
44 namespace configmgr
46 // -----------------------------------------------------------------------------
47 namespace configuration
49 class AbsolutePath;
51 // -----------------------------------------------------------------------------
52 namespace backend
54 // -----------------------------------------------------------------------------
55 namespace uno = ::com::sun::star::uno;
56 namespace backenduno = ::com::sun::star::configuration::backend;
58 // -----------------------------------------------------------------------------
60 class UpdateDispatcher: private boost::noncopyable, private ChangeTreeAction, private data::SetVisitor
62 public:
63 UpdateDispatcher(uno::Reference< backenduno::XUpdateHandler > const & _xUpdateHandler, rtl::OUString const & _aLocale);
64 ~UpdateDispatcher();
66 void dispatchUpdate(configuration::AbsolutePath const & _aRootPath, SubtreeChange const& _anUpdate);
68 protected:
69 using data::NodeVisitor::handle;
71 private:
72 void startUpdate();
73 void endUpdate();
75 virtual void handle(ValueChange const& aValueNode);
76 virtual void handle(AddNode const& aAddNode);
77 virtual void handle(RemoveNode const& aRemoveNode);
78 virtual void handle(SubtreeChange const& aSubtree) ;
80 virtual bool handle(sharable::ValueNode * node);
81 virtual bool handle(sharable::GroupNode * node);
82 virtual bool handle(sharable::SetNode * node);
83 virtual bool handle(sharable::TreeFragment * tree);
84 private:
85 sal_Int16 getUpdateAttributes(node::Attributes const & _aAttributes, bool bAdded);
86 sal_Int16 getUpdateAttributeMask(node::Attributes const & _aAttributes);
88 bool testReplacedAndGetName(sharable::Node * node, rtl::OUString & _aName);
89 private:
90 configuration::AbsolutePath const * m_pContextPath;
91 uno::Reference< backenduno::XUpdateHandler > m_xUpdateHandler;
92 rtl::OUString m_aLocale;
93 rtl::OUString m_aElementName;
94 bool m_bInValueSet;
95 bool m_bInLocalizedValues;
97 // -----------------------------------------------------------------------------
98 } // namespace backend
99 // -----------------------------------------------------------------------------
101 } // namespace configmgr
102 #endif