#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>
@ -263,42 +263,71 @@ static bool impl_getZipFile(
rtl::OString Databases::getImagesZipFileURL()
{
sal_Int16 nSymbolsStyle = SvtMiscOptions().GetCurrentSymbolsStyle();
if ( !m_aImagesZipFileURL.getLength() || ( m_nSymbolsStyle != nSymbolsStyle ) )
//sal_Int16 nSymbolsStyle = SvtMiscOptions().GetCurrentSymbolsStyle();
sal_Int16 nSymbolsStyle = 0;
try
{
m_nSymbolsStyle = nSymbolsStyle;
uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
m_xSMgr ->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"), m_xContext), uno::UNO_QUERY_THROW);
rtl::OUString aImageZip;
rtl::OUString aSymbolsStyleName = SvtMiscOptions().GetCurrentSymbolsStyleName();
bool bFound = false;
// 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);
if ( aSymbolsStyleName.getLength() != 0 )
// 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 )
{
rtl::OUString aZipName = rtl::OUString::createFromAscii( "images_" );
aZipName += aSymbolsStyleName;
aZipName += rtl::OUString::createFromAscii( ".zip" );
bFound = impl_getZipFile( m_aImagesZipPaths, aZipName, aImageZip );
m_nSymbolsStyle = nSymbolsStyle;
bChanged = true;
}
if ( ! bFound )
bFound = impl_getZipFile( m_aImagesZipPaths, rtl::OUString::createFromAscii( "images.zip" ), aImageZip );
if ( !m_aImagesZipFileURL.getLength() || bChanged )
{
rtl::OUString aImageZip, aSymbolsStyleName;
aResult = xAccess->getByHierarchicalName(::rtl::OUString::createFromAscii("Misc/SymbolStyle"));
aResult >>= aSymbolsStyleName;
if ( ! bFound )
aImageZip = rtl::OUString();
bool bFound = false;
if ( aSymbolsStyleName.getLength() != 0 )
{
rtl::OUString aZipName = rtl::OUString::createFromAscii( "images_" );
aZipName += aSymbolsStyleName;
aZipName += rtl::OUString::createFromAscii( ".zip" );
m_aImagesZipFileURL = rtl::OUStringToOString(
rtl::Uri::encode(
aImageZip,
rtl_UriCharClassPchar,
rtl_UriEncodeIgnoreEscapes,
RTL_TEXTENCODING_UTF8 ), RTL_TEXTENCODING_UTF8 );
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
{
sal_Int32 idx = -1,idx1 = -1,idx2 = -1,k = 0,off;