diff --git a/xmlhelp/prj/build.lst b/xmlhelp/prj/build.lst index b360e5f763ee..08b320d8302c 100644 --- a/xmlhelp/prj/build.lst +++ b/xmlhelp/prj/build.lst @@ -1,4 +1,4 @@ -xh xmlhelp : ucbhelper LIBXSLT:libxslt unoil BERKELEYDB:berkeleydb svtools LUCENE:lucene unotools javaunohelper NULL +xh xmlhelp : ucbhelper LIBXSLT:libxslt unoil BERKELEYDB:berkeleydb LUCENE:lucene unotools javaunohelper NULL xh xmlhelp usr1 - all xh_mkout NULL xh xmlhelp\inc nmake - all xh_inc NULL xh xmlhelp\source\treeview nmake - all xh_treeview xh_inc NULL diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 8130e5f38bd2..618596a11c0b 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -40,7 +40,6 @@ #include #include #include -#include #include "inputstream.hxx" #include #include @@ -52,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -261,43 +261,72 @@ static bool impl_getZipFile( return false; } -rtl::OString Databases::getImagesZipFileURL() -{ - sal_Int16 nSymbolsStyle = SvtMiscOptions().GetCurrentSymbolsStyle(); - if ( !m_aImagesZipFileURL.getLength() || ( m_nSymbolsStyle != nSymbolsStyle ) ) - { - m_nSymbolsStyle = nSymbolsStyle; - - rtl::OUString aImageZip; - rtl::OUString aSymbolsStyleName = SvtMiscOptions().GetCurrentSymbolsStyleName(); - bool bFound = false; - - if ( aSymbolsStyleName.getLength() != 0 ) - { - rtl::OUString aZipName = rtl::OUString::createFromAscii( "images_" ); - aZipName += aSymbolsStyleName; - aZipName += rtl::OUString::createFromAscii( ".zip" ); - - bFound = impl_getZipFile( m_aImagesZipPaths, aZipName, aImageZip ); - } - - if ( ! bFound ) - bFound = impl_getZipFile( m_aImagesZipPaths, rtl::OUString::createFromAscii( "images.zip" ), aImageZip ); - - if ( ! bFound ) - aImageZip = rtl::OUString(); - - m_aImagesZipFileURL = rtl::OUStringToOString( - rtl::Uri::encode( - aImageZip, - rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ), RTL_TEXTENCODING_UTF8 ); - } - - return m_aImagesZipFileURL; -} - +rtl::OString Databases::getImagesZipFileURL() +{ + //sal_Int16 nSymbolsStyle = SvtMiscOptions().GetCurrentSymbolsStyle(); + sal_Int16 nSymbolsStyle = 0; + try + { + uno::Reference< lang::XMultiServiceFactory > xConfigProvider( + m_xSMgr ->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"), m_xContext), uno::UNO_QUERY_THROW); + + // set root path + uno::Sequence < uno::Any > lParams(1); + beans::PropertyValue aParam ; + aParam.Name = ::rtl::OUString::createFromAscii("nodepath"); + aParam.Value <<= ::rtl::OUString::createFromAscii("org.openoffice.Office.Common"); + lParams[0] = uno::makeAny(aParam); + + // open it + uno::Reference< uno::XInterface > xCFG( xConfigProvider->createInstanceWithArguments( + ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationAccess"), + lParams) ); + + bool bChanged = false; + uno::Reference< container::XHierarchicalNameAccess > xAccess(xCFG, uno::UNO_QUERY_THROW); + uno::Any aResult = xAccess->getByHierarchicalName(::rtl::OUString::createFromAscii("Misc/SymbolSet")); + if ( (aResult >>= nSymbolsStyle) && m_nSymbolsStyle != nSymbolsStyle ) + { + m_nSymbolsStyle = nSymbolsStyle; + bChanged = true; + } + + if ( !m_aImagesZipFileURL.getLength() || bChanged ) + { + rtl::OUString aImageZip, aSymbolsStyleName; + aResult = xAccess->getByHierarchicalName(::rtl::OUString::createFromAscii("Misc/SymbolStyle")); + aResult >>= aSymbolsStyleName; + + bool bFound = false; + if ( aSymbolsStyleName.getLength() != 0 ) + { + rtl::OUString aZipName = rtl::OUString::createFromAscii( "images_" ); + aZipName += aSymbolsStyleName; + aZipName += rtl::OUString::createFromAscii( ".zip" ); + + bFound = impl_getZipFile( m_aImagesZipPaths, aZipName, aImageZip ); + } + + if ( ! bFound ) + bFound = impl_getZipFile( m_aImagesZipPaths, rtl::OUString::createFromAscii( "images.zip" ), aImageZip ); + + if ( ! bFound ) + aImageZip = rtl::OUString(); + + m_aImagesZipFileURL = rtl::OUStringToOString( + rtl::Uri::encode( + aImageZip, + rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ), RTL_TEXTENCODING_UTF8 ); + } + } + catch ( NoSuchElementException const & ) + { + } + + return m_aImagesZipFileURL; +} void Databases::replaceName( rtl::OUString& oustring ) const { @@ -1598,14 +1627,14 @@ rtl::OUString ExtensionIteratorBase::implGetFileFromPackage( ::std::vector< ::rtl::OUString > av; implGetLanguageVectorFromPackage( av, xPackage ); ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end(); - try - { - pFound = ::comphelper::Locale::getFallback( av, m_aLanguage ); - } + try + { + pFound = ::comphelper::Locale::getFallback( av, m_aLanguage ); + } catch( ::comphelper::Locale::MalFormedLocaleException& ) {} - if( pFound != av.end() ) - aLanguage = *pFound; + if( pFound != av.end() ) + aLanguage = *pFound; } } return aFile; @@ -1622,7 +1651,7 @@ void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< ::r { rv.clear(); rtl::OUString aExtensionPath = xPackage->getURL(); - Sequence< rtl::OUString > aEntrySeq = m_xSFA->getFolderContents( aExtensionPath, true ); + Sequence< rtl::OUString > aEntrySeq = m_xSFA->getFolderContents( aExtensionPath, true ); const rtl::OUString* pSeq = aEntrySeq.getConstArray(); sal_Int32 nCount = aEntrySeq.getLength(); @@ -1646,7 +1675,7 @@ void ExtensionIteratorBase::implGetLanguageVectorFromPackage( ::std::vector< ::r rv.push_back( aPureEntry ); } } - } + } } @@ -1717,15 +1746,15 @@ Db* DataBaseIterator::implGetDbFromPackage( Reference< deployment::XPackage > xP ::std::vector< ::rtl::OUString > av; implGetLanguageVectorFromPackage( av, xPackage ); ::std::vector< ::rtl::OUString >::const_iterator pFound = av.end(); - try - { - pFound = ::comphelper::Locale::getFallback( av, m_aLanguage ); - } + try + { + pFound = ::comphelper::Locale::getFallback( av, m_aLanguage ); + } catch( ::comphelper::Locale::MalFormedLocaleException& ) {} - if( pFound != av.end() ) + if( pFound != av.end() ) { - aUsedLanguage = *pFound; + aUsedLanguage = *pFound; pRetDb = m_rDatabases.getBerkeley( aHelpFilesBaseName, aUsedLanguage, m_bHelpText, &aExtensionPath ); } } diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 4e7e2efb2a84..e0d5c9697dad 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -1015,7 +1015,7 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam, ::rtl::OUString aExtensionPath; rtl::OUString aJar = urlParam->get_jar(); - bool bAddExtensionPath = false; + bool bAddExtensionPath = false; sal_Int32 nQuestionMark1 = aJar.indexOf( sal_Unicode('?') ); sal_Int32 nQuestionMark2 = aJar.lastIndexOf( sal_Unicode('?') ); if( nQuestionMark1 != -1 && nQuestionMark2 != -1 && nQuestionMark1 != nQuestionMark2 )