diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2005-11-11 11:23:53 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2005-11-11 11:23:53 +0000 |
commit | 870a566508c94a4bd506288018e66ac4df753bf5 (patch) | |
tree | 4a205e1be220c19ce56e67473505af5cdf447ed2 /sfx2 | |
parent | 8bb27dd08eaeab4a2ab2549f210cb7491c1c33da (diff) |
INTEGRATION: CWS c06 (1.70.38); FILE MERGED
2005/10/13 13:16:54 mav 1.70.38.3: #125985# the warning should be shown when the macro execution is requested
2005/10/12 13:15:02 mav 1.70.38.2: #125985# output warning on loading only if macro is in document
2005/10/11 13:32:01 mav 1.70.38.1: #125985# introduce possibility to switch macros off
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index c4431732fac1..a17b0f57158e 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -4,9 +4,9 @@ * * $RCSfile: objmisc.cxx,v $ * - * $Revision: 1.73 $ + * $Revision: 1.74 $ * - * last change: $Author: rt $ $Date: 2005-11-11 10:20:18 $ + * last change: $Author: rt $ $Date: 2005-11-11 12:23:53 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -1047,7 +1047,13 @@ void SfxObjectShell::CheckMacrosOnLoading_Impl() if ( GetError() != ERRCODE_NONE ) return; - if ( bHasStorage && ( !pFilter || !( pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) ) ) + if ( SvtSecurityOptions().IsMacroDisabled() ) + { + // no macro should be executed at all + pImp->bMacroDisabled = sal_True; + pImp->nMacroMode = MacroExecMode::NEVER_EXECUTE; + } + else if ( bHasStorage && ( !pFilter || !( pFilter->GetFilterFlags() & SFX_FILTER_STARONEFILTER ) ) ) { uno::Reference< embed::XStorage > xStorage = pMedium->GetStorage(); if ( xStorage.is() ) @@ -1056,7 +1062,7 @@ void SfxObjectShell::CheckMacrosOnLoading_Impl() if ( bHasMacros ) { - AdjustMacroMode( String() ); + AdjustMacroMode( String() ); // if macros are disabled the message will be shown here if ( SvtSecurityOptions().GetMacroSecurityLevel() >= 2 && MacroExecMode::NEVER_EXECUTE == pImp->nMacroMode ) { @@ -1064,7 +1070,7 @@ void SfxObjectShell::CheckMacrosOnLoading_Impl() aBox.Execute(); } } - else + else if ( !pImp->bMacroDisabled ) { // if macros will be added by the user later, the security check is obsolete pImp->nMacroMode = MacroExecMode::ALWAYS_EXECUTE_NO_WARN; @@ -1078,7 +1084,7 @@ void SfxObjectShell::CheckMacrosOnLoading_Impl() if ( HasMacrosLib_Impl() ) { // no signing in alien formats! - AdjustMacroMode( String() ); + AdjustMacroMode( String() ); // if macros are disabled the message will be shown here if ( SvtSecurityOptions().GetMacroSecurityLevel() >= 2 && MacroExecMode::NEVER_EXECUTE == pImp->nMacroMode ) { @@ -1086,7 +1092,7 @@ void SfxObjectShell::CheckMacrosOnLoading_Impl() aBox.Execute(); } } - else + else if ( !pImp->bMacroDisabled ) { // if macros will be added by the user later, the security check is obsolete pImp->nMacroMode = MacroExecMode::ALWAYS_EXECUTE_NO_WARN; @@ -1868,6 +1874,22 @@ void SfxObjectShell::AdjustMacroMode( const String& rScriptType ) } // <-- + if ( SvtSecurityOptions().IsMacroDisabled() ) + { + // no macro should be executed at all + pImp->bMacroDisabled = sal_True; + pImp->nMacroMode = MacroExecMode::NEVER_EXECUTE; + + if ( !pImp->bMacroDisabledMessageIsShown ) + { + String aMessage( SfxResId( STR_MACROS_DISABLED ) ); + WarningBox( NULL, WB_OK, aMessage ).Execute(); + pImp->bMacroDisabledMessageIsShown = sal_True; + } + + return; + } + // get setting from configuration if required sal_Int16 nAutoConformation = 0; if ( pImp->nMacroMode == MacroExecMode::USE_CONFIG |