diff options
author | Oliver Bolte <obo@openoffice.org> | 2008-02-27 09:31:07 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2008-02-27 09:31:07 +0000 |
commit | a90c5fa073903bb79880cd96dde9018c4cc4abe5 (patch) | |
tree | 879dd23f1eab66bb2829bd9c114fd88bd10386ca /xmlhelp | |
parent | fbf7c0ad62001993a6409f0f4d835907070d6f39 (diff) |
INTEGRATION: CWS ab46_DEV300 (1.49.18); FILE MERGED
2008/02/21 11:41:50 ab 1.49.18.1: #i84550# Caching help related information about extensions
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 86 |
1 files changed, 53 insertions, 33 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 35ccee5195df..a177c9071606 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -4,9 +4,9 @@ * * $RCSfile: databases.cxx,v $ * - * $Revision: 1.50 $ + * $Revision: 1.51 $ * - * last change: $Author: ihi $ $Date: 2008-02-04 13:55:27 $ + * last change: $Author: obo $ $Date: 2008-02-27 10:31:07 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1316,18 +1316,23 @@ void Databases::setActiveText( const rtl::OUString& Module, DataBaseIterator aDbIt( m_xContext, *this, Module, Language, true ); bool bSuccess = false; + // #i84550 Cache information about failed ids + rtl::OString id( Id.getStr(),Id.getLength(),RTL_TEXTENCODING_UTF8 ); + EmptyActiveTextSet::iterator it = m_aEmptyActiveTextSet.find( id ); + bool bFoundAsEmpty = ( it != m_aEmptyActiveTextSet.end() ); Dbt data; - Db* db; - while( (db = aDbIt.nextDb()) != NULL ) + if( !bFoundAsEmpty ) { - rtl::OString id( Id.getStr(),Id.getLength(),RTL_TEXTENCODING_UTF8 ); + Db* db; Dbt key( static_cast< void* >( const_cast< sal_Char* >( id.getStr() ) ),id.getLength() ); - - int err = db->get( 0, &key, &data, 0 ); - if( err == 0 ) + while( (db = aDbIt.nextDb()) != NULL ) { - bSuccess = true; - break; + int err = db->get( 0, &key, &data, 0 ); + if( err == 0 ) + { + bSuccess = true; + break; + } } } @@ -1361,6 +1366,8 @@ void Databases::setActiveText( const rtl::OUString& Module, { *byteCount = 0; *buffer = new char[0]; + if( !bFoundAsEmpty ) + m_aEmptyActiveTextSet.insert( id ); } } @@ -1384,6 +1391,8 @@ void Databases::setInstallPath( const rtl::OUString& aInstDir ) //=================================================================== // class ExtensionIteratorBase +ExtensionHelpExistanceMap ExtensionIteratorBase::aHelpExistanceMap; + ExtensionIteratorBase::ExtensionIteratorBase( Reference< XComponentContext > xContext, Databases& rDatabases, const rtl::OUString& aInitialModule, const rtl::OUString& aLanguage ) : m_xContext( xContext ) @@ -1456,6 +1465,14 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromP if( !xPackage.is() ) return xHelpPackage; + // #i84550 Cache information about help content in extension + rtl::OUString aExtensionPath = xPackage->getURL(); + ExtensionHelpExistanceMap::iterator it = aHelpExistanceMap.find( aExtensionPath ); + bool bFound = ( it != aHelpExistanceMap.end() ); + bool bHasHelp = bFound ? it->second : false; + if( bFound && !bHasHelp ) + return xHelpPackage; + // Check if parent package is registered beans::Optional< beans::Ambiguous<sal_Bool> > option( xPackage->isRegistered ( Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>() ) ); @@ -1466,35 +1483,38 @@ Reference< deployment::XPackage > ExtensionIteratorBase::implGetHelpPackageFromP if( !reg.IsAmbiguous && reg.Value ) bRegistered = true; } - if( !bRegistered ) - return xHelpPackage; - - if( xPackage->isBundle() ) + if( bRegistered ) { - Sequence< Reference< deployment::XPackage > > aPkgSeq = xPackage->getBundle - ( Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>() ); - sal_Int32 nPkgCount = aPkgSeq.getLength(); - const Reference< deployment::XPackage >* pSeq = aPkgSeq.getConstArray(); - for( sal_Int32 iPkg = 0 ; iPkg < nPkgCount ; ++iPkg ) + if( xPackage->isBundle() ) { - const Reference< deployment::XPackage > xSubPkg = pSeq[ iPkg ]; - const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xSubPkg->getPackageType(); - rtl::OUString aMediaType = xPackageTypeInfo->getMediaType(); - if( aMediaType.equals( aHelpMediaType ) ) + Sequence< Reference< deployment::XPackage > > aPkgSeq = xPackage->getBundle + ( Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>() ); + sal_Int32 nPkgCount = aPkgSeq.getLength(); + const Reference< deployment::XPackage >* pSeq = aPkgSeq.getConstArray(); + for( sal_Int32 iPkg = 0 ; iPkg < nPkgCount ; ++iPkg ) { - xHelpPackage = xSubPkg; - o_xParentPackageBundle = xPackage; - break; + const Reference< deployment::XPackage > xSubPkg = pSeq[ iPkg ]; + const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xSubPkg->getPackageType(); + rtl::OUString aMediaType = xPackageTypeInfo->getMediaType(); + if( aMediaType.equals( aHelpMediaType ) ) + { + xHelpPackage = xSubPkg; + o_xParentPackageBundle = xPackage; + break; + } } } + else + { + const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xPackage->getPackageType(); + rtl::OUString aMediaType = xPackageTypeInfo->getMediaType(); + if( aMediaType.equals( aHelpMediaType ) ) + xHelpPackage = xPackage; + } } - else - { - const Reference< deployment::XPackageTypeInfo > xPackageTypeInfo = xPackage->getPackageType(); - rtl::OUString aMediaType = xPackageTypeInfo->getMediaType(); - if( aMediaType.equals( aHelpMediaType ) ) - xHelpPackage = xPackage; - } + + if( !bFound ) + aHelpExistanceMap[ aExtensionPath ] = xHelpPackage.is(); return xHelpPackage; } |