Index: sfxhtml.hxx
===================================================================
RCS file: /cvs/framework/sfx2/inc/sfx2/sfxhtml.hxx,v
retrieving revision 1.2
diff -u -r1.2 sfxhtml.hxx
--- sfxhtml.hxx 11 Apr 2007 21:28:52 -0000 1.2
+++ sfxhtml.hxx 18 May 2007 16:52:55 -0000
@@ -110,6 +110,7 @@
const String& aNumStr, SvNumberFormatter& rFormatter );
static rtl_TextEncoding GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader );
+ static SvKeyValueIterator* FakeHTMLHeader();
protected:
BOOL ParseMetaOptions( SfxDocumentInfo*, SvKeyValueIterator* );
@@ -154,7 +155,6 @@
static rtl_TextEncoding GetEncodingByMIME( const String& rMime );
BOOL SetEncodingByHTTPHeader( SvKeyValueIterator *pHTTPHeader );
};
inline BOOL SfxHTMLParser::ParseAreaOptions(ImageMap * pImageMap, const String& rBaseURL,
Index: sfxhtml.cxx
===================================================================
RCS file: /cvs/framework/sfx2/source/bastyp/sfxhtml.cxx,v
retrieving revision 1.17.158.3
diff -u -r1.17.158.3 sfxhtml.cxx
--- sfxhtml.cxx 14 Apr 2007 17:42:37 -0000 1.17.158.3
+++ sfxhtml.cxx 18 May 2007 16:51:22 -0000
@@ -611,6 +611,21 @@
return eRet;
}
+SvKeyValueIterator* SfxHTMLParser::FakeHTMLHeader()
+{
+ SvKeyValueIterator* pValues=0;
+ const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
+ if( pCharSet )
+ {
+ String aContentType = String::CreateFromAscii( "text/html; charset=" );
+ aContentType.AppendAscii( pCharSet );
+ pValues = new SvKeyValueIterator;
+ pValues->Append( SvKeyValue( String::CreateFromAscii( sHTML_META_content_type ), aContentType ) );
+ }
+
+ return pValues;
+}
+
BOOL SfxHTMLParser::SetEncodingByHTTPHeader(
SvKeyValueIterator *pHTTPHeader )
{
Index: swhtml.cxx
===================================================================
RCS file: /cvs/sw/sw/source/filter/html/swhtml.cxx,v
retrieving revision 1.40.134.1
diff -u -r1.40.134.1 swhtml.cxx
--- swhtml.cxx 27 Mar 2007 21:25:46 -0000 1.40.134.1
+++ swhtml.cxx 18 May 2007 17:07:22 -0000
@@ -501,8 +501,9 @@
else
{
SwDocShell *pDocSh = pDoc->GetDocShell();
- SvKeyValueIterator *pHeaderAttrs =
- pDocSh->GetHeaderAttributes();
+ SvKeyValueIterator *pHeaderAttrs = pDocSh->GetHeaderAttributes();
+ if( !pHeaderAttrs && !pDocSh->IsLoading() )
+ pHeaderAttrs = SfxHTMLParser::FakeHTMLHeader();
if( pHeaderAttrs )
SetEncodingByHTTPHeader( pHeaderAttrs );
}
Index: htmlpars.cxx
===================================================================
RCS file: /cvs/sc/sc/source/filter/html/htmlpars.cxx,v
retrieving revision 1.30
diff -u -r1.30 htmlpars.cxx
--- htmlpars.cxx 27 Feb 2007 12:31:23 -0000 1.30
+++ htmlpars.cxx 18 May 2007 16:53:46 -0000
@@ -178,17 +178,7 @@
{
// When not loading, set up fake http headers to force the SfxHTMLParser to use UTF8
// (used when pasting from clipboard)
-
- const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
- if( pCharSet )
- {
- String aContentType = String::CreateFromAscii( "text/html; charset=" );
- aContentType.AppendAscii( pCharSet );
-
- xValues = new SvKeyValueIterator;
- xValues->Append( SvKeyValue( String::CreateFromAscii( sHTML_META_content_type ), aContentType ) );
- pAttributes = xValues;
- }
+ pAttributes = SfxHTMLParser::FakeHTMLHeader();
}
ULONG nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_HTML, pAttributes );
@@ -2806,16 +2796,7 @@
{
/* When not loading, set up fake HTTP headers to force the SfxHTMLParser
to use UTF8 (used when pasting from clipboard) */
- const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
- if( pCharSet )
- {
- String aContentType = String::CreateFromAscii( "text/html; charset=" );
- aContentType.AppendAscii( pCharSet );
-
- xValues = new SvKeyValueIterator;
- xValues->Append( SvKeyValue( String::CreateFromAscii( sHTML_META_content_type ), aContentType ) );
- pAttributes = xValues;
- }
+ pAttributes = SfxHTMLParser::FakeHTMLHeader();
}
Link aOldLink = pEdit->GetImportHdl();