summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2004-05-03 06:57:22 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2004-05-03 06:57:22 +0000
commit2aac2d0ae94fb3b8510e5c44260a90caa5746bc3 (patch)
tree983dd5d6b058da89abf8fa880fbd46b01471931c /basctl
parentc501e87c7495fc9649e59804d6c74156c336598f (diff)
INTEGRATION: CWS macrosecurity2 (1.27.54); FILE MERGED
2004/04/21 13:35:37 tbe 1.27.54.1: #116444# Security RunMacro=Never misleading
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/macrodlg.cxx41
1 files changed, 38 insertions, 3 deletions
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 0399f223667b..c251d875ca5d 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: macrodlg.cxx,v $
*
- * $Revision: 1.27 $
+ * $Revision: 1.28 $
*
- * last change: $Author: hr $ $Date: 2003-11-05 12:39:30 $
+ * last change: $Author: rt $ $Date: 2004-05-03 07:57:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -85,6 +85,7 @@
#ifndef _SBXCLASS_HXX //autogen
#include <svtools/sbx.hxx>
#endif
+
#include <bastypes.hxx>
#include <sbxitem.hxx>
@@ -95,6 +96,9 @@
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_
#include <com/sun/star/script/XLibraryContainer2.hpp>
#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_MACROEXECMODE_HPP_
+#include <com/sun/star/document/MacroExecMode.hpp>
+#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -760,7 +764,38 @@ IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
if ( pButton == &aRunButton )
{
StoreMacroDescription();
- if ( nMode == MACROCHOOSER_RECORDING )
+
+ // #116444# check security settings before macro execution
+ if ( nMode == MACROCHOOSER_ALL )
+ {
+ SbMethod* pMethod = GetMacro();
+ if ( pMethod )
+ {
+ SbModule* pModule = pMethod->GetModule();
+ if ( pModule )
+ {
+ StarBASIC* pBasic = (StarBASIC*)pModule->GetParent();
+ if ( pBasic )
+ {
+ BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic );
+ if ( pBasMgr )
+ {
+ SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
+ if ( pShell )
+ {
+ pShell->AdjustMacroMode( String() );
+ if ( pShell->GetMacroMode() == ::com::sun::star::document::MacroExecMode::NEVER_EXECUTE )
+ {
+ WarningBox( this, WB_OK, String( IDEResId( RID_STR_CANNOTRUNMACRO ) ) ).Execute();
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else if ( nMode == MACROCHOOSER_RECORDING )
{
BOOL bValid = BasicIDE::IsValidSbxName( aMacroNameEdit.GetText() );
if ( !bValid )