Kaydet (Commit) acd820fd authored tarafından Katarina Behrens's avatar Katarina Behrens

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: 's avatarMichael Stahl <Michael.Stahl@cib.de>
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst 572c5c6b
......@@ -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 >();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment