#83054#
Now reading the necessary variables( provider.cxx ), setting them at the xslt-processor and modifying titles( urlparameter.cxx ), as well as defining the replacement and doing it for active help and keywordindex also( databases.cxx ).
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: databases.cxx,v $
|
||||
*
|
||||
* $Revision: 1.24 $
|
||||
* $Revision: 1.25 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2001-10-24 10:55:13 $
|
||||
* last change: $Author: abi $ $Date: 2001-10-31 13:08:14 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -84,10 +84,11 @@
|
||||
#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
|
||||
#include <com/sun/star/lang/Locale.hpp>
|
||||
#endif
|
||||
#ifndef _RTL_USTRBUF_HXX_
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#endif
|
||||
#include "inputstream.hxx"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
using namespace chelp;
|
||||
using namespace com::sun::star::uno;
|
||||
@@ -98,6 +99,11 @@ using namespace com::sun::star::lang;
|
||||
|
||||
|
||||
Databases::Databases( const rtl::OUString& instPath,
|
||||
const rtl::OUString& productName,
|
||||
const rtl::OUString& productVersion,
|
||||
const rtl::OUString& vendorName,
|
||||
const rtl::OUString& vendorVersion,
|
||||
const rtl::OUString& vendorShort,
|
||||
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xSMgr )
|
||||
: m_xSMgr( xSMgr ),
|
||||
m_nErrorDocLength( 0 ),
|
||||
@@ -105,6 +111,12 @@ Databases::Databases( const rtl::OUString& instPath,
|
||||
m_nCustomCSSDocLength( 0 ),
|
||||
m_pCustomCSSDoc( 0 )
|
||||
{
|
||||
m_vReplacement[0] = productName;
|
||||
m_vReplacement[1] = productVersion;
|
||||
m_vReplacement[2] = vendorName;
|
||||
m_vReplacement[3] = vendorVersion;
|
||||
m_vReplacement[4] = vendorShort;
|
||||
|
||||
setInstallPath( instPath );
|
||||
}
|
||||
|
||||
@@ -159,6 +171,72 @@ Databases::~Databases()
|
||||
|
||||
|
||||
|
||||
void Databases::replaceName( rtl::OUString& oustring ) const
|
||||
{
|
||||
sal_Int32 idx = -1,k = 0,add,off;
|
||||
bool cap = false;
|
||||
rtl::OUStringBuffer aStrBuf( 0 );
|
||||
|
||||
while( ( idx = oustring.indexOf( sal_Unicode('%'),++idx ) ) != -1 )
|
||||
{
|
||||
if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTNAME" ),
|
||||
idx ) == idx )
|
||||
{
|
||||
add = 12;
|
||||
off = PRODUCTNAME;
|
||||
}
|
||||
else if( oustring.indexOf( rtl::OUString::createFromAscii( "%PRODUCTVERSION" ),
|
||||
idx ) == idx )
|
||||
{
|
||||
add = 15;
|
||||
off = PRODUCTVERSION;
|
||||
}
|
||||
else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORNAME" ),
|
||||
idx ) == idx )
|
||||
{
|
||||
add = 11;
|
||||
off = VENDORNAME;
|
||||
}
|
||||
else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORVERSION" ),
|
||||
idx ) == idx )
|
||||
{
|
||||
add = 14;
|
||||
off = VENDORVERSION;
|
||||
}
|
||||
else if( oustring.indexOf( rtl::OUString::createFromAscii( "%VENDORSHORT" ),
|
||||
idx ) == idx )
|
||||
{
|
||||
add = 12;
|
||||
off = VENDORSHORT;
|
||||
}
|
||||
else
|
||||
add = 0;
|
||||
|
||||
if( add )
|
||||
{
|
||||
if( ! cap )
|
||||
{
|
||||
cap = true;
|
||||
aStrBuf.ensureCapacity( 256 );
|
||||
}
|
||||
|
||||
aStrBuf.append( &oustring.getStr()[k],idx - k );
|
||||
aStrBuf.append( m_vReplacement[off] );
|
||||
k = idx + add;
|
||||
}
|
||||
}
|
||||
|
||||
if( cap )
|
||||
{
|
||||
if( k < oustring.getLength() )
|
||||
aStrBuf.append( &oustring.getStr()[k],oustring.getLength()-k );
|
||||
oustring = aStrBuf.makeStringAndClear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
rtl::OUString Databases::getInstallPathAsSystemPath()
|
||||
{
|
||||
osl::MutexGuard aGuard( m_aMutex );
|
||||
@@ -322,7 +400,13 @@ StaticModuleInformation* Databases::getStaticInformationForModule( const rtl::OU
|
||||
else
|
||||
lineBuffer[ pos++ ] = ch;
|
||||
}
|
||||
it->second = new StaticModuleInformation( title,startid,program,heading,fulltext,order );
|
||||
replaceName( title );
|
||||
it->second = new StaticModuleInformation( title,
|
||||
startid,
|
||||
program,
|
||||
heading,
|
||||
fulltext,
|
||||
order );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,59 +546,27 @@ Databases::getCollator( const rtl::OUString& Language,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
KeywordInfo::KeywordInfo()
|
||||
: pos( 0 ),
|
||||
listKey( 100 )
|
||||
KeywordInfo::KeywordElement::KeywordElement( Databases *pDatabases,
|
||||
Db* pDb,
|
||||
Reference< XCollator > xCollator,
|
||||
rtl::OUString& ky,
|
||||
rtl::OUString& data )
|
||||
: m_xCollator( xCollator ),
|
||||
key( ky )
|
||||
{
|
||||
if( key.indexOf( rtl::OUString::createFromAscii( "%PRODUCTNAME" ) ) != -1 )
|
||||
while( false );
|
||||
|
||||
pDatabases->replaceName( key );
|
||||
init( pDatabases,pDb,data );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Sequence< rtl::OUString >& KeywordInfo::insertId( sal_Int32 index,rtl::OUString ids )
|
||||
bool KeywordInfo::KeywordElement::operator<( const KeywordElement& ra ) const
|
||||
{
|
||||
std::vector< rtl::OUString > test;
|
||||
while( ids.getLength() )
|
||||
{
|
||||
sal_Int32 idx = ids.indexOf( ';' );
|
||||
test.push_back( ids.copy(0,idx) );
|
||||
ids = ids.copy( 1+idx );
|
||||
}
|
||||
const rtl::OUString& l = key;
|
||||
const rtl::OUString& r = ra.key;
|
||||
|
||||
listId[index].realloc( test.size() );
|
||||
for( sal_uInt32 i = 0; i < test.size(); ++i )
|
||||
listId[index][i] = test[i];
|
||||
|
||||
listAnchor[index].realloc( test.size() );
|
||||
|
||||
for( sal_Int32 k = 0; k < listId[index].getLength(); ++k )
|
||||
{
|
||||
if( listId[index][k].getLength() )
|
||||
{
|
||||
sal_Int32 idx = listId[index][k].indexOf( sal_Unicode( '#' ) );
|
||||
if( idx != -1 )
|
||||
{
|
||||
listAnchor[index][k] = listId[index][k].copy(1+idx).trim();
|
||||
listId[index][k] = listId[index][k].copy(0,idx).trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
listTitle[index].realloc( test.size() );
|
||||
return listId[index];
|
||||
}
|
||||
|
||||
|
||||
|
||||
KeywordInfo::Compare::Compare( const Reference< XCollator >& xCollator )
|
||||
: m_xCollator( xCollator )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int KeywordInfo::Compare::operator()( const rtl::OUString& l,const rtl::OUString& r ) const
|
||||
{
|
||||
if( m_xCollator.is() )
|
||||
{
|
||||
sal_Int32 l1 = l.indexOf( sal_Unicode( ';' ) );
|
||||
@@ -541,31 +593,84 @@ int KeywordInfo::Compare::operator()( const rtl::OUString& l,const rtl::OUString
|
||||
sal_Int32 c1 = m_xCollator->compareSubstring( l,0,l3,r,0,r3 );
|
||||
|
||||
if( c1 == +1 )
|
||||
return 0;
|
||||
return false;
|
||||
else
|
||||
{
|
||||
if( c1 == 0 )
|
||||
return ( m_xCollator->compareSubstring( l,1+l1,l2,r,1+r1,r2 ) < 0 ) ? 1 : 0;
|
||||
return ( m_xCollator->compareSubstring( l,1+l1,l2,r,1+r1,r2 ) < 0 ) ? true : false;
|
||||
else
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
return ( l <= r ) ? 1 : 0;
|
||||
return ( l <= r ) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void KeywordInfo::sort( std::vector< rtl::OUString >& listKey_, const Compare& comp )
|
||||
void KeywordInfo::KeywordElement::init( Databases *pDatabases,Db* pDb,const rtl::OUString& ids )
|
||||
{
|
||||
std::sort( listKey_.begin(),listKey_.end(),comp );
|
||||
listKey.realloc( listKey_.size() );
|
||||
listId.realloc( listKey_.size() );
|
||||
listAnchor.realloc( listKey_.size() );
|
||||
listTitle.realloc( listKey_.size() );
|
||||
const sal_Unicode* idstr = ids.getStr();
|
||||
std::vector< rtl::OUString > id,anchor;
|
||||
int idx = -1,k;
|
||||
while( ( idx = ids.indexOf( ';',k = ++idx ) ) != -1 )
|
||||
{
|
||||
int h = ids.indexOf( sal_Unicode( '#' ),k );
|
||||
if( h < idx )
|
||||
{
|
||||
// found an anchor
|
||||
id.push_back( rtl::OUString( &idstr[k],h-k ) );
|
||||
anchor.push_back( rtl::OUString( &idstr[h+1],idx-h-1 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
id.push_back( rtl::OUString( &idstr[k],idx-k ) );
|
||||
anchor.push_back( rtl::OUString() );
|
||||
}
|
||||
}
|
||||
|
||||
for( sal_uInt32 i = 0; i < listKey_.size(); ++i )
|
||||
listKey[i] = listKey_[i];
|
||||
listId.realloc( id.size() );
|
||||
listAnchor.realloc( id.size() );
|
||||
listTitle.realloc( id.size() );
|
||||
for( sal_uInt32 i = 0; i < id.size(); ++i )
|
||||
{
|
||||
listId[i] = id[i];
|
||||
listAnchor[i] = anchor[i];
|
||||
|
||||
rtl::OString idi( id[i].getStr(),id[i].getLength(),RTL_TEXTENCODING_UTF8 );
|
||||
Dbt key( static_cast< void* >( const_cast< sal_Char* >( idi.getStr() ) ),
|
||||
idi.getLength() );
|
||||
Dbt data;
|
||||
if( pDb )
|
||||
pDb->get( 0,&key,&data,0 );
|
||||
|
||||
DbtToStringConverter converter( static_cast< sal_Char* >( data.get_data() ),
|
||||
data.get_size() );
|
||||
|
||||
rtl::OUString title = converter.getTitle();
|
||||
pDatabases->replaceName( title );
|
||||
listTitle[i] = title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
KeywordInfo::KeywordInfo( const std::set< KeywordElement >& aSet )
|
||||
: listKey( aSet.size() ),
|
||||
listId( aSet.size() ),
|
||||
listAnchor( aSet.size() ),
|
||||
listTitle( aSet.size() )
|
||||
{
|
||||
int idx = 0;
|
||||
std::set< KeywordElement >::iterator it = aSet.begin();
|
||||
while( it != aSet.end() )
|
||||
{
|
||||
listKey[idx] = it->key;
|
||||
listId[idx] = it->listId;
|
||||
listAnchor[idx] = it->listAnchor;
|
||||
listTitle[idx] = it->listTitle;
|
||||
++idx;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -584,40 +689,42 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database,
|
||||
|
||||
if( aPair.second && ! it->second )
|
||||
{
|
||||
std::vector< rtl::OUString > listKey_;
|
||||
std::hash_map< rtl::OUString,rtl::OUString,ha,eq > internalHash;
|
||||
|
||||
rtl::OUString fileNameOU =
|
||||
getInstallPathAsSystemPath() +
|
||||
key +
|
||||
rtl::OUString::createFromAscii( ".key" );
|
||||
|
||||
rtl::OString fileName( fileNameOU.getStr(),fileNameOU.getLength(),osl_getThreadTextEncoding() );
|
||||
|
||||
Db table( 0,DB_CXX_NO_EXCEPTIONS );
|
||||
if( 0 == table.open( fileName.getStr(),0,DB_BTREE,DB_RDONLY,0644 ) )
|
||||
{ // success opening the database
|
||||
Dbc* cursor = 0;
|
||||
table.cursor( 0,&cursor,0 );
|
||||
Dbt key,data;
|
||||
{
|
||||
std::set<KeywordInfo::KeywordElement> aSet;
|
||||
Db* idmap = getBerkeley( Database,Language );
|
||||
Reference< XCollator > xCollator = getCollator( Language,rtl::OUString() );
|
||||
|
||||
bool first = true;
|
||||
Dbt key,data;
|
||||
key.set_flags( DB_DBT_MALLOC ); // Initially the cursor must allocate the necessary memory
|
||||
data.set_flags( DB_DBT_MALLOC );
|
||||
KeywordInfo* info = it->second = new KeywordInfo();
|
||||
|
||||
rtl::OUString keyStri;
|
||||
Dbc* cursor = 0;
|
||||
table.cursor( 0,&cursor,0 );
|
||||
|
||||
while( cursor && DB_NOTFOUND != cursor->get( &key,&data,DB_NEXT ) )
|
||||
{
|
||||
keyStri = rtl::OUString( static_cast<sal_Char*>(key.get_data()),
|
||||
key.get_size(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
info->insert( listKey_,keyStri );
|
||||
internalHash[ keyStri ] = rtl::OUString( static_cast<sal_Char*>(data.get_data()),
|
||||
data.get_size(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
rtl::OUString keyword( static_cast<sal_Char*>(key.get_data()),
|
||||
key.get_size(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
rtl::OUString doclist( static_cast<sal_Char*>(data.get_data()),
|
||||
data.get_size(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
|
||||
aSet.insert(
|
||||
KeywordInfo::KeywordElement( this,
|
||||
idmap,
|
||||
xCollator,
|
||||
keyword,
|
||||
doclist ) );
|
||||
if( first )
|
||||
{
|
||||
key.set_flags( DB_DBT_REALLOC );
|
||||
@@ -625,35 +732,9 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database,
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
info->sort( listKey_,KeywordInfo::Compare( getCollator( Language,
|
||||
rtl::OUString() ) ) );
|
||||
cursor->close();
|
||||
|
||||
Sequence< rtl::OUString >& keywords = info->getKeywordList();
|
||||
Db *table2 = getBerkeley( Database,Language );
|
||||
for( sal_Int32 i = 0; i < keywords.getLength(); ++i )
|
||||
{
|
||||
Sequence< rtl::OUString >& id = info->insertId( i,internalHash[ keywords[i] ] );
|
||||
Sequence< rtl::OUString >& title = info->getTitleForIndex( i );
|
||||
|
||||
for( sal_Int32 j = 0; j < id.getLength(); ++j )
|
||||
{
|
||||
rtl::OString idj( id[j].getStr(),id[j].getLength(),RTL_TEXTENCODING_UTF8 );
|
||||
Dbt key1( static_cast< void* >( const_cast< sal_Char* >( idj.getStr() ) ),
|
||||
idj.getLength() );
|
||||
Dbt data1;
|
||||
if( table2 )
|
||||
table2->get( 0,&key1,&data1,0 );
|
||||
|
||||
DbtToStringConverter converter( static_cast< sal_Char* >( data1.get_data() ),
|
||||
data1.get_size() );
|
||||
|
||||
title[j] = converter.getTitle();
|
||||
}
|
||||
}
|
||||
KeywordInfo* info = it->second = new KeywordInfo( aSet );
|
||||
}
|
||||
|
||||
table.close( 0 );
|
||||
}
|
||||
|
||||
@@ -662,6 +743,8 @@ KeywordInfo* Databases::getKeyword( const rtl::OUString& Database,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference< XHierarchicalNameAccess > Databases::jarFile( const rtl::OUString& jar,
|
||||
const rtl::OUString& Language )
|
||||
{
|
||||
@@ -889,10 +972,29 @@ void Databases::setActiveText( const rtl::OUString& Module,
|
||||
Dbt key( static_cast< void* >( const_cast< sal_Char* >( id.getStr() ) ),id.getLength() );
|
||||
Dbt data;
|
||||
db->get( 0,&key,&data,0 );
|
||||
*byteCount = data.get_size();
|
||||
*buffer = new char[ 1 + *byteCount ];
|
||||
(*buffer)[*byteCount] = 0;
|
||||
rtl_copyMemory( *buffer,data.get_data(),*byteCount );
|
||||
int len = data.get_size();
|
||||
const sal_Char* ptr = static_cast<sal_Char*>( data.get_data() );
|
||||
|
||||
// ensure existence of tmp after for
|
||||
rtl::OString tmp;
|
||||
for( int i = 0; i < len; ++i )
|
||||
if( ptr[i] == '%' )
|
||||
{
|
||||
// need to replace
|
||||
rtl::OUString temp = rtl::OUString( ptr,len,RTL_TEXTENCODING_UTF8 );
|
||||
replaceName( temp );
|
||||
tmp = rtl::OString( temp.getStr(),
|
||||
temp.getLength(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
len = tmp.getLength();
|
||||
ptr = tmp.getStr();
|
||||
break;
|
||||
}
|
||||
|
||||
*byteCount = len;
|
||||
*buffer = new char[ 1 + len ];
|
||||
(*buffer)[len] = 0;
|
||||
rtl_copyMemory( *buffer,ptr,len );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: provider.cxx,v $
|
||||
*
|
||||
* $Revision: 1.9 $
|
||||
* $Revision: 1.10 $
|
||||
*
|
||||
* last change: $Author: mh $ $Date: 2001-10-04 08:35:51 $
|
||||
* last change: $Author: abi $ $Date: 2001-10-31 13:08:14 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -85,9 +85,6 @@
|
||||
#ifndef _DATABASES_HXX_
|
||||
#include <provider/databases.hxx>
|
||||
#endif
|
||||
#ifndef COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
|
||||
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_FRAME_XCONFIGMANAGER_HPP_
|
||||
#include <com/sun/star/frame/XConfigManager.hpp>
|
||||
#endif
|
||||
@@ -222,116 +219,175 @@ Reference< XContent > SAL_CALL ContentProvider::queryContent( const Reference< X
|
||||
}
|
||||
|
||||
|
||||
#include <provider/debughelper.hxx>
|
||||
|
||||
void ContentProvider::init()
|
||||
{
|
||||
osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
isInitialized = true;
|
||||
Reference< XMultiServiceFactory > sProvider( getConfiguration() );
|
||||
Reference< XHierarchicalNameAccess > xHierAccess( getHierAccess( sProvider,
|
||||
"org.openoffice.Office.Common" ) );
|
||||
|
||||
// rtl::OUString sProviderService =
|
||||
// rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" );
|
||||
rtl::OUString instPath( getKey( xHierAccess,"Path/Current/Help" ) );
|
||||
if( ! instPath.getLength() )
|
||||
// try to determine path from default
|
||||
instPath = rtl::OUString::createFromAscii( "$(instpath)/help" );
|
||||
|
||||
// replace anything like $(instpath);
|
||||
subst( instPath );
|
||||
|
||||
/**
|
||||
* now determing
|
||||
* productname,
|
||||
* productversion,
|
||||
* vendorname,
|
||||
* vendorversion,
|
||||
* vendorshort
|
||||
*/
|
||||
|
||||
xHierAccess = getHierAccess( sProvider,
|
||||
"org.openoffice.Setup" );
|
||||
rtl::OUString productname( getKey( xHierAccess,"Product/ooName" ) );
|
||||
|
||||
rtl::OUString setupversion( getKey( xHierAccess,"Product/ooSetupVersion" ) );
|
||||
rtl::OUString setupextension( getKey( xHierAccess,"Product/ooSetupExtension") );
|
||||
rtl::OUString productversion( setupversion +
|
||||
rtl::OUString::createFromAscii( " " ) +
|
||||
setupextension );
|
||||
|
||||
|
||||
// Any aAny;
|
||||
// aAny <<= rtl::OUString::createFromAscii( "local" );
|
||||
// PropertyValue aProp( rtl::OUString::createFromAscii( "servertype" ),
|
||||
// -1,
|
||||
// aAny,
|
||||
// PropertyState_DIRECT_VALUE );
|
||||
xHierAccess = getHierAccess( sProvider,
|
||||
"org.openoffice.Webtop.Common" );
|
||||
rtl::OUString vendorname( getKey( xHierAccess,"Product/ooName" ) );
|
||||
|
||||
// Sequence< Any > seq(1);
|
||||
// seq[0] <<= aProp;
|
||||
|
||||
// Reference< XMultiServiceFactory > sProvider;
|
||||
// try
|
||||
// {
|
||||
// sProvider =
|
||||
// Reference< XMultiServiceFactory >(
|
||||
// m_xSMgr->createInstanceWithArguments( sProviderService,seq ),
|
||||
// UNO_QUERY );
|
||||
// }
|
||||
// catch( const com::sun::star::uno::Exception& e )
|
||||
// {
|
||||
// VOS_ENSHURE( sProvider.is()," cant instantiate the multiservicefactory " );
|
||||
// }
|
||||
|
||||
|
||||
// if( ! sProvider.is() )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// rtl::OUString sReaderService =
|
||||
// rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" );
|
||||
|
||||
// seq[0] <<= rtl::OUString::createFromAscii( "org.openoffice.Office.Common" );
|
||||
|
||||
|
||||
// Reference< XHierarchicalNameAccess > xHierAccess;
|
||||
// try
|
||||
// {
|
||||
// xHierAccess =
|
||||
// Reference< XHierarchicalNameAccess >
|
||||
// ( sProvider->createInstanceWithArguments( sReaderService,seq ),
|
||||
// UNO_QUERY );
|
||||
// }
|
||||
// catch( const com::sun::star::uno::Exception& e )
|
||||
// {
|
||||
// VOS_ENSHURE( xHierAccess.is()," cant instantiate the reader service " );
|
||||
// }
|
||||
|
||||
// if( ! xHierAccess.is() )
|
||||
// return;
|
||||
|
||||
// try
|
||||
// {
|
||||
// aAny =
|
||||
// xHierAccess->getByHierarchicalName( rtl::OUString::createFromAscii("Path/Current/Help") );
|
||||
// }
|
||||
// catch( const com::sun::star::container::NoSuchElementException& e )
|
||||
// {
|
||||
// VOS_ENSHURE( false," path to help files could not be determined " );
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
// rtl::OUString instPath;
|
||||
// bool err = ! ( aAny >>= instPath );
|
||||
|
||||
// if( err )
|
||||
// {
|
||||
// VOS_ENSHURE( false," path to help files could not be determined " );
|
||||
// return;
|
||||
// }
|
||||
|
||||
rtl::OUString instPath( rtl::OUString::createFromAscii( "$(instpath)/help/" ) );
|
||||
|
||||
Reference< XConfigManager > xCfgMgr;
|
||||
try
|
||||
{
|
||||
xCfgMgr =
|
||||
Reference< XConfigManager >(
|
||||
m_xSMgr->createInstance( rtl::OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ),
|
||||
UNO_QUERY );
|
||||
}
|
||||
catch( const com::sun::star::uno::Exception& e )
|
||||
{
|
||||
VOS_ENSHURE( xCfgMgr.is()," cant instantiate the special config manager " );
|
||||
}
|
||||
|
||||
|
||||
if( ! xCfgMgr.is() )
|
||||
{
|
||||
fprintf( stderr,"specialconfigmanager not found\n" );
|
||||
}
|
||||
else
|
||||
instPath = xCfgMgr->substituteVariables( instPath );
|
||||
|
||||
// err_msg( "installpath as given by substituteVariables ",
|
||||
// instPath );
|
||||
|
||||
// instPath = rtl::OUString::createFromAscii( "/export/home/abi/src38b11/help" );
|
||||
setupversion = rtl::OUString( getKey( xHierAccess,"Product/ooSetupVersion" ) );
|
||||
setupextension = rtl::OUString ( getKey( xHierAccess,"Product/ooSetupExtension") );
|
||||
rtl::OUString vendorversion( setupversion +
|
||||
rtl::OUString::createFromAscii( " " ) +
|
||||
setupextension );
|
||||
rtl::OUString vendorshort = vendorname;
|
||||
|
||||
m_pDatabases = new Databases( instPath,
|
||||
productname,
|
||||
productversion,
|
||||
vendorname,
|
||||
vendorversion,
|
||||
vendorshort,
|
||||
m_xSMgr );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference< XMultiServiceFactory > ContentProvider::getConfiguration() const
|
||||
{
|
||||
Reference< XMultiServiceFactory > sProvider;
|
||||
if( m_xSMgr.is() )
|
||||
{
|
||||
Any aAny;
|
||||
aAny <<= rtl::OUString::createFromAscii( "plugin" );
|
||||
PropertyValue aProp( rtl::OUString::createFromAscii( "servertype" ),
|
||||
-1,
|
||||
aAny,
|
||||
PropertyState_DIRECT_VALUE );
|
||||
|
||||
Sequence< Any > seq(1);
|
||||
seq[0] <<= aProp;
|
||||
|
||||
try
|
||||
{
|
||||
rtl::OUString sProviderService =
|
||||
rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" );
|
||||
sProvider =
|
||||
Reference< XMultiServiceFactory >(
|
||||
m_xSMgr->createInstanceWithArguments( sProviderService,seq ),
|
||||
UNO_QUERY );
|
||||
}
|
||||
catch( const com::sun::star::uno::Exception& )
|
||||
{
|
||||
OSL_ENSURE( sProvider.is(),"cant instantiate configuration" );
|
||||
}
|
||||
}
|
||||
|
||||
return sProvider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference< XHierarchicalNameAccess >
|
||||
ContentProvider::getHierAccess( const Reference< XMultiServiceFactory >& sProvider,
|
||||
const char* file ) const
|
||||
{
|
||||
Reference< XHierarchicalNameAccess > xHierAccess;
|
||||
|
||||
if( sProvider.is() )
|
||||
{
|
||||
Sequence< Any > seq(1);
|
||||
rtl::OUString sReaderService =
|
||||
rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" );
|
||||
|
||||
seq[0] <<= rtl::OUString::createFromAscii( file );
|
||||
|
||||
try
|
||||
{
|
||||
xHierAccess =
|
||||
Reference< XHierarchicalNameAccess >
|
||||
( sProvider->createInstanceWithArguments( sReaderService,seq ),
|
||||
UNO_QUERY );
|
||||
}
|
||||
catch( const com::sun::star::uno::Exception& )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return xHierAccess;
|
||||
}
|
||||
|
||||
|
||||
|
||||
rtl::OUString
|
||||
ContentProvider::getKey( const Reference< XHierarchicalNameAccess >& xHierAccess,
|
||||
const char* key ) const
|
||||
{
|
||||
rtl::OUString instPath;
|
||||
if( xHierAccess.is() )
|
||||
{
|
||||
Any aAny;
|
||||
try
|
||||
{
|
||||
aAny =
|
||||
xHierAccess->getByHierarchicalName( rtl::OUString::createFromAscii( key ) );
|
||||
}
|
||||
catch( const com::sun::star::container::NoSuchElementException& )
|
||||
{
|
||||
}
|
||||
aAny >>= instPath;
|
||||
}
|
||||
return instPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ContentProvider::subst( rtl::OUString& instpath ) const
|
||||
{
|
||||
Reference< XConfigManager > xCfgMgr;
|
||||
if( m_xSMgr.is() )
|
||||
{
|
||||
try
|
||||
{
|
||||
xCfgMgr =
|
||||
Reference< XConfigManager >(
|
||||
m_xSMgr->createInstance( rtl::OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ),
|
||||
UNO_QUERY );
|
||||
}
|
||||
catch( const com::sun::star::uno::Exception& e )
|
||||
{
|
||||
OSL_ENSURE( xCfgMgr.is()," cant instantiate the special config manager " );
|
||||
}
|
||||
}
|
||||
|
||||
OSL_ENSURE( xCfgMgr.is(), "specialconfigmanager not found\n" );
|
||||
|
||||
if( xCfgMgr.is() )
|
||||
instpath = xCfgMgr->substituteVariables( instpath );
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: urlparameter.cxx,v $
|
||||
*
|
||||
* $Revision: 1.24 $
|
||||
* $Revision: 1.25 $
|
||||
*
|
||||
* last change: $Author: hr $ $Date: 2001-10-24 11:17:19 $
|
||||
* last change: $Author: abi $ $Date: 2001-10-31 13:08:14 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -365,6 +365,7 @@ void URLParameter::readBerkeley()
|
||||
DbtToStringConverter converter( static_cast< sal_Char* >( data.get_data() ),
|
||||
data.get_size() );
|
||||
m_aTitle = converter.getTitle();
|
||||
m_pDatabases->replaceName( m_aTitle );
|
||||
m_aPath = converter.getFile();
|
||||
m_aJar = converter.getDatabase();
|
||||
m_aTag = converter.getHash();
|
||||
@@ -793,8 +794,8 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
|
||||
|
||||
// Uses the implementation detail, that rtl::OString::getStr returns a zero terminated character-array
|
||||
|
||||
const char* parameter[31];
|
||||
rtl::OString parString[30];
|
||||
const char* parameter[41];
|
||||
rtl::OString parString[40];
|
||||
int last;
|
||||
|
||||
parString[ 0] = "Program";
|
||||
@@ -809,29 +810,51 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
|
||||
parString[ 9] = urlParam->getByName( "Language" );
|
||||
parString[10] = "System";
|
||||
parString[11] = urlParam->getByName( "System" );
|
||||
parString[12] = "hp";
|
||||
parString[13] = urlParam->getByName( "HelpPrefix" );
|
||||
last = 14;
|
||||
parString[12] = "productname";
|
||||
parString[13] = rtl::OString( pDatabases->getProductName().getStr(),
|
||||
pDatabases->getProductName().getLength(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
parString[14] = "productversion";
|
||||
parString[15] = rtl::OString( pDatabases->getProductVersion().getStr(),
|
||||
pDatabases->getProductVersion().getLength(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
|
||||
if( parString[13].getLength() )
|
||||
parString[16] = "hp";
|
||||
parString[17] = urlParam->getByName( "HelpPrefix" );
|
||||
last = 18;
|
||||
|
||||
if( parString[17].getLength() )
|
||||
{
|
||||
parString[14] = "sm";
|
||||
parString[15] = "vnd.sun.star.help%3A%2F%2F";
|
||||
parString[16] = "qm";
|
||||
parString[17] = "%3F";
|
||||
parString[18] = "es";
|
||||
parString[19] = "%3D";
|
||||
parString[20] = "am";
|
||||
parString[21] = "%26";
|
||||
parString[22] = "cl";
|
||||
parString[23] = "%3A";
|
||||
parString[24] = "sl";
|
||||
parString[25] = "%2F";
|
||||
parString[26] = "hm";
|
||||
parString[27] = "%23";
|
||||
parString[28] = "cs";
|
||||
parString[29] = "css";
|
||||
last = 30;
|
||||
parString[18] = "sm";
|
||||
parString[19] = "vnd.sun.star.help%3A%2F%2F";
|
||||
parString[20] = "qm";
|
||||
parString[21] = "%3F";
|
||||
parString[22] = "es";
|
||||
parString[23] = "%3D";
|
||||
parString[24] = "am";
|
||||
parString[25] = "%26";
|
||||
parString[26] = "cl";
|
||||
parString[27] = "%3A";
|
||||
parString[28] = "sl";
|
||||
parString[29] = "%2F";
|
||||
parString[30] = "hm";
|
||||
parString[31] = "%23";
|
||||
parString[32] = "cs";
|
||||
parString[33] = "css";
|
||||
|
||||
parString[34] = "vendorname";
|
||||
parString[35] = rtl::OString( pDatabases->getVendorName().getStr(),
|
||||
pDatabases->getVendorName().getLength(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
parString[36] = "vendorversion";
|
||||
parString[37] = rtl::OString( pDatabases->getVendorVersion().getStr(),
|
||||
pDatabases->getVendorVersion().getLength(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
parString[38] = "vendorshort";
|
||||
parString[39] = rtl::OString( pDatabases->getVendorShort().getStr(),
|
||||
pDatabases->getVendorShort().getLength(),
|
||||
RTL_TEXTENCODING_UTF8 );
|
||||
last = 40;
|
||||
}
|
||||
|
||||
for( int i = 0; i < last; ++i )
|
||||
@@ -842,8 +865,6 @@ InputStreamTransformer::InputStreamTransformer( URLParameter* urlParam,
|
||||
SablotHandle p;
|
||||
SablotCreateProcessor(&p);
|
||||
SablotRegHandler( p,HLR_SCHEME,&schemeHandler,(void*)(&userData) );
|
||||
|
||||
// rtl::OUString xslURL = pDatabases->getInstallPathAsURL();
|
||||
rtl::OUString xslURL = pDatabases->getInstallPathAsURLWithOutEncoding();
|
||||
|
||||
rtl::OString xslURLascii = "file:";
|
||||
|
||||
Reference in New Issue
Block a user