Change String to OUString in SwHTMLParser class
I changed some variables in SwHTMLParser class and her dependencies. Change-Id: Ie8ad6c481df8a904bd358c2e9cd6afeef990d418 Reviewed-on: https://gerrit.libreoffice.org/5330 Reviewed-by: Tor Lillqvist <tml@iki.fi> Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
committed by
Michael Stahl
parent
a745bfdb78
commit
7a504c8752
@@ -252,13 +252,13 @@ public:
|
|||||||
bool bSwitchToUCS2 = false,
|
bool bSwitchToUCS2 = false,
|
||||||
rtl_TextEncoding eEnc=RTL_TEXTENCODING_DONTKNOW );
|
rtl_TextEncoding eEnc=RTL_TEXTENCODING_DONTKNOW );
|
||||||
|
|
||||||
bool ParseScriptOptions( String& rLangString, const String&, HTMLScriptLanguage& rLang,
|
bool ParseScriptOptions( OUString& rLangString, const OUString&, HTMLScriptLanguage& rLang,
|
||||||
String& rSrc, String& rLibrary, String& rModule );
|
OUString& rSrc, OUString& rLibrary, OUString& rModule );
|
||||||
|
|
||||||
// Einen Kommentar um den Inhalt von <SCRIPT> oder <STYLE> entfernen
|
// Einen Kommentar um den Inhalt von <SCRIPT> oder <STYLE> entfernen
|
||||||
// Bei 'bFull' wird ggf. die gesammte Zeile hinter einem "<!--"
|
// Bei 'bFull' wird ggf. die gesammte Zeile hinter einem "<!--"
|
||||||
// entfernt (fuer JavaSript)
|
// entfernt (fuer JavaSript)
|
||||||
static void RemoveSGMLComment( String &rString, sal_Bool bFull );
|
static void RemoveSGMLComment( OUString &rString, sal_Bool bFull );
|
||||||
|
|
||||||
static bool InternalImgToPrivateURL( String& rURL );
|
static bool InternalImgToPrivateURL( String& rURL );
|
||||||
static rtl_TextEncoding GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader );
|
static rtl_TextEncoding GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader );
|
||||||
|
@@ -36,19 +36,19 @@ static HTMLOptionEnum const aScriptLangOptEnums[] =
|
|||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
bool HTMLParser::ParseScriptOptions( String& rLangString, const String& rBaseURL,
|
bool HTMLParser::ParseScriptOptions( OUString& rLangString, const OUString& rBaseURL,
|
||||||
HTMLScriptLanguage& rLang,
|
HTMLScriptLanguage& rLang,
|
||||||
String& rSrc,
|
OUString& rSrc,
|
||||||
String& rLibrary,
|
OUString& rLibrary,
|
||||||
String& rModule )
|
OUString& rModule )
|
||||||
{
|
{
|
||||||
const HTMLOptions& aScriptOptions = GetOptions();
|
const HTMLOptions& aScriptOptions = GetOptions();
|
||||||
|
|
||||||
rLangString.Erase();
|
rLangString = "";
|
||||||
rLang = HTML_SL_JAVASCRIPT;
|
rLang = HTML_SL_JAVASCRIPT;
|
||||||
rSrc.Erase();
|
rSrc = "";
|
||||||
rLibrary.Erase();
|
rLibrary = "";
|
||||||
rModule.Erase();
|
rModule = "";
|
||||||
|
|
||||||
for( size_t i = aScriptOptions.size(); i; )
|
for( size_t i = aScriptOptions.size(); i; )
|
||||||
{
|
{
|
||||||
@@ -82,71 +82,71 @@ bool HTMLParser::ParseScriptOptions( String& rLangString, const String& rBaseURL
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTMLParser::RemoveSGMLComment( String &rString, sal_Bool bFull )
|
void HTMLParser::RemoveSGMLComment( OUString &rString, sal_Bool bFull )
|
||||||
{
|
{
|
||||||
sal_Unicode c = 0;
|
sal_Unicode c = 0;
|
||||||
while( rString.Len() &&
|
while( !rString.isEmpty() &&
|
||||||
( ' '==(c=rString.GetChar(0)) || '\t'==c || '\r'==c || '\n'==c ) )
|
( ' '==(c=rString[0]) || '\t'==c || '\r'==c || '\n'==c ) )
|
||||||
rString.Erase( 0, 1 );
|
rString = rString.copy( 1, rString.getLength() - 1 );
|
||||||
|
|
||||||
while( rString.Len() &&
|
while( !rString.isEmpty() &&
|
||||||
( ' '==(c=rString.GetChar( rString.Len()-1))
|
( ' '==(c=rString[rString.getLength()-1])
|
||||||
|| '\t'==c || '\r'==c || '\n'==c ) )
|
|| '\t'==c || '\r'==c || '\n'==c ) )
|
||||||
rString.Erase( rString.Len()-1 );
|
rString = rString.copy( 0, rString.getLength()-1 );
|
||||||
|
|
||||||
|
|
||||||
// remove SGML comments
|
// remove SGML comments
|
||||||
if( rString.Len() >= 4 &&
|
if( rString.getLength() >= 4 &&
|
||||||
rString.CompareToAscii( "<!--", 4 ) == COMPARE_EQUAL )
|
rString.startsWith( "<!--" ) )
|
||||||
{
|
{
|
||||||
xub_StrLen nPos = 3;
|
sal_Int32 nPos = 3;
|
||||||
if( bFull )
|
if( bFull )
|
||||||
{
|
{
|
||||||
// the whole line
|
// the whole line
|
||||||
nPos = 4;
|
nPos = 4;
|
||||||
while( nPos < rString.Len() &&
|
while( nPos < rString.getLength() &&
|
||||||
( ( c = rString.GetChar( nPos )) != '\r' && c != '\n' ) )
|
( ( c = rString[nPos] ) != '\r' && c != '\n' ) )
|
||||||
++nPos;
|
++nPos;
|
||||||
if( c == '\r' && nPos+1 < rString.Len() &&
|
if( c == '\r' && nPos+1 < rString.getLength() &&
|
||||||
'\n' == rString.GetChar( nPos+1 ))
|
'\n' == rString[nPos+1] )
|
||||||
++nPos;
|
++nPos;
|
||||||
else if( c != '\n' )
|
else if( c != '\n' )
|
||||||
nPos = 3;
|
nPos = 3;
|
||||||
}
|
}
|
||||||
rString.Erase( 0, ++nPos );
|
++nPos;
|
||||||
|
rString = rString.copy( nPos, rString.getLength() - nPos );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( rString.Len() >=3 &&
|
if( rString.getLength() >=3 &&
|
||||||
rString.Copy(rString.Len()-3).CompareToAscii("-->")
|
rString.endsWith("-->") )
|
||||||
== COMPARE_EQUAL )
|
|
||||||
{
|
{
|
||||||
rString.Erase( rString.Len()-3 );
|
rString = rString.copy( 0, rString.getLength()-3 );
|
||||||
if( bFull )
|
if( bFull )
|
||||||
{
|
{
|
||||||
// "//" or "'", maybe preceding CR/LF
|
// "//" or "'", maybe preceding CR/LF
|
||||||
rString = comphelper::string::stripEnd(rString, ' ');
|
rString = comphelper::string::stripEnd(rString, ' ');
|
||||||
xub_StrLen nDel = 0, nLen = rString.Len();
|
sal_Int32 nDel = 0, nLen = rString.getLength();
|
||||||
if( nLen >= 2 &&
|
if( nLen >= 2 &&
|
||||||
rString.Copy(nLen-2).CompareToAscii("//") == COMPARE_EQUAL )
|
rString.endsWith("//") )
|
||||||
{
|
{
|
||||||
nDel = 2;
|
nDel = 2;
|
||||||
}
|
}
|
||||||
else if( nLen && '\'' == rString.GetChar(nLen-1) )
|
else if( nLen && '\'' == rString[nLen-1] )
|
||||||
{
|
{
|
||||||
nDel = 1;
|
nDel = 1;
|
||||||
}
|
}
|
||||||
if( nDel && nLen >= nDel+1 )
|
if( nDel && nLen >= nDel+1 )
|
||||||
{
|
{
|
||||||
c = rString.GetChar( nLen-(nDel+1) );
|
c = rString[nLen-(nDel+1)];
|
||||||
if( '\r'==c || '\n'==c )
|
if( '\r'==c || '\n'==c )
|
||||||
{
|
{
|
||||||
nDel++;
|
nDel++;
|
||||||
if( '\n'==c && nLen >= nDel+1 &&
|
if( '\n'==c && nLen >= nDel+1 &&
|
||||||
'\r'==rString.GetChar( nLen-(nDel+1) ) )
|
'\r'==rString[nLen-(nDel+1)] )
|
||||||
nDel++;
|
nDel++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rString.Erase( nLen-nDel );
|
rString = rString.copy( 0, nLen-nDel );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ void SwHTMLParser::NewScript()
|
|||||||
ParseScriptOptions( aScriptType, sBaseURL, eScriptLang, aScriptURL,
|
ParseScriptOptions( aScriptType, sBaseURL, eScriptLang, aScriptURL,
|
||||||
aBasicLib, aBasicModule );
|
aBasicLib, aBasicModule );
|
||||||
|
|
||||||
if( aScriptURL.Len() )
|
if( !aScriptURL.isEmpty() )
|
||||||
{
|
{
|
||||||
// Den Inhalt des Script-Tags ignorieren
|
// Den Inhalt des Script-Tags ignorieren
|
||||||
bIgnoreRawData = sal_True;
|
bIgnoreRawData = sal_True;
|
||||||
@@ -96,13 +96,13 @@ void SwHTMLParser::EndScript()
|
|||||||
(SwScriptFieldType*)pDoc->GetSysFldType( RES_SCRIPTFLD );
|
(SwScriptFieldType*)pDoc->GetSysFldType( RES_SCRIPTFLD );
|
||||||
|
|
||||||
SwScriptField aFld( pType, aScriptType,
|
SwScriptField aFld( pType, aScriptType,
|
||||||
aScriptURL.Len() ? aScriptURL : aScriptSource,
|
!aScriptURL.isEmpty() ? aScriptURL : aScriptSource,
|
||||||
aScriptURL.Len()!=0 );
|
!aScriptURL.isEmpty() );
|
||||||
InsertAttr( SwFmtFld( aFld ) );
|
InsertAttr( SwFmtFld( aFld ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
SwDocShell *pDocSh = pDoc->GetDocShell();
|
SwDocShell *pDocSh = pDoc->GetDocShell();
|
||||||
if( aScriptSource.Len() && pDocSh &&
|
if( !aScriptSource.isEmpty() && pDocSh &&
|
||||||
bInsIntoBasic && IsNewDoc() )
|
bInsIntoBasic && IsNewDoc() )
|
||||||
{
|
{
|
||||||
// Fuer JavaScript und StarBasic noch ein Basic-Modul anlegen
|
// Fuer JavaScript und StarBasic noch ein Basic-Modul anlegen
|
||||||
@@ -111,7 +111,7 @@ void SwHTMLParser::EndScript()
|
|||||||
|
|
||||||
// get library name
|
// get library name
|
||||||
OUString aLibName;
|
OUString aLibName;
|
||||||
if( aBasicLib.Len() )
|
if( !aBasicLib.isEmpty() )
|
||||||
aLibName = aBasicLib;
|
aLibName = aBasicLib;
|
||||||
else
|
else
|
||||||
aLibName = OUString("Standard");
|
aLibName = OUString("Standard");
|
||||||
@@ -136,13 +136,13 @@ void SwHTMLParser::EndScript()
|
|||||||
|
|
||||||
if ( xModLib.is() )
|
if ( xModLib.is() )
|
||||||
{
|
{
|
||||||
if( !aBasicModule.Len() )
|
if( aBasicModule.isEmpty() )
|
||||||
{
|
{
|
||||||
// create module name
|
// create module name
|
||||||
sal_Bool bFound = sal_True;
|
sal_Bool bFound = sal_True;
|
||||||
while( bFound )
|
while( bFound )
|
||||||
{
|
{
|
||||||
aBasicModule.AssignAscii( "Modul" );
|
aBasicModule = "Modul";
|
||||||
aBasicModule += OUString::number( (sal_Int32)(++nSBModuleCnt) );
|
aBasicModule += OUString::number( (sal_Int32)(++nSBModuleCnt) );
|
||||||
bFound = xModLib->hasByName( OUString( aBasicModule ) );
|
bFound = xModLib->hasByName( OUString( aBasicModule ) );
|
||||||
}
|
}
|
||||||
@@ -172,12 +172,12 @@ void SwHTMLParser::EndScript()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aScriptSource.Erase();
|
aScriptSource = "";
|
||||||
aScriptType.Erase();
|
aScriptType = "";
|
||||||
aScriptURL.Erase();
|
aScriptURL = "";
|
||||||
|
|
||||||
aBasicLib.Erase();
|
aBasicLib = "";
|
||||||
aBasicModule.Erase();
|
aBasicModule = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwHTMLParser::AddScriptSource()
|
void SwHTMLParser::AddScriptSource()
|
||||||
@@ -187,7 +187,7 @@ void SwHTMLParser::AddScriptSource()
|
|||||||
(HTML_SL_STARBASIC==eScriptLang && aToken.GetChar( 0 ) == '\'') )
|
(HTML_SL_STARBASIC==eScriptLang && aToken.GetChar( 0 ) == '\'') )
|
||||||
{
|
{
|
||||||
xub_StrLen nPos = STRING_NOTFOUND;
|
xub_StrLen nPos = STRING_NOTFOUND;
|
||||||
if( !aBasicLib.Len() )
|
if( aBasicLib.isEmpty() )
|
||||||
{
|
{
|
||||||
nPos = aToken.SearchAscii( OOO_STRING_SVTOOLS_HTML_SB_library );
|
nPos = aToken.SearchAscii( OOO_STRING_SVTOOLS_HTML_SB_library );
|
||||||
if( nPos != STRING_NOTFOUND )
|
if( nPos != STRING_NOTFOUND )
|
||||||
@@ -198,7 +198,7 @@ void SwHTMLParser::AddScriptSource()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !aBasicModule.Len() && nPos==STRING_NOTFOUND )
|
if( aBasicModule.isEmpty() && nPos==STRING_NOTFOUND )
|
||||||
{
|
{
|
||||||
nPos = aToken.SearchAscii( OOO_STRING_SVTOOLS_HTML_SB_module );
|
nPos = aToken.SearchAscii( OOO_STRING_SVTOOLS_HTML_SB_module );
|
||||||
if( nPos != STRING_NOTFOUND )
|
if( nPos != STRING_NOTFOUND )
|
||||||
@@ -211,17 +211,17 @@ void SwHTMLParser::AddScriptSource()
|
|||||||
|
|
||||||
if( nPos==STRING_NOTFOUND )
|
if( nPos==STRING_NOTFOUND )
|
||||||
{
|
{
|
||||||
if( aScriptSource.Len() )
|
if( !aScriptSource.isEmpty() )
|
||||||
aScriptSource += '\n';
|
aScriptSource += "\n";
|
||||||
(aScriptSource += aToken);
|
aScriptSource += aToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( aScriptSource.Len() || aToken.Len() )
|
else if( !aScriptSource.isEmpty() || aToken.Len() )
|
||||||
{
|
{
|
||||||
// Leerzeilen am Anfang werden ignoriert
|
// Leerzeilen am Anfang werden ignoriert
|
||||||
if( aScriptSource.Len() )
|
if( !aScriptSource.isEmpty() )
|
||||||
{
|
{
|
||||||
aScriptSource += '\n';
|
aScriptSource += "\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -1708,10 +1708,10 @@ void SwHTMLParser::EndStyle()
|
|||||||
{
|
{
|
||||||
bIgnoreRawData = sal_False;
|
bIgnoreRawData = sal_False;
|
||||||
|
|
||||||
if( aStyleSource.Len() )
|
if( !aStyleSource.isEmpty() )
|
||||||
{
|
{
|
||||||
pCSS1Parser->ParseStyleSheet( aStyleSource );
|
pCSS1Parser->ParseStyleSheet( aStyleSource );
|
||||||
aStyleSource.Erase();
|
aStyleSource = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -261,7 +261,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
|
|||||||
{
|
{
|
||||||
|
|
||||||
OSL_ENSURE( !pMarquee, "Marquee in Marquee???" );
|
OSL_ENSURE( !pMarquee, "Marquee in Marquee???" );
|
||||||
aContents.Erase();
|
aContents = "";
|
||||||
|
|
||||||
String aId, aStyle, aClass;
|
String aId, aStyle, aClass;
|
||||||
|
|
||||||
@@ -572,7 +572,7 @@ void SwHTMLParser::EndMarquee()
|
|||||||
((SdrTextObj*)pMarquee)->FitFrameToTextSize();
|
((SdrTextObj*)pMarquee)->FitFrameToTextSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
aContents.Erase();
|
aContents = "";
|
||||||
pMarquee = 0;
|
pMarquee = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -574,7 +574,7 @@ void SwHTMLParser::EndField()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bInField = sal_False;
|
bInField = sal_False;
|
||||||
aContents.Erase();
|
aContents = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwHTMLParser::InsertFieldText()
|
void SwHTMLParser::InsertFieldText()
|
||||||
@@ -588,18 +588,15 @@ void SwHTMLParser::InsertFieldText()
|
|||||||
|
|
||||||
void SwHTMLParser::InsertCommentText( const sal_Char *pTag )
|
void SwHTMLParser::InsertCommentText( const sal_Char *pTag )
|
||||||
{
|
{
|
||||||
sal_Bool bEmpty = aContents.Len() == 0;
|
sal_Bool bEmpty = aContents.isEmpty();
|
||||||
if( !bEmpty )
|
if( !bEmpty )
|
||||||
aContents += '\n';
|
aContents += "\n";
|
||||||
|
|
||||||
aContents += aToken;
|
aContents += aToken;
|
||||||
if( bEmpty && pTag )
|
if( bEmpty && pTag )
|
||||||
{
|
{
|
||||||
String aTmp( aContents );
|
OUString aTmp( aContents );
|
||||||
aContents.AssignAscii( "HTML: <" );
|
aContents = "HTML: <" + OUString( *pTag ) + ">" + aTmp;
|
||||||
aContents.AppendAscii( pTag );
|
|
||||||
aContents.Append( '>' );
|
|
||||||
aContents.Append( aTmp );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -433,7 +433,7 @@ IMAGE_SETEVENT:
|
|||||||
// einer Bullet-Liste
|
// einer Bullet-Liste
|
||||||
if( !pPam->GetPoint()->nContent.GetIndex() &&
|
if( !pPam->GetPoint()->nContent.GetIndex() &&
|
||||||
GetNumInfo().GetDepth() > 0 && GetNumInfo().GetDepth() <= MAXLEVEL &&
|
GetNumInfo().GetDepth() > 0 && GetNumInfo().GetDepth() <= MAXLEVEL &&
|
||||||
aBulletGrfs[GetNumInfo().GetDepth()-1].Len() &&
|
!aBulletGrfs[GetNumInfo().GetDepth()-1].isEmpty() &&
|
||||||
aBulletGrfs[GetNumInfo().GetDepth()-1]==sGrfNm )
|
aBulletGrfs[GetNumInfo().GetDepth()-1]==sGrfNm )
|
||||||
{
|
{
|
||||||
SwTxtNode* pTxtNode = pPam->GetNode()->GetTxtNode();
|
SwTxtNode* pTxtNode = pPam->GetNode()->GetTxtNode();
|
||||||
|
@@ -279,7 +279,7 @@ void SwHTMLParser::NewNumBulList( int nToken )
|
|||||||
bChangeNumFmt = sal_True;
|
bChangeNumFmt = sal_True;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
aBulletGrfs[nLevel].Erase();
|
aBulletGrfs[nLevel] = "";
|
||||||
|
|
||||||
// den aktuellen Absatz erst einmal nicht numerieren
|
// den aktuellen Absatz erst einmal nicht numerieren
|
||||||
{
|
{
|
||||||
|
@@ -238,8 +238,8 @@ sal_uLong HTMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, co
|
|||||||
|
|
||||||
|
|
||||||
SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCrsr, SvStream& rIn,
|
SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCrsr, SvStream& rIn,
|
||||||
const String& rPath,
|
const OUString& rPath,
|
||||||
const String& rBaseURL,
|
const OUString& rBaseURL,
|
||||||
int bReadNewDoc,
|
int bReadNewDoc,
|
||||||
SfxMedium* pMed, sal_Bool bReadUTF8,
|
SfxMedium* pMed, sal_Bool bReadUTF8,
|
||||||
sal_Bool bNoHTMLComments )
|
sal_Bool bNoHTMLComments )
|
||||||
@@ -370,19 +370,17 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCrsr, SvStream& rIn,
|
|||||||
if( pMed )
|
if( pMed )
|
||||||
{
|
{
|
||||||
sJmpMark = pMed->GetURLObject().GetMark();
|
sJmpMark = pMed->GetURLObject().GetMark();
|
||||||
if( sJmpMark.Len() )
|
if( !sJmpMark.isEmpty() )
|
||||||
{
|
{
|
||||||
eJumpTo = JUMPTO_MARK;
|
eJumpTo = JUMPTO_MARK;
|
||||||
xub_StrLen nLastPos, nPos = 0;
|
sal_Int32 nLastPos = sJmpMark.lastIndexOf( cMarkSeparator );
|
||||||
while( STRING_NOTFOUND != ( nLastPos =
|
sal_Int32 nPos = nLastPos != -1 ? nLastPos : 0;
|
||||||
sJmpMark.Search( cMarkSeparator, nPos + 1 )) )
|
|
||||||
nPos = nLastPos;
|
|
||||||
|
|
||||||
String sCmp;
|
String sCmp;
|
||||||
if (nPos)
|
if (nPos)
|
||||||
{
|
{
|
||||||
sCmp = comphelper::string::remove(
|
sCmp = comphelper::string::remove(
|
||||||
sJmpMark.Copy(nPos + 1), ' ');
|
sJmpMark.copy(nPos + 1), ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sCmp.Len() )
|
if( sCmp.Len() )
|
||||||
@@ -400,13 +398,14 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCrsr, SvStream& rIn,
|
|||||||
eJumpTo = JUMPTO_NONE; // das ist nichts gueltiges!
|
eJumpTo = JUMPTO_NONE; // das ist nichts gueltiges!
|
||||||
else
|
else
|
||||||
// ansonsten ist das ein normaler (Book)Mark
|
// ansonsten ist das ein normaler (Book)Mark
|
||||||
nPos = STRING_LEN;
|
nPos = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nPos = STRING_LEN;
|
nPos = -1;
|
||||||
|
|
||||||
sJmpMark.Erase( nPos );
|
if( nPos != -1 )
|
||||||
if( !sJmpMark.Len() )
|
sJmpMark = sJmpMark.copy( 0, nPos );
|
||||||
|
if( sJmpMark.isEmpty() )
|
||||||
eJumpTo = JUMPTO_NONE;
|
eJumpTo = JUMPTO_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -639,7 +638,7 @@ void SwHTMLParser::Continue( int nToken )
|
|||||||
{
|
{
|
||||||
// noch die letzten Attribute setzen
|
// noch die letzten Attribute setzen
|
||||||
{
|
{
|
||||||
if( aScriptSource.Len() )
|
if( !aScriptSource.isEmpty() )
|
||||||
{
|
{
|
||||||
SwScriptFieldType *pType =
|
SwScriptFieldType *pType =
|
||||||
(SwScriptFieldType*)pDoc->GetSysFldType( RES_SCRIPTFLD );
|
(SwScriptFieldType*)pDoc->GetSysFldType( RES_SCRIPTFLD );
|
||||||
@@ -988,7 +987,7 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
switch( nToken )
|
switch( nToken )
|
||||||
{
|
{
|
||||||
case HTML_TITLE_OFF:
|
case HTML_TITLE_OFF:
|
||||||
if( IsNewDoc() && sTitle.Len() )
|
if( IsNewDoc() && !sTitle.isEmpty() )
|
||||||
{
|
{
|
||||||
if( pDoc->GetDocShell() ) {
|
if( pDoc->GetDocShell() ) {
|
||||||
uno::Reference<document::XDocumentPropertiesSupplier>
|
uno::Reference<document::XDocumentPropertiesSupplier>
|
||||||
@@ -1005,15 +1004,15 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bInTitle = sal_False;
|
bInTitle = sal_False;
|
||||||
sTitle.Erase();
|
sTitle = "";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTML_NONBREAKSPACE:
|
case HTML_NONBREAKSPACE:
|
||||||
sTitle += ' ';
|
sTitle += " ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTML_SOFTHYPH:
|
case HTML_SOFTHYPH:
|
||||||
sTitle += '-';
|
sTitle += "-";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTML_TEXTTOKEN:
|
case HTML_TEXTTOKEN:
|
||||||
@@ -1021,16 +1020,16 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
sTitle += '<';
|
sTitle += "<";
|
||||||
if( (HTML_TOKEN_ONOFF & nToken) && (1 & nToken) )
|
if( (HTML_TOKEN_ONOFF & nToken) && (1 & nToken) )
|
||||||
sTitle += '/';
|
sTitle += "/";
|
||||||
sTitle += sSaveToken;
|
sTitle += sSaveToken;
|
||||||
if( aToken.Len() )
|
if( aToken.Len() )
|
||||||
{
|
{
|
||||||
sTitle += ' ';
|
sTitle += " ";
|
||||||
sTitle += aToken;
|
sTitle += aToken;
|
||||||
}
|
}
|
||||||
sTitle += '>';
|
sTitle += ">";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1071,7 +1070,7 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
case HTML_NOEMBED_OFF:
|
case HTML_NOEMBED_OFF:
|
||||||
aContents = convertLineEnd(aContents, GetSystemLineEnd());
|
aContents = convertLineEnd(aContents, GetSystemLineEnd());
|
||||||
InsertComment( aContents, OOO_STRING_SVTOOLS_HTML_noembed );
|
InsertComment( aContents, OOO_STRING_SVTOOLS_HTML_noembed );
|
||||||
aContents.Erase();
|
aContents = "";
|
||||||
bCallNextToken = sal_False;
|
bCallNextToken = sal_False;
|
||||||
bInNoEmbed = sal_False;
|
bInNoEmbed = sal_False;
|
||||||
break;
|
break;
|
||||||
@@ -1212,7 +1211,7 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( aUnknownToken.Len() )
|
else if( !aUnknownToken.isEmpty() )
|
||||||
{
|
{
|
||||||
// Paste content of unknown tags.
|
// Paste content of unknown tags.
|
||||||
// (but surely if we are not in the header section) fdo#36080 fdo#34666
|
// (but surely if we are not in the header section) fdo#36080 fdo#34666
|
||||||
@@ -1236,18 +1235,18 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
switch( nToken )
|
switch( nToken )
|
||||||
{
|
{
|
||||||
case HTML_UNKNOWNCONTROL_OFF:
|
case HTML_UNKNOWNCONTROL_OFF:
|
||||||
if( aUnknownToken.CompareTo(sSaveToken) != COMPARE_EQUAL )
|
if( aUnknownToken.startsWith(sSaveToken) )
|
||||||
return;
|
return;
|
||||||
case HTML_FRAMESET_ON:
|
case HTML_FRAMESET_ON:
|
||||||
case HTML_HEAD_OFF:
|
case HTML_HEAD_OFF:
|
||||||
case HTML_BODY_ON:
|
case HTML_BODY_ON:
|
||||||
case HTML_IMAGE: // Don't know why Netscape acts this way.
|
case HTML_IMAGE: // Don't know why Netscape acts this way.
|
||||||
aUnknownToken.Erase();
|
aUnknownToken = "";
|
||||||
break;
|
break;
|
||||||
case HTML_TEXTTOKEN:
|
case HTML_TEXTTOKEN:
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
aUnknownToken.Erase();
|
aUnknownToken = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1256,10 +1255,10 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
switch( nToken )
|
switch( nToken )
|
||||||
{
|
{
|
||||||
case HTML_BODY_ON:
|
case HTML_BODY_ON:
|
||||||
if( aStyleSource.Len() )
|
if( !aStyleSource.isEmpty() )
|
||||||
{
|
{
|
||||||
pCSS1Parser->ParseStyleSheet( aStyleSource );
|
pCSS1Parser->ParseStyleSheet( aStyleSource );
|
||||||
aStyleSource.Erase();
|
aStyleSource = "";
|
||||||
}
|
}
|
||||||
if( IsNewDoc() )
|
if( IsNewDoc() )
|
||||||
{
|
{
|
||||||
@@ -1377,8 +1376,8 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
}
|
}
|
||||||
else if( IsReadStyle() )
|
else if( IsReadStyle() )
|
||||||
{
|
{
|
||||||
if( aStyleSource.Len() )
|
if( !aStyleSource.isEmpty() )
|
||||||
aStyleSource += '\n';
|
aStyleSource += "\n";
|
||||||
aStyleSource += aToken;
|
aStyleSource += aToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1884,10 +1883,10 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HTML_HEAD_OFF:
|
case HTML_HEAD_OFF:
|
||||||
if( aStyleSource.Len() )
|
if( !aStyleSource.isEmpty() )
|
||||||
{
|
{
|
||||||
pCSS1Parser->ParseStyleSheet( aStyleSource );
|
pCSS1Parser->ParseStyleSheet( aStyleSource );
|
||||||
aStyleSource.Erase();
|
aStyleSource = "";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2009,7 +2008,7 @@ void SwHTMLParser::NextToken( int nToken )
|
|||||||
// does not start with a '!'.
|
// does not start with a '!'.
|
||||||
// (but judging from the code, also if does not start with a '%')
|
// (but judging from the code, also if does not start with a '%')
|
||||||
// (and also if we're not somewhere we consider PRE)
|
// (and also if we're not somewhere we consider PRE)
|
||||||
if( IsInHeader() && !IsReadPRE() && !aUnknownToken.Len() &&
|
if( IsInHeader() && !IsReadPRE() && aUnknownToken.isEmpty() &&
|
||||||
sSaveToken.Len() && '!' != sSaveToken.GetChar(0) &&
|
sSaveToken.Len() && '!' != sSaveToken.GetChar(0) &&
|
||||||
'%' != sSaveToken.GetChar(0) )
|
'%' != sSaveToken.GetChar(0) )
|
||||||
aUnknownToken = sSaveToken;
|
aUnknownToken = sSaveToken;
|
||||||
|
@@ -352,20 +352,20 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
|
|||||||
friend class _CellSaveStruct;
|
friend class _CellSaveStruct;
|
||||||
friend class _CaptionSaveStruct;
|
friend class _CaptionSaveStruct;
|
||||||
|
|
||||||
String aPathToFile;
|
OUString aPathToFile;
|
||||||
String sBaseURL;
|
OUString sBaseURL;
|
||||||
String sSaveBaseURL;
|
OUString sSaveBaseURL;
|
||||||
String aBasicLib;
|
OUString aBasicLib;
|
||||||
String aBasicModule;
|
OUString aBasicModule;
|
||||||
String aScriptSource; // Inhalt des aktuellen Script-Blocks
|
OUString aScriptSource; // Inhalt des aktuellen Script-Blocks
|
||||||
String aScriptType; // Type des gelesenen Scripts (StarBasic/VB/JAVA)
|
OUString aScriptType; // Type des gelesenen Scripts (StarBasic/VB/JAVA)
|
||||||
String aScriptURL; // URL eines Scripts
|
OUString aScriptURL; // URL eines Scripts
|
||||||
String aStyleSource; // Inhalt des aktuellen Style-Sheets
|
OUString aStyleSource; // Inhalt des aktuellen Style-Sheets
|
||||||
String aContents; // Text des akteullen Marquee, Feldes etc.
|
OUString aContents; // Text des akteullen Marquee, Feldes etc.
|
||||||
String sTitle;
|
OUString sTitle;
|
||||||
String aUnknownToken; // ein gestartetes unbekanntes Token
|
OUString aUnknownToken; // ein gestartetes unbekanntes Token
|
||||||
String aBulletGrfs[MAXLEVEL];
|
OUString aBulletGrfs[MAXLEVEL];
|
||||||
String sJmpMark;
|
OUString sJmpMark;
|
||||||
|
|
||||||
std::vector<sal_uInt16> aBaseFontStack; // Stack fuer <BASEFONT>
|
std::vector<sal_uInt16> aBaseFontStack; // Stack fuer <BASEFONT>
|
||||||
// Bit 0-2: Fontgroesse (1-7)
|
// Bit 0-2: Fontgroesse (1-7)
|
||||||
@@ -895,8 +895,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
SwHTMLParser( SwDoc* pD, SwPaM & rCrsr, SvStream& rIn,
|
SwHTMLParser( SwDoc* pD, SwPaM & rCrsr, SvStream& rIn,
|
||||||
const String& rFileName,
|
const OUString& rFileName,
|
||||||
const String& rBaseURL,
|
const OUString& rBaseURL,
|
||||||
int bReadNewDoc = sal_True,
|
int bReadNewDoc = sal_True,
|
||||||
SfxMedium* pMed = 0, sal_Bool bReadUTF8 = sal_False,
|
SfxMedium* pMed = 0, sal_Bool bReadUTF8 = sal_False,
|
||||||
sal_Bool bIgnoreHTMLComments = sal_False );
|
sal_Bool bIgnoreHTMLComments = sal_False );
|
||||||
|
Reference in New Issue
Block a user