diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-02-07 17:54:49 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-02-08 09:07:19 +0100 |
commit | 303f8e5160ddb39914ba7f669698d5dbe958878a (patch) | |
tree | 9fb7eaf336df3434dd7ffe883323b2513edb427e /sw/source | |
parent | 89fa5e45c3cc87cba450aff965918bf5af8f2fa9 (diff) |
sw HTML import: avoid loading the Writer/Web template for the Writer filter
The share/template/common/internal/html.stw template we have is for
Writer/Web, loading that into Writer is questionable at best. Also it
means that the outline numbering of the heading styles is not set, which
is a problem, as the sw HTML import only sets the style, not the
outline numbering.
Change-Id: I86d11d8a5744c3c2ca71b03fd41a24d3f88ea333
Reviewed-on: https://gerrit.libreoffice.org/49381
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/basflt/shellio.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/html/wrthtml.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/inc/fltini.hxx | 2 |
4 files changed, 12 insertions, 8 deletions
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 037c12b4a993..3e98da244e51 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -442,17 +442,17 @@ Reader::~Reader() { } -OUString Reader::GetTemplateName() const +OUString Reader::GetTemplateName(SwDoc& /*rDoc*/) const { return OUString(); } // load the Filter template, set and release -SwDoc* Reader::GetTemplateDoc() +SwDoc* Reader::GetTemplateDoc(SwDoc& rDoc) { if( !bHasAskTemplateName ) { - SetTemplateName( GetTemplateName() ); + SetTemplateName( GetTemplateName(rDoc) ); bHasAskTemplateName = true; } @@ -529,7 +529,7 @@ bool Reader::SetTemplate( SwDoc& rDoc ) { bool bRet = false; - GetTemplateDoc(); + GetTemplateDoc(rDoc); if( mxTemplate.is() ) { rDoc.RemoveAllFormatLanguageDependencies(); @@ -901,7 +901,7 @@ ErrCode SwWriter::Write( WriterRef const & rxWriter, const OUString* pRealFileNa bool SetHTMLTemplate( SwDoc & rDoc ) { // get template name of the Sfx-HTML-Filter !!! - if( !ReadHTML->GetTemplateDoc() ) + if( !ReadHTML->GetTemplateDoc(rDoc) ) ReadHTML->MakeHTMLDummyTemplateDoc(); bool bRet = ReadHTML->SetTemplate( rDoc ); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index c21a373315ed..4586686e1693 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -158,8 +158,12 @@ HTMLReader::HTMLReader() bTmplBrowseMode = true; } -OUString HTMLReader::GetTemplateName() const +OUString HTMLReader::GetTemplateName(SwDoc& rDoc) const { + if (!rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)) + // HTML import into Writer, avoid loading the Writer/Web template. + return OUString(); + const OUString sTemplateWithoutExt("internal/html"); SvtPathOptions aPathOpt; diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 4fd3cd91be9d..dd6a2dd3f0ad 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -265,7 +265,7 @@ ErrCode SwHTMLWriter::WriteStream() SwCharFormats::size_type nOldCharFormatCnt = 0; OSL_ENSURE( !m_xTemplate.is(), "Where is the HTML template coming from?" ); - m_xTemplate = static_cast<HTMLReader*>(ReadHTML)->GetTemplateDoc(); + m_xTemplate = static_cast<HTMLReader*>(ReadHTML)->GetTemplateDoc(*pDoc); if( m_xTemplate.is() ) { bOldHTMLMode = m_xTemplate->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE); diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx index 2a6b55fc0724..c20859fa5250 100644 --- a/sw/source/filter/inc/fltini.hxx +++ b/sw/source/filter/inc/fltini.hxx @@ -34,7 +34,7 @@ class HTMLReader: public Reader // we don't want to have the streams/storages open virtual bool SetStrmStgPtr() override; virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; - virtual OUString GetTemplateName() const override; + virtual OUString GetTemplateName(SwDoc& rDoc) const override; public: HTMLReader(); }; |