diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2019-05-07 16:27:22 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2019-05-13 10:57:24 +0200 |
commit | acd820fd39394acc9829836a597c277d8965242e (patch) | |
tree | d48d4bf43fbb392b23f5d9e0459d094f943584dc /framework/source/loadenv | |
parent | 572c5c6b229aba9188435901e1679f50149b8fcb (diff) |
tdf#83722: don't recycle frame with unmodified template
a frame that contained valid but unmodified document opened from
template or explicitly opened by the user (File > New) was treated
the same as blank document i.e. it was reused and the content was
overwritten by newly opened document (even if it already had
non-empty content provided by the template).
So let's not do that and let's open a new document in a new frame
instead
Change-Id: I10252d114e8cc5fcad3c98194ef07fd59873d6da
Reviewed-on: https://gerrit.libreoffice.org/71919
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'framework/source/loadenv')
-rw-r--r-- | framework/source/loadenv/loadenv.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 2ddfd34492d0..f37f267733b3 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1076,7 +1076,7 @@ bool LoadEnv::impl_loadContent() // if it will be run out of scope. // Note further: ignore if this internal guard already contains a resource. - // Might impl_searchRecylcTarget() set it before. But in case this impl-method wasn't used + // Might impl_searchRecycleTarget() set it before. But in case this impl-method wasn't used // and the target frame was new created ... this lock here must be set! css::uno::Reference< css::document::XActionLockable > xTargetLock(xTargetFrame, css::uno::UNO_QUERY); m_aTargetLock.setResource(xTargetLock); @@ -1514,6 +1514,15 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() css::uno::Reference< css::frame::XController > xOldDoc = xTask->getController(); if (xOldDoc.is()) { + utl::MediaDescriptor lOldDocDescriptor(xModel->getArgs()); + bool bFromTemplate = lOldDocDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_ASTEMPLATE() , false); + OUString sReferrer = lOldDocDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REFERRER(), OUString()); + + // tdf#83722: valid but unmodified document, either from template + // or opened by the user (File > New) + if (bFromTemplate || !sReferrer.isEmpty()) + return css::uno::Reference< css::frame::XFrame >(); + bReactivateOldControllerOnError = xOldDoc->suspend(true); if (! bReactivateOldControllerOnError) return css::uno::Reference< css::frame::XFrame >(); |