diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-05 19:19:44 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-04-05 21:26:02 +0200 |
commit | d7c4d0d4ea83481693af3645a03b03b53e456f60 (patch) | |
tree | 89be104be26c98b02d691a1d73b76c2ddb452326 /sw | |
parent | b5602d5c853ce9479b2920743667e5af1cd63037 (diff) |
tdf#136740: Do not initialize document settings when pasting
When pasting from clipboard, the document already has the defaults
set, and pasted text must not change those defaults.
When pasting RTF, RTFDocumentImpl::outputSettingsTable does the document
settings initialization, and is called from RTFDocumentImpl::checkFirstRun
when m_bFirstRun is true. Other defaults are set in the latter function,
too.
This makes m_bFirstRun false when RTFDocumentImpl is created in the context
of a paste operation. Alternatively, checking the context could be made
when deciding if to apply specific settings.
Change-Id: Ide1eabbef1d04a4fa2f1ca14846b8e404f2a0cb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113613
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 6466f17af9c2..bf552656356d 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -32,6 +32,7 @@ #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> @@ -2162,6 +2163,11 @@ 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 ); |