summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx10
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx2
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx59
-rw-r--r--sw/source/uibase/config/modcfg.cxx7
-rw-r--r--sw/source/uibase/dbui/dbmgr.cxx53
-rw-r--r--sw/source/uibase/inc/mailmrge.hxx7
6 files changed, 133 insertions, 5 deletions
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 20097ec6c385..a715f6280c44 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -645,11 +645,21 @@ bool AbstractMailMergeDlg_Impl::IsGenerateFromDataBase() const
return pDlg->IsGenerateFromDataBase();
}
+bool AbstractMailMergeDlg_Impl::IsFileEncyrptedFromDataBase() const
+{
+ return pDlg->IsFileEncyrptedFromDataBase();
+}
+
OUString AbstractMailMergeDlg_Impl::GetColumnName() const
{
return pDlg->GetColumnName();
}
+OUString AbstractMailMergeDlg_Impl::GetPasswordColumnName() const
+{
+ return pDlg->GetPasswordColumnName();
+}
+
OUString AbstractMailMergeDlg_Impl::GetTargetURL() const
{
return pDlg->GetTargetURL();
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 295b56f92348..3a7ecc581512 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -507,7 +507,9 @@ class AbstractMailMergeDlg_Impl : public AbstractMailMergeDlg
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 f9648fdd83fa..0eca50378902 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -170,6 +170,10 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
get(m_pFormatRtfCB, "rtf");
get(m_pFormatSwCB, "swriter");
+ get(m_pPasswordCB, "passwd-check");
+ get(m_pPasswordFT, "passwd-label");
+ get(m_pPasswordLB, "passwd-combobox");
+
get(m_pOkBTN, "ok");
m_pSingleJobsCB->Show(false); // not supported in since cws printerpullpages anymore
@@ -184,6 +188,9 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
m_pAttachFT->Show(false);
m_pAttachED->Show(false);
m_pAttachPB->Show(false);
+ m_pPasswordCB->Show(false);
+ m_pPasswordFT->Show(false);
+ m_pPasswordLB->Show(false);
Point aMailPos = m_pMailingRB->GetPosPixel();
Point aFilePos = m_pFileRB->GetPosPixel();
@@ -276,13 +283,21 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
m_pFromNF->SetMax(SAL_MAX_INT32);
m_pToNF->SetMax(SAL_MAX_INT32);
+ Link<ListBox&,void> aLk3 = LINK(this, SwMailMergeDlg, FileFormatHdl);
+ m_pFilterLB->SetSelectHdl(aLk3);
+
SwDBManager* pDBManager = rSh.GetDBManager();
+
if(_xConnection.is())
SwDBManager::GetColumnNames(m_pAddressFieldLB, _xConnection, rTableName);
else
pDBManager->GetColumnNames(m_pAddressFieldLB, rSourceName, rTableName);
+
for(sal_Int32 nEntry = 0; nEntry < m_pAddressFieldLB->GetEntryCount(); ++nEntry)
+ {
m_pColumnLB->InsertEntry(m_pAddressFieldLB->GetEntry(nEntry));
+ m_pPasswordLB->InsertEntry(m_pAddressFieldLB->GetEntry(nEntry));
+ }
m_pAddressFieldLB->SelectEntry("EMAIL");
@@ -297,15 +312,23 @@ SwMailMergeDlg::SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rShell,
else
m_pPathED->SetText(aURL.GetFull());
- if (!bColumn ) {
+ if (!bColumn )
+ {
m_pColumnLB->SelectEntry("NAME");
- } else
+ m_pPasswordLB->SelectEntry("PASSWORD");
+ }
+ else
+ {
m_pColumnLB->SelectEntry(pModOpt->GetNameFromColumn());
+ m_pPasswordLB->SelectEntry(pModOpt->GetPasswordFromColumn());
+ }
if (m_pAddressFieldLB->GetSelectedEntryCount() == 0)
m_pAddressFieldLB->SelectEntryPos(0);
if (m_pColumnLB->GetSelectedEntryCount() == 0)
m_pColumnLB->SelectEntryPos(0);
+ if (m_pPasswordLB->GetSelectedEntryCount() == 0)
+ m_pPasswordLB->SelectEntryPos(0);
const bool bEnable = m_aSelection.getLength() != 0;
m_pMarkedRB->Enable(bEnable);
@@ -437,6 +460,9 @@ IMPL_LINK( SwMailMergeDlg, OutputTypeHdl, Button *, pBtn, void )
m_pFilterFT->Enable(false);
m_pFilterLB->Enable(false);
m_pGenerateFromDataBaseCB->Enable(false);
+ m_pPasswordCB->Enable(false);
+ m_pPasswordFT->Enable(false);
+ m_pPasswordLB->Enable(false);
}
}
@@ -455,6 +481,9 @@ IMPL_LINK( SwMailMergeDlg, SaveTypeHdl, Button*, pBtn, void )
m_pPathPB->Enable( false );
m_pFilterFT->Enable( false );
m_pFilterLB->Enable( false );
+ m_pPasswordCB->Enable(false);
+ m_pPasswordFT->Enable(false);
+ m_pPasswordLB->Enable(false);
}
}
@@ -468,6 +497,29 @@ IMPL_LINK( SwMailMergeDlg, FilenameHdl, Button*, pBox, void )
m_pPathPB->Enable( bEnable );
m_pFilterFT->Enable( bEnable );
m_pFilterLB->Enable( bEnable );
+
+ if(m_pFilterLB->GetSelectedEntry() == "PDF - Portable Document Format")
+ {
+ m_pPasswordCB->Show(true);
+ m_pPasswordFT->Show(true);
+ m_pPasswordLB->Show(true);
+ m_pPasswordCB->Enable(true);
+ m_pPasswordFT->Enable(true);
+ m_pPasswordLB->Enable(true);
+ }
+}
+
+IMPL_LINK_NOARG( SwMailMergeDlg, FileFormatHdl, ListBox&, void )
+{
+ OUString sSelectedFilter = m_pFilterLB->GetSelectedEntry();
+ bool bEnable = sSelectedFilter == "PDF - Portable Document Format";
+
+ m_pPasswordCB->Show(bEnable);
+ m_pPasswordFT->Show(bEnable);
+ m_pPasswordLB->Show(bEnable);
+ m_pPasswordCB->Enable(bEnable);
+ m_pPasswordFT->Enable(bEnable);
+ m_pPasswordLB->Enable(bEnable);
}
IMPL_LINK_NOARG(SwMailMergeDlg, ModifyHdl, Edit&, void)
@@ -507,15 +559,18 @@ bool SwMailMergeDlg::ExecQryShell()
nMergeType = DBMGR_MERGE_FILE;
pModOpt->SetMailingPath( GetURLfromPath() );
pModOpt->SetIsNameFromColumn(m_pGenerateFromDataBaseCB->IsChecked());
+ pModOpt->SetIsFileEncyrptedFromColumn(m_pPasswordCB->IsChecked());
if (!AskUserFilename()) {
pModOpt->SetNameFromColumn(m_pColumnLB->GetSelectedEntry());
+ pModOpt->SetPasswordFromColumn(m_pPasswordLB->GetSelectedEntry());
if( m_pFilterLB->GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND)
m_sSaveFilter = *static_cast<const OUString*>(m_pFilterLB->GetSelectedEntryData());
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(GetFrameWeld(), sFilter);
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index fd8f9eeef127..3ce420932f4a 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -1187,6 +1187,7 @@ SwMiscConfig::SwMiscConfig() :
m_bNumAlignSize(true),
m_bSinglePrintJob(false),
m_bIsNameFromColumn(true),
+ m_bIsPasswordFromColumn(false),
m_bAskForMailMergeInPrint(true),
m_nMailingFormats(MailTextFormats::NONE)
{
@@ -1218,6 +1219,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
};
OUString* pNames = aNames.getArray();
for(int i = 0; i < nCount; i++)
@@ -1253,6 +1256,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);
@@ -1285,6 +1290,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 9c694a2bad4e..a3a443aec18a 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -990,6 +990,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,
@@ -1189,10 +1213,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 )
@@ -1207,6 +1234,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 = pImpl->pMergeData->xFormatter;
aColumnDBFormat.aNullDate = pImpl->pMergeData->aNullDate;
@@ -1422,6 +1455,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;
@@ -1549,7 +1591,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;
@@ -3083,9 +3125,14 @@ void SwDBManager::ExecuteFormLetter( SwWrtShell& rSh,
aMergeDesc.bCreateSingleFile = pImpl->pMergeDialog->IsSaveSingleDoc();
aMergeDesc.bPrefixIsFilename = aMergeDesc.bCreateSingleFile;
aMergeDesc.sPrefix = pImpl->pMergeDialog->GetTargetURL();
- if( !aMergeDesc.bCreateSingleFile && pImpl->pMergeDialog->IsGenerateFromDataBase() )
+
+ if( !aMergeDesc.bCreateSingleFile )
{
- aMergeDesc.sDBcolumn = pImpl->pMergeDialog->GetColumnName();
+ if(pImpl->pMergeDialog->IsGenerateFromDataBase())
+ aMergeDesc.sDBcolumn = pImpl->pMergeDialog->GetColumnName();
+
+ if(pImpl->pMergeDialog->IsFileEncyrptedFromDataBase())
+ aMergeDesc.sDBPasswordColumn = pImpl->pMergeDialog->GetPasswordColumnName();
}
Merge( aMergeDesc );
diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx
index cbb9a9465936..d5730a80736c 100644
--- a/sw/source/uibase/inc/mailmrge.hxx
+++ b/sw/source/uibase/inc/mailmrge.hxx
@@ -90,6 +90,10 @@ class SwMailMergeDlg : public SvxStandardDialog
VclPtr<CheckBox> m_pFormatRtfCB;
VclPtr<CheckBox> m_pFormatSwCB;
+ VclPtr<CheckBox> m_pPasswordCB;
+ VclPtr<FixedText> m_pPasswordFT;
+ VclPtr<ListBox> m_pPasswordLB;
+
VclPtr<OKButton> m_pOkBTN;
std::unique_ptr<SwMailMergeDlg_Impl> pImpl;
@@ -110,6 +114,7 @@ class SwMailMergeDlg : public SvxStandardDialog
DECL_LINK( FilenameHdl, Button*, void );
DECL_LINK( ModifyHdl, Edit&, void );
DECL_LINK( SaveTypeHdl, Button*, void );
+ DECL_LINK( FileFormatHdl, ListBox&, void );
virtual void Apply() override;
bool ExecQryShell();
@@ -130,7 +135,9 @@ public:
bool IsSaveSingleDoc() const { return m_pSaveSingleDocRB->IsChecked(); }
bool IsGenerateFromDataBase() const { return m_pGenerateFromDataBaseCB->IsChecked(); }
+ bool IsFileEncyrptedFromDataBase() const { return m_pPasswordCB->IsChecked(); }
OUString GetColumnName() const { return m_pColumnLB->GetSelectedEntry(); }
+ OUString GetPasswordColumnName() const { return m_pPasswordLB->GetSelectedEntry(); }
OUString GetTargetURL() const;
const OUString& GetSaveFilter() const {return m_sSaveFilter;}