summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/uibase')
-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
3 files changed, 64 insertions, 3 deletions
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;}