diff options
author | Mathias Bauer <mba@openoffice.org> | 2001-11-30 13:00:25 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2001-11-30 13:00:25 +0000 |
commit | ead28ef0c518375dbea8c46bde857377351badca (patch) | |
tree | f86c11c170d92dcb73a8115f965b9eb64d4e8bb7 /sfx2 | |
parent | 2db4e62dd75c5473e53368213831aeaff22bcc94 (diff) |
#95362#: new security settings
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/inc/eventdlg.hxx | 9 | ||||
-rw-r--r-- | sfx2/source/inc/eventsupplier.hxx | 6 | ||||
-rw-r--r-- | sfx2/source/notify/eventsupplier.cxx | 39 |
3 files changed, 31 insertions, 23 deletions
diff --git a/sfx2/source/inc/eventdlg.hxx b/sfx2/source/inc/eventdlg.hxx index 2c213ed6e686..879b3a52b5d3 100644 --- a/sfx2/source/inc/eventdlg.hxx +++ b/sfx2/source/inc/eventdlg.hxx @@ -2,9 +2,9 @@ * * $RCSfile: eventdlg.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: pb $ $Date: 2001-06-28 13:39:21 $ + * last change: $Author: mba $ $Date: 2001-11-30 13:56:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,16 +76,11 @@ class SfxEventConfigPage : public _SfxMacroTabPage { RadioButton aStarOfficeRB; RadioButton aDocumentRB; -// CheckBox aWarningCB; - CheckBox aAlwaysWarningCB; - FixedLine aSafetyGb; SvxMacroItem* pAppItem; SvxMacroItem* pDocItem; - BOOL bModified; BOOL bAppConfig; - DECL_LINK( ButtonHdl, Button* ); DECL_LINK( SelectHdl_Impl, RadioButton* ); public: diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx index 38e3c7338cc4..fc5a9a9ad823 100644 --- a/sfx2/source/inc/eventsupplier.hxx +++ b/sfx2/source/inc/eventsupplier.hxx @@ -2,9 +2,9 @@ * * $RCSfile: eventsupplier.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mba $ $Date: 2001-08-24 08:03:34 $ + * last change: $Author: mba $ $Date: 2001-11-30 13:56:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -134,7 +134,7 @@ class SfxEvents_Impl : public ::cppu::WeakImplHelper2< ::com::sun::star::contain ::osl::Mutex maMutex; SfxObjectShell *mpObjShell; - sal_Bool Warn_Impl(); + sal_Bool Warn_Impl( const String& ); ANY BlowUpMacro( const ANY& rEvent ) const; public: diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index ec3c72b60cd8..5fa5a0b3e758 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -2,9 +2,9 @@ * * $RCSfile: eventsupplier.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: mba $ $Date: 2001-11-19 11:18:48 $ + * last change: $Author: mba $ $Date: 2001-11-30 13:57:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,8 @@ #include <evntconf.hxx> #endif +#include <svtools/securityoptions.hxx> + #ifndef _SFX_EVENTSUPPLIER_HXX_ #include "eventsupplier.hxx" #endif @@ -95,6 +97,7 @@ #include "sfxsids.hrc" #include "sfxlocal.hrc" +#include "docfile.hxx" //-------------------------------------------------------------------------------------------------------- @@ -248,6 +251,7 @@ void SAL_CALL SfxEvents_Impl::notifyEvent( const DOCEVENTOBJECT& aEvent ) throw( if ( aEventData >>= aProperties ) { + OUSTRING aPrefix = OUSTRING( RTL_CONSTASCII_USTRINGPARAM( MACRO_PRFIX ) ); OUSTRING aType; OUSTRING aScript; OUSTRING aLibrary; @@ -282,10 +286,9 @@ void SAL_CALL SfxEvents_Impl::notifyEvent( const DOCEVENTOBJECT& aEvent ) throw( if ( aType.compareToAscii( STAR_BASIC ) == 0 ) { - if ( ! aScript.getLength() && aMacroName.getLength() ) + if ( !aScript.getLength() && aMacroName.getLength() ) { aScript = OUSTRING( RTL_CONSTASCII_USTRINGPARAM( MACRO_PRFIX ) ); - if ( aLibrary.compareTo( SFX_APP()->GetName() ) != 0 && aLibrary.compareToAscii("StarDesktop") != 0 ) { @@ -301,7 +304,8 @@ void SAL_CALL SfxEvents_Impl::notifyEvent( const DOCEVENTOBJECT& aEvent ) throw( { aGuard.clear(); ErrCode nErr; - if ( Warn_Impl() ) + // never ask for macros from application basic + if ( !aScript.compareToAscii( "macro:///", 9 ) || Warn_Impl( aScript ) ) nErr = SfxMacroLoader::loadMacro( aScript, mpObjShell ); else nErr = 0; @@ -436,22 +440,31 @@ SvxMacro* SfxEvents_Impl::ConvertToMacro( const ANY& rElement, SfxObjectShell* p } //-------------------------------------------------------------------------------------------------------- -sal_Bool SfxEvents_Impl::Warn_Impl() +sal_Bool SfxEvents_Impl::Warn_Impl( const String& rMacName ) { - // Wenn das Macro sowieso nicht ausgef"uhrt wird, mu\s auch nicht gefragt werden - if ( !mpObjShell->IsSecure() ) + SvtSecurityOptions aOpt; + EBasicSecurityMode eMode = aOpt.GetBasicMode(); + if ( eMode == eNEVER_EXECUTE ) return sal_False; - // Bei dokumentgebundenen Macros WarningStatus checken - // Wenn "Immer warnen" angeschaltet ist, Warnung ausgeben - sal_Bool bWarn = SFX_APP()->GetEventConfig()->IsWarningForced(); + sal_Bool bConfirm = aOpt.IsConfirmationEnabled(); + sal_Bool bWarn = aOpt.IsWarningEnabled(); + sal_Bool bSecure = aOpt.IsSecureURL( rMacName, mpObjShell->GetMedium()->GetName() ); - if ( bWarn ) + //if ( !mpObjShell->IsSecure() ) + // return sal_False; + if ( bSecure && bWarn || !bSecure && bConfirm ) { - SfxMacroQueryDlg_Impl aBox ( SfxResId( DLG_MACROQUERY ) ); + OUSTRING aPrefix = OUSTRING( RTL_CONSTASCII_USTRINGPARAM( MACRO_PRFIX ) ); + OUSTRING aName = rMacName.Copy( (USHORT) aPrefix.getLength() ); + sal_Int32 nPos = aName.indexOf( '/' ); + aName = aName.copy( nPos+1 ); + SfxMacroQueryDlg_Impl aBox ( SfxResId( DLG_MACROQUERY ), aName, bSecure ); if ( aBox.Execute() ) bWarn = sal_False; } + else + return bSecure; return !bWarn; } |