merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / backend / basicupdatemerger.hxx
blobe4c233f6e16020203e224a8ae0256e31cd1f3c80
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: basicupdatemerger.hxx,v $
10 * $Revision: 1.6 $
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_BASICUPDATEMERGER_HXX
32 #define CONFIGMGR_BACKEND_BASICUPDATEMERGER_HXX
34 #include <cppuhelper/implbase2.hxx>
35 #include <com/sun/star/configuration/backend/XLayerHandler.hpp>
36 #include <com/sun/star/configuration/backend/XLayer.hpp>
38 #ifndef INCLUDED_VECTOR
39 #include <vector>
40 #define INCLUDED_VECTOR
41 #endif
42 // -----------------------------------------------------------------------------
44 namespace configmgr
46 // -----------------------------------------------------------------------------
47 namespace backend
49 // -----------------------------------------------------------------------------
50 namespace uno = ::com::sun::star::uno;
51 namespace lang = ::com::sun::star::lang;
52 namespace backenduno = ::com::sun::star::configuration::backend;
53 // -----------------------------------------------------------------------------
55 class BasicUpdateMerger : public cppu::WeakImplHelper2< backenduno::XLayerHandler, backenduno::XLayer >
57 public:
58 explicit
59 BasicUpdateMerger(uno::Reference< backenduno::XLayer > const & _xSourceLayer);
60 ~BasicUpdateMerger();
62 // XLayerHandler
63 protected:
64 virtual void SAL_CALL
65 startLayer( )
66 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
68 virtual void SAL_CALL
69 endLayer( )
70 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
72 virtual void SAL_CALL
73 overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
74 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
76 virtual void SAL_CALL
77 addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
78 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
80 virtual void SAL_CALL
81 addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
82 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
84 virtual void SAL_CALL
85 endNode( )
86 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
88 virtual void SAL_CALL
89 dropNode( const rtl::OUString& aName )
90 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
92 virtual void SAL_CALL
93 overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
94 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
96 virtual void SAL_CALL
97 endProperty( )
98 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
100 virtual void SAL_CALL
101 setPropertyValue( const uno::Any& aValue )
102 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
104 virtual void SAL_CALL
105 setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
106 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
108 virtual void SAL_CALL
109 addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
110 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
112 virtual void SAL_CALL
113 addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
114 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
116 // XLayer
117 protected:
118 virtual void SAL_CALL
119 readData( const uno::Reference< backenduno::XLayerHandler >& aHandler )
120 throw (backenduno::MalformedDataException, lang::NullPointerException, lang::WrappedTargetException, uno::RuntimeException);
122 // new overrideable
123 private:
124 /// write the whole update to the output
125 virtual void flushUpdate() = 0;
127 protected:
128 bool isHandling() const { return m_nNesting != 0 || !m_aSearchPath.empty(); }
129 bool isSkipping() const { return m_bSkipping; }
130 void startSkipping();
132 void findContext(std::vector<rtl::OUString> const & _aContext);
133 void leaveContext();
135 uno::Reference< backenduno::XLayerHandler > getResultWriter() const { return m_xResultHandler; };
137 void raiseMalformedDataException(sal_Char const * pMsg);
138 private:
139 void pushLevel(rtl::OUString const & _aLevel);
140 void popLevel();
142 void flushContext();
143 private:
144 uno::Reference< backenduno::XLayer > m_xSourceLayer;
145 uno::Reference< backenduno::XLayerHandler > m_xResultHandler;
146 std::vector<rtl::OUString> m_aSearchPath;
148 sal_Int16 m_nNesting;
149 bool m_bSkipping;
151 // -----------------------------------------------------------------------------
152 } // namespace xml
153 // -----------------------------------------------------------------------------
155 } // namespace configmgr
156 #endif