merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / backend / importmergehandler.hxx
blob8e0983856c2c3168610dc01e75316739ecb057b6
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: importmergehandler.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_IMPORTMERGEHANDLER_HXX
32 #define CONFIGMGR_BACKEND_IMPORTMERGEHANDLER_HXX
34 #include "basicimporthandler.hxx"
36 // -----------------------------------------------------------------------------
38 namespace configmgr
40 // -----------------------------------------------------------------------------
41 namespace backend
43 // -----------------------------------------------------------------------------
44 namespace uno = ::com::sun::star::uno;
45 namespace lang = ::com::sun::star::lang;
46 namespace backenduno = ::com::sun::star::configuration::backend;
47 // -----------------------------------------------------------------------------
49 class ImportMergeHandler : public BasicImportHandler
51 public:
52 enum Mode
54 merge, // merge as update into existing data
55 copy, // reset existing data first -> copy imported data
56 no_overwrite // copy/merge only if no data is in the layer
59 explicit
60 ImportMergeHandler(uno::Reference< backenduno::XBackend > const & xTargetBackend, Mode mode,
61 rtl::OUString const & aEntity = rtl::OUString(), sal_Bool const & bNotify = sal_False);
63 // XLayerHandler
64 protected:
65 virtual void SAL_CALL
66 startLayer( )
67 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
69 virtual void SAL_CALL
70 endLayer( )
71 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
73 virtual void SAL_CALL
74 overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
75 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
77 virtual void SAL_CALL
78 addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
79 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
81 virtual void SAL_CALL
82 addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
83 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
85 virtual void SAL_CALL
86 endNode( )
87 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
89 virtual void SAL_CALL
90 dropNode( const rtl::OUString& aName )
91 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
93 virtual void SAL_CALL
94 overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
95 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
97 virtual void SAL_CALL
98 endProperty( )
99 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
101 virtual void SAL_CALL
102 setPropertyValue( const uno::Any& aValue )
103 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
105 virtual void SAL_CALL
106 setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
107 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
109 virtual void SAL_CALL
110 addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
111 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
113 virtual void SAL_CALL
114 addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
115 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
116 private:
117 bool isStarted() const;
118 void checkStarted();
119 void failNotStarted();
121 uno::Reference< backenduno::XUpdateHandler > getOutputHandler();
123 uno::Reference< backenduno::XUpdateHandler > createOutputHandler();
124 private:
125 uno::Reference< backenduno::XUpdateHandler > m_xOutputHandler;
126 Mode m_mode;
128 // -----------------------------------------------------------------------------
129 } // namespace xml
130 // -----------------------------------------------------------------------------
132 } // namespace configmgr
133 #endif