diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-08-07 17:37:11 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2019-09-05 12:32:33 +0200 |
commit | 2b802429df9ef3f802da269b29f9e872dc254c0f (patch) | |
tree | 663e21de9b7d9c940b91186ad01f0f12e3f7af5f /sfx2/source/inc | |
parent | 4984dbdef324ebe709f03144ef2808dbef09ba83 (diff) |
warn on load when a document binds an event to a macro
a) treat shared/Scripts equivalently to document scripts
This doesn't automatically warn/block running those scripts when used in a
freshly loaded document on its own however
because DocumentMacroMode::checkMacrosOnLoading will see at...
if ( m_xData->m_rDocumentAccess.documentStorageHasMacros() || hasMacroLibrary() )
that the document contains no macros and flip the allow macros flag to true so
that potentially new uses of macros added by the user during the edit are
allowed to run
b) so, add an additional flag to indicate existence of use of macros in a document
c) for odf import, set it when a script:event-listener tag is encountered
d) for html import when registerScriptEvents or SwFormatINetFormat::SetMacroTable is called
e) for doc import when Read_F_Macro or StoreMacroCmds is called as well for good measure
f) for xls import when registerScriptEvent or ScMacroInfo::SetMacro is called
g) for oox import when VbaProject::attachMacros is called
Change-Id: Ic1203d8ec7dfc217aa217135033ae9db2888e19b
Reviewed-on: https://gerrit.libreoffice.org/77387
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'sfx2/source/inc')
-rw-r--r-- | sfx2/source/inc/objshimp.hxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 006b938664ea..848775ef2f47 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -90,7 +90,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bSaveVersionOnClose:1, m_bSharedXMLFlag:1, // whether the document should be edited in shared mode m_bAllowShareControlFileClean:1, // whether the flag should be stored in xml file - m_bConfigOptionsChecked:1; // whether or not the user options are checked after the Options dialog is closed. + m_bConfigOptionsChecked:1, // whether or not the user options are checked after the Options dialog is closed. + m_bMacroCallsSeenWhileLoading:1; // whether or not the user options are checked after the Options dialog is closed. IndexBitSet aBitSet; ErrCode lErr; @@ -139,6 +140,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess virtual void setCurrentMacroExecMode( sal_uInt16 nMacroMode ) override; virtual OUString getDocumentLocation() const override; virtual bool documentStorageHasMacros() const override; + virtual bool macroCallsSeenWhileLoading() const override; virtual css::uno::Reference< css::document::XEmbeddedScripts > getEmbeddedDocumentScripts() const override; virtual SignatureState getScriptingSignatureState() override; |