diff options
author | Peter Burow <pb@openoffice.org> | 2001-08-10 07:52:07 +0000 |
---|---|---|
committer | Peter Burow <pb@openoffice.org> | 2001-08-10 07:52:07 +0000 |
commit | 1568e90d1d9b17cfba3a9b86106bb3e915ee37d3 (patch) | |
tree | 6284c42f54119a8d4d62c3b0ec5d9a682b0a73aa /sfx2 | |
parent | 49ceb0071b23b45a395a83afaf8b983559500170 (diff) |
fix: #89507# #88139# GetActiveHelpString() added
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/bastyp/helper.cxx | 44 | ||||
-rw-r--r-- | sfx2/source/inc/helper.hxx | 5 |
2 files changed, 45 insertions, 4 deletions
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index 8cdd3b1e53d6..666427cd2344 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: helper.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: pb $ $Date: 2001-07-14 12:36:34 $ + * last change: $Author: pb $ $Date: 2001-08-10 08:52:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,9 +103,15 @@ #ifndef _COM_SUN_STAR_UTIL_DATETIME_HPP_ #include <com/sun/star/util/DateTime.hpp> #endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_ +#include <com/sun/star/io/XInputStream.hpp> +#endif #ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX #include <unotools/localedatawrapper.hxx> #endif +#ifndef _RTL_STRBUF_HXX_ +#include <rtl/strbuf.hxx> +#endif #include <tools/ref.hxx> #include <tools/debug.hxx> @@ -725,6 +731,40 @@ Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const String& rU // ----------------------------------------------------------------------- +String SfxContentHelper::GetActiveHelpString( const String& rURL ) +{ + String aRet; + try + { + Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + Reference< XInteractionHandler > xInteractionHandler = Reference< XInteractionHandler > ( + xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler") ) ), UNO_QUERY ); + Content aCnt( rURL, new ::ucb::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ) ); + // open the "active help" stream + Reference< ::com::sun::star::io::XInputStream > xStream = aCnt.openStream(); + // and convert it to a String + Sequence< sal_Int8 > lData; + sal_Int32 nRead = xStream->readBytes( lData, 1024 ); + while ( nRead > 0 ) + { + OStringBuffer sBuffer( nRead ); + for( sal_Int32 i = 0; i < nRead; ++i ) + sBuffer.append( (sal_Char)lData[i] ); + OUString sString = OStringToOUString( sBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); + aRet += String( sString ); + + nRead = xStream->readBytes( lData, 1024 ); + } + } + catch( ::com::sun::star::uno::Exception& ) + { + } + + return aRet; +} + +// ----------------------------------------------------------------------- + sal_Bool SfxContentHelper::CopyTo( const String& rSource, const String& rDest ) { return Transfer_Impl( rSource, rDest, sal_False, NameClash::ERROR ); diff --git a/sfx2/source/inc/helper.hxx b/sfx2/source/inc/helper.hxx index 01e43bce68cd..b54d9b1f8b9a 100644 --- a/sfx2/source/inc/helper.hxx +++ b/sfx2/source/inc/helper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: helper.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: pb $ $Date: 2001-08-10 08:49:49 $ + * last change: $Author: pb $ $Date: 2001-08-10 08:51:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -96,6 +96,7 @@ public: GetResultSet( const String& rURL ); static ::com::sun::star::uno::Sequence< ::rtl::OUString > GetHelpTreeViewContents( const String& rURL ); + static String GetActiveHelpString( const String& rURL ); static sal_Bool CopyTo( const String& rSource, const String& rDest ); |