[Libreoffice-commits] core.git: Branch 'feature/mailmerge-toolbar' - officecfg/registry sw/inc sw/sdi sw/source sw/uiconfig

Jan Holesovsky kendy at collabora.com
Wed Dec 23 04:25:44 PST 2015


 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |    8 ++
 sw/inc/cmdid.h                                                      |   10 +-
 sw/sdi/swriter.sdi                                                  |   24 ++++++
 sw/sdi/wrtapp.sdi                                                   |    6 +
 sw/source/uibase/app/apphdl.cxx                                     |   38 +++++++++-
 sw/uiconfig/swform/toolbar/mailmerge.xml                            |    2 
 sw/uiconfig/swreport/toolbar/mailmerge.xml                          |    2 
 sw/uiconfig/swriter/toolbar/mailmerge.xml                           |    2 
 sw/uiconfig/swxform/toolbar/mailmerge.xml                           |    2 
 9 files changed, 88 insertions(+), 6 deletions(-)

New commits:
commit 0ad62c0f058d9f8f6ad6cc7d2104a4b5b68df582
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Dec 23 13:24:33 2015 +0100

    mailmerge: Implemented "Edit Individual Documents" toolbar button.
    
    Change-Id: Ia867e24a3a96b8a5d22a5c07a83e16b8b049fd60

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 6df35bb..4c3ae1a 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -524,6 +524,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 4cd552a..b6ed874 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 e704454..8c816ad 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -5323,6 +5323,30 @@ SfxVoidItem MailMergeLastEntry FN_MAILMERGE_LAST_ENTRY
     GroupId = GID_DOCUMENT;
 ]
 
+SfxVoidItem MailMergeCreateDocuments FN_MAILMERGE_CREATE_DOCUMENTS
+()
+[
+    /* flags: */
+    AutoUpdate = TRUE,
+    Cachable = Cachable,
+    FastCall = TRUE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = TRUE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_DOCUMENT;
+]
+
 SfxBoolItem MergeTable FN_TABLE_MERGE_TABLE
 ()
 [
diff --git a/sw/sdi/wrtapp.sdi b/sw/sdi/wrtapp.sdi
index b130264..ccaab47 100644
--- a/sw/sdi/wrtapp.sdi
+++ b/sw/sdi/wrtapp.sdi
@@ -89,6 +89,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 327201c..7432b92 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 662a000..2ad2e32 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 662a000..2ad2e32 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 662a000..2ad2e32 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 662a000..2ad2e32 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>


More information about the Libreoffice-commits mailing list