loplugin:flatten in ucbhelper
Change-Id: Ic5a8ce908671bd492395bff01aa211b8bdd74ca7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100008 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
186c34af5d
commit
c82dae439e
7 changed files with 339 additions and 339 deletions
|
@ -1314,21 +1314,21 @@ css::uno::Any SAL_CALL ContentEventListener_Impl::queryInterface( const css::uno
|
|||
// virtual
|
||||
void SAL_CALL ContentEventListener_Impl::contentEvent( const ContentEvent& evt )
|
||||
{
|
||||
if ( evt.Source == m_rContent.m_xContent )
|
||||
if ( evt.Source != m_rContent.m_xContent )
|
||||
return;
|
||||
|
||||
switch ( evt.Action )
|
||||
{
|
||||
switch ( evt.Action )
|
||||
{
|
||||
case ContentAction::DELETED:
|
||||
m_rContent.reinit( Reference< XContent >() );
|
||||
break;
|
||||
case ContentAction::DELETED:
|
||||
m_rContent.reinit( Reference< XContent >() );
|
||||
break;
|
||||
|
||||
case ContentAction::EXCHANGED:
|
||||
m_rContent.reinit( evt.Content );
|
||||
break;
|
||||
case ContentAction::EXCHANGED:
|
||||
m_rContent.reinit( evt.Content );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -819,104 +819,104 @@ void InternetProxyDecider_Impl::setNoProxyList(
|
|||
|
||||
m_aNoProxyList.clear();
|
||||
|
||||
if ( !rNoProxyList.isEmpty() )
|
||||
if ( rNoProxyList.isEmpty() )
|
||||
return;
|
||||
|
||||
// List of connection endpoints hostname[:port],
|
||||
// separated by semicolon. Wildcards allowed.
|
||||
|
||||
sal_Int32 nPos = 0;
|
||||
sal_Int32 nEnd = rNoProxyList.indexOf( ';' );
|
||||
sal_Int32 nLen = rNoProxyList.getLength();
|
||||
|
||||
do
|
||||
{
|
||||
// List of connection endpoints hostname[:port],
|
||||
// separated by semicolon. Wildcards allowed.
|
||||
if ( nEnd == -1 )
|
||||
nEnd = nLen;
|
||||
|
||||
sal_Int32 nPos = 0;
|
||||
sal_Int32 nEnd = rNoProxyList.indexOf( ';' );
|
||||
sal_Int32 nLen = rNoProxyList.getLength();
|
||||
OUString aToken = rNoProxyList.copy( nPos, nEnd - nPos );
|
||||
|
||||
do
|
||||
if ( !aToken.isEmpty() )
|
||||
{
|
||||
if ( nEnd == -1 )
|
||||
nEnd = nLen;
|
||||
OUString aServer;
|
||||
OUString aPort;
|
||||
|
||||
OUString aToken = rNoProxyList.copy( nPos, nEnd - nPos );
|
||||
// numerical IPv6 address?
|
||||
bool bIPv6Address = false;
|
||||
sal_Int32 nClosedBracketPos = aToken.indexOf( ']' );
|
||||
if ( nClosedBracketPos == -1 )
|
||||
nClosedBracketPos = 0;
|
||||
else
|
||||
bIPv6Address = true;
|
||||
|
||||
if ( !aToken.isEmpty() )
|
||||
sal_Int32 nColonPos = aToken.indexOf( ':', nClosedBracketPos );
|
||||
if ( nColonPos == -1 )
|
||||
{
|
||||
OUString aServer;
|
||||
OUString aPort;
|
||||
|
||||
// numerical IPv6 address?
|
||||
bool bIPv6Address = false;
|
||||
sal_Int32 nClosedBracketPos = aToken.indexOf( ']' );
|
||||
if ( nClosedBracketPos == -1 )
|
||||
nClosedBracketPos = 0;
|
||||
else
|
||||
bIPv6Address = true;
|
||||
|
||||
sal_Int32 nColonPos = aToken.indexOf( ':', nClosedBracketPos );
|
||||
if ( nColonPos == -1 )
|
||||
// No port given, server pattern equals current token
|
||||
aPort = "*";
|
||||
if ( aToken.indexOf( '*' ) == -1 )
|
||||
{
|
||||
// No port given, server pattern equals current token
|
||||
aPort = "*";
|
||||
if ( aToken.indexOf( '*' ) == -1 )
|
||||
{
|
||||
// pattern describes exactly one server
|
||||
aServer = aToken;
|
||||
}
|
||||
|
||||
aToken += ":*";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Port given, extract server pattern
|
||||
sal_Int32 nAsteriskPos = aToken.indexOf( '*' );
|
||||
aPort = aToken.copy( nColonPos + 1 );
|
||||
if ( nAsteriskPos < nColonPos )
|
||||
{
|
||||
// pattern describes exactly one server
|
||||
aServer = aToken.copy( 0, nColonPos );
|
||||
}
|
||||
// pattern describes exactly one server
|
||||
aServer = aToken;
|
||||
}
|
||||
|
||||
OUStringBuffer aFullyQualifiedHost;
|
||||
if ( !aServer.isEmpty() )
|
||||
aToken += ":*";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Port given, extract server pattern
|
||||
sal_Int32 nAsteriskPos = aToken.indexOf( '*' );
|
||||
aPort = aToken.copy( nColonPos + 1 );
|
||||
if ( nAsteriskPos < nColonPos )
|
||||
{
|
||||
// Remember fully qualified server name if current list
|
||||
// entry specifies exactly one non-fully qualified server
|
||||
// name.
|
||||
// pattern describes exactly one server
|
||||
aServer = aToken.copy( 0, nColonPos );
|
||||
}
|
||||
}
|
||||
|
||||
// remove square brackets from host name in case it's
|
||||
// a numerical IPv6 address.
|
||||
OUStringBuffer aFullyQualifiedHost;
|
||||
if ( !aServer.isEmpty() )
|
||||
{
|
||||
// Remember fully qualified server name if current list
|
||||
// entry specifies exactly one non-fully qualified server
|
||||
// name.
|
||||
|
||||
// remove square brackets from host name in case it's
|
||||
// a numerical IPv6 address.
|
||||
if ( bIPv6Address )
|
||||
aServer = aServer.copy( 1, aServer.getLength() - 2 );
|
||||
|
||||
// This might be quite expensive (DNS lookup).
|
||||
const osl::SocketAddr aAddr( aServer, 0 );
|
||||
OUString aTmp = aAddr.getHostname().toAsciiLowerCase();
|
||||
if ( aTmp != aServer.toAsciiLowerCase() )
|
||||
{
|
||||
if ( bIPv6Address )
|
||||
aServer = aServer.copy( 1, aServer.getLength() - 2 );
|
||||
|
||||
// This might be quite expensive (DNS lookup).
|
||||
const osl::SocketAddr aAddr( aServer, 0 );
|
||||
OUString aTmp = aAddr.getHostname().toAsciiLowerCase();
|
||||
if ( aTmp != aServer.toAsciiLowerCase() )
|
||||
{
|
||||
if ( bIPv6Address )
|
||||
{
|
||||
aFullyQualifiedHost.append( "[" );
|
||||
aFullyQualifiedHost.append( aTmp );
|
||||
aFullyQualifiedHost.append( "]" );
|
||||
}
|
||||
else
|
||||
{
|
||||
aFullyQualifiedHost.append( aTmp );
|
||||
}
|
||||
aFullyQualifiedHost.append( ":" );
|
||||
aFullyQualifiedHost.append( aPort );
|
||||
aFullyQualifiedHost.append( "[" );
|
||||
aFullyQualifiedHost.append( aTmp );
|
||||
aFullyQualifiedHost.append( "]" );
|
||||
}
|
||||
else
|
||||
{
|
||||
aFullyQualifiedHost.append( aTmp );
|
||||
}
|
||||
aFullyQualifiedHost.append( ":" );
|
||||
aFullyQualifiedHost.append( aPort );
|
||||
}
|
||||
|
||||
m_aNoProxyList.emplace_back( WildCard( aToken ),
|
||||
WildCard( aFullyQualifiedHost.makeStringAndClear() ) );
|
||||
}
|
||||
|
||||
if ( nEnd != nLen )
|
||||
{
|
||||
nPos = nEnd + 1;
|
||||
nEnd = rNoProxyList.indexOf( ';', nPos );
|
||||
}
|
||||
m_aNoProxyList.emplace_back( WildCard( aToken ),
|
||||
WildCard( aFullyQualifiedHost.makeStringAndClear() ) );
|
||||
}
|
||||
|
||||
if ( nEnd != nLen )
|
||||
{
|
||||
nPos = nEnd + 1;
|
||||
nEnd = rNoProxyList.indexOf( ';', nPos );
|
||||
}
|
||||
while ( nEnd != nLen );
|
||||
}
|
||||
while ( nEnd != nLen );
|
||||
}
|
||||
|
||||
} // namespace proxydecider_impl
|
||||
|
|
|
@ -402,60 +402,60 @@ void SAL_CALL ContentImplHelper::addProperty(
|
|||
OSL_ENSURE( xSet.is(),
|
||||
"ContentImplHelper::addProperty - No property set!" );
|
||||
|
||||
if ( xSet.is() )
|
||||
if ( !xSet.is() )
|
||||
return;
|
||||
|
||||
uno::Reference< beans::XPropertyContainer > xContainer(
|
||||
xSet, uno::UNO_QUERY );
|
||||
|
||||
OSL_ENSURE(
|
||||
xContainer.is(),
|
||||
"ContentImplHelper::addProperty - No property container!" );
|
||||
|
||||
if ( !xContainer.is() )
|
||||
return;
|
||||
|
||||
// Property is always removable.
|
||||
Attributes |= beans::PropertyAttribute::REMOVABLE;
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< beans::XPropertyContainer > xContainer(
|
||||
xSet, uno::UNO_QUERY );
|
||||
xContainer->addProperty( Name, Attributes, DefaultValue );
|
||||
}
|
||||
catch ( beans::PropertyExistException const & )
|
||||
{
|
||||
OSL_FAIL( "ContentImplHelper::addProperty - Exists!" );
|
||||
throw;
|
||||
}
|
||||
catch ( beans::IllegalTypeException const & )
|
||||
{
|
||||
OSL_FAIL( "ContentImplHelper::addProperty - Wrong Type!" );
|
||||
throw;
|
||||
}
|
||||
catch ( lang::IllegalArgumentException const & )
|
||||
{
|
||||
OSL_FAIL( "ContentImplHelper::addProperty - Illegal Arg!" );
|
||||
throw;
|
||||
}
|
||||
|
||||
OSL_ENSURE(
|
||||
xContainer.is(),
|
||||
"ContentImplHelper::addProperty - No property container!" );
|
||||
// Success!
|
||||
|
||||
if ( xContainer.is() )
|
||||
{
|
||||
// Property is always removable.
|
||||
Attributes |= beans::PropertyAttribute::REMOVABLE;
|
||||
if ( m_pImpl->m_xPropSetInfo.is() )
|
||||
{
|
||||
// Info cached in propertyset info is invalid now!
|
||||
m_pImpl->m_xPropSetInfo->reset();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
xContainer->addProperty( Name, Attributes, DefaultValue );
|
||||
}
|
||||
catch ( beans::PropertyExistException const & )
|
||||
{
|
||||
OSL_FAIL( "ContentImplHelper::addProperty - Exists!" );
|
||||
throw;
|
||||
}
|
||||
catch ( beans::IllegalTypeException const & )
|
||||
{
|
||||
OSL_FAIL( "ContentImplHelper::addProperty - Wrong Type!" );
|
||||
throw;
|
||||
}
|
||||
catch ( lang::IllegalArgumentException const & )
|
||||
{
|
||||
OSL_FAIL( "ContentImplHelper::addProperty - Illegal Arg!" );
|
||||
throw;
|
||||
}
|
||||
|
||||
// Success!
|
||||
|
||||
if ( m_pImpl->m_xPropSetInfo.is() )
|
||||
{
|
||||
// Info cached in propertyset info is invalid now!
|
||||
m_pImpl->m_xPropSetInfo->reset();
|
||||
}
|
||||
|
||||
// Notify propertyset info change listeners.
|
||||
if ( m_pImpl->m_pPropSetChangeListeners &&
|
||||
m_pImpl->m_pPropSetChangeListeners->getLength() )
|
||||
{
|
||||
beans::PropertySetInfoChangeEvent evt(
|
||||
static_cast< cppu::OWeakObject * >( this ),
|
||||
Name,
|
||||
-1, // No handle available
|
||||
beans::PropertySetInfoChange::PROPERTY_INSERTED );
|
||||
notifyPropertySetInfoChange( evt );
|
||||
}
|
||||
}
|
||||
// Notify propertyset info change listeners.
|
||||
if ( m_pImpl->m_pPropSetChangeListeners &&
|
||||
m_pImpl->m_pPropSetChangeListeners->getLength() )
|
||||
{
|
||||
beans::PropertySetInfoChangeEvent evt(
|
||||
static_cast< cppu::OWeakObject * >( this ),
|
||||
Name,
|
||||
-1, // No handle available
|
||||
beans::PropertySetInfoChange::PROPERTY_INSERTED );
|
||||
notifyPropertySetInfoChange( evt );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,69 +490,69 @@ void SAL_CALL ContentImplHelper::removeProperty( const OUString& Name )
|
|||
// Open persistent property set, if exists.
|
||||
uno::Reference< css::ucb::XPersistentPropertySet > xSet(
|
||||
getAdditionalPropertySet( false ) );
|
||||
if ( xSet.is() )
|
||||
if ( !xSet.is() )
|
||||
return;
|
||||
|
||||
uno::Reference< beans::XPropertyContainer > xContainer(
|
||||
xSet, uno::UNO_QUERY );
|
||||
|
||||
OSL_ENSURE(
|
||||
xContainer.is(),
|
||||
"ContentImplHelper::removeProperty - No property container!" );
|
||||
|
||||
if ( !xContainer.is() )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
uno::Reference< beans::XPropertyContainer > xContainer(
|
||||
xSet, uno::UNO_QUERY );
|
||||
xContainer->removeProperty( Name );
|
||||
}
|
||||
catch ( beans::UnknownPropertyException const & )
|
||||
{
|
||||
OSL_FAIL( "ContentImplHelper::removeProperty - Unknown!" );
|
||||
throw;
|
||||
}
|
||||
catch ( beans::NotRemoveableException const & )
|
||||
{
|
||||
OSL_FAIL(
|
||||
"ContentImplHelper::removeProperty - Unremovable!" );
|
||||
throw;
|
||||
}
|
||||
|
||||
OSL_ENSURE(
|
||||
xContainer.is(),
|
||||
"ContentImplHelper::removeProperty - No property container!" );
|
||||
xContainer = nullptr;
|
||||
|
||||
if ( xContainer.is() )
|
||||
// Success!
|
||||
|
||||
if ( !xSet->getPropertySetInfo()->getProperties().hasElements() )
|
||||
{
|
||||
// Remove empty propertyset from registry.
|
||||
uno::Reference< css::ucb::XPropertySetRegistry >
|
||||
xReg = xSet->getRegistry();
|
||||
if ( xReg.is() )
|
||||
{
|
||||
try
|
||||
{
|
||||
xContainer->removeProperty( Name );
|
||||
}
|
||||
catch ( beans::UnknownPropertyException const & )
|
||||
{
|
||||
OSL_FAIL( "ContentImplHelper::removeProperty - Unknown!" );
|
||||
throw;
|
||||
}
|
||||
catch ( beans::NotRemoveableException const & )
|
||||
{
|
||||
OSL_FAIL(
|
||||
"ContentImplHelper::removeProperty - Unremovable!" );
|
||||
throw;
|
||||
}
|
||||
|
||||
xContainer = nullptr;
|
||||
|
||||
// Success!
|
||||
|
||||
if ( !xSet->getPropertySetInfo()->getProperties().hasElements() )
|
||||
{
|
||||
// Remove empty propertyset from registry.
|
||||
uno::Reference< css::ucb::XPropertySetRegistry >
|
||||
xReg = xSet->getRegistry();
|
||||
if ( xReg.is() )
|
||||
{
|
||||
OUString aKey( xSet->getKey() );
|
||||
xSet = nullptr;
|
||||
xReg->removePropertySet( aKey );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_pImpl->m_xPropSetInfo.is() )
|
||||
{
|
||||
// Info cached in propertyset info is invalid now!
|
||||
m_pImpl->m_xPropSetInfo->reset();
|
||||
}
|
||||
|
||||
// Notify propertyset info change listeners.
|
||||
if ( m_pImpl->m_pPropSetChangeListeners &&
|
||||
m_pImpl->m_pPropSetChangeListeners->getLength() )
|
||||
{
|
||||
beans::PropertySetInfoChangeEvent evt(
|
||||
static_cast< cppu::OWeakObject * >( this ),
|
||||
Name,
|
||||
-1, // No handle available
|
||||
beans::PropertySetInfoChange::PROPERTY_REMOVED );
|
||||
notifyPropertySetInfoChange( evt );
|
||||
}
|
||||
OUString aKey( xSet->getKey() );
|
||||
xSet = nullptr;
|
||||
xReg->removePropertySet( aKey );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_pImpl->m_xPropSetInfo.is() )
|
||||
{
|
||||
// Info cached in propertyset info is invalid now!
|
||||
m_pImpl->m_xPropSetInfo->reset();
|
||||
}
|
||||
|
||||
// Notify propertyset info change listeners.
|
||||
if ( m_pImpl->m_pPropSetChangeListeners &&
|
||||
m_pImpl->m_pPropSetChangeListeners->getLength() )
|
||||
{
|
||||
beans::PropertySetInfoChangeEvent evt(
|
||||
static_cast< cppu::OWeakObject * >( this ),
|
||||
Name,
|
||||
-1, // No handle available
|
||||
beans::PropertySetInfoChange::PROPERTY_REMOVED );
|
||||
notifyPropertySetInfoChange( evt );
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
@ -644,75 +644,75 @@ void ContentImplHelper::notifyPropertiesChange(
|
|||
return;
|
||||
|
||||
sal_Int32 nCount = evt.getLength();
|
||||
if ( nCount )
|
||||
if ( !nCount )
|
||||
return;
|
||||
|
||||
// First, notify listeners interested in changes of every property.
|
||||
cppu::OInterfaceContainerHelper* pAllPropsContainer
|
||||
= m_pImpl->m_pPropertyChangeListeners->getContainer(
|
||||
OUString() );
|
||||
if ( pAllPropsContainer )
|
||||
{
|
||||
// First, notify listeners interested in changes of every property.
|
||||
cppu::OInterfaceContainerHelper* pAllPropsContainer
|
||||
= m_pImpl->m_pPropertyChangeListeners->getContainer(
|
||||
OUString() );
|
||||
if ( pAllPropsContainer )
|
||||
cppu::OInterfaceIteratorHelper aIter( *pAllPropsContainer );
|
||||
while ( aIter.hasMoreElements() )
|
||||
{
|
||||
cppu::OInterfaceIteratorHelper aIter( *pAllPropsContainer );
|
||||
// Propagate event.
|
||||
uno::Reference< beans::XPropertiesChangeListener > xListener(
|
||||
aIter.next(), uno::UNO_QUERY );
|
||||
if ( xListener.is() )
|
||||
xListener->propertiesChange( evt );
|
||||
}
|
||||
}
|
||||
|
||||
PropertiesEventListenerMap aListeners;
|
||||
|
||||
for ( const beans::PropertyChangeEvent& rEvent : evt )
|
||||
{
|
||||
const OUString& rName = rEvent.PropertyName;
|
||||
|
||||
cppu::OInterfaceContainerHelper* pPropsContainer
|
||||
= m_pImpl->m_pPropertyChangeListeners->getContainer( rName );
|
||||
if ( pPropsContainer )
|
||||
{
|
||||
cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
|
||||
while ( aIter.hasMoreElements() )
|
||||
{
|
||||
// Propagate event.
|
||||
uno::Reference< beans::XPropertiesChangeListener > xListener(
|
||||
aIter.next(), uno::UNO_QUERY );
|
||||
if ( xListener.is() )
|
||||
xListener->propertiesChange( evt );
|
||||
}
|
||||
}
|
||||
PropertyEventSequence* p = nullptr;
|
||||
|
||||
PropertiesEventListenerMap aListeners;
|
||||
|
||||
for ( const beans::PropertyChangeEvent& rEvent : evt )
|
||||
{
|
||||
const OUString& rName = rEvent.PropertyName;
|
||||
|
||||
cppu::OInterfaceContainerHelper* pPropsContainer
|
||||
= m_pImpl->m_pPropertyChangeListeners->getContainer( rName );
|
||||
if ( pPropsContainer )
|
||||
{
|
||||
cppu::OInterfaceIteratorHelper aIter( *pPropsContainer );
|
||||
while ( aIter.hasMoreElements() )
|
||||
beans::XPropertiesChangeListener* pListener =
|
||||
static_cast< beans::XPropertiesChangeListener * >(
|
||||
aIter.next() );
|
||||
PropertiesEventListenerMap::iterator it =
|
||||
aListeners.find( pListener );
|
||||
if ( it == aListeners.end() )
|
||||
{
|
||||
PropertyEventSequence* p = nullptr;
|
||||
|
||||
beans::XPropertiesChangeListener* pListener =
|
||||
static_cast< beans::XPropertiesChangeListener * >(
|
||||
aIter.next() );
|
||||
PropertiesEventListenerMap::iterator it =
|
||||
aListeners.find( pListener );
|
||||
if ( it == aListeners.end() )
|
||||
{
|
||||
// Not in map - create and insert new entry.
|
||||
p = &aListeners.emplace( pListener, PropertyEventSequence(nCount)).first->second;
|
||||
}
|
||||
else
|
||||
p = &it->second;
|
||||
|
||||
if ( p )
|
||||
p->append( rEvent );
|
||||
// Not in map - create and insert new entry.
|
||||
p = &aListeners.emplace( pListener, PropertyEventSequence(nCount)).first->second;
|
||||
}
|
||||
else
|
||||
p = &it->second;
|
||||
|
||||
if ( p )
|
||||
p->append( rEvent );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Notify listeners.
|
||||
PropertiesEventListenerMap::iterator it = aListeners.begin();
|
||||
while ( !aListeners.empty() )
|
||||
{
|
||||
beans::XPropertiesChangeListener* pListener =
|
||||
static_cast< beans::XPropertiesChangeListener * >( (*it).first );
|
||||
PropertyEventSequence pSeq = std::move(it->second);
|
||||
// Notify listeners.
|
||||
PropertiesEventListenerMap::iterator it = aListeners.begin();
|
||||
while ( !aListeners.empty() )
|
||||
{
|
||||
beans::XPropertiesChangeListener* pListener =
|
||||
static_cast< beans::XPropertiesChangeListener * >( (*it).first );
|
||||
PropertyEventSequence pSeq = std::move(it->second);
|
||||
|
||||
// Remove current element.
|
||||
aListeners.erase( it );
|
||||
// Remove current element.
|
||||
aListeners.erase( it );
|
||||
|
||||
// Propagate event.
|
||||
pListener->propertiesChange( pSeq.getEvents() );
|
||||
// Propagate event.
|
||||
pListener->propertiesChange( pSeq.getEvents() );
|
||||
|
||||
it = aListeners.begin();
|
||||
}
|
||||
it = aListeners.begin();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -604,53 +604,53 @@ void PropertyValueSet::appendVoid( const OUString& rPropName )
|
|||
void PropertyValueSet::appendPropertySet(
|
||||
const Reference< XPropertySet >& rxSet )
|
||||
{
|
||||
if ( rxSet.is() )
|
||||
if ( !rxSet.is() )
|
||||
return;
|
||||
|
||||
Reference< XPropertySetInfo > xInfo = rxSet->getPropertySetInfo();
|
||||
if ( !xInfo.is() )
|
||||
return;
|
||||
|
||||
const Sequence< Property > aProps = xInfo->getProperties();
|
||||
|
||||
Reference< XPropertyAccess > xPropertyAccess( rxSet, UNO_QUERY );
|
||||
if ( xPropertyAccess.is() )
|
||||
{
|
||||
Reference< XPropertySetInfo > xInfo = rxSet->getPropertySetInfo();
|
||||
if ( xInfo.is() )
|
||||
// Efficient: Get all prop values with one ( remote) call.
|
||||
|
||||
const Sequence< css::beans::PropertyValue > aPropValues
|
||||
= xPropertyAccess->getPropertyValues();
|
||||
|
||||
for ( const css::beans::PropertyValue& rPropValue : aPropValues )
|
||||
{
|
||||
const Sequence< Property > aProps = xInfo->getProperties();
|
||||
|
||||
Reference< XPropertyAccess > xPropertyAccess( rxSet, UNO_QUERY );
|
||||
if ( xPropertyAccess.is() )
|
||||
// Find info for current property value.
|
||||
auto pProp = std::find_if(aProps.begin(), aProps.end(),
|
||||
[&rPropValue](const Property& rProp) { return rProp.Name == rPropValue.Name; });
|
||||
if (pProp != aProps.end())
|
||||
{
|
||||
// Efficient: Get all prop values with one ( remote) call.
|
||||
|
||||
const Sequence< css::beans::PropertyValue > aPropValues
|
||||
= xPropertyAccess->getPropertyValues();
|
||||
|
||||
for ( const css::beans::PropertyValue& rPropValue : aPropValues )
|
||||
{
|
||||
// Find info for current property value.
|
||||
auto pProp = std::find_if(aProps.begin(), aProps.end(),
|
||||
[&rPropValue](const Property& rProp) { return rProp.Name == rPropValue.Name; });
|
||||
if (pProp != aProps.end())
|
||||
{
|
||||
// Found!
|
||||
appendObject( *pProp, rPropValue.Value );
|
||||
}
|
||||
}
|
||||
// Found!
|
||||
appendObject( *pProp, rPropValue.Value );
|
||||
}
|
||||
else
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get every single prop value with one ( remote) call.
|
||||
|
||||
for ( const Property& rProp : aProps )
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get every single prop value with one ( remote) call.
|
||||
Any aValue = rxSet->getPropertyValue( rProp.Name );
|
||||
|
||||
for ( const Property& rProp : aProps )
|
||||
{
|
||||
try
|
||||
{
|
||||
Any aValue = rxSet->getPropertyValue( rProp.Name );
|
||||
|
||||
if ( aValue.hasValue() )
|
||||
appendObject( rProp, aValue );
|
||||
}
|
||||
catch (const UnknownPropertyException&)
|
||||
{
|
||||
}
|
||||
catch (const WrappedTargetException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
if ( aValue.hasValue() )
|
||||
appendObject( rProp, aValue );
|
||||
}
|
||||
catch (const UnknownPropertyException&)
|
||||
{
|
||||
}
|
||||
catch (const WrappedTargetException&)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,19 +181,19 @@ void ContentProviderImplHelper::queryExistingContents(
|
|||
void ContentProviderImplHelper::registerNewContent(
|
||||
const uno::Reference< ucb::XContent > & xContent )
|
||||
{
|
||||
if ( xContent.is() )
|
||||
{
|
||||
osl::MutexGuard aGuard( m_aMutex );
|
||||
if ( !xContent.is() )
|
||||
return;
|
||||
|
||||
cleanupRegisteredContents();
|
||||
osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
const OUString aURL(
|
||||
xContent->getIdentifier()->getContentIdentifier() );
|
||||
ucbhelper_impl::Contents::const_iterator it
|
||||
= m_pImpl->m_aContents.find( aURL );
|
||||
if ( it == m_pImpl->m_aContents.end() )
|
||||
m_pImpl->m_aContents[ aURL ] = xContent;
|
||||
}
|
||||
cleanupRegisteredContents();
|
||||
|
||||
const OUString aURL(
|
||||
xContent->getIdentifier()->getContentIdentifier() );
|
||||
ucbhelper_impl::Contents::const_iterator it
|
||||
= m_pImpl->m_aContents.find( aURL );
|
||||
if ( it == m_pImpl->m_aContents.end() )
|
||||
m_pImpl->m_aContents[ aURL ] = xContent;
|
||||
}
|
||||
|
||||
uno::Reference< css::ucb::XPropertySetRegistry >
|
||||
|
|
|
@ -1404,22 +1404,22 @@ PropertySetInfo::PropertySetInfo(
|
|||
: m_pProps( new uno::Sequence< beans::Property >( nProps ) )
|
||||
{
|
||||
|
||||
if ( nProps )
|
||||
if ( !nProps )
|
||||
return;
|
||||
|
||||
const PropertyInfo* pEntry = pProps;
|
||||
beans::Property* pProperties = m_pProps->getArray();
|
||||
|
||||
for ( sal_Int32 n = 0; n < nProps; ++n )
|
||||
{
|
||||
const PropertyInfo* pEntry = pProps;
|
||||
beans::Property* pProperties = m_pProps->getArray();
|
||||
beans::Property& rProp = pProperties[ n ];
|
||||
|
||||
for ( sal_Int32 n = 0; n < nProps; ++n )
|
||||
{
|
||||
beans::Property& rProp = pProperties[ n ];
|
||||
rProp.Name = OUString::createFromAscii( pEntry->pName );
|
||||
rProp.Handle = pEntry->nHandle;
|
||||
rProp.Type = pEntry->pGetCppuType();
|
||||
rProp.Attributes = pEntry->nAttributes;
|
||||
|
||||
rProp.Name = OUString::createFromAscii( pEntry->pName );
|
||||
rProp.Handle = pEntry->nHandle;
|
||||
rProp.Type = pEntry->pGetCppuType();
|
||||
rProp.Attributes = pEntry->nAttributes;
|
||||
|
||||
pEntry++;
|
||||
}
|
||||
pEntry++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -231,30 +231,30 @@ void ResultSetImplHelper::init( bool bStatic )
|
|||
{
|
||||
osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
if ( !m_bInitDone )
|
||||
if ( m_bInitDone )
|
||||
return;
|
||||
|
||||
if ( bStatic )
|
||||
{
|
||||
if ( bStatic )
|
||||
{
|
||||
// virtual... derived class fills m_xResultSet1
|
||||
initStatic();
|
||||
// virtual... derived class fills m_xResultSet1
|
||||
initStatic();
|
||||
|
||||
OSL_ENSURE( m_xResultSet1.is(),
|
||||
"ResultSetImplHelper::init - No 1st result set!" );
|
||||
m_bStatic = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// virtual... derived class fills m_xResultSet1 and m_xResultSet2
|
||||
initDynamic();
|
||||
|
||||
OSL_ENSURE( m_xResultSet1.is(),
|
||||
"ResultSetImplHelper::init - No 1st result set!" );
|
||||
OSL_ENSURE( m_xResultSet2.is(),
|
||||
"ResultSetImplHelper::init - No 2nd result set!" );
|
||||
m_bStatic = false;
|
||||
}
|
||||
m_bInitDone = true;
|
||||
OSL_ENSURE( m_xResultSet1.is(),
|
||||
"ResultSetImplHelper::init - No 1st result set!" );
|
||||
m_bStatic = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// virtual... derived class fills m_xResultSet1 and m_xResultSet2
|
||||
initDynamic();
|
||||
|
||||
OSL_ENSURE( m_xResultSet1.is(),
|
||||
"ResultSetImplHelper::init - No 1st result set!" );
|
||||
OSL_ENSURE( m_xResultSet2.is(),
|
||||
"ResultSetImplHelper::init - No 2nd result set!" );
|
||||
m_bStatic = false;
|
||||
}
|
||||
m_bInitDone = true;
|
||||
}
|
||||
|
||||
} // namespace ucbhelper
|
||||
|
|
Loading…
Reference in a new issue