diff options
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r-- | sfx2/source/doc/iframe.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/doc/objmisc.cxx | 14 |
2 files changed, 26 insertions, 8 deletions
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 7d7fdb02ad98..f1e03e7898a2 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -39,10 +39,12 @@ #include <svl/ownlist.hxx> #include <svl/itemprop.hxx> #include <sfx2/frmdescr.hxx> +#include <sfx2/objsh.hxx> #include <sfx2/sfxdlg.hxx> #include <sfx2/sfxsids.hrc> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/window.hxx> +#include <macroloader.hxx> using namespace ::com::sun::star; @@ -158,6 +160,19 @@ sal_Bool SAL_CALL IFrameObject::load( { if ( SvtMiscOptions().IsPluginsEnabled() ) { + util::URL aTargetURL; + aTargetURL.Complete = maFrmDescr.GetURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ); + uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( mxContext ) ); + xTrans->parseStrict( aTargetURL ); + + if (INetURLObject(aTargetURL.Complete).GetProtocol() == INetProtocol::Macro) + { + uno::Reference<frame::XFramesSupplier> xParentFrame = xFrame->getCreator(); + SfxObjectShell* pDoc = SfxMacroLoader::GetObjectShell(xParentFrame); + if (pDoc && !pDoc->AdjustMacroMode()) + return false; + } + DBG_ASSERT( !mxFrame.is(), "Frame already existing!" ); VclPtr<vcl::Window> pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); VclPtr<IFrameWindow_Impl> pWin = VclPtr<IFrameWindow_Impl>::Create( pParent, maFrmDescr.IsFrameBorderOn() ); @@ -180,11 +195,6 @@ sal_Bool SAL_CALL IFrameObject::load( if ( xFramesSupplier.is() ) mxFrame->setCreator( xFramesSupplier ); - util::URL aTargetURL; - aTargetURL.Complete = maFrmDescr.GetURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ); - uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( mxContext ) ); - xTrans->parseStrict( aTargetURL ); - uno::Sequence < beans::PropertyValue > aProps(2); aProps[0].Name = "PluginMode"; aProps[0].Value <<= sal_Int16(2); diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 91817a637620..5b078261910f 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -106,6 +106,7 @@ #include <sfx2/strings.hrc> #include <workwin.hxx> #include <sfx2/sfxdlg.hxx> +#include <sfx2/sfxbasemodel.hxx> #include <appbaslib.hxx> #include <openflag.hxx> #include "objstor.hxx" @@ -496,9 +497,16 @@ bool SfxObjectShell::SwitchToShared( bool bShared, bool bSave ) { // TODO/LATER: currently the application guards against the reentrance problem SetModified(); // the modified flag has to be set to let the document be stored with the shared flag - const SfxPoolItem* pItem = pViewFrame->GetBindings().ExecuteSynchron( HasName() ? SID_SAVEDOC : SID_SAVEASDOC ); - const SfxBoolItem* pResult = dynamic_cast<const SfxBoolItem*>( pItem ); - bResult = ( pResult && pResult->GetValue() ); + try + { + // Do *not* use dispatch mechanism in this place - we don't want others (extensions etc.) to intercept this. + pImpl->pBaseModel->store(); + bResult = true; + } + catch (...) + { + bResult = false; + } } } |