2010-10-12 08:57:08 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-11-16 05:14:16 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 05:27:43 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-11-16 05:14:16 -06:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-11-16 05:14:16 -06:00
|
|
|
*
|
2008-04-11 05:27:43 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-11-16 05:14:16 -06:00
|
|
|
*
|
2008-04-11 05:27:43 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-11-16 05:14:16 -06:00
|
|
|
*
|
2008-04-11 05:27:43 -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.
|
2004-11-16 05:14:16 -06:00
|
|
|
*
|
2008-04-11 05:27:43 -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).
|
2004-11-16 05:14:16 -06:00
|
|
|
*
|
2008-04-11 05:27:43 -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.
|
2004-11-16 05:14:16 -06:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include "xsdvalidationhelper.hxx"
|
|
|
|
#include "xsddatatypes.hxx"
|
|
|
|
#include "formstrings.hxx"
|
|
|
|
|
|
|
|
/** === begin UNO includes === **/
|
2005-03-23 04:59:24 -06:00
|
|
|
#include <com/sun/star/lang/XServiceInfo.hpp>
|
|
|
|
#include <com/sun/star/xsd/DataTypeClass.hpp>
|
|
|
|
#include <com/sun/star/util/NumberFormat.hpp>
|
|
|
|
#include <com/sun/star/util/XNumberFormatTypes.hpp>
|
|
|
|
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
|
2004-11-16 05:14:16 -06:00
|
|
|
#include <com/sun/star/xforms/XDataTypeRepository.hpp>
|
|
|
|
/** === end UNO includes === **/
|
2009-10-15 17:05:16 -05:00
|
|
|
#include <unotools/syslocale.hxx>
|
2008-01-14 08:02:02 -06:00
|
|
|
#include <tools/diagnose_ex.h>
|
2005-03-23 04:59:24 -06:00
|
|
|
|
2004-11-16 05:14:16 -06:00
|
|
|
//........................................................................
|
|
|
|
namespace pcr
|
|
|
|
{
|
|
|
|
//........................................................................
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::xsd;
|
2005-03-23 04:59:24 -06:00
|
|
|
using namespace ::com::sun::star::util;
|
|
|
|
using namespace ::com::sun::star::lang;
|
2004-11-16 05:14:16 -06:00
|
|
|
using namespace ::com::sun::star::xforms;
|
|
|
|
|
2005-03-23 04:59:24 -06:00
|
|
|
namespace NumberFormat = ::com::sun::star::util::NumberFormat;
|
|
|
|
|
2004-11-16 05:14:16 -06:00
|
|
|
//====================================================================
|
|
|
|
//= XSDValidationHelper
|
|
|
|
//====================================================================
|
|
|
|
//--------------------------------------------------------------------
|
2006-03-14 04:34:50 -06:00
|
|
|
XSDValidationHelper::XSDValidationHelper( ::osl::Mutex& _rMutex, const Reference< XPropertySet >& _rxIntrospectee, const Reference< frame::XModel >& _rxContextDocument )
|
|
|
|
:EFormsHelper( _rMutex, _rxIntrospectee, _rxContextDocument )
|
2005-03-23 04:59:24 -06:00
|
|
|
,m_bInspectingFormattedField( false )
|
2004-11-16 05:14:16 -06:00
|
|
|
{
|
2005-03-23 04:59:24 -06:00
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XPropertySetInfo > xPSI;
|
|
|
|
Reference< XServiceInfo > xSI( _rxIntrospectee, UNO_QUERY );
|
|
|
|
if ( m_xControlModel.is() )
|
|
|
|
xPSI = m_xControlModel->getPropertySetInfo();
|
|
|
|
if ( xPSI.is()
|
|
|
|
&& xPSI->hasPropertyByName( PROPERTY_FORMATKEY )
|
|
|
|
&& xPSI->hasPropertyByName( PROPERTY_FORMATSSUPPLIER )
|
|
|
|
&& xSI.is()
|
|
|
|
&& xSI->supportsService( SERVICE_COMPONENT_FORMATTEDFIELD )
|
|
|
|
)
|
|
|
|
m_bInspectingFormattedField = true;
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::XSDValidationHelper: caught an exception while examining the introspectee!" );
|
2005-03-23 04:59:24 -06:00
|
|
|
}
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void XSDValidationHelper::getAvailableDataTypeNames( ::std::vector< ::rtl::OUString >& /* [out] */ _rNames ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
_rNames.resize( 0 );
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XDataTypeRepository > xRepository = getDataTypeRepository();
|
|
|
|
Sequence< ::rtl::OUString > aElements;
|
|
|
|
if ( xRepository.is() )
|
|
|
|
aElements = xRepository->getElementNames();
|
|
|
|
|
|
|
|
_rNames.resize( aElements.getLength() );
|
|
|
|
::std::copy( aElements.getConstArray(), aElements.getConstArray() + aElements.getLength(), _rNames.begin() );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::getAvailableDataTypeNames: caught an exception!" );
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
Reference< XDataTypeRepository > XSDValidationHelper::getDataTypeRepository() const SAL_THROW((Exception))
|
|
|
|
{
|
|
|
|
Reference< XDataTypeRepository > xRepository;
|
|
|
|
|
|
|
|
Reference< xforms::XModel > xModel( getCurrentFormModel( ) );
|
|
|
|
if ( xModel.is() )
|
|
|
|
xRepository = xModel->getDataTypeRepository();
|
|
|
|
|
|
|
|
return xRepository;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
Reference< XDataTypeRepository > XSDValidationHelper::getDataTypeRepository( const ::rtl::OUString& _rModelName ) const SAL_THROW((Exception))
|
|
|
|
{
|
|
|
|
Reference< XDataTypeRepository > xRepository;
|
|
|
|
|
|
|
|
Reference< xforms::XModel > xModel( getFormModelByName( _rModelName ) );
|
|
|
|
if ( xModel.is() )
|
|
|
|
xRepository = xModel->getDataTypeRepository();
|
|
|
|
|
|
|
|
return xRepository;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
Reference< XDataType > XSDValidationHelper::getDataType( const ::rtl::OUString& _rName ) const SAL_THROW((Exception))
|
|
|
|
{
|
|
|
|
Reference< XDataType > xDataType;
|
|
|
|
|
|
|
|
if ( _rName.getLength() )
|
|
|
|
{
|
|
|
|
Reference< XDataTypeRepository > xRepository = getDataTypeRepository();
|
|
|
|
if ( xRepository.is() )
|
|
|
|
xDataType = xRepository->getDataType( _rName );
|
|
|
|
}
|
|
|
|
return xDataType;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
::rtl::OUString XSDValidationHelper::getValidatingDataTypeName( ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
::rtl::OUString sDataTypeName;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XPropertySet > xBinding( getCurrentBinding() );
|
|
|
|
// it's allowed here to not (yet) have a binding
|
|
|
|
if ( xBinding.is() )
|
|
|
|
{
|
|
|
|
OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_XSD_DATA_TYPE ) >>= sDataTypeName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::getValidatingDataTypeName: caught an exception!" );
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
return sDataTypeName;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
::rtl::Reference< XSDDataType > XSDValidationHelper::getDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
::rtl::Reference< XSDDataType > pReturn;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XDataType > xValidatedAgainst;
|
|
|
|
|
|
|
|
if ( _rName.getLength() )
|
|
|
|
xValidatedAgainst = getDataType( _rName );
|
|
|
|
|
|
|
|
if ( xValidatedAgainst.is() )
|
|
|
|
pReturn = new XSDDataType( xValidatedAgainst );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::getDataTypeByName: caught an exception!" );
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return pReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
::rtl::Reference< XSDDataType > XSDValidationHelper::getValidatingDataType( ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return getDataTypeByName( getValidatingDataTypeName() );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
bool XSDValidationHelper::cloneDataType( const ::rtl::Reference< XSDDataType >& _pDataType, const ::rtl::OUString& _rNewName ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
OSL_ENSURE( _pDataType.is(), "XSDValidationHelper::removeDataTypeFromRepository: invalid data type!" );
|
|
|
|
if ( !_pDataType.is() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XDataTypeRepository > xRepository( getDataTypeRepository() );
|
|
|
|
OSL_ENSURE( xRepository.is(), "XSDValidationHelper::removeDataTypeFromRepository: invalid data type repository!" );
|
|
|
|
if ( !xRepository.is() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
Reference< XDataType > xDataType( _pDataType->getUnoDataType() );
|
|
|
|
OSL_ENSURE( xDataType.is(), "XSDValidationHelper::removeDataTypeFromRepository: invalid data type (II)!" );
|
|
|
|
if ( !xDataType.is() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
xRepository->cloneDataType( xDataType->getName(), _rNewName );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::cloneDataType: caught an exception!" );
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
bool XSDValidationHelper::removeDataTypeFromRepository( const ::rtl::OUString& _rName ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XDataTypeRepository > xRepository( getDataTypeRepository() );
|
|
|
|
OSL_ENSURE( xRepository.is(), "XSDValidationHelper::removeDataTypeFromRepository: invalid data type repository!" );
|
|
|
|
if ( !xRepository.is() )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if ( !xRepository->hasByName( _rName ) )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::removeDataTypeFromRepository: invalid repository and/or data type!" );
|
2004-11-16 05:14:16 -06:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
xRepository->revokeDataType( _rName );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::removeDataTypeFromRepository: caught an exception!" );
|
2004-11-16 05:14:16 -06:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void XSDValidationHelper::setValidatingDataTypeByName( const ::rtl::OUString& _rName ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XPropertySet > xBinding( getCurrentBinding() );
|
|
|
|
OSL_ENSURE( xBinding.is(), "XSDValidationHelper::setValidatingDataTypeByName: no active binding - how this?" );
|
|
|
|
|
|
|
|
if ( xBinding.is() )
|
|
|
|
{
|
|
|
|
// get the old data type - this is necessary for notifying property changes
|
2006-03-14 04:34:50 -06:00
|
|
|
::rtl::OUString sOldDataTypeName;
|
|
|
|
OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_XSD_DATA_TYPE ) >>= sOldDataTypeName );
|
2004-11-16 05:14:16 -06:00
|
|
|
Reference< XPropertySet > xOldType;
|
2006-03-14 04:34:50 -06:00
|
|
|
try { xOldType = xOldType.query( getDataType( sOldDataTypeName ) ); } catch( const Exception& ) { }
|
2004-11-16 05:14:16 -06:00
|
|
|
|
|
|
|
// set the new data type name
|
|
|
|
xBinding->setPropertyValue( PROPERTY_XSD_DATA_TYPE, makeAny( _rName ) );
|
|
|
|
|
|
|
|
// retrieve the new data type object
|
|
|
|
Reference< XPropertySet > xNewType( getDataType( _rName ), UNO_QUERY );
|
|
|
|
|
|
|
|
// fire any changes in the properties which result from this new type
|
2011-09-29 15:32:08 -05:00
|
|
|
std::set< ::rtl::OUString > aFilter; aFilter.insert( static_cast<const rtl::OUString&>(PROPERTY_NAME) );
|
2004-11-16 05:14:16 -06:00
|
|
|
firePropertyChanges( xOldType, xNewType, aFilter );
|
2006-03-14 04:34:50 -06:00
|
|
|
|
|
|
|
// fire the change in the Data Type property
|
|
|
|
::rtl::OUString sNewDataTypeName;
|
|
|
|
OSL_VERIFY( xBinding->getPropertyValue( PROPERTY_XSD_DATA_TYPE ) >>= sNewDataTypeName );
|
|
|
|
firePropertyChange( PROPERTY_XSD_DATA_TYPE, makeAny( sOldDataTypeName ), makeAny( sNewDataTypeName ) );
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
}
|
2008-01-14 08:02:02 -06:00
|
|
|
catch( const Exception& )
|
2004-11-16 05:14:16 -06:00
|
|
|
{
|
2008-01-14 08:02:02 -06:00
|
|
|
DBG_UNHANDLED_EXCEPTION();
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void XSDValidationHelper::copyDataType( const ::rtl::OUString& _rFromModel, const ::rtl::OUString& _rToModel,
|
|
|
|
const ::rtl::OUString& _rDataTypeName ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
if ( _rFromModel == _rToModel )
|
|
|
|
// nothing to do (me thinks)
|
|
|
|
return;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XDataTypeRepository > xFromRepository, xToRepository;
|
|
|
|
if ( _rFromModel.getLength() )
|
|
|
|
xFromRepository = getDataTypeRepository( _rFromModel );
|
|
|
|
if ( _rToModel.getLength() )
|
|
|
|
xToRepository = getDataTypeRepository( _rToModel );
|
|
|
|
|
|
|
|
if ( !xFromRepository.is() || !xToRepository.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ( !xFromRepository->hasByName( _rDataTypeName ) || xToRepository->hasByName( _rDataTypeName ) )
|
|
|
|
// not existent in the source, or already existent (by name) in the destination
|
|
|
|
return;
|
|
|
|
|
|
|
|
// determine the built-in type belonging to the source type
|
|
|
|
::rtl::Reference< XSDDataType > pSourceType = new XSDDataType( xFromRepository->getDataType( _rDataTypeName ) );
|
|
|
|
::rtl::OUString sTargetBaseType = getBasicTypeNameForClass( pSourceType->classify(), xToRepository );
|
|
|
|
|
|
|
|
// create the target type
|
|
|
|
Reference< XDataType > xTargetType = xToRepository->cloneDataType( sTargetBaseType, _rDataTypeName );
|
|
|
|
::rtl::Reference< XSDDataType > pTargetType = new XSDDataType( xTargetType );
|
|
|
|
|
|
|
|
// copy the facets
|
|
|
|
pTargetType->copyFacetsFrom( pSourceType );
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::copyDataType: caught an exception!" );
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-23 04:59:24 -06:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
void XSDValidationHelper::findDefaultFormatForIntrospectee() SAL_THROW(())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
::rtl::Reference< XSDDataType > xDataType = getValidatingDataType();
|
|
|
|
if ( xDataType.is() )
|
|
|
|
{
|
|
|
|
// find a NumberFormat type corresponding to the DataTypeClass
|
|
|
|
sal_Int16 nNumberFormatType = NumberFormat::NUMBER;
|
|
|
|
switch ( xDataType->classify() )
|
|
|
|
{
|
|
|
|
case DataTypeClass::DATETIME:
|
|
|
|
nNumberFormatType = NumberFormat::DATETIME;
|
|
|
|
break;
|
|
|
|
case DataTypeClass::DATE:
|
|
|
|
nNumberFormatType = NumberFormat::DATE;
|
|
|
|
break;
|
|
|
|
case DataTypeClass::TIME:
|
|
|
|
nNumberFormatType = NumberFormat::TIME;
|
|
|
|
break;
|
|
|
|
case DataTypeClass::STRING:
|
|
|
|
case DataTypeClass::anyURI:
|
|
|
|
case DataTypeClass::QName:
|
|
|
|
case DataTypeClass::NOTATION:
|
|
|
|
nNumberFormatType = NumberFormat::TEXT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get the number formatter from the introspectee
|
|
|
|
Reference< XNumberFormatsSupplier > xSupplier;
|
|
|
|
Reference< XNumberFormatTypes > xFormatTypes;
|
|
|
|
OSL_VERIFY( m_xControlModel->getPropertyValue( PROPERTY_FORMATSSUPPLIER ) >>= xSupplier );
|
|
|
|
if ( xSupplier.is() )
|
|
|
|
xFormatTypes = xFormatTypes.query( xSupplier->getNumberFormats() );
|
|
|
|
OSL_ENSURE( xFormatTypes.is(), "XSDValidationHelper::findDefaultFormatForIntrospectee: no number formats for the introspectee!" );
|
|
|
|
if ( !xFormatTypes.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
// and the standard format for the given NumberFormat type
|
|
|
|
sal_Int32 nDesiredFormat = xFormatTypes->getStandardFormat( nNumberFormatType, SvtSysLocale().GetLocaleData().getLocale() );
|
|
|
|
|
|
|
|
// set this at the introspectee
|
|
|
|
m_xControlModel->setPropertyValue( PROPERTY_FORMATKEY, makeAny( nDesiredFormat ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::findDefaultFormatForIntrospectee: caught an exception!" );
|
2005-03-23 04:59:24 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-11-16 05:14:16 -06:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
::rtl::OUString XSDValidationHelper::getBasicTypeNameForClass( sal_Int16 _nClass ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
return getBasicTypeNameForClass( _nClass, getDataTypeRepository() );
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
::rtl::OUString XSDValidationHelper::getBasicTypeNameForClass( sal_Int16 _nClass, Reference< XDataTypeRepository > _rxRepository ) const SAL_THROW(())
|
|
|
|
{
|
|
|
|
::rtl::OUString sReturn;
|
|
|
|
OSL_ENSURE( _rxRepository.is(), "XSDValidationHelper::getBasicTypeNameForClass: invalid repository!" );
|
|
|
|
if ( !_rxRepository.is() )
|
|
|
|
return sReturn;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XDataType > xDataType = _rxRepository->getBasicDataType( _nClass );
|
|
|
|
OSL_ENSURE( xDataType.is(), "XSDValidationHelper::getBasicTypeNameForClass: invalid data type returned!" );
|
|
|
|
if ( xDataType.is() )
|
|
|
|
sReturn = xDataType->getName();
|
|
|
|
}
|
|
|
|
catch( const Exception& )
|
|
|
|
{
|
2011-03-19 08:06:18 -05:00
|
|
|
OSL_FAIL( "XSDValidationHelper::getBasicTypeNameForClass: caught an exception!" );
|
2004-11-16 05:14:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return sReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
} // namespace pcr
|
|
|
|
//........................................................................
|
|
|
|
|
2010-10-12 08:57:08 -05:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|