diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/mieclip.hxx | 10 | ||||
-rw-r--r-- | sfx2/source/bastyp/mieclip.cxx | 92 |
2 files changed, 59 insertions, 43 deletions
diff --git a/sfx2/inc/mieclip.hxx b/sfx2/inc/mieclip.hxx index 435dc0fc1526..9b211c2f4b7a 100644 --- a/sfx2/inc/mieclip.hxx +++ b/sfx2/inc/mieclip.hxx @@ -2,9 +2,9 @@ * * $RCSfile: mieclip.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:52:23 $ + * last change: $Author: jp $ $Date: 2001-02-02 13:41:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,8 +83,11 @@ public: MSE40HTMLClipFormatObj() : pStrm(0) {} ~MSE40HTMLClipFormatObj(); +//JP 31.01.2001: old interfaces BOOL GetData( SotDataObject& ); BOOL GetData( SvData& ); +//JP 31.01.2001: the new one + SvStream* IsValid( SvStream& ); const SvStream* GetStream() const { return pStrm; } SvStream* GetStream() { return pStrm; } @@ -96,6 +99,9 @@ public: // /* $Log: not supported by cvs2svn $ + Revision 1.1.1.1 2000/09/18 16:52:23 hr + initial import + Revision 1.8 2000/09/17 16:47:07 willem.vandorp OpenOffice header added. diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 1b5b6dccf222..dff96844e3bd 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -2,9 +2,9 @@ * * $RCSfile: mieclip.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:52:28 $ + * last change: $Author: jp $ $Date: 2001-02-02 13:41:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,59 +102,69 @@ BOOL MSE40HTMLClipFormatObj::GetData( SvData& rData ) SvStorageStreamRef xStrm; rData.GetData( (SvStorageStreamRef&)xStrm ); if( xStrm.Is() ) - { - ByteString sLine, sVersion; - ULONG nStt = 0, nEnd = 0; - USHORT nIndex = 0; + IsValid( *xStrm ); + return 0 != pStrm; +} + +SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) +{ + BOOL bRet = FALSE; + if( pStrm ) + delete pStrm, pStrm = 0; + + ByteString sLine, sVersion; + ULONG nStt = 0, nEnd = 0; + USHORT nIndex = 0; - xStrm->Seek(STREAM_SEEK_TO_BEGIN); - xStrm->ResetError(); + rStream.Seek(STREAM_SEEK_TO_BEGIN); + rStream.ResetError(); - if( xStrm->ReadLine( sLine ) && - sLine.GetToken( 0, ':', nIndex ) == "Version" ) + if( rStream.ReadLine( sLine ) && + sLine.GetToken( 0, ':', nIndex ) == "Version" ) + { + sVersion = sLine.Copy( nIndex ); + while( rStream.ReadLine( sLine ) ) { - sVersion = sLine.Copy( nIndex ); - while( xStrm->ReadLine( sLine ) ) + nIndex = 0; + ByteString sTmp( sLine.GetToken( 0, ':', nIndex ) ); + if( sTmp == "StartHTML" ) + nStt = (ULONG)(sLine.Erase( 0, nIndex ).ToInt32()); + else if( sTmp == "EndHTML" ) + nEnd = (ULONG)(sLine.Erase( 0, nIndex ).ToInt32()); + else if( sTmp == "SourceURL" ) + sBaseURL = String(S2U(sLine.Erase( 0, nIndex ))); + + if( nEnd && nStt && + ( sBaseURL.Len() || rStream.Tell() >= nStt )) { - nIndex = 0; - ByteString sTmp( sLine.GetToken( 0, ':', nIndex ) ); - if( sTmp == "StartHTML" ) - nStt = (ULONG)(sLine.Erase( 0, nIndex ).ToInt32()); - else if( sTmp == "EndHTML" ) - nEnd = (ULONG)(sLine.Erase( 0, nIndex ).ToInt32()); - else if( sTmp == "SourceURL" ) - sBaseURL = String(S2U(sLine.Erase( 0, nIndex ))); - - if( nEnd && nStt && - ( sBaseURL.Len() || xStrm->Tell() >= nStt )) - { - bRet = TRUE; - break; - } + bRet = TRUE; + break; } } + } - if( bRet ) - { - xStrm->Seek( nStt ); - - pStrm = new SvCacheStream( ( nEnd - nStt < 0x10000l - ? nEnd - nStt + 32 - : 0 )); - *pStrm << *xStrm; - pStrm->SetStreamSize( nEnd - nStt ); - pStrm->Seek( STREAM_SEEK_TO_BEGIN ); - - bRet = TRUE; - } + if( bRet ) + { + rStream.Seek( nStt ); + + pStrm = new SvCacheStream( ( nEnd - nStt < 0x10000l + ? nEnd - nStt + 32 + : 0 )); + *pStrm << rStream; + pStrm->SetStreamSize( nEnd - nStt ); + pStrm->Seek( STREAM_SEEK_TO_BEGIN ); } - return bRet; + + return pStrm; } //////////////////////////////////////////////////////////////////////////////// // /* $Log: not supported by cvs2svn $ +/* Revision 1.1.1.1 2000/09/18 16:52:28 hr +/* initial import +/* /* Revision 1.9 2000/09/17 16:47:18 willem.vandorp /* OpenOffice header added. /* |