summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorJan-Marek Glogowski <jan-marek.glogowski@extern.cib.de>2020-02-07 23:16:50 +0000
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-02-13 10:19:20 +0100
commitd6188f8c3803490f75fbd1931a0bd6f821c4d700 (patch)
tree09e4e9a924207f2c3045f5d2dd13c4fb63e5a25f /framework
parentc38ba97261c0af28cb48786a7ad7edcab1e85cb4 (diff)
tdf#126700 allow replacing the default documents
Per default, a document opened by a user action will always open in a new frame. For tdf#83722, this behaviour was extended to documents created from templates. But this currently also affects the default factory templates, if these are replaced by a config setting with a real template, which was not intentional. So this patch introduces a new MediaDescriptor property, which allows to mark a document as replaceable and automatically sets it for factory default documents. If this property is set to true, a document just acts as a placeholder while it's unmodified. I.e. the next opened document from its frame will close and replace it. For this backport the documentation in MediaDescriptor.idl is dropped, so people won't rely on this as a feature before 7.0. Change-Id: I45ffa8709f7cdda949fac78f3b363f120f0c4a03 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88257 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 61e1e0413296928d929f99c0f006c6cbbcf4ac40) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88537
Diffstat (limited to 'framework')
-rw-r--r--framework/source/loadenv/loadenv.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx
index 5c1414f3cbdf..3d04e17a23c2 100644
--- a/framework/source/loadenv/loadenv.cxx
+++ b/framework/source/loadenv/loadenv.cxx
@@ -1098,10 +1098,11 @@ bool LoadEnv::impl_loadContent()
bool bHidden = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_HIDDEN(), false);
bool bMinimized = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_MINIMIZED(), false);
bool bPreview = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_PREVIEW(), false);
- css::uno::Reference< css::task::XStatusIndicator > xProgress = m_lMediaDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(), css::uno::Reference< css::task::XStatusIndicator >());
if (!bHidden && !bMinimized && !bPreview)
{
+ css::uno::Reference<css::task::XStatusIndicator> xProgress = m_lMediaDescriptor.getUnpackedValueOrDefault(
+ utl::MediaDescriptor::PROP_STATUSINDICATOR(), css::uno::Reference<css::task::XStatusIndicator>());
if (!xProgress.is())
{
// Note: it's an optional interface!
@@ -1524,12 +1525,9 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget()
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 (via File > New, referrer is set to private:user)
- if (bFromTemplate || (sReferrer == "private:user"))
+ // replaceable document
+ if (!lOldDocDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REPLACEABLE(), false))
return css::uno::Reference< css::frame::XFrame >();
bReactivateOldControllerOnError = xOldDoc->suspend(true);