diff options
30 files changed, 183 insertions, 367 deletions
diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx index 5fb93652b9a9..18e3beceb8ef 100644 --- a/cui/source/options/opthtml.cxx +++ b/cui/source/options/opthtml.cxx @@ -40,7 +40,6 @@ OfaHtmlTabPage::OfaHtmlTabPage(weld::Container* pPage, weld::DialogController* p , m_xStarBasicWarningCB(m_xBuilder->weld_check_button("starbasicwarning")) , m_xPrintExtensionCB(m_xBuilder->weld_check_button("printextension")) , m_xSaveGrfLocalCB(m_xBuilder->weld_check_button("savegrflocal")) - , m_xCharSetLB(new SvxTextEncodingBox(m_xBuilder->weld_combo_box("charset"))) { // replace placeholder with UI string from language list OUString aText(m_xNumbersEnglishUSCB->get_label()); @@ -57,9 +56,6 @@ OfaHtmlTabPage::OfaHtmlTabPage(weld::Container* pPage, weld::DialogController* p } m_xStarBasicCB->connect_toggled(LINK(this, OfaHtmlTabPage, CheckBoxHdl_Impl)); - - // initialize the characterset listbox - m_xCharSetLB->FillWithMimeAndSelectBest(); } OfaHtmlTabPage::~OfaHtmlTabPage() @@ -125,10 +121,6 @@ bool OfaHtmlTabPage::FillItemSet( SfxItemSet* ) officecfg::Office::Common::Filter::HTML::Export::PrintLayout::set( m_xPrintExtensionCB->get_active(), xChanges); - if( m_xCharSetLB->GetSelectTextEncoding() != SvxHtmlOptions::GetTextEncoding() ) - officecfg::Office::Common::Filter::HTML::Export::Encoding::set( - m_xCharSetLB->GetSelectTextEncoding(), xChanges ); - xChanges->commit(); return false; } @@ -166,10 +158,6 @@ void OfaHtmlTabPage::Reset( const SfxItemSet* ) m_xNumbersEnglishUSCB->save_state(); m_xUnknownTagCB->save_state(); m_xIgnoreFontNamesCB->save_state(); - - if( !SvxHtmlOptions::IsDefaultTextEncoding() && - m_xCharSetLB->GetSelectTextEncoding() != SvxHtmlOptions::GetTextEncoding() ) - m_xCharSetLB->SelectTextEncoding( SvxHtmlOptions::GetTextEncoding() ); } IMPL_LINK(OfaHtmlTabPage, CheckBoxHdl_Impl, weld::Toggleable&, rBox, void) diff --git a/cui/source/options/opthtml.hxx b/cui/source/options/opthtml.hxx index 4fdb9d754451..33bff167b87a 100644 --- a/cui/source/options/opthtml.hxx +++ b/cui/source/options/opthtml.hxx @@ -40,7 +40,6 @@ class OfaHtmlTabPage : public SfxTabPage std::unique_ptr<weld::CheckButton> m_xStarBasicWarningCB; std::unique_ptr<weld::CheckButton> m_xPrintExtensionCB; std::unique_ptr<weld::CheckButton> m_xSaveGrfLocalCB; - std::unique_ptr<SvxTextEncodingBox> m_xCharSetLB; DECL_LINK(CheckBoxHdl_Impl, weld::Toggleable&, void); diff --git a/cui/uiconfig/ui/opthtmlpage.ui b/cui/uiconfig/ui/opthtmlpage.ui index ac45186681b1..e8e9e68c2819 100644 --- a/cui/uiconfig/ui/opthtmlpage.ui +++ b/cui/uiconfig/ui/opthtmlpage.ui @@ -434,51 +434,6 @@ <property name="margin-start">12</property> <property name="margin-top">6</property> <child> - <!-- n-columns=1 n-rows=1 --> - <object class="GtkGrid" id="grid4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> - <child> - <object class="GtkLabel" id="charsetFT"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="opthtmlpage|charsetFT">Character _set:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">charset</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkComboBoxText" id="charset"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> - <property name="hexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="charset-atkobject"> - <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|charset">Select the appropriate character set for the export</property> - </object> - </child> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> - </child> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">4</property> - </packing> - </child> - <child> <object class="GtkCheckButton" id="savegrflocal"> <property name="label" translatable="yes" context="opthtmlpage|savegrflocal">_Copy local images to Internet</property> <property name="visible">True</property> diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index 08e8fcc76c0d..7bfbd5d769cf 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -579,7 +579,7 @@ OHTMLImportExport::OHTMLImportExport(const svx::ODataAccessDescriptor& _aDataDes #endif { // set HTML configuration - m_eDestEnc = SvxHtmlOptions::GetTextEncoding(); + m_eDestEnc = RTL_TEXTENCODING_UTF8; strncpy( sIndent, sIndentSource ,std::min(sizeof(sIndent),sizeof(sIndentSource))); sIndent[0] = 0; } @@ -630,7 +630,7 @@ void OHTMLImportExport::WriteHeader() HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr()); SfxFrameHTMLWriter::Out_DocInfo( (*m_pStream), OUString(), - xDocProps, sIndent, osl_getThreadTextEncoding() ); + xDocProps, sIndent ); m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr()); IncIndent(-1); m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr()); @@ -898,7 +898,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal if ( rValue.isEmpty() ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_linebreak); // no completely empty cell else - HTMLOutFuncs::Out_String( (*m_pStream), rValue ,m_eDestEnc); + HTMLOutFuncs::Out_String( (*m_pStream), rValue ); if ( bStrikeout ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_strike, false); if ( bUnderline ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_underline, false); diff --git a/include/sfx2/frmhtmlw.hxx b/include/sfx2/frmhtmlw.hxx index dfc0d1645d35..1011327c204c 100644 --- a/include/sfx2/frmhtmlw.hxx +++ b/include/sfx2/frmhtmlw.hxx @@ -40,35 +40,30 @@ class SFX2_DLLPUBLIC SfxFrameHTMLWriter SAL_DLLPRIVATE static void OutMeta( SvStream& rStrm, const char *pIndent, const OUString& rName, const OUString& rContent, bool bHTTPEquiv, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars = nullptr ); SAL_DLLPRIVATE inline static void OutMeta( SvStream& rStrm, const char *pIndent, const char *pName, const OUString& rContent, bool bHTTPEquiv, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars = nullptr ); public: static void Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, const css::uno::Reference< css::document::XDocumentProperties>&, const char *pIndent, - rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars = nullptr ); static void Out_FrameDescriptor( SvStream&, const OUString& rBaseURL, const css::uno::Reference < css::beans::XPropertySet >& xSet, - rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars = nullptr ); }; inline void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm, const char *pIndent, const char *pName, const OUString& rContent, bool bHTTPEquiv, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { OUString sTmp = OUString::createFromAscii(pName); - OutMeta( rStrm, pIndent, sTmp, rContent, bHTTPEquiv, eDestEnc, pNonConvertableChars ); + OutMeta( rStrm, pIndent, sTmp, rContent, bHTTPEquiv, pNonConvertableChars ); } #endif diff --git a/include/svtools/htmlcfg.hxx b/include/svtools/htmlcfg.hxx index 19baf09e656d..1ed542867ef0 100644 --- a/include/svtools/htmlcfg.hxx +++ b/include/svtools/htmlcfg.hxx @@ -38,10 +38,6 @@ SVT_DLLPUBLIC sal_uInt16 GetFontSize(sal_uInt16 nPos); SVT_DLLPUBLIC sal_uInt16 GetExportMode(); SVT_DLLPUBLIC bool IsPrintLayoutExtension(); - -SVT_DLLPUBLIC bool IsDefaultTextEncoding(); -SVT_DLLPUBLIC rtl_TextEncoding GetTextEncoding(); -SVT_DLLPUBLIC void SetTextEncoding(rtl_TextEncoding); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svtools/htmlout.hxx b/include/svtools/htmlout.hxx index 8e87855b527c..4207bcb4d2bc 100644 --- a/include/svtools/htmlout.hxx +++ b/include/svtools/htmlout.hxx @@ -41,29 +41,16 @@ struct HTMLOutEvent SvMacroItemId nEvent; }; -struct SVT_DLLPUBLIC HTMLOutContext -{ - rtl_TextEncoding m_eDestEnc; - rtl_TextToUnicodeConverter m_hConv; - rtl_TextToUnicodeContext m_hContext; - - HTMLOutContext( rtl_TextEncoding eDestEnc ); - ~HTMLOutContext(); -}; - struct HTMLOutFuncs { SVT_DLLPUBLIC static OString ConvertStringToHTML( const OUString& sSrc, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ); SVT_DLLPUBLIC static SvStream& Out_AsciiTag( SvStream&, std::string_view rStr, bool bOn = true); SVT_DLLPUBLIC static SvStream& Out_Char( SvStream&, sal_uInt32 cChar, - HTMLOutContext& rContext, OUString *pNonConvertableChars ); SVT_DLLPUBLIC static SvStream& Out_String( SvStream&, const OUString&, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars = nullptr ); SVT_DLLPUBLIC static SvStream& Out_Hex( SvStream&, sal_uInt32 nHex, sal_uInt8 nLen ); SVT_DLLPUBLIC static SvStream& Out_Color( SvStream&, const Color&, bool bXHTML = false ); @@ -73,9 +60,8 @@ struct HTMLOutFuncs const char *pDelim, const char *pIndentArea, const char *pIndentMap, - rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars = nullptr ); - SVT_DLLPUBLIC static SvStream& FlushToAscii( SvStream&, HTMLOutContext& rContext ); + SVT_DLLPUBLIC static SvStream& FlushToAscii( SvStream& ); SVT_DLLPUBLIC static SvStream& OutScript( SvStream& rStrm, const OUString& rBaseURL, @@ -85,21 +71,18 @@ struct HTMLOutFuncs const OUString& rSrc, const OUString *pSBLibrary, const OUString *pSBModule, - rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars = nullptr ); // the 3rd parameter is an array of HTMLOutEvents which is terminated // by an entry that consists only of 0s SVT_DLLPUBLIC static SvStream& Out_Events( SvStream&, const SvxMacroTableDtor&, const HTMLOutEvent*, bool bOutStarBasic, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ); // <TD SDVAL="..." SDNUM="..."> SVT_DLLPUBLIC static OString CreateTableDataOptionsValNum( bool bValue, double fVal, sal_uInt32 nFormat, SvNumberFormatter& rFormatter, - rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, OUString *pNonConvertableChars = nullptr); SVT_DLLPUBLIC static bool PrivateURLToInternalImg( OUString& rURL ); }; diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index b912f506d735..5bf84c498843 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -114,7 +114,7 @@ const char ScHTMLExport::sIndentSource[nIndentMax+1] = #define TAG_ON( tag ) HTMLOutFuncs::Out_AsciiTag( rStrm, tag ) #define TAG_OFF( tag ) HTMLOutFuncs::Out_AsciiTag( rStrm, tag, false ) -#define OUT_STR( str ) HTMLOutFuncs::Out_String( rStrm, str, eDestEnc, &aNonConvertibleChars ) +#define OUT_STR( str ) HTMLOutFuncs::Out_String( rStrm, str, &aNonConvertibleChars ) #define OUT_LF() rStrm.WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() ) #define TAG_ON_LF( tag ) (TAG_ON( tag ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() )) #define TAG_OFF_LF( tag ) (TAG_OFF( tag ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() )) @@ -214,7 +214,6 @@ ScHTMLExport::ScHTMLExport( SvStream& rStrmP, const OUString& rBaseURL, ScDocume sIndent[0] = 0; // set HTML configuration - eDestEnc = (pDoc->IsClipOrUndo() ? RTL_TEXTENCODING_UTF8 : SvxHtmlOptions::GetTextEncoding()); bCopyLocalFileToINet = officecfg::Office::Common::Filter::HTML::Export::LocalGraphic::get(); if (rFilterOptions == u"SkipImages") @@ -314,7 +313,7 @@ void ScHTMLExport::WriteHeader() if ( pDoc->IsClipOrUndo() ) { // no real DocInfo available, but some META information like charset needed - SfxFrameHTMLWriter::Out_DocInfo( rStrm, aBaseURL, nullptr, sIndent, eDestEnc, &aNonConvertibleChars ); + SfxFrameHTMLWriter::Out_DocInfo( rStrm, aBaseURL, nullptr, sIndent, &aNonConvertibleChars ); } else { @@ -323,7 +322,7 @@ void ScHTMLExport::WriteHeader() uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties(); SfxFrameHTMLWriter::Out_DocInfo( rStrm, aBaseURL, xDocProps, - sIndent, eDestEnc, &aNonConvertibleChars ); + sIndent, &aNonConvertibleChars ); OUT_LF(); if (!xDocProps->getPrintedBy().isEmpty()) @@ -1105,7 +1104,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC } aStrTD.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValueData, fVal, - nFormat, *pFormatter, eDestEnc, &aNonConvertibleChars)); + nFormat, *pFormatter, &aNonConvertibleChars)); TAG_ON(aStrTD.makeStringAndClear().getStr()); @@ -1147,7 +1146,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC for (sal_Int32 nPos {0};;) { OString aTmpStr = HTMLOutFuncs::ConvertStringToHTML( - rList.getToken( 0, ';', nPos ), eDestEnc, + rList.getToken( 0, ';', nPos ), &aNonConvertibleChars); aStr.append(aTmpStr); if (nPos<0) @@ -1192,7 +1191,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC if (bWriteHyperLink) { - OString aURLStr = HTMLOutFuncs::ConvertStringToHTML(aURL, eDestEnc, &aNonConvertibleChars); + OString aURLStr = HTMLOutFuncs::ConvertStringToHTML(aURL, &aNonConvertibleChars); OString aStr = OOO_STRING_SVTOOLS_HTML_anchor " " OOO_STRING_SVTOOLS_HTML_O_href "=\"" + aURLStr + "\""; TAG_ON(aStr.getStr()); } diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx index c76f001fdf84..7d3c7f75b213 100644 --- a/sc/source/filter/html/htmlexp2.cxx +++ b/sc/source/filter/html/htmlexp2.cxx @@ -215,7 +215,7 @@ void ScHTMLExport::WriteImage( OUString& rLinkName, const Graphic& rGrf, rStrm.WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_image ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_src ).WriteCharPtr( "=\"" ); HTMLOutFuncs::Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative( aBaseURL, - rLinkName ), eDestEnc ).WriteChar( '\"' ); + rLinkName ) ).WriteChar( '\"' ); if ( !rImgOptions.empty() ) rStrm.WriteOString( rImgOptions ); rStrm.WriteChar( '>' ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() ); diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx index ad81b401064c..01f184cd99d1 100644 --- a/sc/source/filter/inc/htmlexp.hxx +++ b/sc/source/filter/inc/htmlexp.hxx @@ -116,7 +116,6 @@ class ScHTMLExport : public ScExportBase VclPtr<OutputDevice> pAppWin; // for Pixel-work FileNameMapPtr pFileNameMap; // for CopyLocalFileToINet OUString aNonConvertibleChars; // collect nonconvertible characters - rtl_TextEncoding eDestEnc; SCTAB nUsedTables; short nIndent; char sIndent[nIndentMax+1]; diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 158a0b57d103..9ceffc8a515a 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -1065,7 +1065,7 @@ OUString HtmlExport::DocumentMetadata() const OUString aNonConvertableCharacters; SfxFrameHTMLWriter::Out_DocInfo(aStream, maDocFileName, xDocProps, - " ", RTL_TEXTENCODING_UTF8, + " ", &aNonConvertableCharacters); const sal_uInt64 nLen = aStream.GetSize(); @@ -2809,7 +2809,7 @@ OUString HtmlExport::CreateHTMLRectArea( const ::tools::Rectangle& rRect, OUString HtmlExport::StringToHTMLString( const OUString& rString ) { SvMemoryStream aMemStm; - HTMLOutFuncs::Out_String( aMemStm, rString, RTL_TEXTENCODING_UTF8 ); + HTMLOutFuncs::Out_String( aMemStm, rString ); aMemStm.WriteChar( char(0) ); sal_Int32 nLength = strlen(static_cast<char const *>(aMemStm.GetData())); return OUString( static_cast<char const *>(aMemStm.GetData()), nLength, RTL_TEXTENCODING_UTF8 ); diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index 1b83c2be8b1e..d568b193040f 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -53,7 +53,6 @@ void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm, const OUString& rName, const OUString& rContent, bool bHTTPEquiv, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { rStrm.WriteCharPtr( SAL_NEWLINE_STRING ); @@ -65,29 +64,21 @@ void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm, .append(bHTTPEquiv ? OOO_STRING_SVTOOLS_HTML_O_httpequiv : OOO_STRING_SVTOOLS_HTML_O_name).append("=\""); rStrm.WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rStrm, rName, eDestEnc, pNonConvertableChars ); + HTMLOutFuncs::Out_String( rStrm, rName, pNonConvertableChars ); sOut.append("\" " OOO_STRING_SVTOOLS_HTML_O_content "=\""); rStrm.WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rStrm, rContent, eDestEnc, pNonConvertableChars ).WriteCharPtr( "\"/>" ); + HTMLOutFuncs::Out_String( rStrm, rContent, pNonConvertableChars ).WriteCharPtr( "\"/>" ); } void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, const uno::Reference<document::XDocumentProperties> & i_xDocProps, const char *pIndent, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { - const char *pCharSet = - rtl_getBestMimeCharsetFromTextEncoding( eDestEnc ); - - if( pCharSet ) - { - OUString aContentType = "text/html; charset=" + OUString(pCharSet, strlen(pCharSet), RTL_TEXTENCODING_UTF8); - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_content_type, aContentType, true, - eDestEnc, pNonConvertableChars ); - } + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_content_type, "text/html; charset=utf-8", true, + pNonConvertableChars ); // Title (regardless if empty) rStrm.WriteCharPtr( SAL_NEWLINE_STRING ); @@ -98,7 +89,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, { const OUString& rTitle = i_xDocProps->getTitle(); if( !rTitle.isEmpty() ) - HTMLOutFuncs::Out_String( rStrm, rTitle, eDestEnc, pNonConvertableChars ); + HTMLOutFuncs::Out_String( rStrm, rTitle, pNonConvertableChars ); } HTMLOutFuncs::Out_AsciiTag( rStrm, OOO_STRING_SVTOOLS_HTML_title, false ); @@ -114,7 +105,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, rStrm.WriteOString( "<" OOO_STRING_SVTOOLS_HTML_base " " OOO_STRING_SVTOOLS_HTML_O_target "=\"" ); - HTMLOutFuncs::Out_String( rStrm, rTarget, eDestEnc, pNonConvertableChars ) + HTMLOutFuncs::Out_String( rStrm, rTarget, pNonConvertableChars ) .WriteCharPtr( "\">" ); } } @@ -124,7 +115,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, OUString os( "$_OS" ); ::rtl::Bootstrap::expandMacros(os); sGenerator = sGenerator.replaceFirst( "%1", os ); - OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_generator, sGenerator, false, eDestEnc, pNonConvertableChars ); + OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_generator, sGenerator, false, pNonConvertableChars ); if( !i_xDocProps.is() ) return; @@ -144,14 +135,14 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, } OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_refresh, sContent, true, - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); } // Author const OUString& rAuthor = i_xDocProps->getAuthor(); if( !rAuthor.isEmpty() ) OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_author, rAuthor, false, - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); // created ::util::DateTime uDT = i_xDocProps->getCreationDate(); @@ -159,39 +150,39 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT); OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_created, aBuffer.makeStringAndClear(), false, - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); // changedby const OUString& rChangedBy = i_xDocProps->getModifiedBy(); if( !rChangedBy.isEmpty() ) OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changedby, rChangedBy, false, - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); // changed uDT = i_xDocProps->getModificationDate(); ::sax::Converter::convertTimeOrDateTime(aBuffer, uDT); OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_changed, aBuffer.makeStringAndClear(), false, - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); // Subject const OUString& rTheme = i_xDocProps->getSubject(); if( !rTheme.isEmpty() ) OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_classification, rTheme, false, - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); // Description const OUString& rComment = i_xDocProps->getDescription(); if( !rComment.isEmpty() ) OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_description, rComment, false, - eDestEnc, pNonConvertableChars); + pNonConvertableChars); // Keywords OUString Keywords = ::comphelper::string::convertCommaSeparated( i_xDocProps->getKeywords()); if( !Keywords.isEmpty() ) OutMeta( rStrm, pIndent, OOO_STRING_SVTOOLS_HTML_META_keywords, Keywords, false, - eDestEnc, pNonConvertableChars); + pNonConvertableChars); uno::Reference < script::XTypeConverter > xConverter( script::Converter::create( ::comphelper::getProcessComponentContext() ) ); @@ -213,7 +204,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, aStr >>= str; OUString valstr(comphelper::string::stripEnd(str, ' ')); OutMeta( rStrm, pIndent, name, valstr, false, - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); } catch (const uno::Exception&) { @@ -225,7 +216,7 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, void SfxFrameHTMLWriter::Out_FrameDescriptor( SvStream& rOut, const OUString& rBaseURL, const uno::Reference < beans::XPropertySet >& xSet, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) + OUString *pNonConvertableChars ) { try { @@ -241,7 +232,7 @@ void SfxFrameHTMLWriter::Out_FrameDescriptor( rBaseURL, aURL ); sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_src "=\""); rOut.WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rOut, aURL, eDestEnc, pNonConvertableChars ); + HTMLOutFuncs::Out_String( rOut, aURL, pNonConvertableChars ); sOut.append('\"'); } } @@ -251,7 +242,7 @@ void SfxFrameHTMLWriter::Out_FrameDescriptor( { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); rOut.WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rOut, aStr, eDestEnc, pNonConvertableChars ); + HTMLOutFuncs::Out_String( rOut, aStr, pNonConvertableChars ); sOut.append('\"'); } diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx index 2e82df094e0b..983d85e4bf22 100644 --- a/svtools/source/config/htmlcfg.cxx +++ b/svtools/source/config/htmlcfg.cxx @@ -84,30 +84,6 @@ bool IsPrintLayoutExtension() return bRet; } -bool IsDefaultTextEncoding() -{ - std::optional<sal_Int32> x = officecfg::Office::Common::Filter::HTML::Export::Encoding::get(); - // if we have a value, then the text encoding is not default - return !bool(x); -} -rtl_TextEncoding GetTextEncoding() -{ - std::optional<sal_Int32> x = officecfg::Office::Common::Filter::HTML::Export::Encoding::get(); - rtl_TextEncoding eRet; - if (!x) - eRet = SvtSysLocale::GetBestMimeEncoding(); - else - eRet = static_cast<rtl_TextEncoding>(*x); - return eRet; -} - -void SetTextEncoding( rtl_TextEncoding eEnc ) -{ - std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::Filter::HTML::Export::Encoding::set(eEnc, batch); - batch->commit(); -} - } // namespace SvxHtmlOptions /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 0c1c23ace915..b42e425df350 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -39,23 +39,18 @@ #define TXTCONV_BUFFER_SIZE 20 -HTMLOutContext::HTMLOutContext( rtl_TextEncoding eDestEnc ) +static sal_Size convertUnicodeToText(const sal_Unicode* pSrcBuf, sal_Size nSrcChars, char* pDestBuf, + sal_Size nDestBytes, sal_uInt32 nFlags, sal_uInt32* pInfo, + sal_Size* pSrcCvtChars) { - m_eDestEnc = RTL_TEXTENCODING_DONTKNOW == eDestEnc - ? osl_getThreadTextEncoding() - : eDestEnc; - - m_hConv = rtl_createUnicodeToTextConverter( eDestEnc ); - DBG_ASSERT( m_hConv, - "HTMLOutContext::HTMLOutContext: no converter for source encoding" ); - m_hContext = m_hConv ? rtl_createUnicodeToTextContext( m_hConv ) - : reinterpret_cast<rtl_TextToUnicodeContext>(1); -} - -HTMLOutContext::~HTMLOutContext() -{ - rtl_destroyUnicodeToTextContext( m_hConv, m_hContext ); - rtl_destroyUnicodeToTextConverter( m_hConv ); + static rtl_UnicodeToTextConverter hConverter + = rtl_createUnicodeToTextConverter(RTL_TEXTENCODING_UTF8); + static rtl_UnicodeToTextContext hContext = hConverter + ? rtl_createUnicodeToTextContext(hConverter) + : reinterpret_cast<rtl_TextToUnicodeContext>(1); + + return rtl_convertUnicodeToText(hConverter, hContext, pSrcBuf, nSrcChars, pDestBuf, nDestBytes, + nFlags, pInfo, pSrcCvtChars); } static const char *lcl_svhtml_GetEntityForChar( sal_uInt32 c, @@ -391,11 +386,11 @@ static const char *lcl_svhtml_GetEntityForChar( sal_uInt32 c, return pStr; } -static sal_Size lcl_FlushContext(HTMLOutContext& rContext, char* pBuffer, sal_uInt32 nFlags) +static sal_Size lcl_FlushContext(char* pBuffer, sal_uInt32 nFlags) { sal_uInt32 nInfo = 0; sal_Size nSrcChars; - sal_Size nLen = rtl_convertUnicodeToText(rContext.m_hConv, rContext.m_hContext, nullptr, 0, + sal_Size nLen = convertUnicodeToText(nullptr, 0, pBuffer, TXTCONV_BUFFER_SIZE, nFlags|RTL_UNICODETOTEXT_FLAGS_FLUSH, &nInfo, &nSrcChars); DBG_ASSERT((nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0, "HTMLOut: error while flushing"); @@ -403,14 +398,11 @@ static sal_Size lcl_FlushContext(HTMLOutContext& rContext, char* pBuffer, sal_uI } static OString lcl_ConvertCharToHTML( sal_uInt32 c, - HTMLOutContext& rContext, OUString *pNonConvertableChars ) { assert(rtl::isUnicodeCodePoint(c)); OStringBuffer aDest; - DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW != rContext.m_eDestEnc, - "wrong destination encoding" ); const char *pStr = nullptr; switch( c ) { @@ -428,8 +420,8 @@ static OString lcl_ConvertCharToHTML( sal_uInt32 c, // The new HTML4 entities above 255 are not used for UTF-8, // because Netscape 4 does support UTF-8 but does not support // these entities. - if( c < 128 || RTL_TEXTENCODING_UTF8 != rContext.m_eDestEnc ) - pStr = lcl_svhtml_GetEntityForChar( c, rContext.m_eDestEnc ); + if( c < 128 ) + pStr = lcl_svhtml_GetEntityForChar( c, RTL_TEXTENCODING_UTF8 ); break; } @@ -440,7 +432,7 @@ static OString lcl_ConvertCharToHTML( sal_uInt32 c, RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR; if( pStr ) { - sal_Size nLen = lcl_FlushContext(rContext, cBuffer, nFlags); + sal_Size nLen = lcl_FlushContext(cBuffer, nFlags); char *pBuffer = cBuffer; while( nLen-- ) aDest.append(*pBuffer++); @@ -453,8 +445,7 @@ static OString lcl_ConvertCharToHTML( sal_uInt32 c, sal_Unicode utf16[2]; auto n = rtl::splitSurrogates(c, utf16); - sal_Size nLen = rtl_convertUnicodeToText(rContext.m_hConv, - rContext.m_hContext, utf16, n, + sal_Size nLen = convertUnicodeToText(utf16, n, cBuffer, TXTCONV_BUFFER_SIZE, nFlags, &nInfo, &nSrcChars); if( nLen > 0 && (nInfo & (RTL_UNICODETOTEXT_INFO_ERROR|RTL_UNICODETOTEXT_INFO_DESTBUFFERTOSMALL)) == 0 ) @@ -469,7 +460,7 @@ static OString lcl_ConvertCharToHTML( sal_uInt32 c, // character set, the UNICODE character is exported as character // entity. // coverity[callee_ptr_arith] - its ok - nLen = lcl_FlushContext(rContext, cBuffer, nFlags); + nLen = lcl_FlushContext(cBuffer, nFlags); char *pBuffer = cBuffer; while( nLen-- ) aDest.append(*pBuffer++); @@ -488,7 +479,7 @@ static OString lcl_ConvertCharToHTML( sal_uInt32 c, return aDest.makeStringAndClear(); } -static OString lcl_FlushToAscii( HTMLOutContext& rContext ) +static OString lcl_FlushToAscii() { OStringBuffer aDest; @@ -497,7 +488,7 @@ static OString lcl_FlushToAscii( HTMLOutContext& rContext ) RTL_UNICODETOTEXT_FLAGS_CONTROL_IGNORE| RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR| RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR; - sal_Size nLen = lcl_FlushContext(rContext, cBuffer, nFlags); + sal_Size nLen = lcl_FlushContext(cBuffer, nFlags); char *pBuffer = cBuffer; while( nLen-- ) aDest.append(*pBuffer++); @@ -505,14 +496,13 @@ static OString lcl_FlushToAscii( HTMLOutContext& rContext ) } OString HTMLOutFuncs::ConvertStringToHTML( const OUString& rSrc, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) + OUString *pNonConvertableChars ) { - HTMLOutContext aContext( eDestEnc ); OStringBuffer aDest; for( sal_Int32 i=0, nLen = rSrc.getLength(); i < nLen; ) aDest.append(lcl_ConvertCharToHTML( - rSrc.iterateCodePoints(&i), aContext, pNonConvertableChars)); - aDest.append(lcl_FlushToAscii(aContext)); + rSrc.iterateCodePoints(&i), pNonConvertableChars)); + aDest.append(lcl_FlushToAscii()); return aDest.makeStringAndClear(); } @@ -530,31 +520,27 @@ SvStream& HTMLOutFuncs::Out_AsciiTag( SvStream& rStream, std::string_view rStr, } SvStream& HTMLOutFuncs::Out_Char( SvStream& rStream, sal_uInt32 c, - HTMLOutContext& rContext, OUString *pNonConvertableChars ) { - OString sOut = lcl_ConvertCharToHTML( c, rContext, pNonConvertableChars ); + OString sOut = lcl_ConvertCharToHTML( c, pNonConvertableChars ); rStream.WriteOString( sOut ); return rStream; } SvStream& HTMLOutFuncs::Out_String( SvStream& rStream, const OUString& rOUStr, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { - HTMLOutContext aContext( eDestEnc ); sal_Int32 nLen = rOUStr.getLength(); for( sal_Int32 n = 0; n < nLen; ) HTMLOutFuncs::Out_Char( rStream, rOUStr.iterateCodePoints(&n), - aContext, pNonConvertableChars ); - HTMLOutFuncs::FlushToAscii( rStream, aContext ); + pNonConvertableChars ); + HTMLOutFuncs::FlushToAscii( rStream ); return rStream; } -SvStream& HTMLOutFuncs::FlushToAscii( SvStream& rStream, - HTMLOutContext& rContext ) +SvStream& HTMLOutFuncs::FlushToAscii( SvStream& rStream ) { - OString sOut = lcl_FlushToAscii( rContext ); + OString sOut = lcl_FlushToAscii(); if (!sOut.isEmpty()) rStream.WriteOString( sOut ); @@ -613,12 +599,8 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, const char *pDelim, const char *pIndentArea, const char *pIndentMap, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { - if( RTL_TEXTENCODING_DONTKNOW == eDestEnc ) - eDestEnc = osl_getThreadTextEncoding(); - const OUString& rOutName = !rName.isEmpty() ? rName : rIMap.GetName(); DBG_ASSERT( !rOutName.isEmpty(), "No ImageMap-Name" ); if( rOutName.isEmpty() ) @@ -631,7 +613,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, OOO_STRING_SVTOOLS_HTML_O_name "=\""); rStream.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStream, rOutName, eDestEnc, pNonConvertableChars ); + Out_String( rStream, rOutName, pNonConvertableChars ); rStream.WriteCharPtr( "\">" ); for( size_t i=0; i<rIMap.GetIMapObjectCount(); i++ ) @@ -732,7 +714,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, rBaseURL, aURL ); sOut.append(OOO_STRING_SVTOOLS_HTML_O_href "=\""); rStream.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStream, aURL, eDestEnc, pNonConvertableChars ).WriteChar( '\"' ); + Out_String( rStream, aURL, pNonConvertableChars ).WriteChar( '\"' ); } else rStream.WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_nohref ); @@ -742,7 +724,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); rStream.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStream, rObjName, eDestEnc, pNonConvertableChars ).WriteChar( '\"' ); + Out_String( rStream, rObjName, pNonConvertableChars ).WriteChar( '\"' ); } const OUString& rTarget = pObj->GetTarget(); @@ -750,7 +732,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_target "=\""); rStream.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStream, rTarget, eDestEnc, pNonConvertableChars ).WriteChar( '\"' ); + Out_String( rStream, rTarget, pNonConvertableChars ).WriteChar( '\"' ); } OUString rDesc( pObj->GetAltText() ); @@ -761,13 +743,13 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_alt "=\""); rStream.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStream, rDesc, eDestEnc, pNonConvertableChars ).WriteChar( '\"' ); + Out_String( rStream, rDesc, pNonConvertableChars ).WriteChar( '\"' ); } const SvxMacroTableDtor& rMacroTab = pObj->GetMacroTable(); if( pEventTable && !rMacroTab.empty() ) Out_Events( rStream, rMacroTab, pEventTable, - bOutStarBasic, eDestEnc, pNonConvertableChars ); + bOutStarBasic, pNonConvertableChars ); rStream.WriteChar( '>' ); } @@ -792,12 +774,8 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, const OUString& rSrc, const OUString *pSBLibrary, const OUString *pSBModule, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { - if( RTL_TEXTENCODING_DONTKNOW == eDestEnc ) - eDestEnc = osl_getThreadTextEncoding(); - // script is not indented! OStringBuffer sOut; sOut.append('<') @@ -807,7 +785,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_language "=\""); rStrm.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStrm, rLanguage, eDestEnc, pNonConvertableChars ); + Out_String( rStrm, rLanguage, pNonConvertableChars ); sOut.append('\"'); } @@ -815,7 +793,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_src "=\""); rStrm.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(rBaseURL, rSrc), eDestEnc, pNonConvertableChars ); + Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(rBaseURL, rSrc), pNonConvertableChars ); sOut.append('\"'); } @@ -823,7 +801,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_sdlibrary "=\""); rStrm.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStrm, *pSBLibrary, eDestEnc, pNonConvertableChars ); + Out_String( rStrm, *pSBLibrary, pNonConvertableChars ); sOut.append('\"'); } @@ -831,7 +809,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_sdmodule "=\""); rStrm.WriteOString( sOut.makeStringAndClear() ); - Out_String( rStrm, *pSBModule, eDestEnc, pNonConvertableChars ); + Out_String( rStrm, *pSBModule, pNonConvertableChars ); sOut.append('\"'); } @@ -854,14 +832,14 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, if( pSBLibrary ) { sOut.append("' " OOO_STRING_SVTOOLS_HTML_SB_library " " + - OUStringToOString(*pSBLibrary, eDestEnc)); + OUStringToOString(*pSBLibrary, RTL_TEXTENCODING_UTF8)); rStrm.WriteOString( sOut.makeStringAndClear() ).WriteCharPtr( SAL_NEWLINE_STRING ); } if( pSBModule ) { sOut.append("' " OOO_STRING_SVTOOLS_HTML_SB_module " " + - OUStringToOString(*pSBModule, eDestEnc)); + OUStringToOString(*pSBModule, RTL_TEXTENCODING_UTF8)); rStrm.WriteOString( sOut.makeStringAndClear() ).WriteCharPtr( SAL_NEWLINE_STRING ); } } @@ -870,7 +848,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, { // we write the module in ANSI-charset, but with // the system new line. - const OString sSource(OUStringToOString(rSource, eDestEnc)); + const OString sSource(OUStringToOString(rSource, RTL_TEXTENCODING_UTF8)); rStrm.WriteOString( sSource ).WriteCharPtr( SAL_NEWLINE_STRING ); } rStrm.WriteCharPtr( SAL_NEWLINE_STRING ); @@ -894,7 +872,6 @@ SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm, const SvxMacroTableDtor& rMacroTable, const HTMLOutEvent *pEventTable, bool bOutStarBasic, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { sal_uInt16 i=0; @@ -915,7 +892,7 @@ SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm, OString sOut = OString::Concat(" ") + pStr + "=\""; rStrm.WriteOString( sOut ); - Out_String( rStrm, pMacro->GetMacName(), eDestEnc, pNonConvertableChars ).WriteChar( '\"' ); + Out_String( rStrm, pMacro->GetMacName(), pNonConvertableChars ).WriteChar( '\"' ); } } i++; @@ -927,7 +904,7 @@ SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm, OString HTMLOutFuncs::CreateTableDataOptionsValNum( bool bValue, double fVal, sal_uInt32 nFormat, SvNumberFormatter& rFormatter, - rtl_TextEncoding eDestEnc, OUString* pNonConvertableChars) + OUString* pNonConvertableChars) { OStringBuffer aStrTD; @@ -936,7 +913,7 @@ OString HTMLOutFuncs::CreateTableDataOptionsValNum( // printf / scanf is not precise enough OUString aValStr; rFormatter.GetInputLineString( fVal, 0, aValStr ); - OString sTmp(OUStringToOString(aValStr, eDestEnc)); + OString sTmp(OUStringToOString(aValStr, RTL_TEXTENCODING_UTF8)); aStrTD.append(" " OOO_STRING_SVTOOLS_HTML_O_SDval "=\"" + sTmp + "\""); } @@ -954,7 +931,7 @@ OString HTMLOutFuncs::CreateTableDataOptionsValNum( if ( pFormatEntry ) { aNumStr = ConvertStringToHTML( pFormatEntry->GetFormatstring(), - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); nLang = pFormatEntry->GetLanguage(); } else diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index f18c5a02470f..5ba0fa510589 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1125,10 +1125,6 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testChinese) OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "reqif-chinese.odt"; mxComponent = loadFromDesktop(aURL, "com.sun.star.text.TextDocument", {}); - // Prevent parseXmlStream guess incompatible encoding and complaint. - rtl_TextEncoding eOldEncoding = SvxHtmlOptions::GetTextEncoding(); - SvxHtmlOptions::SetTextEncoding(RTL_TEXTENCODING_UTF8); - // Export it. ExportToReqif(); SvMemoryStream aStream; @@ -1138,7 +1134,6 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testChinese) // Without the accompanying fix in place, this test would have failed as the output was not // well-formed. CPPUNIT_ASSERT(pDoc); - SvxHtmlOptions::SetTextEncoding(eOldEncoding); } CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifComment) diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 9e4de8c52527..731381f1a071 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -329,7 +329,7 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp, case CSS1_OUTMODE_RULE_ON: { OutNewLine(); - sOut.append(OUStringToOString(m_aCSS1Selector, m_eDestEnc) + " { "); + sOut.append(OUStringToOString(m_aCSS1Selector, RTL_TEXTENCODING_UTF8) + " { "); } break; @@ -351,9 +351,9 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp, Strm().WriteOString( sOut.makeStringAndClear() ); if( !sVal.empty() ) HTMLOutFuncs::Out_String( Strm(), OUString::createFromAscii(sVal), - m_eDestEnc, &m_aNonConvertableCharacters ); + &m_aNonConvertableCharacters ); else if( pSVal ) - HTMLOutFuncs::Out_String( Strm(), *pSVal, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), *pSVal, &m_aNonConvertableCharacters ); } else { @@ -361,7 +361,7 @@ void SwHTMLWriter::OutCSS1_Property( const char *pProp, if( !sVal.empty() ) sOut.append(sVal); else if( pSVal ) - sOut.append(OUStringToOString(*pSVal, m_eDestEnc)); + sOut.append(OUStringToOString(*pSVal, RTL_TEXTENCODING_UTF8)); } if (!sOut.isEmpty()) @@ -1680,7 +1680,7 @@ static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rPageDesc, if( rHTMLWrt.m_bFirstCSS1Property && bPseudo ) { rHTMLWrt.OutNewLine(); - OString sTmp(OUStringToOString(aSelector, rHTMLWrt.m_eDestEnc)); + OString sTmp(OUStringToOString(aSelector, RTL_TEXTENCODING_UTF8)); rWrt.Strm().WriteOString( sTmp ).WriteCharPtr( " {" ); rHTMLWrt.m_bFirstCSS1Property = false; } diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 874437ede6ec..1467a92c3eb6 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -896,7 +896,7 @@ static void OutHTML_SwFormat( Writer& rWrt, const SwFormat& rFormat, } } HTMLOutFuncs::Out_String( rWrt.Strm(), aClass, - rHWrt.m_eDestEnc, &rHWrt.m_aNonConvertableCharacters ); + &rHWrt.m_aNonConvertableCharacters ); sOut += "\""; } rWrt.Strm().WriteOString( sOut ); @@ -1134,10 +1134,8 @@ public: sal_uInt16 GetScriptAtPos( sal_Int32 nPos, sal_uInt16 nWeak ); - void OutStartAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos, - HTMLOutContext *pContext = nullptr ); - void OutEndAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos, - HTMLOutContext *pContext ); + void OutStartAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos ); + void OutEndAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos ); bool IsHTMLMode(sal_uLong nMode) const { return (m_nHTMLMode & nMode) != 0; } }; @@ -1867,8 +1865,7 @@ sal_uInt16 HTMLEndPosLst::GetScriptAtPos( sal_Int32 nPos, sal_uInt16 nWeak ) return nRet; } -void HTMLEndPosLst::OutStartAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos, - HTMLOutContext *pContext ) +void HTMLEndPosLst::OutStartAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos ) { rHWrt.m_bTagOn = true; @@ -1914,11 +1911,7 @@ void HTMLEndPosLst::OutStartAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos, { rHWrt.m_nCSS1Script = GetScriptAtPos( nPos, nCSS1Script ); } - if( pContext ) - { - HTMLOutFuncs::FlushToAscii( rHWrt.Strm(), *pContext ); - pContext = nullptr; // one time only - } + HTMLOutFuncs::FlushToAscii( rHWrt.Strm() ); // was one time only - do we still need it? Out( aHTMLAttrFnTab, *pPos->GetItem(), rHWrt ); rHWrt.maStartedAttributes[pPos->GetItem()->Which()]++; rHWrt.m_nCSS1Script = nCSS1Script; @@ -1926,8 +1919,7 @@ void HTMLEndPosLst::OutStartAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos, } } -void HTMLEndPosLst::OutEndAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos, - HTMLOutContext *pContext = nullptr ) +void HTMLEndPosLst::OutEndAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos ) { rHWrt.m_bTagOn = false; @@ -1940,11 +1932,7 @@ void HTMLEndPosLst::OutEndAttrs( SwHTMLWriter& rHWrt, sal_Int32 nPos, if( SAL_MAX_INT32 == nPos || nEnd == nPos ) { - if( pContext ) - { - HTMLOutFuncs::FlushToAscii( rHWrt.Strm(), *pContext ); - pContext = nullptr; // one time only - } + HTMLOutFuncs::FlushToAscii( rHWrt.Strm() ); // was one time only - do we still need it? // Skip closing span if next character span has the same border (border merge) bool bSkipOut = false; if( pPos->GetItem()->Which() == RES_CHRATR_BOX ) @@ -2271,7 +2259,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) if( !aOutlineText.isEmpty() ) HTMLOutFuncs::Out_String( rWrt.Strm(), aOutlineText, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters); + &rHTMLWrt.m_aNonConvertableCharacters); if( rHTMLWrt.m_pFormatFootnote ) { @@ -2344,8 +2332,6 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) } { - HTMLOutContext aContext( rHTMLWrt.m_eDestEnc ); - // Tabs are leading till there is a non-tab since the start of the paragraph. bool bLeadingTab = true; for( ; nStrPos < nEnd; nStrPos++ ) @@ -2353,10 +2339,9 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) // output the frames that are anchored to the current position if( bFlysLeft ) { - aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset, &aContext ); + aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset ); bFlysLeft = rHTMLWrt.OutFlyFrame( rNode.GetIndex(), - nStrPos, HtmlPosition::Inside, - &aContext ); + nStrPos, HtmlPosition::Inside ); } bool bOutChar = true; @@ -2413,8 +2398,8 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) rHTMLWrt.m_CharFormatInfos ); } - aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset, &aContext ); - aEndPosLst.OutStartAttrs( rHTMLWrt, nStrPos + nOffset, &aContext ); + aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset ); + aEndPosLst.OutStartAttrs( rHTMLWrt, nStrPos + nOffset ); if( pTextHt ) { @@ -2424,7 +2409,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) sal_uInt16 nCSS1Script = rHTMLWrt.m_nCSS1Script; rHTMLWrt.m_nCSS1Script = aEndPosLst.GetScriptAtPos( nStrPos + nOffset, nCSS1Script ); - HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext ); + HTMLOutFuncs::FlushToAscii( rWrt.Strm() ); Out( aHTMLAttrFnTab, pTextHt->GetAttr(), rHTMLWrt ); rHTMLWrt.m_nCSS1Script = nCSS1Script; rHTMLWrt.m_bLFPossible = false; @@ -2459,7 +2444,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) (nLineLen >= rHTMLWrt.m_nWishLineLen || (nLineLen+nWordLen) >= rHTMLWrt.m_nWishLineLen ) ) { - HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext ); + HTMLOutFuncs::FlushToAscii( rWrt.Strm() ); rHTMLWrt.OutNewLine(); bOutChar = false; } @@ -2469,7 +2454,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) { if( 0x0a == c ) { - HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext ); + HTMLOutFuncs::FlushToAscii( rWrt.Strm() ); HtmlWriter aHtml(rWrt.Strm(), rHTMLWrt.maNamespace); aHtml.single(OOO_STRING_SVTOOLS_HTML_linebreak); } @@ -2505,7 +2490,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) if (!bConsumed) { - HTMLOutFuncs::Out_Char(rWrt.Strm(), c, aContext, + HTMLOutFuncs::Out_Char(rWrt.Strm(), c, &rHTMLWrt.m_aNonConvertableCharacters); } } @@ -2521,7 +2506,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) } } } - HTMLOutFuncs::FlushToAscii( rWrt.Strm(), aContext ); + HTMLOutFuncs::FlushToAscii( rWrt.Strm() ); } aEndPosLst.OutEndAttrs( rHTMLWrt, SAL_MAX_INT32 ); @@ -2724,7 +2709,7 @@ static Writer& OutHTML_SvxFont( Writer& rWrt, const SfxPoolItem& rHt ) OString sOut = "<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_span " " OOO_STRING_SVTOOLS_HTML_O_style "=\"font-family: "; rWrt.Strm().WriteOString(sOut); - HTMLOutFuncs::Out_String(rWrt.Strm(), aNames, rHTMLWrt.m_eDestEnc, + HTMLOutFuncs::Out_String(rWrt.Strm(), aNames, &rHTMLWrt.m_aNonConvertableCharacters) .WriteCharPtr("\">"); } @@ -2733,7 +2718,7 @@ static Writer& OutHTML_SvxFont( Writer& rWrt, const SfxPoolItem& rHt ) OString sOut = "<" + rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_font " " OOO_STRING_SVTOOLS_HTML_O_face "=\""; rWrt.Strm().WriteOString( sOut ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aNames, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ) + HTMLOutFuncs::Out_String( rWrt.Strm(), aNames, &rHTMLWrt.m_aNonConvertableCharacters ) .WriteCharPtr( "\">" ); } } @@ -3044,7 +3029,7 @@ Writer& OutHTML_INetFormat( Writer& rWrt, const SwFormatINetFormat& rINetFormat, sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\""; rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), rINetFormat.GetName(), - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); sOut = "\""; } @@ -3053,7 +3038,7 @@ Writer& OutHTML_INetFormat( Writer& rWrt, const SwFormatINetFormat& rINetFormat, { sOut += " " OOO_STRING_SVTOOLS_HTML_O_target "=\""; rWrt.Strm().WriteOString( sOut ); - HTMLOutFuncs::Out_String( rWrt.Strm(), rTarget, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), rTarget, &rHTMLWrt.m_aNonConvertableCharacters ); sOut = "\""; } @@ -3065,7 +3050,7 @@ Writer& OutHTML_INetFormat( Writer& rWrt, const SwFormatINetFormat& rINetFormat, if( bEvents ) HTMLOutFuncs::Out_Events( rWrt.Strm(), *pMacTable, aAnchorEventTable, - rHTMLWrt.m_bCfgStarBasic, rHTMLWrt.m_eDestEnc, + rHTMLWrt.m_bCfgStarBasic, &rHTMLWrt.m_aNonConvertableCharacters ); rWrt.Strm().WriteCharPtr( ">" ); @@ -3176,7 +3161,7 @@ static Writer& OutHTML_SwTextCharFormat( Writer& rWrt, const SfxPoolItem& rHt ) } } HTMLOutFuncs::Out_String( rWrt.Strm(), aClass, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); sOut = "\""; } sOut += ">"; diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 65badb54f68b..098233e5dbfc 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -284,7 +284,7 @@ void SwHTMLWriter::OutBasic(const SwHTMLWriter & rHTMLWrt) "=\"text/x-"; Strm().WriteOString( sOut ); // Entities aren't welcome here - Strm().WriteOString( OUStringToOString(sLang, m_eDestEnc) ) + Strm().WriteOString( OUStringToOString(sLang, RTL_TEXTENCODING_UTF8) ) .WriteCharPtr( "\">" ); } @@ -293,7 +293,7 @@ void SwHTMLWriter::OutBasic(const SwHTMLWriter & rHTMLWrt) HTMLOutFuncs::OutScript( Strm(), GetBaseURL(), pModule->GetSource32(), sLang, STARBASIC, OUString(), &rLibName, &rModName, - m_eDestEnc, &m_aNonConvertableCharacters ); + &m_aNonConvertableCharacters ); } } #endif @@ -325,7 +325,7 @@ void SwHTMLWriter::OutBasicBodyEvents() if( !aDocTable.empty() ) HTMLOutFuncs::Out_Events( Strm(), aDocTable, aBodyEventTable, - m_bCfgStarBasic, m_eDestEnc, &m_aNonConvertableCharacters ); + m_bCfgStarBasic, &m_aNonConvertableCharacters ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx index fde32e78170d..8ba6299b99c8 100644 --- a/sw/source/filter/html/htmldrawwriter.cxx +++ b/sw/source/filter/html/htmldrawwriter.cxx @@ -274,7 +274,7 @@ Writer& OutHTML_DrawFrameFormatAsMarquee( Writer& rWrt, OUString aText( aOutliner.GetText( aOutliner.GetParagraph(0), aOutliner.GetParagraphCount() ) ); HTMLOutFuncs::Out_String( rWrt.Strm(), aText, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_marquee), false ); diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index dbe4fe8d9092..a28ffade717f 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -286,14 +286,14 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aName, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append('\"'); } if( !aValue.isEmpty() ) { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_value "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aValue, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aValue, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append('\"'); } if( bNumFormat ) @@ -301,7 +301,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, OSL_ENSURE( nFormat, "number format is 0" ); sOut.append(HTMLOutFuncs::CreateTableDataOptionsValNum( bNumValue, dNumValue, nFormat, - *rHTMLWrt.m_pDoc->GetNumberFormatter(), rHTMLWrt.m_eDestEnc, + *rHTMLWrt.m_pDoc->GetNumberFormatter(), &rHTMLWrt.m_aNonConvertableCharacters)); } if( bFixed ) @@ -409,7 +409,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, } HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand.copy( nPos, nChunkLen ), - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); rHTMLWrt.m_bTagOn = false; while( nItems ) @@ -419,7 +419,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, else { HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand.copy( nPos, nChunkLen ), - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); } nPos = nEndPos; } @@ -428,7 +428,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, else { HTMLOutFuncs::Out_String( rWrt.Strm(), sExpand, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); } // Output the closing tag. @@ -459,7 +459,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) // TODO: HTML-Tags are written without entities, that for, characters // not contained in the destination encoding are lost! OString sTmp(OUStringToOString(rText, - static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc)); + RTL_TEXTENCODING_UTF8)); rWrt.Strm().WriteOString( sTmp ).WriteChar( '>' ); } else if( SwFieldIds::Postit == pFieldTyp->Which() ) @@ -480,7 +480,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) // TODO: HTML-Tags are written without entities, that for, // characters not contained in the destination encoding are lost! OString sTmp(OUStringToOString(sComment, - static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc)); + RTL_TEXTENCODING_UTF8)); rWrt.Strm().WriteOString( sTmp ); bWritten = true; } @@ -496,7 +496,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) // characters not contained in the destination encoding are // lost! OString sTmp(OUStringToOString(sComment, - static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc)); + RTL_TEXTENCODING_UTF8)); rWrt.Strm().WriteOString( sTmp ); bWritten = true; } @@ -510,7 +510,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) OString sOut = "<" OOO_STRING_SVTOOLS_HTML_comment " " + - OUStringToOString(sComment, static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc) + + OUStringToOString(sComment, RTL_TEXTENCODING_UTF8) + " -->"; rWrt.Strm().WriteOString( sOut ); } @@ -531,7 +531,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) // otherwise is the script content itself. Since only JavaScript // is in fields, it must be JavaScript ...:) HTMLOutFuncs::OutScript( rWrt.Strm(), rWrt.GetBaseURL(), aContents, rType, JAVASCRIPT, - aURL, nullptr, nullptr, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + aURL, nullptr, nullptr, &rHTMLWrt.m_aNonConvertableCharacters ); if( rHTMLWrt.m_bLFPossible ) rHTMLWrt.OutNewLine( true ); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index ade669f80b79..ba7c67200f5b 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -353,8 +353,7 @@ void SwHTMLWriter::CollectFlyFrames() } } -bool SwHTMLWriter::OutFlyFrame( SwNodeOffset nNdIdx, sal_Int32 nContentIdx, HtmlPosition nPos, - HTMLOutContext *pContext ) +bool SwHTMLWriter::OutFlyFrame( SwNodeOffset nNdIdx, sal_Int32 nContentIdx, HtmlPosition nPos ) { bool bFlysLeft = false; // Are there still Flys left at the current node position? @@ -390,11 +389,7 @@ bool SwHTMLWriter::OutFlyFrame( SwNodeOffset nNdIdx, sal_Int32 nContentIdx, Html bRestart = true; // not really, only exit the loop } - if( pContext ) - { - HTMLOutFuncs::FlushToAscii(Strm(), *pContext ); - pContext = nullptr; // one time only - } + HTMLOutFuncs::FlushToAscii(Strm()); // it was one time only; do we still need it? OutFrameFormat( pPosFly->GetOutMode(), pPosFly->GetFormat(), pPosFly->GetSdrObject() ); @@ -532,7 +527,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, (nFrameOpts & HtmlFrmOpts::Id) ? OOO_STRING_SVTOOLS_HTML_O_id : OOO_STRING_SVTOOLS_HTML_O_name; sOut.append(OString::Concat(" ") + pStr + "=\""); Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( Strm(), rFrameFormat.GetName(), m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), rFrameFormat.GetName(), &m_aNonConvertableCharacters ); sOut.append('\"'); } @@ -549,7 +544,7 @@ OString SwHTMLWriter::OutFrameFormatOptions( const SwFrameFormat &rFrameFormat, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_alt "=\""); Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( Strm(), rAlternateText, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), rAlternateText, &m_aNonConvertableCharacters ); sOut.append('\"'); } @@ -1182,7 +1177,6 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con aIMapEventTable, rHTMLWrt.m_bCfgStarBasic, SAL_NEWLINE_STRING, pIndArea, pIndMap, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); } else @@ -1191,7 +1185,6 @@ OUString lclWriteOutImap(SwHTMLWriter& rHTMLWrt, const SfxItemSet& rItemSet, con aIMapEventTable, rHTMLWrt.m_bCfgStarBasic, SAL_NEWLINE_STRING, pIndArea, pIndMap, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); } } @@ -1501,14 +1494,14 @@ Writer& OutHTML_BulletImage( Writer& rWrt, { sOut.append(OOO_STRING_SVTOOLS_HTML_O_src "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aLink, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aLink, &rHTMLWrt.m_aNonConvertableCharacters ); } else { sOut.append("list-style-image: url(" OOO_STRING_SVTOOLS_HTML_O_data ":"); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aGraphicInBase64, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aGraphicInBase64, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append(");"); } sOut.append('\"'); diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index eaf475ceb603..da838b3bdfd2 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -80,7 +80,6 @@ const HtmlFrmOpts HTML_FRMOPTS_IMG_CONTROL_CSS1 = static void lcl_html_outEvents( SvStream& rStrm, const uno::Reference< form::XFormComponent >& rFormComp, bool bCfgStarBasic, - rtl_TextEncoding eDestEnc, OUString *pNonConvertableChars ) { uno::Reference< uno::XInterface > xParentIfc = rFormComp->getParent(); @@ -176,7 +175,7 @@ static void lcl_html_outEvents( SvStream& rStrm, } sOut += "=\""; rStrm.WriteOString( sOut ); - HTMLOutFuncs::Out_String( rStrm, rDesc.ScriptCode, eDestEnc, pNonConvertableChars ); + HTMLOutFuncs::Out_String( rStrm, rDesc.ScriptCode, pNonConvertableChars ); rStrm.WriteChar( '\"' ); if( EXTENDED_STYPE == eScriptType && !rDesc.AddListenerParam.isEmpty() ) @@ -186,7 +185,7 @@ static void lcl_html_outEvents( SvStream& rStrm, OUStringToOString(sMethod, RTL_TEXTENCODING_ASCII_US) + "=\""; rStrm.WriteOString( sOut ); HTMLOutFuncs::Out_String( rStrm, rDesc.AddListenerParam, - eDestEnc, pNonConvertableChars ); + pNonConvertableChars ); rStrm.WriteChar( '\"' ); } } @@ -458,7 +457,7 @@ void SwHTMLWriter::OutForm( bool bOn, sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\""; Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( Strm(), *s, - m_eDestEnc, &m_aNonConvertableCharacters ); + &m_aNonConvertableCharacters ); sOut = "\""; } } @@ -472,7 +471,7 @@ void SwHTMLWriter::OutForm( bool bOn, Strm().WriteOString( sOut ); OUString aURL = URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), *s); - HTMLOutFuncs::Out_String( Strm(), aURL, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), aURL, &m_aNonConvertableCharacters ); sOut = "\""; } } @@ -517,14 +516,14 @@ void SwHTMLWriter::OutForm( bool bOn, sOut += " " OOO_STRING_SVTOOLS_HTML_O_target "=\""; Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( Strm(), *s, - m_eDestEnc, &m_aNonConvertableCharacters ); + &m_aNonConvertableCharacters ); sOut = "\""; } } Strm().WriteOString( sOut ); uno::Reference< form::XFormComponent > xFormComp( rFormComps, uno::UNO_QUERY ); - lcl_html_outEvents( Strm(), xFormComp, m_bCfgStarBasic, m_eDestEnc, &m_aNonConvertableCharacters ); + lcl_html_outEvents( Strm(), xFormComp, m_bCfgStarBasic, &m_aNonConvertableCharacters ); Strm().WriteChar( '>' ); IncIndentLevel(); // indent content of form @@ -587,7 +586,7 @@ void SwHTMLWriter::OutHiddenControls( sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\""; Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( Strm(), *s, - m_eDestEnc, &m_aNonConvertableCharacters ); + &m_aNonConvertableCharacters ); sOut = "\""; } } @@ -599,7 +598,7 @@ void SwHTMLWriter::OutHiddenControls( sOut += " " OOO_STRING_SVTOOLS_HTML_O_value "=\""; Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( Strm(), *s, - m_eDestEnc, &m_aNonConvertableCharacters ); + &m_aNonConvertableCharacters ); sOut = "\""; } } @@ -940,7 +939,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, sOut += " " OOO_STRING_SVTOOLS_HTML_O_name "=\""; rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), *s, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); sOut = "\""; } } @@ -958,7 +957,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, { sOut += " " OOO_STRING_SVTOOLS_HTML_O_value "=\""; rWrt.Strm().WriteOString( sOut ); - HTMLOutFuncs::Out_String( rWrt.Strm(), sValue, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), sValue, &rHTMLWrt.m_aNonConvertableCharacters ); sOut = "\""; } @@ -976,7 +975,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, HTMLOutFuncs::Out_String( rWrt.Strm(), URIHelper::simpleNormalizedMakeRelative( rWrt.GetBaseURL(), *s), - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); sOut = "\""; } } @@ -1147,7 +1146,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, uno::Reference< form::XFormComponent > xFormComp( xControlModel, uno::UNO_QUERY ); lcl_html_outEvents( rWrt.Strm(), xFormComp, rHTMLWrt.m_bCfgStarBasic, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); rWrt.Strm().WriteChar( '>' ); @@ -1207,7 +1206,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, sOut += " " OOO_STRING_SVTOOLS_HTML_O_value "=\""; rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), sVal, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); sOut = "\""; } if( bSelected ) @@ -1217,7 +1216,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), pStrings[i], - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); } HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_option), false ); @@ -1248,7 +1247,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, rWrt.Strm().WriteCharPtr( SAL_NEWLINE_STRING ); OUString aLine = sVal.getToken( 0, 0x0A, nPos ); HTMLOutFuncs::Out_String( rWrt.Strm(), aLine, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); } } HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_textarea), false ); @@ -1261,7 +1260,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, if( !s->isEmpty() ) { HTMLOutFuncs::Out_String( rWrt.Strm(), *s, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ).WriteChar( ' ' ); + &rHTMLWrt.m_aNonConvertableCharacters ).WriteChar( ' ' ); } } } diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index 0020a4166eae..6702a80efe3f 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -305,14 +305,14 @@ Writer& OutHTML_SwFormatFootnote( Writer& rWrt, const SfxPoolItem& rHt ) OString aTag = rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor; sOut.append("<" + aTag + " " OOO_STRING_SVTOOLS_HTML_O_class "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), sClass, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), sClass, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append("\" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), sFootnoteName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), sFootnoteName, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append(OOO_STRING_SVTOOLS_HTML_FTN_anchor "\" " OOO_STRING_SVTOOLS_HTML_O_href "=\"#"); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), sFootnoteName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), sFootnoteName, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append(OOO_STRING_SVTOOLS_HTML_FTN_symbol "\""); if( !rFormatFootnote.GetNumStr().isEmpty() ) sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_sdfixed); @@ -321,7 +321,7 @@ Writer& OutHTML_SwFormatFootnote( Writer& rWrt, const SfxPoolItem& rHt ) HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_superscript )); HTMLOutFuncs::Out_String( rWrt.Strm(), rFormatFootnote.GetViewNumStr(*rWrt.m_pDoc, nullptr), - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_superscript), false ); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor), false ); @@ -361,7 +361,7 @@ void SwHTMLWriter::OutFootEndNotes() "<" + GetNamespace() + OOO_STRING_SVTOOLS_HTML_division " " OOO_STRING_SVTOOLS_HTML_O_id "=\""; Strm().WriteOString( sOut ); - HTMLOutFuncs::Out_String( Strm(), sFootnoteName, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), sFootnoteName, &m_aNonConvertableCharacters ); Strm().WriteCharPtr( "\">" ); m_bLFPossible = true; @@ -468,18 +468,18 @@ void SwHTMLWriter::OutFootEndNoteSym( const SwFormatFootnote& rFormatFootnote, sOut.append("<" + GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor " " OOO_STRING_SVTOOLS_HTML_O_class "=\""); Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( Strm(), sClass, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), sClass, &m_aNonConvertableCharacters ); sOut.append("\" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( Strm(), sFootnoteName, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), sFootnoteName, &m_aNonConvertableCharacters ); sOut.append(OOO_STRING_SVTOOLS_HTML_FTN_symbol "\" " OOO_STRING_SVTOOLS_HTML_O_href "=\"#"); Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( Strm(), sFootnoteName, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), sFootnoteName, &m_aNonConvertableCharacters ); sOut.append(OOO_STRING_SVTOOLS_HTML_FTN_anchor "\">"); Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( Strm(), rNum, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), rNum, &m_aNonConvertableCharacters ); HTMLOutFuncs::Out_AsciiTag( Strm(), OStringConcatenation(GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor), false ); } @@ -539,7 +539,7 @@ static void lcl_html_outFootEndNoteInfo( Writer& rWrt, OUString const *pParts, OOO_STRING_SVTOOLS_HTML_O_name "=\"" + pName + "\" " OOO_STRING_SVTOOLS_HTML_O_content "=\""; rWrt.Strm().WriteOString( sOut ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aContent.makeStringAndClear(), rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aContent.makeStringAndClear(), &rHTMLWrt.m_aNonConvertableCharacters ); rWrt.Strm().WriteCharPtr( "\">" ); } diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index eeefc4e41c33..4912a8adc4da 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1245,7 +1245,7 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_src "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aURL, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aURL, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append('\"'); } @@ -1255,7 +1255,7 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_type "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aType, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aType, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append('\"'); } @@ -1289,7 +1289,7 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_codebase "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), sCodeBase, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), sCodeBase, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append('\"'); } } @@ -1300,7 +1300,7 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor aAny >>= aClass; sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_code "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aClass, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aClass, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append('\"'); // NAME @@ -1311,7 +1311,7 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_name "=\""); rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), aAppletName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), aAppletName, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append('\"'); } @@ -1333,7 +1333,6 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor SfxFrameHTMLWriter::Out_FrameDescriptor( rWrt.Strm(), rWrt.GetBaseURL(), xSet, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); nFrameOpts = bInCntnr ? HTML_FRMOPTS_IFRAME_CNTNR @@ -1371,9 +1370,9 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor { const OUString& rValue = rCommand.GetArgument(); rWrt.Strm().WriteChar( ' ' ); - HTMLOutFuncs::Out_String( rWrt.Strm(), rName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), rName, &rHTMLWrt.m_aNonConvertableCharacters ); rWrt.Strm().WriteCharPtr( "=\"" ); - HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ).WriteChar( '\"' ); + HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, &rHTMLWrt.m_aNonConvertableCharacters ).WriteChar( '\"' ); } else if( SwHtmlOptType::PARAM == nType ) { @@ -1397,10 +1396,10 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor " " OOO_STRING_SVTOOLS_HTML_O_name "=\""); rWrt.Strm().WriteOString( sBuf.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), rName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), rName, &rHTMLWrt.m_aNonConvertableCharacters ); sBuf.append("\" " OOO_STRING_SVTOOLS_HTML_O_value "=\""); rWrt.Strm().WriteOString( sBuf.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ).WriteCharPtr( "\">" ); + HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, &rHTMLWrt.m_aNonConvertableCharacters ).WriteCharPtr( "\">" ); } rHTMLWrt.DecIndentLevel(); // indent the applet content @@ -1427,9 +1426,9 @@ Writer& OutHTML_FrameFormatOLENode( Writer& rWrt, const SwFrameFormat& rFrameFor { const OUString& rValue = rCommand.GetArgument(); rWrt.Strm().WriteChar( ' ' ); - HTMLOutFuncs::Out_String( rWrt.Strm(), rName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), rName, &rHTMLWrt.m_aNonConvertableCharacters ); rWrt.Strm().WriteCharPtr( "=\"" ); - HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ).WriteChar( '\"' ); + HTMLOutFuncs::Out_String( rWrt.Strm(), rValue, &rHTMLWrt.m_aNonConvertableCharacters ).WriteChar( '\"' ); } } rHTMLWrt.Strm().WriteChar( '>' ); diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index e39cb506ff10..89eb33fe56d8 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -452,7 +452,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, if( bNumFormat || bValue ) { sOut.append(HTMLOutFuncs::CreateTableDataOptionsValNum(bValue, nValue, - nNumFormat, *rWrt.m_pDoc->GetNumberFormatter(), rWrt.m_eDestEnc, + nNumFormat, *rWrt.m_pDoc->GetNumberFormatter(), &rWrt.m_aNonConvertableCharacters)); } sOut.append('>'); @@ -718,7 +718,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, .append(bTopCaption ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom) .append("\""); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rWrt.GetNamespace() + sOutStr) ); - HTMLOutFuncs::Out_String( rWrt.Strm(), *pCaption, rWrt.m_eDestEnc, &rWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rWrt.Strm(), *pCaption, &rWrt.m_aNonConvertableCharacters ); HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), OStringConcatenation(rWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_caption), false ); } diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 9ac3f2519660..a25bdcdf555b 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -125,7 +125,6 @@ SwHTMLWriter::SwHTMLWriter( const OUString& rBaseURL, std::u16string_view rFilte , m_nCSS1OutMode(0) , m_nCSS1Script(CSS1_OUTMODE_WESTERN) , m_nDirection(SvxFrameDirection::Horizontal_LR_TB) - , m_eDestEnc(RTL_TEXTENCODING_MS_1252) , m_eLang(LANGUAGE_DONTKNOW) , m_bCfgOutStyles( false ) , m_bCfgPreferStyles( false ) @@ -405,11 +404,6 @@ ErrCode SwHTMLWriter::WriteStream() m_eCSS1Unit = SW_MOD()->GetMetric( m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) ); - bool bWriteUTF8 = m_bWriteClipboardDoc; - m_eDestEnc = bWriteUTF8 ? RTL_TEXTENCODING_UTF8 : SvxHtmlOptions::GetTextEncoding(); - const char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( m_eDestEnc ); - m_eDestEnc = rtl_getTextEncodingFromMimeCharset( pCharSet ); - // Only for the MS-IE we favour the export of styles. m_bCfgPreferStyles = HTML_CFG_MSIE == m_nExportMode; @@ -518,7 +512,7 @@ ErrCode SwHTMLWriter::WriteStream() // save only the tag of section OString aName = HTMLOutFuncs::ConvertStringToHTML( - pSNd->GetSection().GetSectionName(), m_eDestEnc, + pSNd->GetSection().GetSectionName(), &m_aNonConvertableCharacters ); aStartTags = @@ -716,7 +710,7 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, { sOut.append(" " OOO_STRING_SVTOOLS_HTML_O_id "=\""); rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), rName, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), rName, &rHTMLWrt.m_aNonConvertableCharacters ); sOut.append('\"'); } @@ -740,13 +734,12 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, bool bURLContainsDelim = (-1 != aEncURL.indexOf( cDelim ) ); HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), aEncURL, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); const char* const pDelim = "ÿ"; if( !aFilter.isEmpty() || !aSection.isEmpty() || bURLContainsDelim ) rHTMLWrt.Strm().WriteCharPtr( pDelim ); if( !aFilter.isEmpty() ) - HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), aFilter, rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), aFilter, &rHTMLWrt.m_aNonConvertableCharacters ); if( !aSection.isEmpty() || bURLContainsDelim ) rHTMLWrt.Strm().WriteCharPtr( pDelim ); if( !aSection.isEmpty() ) @@ -764,7 +757,7 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& rHTMLWrt, nPos = aSection.indexOf( cDelim, nPos+3 ); } HTMLOutFuncs::Out_String( rHTMLWrt.Strm(), aSection, - rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); + &rHTMLWrt.m_aNonConvertableCharacters ); } sOut.append('\"'); } @@ -1102,7 +1095,7 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) // xDocProps may be null here (when copying) SfxFrameHTMLWriter::Out_DocInfo( Strm(), GetBaseURL(), xDocProps, - sIndent.getStr(), m_eDestEnc, + sIndent.getStr(), &m_aNonConvertableCharacters ); // comments and meta-tags of first paragraph @@ -1209,7 +1202,7 @@ void SwHTMLWriter::OutAnchor( const OUString& rName ) { sOut.append(OOO_STRING_SVTOOLS_HTML_O_name "=\""); Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( Strm(), rName, m_eDestEnc, &m_aNonConvertableCharacters ).WriteCharPtr( "\">" ); + HTMLOutFuncs::Out_String( Strm(), rName, &m_aNonConvertableCharacters ).WriteCharPtr( "\">" ); } else { @@ -1217,7 +1210,7 @@ void SwHTMLWriter::OutAnchor( const OUString& rName ) // spaces. sOut.append(OOO_STRING_SVTOOLS_HTML_O_id "=\""); Strm().WriteOString( sOut.makeStringAndClear() ); - HTMLOutFuncs::Out_String( Strm(), rName.replace(' ', '_'), m_eDestEnc, &m_aNonConvertableCharacters ).WriteCharPtr( "\">" ); + HTMLOutFuncs::Out_String( Strm(), rName.replace(' ', '_'), &m_aNonConvertableCharacters ).WriteCharPtr( "\">" ); } HTMLOutFuncs::Out_AsciiTag( Strm(), OStringConcatenation(GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor), false ); } @@ -1352,7 +1345,7 @@ OUString SwHTMLWriter::convertHyperlinkHRefValue(const OUString& rURL) void SwHTMLWriter::OutHyperlinkHRefValue( const OUString& rURL ) { OUString sURL = convertHyperlinkHRefValue(rURL); - HTMLOutFuncs::Out_String( Strm(), sURL, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), sURL, &m_aNonConvertableCharacters ); } void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic ) @@ -1382,7 +1375,7 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic } Strm().WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_background "=\"" ); Strm().WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_data ":" ); - HTMLOutFuncs::Out_String( Strm(), aGraphicInBase64, m_eDestEnc, &m_aNonConvertableCharacters ).WriteChar( '\"' ); + HTMLOutFuncs::Out_String( Strm(), aGraphicInBase64, &m_aNonConvertableCharacters ).WriteChar( '\"' ); } } else @@ -1393,7 +1386,7 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic } OUString s( URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), GraphicURL)); Strm().WriteCharPtr(" " OOO_STRING_SVTOOLS_HTML_O_background "=\"" ); - HTMLOutFuncs::Out_String( Strm(), s, m_eDestEnc, &m_aNonConvertableCharacters ); + HTMLOutFuncs::Out_String( Strm(), s, &m_aNonConvertableCharacters ); Strm().WriteCharPtr("\""); } @@ -1440,7 +1433,7 @@ void SwHTMLWriter::OutLanguage( LanguageType nLang ) sOut.append("=\""); Strm().WriteOString( sOut.makeStringAndClear() ); HTMLOutFuncs::Out_String( Strm(), LanguageTag::convertToBcp47(nLang), - m_eDestEnc, &m_aNonConvertableCharacters ).WriteChar( '"' ); + &m_aNonConvertableCharacters ).WriteChar( '"' ); } SvxFrameDirection SwHTMLWriter::GetHTMLDirection( const SfxItemSet& rItemSet ) const diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx index 674b86d27ab1..937d7367907e 100644 --- a/sw/source/filter/html/wrthtml.hxx +++ b/sw/source/filter/html/wrthtml.hxx @@ -335,7 +335,6 @@ public: // that is not contained in class names) SvxFrameDirection m_nDirection; // the current direction - rtl_TextEncoding m_eDestEnc; LanguageType m_eLang; // description of the export configuration @@ -439,7 +438,7 @@ public: // output the FlyFrame anchored at current position bool OutFlyFrame( SwNodeOffset nNdIdx, sal_Int32 nContentIdx, - HtmlPosition nPos, HTMLOutContext *pContext = nullptr ); + HtmlPosition nPos ); void OutFrameFormat( AllHtmlFlags nType, const SwFrameFormat& rFormat, const SdrObject *pSdrObj ); diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index d31654bf474c..ed7acab698c5 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -983,7 +983,7 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi case MM_DOCTYPE_HTML: { bAsBody = true; - eEncoding = SvxHtmlOptions::GetTextEncoding(); + eEncoding = RTL_TEXTENCODING_UTF8; } break; case MM_DOCTYPE_TEXT: diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index fd9add19834c..715f3f0d5cbc 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1123,9 +1123,8 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, xMailDispatcher->addListener( xMailListener ); if(!rMergeDescriptor.bSendAsAttachment && rMergeDescriptor.bSendAsHTML) { - sMailBodyMimeType = "text/html; charset=" + OUString::createFromAscii( - rtl_getBestMimeCharsetFromTextEncoding( sMailEncoding )); - sMailEncoding = SvxHtmlOptions::GetTextEncoding(); + sMailBodyMimeType = "text/html; charset=utf-8"; + sMailEncoding = RTL_TEXTENCODING_UTF8; } else sMailBodyMimeType = "text/plain; charset=UTF-8; format=flowed"; diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index a3e4ca436131..a143493fe384 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -158,9 +158,7 @@ static rtl_TextEncoding lcl_GetStreamCharSet(rtl_TextEncoding eLoadEncoding) rtl_TextEncoding eRet = eLoadEncoding; if(RTL_TEXTENCODING_DONTKNOW == eRet) { - const char *pCharSet = - rtl_getBestMimeCharsetFromTextEncoding( SvxHtmlOptions::GetTextEncoding() ); - eRet = rtl_getTextEncodingFromMimeCharset( pCharSet ); + eRet = RTL_TEXTENCODING_UTF8; } return eRet; } @@ -750,9 +748,7 @@ void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) void SwSrcView::Load(SwDocShell* pDocShell) { - const char *pCharSet = - rtl_getBestMimeCharsetFromTextEncoding( SvxHtmlOptions::GetTextEncoding() ); - rtl_TextEncoding eDestEnc = rtl_getTextEncodingFromMimeCharset( pCharSet ); + rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_UTF8; m_aEditWin->SetReadonly(pDocShell->IsReadOnly()); m_aEditWin->SetTextEncoding(eDestEnc); |