[Libreoffice-commits] core.git: Branch 'distro/vector/vtext-6.5' - sw/inc sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Feb 8 12:53:05 UTC 2018


 sw/inc/shellio.hxx                  |    4 ++--
 sw/source/filter/basflt/shellio.cxx |   10 +++++-----
 sw/source/filter/html/swhtml.cxx    |    6 +++++-
 sw/source/filter/html/wrthtml.cxx   |    2 +-
 sw/source/filter/inc/fltini.hxx     |    2 +-
 5 files changed, 14 insertions(+), 10 deletions(-)

New commits:
commit 6c6095a92fb866ff4b62a277325215d8af06cfae
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Feb 7 17:54:49 2018 +0100

    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.
    
    Reviewed-on: https://gerrit.libreoffice.org/49381
    Tested-by: Jenkins <ci at libreoffice.org>
    
    (cherry picked from commit 303f8e5160ddb39914ba7f669698d5dbe958878a)
    
    Conflicts:
            sw/inc/shellio.hxx
            sw/qa/extras/htmlimport/htmlimport.cxx
            sw/source/filter/basflt/shellio.cxx
            sw/source/filter/html/swhtml.cxx
            sw/source/filter/html/wrthtml.cxx
            sw/source/filter/inc/fltini.hxx
    
    Change-Id: I86d11d8a5744c3c2ca71b03fd41a24d3f88ea333

diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index e0bdf94f2c65..409a0e3a4f33 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -220,7 +220,7 @@ protected:
     sal_Bool bHasAskTemplateName : 1;
     sal_Bool bIgnoreHTMLComments : 1;
 
-    virtual String GetTemplateName() const;
+    virtual String GetTemplateName(SwDoc& rDoc) const;
 
 public:
     Reader();
@@ -239,7 +239,7 @@ public:
     static void ResetFrmFmts( SwDoc& rDoc );
 
     // Load filter template, set it and release it again.
-    SwDoc* GetTemplateDoc();
+    SwDoc* GetTemplateDoc(SwDoc& rDoc);
     sal_Bool SetTemplate( SwDoc& rDoc );
     void ClearTemplate();
     void SetTemplateName( const String& rDir );
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index fc9ec6b3b8fc..c4f5d2483cd6 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -450,17 +450,17 @@ Reader::~Reader()
     delete pTemplate;
 }
 
-String Reader::GetTemplateName() const
+String Reader::GetTemplateName(SwDoc& /*rDoc*/) const
 {
     return aEmptyStr;
 }
 
 // Die Filter-Vorlage laden, setzen und wieder freigeben
-SwDoc* Reader::GetTemplateDoc()
+SwDoc* Reader::GetTemplateDoc(SwDoc& rDoc)
 {
     if( !bHasAskTemplateName )
     {
-        SetTemplateName( GetTemplateName() );
+        SetTemplateName( GetTemplateName(rDoc) );
         bHasAskTemplateName = sal_True;
     }
 
@@ -543,7 +543,7 @@ sal_Bool Reader::SetTemplate( SwDoc& rDoc )
 {
     sal_Bool bRet = sal_False;
 
-    GetTemplateDoc();
+    GetTemplateDoc(rDoc);
     if( pTemplate )
     {
         rDoc.RemoveAllFmtLanguageDependencies();
@@ -955,7 +955,7 @@ sal_uLong SwWriter::Write( WriterRef& rxWriter, const String* pRealFileName )
 sal_Bool SetHTMLTemplate( SwDoc & rDoc )
 {
     // Vorlagennamen von den Sfx-HTML-Filter besorgen!!!
-    if( !ReadHTML->GetTemplateDoc() )
+    if( !ReadHTML->GetTemplateDoc(rDoc) )
         ReadHTML->MakeHTMLDummyTemplateDoc();
 
     sal_Bool bRet = ReadHTML->SetTemplate( rDoc );
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index fcee5a4cd969..f7079d99f018 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -146,8 +146,12 @@ HTMLReader::HTMLReader()
     bTmplBrowseMode = sal_True;
 }
 
-String HTMLReader::GetTemplateName() const
+String HTMLReader::GetTemplateName(SwDoc& rDoc) const
 {
+    if (!rDoc.get(IDocumentSettingAccess::HTML_MODE))
+        // HTML import into Writer, avoid loading the Writer/Web template.
+        return String();
+
     String sTemplate(rtl::OUString("internal"));
     sTemplate += INET_PATH_TOKEN;
     sTemplate.AppendAscii( TOOLS_CONSTASCII_STRINGPARAM("html") );
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 470f2ca2d27d..62b93327f388 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -216,7 +216,7 @@ sal_uLong SwHTMLWriter::WriteStream()
     sal_uInt16 nOldTxtFmtCollCnt = 0, nOldCharFmtCnt = 0;
 
     OSL_ENSURE( !pTemplate, "Wo kommt denn die HTML-Vorlage hier her?" );
-    pTemplate = ((HTMLReader*)ReadHTML)->GetTemplateDoc();
+    pTemplate = ((HTMLReader*)ReadHTML)->GetTemplateDoc(*pDoc);
     if( pTemplate )
     {
         pTemplate->acquire();
diff --git a/sw/source/filter/inc/fltini.hxx b/sw/source/filter/inc/fltini.hxx
index b3758cdcb5c5..d74d2615d53c 100644
--- a/sw/source/filter/inc/fltini.hxx
+++ b/sw/source/filter/inc/fltini.hxx
@@ -34,7 +34,7 @@ class HTMLReader: public Reader
     // wir wollen die Streams / Storages nicht geoeffnet haben
     virtual int SetStrmStgPtr();
     virtual sal_uLong Read(SwDoc &, const String& rBaseURL, SwPaM &,const String &);
-    virtual String GetTemplateName() const;
+    virtual String GetTemplateName(SwDoc& rDoc) const;
 public:
     HTMLReader();
 };


More information about the Libreoffice-commits mailing list