diff options
Diffstat (limited to 'fpicker/source/win32/FilterContainer.cxx')
-rw-r--r-- | fpicker/source/win32/FilterContainer.cxx | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/fpicker/source/win32/FilterContainer.cxx b/fpicker/source/win32/FilterContainer.cxx index a9a85f3ca48e..4fabed1460e4 100644 --- a/fpicker/source/win32/FilterContainer.cxx +++ b/fpicker/source/win32/FilterContainer.cxx @@ -99,33 +99,36 @@ void CFilterContainer::empty() // Precondition: the container is not empty // there is a filter identified by the name -bool CFilterContainer::getFilter( const OUString& aName, OUString& theFilter ) const +bool CFilterContainer::getFilterByName(const OUString& aName, OUString& theFilter) const { OSL_PRECOND( !m_vFilters.empty() , "Empty filter container" ); + return getFilterByIndex(getFilterTagPos(aName), theFilter); +} - sal_Int32 pos = getFilterTagPos( aName ); +bool CFilterContainer::getFilterByIndex(sal_Int32 aIndex, OUString& theFilter) const +{ + bool bRet = true; try { - if ( pos > -1 ) - theFilter = m_vFilters.at( pos ).second; + theFilter = m_vFilters.at(aIndex).second; } - catch( std::out_of_range& ) + catch (std::out_of_range&) { - OSL_FAIL( "Filter not in filter container" ); - pos = -1; + OSL_FAIL("Filter index out of range"); + bRet = false; } - return pos > -1; + return bRet; } -bool CFilterContainer::getFilter( sal_Int32 aIndex, OUString& theFilter ) const +bool CFilterContainer::getFilterNameByIndex(sal_Int32 aIndex, OUString& theName) const { bool bRet = true; try { - theFilter = m_vFilters.at( aIndex ).first; + theName = m_vFilters.at(aIndex).first; } catch( std::out_of_range& ) { |