summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/source/loadenv/loadenv.cxx10
-rw-r--r--include/sfx2/sfxsids.hrc2
-rw-r--r--include/unotools/mediadescriptor.hxx1
-rw-r--r--sfx2/source/appl/appuno.cxx18
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx5
-rw-r--r--sfx2/source/view/frmload.cxx4
-rw-r--r--sw/qa/python/check_xmodel.py4
-rw-r--r--unotools/source/misc/mediadescriptor.cxx6
8 files changed, 41 insertions, 9 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);
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index 9fa90a5f6226..eb8e0e5c0360 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -269,8 +269,8 @@ class SvxSearchItem;
#define SID_LOCK_PRINT (SID_SFX_START + 1736)
#define SID_LOCK_SAVE (SID_SFX_START + 1737)
#define SID_LOCK_EDITDOC (SID_SFX_START + 1738)
+#define SID_REPLACEABLE (SID_SFX_START + 1739)
-// SID_SFX_free_START (SID_SFX_START + 1739)
// SID_SFX_free_END (SID_SFX_START + 3999)
#define SID_OPEN_NEW_VIEW (SID_SFX_START + 520)
diff --git a/include/unotools/mediadescriptor.hxx b/include/unotools/mediadescriptor.hxx
index 6a826ce309ac..da94f4188b3c 100644
--- a/include/unotools/mediadescriptor.hxx
+++ b/include/unotools/mediadescriptor.hxx
@@ -84,6 +84,7 @@ class UNOTOOLS_DLLPUBLIC MediaDescriptor : public comphelper::SequenceAsHashMap
static const OUString& PROP_PREVIEW();
static const OUString& PROP_READONLY();
static const OUString& PROP_REFERRER();
+ static const OUString& PROP_REPLACEABLE();
static const OUString& PROP_SALVAGEDFILE();
static const OUString& PROP_STATUSINDICATOR();
static const OUString& PROP_STREAM();
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index bfbe90dc896b..ff3fdfe91b6e 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -174,6 +174,7 @@ static char const sLockExport[] = "LockExport";
static char const sLockPrint[] = "LockPrint";
static char const sLockSave[] = "LockSave";
static char const sLockEditDoc[] = "LockEditDoc";
+static char const sReplaceable[] = "Replaceable";
static bool isMediaDescriptor( sal_uInt16 nSlotId )
{
@@ -888,6 +889,14 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert
if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_EDITDOC, bVal ) );
}
+ else if (aName == sReplaceable)
+ {
+ bool bVal = false;
+ bool bOK = (rProp.Value >>= bVal);
+ DBG_ASSERT(bOK, "invalid type for Replaceable");
+ if (bOK)
+ rSet.Put(SfxBoolItem(SID_REPLACEABLE, bVal));
+ }
#ifdef DBG_UTIL
else
--nFoundArgs;
@@ -1115,6 +1124,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
nAdditional++;
if ( rSet.GetItemState( SID_LOCK_EDITDOC ) == SfxItemState::SET )
nAdditional++;
+ if (rSet.GetItemState(SID_REPLACEABLE) == SfxItemState::SET)
+ nAdditional++;
// consider additional arguments
nProps += nAdditional;
@@ -1282,6 +1293,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
continue;
if ( nId == SID_LOCK_EDITDOC )
continue;
+ if (nId == SID_REPLACEABLE)
+ continue;
}
OString aDbg = "Unknown item detected: " + OString::number(static_cast<sal_Int32>(nId));
@@ -1699,6 +1712,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<b
pValue[nActProp].Name = sLockEditDoc;
pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
}
+ if (rSet.GetItemState(SID_REPLACEABLE, false, &pItem) == SfxItemState::SET)
+ {
+ pValue[nActProp].Name = sReplaceable;
+ pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
+ }
}
rArgs = aSequ;
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 394475c40129..a136f74f2886 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1099,6 +1099,11 @@ void SAL_CALL SfxBaseModel::setArgs(const Sequence<beans::PropertyValue>& aArgs)
rArg.Value >>= bValue;
pMedium->GetItemSet()->Put(SfxBoolItem(SID_LOCK_EDITDOC, bValue));
}
+ else if (rArg.Name == "Replaceable")
+ {
+ rArg.Value >>= bValue;
+ pMedium->GetItemSet()->Put(SfxBoolItem(SID_REPLACEABLE, bValue));
+ }
else
{
throw lang::IllegalArgumentException("Setting property not supported: " + rArg.Name,
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index d098ac5c00e2..b16d9b471048 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -624,7 +624,9 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
const OUString sURL = aDescriptor.getOrDefault( "URL", OUString() );
const bool bIsFactoryURL = sURL.startsWith( "private:factory/" );
bool bInitNewModel = bIsFactoryURL;
- if ( bIsFactoryURL && !bExternalModel )
+ const bool bIsDefault = bIsFactoryURL && !bExternalModel;
+ aDescriptor.put("Replaceable", bIsDefault);
+ if (bIsDefault)
{
const OUString sFactory = sURL.copy( sizeof( "private:factory/" ) -1 );
// special handling for some weird factory URLs a la private:factory/swriter?slot=21053
diff --git a/sw/qa/python/check_xmodel.py b/sw/qa/python/check_xmodel.py
index f6894dd21a3f..27740958ddb1 100644
--- a/sw/qa/python/check_xmodel.py
+++ b/sw/qa/python/check_xmodel.py
@@ -37,7 +37,8 @@ class TestXModel(unittest.TestCase):
p5 = PropertyValue(Name="LockPrint", Value=True)
p6 = PropertyValue(Name="LockSave", Value=True)
p7 = PropertyValue(Name="LockEditDoc", Value=True)
- xDoc.setArgs([p1, p2, p3, p4, p5, p6, p7])
+ p8 = PropertyValue(Name="Replaceable", Value=True)
+ xDoc.setArgs([p1, p2, p3, p4, p5, p6, p7, p8])
# Make sure that all properties are returned with getArgs()
args = xDoc.getArgs()
@@ -48,6 +49,7 @@ class TestXModel(unittest.TestCase):
self.assertTrue(p5 in args)
self.assertTrue(p6 in args)
self.assertTrue(p7 in args)
+ self.assertTrue(p8 in args)
xDoc.close(True)
diff --git a/unotools/source/misc/mediadescriptor.cxx b/unotools/source/misc/mediadescriptor.cxx
index 0d0839f62b18..1b830fb4e7d9 100644
--- a/unotools/source/misc/mediadescriptor.cxx
+++ b/unotools/source/misc/mediadescriptor.cxx
@@ -222,6 +222,12 @@ const OUString& MediaDescriptor::PROP_REFERRER()
return sProp;
}
+const OUString& MediaDescriptor::PROP_REPLACEABLE()
+{
+ static const OUString sProp("Replaceable");
+ return sProp;
+}
+
const OUString& MediaDescriptor::PROP_STATUSINDICATOR()
{
static const OUString sProp("StatusIndicator");