summaryrefslogtreecommitdiff
path: root/sfx2/source/doc/docmacromode.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/doc/docmacromode.cxx')
-rw-r--r--sfx2/source/doc/docmacromode.cxx53
1 files changed, 13 insertions, 40 deletions
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index 47547569f58b..999ab2076aa5 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -28,7 +28,6 @@
#include <com/sun/star/task/InteractionClassification.hpp>
#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
-#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
@@ -65,7 +64,6 @@ namespace sfx2
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::script::XLibraryContainer;
using ::com::sun::star::script::XLibraryQueryExecutable;
- using ::com::sun::star::script::vba::XVBACompatibility;
using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::UNO_QUERY;
@@ -331,8 +329,6 @@ namespace sfx2
if ( xScripts.is() )
xContainer.set( xScripts->getBasicLibraries(), UNO_QUERY_THROW );
- Reference< XVBACompatibility > xDocVBAMode( xContainer, UNO_QUERY );
- sal_Bool bIsVBAMode = ( xDocVBAMode.is() && xDocVBAMode->getVBACompatibilityMode() );
if ( xContainer.is() )
{
// a library container exists; check if it's empty
@@ -345,47 +341,24 @@ namespace sfx2
{
::rtl::OUString aStdLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
- sal_Int32 nElementCount = aElements.getLength();
- if ( nElementCount )
+ if ( aElements.getLength() )
{
- // old check, if more than 1 library or the first library isn't the expected 'Standard'
- // trigger the security 'nag' dialog
- if ( !bIsVBAMode && ( nElementCount > 1 || !aElements[0].equals( aStdLibName ) ) )
+ if ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) )
bHasMacroLib = sal_True;
else
{
- // other wise just check all libraries for executeable code
- Reference< XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY );
+ // usually a "Standard" library is always present (design)
+ // for this reason we must check if it's empty
+ //
+ // Note: Since #i73229#, this is not true anymore. There's no default
+ // "Standard" lib anymore. Wouldn't it be time to get completely
+ // rid of the "Standard" thingie - this shouldn't be necessary
+ // anymore, should it?
+ Reference < XNameAccess > xLib;
+ Any aAny = xContainer->getByName( aStdLibName );
+ aAny >>= xLib;
if ( xLib.is() )
- {
- const ::rtl::OUString* pElementName = aElements.getConstArray();
- for ( sal_Int32 index = 0; index < nElementCount; ++index )
- {
- bHasMacroLib = xLib->HasExecutableCode( pElementName[index] );
- if ( bHasMacroLib )
- break;
- }
- }
- }
- }
- }
- }
- if ( bIsVBAMode && !bHasMacroLib && xScripts.is() )
- {
- Reference< XLibraryContainer > xDlgContainer( xScripts->getDialogLibraries(), UNO_QUERY );
- if ( xDlgContainer.is() && xDlgContainer->hasElements() )
- {
- Sequence< ::rtl::OUString > aElements = xDlgContainer->getElementNames();
- sal_Int32 nElementCount = aElements.getLength();
- const ::rtl::OUString* pElementName = aElements.getConstArray();
- for ( sal_Int32 index = 0; index < nElementCount; ++index )
- {
- Reference< XNameAccess > xNameAccess;
- xDlgContainer->getByName( pElementName[index] ) >>= xNameAccess;
- if ( xNameAccess.is() && xNameAccess->hasElements() )
- {
- bHasMacroLib = sal_True;
- break;
+ bHasMacroLib = xLib->hasElements();
}
}
}