summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/source/doc/objstor.cxx28
-rw-r--r--sw/source/ui/dbui/mmresultdialogs.cxx80
-rw-r--r--sw/source/ui/inc/mmresultdialogs.hxx4
-rw-r--r--sw/uiconfig/swriter/ui/mmresultemaildialog.ui45
4 files changed, 151 insertions, 6 deletions
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index e80419546292..2bfa41d90a72 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2805,7 +2805,35 @@ bool SfxObjectShell::PreDoSaveAs_Impl(const OUString& rFileName, const OUString&
// set filter; if no filter is given, take the default filter of the factory
if ( !aFilterName.isEmpty() )
+ {
pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetFilter4FilterName( aFilterName ) );
+
+ if(aFilterName == "writer_pdf_Export" && pNewFile->GetItemSet())
+ {
+ uno::Sequence< beans::PropertyValue > aSaveToFilterDataOptions(2);
+ bool bRet = false;
+
+ for(int i = 0 ; i< rArgs.getLength() ; ++i)
+ {
+ auto aProp = rArgs[i];
+ if(aProp.Name == "EncryptFile")
+ {
+ aSaveToFilterDataOptions[0].Name = aProp.Name;
+ aSaveToFilterDataOptions[0].Value = aProp.Value;
+ bRet = true;
+ }
+ if(aProp.Name == "DocumentOpenPassword")
+ {
+ aSaveToFilterDataOptions[1].Name = aProp.Name;
+ aSaveToFilterDataOptions[1].Value = aProp.Value;
+ bRet = true;
+ }
+ }
+
+ if( bRet )
+ pNewFile->GetItemSet()->Put( SfxUnoAnyItem(SID_FILTER_DATA, uno::makeAny(aSaveToFilterDataOptions)));
+ }
+ }
else
pNewFile->SetFilter( GetFactory().GetFilterContainer()->GetAnyFilter( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT ) );
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index 2702afde2b17..8c812c0b4b8f 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -322,6 +322,9 @@ SwMMResultEmailDialog::SwMMResultEmailDialog(weld::Window* pParent)
, m_xSendAsPB(m_xBuilder->weld_button("sendassettings"))
, m_xAttachmentGroup(m_xBuilder->weld_widget("attachgroup"))
, m_xAttachmentED(m_xBuilder->weld_entry("attach"))
+ , m_xPasswordFT(m_xBuilder->weld_label("passwordft"))
+ , m_xPasswordLB(m_xBuilder->weld_combo_box("password"))
+ , m_xPasswordCB(m_xBuilder->weld_check_button("passwordcb"))
, m_xSendAllRB(m_xBuilder->weld_radio_button("sendallrb"))
, m_xFromRB(m_xBuilder->weld_radio_button("fromrb"))
, m_xFromNF(m_xBuilder->weld_spin_button("from"))
@@ -332,6 +335,7 @@ SwMMResultEmailDialog::SwMMResultEmailDialog(weld::Window* pParent)
m_xCopyToPB->connect_clicked(LINK(this, SwMMResultEmailDialog, CopyToHdl_Impl));
m_xSendAsPB->connect_clicked(LINK(this, SwMMResultEmailDialog, SendAsHdl_Impl));
m_xSendAsLB->connect_changed(LINK(this, SwMMResultEmailDialog, SendTypeHdl_Impl));
+ m_xPasswordCB->connect_toggled( LINK( this, SwMMResultEmailDialog, CheckHdl ));
Link<weld::ToggleButton&,void> aLink = LINK(this, SwMMResultEmailDialog, DocumentSelectionHdl_Impl);
m_xSendAllRB->connect_toggled(aLink);
@@ -341,6 +345,10 @@ SwMMResultEmailDialog::SwMMResultEmailDialog(weld::Window* pParent)
m_xOKButton->connect_clicked(LINK(this, SwMMResultEmailDialog, SendDocumentsHdl_Impl));
+ m_xPasswordCB->hide();
+ m_xPasswordFT->hide();
+ m_xPasswordLB->hide();
+
FillInEmailSettings();
}
@@ -416,12 +424,18 @@ void SwMMResultEmailDialog::FillInEmailSettings()
if (xColAccess.is())
aFields = xColAccess->getElementNames();
- // fill mail address ListBox
+ // fill mail address and password ListBox
assert(m_xMailToLB->get_count() == 0);
+ assert(m_xPasswordLB->get_count() == 0);
for (const OUString& rField : std::as_const(aFields))
+ {
m_xMailToLB->append_text(rField);
+ m_xPasswordLB->append_text(rField);
+ }
m_xMailToLB->set_active(0);
+ m_xPasswordLB->set_active(0);
+
// then select the right one - may not be available
const std::vector<std::pair<OUString, int>>& rHeaders = xConfigItem->GetDefaultAddressHeaders();
OUString sEMailColumn = rHeaders[MM_PART_E_MAIL].first;
@@ -448,6 +462,14 @@ IMPL_LINK_NOARG(SwMMResultSaveDialog, DocumentSelectionHdl_Impl, weld::ToggleBut
m_xToNF->set_sensitive(bEnableFromTo);
}
+IMPL_LINK_NOARG(SwMMResultEmailDialog, CheckHdl, weld::ToggleButton&, void)
+{
+ bool bEnable = m_xPasswordCB->get_active();
+
+ m_xPasswordFT->set_sensitive(bEnable);
+ m_xPasswordLB->set_sensitive(bEnable);
+}
+
IMPL_LINK_NOARG(SwMMResultPrintDialog, DocumentSelectionHdl_Impl, weld::ToggleButton&, void)
{
bool bEnableFromTo = m_xFromRB->get_active();
@@ -814,6 +836,7 @@ IMPL_LINK(SwMMResultEmailDialog, SendTypeHdl_Impl, weld::ComboBox&, rBox, void)
{
auto nDocType = rBox.get_active_id().toUInt32();
bool bEnable = MM_DOCTYPE_HTML != nDocType && MM_DOCTYPE_TEXT != nDocType;
+ bool bIsPDF = nDocType == MM_DOCTYPE_PDF;
m_xSendAsPB->set_sensitive(bEnable);
m_xAttachmentGroup->set_sensitive(bEnable);
if(bEnable)
@@ -833,6 +856,21 @@ IMPL_LINK(SwMMResultEmailDialog, SendTypeHdl_Impl, weld::ComboBox&, rBox, void)
m_xAttachmentED->set_text(sAttach);
}
}
+
+ if(bIsPDF)
+ {
+ m_xPasswordCB->show();
+ m_xPasswordFT->show();
+ m_xPasswordLB->show();
+ CheckHdl(*m_xPasswordCB);
+ }
+ else
+ {
+ m_xPasswordCB->hide();
+ m_xPasswordFT->hide();
+ m_xPasswordLB->hide();
+
+ }
}
IMPL_LINK_NOARG(SwMMResultEmailDialog, SendAsHdl_Impl, weld::Button&, void)
@@ -995,6 +1033,7 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi
else
return; // back to the dialog
}
+
OUString sEMailColumn = m_xMailToLB->get_active_text();
OSL_ENSURE( !sEMailColumn.isEmpty(), "No email column selected");
Reference< sdbcx::XColumnsSupplier > xColsSupp( xConfigItem->GetResultSet(), UNO_QUERY);
@@ -1005,6 +1044,14 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi
return;
}
+ OUString sPasswordColumn = m_xPasswordLB->get_active_text();
+ OSL_ENSURE( !sPasswordColumn.isEmpty(), "No password column selected");
+ if(sPasswordColumn.isEmpty() || !xColAccess.is() || !xColAccess->hasByName(sPasswordColumn))
+ {
+ m_xDialog->response(RET_OK);
+ return;
+ }
+
OUString sFilterOptions;
if(MM_DOCTYPE_TEXT == nDocType)
{
@@ -1082,14 +1129,35 @@ IMPL_LINK_NOARG(SwMMResultEmailDialog, SendDocumentsHdl_Impl, weld::Button&, voi
{
bool withFilterOptions = MM_DOCTYPE_TEXT == nDocType || MM_DOCTYPE_HTML == nDocType;
- uno::Sequence< beans::PropertyValue > aFilterValues(withFilterOptions ? 2 : 1);
+ bool withPasswordOptions = m_xPasswordCB->get_active();
+
+ sal_Int32 nTarget = xConfigItem->MoveResultSet(rInfo.nDBRow);
+ OSL_ENSURE( nTarget == rInfo.nDBRow, "row of current document could not be selected");
+ OUString sPassword = lcl_GetColumnValueOf(sPasswordColumn, xColAccess);
+
+ sal_Int32 nOptionCount = (withFilterOptions && withPasswordOptions) ? 4 : withPasswordOptions ? 3 : withFilterOptions ? 2 : 1;
+ sal_Int32 nOpt = 0;
+ uno::Sequence< beans::PropertyValue > aFilterValues(nOptionCount);
beans::PropertyValue* pFilterValues = aFilterValues.getArray();
- pFilterValues[0].Name = "FilterName";
- pFilterValues[0].Value <<= pSfxFlt->GetFilterName();
+
+ pFilterValues[nOpt].Name = "FilterName";
+ pFilterValues[nOpt].Value <<= pSfxFlt->GetFilterName();
+
if(withFilterOptions)
{
- pFilterValues[1].Name = "FilterOptions";
- pFilterValues[1].Value <<= sFilterOptions;
+ nOpt++;
+ pFilterValues[nOpt].Name = "FilterOptions";
+ pFilterValues[nOpt].Value <<= sFilterOptions;
+ }
+
+ if(withPasswordOptions)
+ {
+ nOpt++;
+ pFilterValues[nOpt].Name = "EncryptFile";
+ pFilterValues[nOpt].Value <<= true;
+ nOpt++;
+ pFilterValues[nOpt].Name = "DocumentOpenPassword";
+ pFilterValues[nOpt].Value <<= sPassword;
}
uno::Reference< frame::XStorable > xTempStore( pTempView->GetDocShell()->GetModel(), uno::UNO_QUERY);
diff --git a/sw/source/ui/inc/mmresultdialogs.hxx b/sw/source/ui/inc/mmresultdialogs.hxx
index 4db8e0e766f4..8c28383f7345 100644
--- a/sw/source/ui/inc/mmresultdialogs.hxx
+++ b/sw/source/ui/inc/mmresultdialogs.hxx
@@ -97,6 +97,9 @@ class SwMMResultEmailDialog : public SfxDialogController
std::unique_ptr<weld::Button> m_xSendAsPB;
std::unique_ptr<weld::Widget> m_xAttachmentGroup;
std::unique_ptr<weld::Entry> m_xAttachmentED;
+ std::unique_ptr<weld::Label> m_xPasswordFT;
+ std::unique_ptr<weld::ComboBox> m_xPasswordLB;
+ std::unique_ptr<weld::CheckButton> m_xPasswordCB;
std::unique_ptr<weld::RadioButton> m_xSendAllRB;
std::unique_ptr<weld::RadioButton> m_xFromRB;
std::unique_ptr<weld::SpinButton> m_xFromNF;
@@ -109,6 +112,7 @@ class SwMMResultEmailDialog : public SfxDialogController
DECL_LINK(SendAsHdl_Impl, weld::Button&, void);
DECL_LINK(SendDocumentsHdl_Impl, weld::Button&, void);
DECL_LINK(DocumentSelectionHdl_Impl, weld::ToggleButton&, void);
+ DECL_LINK(CheckHdl, weld::ToggleButton&, void );
void FillInEmailSettings();
diff --git a/sw/uiconfig/swriter/ui/mmresultemaildialog.ui b/sw/uiconfig/swriter/ui/mmresultemaildialog.ui
index c5a987ef8ae5..9100e291c256 100644
--- a/sw/uiconfig/swriter/ui/mmresultemaildialog.ui
+++ b/sw/uiconfig/swriter/ui/mmresultemaildialog.ui
@@ -222,6 +222,51 @@
</packing>
</child>
<child>
+ <object class="GtkLabel" id="passwordft">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="mmresultemaildialog|passwordft">Password</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">password</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="password">
+ <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">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="passwordcb">
+ <property name="label" translatable="yes" context="mmresultemaildialog|passwordcb" >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">3</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<placeholder/>
</child>
</object>