diff options
Diffstat (limited to 'xmlhelp/source/cxxhelp/provider')
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/content.cxx | 16 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/databases.cxx | 8 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/makefile.mk | 6 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/provider.cxx | 6 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/urlparameter.cxx | 209 |
5 files changed, 225 insertions, 20 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx b/xmlhelp/source/cxxhelp/provider/content.cxx index ebeebde96d28..884292e1ae92 100644 --- a/xmlhelp/source/cxxhelp/provider/content.cxx +++ b/xmlhelp/source/cxxhelp/provider/content.cxx @@ -2,9 +2,9 @@ * * $RCSfile: content.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: abi $ $Date: 2001-05-22 07:29:14 $ + * last change: $Author: abi $ $Date: 2001-05-22 14:57:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -415,13 +415,13 @@ Any SAL_CALL Content::execute( const Command& aCommand, Reference< XActiveDataSink > xActiveDataSink( aOpenCommand.Sink,UNO_QUERY ); if( xActiveDataSink.is() ) { - m_aURLParameter.open( m_xSMgr,aCommand,CommandId,Environment ); - Reference< XInputStream > xUntransformed = xActiveDataSink->getInputStream(); - Reference< XInputStream > xTransformed( new Transformer( m_xProvider.getBodyPtr(), - xUntransformed, - m_aURLParameter ) ); + m_aURLParameter.open( m_xSMgr,aCommand,CommandId,Environment,xActiveDataSink ); +// Reference< XInputStream > xUntransformed = xActiveDataSink->getInputStream(); +// Reference< XInputStream > xTransformed( new Transformer( m_xProvider.getBodyPtr(), +// xUntransformed, +// m_aURLParameter ) ); - xActiveDataSink->setInputStream( xTransformed ); +// xActiveDataSink->setInputStream( xTransformed ); } if( m_aURLParameter.isRoot() ) diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 8d18e3cd6833..5b9f26baf00a 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -2,9 +2,9 @@ * * $RCSfile: databases.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: abi $ $Date: 2001-05-17 15:46:30 $ + * last change: $Author: abi $ $Date: 2001-05-22 14:57:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,6 +97,7 @@ void Databases::setInstallPath( const rtl::OUString& aInstDir ) { osl::MutexGuard aGuard( m_aMutex ); + if( osl::FileBase::E_None != osl::FileBase::normalizePath( aInstDir,m_aInstallDirectory ) ) ; @@ -147,7 +148,6 @@ rtl::OUString Databases::getInstallPathAsURL() } - rtl::OUString Databases::getURLMode() { return rtl::OUString::createFromAscii( "with-jars" ); @@ -187,7 +187,7 @@ std::vector< rtl::OUString > Databases::getModuleList( const rtl::OUString& Lang if( fileName.getLength() == idx + 3 && ( str[idx + 1] == 'd' || str[idx + 1] == 'D' ) && ( str[idx + 2] == 'b' || str[idx + 2] == 'B' ) && - ( fileName = fileName.copy(0,idx).toLowerCase() ).compareToAscii( "picture" ) != 0 ) + ( fileName = fileName.copy(0,idx).toAsciiLowerCase() ).compareToAscii( "picture" ) != 0 ) ret.push_back( fileName ); } diff --git a/xmlhelp/source/cxxhelp/provider/makefile.mk b/xmlhelp/source/cxxhelp/provider/makefile.mk index d11e2449142b..c9da727bd22d 100644 --- a/xmlhelp/source/cxxhelp/provider/makefile.mk +++ b/xmlhelp/source/cxxhelp/provider/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: abi $ $Date: 2001-05-22 07:29:14 $ +# last change: $Author: abi $ $Date: 2001-05-22 14:57:11 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -73,6 +73,8 @@ NO_BSYMBOLIC=TRUE .INCLUDE: settings.mk +INC+=-Ie:/w3c/Sablot-0.52/include + .IF "$(GUI)"=="WNT" CFLAGS+=/GR .ENDIF diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx index 85de7b712e8a..2a7858e42bbe 100644 --- a/xmlhelp/source/cxxhelp/provider/provider.cxx +++ b/xmlhelp/source/cxxhelp/provider/provider.cxx @@ -2,9 +2,9 @@ * * $RCSfile: provider.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: abi $ $Date: 2001-05-17 15:46:30 $ + * last change: $Author: abi $ $Date: 2001-05-22 14:57:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -180,7 +180,7 @@ ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider ); Reference< XContent > SAL_CALL ContentProvider::queryContent( const Reference< XContentIdentifier >& xCanonicId ) throw( IllegalIdentifierException, RuntimeException ) { - if ( ! xCanonicId->getContentProviderScheme().equalsIgnoreCase( m_aScheme ) ) + if ( ! xCanonicId->getContentProviderScheme().equalsIgnoreAsciiCase( m_aScheme ) ) { // Wrong URL-scheme throw IllegalIdentifierException(); } diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 965bf7a3338c..698b44df48e3 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: urlparameter.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: abi $ $Date: 2001-05-22 07:29:14 $ + * last change: $Author: abi $ $Date: 2001-05-22 14:57:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -59,9 +59,18 @@ * ************************************************************************/ +#ifndef SablotHIncl +#include <sablot.h> +#endif #ifndef _VOS_DIAGNOSE_HXX_ #include <vos/diagnose.hxx> #endif +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif +#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_ +#include <cppuhelper/queryinterface.hxx> +#endif #ifndef _RTL_URI_HXX_ #include <rtl/uri.hxx> #endif @@ -80,6 +89,9 @@ #ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ #include <com/sun/star/io/XInputStream.hpp> #endif +#ifndef _COM_SUN_STAR_IO_XSEEKABLE_HPP_ +#include <com/sun/star/io/XSeekable.hpp> +#endif #ifndef _COM_SUN_STAR_UCB_OPENCOMMANDARGUMENT2_HPP_ #include <com/sun/star/ucb/OpenCommandArgument2.hpp> #endif @@ -116,6 +128,7 @@ namespace chelp { } +using namespace cppu; using namespace com::sun::star::io; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -397,11 +410,70 @@ void URLParameter::readBerkeley() +// Class encapsulating the transformation of the XInputStream to XHTML + + +class InputStreamTransformer + : public OWeakObject, + public XInputStream, + public XSeekable +{ +public: + + InputStreamTransformer( const Reference< XInputStream >& xUntransformed ); + ~InputStreamTransformer(); + + virtual Any SAL_CALL queryInterface( const Type& rType ) throw( RuntimeException ); + virtual void SAL_CALL acquire( void ) throw( RuntimeException ); + virtual void SAL_CALL release( void ) throw( RuntimeException ); + + + virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >& aData,sal_Int32 nBytesToRead ) throw( NotConnectedException, + BufferSizeExceededException, + IOException, + RuntimeException); + + virtual sal_Int32 SAL_CALL readSomeBytes( Sequence< sal_Int8 >& aData,sal_Int32 nMaxBytesToRead ) throw( NotConnectedException, + BufferSizeExceededException, + IOException, + RuntimeException); + + virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw( NotConnectedException, + BufferSizeExceededException, + IOException, + RuntimeException ); + + virtual sal_Int32 SAL_CALL available( void ) throw( NotConnectedException, + IOException, + RuntimeException ); + + virtual void SAL_CALL closeInput( void ) throw( NotConnectedException, + IOException, + RuntimeException ); + + virtual void SAL_CALL seek( sal_Int64 location ) throw( IllegalArgumentException, + IOException, + RuntimeException ); + + virtual sal_Int64 SAL_CALL getPosition( void ) throw( IOException,RuntimeException ); + + virtual sal_Int64 SAL_CALL getLength( void ) throw( IOException,RuntimeException ); + + +private: + + Reference< XInputStream > m_xInputStream; + Reference< XSeekable > m_xSeekable; +}; + + + void URLParameter::open( const Reference< XMultiServiceFactory >& rxSMgr, const Command& command, sal_Int32 CommandId, - const Reference< XCommandEnvironment >& Environment ) + const Reference< XCommandEnvironment >& Environment, + const Reference< XActiveDataSink >& xDataSink ) { rtl::OUString service = rtl::OUString::createFromAscii( "com.sun.star.ucb.UniversalContentBroker" ); @@ -430,14 +502,17 @@ void URLParameter::open( const Reference< XMultiServiceFactory >& rxSMgr, if( isRoot() ) { + printf( "isRoot" ); // getPicture( HelpDatabases.getCssSheet(),m_xOutputStream); } else if( isPicture() ) { + printf( "isPicture" ); // getPicture( m_xParameter.getInputFromJarFile(),m_xOutputStream ); } else if( isActive() ) { // This is a Helptext + printf( "isActive" ); // m_xOutputStream.setBigBuffer( m_xParameter.getByteArrayText() ); } else @@ -445,6 +520,9 @@ void URLParameter::open( const Reference< XMultiServiceFactory >& rxSMgr, processor->execute( command, CommandId, Environment ); + + // Now plug in a new XInputStream + xDataSink->setInputStream( new InputStreamTransformer( xDataSink->getInputStream() ) ); } } @@ -601,3 +679,128 @@ bool URLParameter::query() return ret; } + + + + +//////////////////////////////////////////////////////////////////////////////// +// InutStreamTransformerImpl // +//////////////////////////////////////////////////////////////////////////////// + + + +InputStreamTransformer::InputStreamTransformer( const Reference< XInputStream >& xInputStream ) + : m_xInputStream( xInputStream ), + m_xSeekable( xInputStream,UNO_QUERY ) +{ +} + + +InputStreamTransformer::~InputStreamTransformer() +{ +} + + +Any SAL_CALL InputStreamTransformer::queryInterface( const Type& rType ) throw( RuntimeException ) +{ + Any aRet; + if( m_xSeekable.is() ) + aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( XInputStream*,this ), + SAL_STATIC_CAST( XSeekable*,this ) ); + else + aRet = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( XInputStream*,this ) ); + + return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ); +} + + + +void SAL_CALL InputStreamTransformer::acquire( void ) throw( RuntimeException ) +{ + OWeakObject::acquire(); +} + + + +void SAL_CALL InputStreamTransformer::release( void ) throw( RuntimeException ) +{ + OWeakObject::release(); +} + + + +sal_Int32 SAL_CALL InputStreamTransformer::readBytes( Sequence< sal_Int8 >& aData,sal_Int32 nBytesToRead ) throw( NotConnectedException, + BufferSizeExceededException, + IOException, + RuntimeException) +{ + return m_xInputStream->readBytes( aData,nBytesToRead ); +} + + + +sal_Int32 SAL_CALL InputStreamTransformer::readSomeBytes( Sequence< sal_Int8 >& aData,sal_Int32 nMaxBytesToRead ) + throw( NotConnectedException, + BufferSizeExceededException, + IOException, + RuntimeException) +{ + return m_xInputStream->readSomeBytes( aData,nMaxBytesToRead ); +} + + + +void SAL_CALL InputStreamTransformer::skipBytes( sal_Int32 nBytesToSkip ) throw( NotConnectedException, + BufferSizeExceededException, + IOException, + RuntimeException ) +{ + m_xInputStream->skipBytes( nBytesToSkip ); +} + + + +sal_Int32 SAL_CALL InputStreamTransformer::available( void ) throw( NotConnectedException, + IOException, + RuntimeException ) +{ + return m_xInputStream->available(); +} + + + +void SAL_CALL InputStreamTransformer::closeInput( void ) throw( NotConnectedException, + IOException, + RuntimeException ) +{ + m_xInputStream->closeInput(); +} + + + +void SAL_CALL InputStreamTransformer::seek( sal_Int64 location ) throw( IllegalArgumentException, + IOException, + RuntimeException ) +{ + if( m_xSeekable.is() ) + m_xSeekable->seek( location ); +} + + + +sal_Int64 SAL_CALL InputStreamTransformer::getPosition( void ) throw( IOException, + RuntimeException ) +{ + if( m_xSeekable.is() ) + return m_xSeekable->getPosition(); +} + + + +sal_Int64 SAL_CALL InputStreamTransformer::getLength( void ) throw( IOException,RuntimeException ) +{ + if( m_xSeekable.is() ) + return m_xSeekable->getLength(); +} |