2000-11-07 07:35:59 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 07:53:42 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-11-07 07:35:59 -06:00
|
|
|
*
|
2008-04-11 07:53:42 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-11-07 07:35:59 -06:00
|
|
|
*
|
2008-04-11 07:53:42 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-11-07 07:35:59 -06:00
|
|
|
*
|
2008-04-11 07:53:42 -05:00
|
|
|
* $RCSfile: template.cxx,v $
|
2008-06-16 08:07:19 -05:00
|
|
|
* $Revision: 1.18 $
|
2000-11-07 07:35:59 -06:00
|
|
|
*
|
2008-04-11 07:53:42 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-11-07 07:35:59 -06:00
|
|
|
*
|
2008-04-11 07:53:42 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-11-07 07:35:59 -06:00
|
|
|
*
|
2008-04-11 07:53:42 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-11-07 07:35:59 -06:00
|
|
|
*
|
2008-04-11 07:53:42 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-11-07 07:35:59 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 09:31:47 -05:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_configmgr.hxx"
|
|
|
|
|
2000-11-07 07:35:59 -06:00
|
|
|
#include "template.hxx"
|
2000-11-19 18:30:48 -06:00
|
|
|
#include "templateimpl.hxx"
|
2002-02-11 06:47:56 -06:00
|
|
|
#include "setnodeaccess.hxx"
|
2003-03-19 09:20:19 -06:00
|
|
|
#include "apitypes.hxx"
|
2000-11-07 07:35:59 -06:00
|
|
|
|
|
|
|
namespace configmgr
|
|
|
|
{
|
|
|
|
namespace configuration
|
|
|
|
{
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-19 18:30:48 -06:00
|
|
|
// class TemplateProvider
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-07 07:35:59 -06:00
|
|
|
|
2001-04-19 09:13:33 -05:00
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-19 18:30:48 -06:00
|
|
|
TemplateProvider::TemplateProvider()
|
|
|
|
: m_aImpl()
|
|
|
|
{
|
|
|
|
}
|
2000-11-07 07:35:59 -06:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2003-03-19 09:20:19 -06:00
|
|
|
TemplateProvider::TemplateProvider(TemplateManagerRef const & xProvider, RequestOptions const& aOptions)
|
|
|
|
: m_aImpl( new TemplateProvider_Impl(xProvider,aOptions) )
|
2000-11-07 07:35:59 -06:00
|
|
|
{
|
2000-11-19 18:30:48 -06:00
|
|
|
}
|
2000-11-07 07:35:59 -06:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-19 18:30:48 -06:00
|
|
|
TemplateProvider::TemplateProvider(TemplateProvider const& aOther)
|
|
|
|
: m_aImpl(aOther.m_aImpl)
|
2000-11-07 07:35:59 -06:00
|
|
|
{
|
|
|
|
}
|
2001-04-19 09:13:33 -05:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
TemplateProvider& TemplateProvider::operator =(TemplateProvider const& aOther)
|
|
|
|
{
|
|
|
|
m_aImpl = aOther.m_aImpl;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2000-11-07 07:35:59 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-19 18:30:48 -06:00
|
|
|
TemplateProvider::~TemplateProvider()
|
2000-11-07 07:35:59 -06:00
|
|
|
{
|
|
|
|
}
|
2000-11-19 18:30:48 -06:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// class Template
|
2000-11-07 07:35:59 -06:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2001-10-26 04:55:13 -05:00
|
|
|
Template::Template(Name const& aName, Name const& aModule,UnoType const& aType)
|
2000-11-07 07:35:59 -06:00
|
|
|
: m_aName(aName)
|
|
|
|
, m_aModule(aModule)
|
|
|
|
, m_aInstanceType(aType)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2000-11-19 18:30:48 -06:00
|
|
|
bool Template::isInstanceTypeKnown() const
|
|
|
|
{
|
|
|
|
OSL_ASSERT( TemplateImplHelper::getNoTypeAvailable().getTypeClass() == uno::TypeClass_VOID );
|
|
|
|
return m_aInstanceType.getTypeClass() != uno::TypeClass_VOID;
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2000-11-07 07:35:59 -06:00
|
|
|
/// checks if this is a 'value' template
|
|
|
|
bool Template::isInstanceValue() const
|
|
|
|
{
|
2000-11-19 18:30:48 -06:00
|
|
|
OSL_ENSURE( isInstanceTypeKnown(), "Template instance type unknown - cannot determine kind");
|
2000-11-07 07:35:59 -06:00
|
|
|
return m_aInstanceType.getTypeClass() != uno::TypeClass_INTERFACE;
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2000-11-19 18:30:48 -06:00
|
|
|
UnoType Template::getInstanceType() const
|
|
|
|
{
|
|
|
|
OSL_ENSURE( isInstanceTypeKnown(), "Template instance type unknown - returning invalid (VOID) type");
|
|
|
|
return m_aInstanceType;
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2000-11-07 07:35:59 -06:00
|
|
|
/// get the path where the template is located
|
2001-07-05 11:05:51 -05:00
|
|
|
OUString Template::getPathString() const
|
2000-11-07 07:35:59 -06:00
|
|
|
{
|
2001-03-12 07:59:05 -06:00
|
|
|
TemplateName aNames(m_aName,m_aModule);
|
2001-07-05 11:05:51 -05:00
|
|
|
return aNames.makePathString( );
|
2000-11-07 07:35:59 -06:00
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2002-02-11 06:47:56 -06:00
|
|
|
TemplateHolder makeSetElementTemplate(data::SetNodeAccess const& _aSet, TemplateProvider const& _aProvider)
|
2000-11-07 07:35:59 -06:00
|
|
|
{
|
2002-02-11 06:47:56 -06:00
|
|
|
TemplateName aNames( _aSet.getElementTemplateName(), _aSet.getElementTemplateModule() );
|
|
|
|
return TemplateImplHelper::makeElementTemplateWithType(aNames, _aProvider, _aSet);
|
2000-11-07 07:35:59 -06:00
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|