merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / backendhelper / backendlayerhelper.hxx
blob785293d1476faa3990ca43f452160c7436007b88
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: backendlayerhelper.hxx,v $
10 * $Revision: 1.4 $
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_BACKENDHELPER_BACKENDLAYERHELPER_HXX_
32 #define CONFIGMGR_BACKENDHELPER_BACKENDLAYERHELPER_HXX_
34 #include <com/sun/star/configuration/backend/XLayerContentDescriber.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
39 #include <cppuhelper/compbase2.hxx>
41 namespace configmgr { namespace backendhelper {
43 namespace css = com::sun::star ;
44 namespace uno = css::uno ;
45 namespace lang = css::lang ;
46 namespace backend = css::configuration::backend ;
47 //------------------------------------------------------------------------------
49 /**
50 * Implements the LayerContentDescriber service.
51 * Describes a set of configuration data to an XLayerHandler
52 * Object
54 class BackendLayerHelper : public cppu::WeakComponentImplHelper2<backend::XLayerContentDescriber, lang::XServiceInfo> {
55 public :
56 /**
57 Service constructor from a service factory.
58 @param xContext component context
60 BackendLayerHelper(const uno::Reference<uno::XComponentContext>& xContext) ;
62 /** Destructor */
63 ~BackendLayerHelper(void) ;
66 // XServiceInfo
67 virtual rtl::OUString SAL_CALL
68 getImplementationName( )
69 throw (uno::RuntimeException) ;
71 virtual sal_Bool SAL_CALL
72 supportsService( const rtl::OUString& aServiceName )
73 throw (uno::RuntimeException) ;
75 virtual uno::Sequence<rtl::OUString> SAL_CALL
76 getSupportedServiceNames( )
77 throw (uno::RuntimeException) ;
80 //XLayerContentDescriber
81 virtual void SAL_CALL
82 describeLayer( const uno::Reference< backend::XLayerHandler >& xHandler,
83 const uno::Sequence< backend::PropertyInfo >& aPropertyInfos )
84 throw (lang::NullPointerException,
85 backend::MalformedDataException,
86 uno::RuntimeException);
88 /**
89 Provides the implementation name.
91 @return implementation name
93 static rtl::OUString SAL_CALL getBackendLayerHelperName(void) ;
94 /**
95 Provides the supported services names
97 @return service names
99 static uno::Sequence<rtl::OUString> SAL_CALL getBackendLayerHelperServiceNames(void) ;
100 private:
101 osl::Mutex mMutex;
104 //------------------------------------------------------------------------------
105 class OONode;
106 class OOProperty;
108 /**
109 Base class for representing OO properties and nodes
111 class IOONode
113 public:
114 virtual OONode* getComposite(){return NULL;}
115 virtual ~IOONode(){};
116 virtual OOProperty* asOOProperty(){return NULL;}
117 rtl::OUString getName(){return mName;}
118 void setName(const rtl::OUString& sName){mName = sName;}
119 protected:
120 IOONode(const rtl::OUString& sName);
121 private:
122 rtl::OUString mName;
124 //------------------------------------------------------------------------------
125 class OONode :public IOONode
127 public:
129 OONode(const rtl::OUString& sName);
130 OONode();
131 ~OONode();
133 IOONode* addChild(IOONode* aChild);
134 OONode* getComposite(){return this;}
135 const std::vector<IOONode*>& getChildren();
136 IOONode* getChild(const rtl::OUString& aChildName);
138 private:
139 std::vector<IOONode*> mChildList;
141 //------------------------------------------------------------------------------
142 class OOProperty :public IOONode
144 public:
145 OOProperty(const rtl::OUString& sName,
146 const rtl::OUString& sPropType,
147 const uno::Any& aPropValue,
148 sal_Bool bProtected);
149 ~OOProperty(){};
151 const rtl::OUString& getType(){return mPropType;}
152 uno::Any getValue(){return mPropValue;}
153 sal_Bool isProtected(){return mbProtected;}
154 OOProperty* asOOProperty(){return this;}
156 private:
157 rtl::OUString mPropType;
158 uno::Any mPropValue;
159 sal_Bool mbProtected;
161 //------------------------------------------------------------------------------
164 } } // configmgr.backendhelper
166 #endif // CONFIGMGR_BACKENDHELPER_BACKENDLAYERHELPER_HXX_