diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2013-11-27 15:48:32 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-02 11:13:44 +0100 |
commit | 3428ccb269d752bcfcb96228b8fb432fcb883924 (patch) | |
tree | 1b4f6fb6900ec154a49347cf0358092f90cd7b5b /sc/source/ui | |
parent | 01e8167a7e89961b5a985d18dab5b8af34f8b97e (diff) |
datastreams: for security, ask before executing a script when importing
Change-Id: I76a11dae2569eb7e0c791c9f1fb20626c4ff7528
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/docshell/datastream.cxx | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx index 4305d3fbc403..88c2ae40b45c 100644 --- a/sc/source/ui/docshell/datastream.cxx +++ b/sc/source/ui/docshell/datastream.cxx @@ -11,6 +11,7 @@ #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/ui/XUIElement.hpp> +#include <officecfg/Office/Common.hxx> #include <osl/conditn.hxx> #include <rtl/strbuf.hxx> #include <salhelper/thread.hxx> @@ -237,14 +238,6 @@ void DataStream::Decode(const OUString& rURL, const OUString& rRange, mnSettings = nSettings; mpEndRange.reset( NULL ); - SvStream *pStream = 0; - if (mnSettings & SCRIPT_STREAM) - pStream = new SvScriptStream(msURL); - else - pStream = new SvFileStream(msURL, STREAM_READ); - mxReaderThread = new datastreams::ReaderThread( pStream ); - mxReaderThread->launch(); - mbValuesInLine = mnSettings & VALUES_IN_LINE; if (msMove == "NO_MOVE") @@ -271,6 +264,16 @@ void DataStream::StartImport() return; mbIsUndoEnabled = mpScDocument->IsUndoEnabled(); mpScDocument->EnableUndo(false); + if (!mxReaderThread.is()) + { + SvStream *pStream = 0; + if (mnSettings & SCRIPT_STREAM) + pStream = new SvScriptStream(msURL); + else + pStream = new SvFileStream(msURL, STREAM_READ); + mxReaderThread = new datastreams::ReaderThread( pStream ); + mxReaderThread->launch(); + } mbRunning = true; AutoTimer::Start(); } @@ -378,7 +381,18 @@ sfx2::SvBaseLink::UpdateResult DataStream::DataChanged( const OUString& , const css::uno::Any& ) { MakeToolbarVisible(); - StartImport(); + StopImport(); + bool bStart = true; + if (mnSettings & SCRIPT_STREAM && !mxReaderThread.is() && + officecfg::Office::Common::Security::Scripting::MacroSecurityLevel::get() >= 1) + { + MessageDialog aQBox( NULL, "QueryRunStreamScriptDialog", "modules/scalc/ui/queryrunstreamscriptdialog.ui"); + aQBox.set_primary_text( aQBox.get_primary_text().replaceFirst("%URL", msURL) ); + if (RET_YES != aQBox.Execute()) + bStart = false; + } + if (bStart) + StartImport(); return SUCCESS; } |