Update ooo320-m1
[ooovba.git] / configmgr / source / inc / template.hxx
blob49fea66201bc6844b520035c021ca41e906c8501
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: template.hxx,v $
10 * $Revision: 1.15 $
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_CONFIGTEMPLATE_HXX_
32 #define CONFIGMGR_CONFIGTEMPLATE_HXX_
34 #include "configexcept.hxx"
35 #include "configpath.hxx"
36 #include <rtl/ref.hxx>
37 #include <salhelper/simplereferenceobject.hxx>
38 #ifndef _CONFIGMGR_UTILITY_HXX_
39 #include <utility.hxx>
40 #endif
42 namespace configmgr
44 //-----------------------------------------------------------------------------
45 class RequestOptions;
46 class TreeManager;
47 namespace sharable { struct SetNode; }
48 namespace configuration
50 //-----------------------------------------------------------------------------
52 class AbsolutePath;
53 //-----------------------------------------------------------------------------
55 struct TemplateProvider_Impl;
56 class TemplateProvider
58 friend class SetElementFactory;
59 friend class TemplateImplHelper;
61 rtl::Reference<TemplateProvider_Impl> m_aImpl;
62 public:
63 TemplateProvider(); // creates an empty (invalid) template instance provider
64 TemplateProvider(rtl::Reference< TreeManager > const & xProvider, RequestOptions const& xOptions);
65 TemplateProvider(TemplateProvider const& aOther);
66 TemplateProvider& operator=(TemplateProvider const& aOther);
67 ~TemplateProvider();
69 bool isValid() const { return !!m_aImpl.is(); }
71 //-----------------------------------------------------------------------------
73 /// provides information about the elements of a <type>Node</type> that is a Container ("set").
74 class Template : public salhelper::SimpleReferenceObject
76 rtl::OUString m_aName;
77 rtl::OUString m_aModule;
78 com::sun::star::uno::Type m_aInstanceType;
79 private:
80 explicit Template(rtl::OUString const& aName, rtl::OUString const& aModule,com::sun::star::uno::Type const& aType);
82 public:
83 /// checks if the type of an instance of this is known
84 bool isInstanceTypeKnown() const;
86 /// checks if this is a 'value' template <p> PRE: the instance type is known </p>
87 bool isInstanceValue() const;
89 /// get the UNO type for instances (primarily (only ?) for 'value' templates) <p> PRE: the instance type is known </p>
90 com::sun::star::uno::Type getInstanceType() const;
92 /// get the path where the template is located
93 rtl::OUString getPathString() const;
95 /// get the local name of the template
96 rtl::OUString getName() const { return m_aName; }
98 /// get the package name of the template
99 rtl::OUString getModule() const { return m_aModule; }
101 friend class TemplateImplHelper;
104 /// make a template instance that matches the elements of the given set. Ensures that the element type is known
105 rtl::Reference<Template> makeSetElementTemplate(sharable::SetNode * set, TemplateProvider const& _aProvider);
106 //-----------------------------------------------------------------------------
110 #endif // CONFIGMGR_CONFIGTEMPLATE_HXX_