merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / backend / schemabuilder.hxx
blob4fc42c377e71bafe0ff130dbaadc7865421d3504
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: schemabuilder.hxx,v $
10 * $Revision: 1.9 $
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_SCHEMABUILDER_HXX
32 #define CONFIGMGR_BACKEND_SCHEMABUILDER_HXX
34 #include "mergedcomponentdata.hxx"
35 #include "componentdatahelper.hxx"
36 #include "mergeddataprovider.hxx"
37 #include <com/sun/star/configuration/backend/XSchemaHandler.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
39 #include <cppuhelper/implbase1.hxx>
41 namespace configmgr
43 // -----------------------------------------------------------------------------
44 class OTreeNodeFactory;
45 // -----------------------------------------------------------------------------
46 namespace backend
48 // -----------------------------------------------------------------------------
49 namespace uno = ::com::sun::star::uno;
50 namespace lang = ::com::sun::star::lang;
52 namespace backenduno = ::com::sun::star::configuration::backend;
53 // -----------------------------------------------------------------------------
55 class SchemaBuilder
56 : public cppu::WeakImplHelper1<backenduno::XSchemaHandler>
58 public:
59 SchemaBuilder(uno::Reference< uno::XComponentContext > const & xContext, const rtl::OUString& aExpectedComponentName, MergedComponentData & rData, ITemplateDataProvider* aTemplateProvider = NULL );
60 virtual ~SchemaBuilder();
62 // checking the result
63 bool isDone() const { return m_aContext.isDone(); }
65 MergedComponentData & result();
66 MergedComponentData const & result() const;
68 // XSchemaHandler
69 public:
70 virtual void SAL_CALL
71 startSchema( )
72 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
74 virtual void SAL_CALL
75 endSchema( )
76 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
78 virtual void SAL_CALL
79 importComponent( const rtl::OUString& aName )
80 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
82 virtual void SAL_CALL
83 startComponent( const rtl::OUString& aName )
84 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
86 virtual void SAL_CALL
87 endComponent( )
88 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
90 virtual void SAL_CALL
91 startGroupTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
92 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
94 virtual void SAL_CALL
95 startSetTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
96 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
98 virtual void SAL_CALL
99 endTemplate( )
100 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
102 virtual void SAL_CALL
103 startGroup( const rtl::OUString& aName, sal_Int16 aAttributes )
104 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
106 virtual void SAL_CALL
107 startSet( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
108 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
110 virtual void SAL_CALL
111 endNode( )
112 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
114 virtual void SAL_CALL
115 addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
116 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
118 virtual void SAL_CALL
119 addPropertyWithDefault( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aDefaultValue )
120 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
122 virtual void SAL_CALL
123 addInstance( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate )
124 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
126 virtual void SAL_CALL
127 addItemType( const backenduno::TemplateIdentifier& aItemType )
128 throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
130 private:
131 static node::Attributes getComponentRootAttributes();
132 static node::Attributes getTemplateBaseAttributes();
133 node::Attributes getNodeAttributes() const;
134 node::Attributes makePropertyAttributes(sal_Int16 aSchemaAttributes) const;
136 bool isExtensible(sal_Int16 aSchemaAttributes);
138 void substituteInstances();
139 private:
140 MergedComponentData & m_aData;
141 DataBuilderContext m_aContext;
142 ComponentDataFactory m_aFactory;
144 // -----------------------------------------------------------------------------
146 } // namespace backend
147 // -----------------------------------------------------------------------------
149 } // namespace configmgr
150 #endif