summaryrefslogtreecommitdiff
path: root/sfx2/source/notify/eventsupplier.cxx
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2001-12-12 14:29:08 +0000
committerMathias Bauer <mba@openoffice.org>2001-12-12 14:29:08 +0000
commitd803240f4d7f2f9e935aeaec001a2ceade7210cb (patch)
tree08e25d2b6138b6712d6c511576dc7b530a0a63a2 /sfx2/source/notify/eventsupplier.cxx
parentd1971b18c329941dd078da6b2df5f4623b6c5ace (diff)
#95867#: confirmation for basic macros
Diffstat (limited to 'sfx2/source/notify/eventsupplier.cxx')
-rw-r--r--sfx2/source/notify/eventsupplier.cxx23
1 files changed, 16 insertions, 7 deletions
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index bef4175be53f..6c8d0e5ac535 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: eventsupplier.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: mba $ $Date: 2001-12-04 11:11:06 $
+ * last change: $Author: mba $ $Date: 2001-12-12 15:29:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -452,19 +452,28 @@ sal_Bool SfxEvents_Impl::Warn_Impl( const String& rMacName )
if ( eMode == eNEVER_EXECUTE )
return sal_False;
+ String aReferer( mpObjShell->GetMedium()->GetName() );
+ if ( !aReferer.Len() )
+ {
+ // if document was created from template, take the templates' name for the checks
+ String aTempl( mpObjShell->GetDocInfo().GetTemplateFileName() );
+ if ( aTempl.Len() )
+ aReferer = INetURLObject( aTempl ).GetMainURL();
+ else
+ // new documents from scratch are safe
+ return TRUE;
+ }
+
sal_Bool bConfirm = aOpt.IsConfirmationEnabled();
sal_Bool bWarn = aOpt.IsWarningEnabled();
- sal_Bool bSecure = aOpt.IsSecureURL( rMacName, mpObjShell->GetMedium()->GetName() );
-
- //if ( !mpObjShell->IsSecure() )
- // return sal_False;
+ sal_Bool bSecure = aOpt.IsSecureURL( rMacName, aReferer );
if ( bSecure && bWarn || !bSecure && bConfirm )
{
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 );
+ SfxMacroQueryDlg_Impl aBox ( aName, bSecure );
if ( aBox.Execute() )
bWarn = sal_False;
}