summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-12-23 13:24:33 +0100
committerJan Holesovsky <kendy@collabora.com>2016-03-16 14:53:28 +0100
commitec4cdb715ae1d6e3b0aa387df01314634ed5395e (patch)
treea7519ca8bfaee8b19ca69d09b389d43b6817d1b6
parentmailmerge: Icon for the Mail Merge Wizard too. (diff)
downloadcore-ec4cdb715ae1d6e3b0aa387df01314634ed5395e.tar.gz
core-ec4cdb715ae1d6e3b0aa387df01314634ed5395e.zip
mailmerge: Implemented "Edit Individual Documents" toolbar button.
Change-Id: Ia867e24a3a96b8a5d22a5c07a83e16b8b049fd60
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu8
-rw-r--r--sw/inc/cmdid.h10
-rw-r--r--sw/sdi/swriter.sdi17
-rw-r--r--sw/sdi/wrtapp.sdi6
-rw-r--r--sw/source/uibase/app/apphdl.cxx38
-rw-r--r--sw/uiconfig/swform/toolbar/mailmerge.xml2
-rw-r--r--sw/uiconfig/swreport/toolbar/mailmerge.xml2
-rw-r--r--sw/uiconfig/swriter/toolbar/mailmerge.xml2
-rw-r--r--sw/uiconfig/swxform/toolbar/mailmerge.xml2
9 files changed, 81 insertions, 6 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index e0ecb183ab90..ad0fc52c4be4 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -562,6 +562,14 @@
<value>1</value>
</prop>
</node>
+ <node oor:name=".uno:MailMergeCreateDocuments" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Edit Individual Documents</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
<node oor:name=".uno:SetAnchorToFrame" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Anchor To Frame</value>
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index a2b192c9bc14..47246bc2c61a 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -252,10 +252,12 @@
#define FN_MAILMERGE_CHILDWINDOW (FN_INSERT + 68) /* back-to-mail-merge-wizard child window*/
#define FN_INSERT_SMA (FN_INSERT + 69) /* insert StarMath */
-#define FN_MAILMERGE_FIRST_ENTRY (FN_INSERT+ 70) /* mail merge wizard - go to the first entry */
-#define FN_MAILMERGE_PREV_ENTRY (FN_INSERT + 71) /* mail merge wizard - go to the previous entry */
-#define FN_MAILMERGE_NEXT_ENTRY (FN_INSERT + 72) /* mail merge wizard - go to the next entry */
-#define FN_MAILMERGE_LAST_ENTRY (FN_INSERT + 73) /* mail merge wizard - go to the next entry */
+#define FN_MAILMERGE_FIRST_ENTRY (FN_INSERT + 70) /* mail merge toolbar - go to the first entry */
+#define FN_MAILMERGE_PREV_ENTRY (FN_INSERT + 71) /* mail merge toolbar - go to the previous entry */
+#define FN_MAILMERGE_NEXT_ENTRY (FN_INSERT + 72) /* mail merge toolbar - go to the next entry */
+#define FN_MAILMERGE_LAST_ENTRY (FN_INSERT + 73) /* mail merge toolbar - go to the next entry */
+
+#define FN_MAILMERGE_CREATE_DOCUMENTS (FN_INSERT + 74) /* mail merge toolbar - create individual documents */
#define FN_DRAWTEXT_ATTR_DLG (FN_INSERT + 76) /* position DrawText */
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index a5b12586adf1..1c40289e4a61 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -3841,6 +3841,23 @@ SfxVoidItem MailMergeLastEntry FN_MAILMERGE_LAST_ENTRY
GroupId = GID_DOCUMENT;
]
+SfxVoidItem MailMergeCreateDocuments FN_MAILMERGE_CREATE_DOCUMENTS
+()
+[
+ AutoUpdate = TRUE,
+ FastCall = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = TRUE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_DOCUMENT;
+]
+
SfxBoolItem MergeTable FN_TABLE_MERGE_TABLE
()
[
diff --git a/sw/sdi/wrtapp.sdi b/sw/sdi/wrtapp.sdi
index 9e8d3587b9fd..57ad1e70090f 100644
--- a/sw/sdi/wrtapp.sdi
+++ b/sw/sdi/wrtapp.sdi
@@ -86,6 +86,12 @@ interface StarWriter
StateMethod = StateOther ;
]
+ FN_MAILMERGE_CREATE_DOCUMENTS
+ [
+ ExecMethod = ExecOther ;
+ StateMethod = StateOther ;
+ ]
+
FN_SET_MODOPT_TBLNUMFMT // status()
[
ExecMethod = ExecOther ;
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
}
}
diff --git a/sw/uiconfig/swform/toolbar/mailmerge.xml b/sw/uiconfig/swform/toolbar/mailmerge.xml
index 662a0000ed70..2ad2e32f9d2b 100644
--- a/sw/uiconfig/swform/toolbar/mailmerge.xml
+++ b/sw/uiconfig/swform/toolbar/mailmerge.xml
@@ -15,4 +15,6 @@
<toolbar:toolbaritem xlink:href=".uno:MailMergePrevEntry"/>
<toolbar:toolbaritem xlink:href=".uno:MailMergeNextEntry"/>
<toolbar:toolbaritem xlink:href=".uno:MailMergeLastEntry"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:MailMergeCreateDocuments"/>
</toolbar:toolbar>
diff --git a/sw/uiconfig/swreport/toolbar/mailmerge.xml b/sw/uiconfig/swreport/toolbar/mailmerge.xml
index 662a0000ed70..2ad2e32f9d2b 100644
--- a/sw/uiconfig/swreport/toolbar/mailmerge.xml
+++ b/sw/uiconfig/swreport/toolbar/mailmerge.xml
@@ -15,4 +15,6 @@
<toolbar:toolbaritem xlink:href=".uno:MailMergePrevEntry"/>
<toolbar:toolbaritem xlink:href=".uno:MailMergeNextEntry"/>
<toolbar:toolbaritem xlink:href=".uno:MailMergeLastEntry"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:MailMergeCreateDocuments"/>
</toolbar:toolbar>
diff --git a/sw/uiconfig/swriter/toolbar/mailmerge.xml b/sw/uiconfig/swriter/toolbar/mailmerge.xml
index 662a0000ed70..2ad2e32f9d2b 100644
--- a/sw/uiconfig/swriter/toolbar/mailmerge.xml
+++ b/sw/uiconfig/swriter/toolbar/mailmerge.xml
@@ -15,4 +15,6 @@
<toolbar:toolbaritem xlink:href=".uno:MailMergePrevEntry"/>
<toolbar:toolbaritem xlink:href=".uno:MailMergeNextEntry"/>
<toolbar:toolbaritem xlink:href=".uno:MailMergeLastEntry"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:MailMergeCreateDocuments"/>
</toolbar:toolbar>
diff --git a/sw/uiconfig/swxform/toolbar/mailmerge.xml b/sw/uiconfig/swxform/toolbar/mailmerge.xml
index 662a0000ed70..2ad2e32f9d2b 100644
--- a/sw/uiconfig/swxform/toolbar/mailmerge.xml
+++ b/sw/uiconfig/swxform/toolbar/mailmerge.xml
@@ -15,4 +15,6 @@
<toolbar:toolbaritem xlink:href=".uno:MailMergePrevEntry"/>
<toolbar:toolbaritem xlink:href=".uno:MailMergeNextEntry"/>
<toolbar:toolbaritem xlink:href=".uno:MailMergeLastEntry"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:MailMergeCreateDocuments"/>
</toolbar:toolbar>