#i103496#: remove dependency on svtools

This commit is contained in:
Mathias Bauer 2009-09-17 10:13:05 +02:00
parent b8a58871dc
commit 874e8bf6b1
3 changed files with 83 additions and 54 deletions

View file

@ -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

View file

@ -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 );
}
}

View file

@ -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 )