using ::com::sun::star::uno::Reference; using ::com::sun::star::report::XFormattedField; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::sdb::XSingleSelectQueryComposer; using ::com::sun::star::sdbcx::XColumnsSupplier; using ::com::sun::star::container::XIndexAccess; using ::com::sun::star::beans::XPropertySet; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Exception; using ::com::sun::star::sdb::XParametersSupplier; using ::com::sun::star::sdbc::SQLException; using ::com::sun::star::util::XNumberFormatsSupplier; using ::com::sun::star::util::XNumberFormatTypes;
OSL_PRECOND( m_xReportDefinition.is(), "FormatNormalizer::impl_ensureUpToDateFieldList_nothrow: no report definition!" ); if ( !m_xReportDefinition.is() ) returnfalse;
::dbaui::DBSubComponentController* pController( m_rModel.getController() );
OSL_ENSURE( pController, "FormatNormalizer::impl_ensureUpToDateFieldList_nothrow: no controller? how can *this* happen?!" ); if ( !pController ) returnfalse;
Reference< XParametersSupplier > xSuppParams( xComposer, UNO_QUERY_THROW );
Reference< XIndexAccess > xParams( xSuppParams->getParameters(), css::uno::UNO_SET_THROW );
lcl_collectFields_throw( xParams, m_aFields );
} catch( const SQLException& )
{ // silence it. This might happen for instance when the user sets a non-existent table, // or things like this
} catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("reportdesign");
}
m_bFieldListDirty = false; returntrue;
}
void FormatNormalizer::impl_adjustFormatToDataFieldType_nothrow( const Reference< XFormattedField >& _rxFormatted )
{ if ( !impl_ensureUpToDateFieldList_nothrow() ) // unable to obtain a recent field list return;
try
{
sal_Int32 nFormatKey = _rxFormatted->getFormatKey(); if ( nFormatKey != 0 ) // it's not the "standard numeric" format -> not interested in return;
OUString sDataField( _rxFormatted->getDataField() ); static constexpr OUString sFieldPrefix( u"field:["_ustr ); if ( sDataField.indexOf( sFieldPrefix ) != 0 ) // not bound to a table field // TODO: we might also do this kind of thing for functions and expressions ... return; if ( !sDataField.endsWith("]") )
{ // last character is not the closing brace
OSL_FAIL( "FormatNormalizer::impl_adjustFormatToDataFieldType_nothrow: suspicious data field value!" ); return;
}
sDataField = sDataField.copy( sFieldPrefix.getLength(), sDataField.getLength() - sFieldPrefix.getLength() - 1 );
FieldList::const_iterator field = std::find_if(m_aFields.begin(), m_aFields.end(),
[&sDataField](const Field& rField) { return rField.sName == sDataField; }); if ( field == m_aFields.end() ) // unknown field return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.