mieclip.cxx (24c56ab9) mieclip.cxx (0f059bb0)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 30 unchanged lines hidden (view full) ---

39
40SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream )
41{
42 sal_Bool bRet = sal_False;
43 if( pStrm )
44 delete pStrm, pStrm = 0;
45
46 ByteString sLine, sVersion;
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 30 unchanged lines hidden (view full) ---

39
40SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream )
41{
42 sal_Bool bRet = sal_False;
43 if( pStrm )
44 delete pStrm, pStrm = 0;
45
46 ByteString sLine, sVersion;
47 sal_uIntPtr nStt = 0, nEnd = 0;
47 sal_Int32 nStt = -1, nEnd = -1;
48 sal_Int32 nStartFragment = 0, nEndFragment = 0;
48 sal_uInt16 nIndex = 0;
49
50 rStream.Seek(STREAM_SEEK_TO_BEGIN);
51 rStream.ResetError();
52
53 if( rStream.ReadLine( sLine ) &&
54 sLine.GetToken( 0, ':', nIndex ) == "Version" )
55 {
56 sVersion = sLine.Copy( nIndex );
57 while( rStream.ReadLine( sLine ) )
58 {
59 nIndex = 0;
60 ByteString sTmp( sLine.GetToken( 0, ':', nIndex ) );
61 if( sTmp == "StartHTML" )
49 sal_uInt16 nIndex = 0;
50
51 rStream.Seek(STREAM_SEEK_TO_BEGIN);
52 rStream.ResetError();
53
54 if( rStream.ReadLine( sLine ) &&
55 sLine.GetToken( 0, ':', nIndex ) == "Version" )
56 {
57 sVersion = sLine.Copy( nIndex );
58 while( rStream.ReadLine( sLine ) )
59 {
60 nIndex = 0;
61 ByteString sTmp( sLine.GetToken( 0, ':', nIndex ) );
62 if( sTmp == "StartHTML" )
62 nStt = (sal_uIntPtr)(sLine.Erase( 0, nIndex ).ToInt32());
63 nStt = sLine.Erase( 0, nIndex ).ToInt32();
63 else if( sTmp == "EndHTML" )
64 else if( sTmp == "EndHTML" )
64 nEnd = (sal_uIntPtr)(sLine.Erase( 0, nIndex ).ToInt32());
65 nEnd = sLine.Erase( 0, nIndex ).ToInt32();
66 else if( sTmp == "StartFragment" )
67 {
68 nStartFragment = sLine.Erase( 0, nIndex ).ToInt32();
69 if( nStt == -1 )
70 nStt = nStartFragment;
71 }
72 else if( sTmp == "EndFragment" )
73 {
74 nEndFragment = sLine.Erase( 0, nIndex ).ToInt32();
75 if (nEnd == -1 )
76 nEnd = nEndFragment;
77 }
65 else if( sTmp == "SourceURL" )
66 sBaseURL = String( sLine.Erase( 0, nIndex ), RTL_TEXTENCODING_UTF8);
67
78 else if( sTmp == "SourceURL" )
79 sBaseURL = String( sLine.Erase( 0, nIndex ), RTL_TEXTENCODING_UTF8);
80
68 if( nEnd && nStt &&
69 ( sBaseURL.Len() || rStream.Tell() >= nStt ))
81 if( nEnd >= 0 && nStt >= 0 &&
82 ( sBaseURL.Len() || rStream.Tell() >= (sal_uInt32)nStt ))
70 {
71 bRet = sal_True;
72 break;
73 }
74 }
75 }
76
77 if( bRet )

--- 14 unchanged lines hidden ---
83 {
84 bRet = sal_True;
85 break;
86 }
87 }
88 }
89
90 if( bRet )

--- 14 unchanged lines hidden ---