From 660fe83b4357c9fa070739b9c4da9d9002c9bd51 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 5 Sep 2013 14:56:08 +0200 Subject: use sensible indentation that always annoyed me Change-Id: I0c439ddb00d78590b465cd47db6e60d1939bd9f7 --- i18npool/source/indexentry/indexentrysupplier.cxx | 162 +++++++++++----------- 1 file changed, 81 insertions(+), 81 deletions(-) (limited to 'i18npool/source/indexentry/indexentrysupplier.cxx') diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx index e832dc8ca7dd..6a4ef3b4b4ff 100644 --- a/i18npool/source/indexentry/indexentrysupplier.cxx +++ b/i18npool/source/indexentry/indexentrysupplier.cxx @@ -33,144 +33,144 @@ IndexEntrySupplier::IndexEntrySupplier( const Reference < XComponentContext >& r Sequence < Locale > SAL_CALL IndexEntrySupplier::getLocaleList() throw (RuntimeException) { - return LocaleDataImpl().getAllInstalledLocaleNames(); + return LocaleDataImpl().getAllInstalledLocaleNames(); } Sequence < OUString > SAL_CALL IndexEntrySupplier::getAlgorithmList( const Locale& rLocale ) throw (RuntimeException) { - return LocaleDataImpl().getIndexAlgorithm(rLocale); + return LocaleDataImpl().getIndexAlgorithm(rLocale); } sal_Bool SAL_CALL IndexEntrySupplier::loadAlgorithm( const Locale& rLocale, const OUString& SortAlgorithm, sal_Int32 collatorOptions ) throw (RuntimeException) { - Sequence < OUString > algorithmList = getAlgorithmList( rLocale ); - for (sal_Int32 i = 0; i < algorithmList.getLength(); i++) { - if (algorithmList[i] == SortAlgorithm) { - if (getLocaleSpecificIndexEntrySupplier(rLocale, SortAlgorithm).is()) - return xIES->loadAlgorithm(rLocale, SortAlgorithm, collatorOptions); - } + Sequence < OUString > algorithmList = getAlgorithmList( rLocale ); + for (sal_Int32 i = 0; i < algorithmList.getLength(); i++) { + if (algorithmList[i] == SortAlgorithm) { + if (getLocaleSpecificIndexEntrySupplier(rLocale, SortAlgorithm).is()) + return xIES->loadAlgorithm(rLocale, SortAlgorithm, collatorOptions); } - return sal_False; + } + return sal_False; } sal_Bool SAL_CALL IndexEntrySupplier::usePhoneticEntry( const Locale& rLocale ) throw (RuntimeException) { - return LocaleDataImpl().hasPhonetic(rLocale); + return LocaleDataImpl().hasPhonetic(rLocale); } OUString SAL_CALL IndexEntrySupplier::getPhoneticCandidate( const OUString& rIndexEntry, const Locale& rLocale ) throw (RuntimeException) { - if (getLocaleSpecificIndexEntrySupplier(rLocale, OUString()).is()) - return xIES->getPhoneticCandidate(rIndexEntry, rLocale); - else - throw RuntimeException(); + if (getLocaleSpecificIndexEntrySupplier(rLocale, OUString()).is()) + return xIES->getPhoneticCandidate(rIndexEntry, rLocale); + else + throw RuntimeException(); } OUString SAL_CALL IndexEntrySupplier::getIndexKey( const OUString& rIndexEntry, const OUString& rPhoneticEntry, const Locale& rLocale ) throw (RuntimeException) { - if (xIES.is()) - return xIES->getIndexKey(rIndexEntry, rPhoneticEntry, rLocale); - else - throw RuntimeException(); + if (xIES.is()) + return xIES->getIndexKey(rIndexEntry, rPhoneticEntry, rLocale); + else + throw RuntimeException(); } sal_Int16 SAL_CALL IndexEntrySupplier::compareIndexEntry( const OUString& rIndexEntry1, const OUString& rPhoneticEntry1, const Locale& rLocale1, const OUString& rIndexEntry2, const OUString& rPhoneticEntry2, const Locale& rLocale2 ) - throw (com::sun::star::uno::RuntimeException) +throw (com::sun::star::uno::RuntimeException) { - if (xIES.is()) - return xIES->compareIndexEntry(rIndexEntry1, rPhoneticEntry1, rLocale1, - rIndexEntry2, rPhoneticEntry2, rLocale2); - else - throw RuntimeException(); + if (xIES.is()) + return xIES->compareIndexEntry(rIndexEntry1, rPhoneticEntry1, rLocale1, + rIndexEntry2, rPhoneticEntry2, rLocale2); + else + throw RuntimeException(); } OUString SAL_CALL IndexEntrySupplier::getIndexCharacter( const OUString& rIndexEntry, const Locale& rLocale, const OUString& rSortAlgorithm ) - throw (RuntimeException) +throw (RuntimeException) { - return getLocaleSpecificIndexEntrySupplier(rLocale, rSortAlgorithm)-> - getIndexCharacter( rIndexEntry, rLocale, rSortAlgorithm ); + return getLocaleSpecificIndexEntrySupplier(rLocale, rSortAlgorithm)-> + getIndexCharacter( rIndexEntry, rLocale, rSortAlgorithm ); } sal_Bool SAL_CALL IndexEntrySupplier::createLocaleSpecificIndexEntrySupplier(const OUString& name) throw( RuntimeException ) { - Reference < XInterface > xI = m_xContext->getServiceManager()->createInstanceWithContext( + Reference < XInterface > xI = m_xContext->getServiceManager()->createInstanceWithContext( OUString("com.sun.star.i18n.IndexEntrySupplier_") + name, m_xContext); - if ( xI.is() ) { - xIES.set( xI, UNO_QUERY ); - return xIES.is(); - } - return sal_False; + if ( xI.is() ) { + xIES.set( xI, UNO_QUERY ); + return xIES.is(); + } + return sal_False; } Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > SAL_CALL IndexEntrySupplier::getLocaleSpecificIndexEntrySupplier(const Locale& rLocale, const OUString& rSortAlgorithm) throw (RuntimeException) { - if (xIES.is() && rSortAlgorithm == aSortAlgorithm && rLocale.Language == aLocale.Language && - rLocale.Country == aLocale.Country && rLocale.Variant == aLocale.Variant) + if (xIES.is() && rSortAlgorithm == aSortAlgorithm && rLocale.Language == aLocale.Language && + rLocale.Country == aLocale.Country && rLocale.Variant == aLocale.Variant) + return xIES; + else { + LocaleDataImpl ld; + aLocale = rLocale; + if (rSortAlgorithm.isEmpty()) + aSortAlgorithm = ld.getDefaultIndexAlgorithm( rLocale ); + else + aSortAlgorithm = rSortAlgorithm; + + OUString module = ld.getIndexModuleByAlgorithm(rLocale, aSortAlgorithm); + if (!module.isEmpty() && createLocaleSpecificIndexEntrySupplier(module)) return xIES; - else { - LocaleDataImpl ld; - aLocale = rLocale; - if (rSortAlgorithm.isEmpty()) - aSortAlgorithm = ld.getDefaultIndexAlgorithm( rLocale ); - else - aSortAlgorithm = rSortAlgorithm; - - OUString module = ld.getIndexModuleByAlgorithm(rLocale, aSortAlgorithm); - if (!module.isEmpty() && createLocaleSpecificIndexEntrySupplier(module)) - return xIES; - - bool bLoaded = false; - if (!aSortAlgorithm.isEmpty()) + + bool bLoaded = false; + if (!aSortAlgorithm.isEmpty()) + { + // Load service with name ___ + // or __ and fallbacks. + bLoaded = createLocaleSpecificIndexEntrySupplier( + LocaleDataImpl::getFirstLocaleServiceName( rLocale) + "_" + aSortAlgorithm); + if (!bLoaded) { - // Load service with name ___ - // or __ and fallbacks. - bLoaded = createLocaleSpecificIndexEntrySupplier( - LocaleDataImpl::getFirstLocaleServiceName( rLocale) + "_" + aSortAlgorithm); + ::std::vector< OUString > aFallbacks( LocaleDataImpl::getFallbackLocaleServiceNames( rLocale)); + for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it) + { + bLoaded = createLocaleSpecificIndexEntrySupplier( *it + "_" + aSortAlgorithm); + if (bLoaded) + break; + } if (!bLoaded) { - ::std::vector< OUString > aFallbacks( LocaleDataImpl::getFallbackLocaleServiceNames( rLocale)); - for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it) - { - bLoaded = createLocaleSpecificIndexEntrySupplier( *it + "_" + aSortAlgorithm); - if (bLoaded) - break; - } - if (!bLoaded) - { - // load service with name _ - bLoaded = createLocaleSpecificIndexEntrySupplier( aSortAlgorithm); - } + // load service with name _ + bLoaded = createLocaleSpecificIndexEntrySupplier( aSortAlgorithm); } } + } + if (!bLoaded) + { + // load default service with name _Unicode + bLoaded = createLocaleSpecificIndexEntrySupplier( "Unicode"); if (!bLoaded) { - // load default service with name _Unicode - bLoaded = createLocaleSpecificIndexEntrySupplier( "Unicode"); - if (!bLoaded) - { - throw RuntimeException(); // could not load any service - } + throw RuntimeException(); // could not load any service } - return xIES; } + return xIES; + } } OUString SAL_CALL IndexEntrySupplier::getIndexFollowPageWord( sal_Bool bMorePages, const Locale& rLocale ) throw (RuntimeException) { - Sequence< OUString > aFollowPageWords = LocaleDataImpl().getFollowPageWords(rLocale); + Sequence< OUString > aFollowPageWords = LocaleDataImpl().getFollowPageWords(rLocale); - return (bMorePages && aFollowPageWords.getLength() > 1) ? - aFollowPageWords[1] : (aFollowPageWords.getLength() > 0 ? - aFollowPageWords[0] : OUString()); + return (bMorePages && aFollowPageWords.getLength() > 1) ? + aFollowPageWords[1] : (aFollowPageWords.getLength() > 0 ? + aFollowPageWords[0] : OUString()); } #define implementationName "com.sun.star.i18n.IndexEntrySupplier" @@ -178,21 +178,21 @@ OUString SAL_CALL IndexEntrySupplier::getIndexFollowPageWord( sal_Bool bMorePage OUString SAL_CALL IndexEntrySupplier::getImplementationName() throw( RuntimeException ) { - return OUString::createFromAscii( implementationName ); + return OUString::createFromAscii( implementationName ); } sal_Bool SAL_CALL IndexEntrySupplier::supportsService(const OUString& rServiceName) throw( RuntimeException ) { - return rServiceName.compareToAscii(implementationName) == 0; + return rServiceName.compareToAscii(implementationName) == 0; } Sequence< OUString > SAL_CALL IndexEntrySupplier::getSupportedServiceNames() throw( RuntimeException ) { - Sequence< OUString > aRet(1); - aRet[0] = OUString::createFromAscii( implementationName ); - return aRet; + Sequence< OUString > aRet(1); + aRet[0] = OUString::createFromAscii( implementationName ); + return aRet; } } } } } -- cgit