| 1 |
Index: source/filter/html/htmlpars.cxx
|
| 2 |
===================================================================
|
| 3 |
RCS file: /cvs/sc/sc/source/filter/html/htmlpars.cxx,v
|
| 4 |
retrieving revision 1.29
|
| 5 |
diff -u -r1.29 htmlpars.cxx
|
| 6 |
--- openoffice.org.orig/sc/source/filter/html/htmlpars.cxx 3 Aug 2006 14:54:12 -0000 1.29
|
| 7 |
+++ openoffice.org/sc/source/filter/html/htmlpars.cxx 24 Apr 2007 09:47:29 -0000
|
| 8 |
@@ -157,27 +157,7 @@
|
| 9 |
SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
|
| 10 |
BOOL bLoading = pObjSh && pObjSh->IsLoading();
|
| 11 |
|
| 12 |
- SvKeyValueIteratorRef xValues;
|
| 13 |
- SvKeyValueIterator* pAttributes = NULL;
|
| 14 |
- if ( bLoading )
|
| 15 |
- pAttributes = pObjSh->GetHeaderAttributes();
|
| 16 |
- else
|
| 17 |
- {
|
| 18 |
- // When not loading, set up fake http headers to force the SfxHTMLParser to use UTF8
|
| 19 |
- // (used when pasting from clipboard)
|
| 20 |
-
|
| 21 |
- const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
|
| 22 |
- if( pCharSet )
|
| 23 |
- {
|
| 24 |
- String aContentType = String::CreateFromAscii( "text/html; charset=" );
|
| 25 |
- aContentType.AppendAscii( pCharSet );
|
| 26 |
-
|
| 27 |
- xValues = new SvKeyValueIterator;
|
| 28 |
- xValues->Append( SvKeyValue( String::CreateFromAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) );
|
| 29 |
- pAttributes = xValues;
|
| 30 |
- }
|
| 31 |
- }
|
| 32 |
-
|
| 33 |
+ SvKeyValueIterator* pAttributes = bLoading ? pObjSh->GetHeaderAttributes() : 0;
|
| 34 |
ULONG nErr = pEdit->Read( rStream, rBaseURL, EE_FORMAT_HTML, pAttributes );
|
| 35 |
|
| 36 |
pEdit->SetImportHdl( aOldLink );
|
| 37 |
@@ -2796,30 +2776,8 @@
|
| 38 |
|
| 39 |
ULONG ScHTMLQueryParser::Read( SvStream& rStrm, const String& rBaseURL )
|
| 40 |
{
|
| 41 |
- SvKeyValueIteratorRef xValues;
|
| 42 |
- SvKeyValueIterator* pAttributes = 0;
|
| 43 |
-
|
| 44 |
SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
|
| 45 |
- if( pObjSh && pObjSh->IsLoading() )
|
| 46 |
- {
|
| 47 |
- pAttributes = pObjSh->GetHeaderAttributes();
|
| 48 |
- }
|
| 49 |
- else
|
| 50 |
- {
|
| 51 |
- /* When not loading, set up fake HTTP headers to force the SfxHTMLParser
|
| 52 |
- to use UTF8 (used when pasting from clipboard) */
|
| 53 |
- const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
|
| 54 |
- if( pCharSet )
|
| 55 |
- {
|
| 56 |
- String aContentType = String::CreateFromAscii( "text/html; charset=" );
|
| 57 |
- aContentType.AppendAscii( pCharSet );
|
| 58 |
-
|
| 59 |
- xValues = new SvKeyValueIterator;
|
| 60 |
- xValues->Append( SvKeyValue( String::CreateFromAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) );
|
| 61 |
- pAttributes = xValues;
|
| 62 |
- }
|
| 63 |
- }
|
| 64 |
-
|
| 65 |
+ SvKeyValueIterator* pAttributes = (pObjSh && pObjSh->IsLoading()) ? pObjSh->GetHeaderAttributes() : 0;
|
| 66 |
Link aOldLink = pEdit->GetImportHdl();
|
| 67 |
pEdit->SetImportHdl( LINK( this, ScHTMLQueryParser, HTMLImportHdl ) );
|
| 68 |
ULONG nErr = pEdit->Read( rStrm, rBaseURL, EE_FORMAT_HTML, pAttributes );
|
| 69 |
Index: source/filter/html/swhtml.cxx
|
| 70 |
===================================================================
|
| 71 |
RCS file: /cvs/sw/sw/source/filter/html/swhtml.cxx,v
|
| 72 |
retrieving revision 1.40
|
| 73 |
diff -u -r1.40 swhtml.cxx
|
| 74 |
--- openoffice.org.orig/sw/source/filter/html/swhtml.cxx 1 Dec 2006 15:54:00 -0000 1.40
|
| 75 |
+++ openoffice.org/sw/source/filter/html/swhtml.cxx 24 Apr 2007 09:45:06 -0000
|
| 76 |
@@ -491,7 +491,7 @@
|
| 77 |
bOldIsHTMLMode = pDoc->get(IDocumentSettingAccess::HTML_MODE);
|
| 78 |
pDoc->set(IDocumentSettingAccess::HTML_MODE, true);
|
| 79 |
|
| 80 |
- pCSS1Parser = new SwCSS1Parser( pDoc, aFontHeights, sBaseURL, IsNewDoc() );
|
| 81 |
+ pCSS1Parser = new SwCSS1Parser( pDoc, aFontHeights, sBaseURL, IsNewDoc() );
|
| 82 |
pCSS1Parser->SetIgnoreFontFamily( pHtmlOptions->IsIgnoreFontFamily() );
|
| 83 |
|
| 84 |
if( bReadUTF8 )
|
| 85 |
@@ -501,10 +501,8 @@
|
| 86 |
else
|
| 87 |
{
|
| 88 |
SwDocShell *pDocSh = pDoc->GetDocShell();
|
| 89 |
- SvKeyValueIterator *pHeaderAttrs =
|
| 90 |
- pDocSh->GetHeaderAttributes();
|
| 91 |
- if( pHeaderAttrs )
|
| 92 |
- SetEncodingByHTTPHeader( pHeaderAttrs );
|
| 93 |
+ SvKeyValueIterator *pHeaderAttrs = (pDocSh && pDocSh->IsLoading()) ? pDocSh->GetHeaderAttributes() : 0;
|
| 94 |
+ SetEncodingByHTTPHeader( pHeaderAttrs );
|
| 95 |
}
|
| 96 |
pCSS1Parser->SetDfltEncoding( gsl_getSystemTextEncoding() );
|
| 97 |
|
| 98 |
Index: source/bastyp/sfxhtml.cxx
|
| 99 |
===================================================================
|
| 100 |
RCS file: /cvs/framework/sfx2/source/bastyp/sfxhtml.cxx,v
|
| 101 |
retrieving revision 1.17
|
| 102 |
diff -u -r1.17 sfxhtml.cxx
|
| 103 |
--- openoffice.org.orig/sfx2/source/bastyp/sfxhtml.cxx 17 Sep 2006 16:25:00 -0000 1.17
|
| 104 |
+++ openoffice.org/sfx2/source/bastyp/sfxhtml.cxx 24 Apr 2007 09:35:50 -0000
|
| 105 |
@@ -53,10 +53,11 @@
|
| 106 |
#include <tools/tenccvt.hxx>
|
| 107 |
|
| 108 |
#include <sfx2/sfxhtml.hxx>
|
| 109 |
+#include <sfx2/objsh.hxx>
|
| 110 |
+#include <sfx2/docfile.hxx>
|
| 111 |
|
| 112 |
#include <com/sun/star/beans/XPropertyContainer.hpp>
|
| 113 |
|
| 114 |
-
|
| 115 |
using namespace ::com::sun::star;
|
| 116 |
|
| 117 |
|
| 118 |
@@ -381,6 +382,26 @@
|
| 119 |
BOOL SfxHTMLParser::SetEncodingByHTTPHeader(
|
| 120 |
SvKeyValueIterator *pHTTPHeader )
|
| 121 |
{
|
| 122 |
+ SvKeyValueIteratorRef xValues;
|
| 123 |
+ /*
|
| 124 |
+ * When not loading, set up fake HTTP headers to force the
|
| 125 |
+ * SfxHTMLParser to use UTF8 (used when pasting from clipboard)
|
| 126 |
+ */
|
| 127 |
+ SfxObjectShell* pObjSh = !pHTTPHeader ? SfxObjectShell::Current() : 0;
|
| 128 |
+ if( pObjSh && !pObjSh->IsLoading() )
|
| 129 |
+ {
|
| 130 |
+ const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
|
| 131 |
+ if( pCharSet )
|
| 132 |
+ {
|
| 133 |
+ String aContentType = String::CreateFromAscii( "text/html; charset=" );
|
| 134 |
+ aContentType.AppendAscii( pCharSet );
|
| 135 |
+
|
| 136 |
+ xValues = new SvKeyValueIterator;
|
| 137 |
+ xValues->Append( SvKeyValue( String::CreateFromAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ), aContentType ) );
|
| 138 |
+ pHTTPHeader = xValues;
|
| 139 |
+ }
|
| 140 |
+ }
|
| 141 |
+
|
| 142 |
BOOL bRet = FALSE;
|
| 143 |
rtl_TextEncoding eEnc = SfxHTMLParser::GetEncodingByHttpHeader( pHTTPHeader );
|
| 144 |
if(RTL_TEXTENCODING_DONTKNOW != eEnc)
|
| 145 |
Index: source/editeng/eehtml.cxx
|
| 146 |
===================================================================
|
| 147 |
RCS file: /cvs/graphics/svx/source/editeng/eehtml.cxx,v
|
| 148 |
retrieving revision 1.16
|
| 149 |
diff -u -r1.16 eehtml.cxx
|
| 150 |
--- openoffice.org.orig/svx/source/editeng/eehtml.cxx 12 Oct 2006 12:37:40 -0000 1.16
|
| 151 |
+++ openoffice.org/svx/source/editeng/eehtml.cxx 18 May 2007 11:00:09 -0000
|
| 152 |
@@ -72,8 +72,7 @@
|
| 153 |
nNumberingLevel = 0;
|
| 154 |
bFieldsInserted = FALSE;
|
| 155 |
|
| 156 |
- if ( pHTTPHeaderAttrs )
|
| 157 |
- SetEncodingByHTTPHeader( pHTTPHeaderAttrs );
|
| 158 |
+ SetEncodingByHTTPHeader( pHTTPHeaderAttrs );
|
| 159 |
}
|
| 160 |
|
| 161 |
EditHTMLParser::~EditHTMLParser()
|