diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-17 10:13:05 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-17 10:13:05 +0200 |
commit | 874e8bf6b141f53e1536a9816cfd90cc044aeb49 (patch) | |
tree | 20e7485f4a7cdccd91c5af67d94fb90e31579639 /xmlhelp/source | |
parent | b8a58871dcc7e2398e95d518dff2f739712515e3 (diff) |
#i103496#: remove dependency on svtools
Diffstat (limited to 'xmlhelp/source')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 133 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 2 |
2 files changed, 82 insertions, 53 deletions
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 <rtl/memory.h> #include <com/sun/star/lang/Locale.hpp> #include <rtl/ustrbuf.hxx> -#include <svtools/miscopt.hxx> #include "inputstream.hxx" #include <algorithm> #include <string.h> @@ -52,6 +51,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/beans/Optional.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XConfigManager.hpp> #include <com/sun/star/util/XMacroExpander.hpp> #include <com/sun/star/uri/XUriReferenceFactory.hpp> @@ -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 ) |