1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: backendlayerhelper.hxx,v $
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 //------------------------------------------------------------------------------
50 * Implements the LayerContentDescriber service.
51 * Describes a set of configuration data to an XLayerHandler
54 class BackendLayerHelper
: public cppu::WeakComponentImplHelper2
<backend::XLayerContentDescriber
, lang::XServiceInfo
> {
57 Service constructor from a service factory.
58 @param xContext component context
60 BackendLayerHelper(const uno::Reference
<uno::XComponentContext
>& xContext
) ;
63 ~BackendLayerHelper(void) ;
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
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
);
89 Provides the implementation name.
91 @return implementation name
93 static rtl::OUString SAL_CALL
getBackendLayerHelperName(void) ;
95 Provides the supported services names
99 static uno::Sequence
<rtl::OUString
> SAL_CALL
getBackendLayerHelperServiceNames(void) ;
104 //------------------------------------------------------------------------------
109 Base class for representing OO properties and nodes
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
;}
120 IOONode(const rtl::OUString
& sName
);
124 //------------------------------------------------------------------------------
125 class OONode
:public IOONode
129 OONode(const rtl::OUString
& sName
);
133 IOONode
* addChild(IOONode
* aChild
);
134 OONode
* getComposite(){return this;}
135 const std::vector
<IOONode
*>& getChildren();
136 IOONode
* getChild(const rtl::OUString
& aChildName
);
139 std::vector
<IOONode
*> mChildList
;
141 //------------------------------------------------------------------------------
142 class OOProperty
:public IOONode
145 OOProperty(const rtl::OUString
& sName
,
146 const rtl::OUString
& sPropType
,
147 const uno::Any
& aPropValue
,
148 sal_Bool bProtected
);
151 const rtl::OUString
& getType(){return mPropType
;}
152 uno::Any
getValue(){return mPropValue
;}
153 sal_Bool
isProtected(){return mbProtected
;}
154 OOProperty
* asOOProperty(){return this;}
157 rtl::OUString mPropType
;
159 sal_Bool mbProtected
;
161 //------------------------------------------------------------------------------
164 } } // configmgr.backendhelper
166 #endif // CONFIGMGR_BACKENDHELPER_BACKENDLAYERHELPER_HXX_