Kaydet (Commit) 4af6c094 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:flatten in filter..i18npool

Change-Id: I9024b8b614a4de83a4d927e1918f6d4904a7fccb
Reviewed-on: https://gerrit.libreoffice.org/42592Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7b45044f
......@@ -527,15 +527,8 @@ namespace XSLT
// wait for the transformer to finish
m_cTransformed.wait();
m_tcontrol->terminate();
if (!m_bError && !m_bTerminated)
{
return;
}
else
{
throw RuntimeException();
}
if (m_bError || m_bTerminated)
throw RuntimeException();
}
......
......@@ -477,16 +477,13 @@ void SAL_CALL Submission::submitWithInteraction(
*this, makeAny( e ) );
}
if( bResult )
{
mxModel->rebuild();
}
else
if( !bResult )
{
// other failure: throw wrapped target exception, too.
throw WrappedTargetException(
lcl_message( sID, OUString() ), *this, Any() );
}
mxModel->rebuild();
}
void SAL_CALL Submission::submit( )
......
......@@ -98,16 +98,13 @@ OUString XMLNamespaces::applyNSToAttributeName( const OUString& aName ) const
int index;
if (( index = aName.indexOf( ':' )) > 0 )
{
if ( aName.getLength() > index+1 )
{
OUString aAttributeName = getNamespaceValue( aName.copy( 0, index )) + "^" + aName.copy( index+1);
return aAttributeName;
}
else
if ( aName.getLength() <= index+1 )
{
// attribute with namespace but without name "namespace:" is not allowed!!
throw SAXException( "Attribute has no name only preceding namespace!", Reference< XInterface >(), Any() );
}
OUString aAttributeName = getNamespaceValue( aName.copy( 0, index )) + "^" + aName.copy( index+1);
return aAttributeName;
}
return aName;
......@@ -135,13 +132,12 @@ OUString XMLNamespaces::applyNSToElementName( const OUString& aName ) const
if ( index > 0 )
{
if ( aName.getLength() > index+1 )
aElementName += aName.copy( index+1 );
else
if ( aName.getLength() <= index+1 )
{
// attribute with namespace but without a name is not allowed (e.g. "cfg:" )
throw SAXException( "Attribute has no name only preceding namespace!", Reference< XInterface >(), Any() );
}
aElementName += aName.copy( index+1 );
}
else
aElementName += aName;
......@@ -157,13 +153,12 @@ OUString XMLNamespaces::getNamespaceValue( const OUString& aNamespace ) const
{
NamespaceMap::const_iterator p;
p = m_aNamespaceMap.find( aNamespace );
if ( p != m_aNamespaceMap.end() )
return p->second;
else
if ( p == m_aNamespaceMap.end() )
{
// namespace not defined => throw exception!
throw SAXException( "XML namespace used but not defined!", Reference< XInterface >(), Any() );
}
return p->second;
}
}
......
......@@ -204,10 +204,9 @@ sal_Int32 SAL_CALL ConstItemContainer::getCount()
Any SAL_CALL ConstItemContainer::getByIndex( sal_Int32 Index )
{
if ( sal_Int32( m_aItemVector.size()) > Index )
return makeAny( m_aItemVector[Index] );
else
if ( sal_Int32( m_aItemVector.size()) <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
return makeAny( m_aItemVector[Index] );
}
// XPropertySet
......
......@@ -156,14 +156,13 @@ void SAL_CALL ContextChangeEventMultiplexer::addContextChangeEventListener (
if (pFocusDescriptor != nullptr)
{
ListenerContainer& rContainer (pFocusDescriptor->maListeners);
if (::std::find(rContainer.begin(), rContainer.end(), rxListener) == rContainer.end())
rContainer.push_back(rxListener);
else
if (::std::find(rContainer.begin(), rContainer.end(), rxListener) != rContainer.end())
{
// The listener was added for the same event focus
// previously. That is an error.
throw cssl::IllegalArgumentException("listener added twice", static_cast<XWeak*>(this), 0);
}
rContainer.push_back(rxListener);
}
// Send out an initial event that informs the new listener about
......
......@@ -590,15 +590,12 @@ OUString const & SubstitutePathVariables::impl_getSubstituteVariableValue( const
VarNameToIndexMap::const_iterator pNTOIIter = m_aPreDefVarMap.find( ( nPos == -1 ) ? aVariable : rVariable );
// Fixed/Predefined variable
if ( pNTOIIter != m_aPreDefVarMap.end() )
{
PreDefVariable nIndex = pNTOIIter->second;
return m_aPreDefVars.m_FixedVar[(sal_Int32)nIndex];
}
else
if ( pNTOIIter == m_aPreDefVarMap.end() )
{
throw NoSuchElementException("Unknown variable!", static_cast<cppu::OWeakObject *>(this));
}
PreDefVariable nIndex = pNTOIIter->second;
return m_aPreDefVars.m_FixedVar[(sal_Int32)nIndex];
}
void SubstitutePathVariables::SetPredefinedPathVariables()
......
......@@ -43,10 +43,9 @@ void GraphicNameAccess::addElement( const OUString& rName, const uno::Reference<
uno::Any SAL_CALL GraphicNameAccess::getByName( const OUString& aName )
{
NameGraphicHashMap::const_iterator pIter = m_aNameToElementMap.find( aName );
if ( pIter != m_aNameToElementMap.end() )
return uno::makeAny( pIter->second );
else
if ( pIter == m_aNameToElementMap.end() )
throw container::NoSuchElementException();
return uno::makeAny( pIter->second );
}
uno::Sequence< OUString > SAL_CALL GraphicNameAccess::getElementNames()
......
......@@ -957,44 +957,41 @@ void SAL_CALL UIConfigurationManager::replaceSettings( const OUString& ResourceU
throw DisposedException();
UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
if ( pDataSettings && !pDataSettings->bDefault )
{
// we have a settings entry in our user-defined layer - replace
Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings;
if ( !pDataSettings || pDataSettings->bDefault )
throw NoSuchElementException();
// we have a settings entry in our user-defined layer - replace
Reference< XIndexAccess > xOldSettings = pDataSettings->xSettings;
// Create a copy of the data if the container is not const
Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
if ( xReplace.is() )
pDataSettings->xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
else
pDataSettings->xSettings = aNewData;
// Create a copy of the data if the container is not const
Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY );
if ( xReplace.is() )
pDataSettings->xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY );
else
pDataSettings->xSettings = aNewData;
pDataSettings->bDefault = false;
pDataSettings->bModified = true;
m_bModified = true;
pDataSettings->bDefault = false;
pDataSettings->bModified = true;
m_bModified = true;
// Modify type container
UIElementType& rElementType = m_aUIElements[nElementType];
rElementType.bModified = true;
// Modify type container
UIElementType& rElementType = m_aUIElements[nElementType];
rElementType.bModified = true;
Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
Reference< XInterface > xIfac( xThis, UNO_QUERY );
Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
Reference< XInterface > xIfac( xThis, UNO_QUERY );
// Create event to notify listener about replaced element settings
ConfigurationEvent aEvent;
// Create event to notify listener about replaced element settings
ConfigurationEvent aEvent;
aEvent.ResourceURL = ResourceURL;
aEvent.Accessor <<= xThis;
aEvent.Source = xIfac;
aEvent.ReplacedElement <<= xOldSettings;
aEvent.Element <<= pDataSettings->xSettings;
aEvent.ResourceURL = ResourceURL;
aEvent.Accessor <<= xThis;
aEvent.Source = xIfac;
aEvent.ReplacedElement <<= xOldSettings;
aEvent.Element <<= pDataSettings->xSettings;
aGuard.clear();
aGuard.clear();
implts_notifyContainerListener( aEvent, NotifyOp_Replace );
}
else
throw NoSuchElementException();
implts_notifyContainerListener( aEvent, NotifyOp_Replace );
}
}
......@@ -1020,44 +1017,41 @@ void SAL_CALL UIConfigurationManager::removeSettings( const OUString& ResourceUR
"ResourceURL: " + ResourceURL, nullptr );
UIElementData* pDataSettings = impl_findUIElementData( ResourceURL, nElementType );
if ( pDataSettings )
if ( !pDataSettings )
throw NoSuchElementException( "The settings data cannot be found. "
"ResourceURL: " + ResourceURL, nullptr);
// If element settings are default, we don't need to change anything!
if ( pDataSettings->bDefault )
return;
else
{
// If element settings are default, we don't need to change anything!
if ( pDataSettings->bDefault )
return;
else
{
Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings;
pDataSettings->bDefault = true;
Reference< XIndexAccess > xRemovedSettings = pDataSettings->xSettings;
pDataSettings->bDefault = true;
// check if this is a default layer node
pDataSettings->bModified = true; // we have to remove this node from the user layer!
pDataSettings->xSettings.clear();
m_bModified = true; // user layer must be written
// check if this is a default layer node
pDataSettings->bModified = true; // we have to remove this node from the user layer!
pDataSettings->xSettings.clear();
m_bModified = true; // user layer must be written
// Modify type container
UIElementType& rElementType = m_aUIElements[nElementType];
rElementType.bModified = true;
// Modify type container
UIElementType& rElementType = m_aUIElements[nElementType];
rElementType.bModified = true;
Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
Reference< XInterface > xIfac( xThis, UNO_QUERY );
Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
Reference< XInterface > xIfac( xThis, UNO_QUERY );
// Create event to notify listener about removed element settings
ConfigurationEvent aEvent;
// Create event to notify listener about removed element settings
ConfigurationEvent aEvent;
aEvent.ResourceURL = ResourceURL;
aEvent.Accessor <<= xThis;
aEvent.Source = xIfac;
aEvent.Element <<= xRemovedSettings;
aEvent.ResourceURL = ResourceURL;
aEvent.Accessor <<= xThis;
aEvent.Source = xIfac;
aEvent.Element <<= xRemovedSettings;
aGuard.clear();
aGuard.clear();
implts_notifyContainerListener( aEvent, NotifyOp_Remove );
}
implts_notifyContainerListener( aEvent, NotifyOp_Remove );
}
else
throw NoSuchElementException( "The settings data cannot be found. "
"ResourceURL: " + ResourceURL, nullptr);
}
}
......
......@@ -179,12 +179,11 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Local
throw uno::RuntimeException();
}
}
if (icuBI->aBreakIterator) {
icuBI->maLocale=rLocale;
bNewBreak=true;
} else {
if (!icuBI->aBreakIterator) {
throw uno::RuntimeException();
}
icuBI->maLocale=rLocale;
bNewBreak=true;
}
if (bNewBreak || icuBI->aICUText.pData != rText.pData)
......
......@@ -83,10 +83,9 @@ CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale )
}
}
if ( xI.is() )
xCalendar.set(xI, UNO_QUERY);
else
if ( !xI.is() )
throw ERROR;
xCalendar.set(xI, UNO_QUERY);
lookupTable.push_back( new lookupTableItem(uniqueID, xCalendar) );
}
......@@ -111,19 +110,17 @@ CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale )
Calendar2 SAL_CALL
CalendarImpl::getLoadedCalendar2()
{
if (xCalendar.is())
return xCalendar->getLoadedCalendar2();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getLoadedCalendar2();
}
Calendar SAL_CALL
CalendarImpl::getLoadedCalendar()
{
if (xCalendar.is())
return xCalendar->getLoadedCalendar();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getLoadedCalendar();
}
Sequence< OUString > SAL_CALL
......@@ -140,217 +137,194 @@ CalendarImpl::getAllCalendars( const Locale& rLocale )
void SAL_CALL
CalendarImpl::setDateTime( double fTimeInDays )
{
if (xCalendar.is())
xCalendar->setDateTime( fTimeInDays );
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
xCalendar->setDateTime( fTimeInDays );
}
double SAL_CALL
CalendarImpl::getDateTime()
{
if (xCalendar.is())
return xCalendar->getDateTime();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getDateTime();
}
void SAL_CALL
CalendarImpl::setLocalDateTime( double fTimeInDays )
{
if (xCalendar.is())
xCalendar->setLocalDateTime( fTimeInDays );
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
xCalendar->setLocalDateTime( fTimeInDays );
}
double SAL_CALL
CalendarImpl::getLocalDateTime()
{
if (xCalendar.is())
return xCalendar->getLocalDateTime();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getLocalDateTime();
}
OUString SAL_CALL
CalendarImpl::getUniqueID()
{
if (xCalendar.is())
return xCalendar->getUniqueID();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getUniqueID();
}
void SAL_CALL
CalendarImpl::setValue( sal_Int16 fieldIndex, sal_Int16 value )
{
if (xCalendar.is())
xCalendar->setValue( fieldIndex, value );
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
xCalendar->setValue( fieldIndex, value );
}
sal_Int16 SAL_CALL
CalendarImpl::getValue( sal_Int16 fieldIndex )
{
if (xCalendar.is())
return xCalendar->getValue( fieldIndex );
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getValue( fieldIndex );
}
void SAL_CALL
CalendarImpl::addValue( sal_Int16 fieldIndex, sal_Int32 amount )
{
if (xCalendar.is())
xCalendar->addValue( fieldIndex, amount);
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
xCalendar->addValue( fieldIndex, amount);
}
sal_Int16 SAL_CALL
CalendarImpl::getFirstDayOfWeek()
{
if (xCalendar.is())
return xCalendar->getFirstDayOfWeek();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getFirstDayOfWeek();
}
void SAL_CALL
CalendarImpl::setFirstDayOfWeek( sal_Int16 day )
{
if (xCalendar.is())
xCalendar->setFirstDayOfWeek(day);
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR ; xCalendar->setFirstDayOfWeek(day);
}
void SAL_CALL
CalendarImpl::setMinimumNumberOfDaysForFirstWeek( sal_Int16 days )
{
if (xCalendar.is())
xCalendar->setMinimumNumberOfDaysForFirstWeek(days);
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
xCalendar->setMinimumNumberOfDaysForFirstWeek(days);
}
sal_Int16 SAL_CALL
CalendarImpl::getMinimumNumberOfDaysForFirstWeek()
{
if (xCalendar.is())
return xCalendar->getMinimumNumberOfDaysForFirstWeek();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getMinimumNumberOfDaysForFirstWeek();
}
OUString SAL_CALL
CalendarImpl::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 nameType )
{
if (xCalendar.is())
return xCalendar->getDisplayName( displayIndex, idx, nameType );
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getDisplayName( displayIndex, idx, nameType );
}
sal_Int16 SAL_CALL
CalendarImpl::getNumberOfMonthsInYear()
{
if (xCalendar.is())
return xCalendar->getNumberOfMonthsInYear();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR ; return xCalendar->getNumberOfMonthsInYear();
}
sal_Int16 SAL_CALL
CalendarImpl::getNumberOfDaysInWeek()
{
if (xCalendar.is())
return xCalendar->getNumberOfDaysInWeek();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getNumberOfDaysInWeek();
}
Sequence< CalendarItem > SAL_CALL
CalendarImpl::getDays()
{
if (xCalendar.is())
return xCalendar->getDays();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getDays();
}
Sequence< CalendarItem > SAL_CALL
CalendarImpl::getMonths()
{
if (xCalendar.is())
return xCalendar->getMonths();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR ; return xCalendar->getMonths();
}
Sequence< CalendarItem2 > SAL_CALL
CalendarImpl::getDays2()
{
if (xCalendar.is())
return xCalendar->getDays2();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getDays2();
}
Sequence< CalendarItem2 > SAL_CALL
CalendarImpl::getMonths2()
{
if (xCalendar.is())
return xCalendar->getMonths2();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getMonths2();
}
Sequence< CalendarItem2 > SAL_CALL
CalendarImpl::getGenitiveMonths2()
{
if (xCalendar.is())
return xCalendar->getGenitiveMonths2();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getGenitiveMonths2();
}
Sequence< CalendarItem2 > SAL_CALL
CalendarImpl::getPartitiveMonths2()
{
if (xCalendar.is())
return xCalendar->getPartitiveMonths2();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getPartitiveMonths2();
}
sal_Bool SAL_CALL
CalendarImpl::isValid()
{
if (xCalendar.is())
return xCalendar->isValid();
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->isValid();
}
OUString SAL_CALL
CalendarImpl::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode )
{
if (xCalendar.is())
return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode);
else
throw ERROR ;
if (!xCalendar.is())
throw ERROR;
return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode);
}
OUString SAL_CALL
......
......@@ -88,10 +88,9 @@ CollatorImpl::loadCollatorAlgorithm(const OUString& impl, const lang::Locale& rL
if (! cachedItem || ! cachedItem->equals(rLocale, impl))
loadCachedCollator(rLocale, impl);
if (cachedItem)
cachedItem->xC->loadCollatorAlgorithm(cachedItem->algorithm, nLocale = rLocale, collatorOptions);
else
if (!cachedItem)
throw RuntimeException(); // impl could not be loaded
cachedItem->xC->loadCollatorAlgorithm(cachedItem->algorithm, nLocale = rLocale, collatorOptions);
return 0;
}
......
......@@ -63,30 +63,27 @@ sal_Bool SAL_CALL IndexEntrySupplier::usePhoneticEntry( const Locale& rLocale )
OUString SAL_CALL IndexEntrySupplier::getPhoneticCandidate( const OUString& rIndexEntry,
const Locale& rLocale )
{
if (getLocaleSpecificIndexEntrySupplier(rLocale, OUString()).is())
return xIES->getPhoneticCandidate(rIndexEntry, rLocale);
else
if (!getLocaleSpecificIndexEntrySupplier(rLocale, OUString()).is())
throw RuntimeException();
return xIES->getPhoneticCandidate(rIndexEntry, rLocale);
}
OUString SAL_CALL IndexEntrySupplier::getIndexKey( const OUString& rIndexEntry,
const OUString& rPhoneticEntry, const Locale& rLocale )
{
if (xIES.is())
return xIES->getIndexKey(rIndexEntry, rPhoneticEntry, rLocale);
else
if (!xIES.is())
throw RuntimeException();
return xIES->getIndexKey(rIndexEntry, rPhoneticEntry, rLocale);
}
sal_Int16 SAL_CALL IndexEntrySupplier::compareIndexEntry(
const OUString& rIndexEntry1, const OUString& rPhoneticEntry1, const Locale& rLocale1,
const OUString& rIndexEntry2, const OUString& rPhoneticEntry2, const Locale& rLocale2 )
{
if (xIES.is())
return xIES->compareIndexEntry(rIndexEntry1, rPhoneticEntry1, rLocale1,
rIndexEntry2, rPhoneticEntry2, rLocale2);
else
if (!xIES.is())
throw RuntimeException();
return xIES->compareIndexEntry(rIndexEntry1, rPhoneticEntry1, rLocale1,
rIndexEntry2, rPhoneticEntry2, rLocale2);
}
OUString SAL_CALL IndexEntrySupplier::getIndexCharacter( const OUString& rIndexEntry,
......
......@@ -633,10 +633,9 @@ Sequence< CalendarItem2 > &LocaleDataImpl::getCalendarItemByName(const OUString&
// Referred locale not found, return name for en_US locale.
if (index == cals.getLength()) {
cals = getAllCalend