diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2021-11-29 10:18:52 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2021-11-29 17:21:38 +0100 |
commit | 774c6a6e1603bf3f12f1573b0778e0f0f9783169 (patch) | |
tree | 1d58ef892165d76ad3d205b069d54715d7dd3245 /sfx2 | |
parent | 015512c0d85fb38c2c3482f0fb9890cc52bfb58a (diff) |
tdf#117280: fix multiple Macro execution when triggered by Document print event
Change-Id: Ibfebcc1a31464b2610afea2035e3d723a0c79167
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126018
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 28afbd7e5bad..44cd4216bece 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2896,7 +2896,13 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , } const SfxViewEventHint* pViewHint = dynamic_cast<const SfxViewEventHint*>(&rHint); - postEvent_Impl( pNamedHint->GetEventName(), pViewHint ? pViewHint->GetController() : Reference< frame::XController2 >() ); + if (pViewHint) + { + const SfxPrintingHint* pPrintingHint = dynamic_cast<const SfxPrintingHint*>(&rHint); + postEvent_Impl( pNamedHint->GetEventName(), pViewHint->GetController(), pPrintingHint? Any(pPrintingHint->GetWhich()) : Any() ); + } + else + postEvent_Impl( pNamedHint->GetEventName(), Reference< frame::XController2 >() ); } if ( rHint.GetId() == SfxHintId::TitleChanged ) @@ -3223,7 +3229,7 @@ public: }; } // anonymous namespace -void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame::XController2 >& xController ) +void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame::XController2 >& xController, const Any& supplement ) { // object already disposed? if ( impl_isDisposed() ) @@ -3245,7 +3251,7 @@ void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame { SAL_INFO("sfx.doc", "SfxDocumentEvent: " + aName); - document::DocumentEvent aDocumentEvent( static_cast<frame::XModel*>(this), aName, xController, Any() ); + document::DocumentEvent aDocumentEvent( static_cast<frame::XModel*>(this), aName, xController, supplement ); pIC->forEach< document::XDocumentEventListener, NotifySingleListenerIgnoreRE< document::XDocumentEventListener, document::DocumentEvent > >( NotifySingleListenerIgnoreRE< document::XDocumentEventListener, document::DocumentEvent >( diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index dbf84dde0d3c..f6cd8936ee84 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -313,7 +313,6 @@ void SfxPrinterController::jobStarted() xDocProps->setPrintDate( now.GetUNODateTime() ); - SfxGetpApp()->NotifyEvent( SfxEventHint(SfxEventHintId::PrintDoc, GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ), mpObjectShell ) ); uno::Sequence < beans::PropertyValue > aOpts; aOpts = getJobProperties( aOpts ); |