From 16e248bec76f2c1587383d26581ecc8241c755f8 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Wed, 30 Dec 2015 00:00:37 +0100 Subject: mailmerge: Implement toolbar controller to exclude entries. This can be used as a "How to implement a custom widget / control in the toolbar" example: * the Controller.xcu change introduces a .uno:MailMergeExcludeEntry command so that it can be added in the toolbar .xml description (in this case mailmerge.xml) * the swriter.sdi introduces the .uno:MailMergeExcludeEntry command for the sfx2 handling - so that it can get notifications about enable/disable changes, invalidates, etc. * wrtapp.sdi + associated apphdl.cxx change make it possible to forward command invalidates (the rBindings.Invalidate(FN_MAILMERGE_EXCLUDE_ENTRY);) to the MMExcludeEntryController::statusChanged() for further handling (in this case setting the checked state according to the current data) * MMExcludeEntryController::createItemWindow() implements the custom widget itself (in this case a checkbox, but can be any VCL widget, even a custom one) * the rest (sw.component and the associated getImplementationName(), supportsService(), etc.) takes care of the instantiation of the controller. Change-Id: I68269538f779a6680b0ba98395b7985d3f1ab95a --- sw/source/uibase/app/apphdl.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sw/source/uibase/app/apphdl.cxx') diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 4e2987f3e38d..575ddc319bd0 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -225,6 +225,12 @@ void SwModule::StateOther(SfxItemSet &rSet) } } break; + case FN_MAILMERGE_EXCLUDE_ENTRY: + { + // just trigger calling statusChanged() of MMExcludeEntryController + rSet.InvalidateItem(nWhich); + } + break; case FN_MAILMERGE_CREATE_DOCUMENTS: case FN_MAILMERGE_SAVE_DOCUMENTS: case FN_MAILMERGE_PRINT_DOCUMENTS: @@ -784,6 +790,7 @@ void SwModule::ExecOther(SfxRequest& rReq) rBindings.Invalidate(FN_MAILMERGE_PREV_ENTRY); rBindings.Invalidate(FN_MAILMERGE_NEXT_ENTRY); rBindings.Invalidate(FN_MAILMERGE_LAST_ENTRY); + rBindings.Invalidate(FN_MAILMERGE_EXCLUDE_ENTRY); rBindings.Update(); } break; -- cgit