update dev300-m58
[ooovba.git] / configmgr / source / treemgr / template.cxx
blob1f8249c63fc22a5862936727f17a8c0585958030
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.cxx,v $
10 * $Revision: 1.18 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_configmgr.hxx"
34 #include "node.hxx"
35 #include "template.hxx"
36 #include "templateimpl.hxx"
37 #include "apitypes.hxx"
39 namespace configmgr
41 namespace configuration
43 //-----------------------------------------------------------------------------
44 // class TemplateProvider
45 //-----------------------------------------------------------------------------
47 //-----------------------------------------------------------------------------
48 TemplateProvider::TemplateProvider()
49 : m_aImpl()
53 //-----------------------------------------------------------------------------
54 TemplateProvider::TemplateProvider(rtl::Reference< TreeManager > const & xProvider, RequestOptions const& aOptions)
55 : m_aImpl( new TemplateProvider_Impl(xProvider,aOptions) )
59 //-----------------------------------------------------------------------------
60 TemplateProvider::TemplateProvider(TemplateProvider const& aOther)
61 : m_aImpl(aOther.m_aImpl)
65 //-----------------------------------------------------------------------------
66 TemplateProvider& TemplateProvider::operator =(TemplateProvider const& aOther)
68 m_aImpl = aOther.m_aImpl;
69 return *this;
72 //-----------------------------------------------------------------------------
73 TemplateProvider::~TemplateProvider()
77 //-----------------------------------------------------------------------------
78 // class Template
79 //-----------------------------------------------------------------------------
81 Template::Template(rtl::OUString const& aName, rtl::OUString const& aModule,com::sun::star::uno::Type const& aType)
82 : m_aName(aName)
83 , m_aModule(aModule)
84 , m_aInstanceType(aType)
87 //-----------------------------------------------------------------------------
89 bool Template::isInstanceTypeKnown() const
91 OSL_ASSERT( TemplateImplHelper::getNoTypeAvailable().getTypeClass() == uno::TypeClass_VOID );
92 return m_aInstanceType.getTypeClass() != uno::TypeClass_VOID;
94 //-----------------------------------------------------------------------------
96 /// checks if this is a 'value' template
97 bool Template::isInstanceValue() const
99 OSL_ENSURE( isInstanceTypeKnown(), "Template instance type unknown - cannot determine kind");
100 return m_aInstanceType.getTypeClass() != uno::TypeClass_INTERFACE;
102 //-----------------------------------------------------------------------------
104 com::sun::star::uno::Type Template::getInstanceType() const
106 OSL_ENSURE( isInstanceTypeKnown(), "Template instance type unknown - returning invalid (VOID) type");
107 return m_aInstanceType;
109 //-----------------------------------------------------------------------------
111 /// get the path where the template is located
112 rtl::OUString Template::getPathString() const
114 TemplateName aNames(m_aName,m_aModule);
115 return aNames.makePathString( );
117 //-----------------------------------------------------------------------------
119 rtl::Reference<Template> makeSetElementTemplate(sharable::SetNode * set, TemplateProvider const& _aProvider)
121 TemplateName aNames( set->getElementTemplateName(), set->getElementTemplateModule() );
122 return TemplateImplHelper::makeElementTemplateWithType(aNames, _aProvider, set);
124 //-----------------------------------------------------------------------------