merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / backend / backendaccess.hxx
blob2a53cb7a0fd6807de5e5c00e8b1c9fbf07b3cf73
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: backendaccess.hxx,v $
10 * $Revision: 1.14 $
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_BACKENDACCESS_HXX_
32 #define CONFIGMGR_BACKEND_BACKENDACCESS_HXX_
34 #include "backendnotifier.hxx"
35 #include "mergeddataprovider.hxx"
36 #include "mergedcomponentdata.hxx"
37 #include "matchlocale.hxx"
38 #include <com/sun/star/configuration/backend/XLayer.hpp>
39 #include <com/sun/star/configuration/backend/XSchema.hpp>
40 #include <com/sun/star/configuration/backend/XBackend.hpp>
41 #include <com/sun/star/uno/XComponentContext.hpp>
42 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
43 #include "binarycache.hxx"
44 #include <com/sun/star/configuration/backend/XBackendChangesNotifier.hpp>
47 namespace configmgr { namespace backend {
49 namespace css = com::sun::star ;
50 namespace uno = css::uno ;
51 namespace lang = css::lang ;
52 namespace backenduno = css::configuration::backend ;
54 /**
55 Implementation of IMergedDataProvider handling the access
56 to the configuration data.
58 class BackendAccess : public IMergedDataProvider
60 public :
61 /**
62 Constructor using an XBackend implementation and a
63 service factory.
65 @param xBackend backend used for access to data
66 @param xContext uno context for instantiation of services
68 BackendAccess( const uno::Reference<backenduno::XBackend>& xBackend,
69 const uno::Reference<uno::XComponentContext>& xContext) ;
70 /** Destructor */
71 ~BackendAccess(void) ;
73 // IMergedDataProvider
74 virtual ResultHolder< ComponentInstance > getNodeData(const ComponentRequest& aRequest,
75 ITemplateDataProvider* aTemplateProvider,
76 INodeDataListener *aListener = NULL)
77 SAL_THROW((com::sun::star::uno::Exception)) ;
78 virtual void removeRequestListener(INodeDataListener *aListener,
79 const ComponentRequest& aRequest)
80 SAL_THROW(());
81 virtual void updateNodeData(const UpdateRequest& aUpdate)
82 SAL_THROW((com::sun::star::uno::Exception)) ;
83 virtual ResultHolder< NodeInstance > getDefaultData(const NodeRequest& aRequest)
84 SAL_THROW((com::sun::star::uno::Exception)) ;
85 virtual ResultHolder< TemplateInstance > getTemplateData(const TemplateRequest& aRequest)
86 SAL_THROW((com::sun::star::uno::Exception)) ;
88 private :
90 /**
91 Retrieves the schema of a component.
93 uno::Reference< backenduno::XSchema > getSchema(const rtl::OUString& aComponent) ;
95 /**
96 Retrieves the schema version of a component.
98 rtl::OUString getSchemaVersion(const rtl::OUString& aComponent) ;
101 Retrieves the layers for a request.
103 uno::Sequence< uno::Reference<backenduno::XLayer> > getLayers(const rtl::OUString& aComponent,const RequestOptions& aOptions) ;
106 Reads merged default data with a given number of layers.
108 bool readDefaultData( MergedComponentData & aComponentData,
109 rtl::OUString const & aComponent,
110 RequestOptions const & aOptions,
111 bool bIncludeTemplates,
112 const uno::Reference<backenduno::XLayer> * pLayers,
113 sal_Int32 nNumLayers,
114 ITemplateDataProvider *aTemplateProvider,
115 sal_Int32 * pLayersMerged = 0)
116 SAL_THROW((com::sun::star::uno::Exception));
118 Merges layers onto component data.
120 void merge(
121 MergedComponentData& aData,
122 const uno::Reference<backenduno::XLayer> * pLayers,
123 sal_Int32 aNumLayers,
124 com::sun::star::lang::Locale const & aRequestedLocale,
125 std::vector< com::sun::star::lang::Locale > & inoutMergedLocales,
126 ITemplateDataProvider *aTemplateProvider,
127 sal_Int32 * pLayersMerged = 0)
128 SAL_THROW((com::sun::star::uno::Exception));
129 private :
131 Decides if merging should be retried after an exception.
133 @throws com::sun::star::uno::Exception
134 if not approved
136 bool approveRecovery(
137 const uno::Any & aMergeException,
138 const uno::Reference<backenduno::XLayer> & aBrokenLayer,
139 bool bUserLayerData)
140 SAL_THROW((com::sun::star::uno::Exception));
142 private :
143 /** Get the factory used for service invocation */
144 uno::Reference<lang::XMultiServiceFactory> getServiceFactory() const;
145 /** UNO context to which this backend belongs */
146 uno::Reference<uno::XComponentContext> mContext ;
147 /** Backend being accessed */
148 uno::Reference<backenduno::XBackend> mBackend ;
149 /** Binary cache of default data */
150 BinaryCache mBinaryCache;
151 /** Manages Nofification from the Backends */
152 uno::Reference<backenduno::XBackendChangesListener> mXNotifier;
154 BackendChangeNotifier * mNotifier;
158 } } // configmgr.backend
160 #endif // CONFIGMGR_BACKEND_BACKENDACCESS_HXX_