diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-12-23 13:24:33 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-18 09:13:56 +0100 |
commit | 6b355901a7e7a1fd8710e743621ad655068a5817 (patch) | |
tree | a6da4fe63e959e9bffd9216552d6ddcacf3e75c6 /sw/source/uibase/app | |
parent | 6d0832228b76c2a0030ab5f05e06ef33f6dcb804 (diff) |
mailmerge: Implemented "Edit Individual Documents" toolbar button.
Change-Id: Ia867e24a3a96b8a5d22a5c07a83e16b8b049fd60
Diffstat (limited to 'sw/source/uibase/app')
-rw-r--r-- | sw/source/uibase/app/apphdl.cxx | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 9ccd649a938e..a8cf5aebb56c 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -225,6 +225,14 @@ void SwModule::StateOther(SfxItemSet &rSet) } } break; + case FN_MAILMERGE_CREATE_DOCUMENTS: + { + SwView* pView = ::GetActiveView(); + SwMailMergeConfigItem* pConfigItem = pView->GetMailMergeConfigItem(); + if (!pConfigItem) + rSet.DisableItem(nWhich); + } + break; default: OSL_FAIL("::StateOther: default"); } @@ -756,8 +764,7 @@ void SwModule::ExecOther(SfxRequest& rReq) {"Cursor", uno::makeAny(pConfigItem->GetResultSet())} })); - SwView* pActView = ::GetActiveView(); - SwWrtShell& rSh = pActView->GetWrtShell(); + SwWrtShell& rSh = pView->GetWrtShell(); SwMergeDescriptor aMergeDesc(DBMGR_MERGE, rSh, aDescriptor); rSh.GetDBManager()->MergeNew(aMergeDesc); @@ -770,6 +777,33 @@ void SwModule::ExecOther(SfxRequest& rReq) rBindings.Update(); } break; + case FN_MAILMERGE_CREATE_DOCUMENTS: + { + SwView* pView = ::GetActiveView(); + SwMailMergeConfigItem* pConfigItem = pView->GetMailMergeConfigItem(); + if (!pConfigItem) + return; + + // TODO share this code somehow with the above FN_MAILMERGE_*_ENTRY + // TODO kill SwMailMergeWizard::CreateTargetDocument() + svx::ODataAccessDescriptor aDescriptor; + aDescriptor.setDataSource(pConfigItem->GetCurrentDBData().sDataSource); + aDescriptor[ svx::daConnection ] <<= pConfigItem->GetConnection().getTyped(); + aDescriptor[ svx::daCursor ] <<= pConfigItem->GetResultSet(); + aDescriptor[ svx::daCommand ] <<= pConfigItem->GetCurrentDBData().sCommand; + aDescriptor[ svx::daCommandType ] <<= pConfigItem->GetCurrentDBData().nCommandType; + aDescriptor[ svx::daSelection ] <<= pConfigItem->GetSelection(); + + SwWrtShell& rSh = pView->GetWrtShell(); + SwMergeDescriptor aMergeDesc(DBMGR_MERGE_SHELL, rSh, aDescriptor); + aMergeDesc.pMailMergeConfigItem = pConfigItem; + aMergeDesc.bCreateSingleFile = true; + rSh.GetDBManager()->MergeNew(aMergeDesc); + + pConfigItem->SetMergeDone(); + if (pConfigItem->GetTargetView()) + pConfigItem->GetTargetView()->GetViewFrame()->GetFrame().Appear(); + } #endif } } |