[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source writerfilter/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 7 06:39:12 UTC 2021


 sw/source/uibase/dochdl/swdtflvr.cxx           |    6 ------
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    6 ++++--
 2 files changed, 4 insertions(+), 8 deletions(-)

New commits:
commit ef7ecb85645c68aeec2585240fa72e322e424020
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Apr 6 14:52:02 2021 +0300
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Apr 7 08:38:36 2021 +0200

    tdf#136740: reimplement the fix using existing m_bIsNewDoc
    
    This reimplements the fix from commit d7c4d0d4ea83481693af3645a03b03b53e456f60.
    The unit test from commit a90a324aa590a94a4091fbfadea67e0b0203767c still passes.
    
    Change-Id: I84c61fa68b9bee679a8e82ef7b8f164297bacb5a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113665
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 7fc2cafbba36db25e7d0083cea162d2df08611b5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113646
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 8caa6c50c358..894d9049bcfd 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -32,7 +32,6 @@
 #include <comphelper/fileformat.h>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
-#include <comphelper/SetFlagContextHelper.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/string.hxx>
 #include <o3tl/deleter.hxx>
@@ -2101,11 +2100,6 @@ bool SwTransferable::PasteFileContent( TransferableDataHelper& rData,
         rSh.SetChgLnk( Link<LinkParamNone*,void>() );
 
         const SwPosition& rInsPos = *rSh.GetCursor()->Start();
-
-        // Reader might need to know if we are pasting into an existing document, or initializing
-        // a new document; e.g. initializing document setting could be skipped when pasting.
-        css::uno::ContextLayer layer(comphelper::NewFlagContext("InPasteFromClipboard"));
-
         SwReader aReader(*pStream, OUString(), OUString(), *rSh.GetCursor());
         rSh.SaveTableBoxContent( &rInsPos );
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3cc89508c71c..a6bca50007ce 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -22,7 +22,6 @@
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
 #include <filter/msfilter/util.hxx>
 #include <filter/msfilter/rtfutil.hxx>
-#include <comphelper/SetFlagContextHelper.hxx>
 #include <comphelper/string.hxx>
 #include <tools/diagnose_ex.h>
 #include <tools/globname.hxx>
@@ -267,7 +266,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
     , m_pMapperStream(nullptr)
     , m_aDefaultState(this)
     , m_bSkipUnknown(false)
-    , m_bFirstRun(!comphelper::IsContextFlagActive("InPasteFromClipboard"))
+    , m_bFirstRun(true)
     , m_bFirstRunException(false)
     , m_bNeedPap(true)
     , m_bNeedCr(false)
@@ -372,6 +371,9 @@ void RTFDocumentImpl::resolveSubstream(std::size_t nPos, Id nId, OUString const&
 
 void RTFDocumentImpl::outputSettingsTable()
 {
+    // tdf#136740: do not change trarget document settings when pasting
+    if (!m_bIsNewDoc)
+        return;
     writerfilter::Reference<Properties>::Pointer_t pProp
         = new RTFReferenceProperties(m_aSettingsTableAttributes, m_aSettingsTableSprms);
     RTFReferenceTable::Entries_t aSettingsTableEntries;


More information about the Libreoffice-commits mailing list