Lines 157-183
Link Here
|
157 |
SfxObjectShell* pObjSh = mpDoc->GetDocumentShell(); |
157 |
SfxObjectShell* pObjSh = mpDoc->GetDocumentShell(); |
158 |
BOOL bLoading = pObjSh && pObjSh->IsLoading(); |
158 |
BOOL bLoading = pObjSh && pObjSh->IsLoading(); |
159 |
|
159 |
|
160 |
SvKeyValueIteratorRef xValues; |
160 |
SvKeyValueIterator* pAttributes = bLoading ? pObjSh->GetHeaderAttributes() : 0; |
161 |
SvKeyValueIterator* pAttributes = NULL; |
|
|
162 |
if ( bLoading ) |
163 |
pAttributes = pObjSh->GetHeaderAttributes(); |
164 |
else |
165 |
{ |
166 |
// When not loading, set up fake http headers to force the SfxHTMLParser to use UTF8 |
167 |
// (used when pasting from clipboard) |
168 |
|
169 |
const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 ); |
170 |
if( pCharSet ) |
171 |
{ |
172 |
String aContentType = String::CreateFromAscii( "text/html; charset=" ); |
173 |
aContentType.AppendAscii( pCharSet ); |
174 |
|
175 |
xValues = new SvKeyValueIterator; |
176 |
xValues->Append( SvKeyValue( String::CreateFromAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) ); |
177 |
pAttributes = xValues; |
178 |
} |
179 |
} |
180 |
|
181 |
ULONG nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_HTML, pAttributes ); |
161 |
ULONG nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_HTML, pAttributes ); |
182 |
|
162 |
|
183 |
pEdit->SetImportHdl( aOldLink ); |
163 |
pEdit->SetImportHdl( aOldLink ); |
Lines 2796-2825
Link Here
|
2796 |
|
2776 |
|
2797 |
ULONG ScHTMLQueryParser::Read( SvStream& rStrm, const String& rBaseURL ) |
2777 |
ULONG ScHTMLQueryParser::Read( SvStream& rStrm, const String& rBaseURL ) |
2798 |
{ |
2778 |
{ |
2799 |
SvKeyValueIteratorRef xValues; |
|
|
2800 |
SvKeyValueIterator* pAttributes = 0; |
2801 |
|
2802 |
SfxObjectShell* pObjSh = mpDoc->GetDocumentShell(); |
2779 |
SfxObjectShell* pObjSh = mpDoc->GetDocumentShell(); |
2803 |
if( pObjSh && pObjSh->IsLoading() ) |
2780 |
SvKeyValueIterator* pAttributes = (pObjSh && pObjSh->IsLoading()) ? pObjSh->GetHeaderAttributes() : 0; |
2804 |
{ |
|
|
2805 |
pAttributes = pObjSh->GetHeaderAttributes(); |
2806 |
} |
2807 |
else |
2808 |
{ |
2809 |
/* When not loading, set up fake HTTP headers to force the SfxHTMLParser |
2810 |
to use UTF8 (used when pasting from clipboard) */ |
2811 |
const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 ); |
2812 |
if( pCharSet ) |
2813 |
{ |
2814 |
String aContentType = String::CreateFromAscii( "text/html; charset=" ); |
2815 |
aContentType.AppendAscii( pCharSet ); |
2816 |
|
2817 |
xValues = new SvKeyValueIterator; |
2818 |
xValues->Append( SvKeyValue( String::CreateFromAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) ); |
2819 |
pAttributes = xValues; |
2820 |
} |
2821 |
} |
2822 |
|
2823 |
Link aOldLink = pEdit->GetImportHdl(); |
2781 |
Link aOldLink = pEdit->GetImportHdl(); |
2824 |
pEdit->SetImportHdl( LINK( this, ScHTMLQueryParser, HTMLImportHdl ) ); |
2782 |
pEdit->SetImportHdl( LINK( this, ScHTMLQueryParser, HTMLImportHdl ) ); |
2825 |
ULONG nErr = pEdit->Read( rStrm, rBaseURL, EE_FORMAT_HTML, pAttributes ); |
2783 |
ULONG nErr = pEdit->Read( rStrm, rBaseURL, EE_FORMAT_HTML, pAttributes ); |