summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-11-29 10:18:52 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-29 21:36:40 +0100
commit20f56c937c44a9cbe3c05fa7c510feaf9d2341df (patch)
tree5f923279d8465781fee1d72830c537e6c166ae91 /sfx2
parent75950f3eb9517b8d5cce4a7e491ab031a1b3f0db (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> (cherry picked from commit 774c6a6e1603bf3f12f1573b0778e0f0f9783169) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126006 Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx12
-rw-r--r--sfx2/source/view/viewprn.cxx1
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 );