Kaydet (Commit) fdc00e2d authored tarafından Stephan Bergmann's avatar Stephan Bergmann

LinkUpdateMode is a global setting

Change-Id: Ida1257337c6e0916f2228fe053d9c9f085183af6
(cherry picked from commit 77cc7147)
üst f2b3519c
...@@ -186,6 +186,8 @@ class UNOTOOLS_DLLPUBLIC SAL_WARN_UNUSED SvtSecurityOptions : public utl::detail ...@@ -186,6 +186,8 @@ class UNOTOOLS_DLLPUBLIC SAL_WARN_UNUSED SvtSecurityOptions : public utl::detail
*/ */
bool isTrustedLocationUri(OUString const & uri) const; bool isTrustedLocationUri(OUString const & uri) const;
bool isTrustedLocationUriForUpdatingLinks(OUString const & uri) const;
::com::sun::star::uno::Sequence< Certificate > GetTrustedAuthors ( ) const; ::com::sun::star::uno::Sequence< Certificate > GetTrustedAuthors ( ) const;
void SetTrustedAuthors ( const ::com::sun::star::uno::Sequence< Certificate >& rAuthors ); void SetTrustedAuthors ( const ::com::sun::star::uno::Sequence< Certificate >& rAuthors );
......
...@@ -2593,6 +2593,9 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa ...@@ -2593,6 +2593,9 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa
OUString sCTName("TrackedChangesProtectionKey"); OUString sCTName("TrackedChangesProtectionKey");
OUString sVBName("VBACompatibilityMode"); OUString sVBName("VBACompatibilityMode");
OUString sSCName("ScriptConfiguration"); OUString sSCName("ScriptConfiguration");
css::uno::Sequence<css::beans::PropertyValue> aFilteredProps(
aConfigProps.getLength());
sal_Int32 nFilteredPropsLen = 0;
for (sal_Int32 i = nCount - 1; i >= 0; --i) for (sal_Int32 i = nCount - 1; i >= 0; --i)
{ {
if (aConfigProps[i].Name == sCTName) if (aConfigProps[i].Name == sCTName)
...@@ -2627,11 +2630,16 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa ...@@ -2627,11 +2630,16 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa
xImportInfo->setPropertyValue( aConfigProps[i].Name, aConfigProps[i].Value ); xImportInfo->setPropertyValue( aConfigProps[i].Name, aConfigProps[i].Value );
} }
} }
if (aConfigProps[i].Name != "LinkUpdateMode")
{
aFilteredProps[nFilteredPropsLen++] = aConfigProps[i];
}
} }
aFilteredProps.realloc(nFilteredPropsLen);
uno::Reference <uno::XInterface> xInterface = xMultiServiceFactory->createInstance("com.sun.star.comp.SpreadsheetSettings"); uno::Reference <uno::XInterface> xInterface = xMultiServiceFactory->createInstance("com.sun.star.comp.SpreadsheetSettings");
uno::Reference <beans::XPropertySet> xProperties(xInterface, uno::UNO_QUERY); uno::Reference <beans::XPropertySet> xProperties(xInterface, uno::UNO_QUERY);
if (xProperties.is()) if (xProperties.is())
SvXMLUnitConverter::convertPropertySet(xProperties, aConfigProps); SvXMLUnitConverter::convertPropertySet(xProperties, aFilteredProps);
} }
} }
} }
......
...@@ -48,6 +48,7 @@ using namespace ::com::sun::star; ...@@ -48,6 +48,7 @@ using namespace ::com::sun::star;
#include <svl/PasswordHelper.hxx> #include <svl/PasswordHelper.hxx>
#include <svl/documentlockfile.hxx> #include <svl/documentlockfile.hxx>
#include <svl/sharecontrolfile.hxx> #include <svl/sharecontrolfile.hxx>
#include <unotools/securityoptions.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include "docuno.hxx" #include "docuno.hxx"
...@@ -419,12 +420,23 @@ void ScDocShell::Execute( SfxRequest& rReq ) ...@@ -419,12 +420,23 @@ void ScDocShell::Execute( SfxRequest& rReq )
if (nCanUpdate == com::sun::star::document::UpdateDocMode::NO_UPDATE) if (nCanUpdate == com::sun::star::document::UpdateDocMode::NO_UPDATE)
nSet = LM_NEVER; nSet = LM_NEVER;
else if (nCanUpdate == com::sun::star::document::UpdateDocMode::QUIET_UPDATE &&
nSet == LM_ON_DEMAND)
nSet = LM_NEVER;
else if (nCanUpdate == com::sun::star::document::UpdateDocMode::FULL_UPDATE) else if (nCanUpdate == com::sun::star::document::UpdateDocMode::FULL_UPDATE)
nSet = LM_ALWAYS; nSet = LM_ALWAYS;
if (nSet == LM_ALWAYS
&& !(SvtSecurityOptions()
.isTrustedLocationUriForUpdatingLinks(
GetMedium() == nullptr
? OUString() : GetMedium()->GetName())))
{
nSet = LM_ON_DEMAND;
}
if (nCanUpdate == css::document::UpdateDocMode::QUIET_UPDATE
&& nSet == LM_ON_DEMAND)
{
nSet = LM_NEVER;
}
if(nSet==LM_ON_DEMAND) if(nSet==LM_ON_DEMAND)
{ {
ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES), ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), WinBits(WB_YES_NO | WB_DEF_YES),
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <ndtxt.hxx> #include <ndtxt.hxx>
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#include <unotools/charclass.hxx> #include <unotools/charclass.hxx>
#include <unotools/securityoptions.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -221,6 +222,15 @@ void DocumentLinksAdministrationManager::UpdateLinks( bool bUI ) ...@@ -221,6 +222,15 @@ void DocumentLinksAdministrationManager::UpdateLinks( bool bUI )
case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = false; break; case document::UpdateDocMode::QUIET_UPDATE:bAskUpdate = false; break;
case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = true; break; case document::UpdateDocMode::FULL_UPDATE: bAskUpdate = true; break;
} }
if (nLinkMode == AUTOMATIC && !bAskUpdate)
{
SfxMedium * medium = m_rDoc.GetDocShell()->GetMedium();
if (!SvtSecurityOptions().isTrustedLocationUriForUpdatingLinks(
medium == nullptr ? OUString() : medium->GetName()))
{
bAskUpdate = true;
}
}
if( bUpdate && (bUI || !bAskUpdate) ) if( bUpdate && (bUI || !bAskUpdate) )
{ {
SfxMedium* pMedium = m_rDoc.GetDocShell()->GetMedium(); SfxMedium* pMedium = m_rDoc.GetDocShell()->GetMedium();
......
...@@ -1085,47 +1085,47 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC ...@@ -1085,47 +1085,47 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
if( !xInfo.is() ) if( !xInfo.is() )
return; return;
std::unordered_set< OUString, OUStringHash > aSet; std::unordered_set< OUString, OUStringHash > aExcludeAlways;
aSet.insert("ForbiddenCharacters"); aExcludeAlways.insert("LinkUpdateMode");
aSet.insert("IsKernAsianPunctuation"); std::unordered_set< OUString, OUStringHash > aExcludeWhenNotLoadingUserSettings;
aSet.insert("CharacterCompressionType"); aExcludeWhenNotLoadingUserSettings.insert("ForbiddenCharacters");
aSet.insert("LinkUpdateMode"); aExcludeWhenNotLoadingUserSettings.insert("IsKernAsianPunctuation");
aSet.insert("FieldAutoUpdate"); aExcludeWhenNotLoadingUserSettings.insert("CharacterCompressionType");
aSet.insert("ChartAutoUpdate"); aExcludeWhenNotLoadingUserSettings.insert("FieldAutoUpdate");
aSet.insert("AddParaTableSpacing"); aExcludeWhenNotLoadingUserSettings.insert("ChartAutoUpdate");
aSet.insert("AddParaTableSpacingAtStart"); aExcludeWhenNotLoadingUserSettings.insert("AddParaTableSpacing");
aSet.insert("PrintAnnotationMode"); aExcludeWhenNotLoadingUserSettings.insert("AddParaTableSpacingAtStart");
aSet.insert("PrintBlackFonts"); aExcludeWhenNotLoadingUserSettings.insert("PrintAnnotationMode");
aSet.insert("PrintControls"); aExcludeWhenNotLoadingUserSettings.insert("PrintBlackFonts");
aSet.insert("PrintDrawings"); aExcludeWhenNotLoadingUserSettings.insert("PrintControls");
aSet.insert("PrintGraphics"); aExcludeWhenNotLoadingUserSettings.insert("PrintDrawings");
aSet.insert("PrintLeftPages"); aExcludeWhenNotLoadingUserSettings.insert("PrintGraphics");
aSet.insert("PrintPageBackground"); aExcludeWhenNotLoadingUserSettings.insert("PrintLeftPages");
aSet.insert("PrintProspect"); aExcludeWhenNotLoadingUserSettings.insert("PrintPageBackground");
aSet.insert("PrintReversed"); aExcludeWhenNotLoadingUserSettings.insert("PrintProspect");
aSet.insert("PrintRightPages"); aExcludeWhenNotLoadingUserSettings.insert("PrintReversed");
aSet.insert("PrintFaxName"); aExcludeWhenNotLoadingUserSettings.insert("PrintRightPages");
aSet.insert("PrintPaperFromSetup"); aExcludeWhenNotLoadingUserSettings.insert("PrintFaxName");
aSet.insert("PrintTables"); aExcludeWhenNotLoadingUserSettings.insert("PrintPaperFromSetup");
aSet.insert("PrintSingleJobs"); aExcludeWhenNotLoadingUserSettings.insert("PrintTables");
aSet.insert("UpdateFromTemplate"); aExcludeWhenNotLoadingUserSettings.insert("PrintSingleJobs");
aSet.insert("PrinterIndependentLayout"); aExcludeWhenNotLoadingUserSettings.insert("UpdateFromTemplate");
aSet.insert("PrintEmptyPages"); aExcludeWhenNotLoadingUserSettings.insert("PrinterIndependentLayout");
aSet.insert("SmallCapsPercentage66"); aExcludeWhenNotLoadingUserSettings.insert("PrintEmptyPages");
aSet.insert("TabOverflow"); aExcludeWhenNotLoadingUserSettings.insert("SmallCapsPercentage66");
aSet.insert("UnbreakableNumberings"); aExcludeWhenNotLoadingUserSettings.insert("TabOverflow");
aSet.insert("ClippedPictures"); aExcludeWhenNotLoadingUserSettings.insert("UnbreakableNumberings");
aSet.insert("BackgroundParaOverDrawings"); aExcludeWhenNotLoadingUserSettings.insert("ClippedPictures");
aSet.insert("TabOverMargin"); aExcludeWhenNotLoadingUserSettings.insert("BackgroundParaOverDrawings");
aSet.insert("PropLineSpacingShrinksFirstLine"); aExcludeWhenNotLoadingUserSettings.insert("TabOverMargin");
aSet.insert("SubtractFlysAnchoredAtFlys"); aExcludeWhenNotLoadingUserSettings.insert("PropLineSpacingShrinksFirstLine");
aExcludeWhenNotLoadingUserSettings.insert("SubtractFlysAnchoredAtFlys");
sal_Int32 nCount = aConfigProps.getLength(); sal_Int32 nCount = aConfigProps.getLength();
const PropertyValue* pValues = aConfigProps.getConstArray(); const PropertyValue* pValues = aConfigProps.getConstArray();
SvtSaveOptions aSaveOpt; SvtSaveOptions aSaveOpt;
bool bIsUserSetting = aSaveOpt.IsLoadUserSettings(), bool bIsUserSetting = aSaveOpt.IsLoadUserSettings();
bSet = bIsUserSetting;
// for some properties we don't want to use the application // for some properties we don't want to use the application
// default if they're missing. So we watch for them in the loop // default if they're missing. So we watch for them in the loop
...@@ -1163,10 +1163,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC ...@@ -1163,10 +1163,12 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
while( nCount-- ) while( nCount-- )
{ {
if( !bIsUserSetting ) bool bSet = aExcludeAlways.find(pValues->Name) == aExcludeAlways.end();
if( bSet && !bIsUserSetting
&& (aExcludeWhenNotLoadingUserSettings.find(pValues->Name)
!= aExcludeWhenNotLoadingUserSettings.end()) )
{ {
// test over the hash value if the entry is in the table. bSet = false;
bSet = aSet.find(pValues->Name) == aSet.end();
} }
if( bSet ) if( bSet )
......
...@@ -1035,6 +1035,14 @@ bool SvtSecurityOptions::isTrustedLocationUri(OUString const & uri) const { ...@@ -1035,6 +1035,14 @@ bool SvtSecurityOptions::isTrustedLocationUri(OUString const & uri) const {
return false; return false;
} }
bool SvtSecurityOptions::isTrustedLocationUriForUpdatingLinks(
OUString const & uri) const
{
return GetMacroSecurityLevel() == 0 || uri.isEmpty()
|| uri.startsWithIgnoreAsciiCase("private:")
|| isTrustedLocationUri(uri);
}
sal_Int32 SvtSecurityOptions::GetMacroSecurityLevel() const sal_Int32 SvtSecurityOptions::GetMacroSecurityLevel() const
{ {
MutexGuard aGuard( GetInitMutex() ); MutexGuard aGuard( GetInitMutex() );
......
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