merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / backend / importsvc.hxx
bloba5398820975d99b66a765b9f73fd062a7cd7075c
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: importsvc.hxx,v $
10 * $Revision: 1.7 $
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_IMPORTSVC_HXX
32 #define CONFIGMGR_BACKEND_IMPORTSVC_HXX
34 #include "serviceinfohelper.hxx"
35 #include <cppuhelper/implbase3.hxx>
36 #include <osl/mutex.hxx>
37 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 #include <com/sun/star/lang/XInitialization.hpp>
40 #include <com/sun/star/configuration/backend/XLayerImporter.hpp>
41 #include <com/sun/star/configuration/backend/XLayerHandler.hpp>
43 // -----------------------------------------------------------------------------
45 namespace configmgr
47 // -----------------------------------------------------------------------------
48 namespace backend
50 // -----------------------------------------------------------------------------
51 namespace uno = ::com::sun::star::uno;
52 namespace lang = ::com::sun::star::lang;
53 namespace backenduno = ::com::sun::star::configuration::backend;
54 // -----------------------------------------------------------------------------
56 class ImportService : public ::cppu::WeakImplHelper3<
57 backenduno::XLayerImporter,
58 lang::XInitialization,
59 lang::XServiceInfo
62 public:
63 explicit
64 ImportService(uno::Reference< uno::XComponentContext > const & _xContext, ServiceInfoHelper const & aSvcInfo);
65 ~ImportService();
67 // XInitialization
68 virtual void SAL_CALL
69 initialize( const uno::Sequence< uno::Any >& aArguments )
70 throw (uno::Exception, uno::RuntimeException);
72 // XServiceInfo
73 virtual rtl::OUString SAL_CALL
74 getImplementationName( )
75 throw (uno::RuntimeException);
77 virtual sal_Bool SAL_CALL
78 supportsService( const rtl::OUString& ServiceName )
79 throw (uno::RuntimeException);
81 virtual uno::Sequence< rtl::OUString > SAL_CALL
82 getSupportedServiceNames( )
83 throw (uno::RuntimeException);
85 // XLayerImporter
86 virtual uno::Reference< backenduno::XBackend > SAL_CALL
87 getTargetBackend( )
88 throw (uno::RuntimeException);
90 virtual void SAL_CALL
91 setTargetBackend( const uno::Reference< backenduno::XBackend >& aBackend )
92 throw (lang::NullPointerException, uno::RuntimeException);
94 virtual void SAL_CALL
95 importLayer( const uno::Reference< backenduno::XLayer >& aLayer )
96 throw ( backenduno::MalformedDataException,
97 lang::WrappedTargetException, lang::IllegalArgumentException,
98 lang::NullPointerException, uno::RuntimeException);
100 virtual void SAL_CALL
101 importLayerForEntity( const uno::Reference< backenduno::XLayer >& aLayer, const rtl::OUString& aEntity )
102 throw ( backenduno::MalformedDataException,
103 lang::WrappedTargetException, lang::IllegalArgumentException,
104 lang::NullPointerException, uno::RuntimeException);
105 protected:
106 uno::Reference< backenduno::XBackend > createDefaultBackend() const;
108 //uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
110 virtual sal_Bool setImplementationProperty( rtl::OUString const & aName, uno::Any const & aValue);
111 /** Notify backend of import */
112 sal_Bool m_bSendNotification;
113 private:
114 // is pure virtual to allow different import services
115 virtual uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity = rtl::OUString()) = 0;
117 private:
118 osl::Mutex m_aMutex;
119 uno::Reference< uno::XComponentContext > m_xContext;
120 uno::Reference< backenduno::XBackend > m_xDestinationBackend;
123 ServiceInfoHelper m_aServiceInfo;
125 ServiceInfoHelper const & getServiceInfo() const { return m_aServiceInfo; }
127 // -----------------------------------------------------------------------------
129 class MergeImportService : public ImportService
131 public:
132 explicit MergeImportService(uno::Reference< uno::XComponentContext > const & _xContext);
133 private:
134 uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity);
136 // -----------------------------------------------------------------------------
138 class CopyImportService : public ImportService
140 public:
141 explicit CopyImportService(uno::Reference< uno::XComponentContext > const & _xContext);
142 private:
143 uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity);
144 sal_Bool setImplementationProperty( rtl::OUString const & aName, uno::Any const & aValue);
145 private:
146 sal_Bool m_bOverwrite;
148 // -----------------------------------------------------------------------------
149 } // namespace xml
150 // -----------------------------------------------------------------------------
152 } // namespace configmgr
153 #endif