[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - officecfg/registry sw/inc sw/source sw/uiconfig

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Wed May 27 06:54:03 UTC 2020


 officecfg/registry/schema/org/openoffice/Office/Writer.xcs |   18 +++
 sw/inc/dbmgr.hxx                                           |    4 
 sw/inc/modcfg.hxx                                          |   13 ++
 sw/inc/swabstdlg.hxx                                       |    2 
 sw/source/ui/dialog/swdlgfact.cxx                          |   10 +
 sw/source/ui/dialog/swdlgfact.hxx                          |    2 
 sw/source/ui/envelp/mailmrge.cxx                           |   73 ++++++++++++-
 sw/source/uibase/config/modcfg.cxx                         |    7 +
 sw/source/uibase/dbui/dbmgr.cxx                            |   53 ++++++++-
 sw/source/uibase/inc/mailmrge.hxx                          |    6 +
 sw/uiconfig/swriter/ui/mailmerge.ui                        |   65 +++++++++--
 11 files changed, 235 insertions(+), 18 deletions(-)

New commits:
commit 29264f05460e5e81e12a5eeb0121385b6661c656
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Fri May 22 11:51:33 2020 +0300
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed May 27 08:53:31 2020 +0200

    Add an option to create encyrpted PDF files with mailmerge.
    
    With that option user can create encyrpted pdf files with
    a password column in database via mailmerge.
    
    Change-Id: I081ef050bc269b1fec24fd01ecc812acd7b857ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94709
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
    (cherry picked from commit 983db96a17630be906b868d2be811663f0d846f6)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94689
    Tested-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index e76bbeef495b..596ce4886b66 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -6193,6 +6193,24 @@
             </info>
           </prop>
         </group>
+        <group oor:name="FilePassword">
+          <info>
+            <desc>Specifies how the file password is built.</desc>
+          </info>
+          <prop oor:name="Generation" oor:type="xs:boolean" oor:nillable="false" >
+            <!--UI hints: Form letter - File output - Generate file password from - Database field-->
+            <info>
+              <desc>Determines if the file password is generated from a database field.</desc>
+            </info>
+            <value>false</value>
+          </prop>
+          <prop oor:name="FromDatabaseField" oor:type="xs:string" oor:nillable="false">
+            <info>
+              <desc>Specifies the column name to be used as file password.</desc>
+            </info>
+            <value/>
+          </prop>
+        </group>
       </group>
     </group>
     <group oor:name="Misc">
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index ec106df3c624..98a3b4d9c1c7 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -202,6 +202,10 @@ struct SwMergeDescriptor
      */
     OUString                                            sDBcolumn;
 
+    /** DB column to fetch password
+     */
+    OUString                                            sDBPasswordColumn;
+
     /** @} */
 
     /**
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 58b721af8007..cb197d0f1a91 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -182,9 +182,11 @@ class SAL_DLLPUBLIC_RTTI SwMiscConfig final : public utl::ConfigItem
     bool        m_bNumAlignSize;              // Numbering/Graphic/KeepRatio
     bool        m_bSinglePrintJob;            // FormLetter/PrintOutput/SinglePrintJobs
     bool        m_bIsNameFromColumn;          // FormLetter/FileOutput/FileName/Generation
+    bool        m_bIsPasswordFromColumn;      // FormLetter/FileOutput/FilePassword/Generation
     bool        m_bAskForMailMergeInPrint;    // Ask if documents containing fields should be 'mailmerged'
     MailTextFormats m_nMailingFormats;            // FormLetter/MailingOutput/Formats
     OUString    m_sNameFromColumn;            // FormLetter/FileOutput/FileName/FromDatabaseField (string!)
+    OUString    m_sPasswordFromColumn;        // FormLetter/FileOutput/FilePassword/FromDatabaseField (string!)
     OUString    m_sMailingPath;               // FormLetter/FileOutput/Path
     OUString    m_sMailName;                  // FormLetter/FileOutput/FileName/FromManualSetting (string!)
 
@@ -339,6 +341,17 @@ public:
     void        SetNameFromColumn( const OUString& rSet )       { m_aMiscConfig.m_sNameFromColumn = rSet;
                                                                   m_aMiscConfig.SetModified();}
 
+    bool        IsFileEncyrptedFromColumn() const        { return m_aMiscConfig.m_bIsPasswordFromColumn;}
+    void        SetIsFileEncyrptedFromColumn( bool bSet )
+                        {
+                            m_aMiscConfig.SetModified();
+                            m_aMiscConfig.m_bIsPasswordFromColumn = bSet;
+                        }
+
+    const OUString& GetPasswordFromColumn() const       { return m_aMiscConfig.m_sPasswordFromColumn; }
+    void        SetPasswordFromColumn( const OUString& rSet )       { m_aMiscConfig.m_sPasswordFromColumn = rSet;
+                                                                      m_aMiscConfig.SetModified();}
+
     const OUString& GetMailingPath() const          { return m_aMiscConfig.m_sMailingPath; }
     void        SetMailingPath(const OUString& sPath) { m_aMiscConfig.m_sMailingPath = sPath;
                                                         m_aMiscConfig.SetModified();}
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 3f1066d36315..7b691ce16bf7 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -152,7 +152,9 @@ public:
     virtual css::uno::Reference< css::sdbc::XResultSet> GetResultSet() const = 0;
     virtual bool IsSaveSingleDoc() const = 0;
     virtual bool IsGenerateFromDataBase() const = 0;
+    virtual bool IsFileEncyrptedFromDataBase() const = 0;
     virtual OUString GetColumnName() const = 0;
+    virtual OUString GetPasswordColumnName() const = 0;
     virtual OUString GetTargetURL() const = 0;
 };
 
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 515b26f00853..2bffa03bd995 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -656,11 +656,21 @@ bool AbstractMailMergeDlg_Impl::IsGenerateFromDataBase() const
     return m_xDlg->IsGenerateFromDataBase();
 }
 
+bool AbstractMailMergeDlg_Impl::IsFileEncyrptedFromDataBase() const
+{
+    return m_xDlg->IsFileEncyrptedFromDataBase();
+}
+
 OUString AbstractMailMergeDlg_Impl::GetColumnName() const
 {
     return m_xDlg->GetColumnName();
 }
 
+OUString AbstractMailMergeDlg_Impl::GetPasswordColumnName() const
+{
+    return m_xDlg->GetPasswordColumnName();
+}
+
 OUString AbstractMailMergeDlg_Impl::GetTargetURL() const
 {
     return m_xDlg->GetTargetURL();
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 5da08110c8c8..6f7a8b226416 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -517,7 +517,9 @@ public:
     virtual css::uno::Reference< css::sdbc::XResultSet> GetResultSet() const override;
     virtual bool IsSaveSingleDoc() const override;
     virtual bool IsGenerateFromDataBase() const override;
+    virtual bool IsFileEncyrptedFromDataBase() const override;
     virtual OUString GetColumnName() const override;
+    virtual OUString GetPasswordColumnName() const override;
     virtual OUString GetTargetURL() const override;
 };
 
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index 16478dd81ccf..ef4a35257aed 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -138,12 +138,15 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell,
     , m_xMailingRB(m_xBuilder->weld_radio_button("electronic"))
     , m_xFileRB(m_xBuilder->weld_radio_button("file"))
     , m_xSingleJobsCB(m_xBuilder->weld_check_button("singlejobs"))
+    , m_xPasswordCB(m_xBuilder->weld_check_button("passwd-check"))
     , m_xSaveMergedDocumentFT(m_xBuilder->weld_label("savemergeddoclabel"))
     , m_xSaveSingleDocRB(m_xBuilder->weld_radio_button("singledocument"))
     , m_xSaveIndividualRB(m_xBuilder->weld_radio_button("individualdocuments"))
     , m_xGenerateFromDataBaseCB(m_xBuilder->weld_check_button("generate"))
     , m_xColumnFT(m_xBuilder->weld_label("fieldlabel"))
     , m_xColumnLB(m_xBuilder->weld_combo_box("field"))
+    , m_xPasswordFT(m_xBuilder->weld_label("passwd-label"))
+    , m_xPasswordLB(m_xBuilder->weld_combo_box("passwd-combobox"))
     , m_xPathFT(m_xBuilder->weld_label("pathlabel"))
     , m_xPathED(m_xBuilder->weld_entry("path"))
     , m_xPathPB(m_xBuilder->weld_button("pathpb"))
@@ -173,6 +176,9 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell,
     m_xAttachFT->hide();
     m_xAttachED->hide();
     m_xAttachPB->hide();
+    m_xPasswordCB->hide();
+    m_xPasswordFT->hide();
+    m_xPasswordLB->hide();
 
     uno::Reference< lang::XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
     if(pSelection) {
@@ -250,6 +256,8 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell,
     m_xSaveIndividualRB->connect_toggled(LINK(this, SwMailMergeDlg, SaveTypeHdl));
     SaveTypeHdl(*m_xSaveSingleDocRB);
 
+    m_xFilterLB->connect_changed(LINK(this, SwMailMergeDlg, FileFormatHdl));
+
     Link<weld::SpinButton&,void> aLk2 = LINK(this, SwMailMergeDlg, ModifyHdl);
     m_xFromNF->connect_value_changed(aLk2);
     m_xToNF->connect_value_changed(aLk2);
@@ -262,7 +270,10 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell,
     else
         pDBManager->GetColumnNames(*m_xAddressFieldLB, rSourceName, rTableName);
     for(sal_Int32 nEntry = 0, nEntryCount = m_xAddressFieldLB->get_count(); nEntry < nEntryCount; ++nEntry)
+    {
         m_xColumnLB->append_text(m_xAddressFieldLB->get_text(nEntry));
+        m_xPasswordLB->append_text(m_xAddressFieldLB->get_text(nEntry));
+    }
 
     m_xAddressFieldLB->set_active_text("EMAIL");
 
@@ -277,15 +288,23 @@ SwMailMergeDlg::SwMailMergeDlg(weld::Window* pParent, SwWrtShell& rShell,
     else
         m_xPathED->set_text(aURL.GetFull());
 
-    if (!bColumn ) {
+    if (!bColumn )
+    {
         m_xColumnLB->set_active_text("NAME");
-    } else
+        m_xPasswordLB->set_active_text("PASSWORD");
+    }
+    else
+    {
         m_xColumnLB->set_active_text(pModOpt->GetNameFromColumn());
+        m_xPasswordLB->set_active_text(pModOpt->GetPasswordFromColumn());
+    }
 
     if (m_xAddressFieldLB->get_active() == -1)
         m_xAddressFieldLB->set_active(0);
     if (m_xColumnLB->get_active() == -1)
         m_xColumnLB->set_active(0);
+    if (m_xPasswordLB->get_active() == -1)
+        m_xPasswordLB->set_active(0);
 
     const bool bEnable = m_aSelection.hasElements();
     m_xMarkedRB->set_sensitive(bEnable);
@@ -364,6 +383,9 @@ IMPL_LINK_NOARG(SwMailMergeDlg, OutputTypeHdl, weld::ToggleButton&, void)
         m_xFilterFT->set_sensitive(false);
         m_xFilterLB->set_sensitive(false);
         m_xGenerateFromDataBaseCB->set_sensitive(false);
+        m_xPasswordCB->set_sensitive( false );
+        m_xPasswordFT->set_sensitive( false );
+        m_xPasswordLB->set_sensitive( false );
     }
 }
 
@@ -372,9 +394,12 @@ IMPL_LINK_NOARG(SwMailMergeDlg, SaveTypeHdl, weld::ToggleButton&, void)
     bool bIndividual = m_xSaveIndividualRB->get_active();
 
     m_xGenerateFromDataBaseCB->set_sensitive( bIndividual );
-    if( bIndividual ) {
+    if( bIndividual )
+    {
         FilenameHdl(*m_xGenerateFromDataBaseCB);
-    } else {
+    }
+    else
+    {
         m_xColumnFT->set_sensitive(false);
         m_xColumnLB->set_sensitive(false);
         m_xPathFT->set_sensitive( false );
@@ -382,6 +407,9 @@ IMPL_LINK_NOARG(SwMailMergeDlg, SaveTypeHdl, weld::ToggleButton&, void)
         m_xPathPB->set_sensitive( false );
         m_xFilterFT->set_sensitive( false );
         m_xFilterLB->set_sensitive( false );
+        m_xPasswordCB->set_sensitive( false );
+        m_xPasswordFT->set_sensitive( false );
+        m_xPasswordLB->set_sensitive( false );
     }
 }
 
@@ -395,6 +423,37 @@ IMPL_LINK( SwMailMergeDlg, FilenameHdl, weld::ToggleButton&, rBox, void )
     m_xPathPB->set_sensitive( bEnable );
     m_xFilterFT->set_sensitive( bEnable );
     m_xFilterLB->set_sensitive( bEnable );
+
+    if(m_xFilterLB->get_active_id() == "writer_pdf_Export")
+    {
+        m_xPasswordCB->show();
+        m_xPasswordFT->show();
+        m_xPasswordLB->show();
+
+        m_xPasswordCB->set_sensitive( bEnable );
+        m_xPasswordFT->set_sensitive( bEnable );
+        m_xPasswordLB->set_sensitive( bEnable );
+    }
+}
+
+IMPL_LINK_NOARG( SwMailMergeDlg, FileFormatHdl, weld::ComboBox&, void )
+{
+    if(m_xFilterLB->get_active_id() == "writer_pdf_Export")
+    {
+        m_xPasswordCB->show();
+        m_xPasswordFT->show();
+        m_xPasswordLB->show();
+
+        m_xPasswordCB->set_sensitive( true );
+        m_xPasswordFT->set_sensitive( true );
+        m_xPasswordLB->set_sensitive( true );
+    }
+    else
+    {
+        m_xPasswordCB->hide();
+        m_xPasswordFT->hide();
+        m_xPasswordLB->hide();
+    }
 }
 
 IMPL_LINK_NOARG(SwMailMergeDlg, ModifyHdl, weld::SpinButton&, void)
@@ -434,15 +493,19 @@ bool SwMailMergeDlg::ExecQryShell()
         nMergeType = DBMGR_MERGE_FILE;
         pModOpt->SetMailingPath( GetURLfromPath() );
         pModOpt->SetIsNameFromColumn(m_xGenerateFromDataBaseCB->get_active());
+        pModOpt->SetIsFileEncyrptedFromColumn(m_xPasswordCB->get_active());
 
-        if (!AskUserFilename()) {
+        if (!AskUserFilename())
+        {
             pModOpt->SetNameFromColumn(m_xColumnLB->get_active_text());
+            pModOpt->SetPasswordFromColumn(m_xPasswordLB->get_active_text());
             if (m_xFilterLB->get_active() != -1)
                 m_sSaveFilter = m_xFilterLB->get_active_id();
             m_sFilename = OUString();
         } else {
             //#i97667# reset column name - otherwise it's remembered from the last run
             pModOpt->SetNameFromColumn(OUString());
+            pModOpt->SetPasswordFromColumn(OUString());
             //start save as dialog
             OUString sFilter;
             m_sFilename = SwMailMergeHelper::CallSaveAsDialog(m_xDialog.get(), sFilter);
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 006ad51069a2..5f7c2124396e 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -1162,6 +1162,7 @@ SwMiscConfig::SwMiscConfig() :
     m_bNumAlignSize(true),
     m_bSinglePrintJob(false),
     m_bIsNameFromColumn(true),
+    m_bIsPasswordFromColumn(false),
     m_bAskForMailMergeInPrint(true),
     m_nMailingFormats(MailTextFormats::NONE)
 {
@@ -1188,6 +1189,8 @@ const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
             "FormLetter/FileOutput/FileName/FromManualSetting",   // 9
             "FormLetter/FileOutput/FileName/Generation",//10
             "FormLetter/PrintOutput/AskForMerge"        //11
+            "FormLetter/FileOutput/FilePassword/FromDatabaseField",  // 12
+            "FormLetter/FileOutput/FilePassword/Generation",//13
     };
     return aNames;
 }
@@ -1219,6 +1222,8 @@ void SwMiscConfig::ImplCommit()
             case 9 : pValues[nProp] <<= m_sMailName;        break;
             case 10: pValues[nProp] <<= m_bIsNameFromColumn; break;
             case 11: pValues[nProp] <<= m_bAskForMailMergeInPrint; break;
+            case 12: pValues[nProp] <<= m_sPasswordFromColumn; break;
+            case 13: pValues[nProp] <<= m_bIsPasswordFromColumn; break;
         }
     }
     PutProperties(aNames, aValues);
@@ -1251,6 +1256,8 @@ void SwMiscConfig::Load()
                 case 9 : pValues[nProp] >>= sTmp; m_sMailName = sTmp;     break;
                 case 10: m_bIsNameFromColumn = *o3tl::doAccess<bool>(pValues[nProp]); break;
                 case 11: pValues[nProp] >>= m_bAskForMailMergeInPrint; break;
+                case 12: m_bIsPasswordFromColumn = *o3tl::doAccess<bool>(pValues[nProp]); break;
+                case 13: pValues[nProp] >>= sTmp; m_sPasswordFromColumn = sTmp; break;
             }
         }
     }
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 05216c55c08b..0b28c048bffb 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -949,6 +949,30 @@ static void lcl_PreparePrinterOptions(
     }
 }
 
+static void lcl_PrepareSaveFilterDataOptions(
+    const uno::Sequence< beans::PropertyValue >& rInSaveFilterDataptions,
+    uno::Sequence< beans::PropertyValue >& rOutSaveFilterDataOptions,
+    const OUString& sPassword)
+{
+    const sal_Int32 nOffset = 2;
+    rOutSaveFilterDataOptions.realloc( nOffset );
+    rOutSaveFilterDataOptions[ 0 ].Name = "EncryptFile";
+    rOutSaveFilterDataOptions[ 0 ].Value <<= true;
+    rOutSaveFilterDataOptions[ 1 ].Name = "DocumentOpenPassword";
+    rOutSaveFilterDataOptions[ 1 ].Value <<= sPassword;
+
+    // copy other options
+    sal_Int32 nIndex = nOffset;
+    for( const beans::PropertyValue& rOption : rInSaveFilterDataptions)
+    {
+         rOutSaveFilterDataOptions.realloc( nIndex + 1 );
+         rOutSaveFilterDataOptions[ nIndex ].Name = rOption.Name;
+         rOutSaveFilterDataOptions[ nIndex++ ].Value = rOption.Value ;
+    }
+
+}
+
+
 static SfxObjectShell* lcl_CreateWorkingDocument(
     // input
     const WorkingDocType aType, const SwWrtShell &rSourceWrtShell,
@@ -1148,10 +1172,13 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
     rtl_TextEncoding                    sMailEncoding = ::osl_getThreadTextEncoding();
 
     uno::Reference< beans::XPropertySet > xColumnProp;
+    uno::Reference< beans::XPropertySet > xPasswordColumnProp;
 
     // Check for (mandatory) email or (optional) filename column
     SwDBFormatData aColumnDBFormat;
     bool bColumnName = !rMergeDescriptor.sDBcolumn.isEmpty();
+    bool bPasswordColumnName = !rMergeDescriptor.sDBPasswordColumn.isEmpty();
+
     if( ! bColumnName )
     {
         if( bMT_EMAIL )
@@ -1166,6 +1193,12 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
         uno::Any aCol = xCols->getByName( rMergeDescriptor.sDBcolumn );
         aCol >>= xColumnProp;
 
+        if(bPasswordColumnName)
+        {
+            aCol = xCols->getByName( rMergeDescriptor.sDBPasswordColumn );
+            aCol >>= xPasswordColumnProp;
+        }
+
         aColumnDBFormat.xFormatter = m_pImpl->pMergeData->xFormatter;
         aColumnDBFormat.aNullDate  = m_pImpl->pMergeData->aNullDate;
 
@@ -1376,6 +1409,15 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                 }
             }
 
+            OUString sPasswordColumnData;
+            uno::Sequence< beans::PropertyValue > aSaveToFilterDataOptions( rMergeDescriptor.aSaveToFilterData );
+
+            if( bMT_EMAIL || bPasswordColumnName )
+            {
+                sPasswordColumnData = GetDBField( xPasswordColumnProp, aColumnDBFormat );
+                lcl_PrepareSaveFilterDataOptions( rMergeDescriptor.aSaveToFilterData, aSaveToFilterDataOptions, sPasswordColumnData );
+            }
+
             if( IsMergeOk() )
             {
                 std::unique_ptr< INetURLObject > aTempFileURL;
@@ -1502,7 +1544,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                     // save merged document
                     OUString sFileURL;
                     if( !lcl_SaveDoc( aTempFileURL.get(), pStoreToFilter, pStoreToFilterOptions,
-                                    &rMergeDescriptor.aSaveToFilterData, bIsPDFexport,
+                                    &aSaveToFilterDataOptions, bIsPDFexport,
                                     xWorkDocSh, *pWorkShell, &sFileURL ) )
                     {
                         m_aMergeStatus = MergeStatus::Error;
@@ -3024,9 +3066,14 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
         aMergeDesc.bCreateSingleFile = m_pImpl->pMergeDialog->IsSaveSingleDoc();
         aMergeDesc.bPrefixIsFilename = aMergeDesc.bCreateSingleFile;
         aMergeDesc.sPrefix = m_pImpl->pMergeDialog->GetTargetURL();
-        if( !aMergeDesc.bCreateSingleFile && m_pImpl->pMergeDialog->IsGenerateFromDataBase() )
+
+        if(!aMergeDesc.bCreateSingleFile)
         {
-            aMergeDesc.sDBcolumn = m_pImpl->pMergeDialog->GetColumnName();
+            if(m_pImpl->pMergeDialog->IsGenerateFromDataBase())
+                aMergeDesc.sDBcolumn = m_pImpl->pMergeDialog->GetColumnName();
+
+            if(m_pImpl->pMergeDialog->IsFileEncyrptedFromDataBase())
+                aMergeDesc.sDBPasswordColumn = m_pImpl->pMergeDialog->GetPasswordColumnName();
         }
 
         Merge( aMergeDesc );
diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx
index c1027c8aec5c..3f82cf083688 100644
--- a/sw/source/uibase/inc/mailmrge.hxx
+++ b/sw/source/uibase/inc/mailmrge.hxx
@@ -70,6 +70,7 @@ class SwMailMergeDlg : public SfxDialogController
     std::unique_ptr<weld::RadioButton> m_xFileRB;
 
     std::unique_ptr<weld::CheckButton> m_xSingleJobsCB;
+    std::unique_ptr<weld::CheckButton> m_xPasswordCB;
 
     std::unique_ptr<weld::Label> m_xSaveMergedDocumentFT;
     std::unique_ptr<weld::RadioButton> m_xSaveSingleDocRB;
@@ -79,6 +80,8 @@ class SwMailMergeDlg : public SfxDialogController
 
     std::unique_ptr<weld::Label> m_xColumnFT;
     std::unique_ptr<weld::ComboBox> m_xColumnLB;
+    std::unique_ptr<weld::Label> m_xPasswordFT;
+    std::unique_ptr<weld::ComboBox> m_xPasswordLB;
     std::unique_ptr<weld::Label> m_xPathFT;
     std::unique_ptr<weld::Entry> m_xPathED;
     std::unique_ptr<weld::Button> m_xPathPB;
@@ -104,6 +107,7 @@ class SwMailMergeDlg : public SfxDialogController
     DECL_LINK( FilenameHdl, weld::ToggleButton&, void );
     DECL_LINK( ModifyHdl, weld::SpinButton&, void );
     DECL_LINK( SaveTypeHdl, weld::ToggleButton&, void );
+    DECL_LINK( FileFormatHdl, weld::ComboBox&, void );
 
     bool            ExecQryShell();
     bool            AskUserFilename() const;
@@ -122,7 +126,9 @@ public:
 
     bool IsSaveSingleDoc() const { return m_xSaveSingleDocRB->get_active(); }
     bool IsGenerateFromDataBase() const { return m_xGenerateFromDataBaseCB->get_active(); }
+    bool IsFileEncyrptedFromDataBase() const { return m_xPasswordCB->get_active(); }
     OUString GetColumnName() const { return m_xColumnLB->get_active_text(); }
+    OUString GetPasswordColumnName() const { return m_xPasswordLB->get_active_text(); }
     OUString GetTargetURL() const;
 
     const OUString& GetSaveFilter() const {return m_sSaveFilter;}
diff --git a/sw/uiconfig/swriter/ui/mailmerge.ui b/sw/uiconfig/swriter/ui/mailmerge.ui
index aa97299752ab..6c3becb6618a 100644
--- a/sw/uiconfig/swriter/ui/mailmerge.ui
+++ b/sw/uiconfig/swriter/ui/mailmerge.ui
@@ -508,7 +508,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">0</property>
-                                                    <property name="top_attach">5</property>
+                                                    <property name="top_attach">7</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -520,7 +520,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">1</property>
-                                                    <property name="top_attach">5</property>
+                                                    <property name="top_attach">7</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -535,7 +535,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">0</property>
-                                                    <property name="top_attach">6</property>
+                                                    <property name="top_attach">8</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -547,7 +547,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">1</property>
-                                                    <property name="top_attach">6</property>
+                                                    <property name="top_attach">8</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -561,7 +561,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">2</property>
-                                                    <property name="top_attach">6</property>
+                                                    <property name="top_attach">8</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -575,7 +575,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">0</property>
-                                                    <property name="top_attach">7</property>
+                                                    <property name="top_attach">9</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -586,7 +586,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">1</property>
-                                                    <property name="top_attach">4</property>
+                                                    <property name="top_attach">6</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -602,7 +602,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">1</property>
-                                                    <property name="top_attach">7</property>
+                                                    <property name="top_attach">9</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -618,7 +618,7 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">1</property>
-                                                    <property name="top_attach">8</property>
+                                                    <property name="top_attach">10</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -634,9 +634,54 @@
                                                   </object>
                                                   <packing>
                                                     <property name="left_attach">1</property>
-                                                    <property name="top_attach">9</property>
+                                                    <property name="top_attach">11</property>
                                                   </packing>
                                                 </child>
+                                                <child>
+                                                  <object class="GtkCheckButton" id="passwd-check">
+                                                    <property name="label" translatable="yes" context="mailmerge|passwd-check">Save with password</property>
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="receives_default">False</property>
+                                                    <property name="draw_indicator">True</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="left_attach">0</property>
+                                                    <property name="top_attach">4</property>
+                                                    <property name="width">2</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <object class="GtkLabel" id="passwd-label">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="halign">start</property>
+                                                    <property name="label" translatable="yes" context="mailmerge|passwd-label">Password field:</property>
+                                                    <property name="use_underline">True</property>
+                                                    <property name="mnemonic_widget">passwd-combobox</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="left_attach">0</property>
+                                                    <property name="top_attach">5</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <object class="GtkComboBoxText" id="passwd-combobox">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="hexpand">True</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="left_attach">1</property>
+                                                    <property name="top_attach">5</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <placeholder/>
+                                                </child>
+                                                <child>
+                                                  <placeholder/>
+                                                </child>
                                                 <child>
                                                   <placeholder/>
                                                 </child>


More information about the Libreoffice-commits mailing list