[Libreoffice-commits] core.git: Branch 'libreoffice-5-0-3' - sc/source

Eike Rathke erack at redhat.com
Mon Oct 12 05:59:19 PDT 2015


 sc/source/ui/docshell/externalrefmgr.cxx |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 02515385af34613746d5e43893c4c032bbdd6d6f
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Oct 9 09:49:01 2015 +0200

    Resolves: tdf#93613 let referenced document evaluate macro config
    
    ... if the current document allows macros.
    
    Change-Id: I927981334e27d073696286ba680777a645d53653
    (cherry picked from commit 8e2acdbcbd3afc1777d6e68a83ebbe6d8dd77645)
    Reviewed-on: https://gerrit.libreoffice.org/19265
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 36a3882..8c557af 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -55,6 +55,7 @@
 #include "scmatrix.hxx"
 #include <columnspanset.hxx>
 #include <column.hxx>
+#include <com/sun/star/document/MacroExecMode.hpp>
 
 #include <memory>
 #include <algorithm>
@@ -2397,6 +2398,21 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
     // make medium hidden to prevent assertion from progress bar
     pSet->Put( SfxBoolItem(SID_HIDDEN, true) );
 
+    // If the current document is allowed to execute macros then the referenced
+    // document may execute macros according to the security configuration.
+    SfxObjectShell* pShell = mpDoc->GetDocumentShell();
+    if (pShell)
+    {
+        SfxMedium* pMedium = pShell->GetMedium();
+        if (pMedium)
+        {
+            const SfxPoolItem* pItem;
+            if (pMedium->GetItemSet()->GetItemState( SID_MACROEXECMODE, false, &pItem ) == SfxItemState::SET &&
+                    static_cast<const SfxUInt16Item*>(pItem)->GetValue() != css::document::MacroExecMode::NEVER_EXECUTE)
+                pSet->Put( SfxUInt16Item( SID_MACROEXECMODE, css::document::MacroExecMode::USE_CONFIG));
+        }
+    }
+
     unique_ptr<SfxMedium> pMedium(new SfxMedium(aFile, STREAM_STD_READ, pFilter, pSet));
     if (pMedium->GetError() != ERRCODE_NONE)
         return NULL;


More information about the Libreoffice-commits mailing list