diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-18 11:40:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-18 14:27:11 +0200 |
commit | ba161dd0c1117915977fb2a8d6ea6adb37026a19 (patch) | |
tree | d33504eb27e25ff960fb6a1c4b774a205561b6c8 /filter | |
parent | do not make calc's threading depend on opencl (diff) | |
download | core-ba161dd0c1117915977fb2a8d6ea6adb37026a19.tar.gz core-ba161dd0c1117915977fb2a8d6ea6adb37026a19.zip |
weld ImpPDFTabSecurityPage
Change-Id: I71c3c49682483801d79aa53de76c83973084aa54
Reviewed-on: https://gerrit.libreoffice.org/56019
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/pdf/impdialog.cxx | 175 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hxx | 57 | ||||
-rw-r--r-- | filter/uiconfig/ui/pdfsecuritypage.ui | 34 |
3 files changed, 109 insertions, 157 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 658f34b4ebb3..284cada63e2c 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -1172,83 +1172,47 @@ void ImpPDFTabViewerPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent /// The Security preferences tab page -ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(vcl::Window* i_pParent, const SfxItemSet& i_rCoreSet) - : SfxTabPage(i_pParent, "PdfSecurityPage","filter/ui/pdfsecuritypage.ui", &i_rCoreSet) +ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(TabPageParent i_pParent, const SfxItemSet& i_rCoreSet) + : SfxTabPage(i_pParent, "filter/ui/pdfsecuritypage.ui", "PdfSecurityPage", &i_rCoreSet) , msUserPwdTitle( PDFFilterResId( STR_PDF_EXPORT_UDPWD ) ) , mbHaveOwnerPassword( false ) , mbHaveUserPassword( false ) , msOwnerPwdTitle( PDFFilterResId( STR_PDF_EXPORT_ODPWD ) ) -{ - get(mpPbSetPwd, "setpassword"); - msStrSetPwd = get<vcl::Window>("setpasswordstitle")->GetText(); - - get(mpUserPwdSet, "userpwdset"); - get(mpUserPwdUnset, "userpwdunset"); - get(mpUserPwdPdfa, "userpwdpdfa"); - - get(mpOwnerPwdSet, "ownerpwdset"); - get(mpOwnerPwdUnset, "ownerpwdunset"); - get(mpOwnerPwdPdfa, "ownerpwdpdfa"); - - get(mpPrintPermissions, "printing"); - get(mpRbPrintNone, "printnone"); - get(mpRbPrintLowRes, "printlow"); - get(mpRbPrintHighRes, "printhigh"); - - get(mpChangesAllowed, "changes"); - get(mpRbChangesNone, "changenone"); - get(mpRbChangesInsDel, "changeinsdel"); - get(mpRbChangesFillForm, "changeform"); - get(mpRbChangesComment, "changecomment"); - get(mpRbChangesAnyNoCopy, "changeany"); - - get(mpContent, "content"); - get(mpCbEnableCopy, "enablecopy"); - get(mpCbEnableAccessibility, "enablea11y"); - - mpPbSetPwd->SetClickHdl( LINK( this, ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl ) ); + , mxPbSetPwd(m_xBuilder->weld_button("setpassword")) + , mxUserPwdSet(m_xBuilder->weld_widget("userpwdset")) + , mxUserPwdUnset(m_xBuilder->weld_widget("userpwdunset")) + , mxUserPwdPdfa(m_xBuilder->weld_widget("userpwdpdfa")) + , mxOwnerPwdSet(m_xBuilder->weld_widget("ownerpwdset")) + , mxOwnerPwdUnset(m_xBuilder->weld_widget("ownerpwdunset")) + , mxOwnerPwdPdfa(m_xBuilder->weld_widget("ownerpwdpdfa")) + , mxPrintPermissions(m_xBuilder->weld_widget("printing")) + , mxRbPrintNone(m_xBuilder->weld_radio_button("printnone")) + , mxRbPrintLowRes(m_xBuilder->weld_radio_button("printlow")) + , mxRbPrintHighRes(m_xBuilder->weld_radio_button("printhigh")) + , mxChangesAllowed(m_xBuilder->weld_widget("changes")) + , mxRbChangesNone(m_xBuilder->weld_radio_button("changenone")) + , mxRbChangesInsDel(m_xBuilder->weld_radio_button("changeinsdel")) + , mxRbChangesFillForm(m_xBuilder->weld_radio_button("changeform")) + , mxRbChangesComment(m_xBuilder->weld_radio_button("changecomment")) + , mxRbChangesAnyNoCopy(m_xBuilder->weld_radio_button("changeany")) + , mxContent(m_xBuilder->weld_widget("content")) + , mxCbEnableCopy(m_xBuilder->weld_check_button("enablecopy")) + , mxCbEnableAccessibility(m_xBuilder->weld_check_button("enablea11y")) + , mxPasswordTitle(m_xBuilder->weld_label("setpasswordstitle")) +{ + msStrSetPwd = mxPasswordTitle->get_label(); + mxPbSetPwd->connect_clicked(LINK(this, ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl)); } - ImpPDFTabSecurityPage::~ImpPDFTabSecurityPage() { - disposeOnce(); } - -void ImpPDFTabSecurityPage::dispose() -{ - mpPbSetPwd.clear(); - mpUserPwdSet.clear(); - mpUserPwdUnset.clear(); - mpUserPwdPdfa.clear(); - mpOwnerPwdSet.clear(); - mpOwnerPwdUnset.clear(); - mpOwnerPwdPdfa.clear(); - mpPrintPermissions.clear(); - mpRbPrintNone.clear(); - mpRbPrintLowRes.clear(); - mpRbPrintHighRes.clear(); - mpChangesAllowed.clear(); - mpRbChangesNone.clear(); - mpRbChangesInsDel.clear(); - mpRbChangesFillForm.clear(); - mpRbChangesComment.clear(); - mpRbChangesAnyNoCopy.clear(); - mpContent.clear(); - mpCbEnableCopy.clear(); - mpCbEnableAccessibility.clear(); - SfxTabPage::dispose(); -} - - -VclPtr<SfxTabPage> ImpPDFTabSecurityPage::Create( TabPageParent pParent, - const SfxItemSet* rAttrSet) +VclPtr<SfxTabPage> ImpPDFTabSecurityPage::Create(TabPageParent pParent, const SfxItemSet* rAttrSet) { - return VclPtr<ImpPDFTabSecurityPage>::Create( pParent.pParent, *rAttrSet ); + return VclPtr<ImpPDFTabSecurityPage>::Create(pParent, *rAttrSet); } - void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) { // please note that in PDF/A-1a mode even if this are copied back, @@ -1261,41 +1225,40 @@ void ImpPDFTabSecurityPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) // verify print status paParent->mnPrint = 0; - if( mpRbPrintLowRes->IsChecked() ) + if (mxRbPrintLowRes->get_active()) paParent->mnPrint = 1; - else if( mpRbPrintHighRes->IsChecked() ) + else if (mxRbPrintHighRes->get_active()) paParent->mnPrint = 2; // verify changes permitted paParent->mnChangesAllowed = 0; - if( mpRbChangesInsDel->IsChecked() ) + if( mxRbChangesInsDel->get_active() ) paParent->mnChangesAllowed = 1; - else if( mpRbChangesFillForm->IsChecked() ) + else if( mxRbChangesFillForm->get_active() ) paParent->mnChangesAllowed = 2; - else if( mpRbChangesComment->IsChecked() ) + else if( mxRbChangesComment->get_active() ) paParent->mnChangesAllowed = 3; - else if( mpRbChangesAnyNoCopy->IsChecked() ) + else if( mxRbChangesAnyNoCopy->get_active() ) paParent->mnChangesAllowed = 4; - paParent->mbCanCopyOrExtract = mpCbEnableCopy->IsChecked(); - paParent->mbCanExtractForAccessibility = mpCbEnableAccessibility->IsChecked(); + paParent->mbCanCopyOrExtract = mxCbEnableCopy->get_active(); + paParent->mbCanExtractForAccessibility = mxCbEnableAccessibility->get_active(); } - void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ) { switch( paParent->mnPrint ) { default: case 0: - mpRbPrintNone->Check(); + mxRbPrintNone->set_active(true); break; case 1: - mpRbPrintLowRes->Check(); + mxRbPrintLowRes->set_active(true); break; case 2: - mpRbPrintHighRes->Check(); + mxRbPrintHighRes->set_active(true); break; } @@ -1303,24 +1266,24 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParen { default: case 0: - mpRbChangesNone->Check(); + mxRbChangesNone->set_active(true); break; case 1: - mpRbChangesInsDel->Check(); + mxRbChangesInsDel->set_active(true); break; case 2: - mpRbChangesFillForm->Check(); + mxRbChangesFillForm->set_active(true); break; case 3: - mpRbChangesComment->Check(); + mxRbChangesComment->set_active(true); break; case 4: - mpRbChangesAnyNoCopy->Check(); + mxRbChangesAnyNoCopy->set_active(true); break; } - mpCbEnableCopy->Check( paParent->mbCanCopyOrExtract ); - mpCbEnableAccessibility->Check( paParent->mbCanExtractForAccessibility ); + mxCbEnableCopy->set_active(paParent->mbCanCopyOrExtract); + mxCbEnableAccessibility->set_active(paParent->mbCanExtractForAccessibility); // set the status of this windows, according to the PDFA selection enablePermissionControls(); @@ -1331,8 +1294,7 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const ImpPDFTabDialog* paParen ImplPDFASecurityControl(!pGeneralPage->IsPdfaSelected()); } - -IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, Button*, void) +IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, weld::Button&, void) { SfxPasswordDialog aPwdDialog(GetFrameWeld(), &msUserPwdTitle); aPwdDialog.SetMinLen(0); @@ -1372,55 +1334,54 @@ void ImpPDFTabSecurityPage::enablePermissionControls() } if (bIsPDFASel) { - mpUserPwdPdfa->Show(); - mpUserPwdSet->Hide(); - mpUserPwdUnset->Hide(); + mxUserPwdPdfa->show(); + mxUserPwdSet->hide(); + mxUserPwdUnset->hide(); } else { if (mbHaveUserPassword && IsEnabled()) { - mpUserPwdSet->Show(); - mpUserPwdUnset->Hide(); - mpUserPwdPdfa->Hide(); + mxUserPwdSet->show(); + mxUserPwdUnset->hide(); + mxUserPwdPdfa->hide(); } else { - mpUserPwdUnset->Show(); - mpUserPwdSet->Hide(); - mpUserPwdPdfa->Hide(); + mxUserPwdUnset->show(); + mxUserPwdSet->hide(); + mxUserPwdPdfa->hide(); } } bool bLocalEnable = mbHaveOwnerPassword && IsEnabled(); if (bIsPDFASel) { - mpOwnerPwdPdfa->Show(); - mpOwnerPwdSet->Hide(); - mpOwnerPwdUnset->Hide(); + mxOwnerPwdPdfa->show(); + mxOwnerPwdSet->hide(); + mxOwnerPwdUnset->hide(); } else { if (bLocalEnable) { - mpOwnerPwdSet->Show(); - mpOwnerPwdUnset->Hide(); - mpOwnerPwdPdfa->Hide(); + mxOwnerPwdSet->show(); + mxOwnerPwdUnset->hide(); + mxOwnerPwdPdfa->hide(); } else { - mpOwnerPwdUnset->Show(); - mpOwnerPwdSet->Hide(); - mpOwnerPwdPdfa->Hide(); + mxOwnerPwdUnset->show(); + mxOwnerPwdSet->hide(); + mxOwnerPwdPdfa->hide(); } } - mpPrintPermissions->Enable(bLocalEnable); - mpChangesAllowed->Enable(bLocalEnable); - mpContent->Enable(bLocalEnable); + mxPrintPermissions->set_sensitive(bLocalEnable); + mxChangesAllowed->set_sensitive(bLocalEnable); + mxContent->set_sensitive(bLocalEnable); } - // This tab page is under control of the PDF/A-1a checkbox: // TODO: implement a method to do it. void ImpPDFTabSecurityPage::ImplPDFASecurityControl( bool bEnableSecurity ) diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index bb9e1582e6dd..3d8ffce28ad6 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -329,35 +329,8 @@ public: /// Class security tab page class ImpPDFTabSecurityPage : public SfxTabPage { - VclPtr<PushButton> mpPbSetPwd; OUString msStrSetPwd; - - VclPtr<VclContainer> mpUserPwdSet; - VclPtr<VclContainer> mpUserPwdUnset; - VclPtr<VclContainer> mpUserPwdPdfa; - - VclPtr<VclContainer> mpOwnerPwdSet; - VclPtr<VclContainer> mpOwnerPwdUnset; - VclPtr<VclContainer> mpOwnerPwdPdfa; - - VclPtr<VclContainer> mpPrintPermissions; - VclPtr<RadioButton> mpRbPrintNone; - VclPtr<RadioButton> mpRbPrintLowRes; - VclPtr<RadioButton> mpRbPrintHighRes; - - VclPtr<VclContainer> mpChangesAllowed; - VclPtr<RadioButton> mpRbChangesNone; - VclPtr<RadioButton> mpRbChangesInsDel; - VclPtr<RadioButton> mpRbChangesFillForm; - VclPtr<RadioButton> mpRbChangesComment; - VclPtr<RadioButton> mpRbChangesAnyNoCopy; - - VclPtr<VclContainer> mpContent; - VclPtr<CheckBox> mpCbEnableCopy; - VclPtr<CheckBox> mpCbEnableAccessibility; - OUString msUserPwdTitle; - bool mbHaveOwnerPassword; bool mbHaveUserPassword; css::uno::Sequence< css::beans::NamedValue > maPreparedOwnerPassword; @@ -365,16 +338,37 @@ class ImpPDFTabSecurityPage : public SfxTabPage css::uno::Reference< css::beans::XMaterialHolder > mxPreparedPasswords; - DECL_LINK( ClickmaPbSetPwdHdl, Button*, void ); + std::unique_ptr<weld::Button> mxPbSetPwd; + std::unique_ptr<weld::Widget> mxUserPwdSet; + std::unique_ptr<weld::Widget> mxUserPwdUnset; + std::unique_ptr<weld::Widget> mxUserPwdPdfa; + std::unique_ptr<weld::Widget> mxOwnerPwdSet; + std::unique_ptr<weld::Widget> mxOwnerPwdUnset; + std::unique_ptr<weld::Widget> mxOwnerPwdPdfa; + std::unique_ptr<weld::Widget> mxPrintPermissions; + std::unique_ptr<weld::RadioButton> mxRbPrintNone; + std::unique_ptr<weld::RadioButton> mxRbPrintLowRes; + std::unique_ptr<weld::RadioButton> mxRbPrintHighRes; + std::unique_ptr<weld::Widget> mxChangesAllowed; + std::unique_ptr<weld::RadioButton> mxRbChangesNone; + std::unique_ptr<weld::RadioButton> mxRbChangesInsDel; + std::unique_ptr<weld::RadioButton> mxRbChangesFillForm; + std::unique_ptr<weld::RadioButton> mxRbChangesComment; + std::unique_ptr<weld::RadioButton> mxRbChangesAnyNoCopy; + std::unique_ptr<weld::Widget> mxContent; + std::unique_ptr<weld::CheckButton> mxCbEnableCopy; + std::unique_ptr<weld::CheckButton> mxCbEnableAccessibility; + std::unique_ptr<weld::Label> mxPasswordTitle; + + DECL_LINK(ClickmaPbSetPwdHdl, weld::Button&, void); void enablePermissionControls(); public: - ImpPDFTabSecurityPage( vcl::Window* pParent, const SfxItemSet& rSet ); + ImpPDFTabSecurityPage(TabPageParent pParent, const SfxItemSet& rSet); virtual ~ImpPDFTabSecurityPage() override; - virtual void dispose() override; - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rAttrSet ); + static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rAttrSet); void GetFilterConfigItem( ImpPDFTabDialog* paParent); void SetFilterConfigItem( const ImpPDFTabDialog* paParent ); @@ -382,7 +376,6 @@ public: bool hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; } }; - /// Implements the relative link stuff class ImpPDFTabLinksPage : public SfxTabPage { diff --git a/filter/uiconfig/ui/pdfsecuritypage.ui b/filter/uiconfig/ui/pdfsecuritypage.ui index ebf4cab10d37..898c7214104a 100644 --- a/filter/uiconfig/ui/pdfsecuritypage.ui +++ b/filter/uiconfig/ui/pdfsecuritypage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="flt"> <requires lib="gtk+" version="3.18"/> <object class="GtkBox" id="PdfSecurityPage"> @@ -49,8 +49,8 @@ <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label5">Open password set</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -61,8 +61,8 @@ <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label6">PDF document will be encrypted</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -84,8 +84,8 @@ <object class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label7">No open password set</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -96,8 +96,8 @@ <object class="GtkLabel" id="label8"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label8">PDF document will not be encrypted</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -119,9 +119,9 @@ <object class="GtkLabel" id="label30"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label30">PDF document will not be encrypted due to PDF/A export.</property> <property name="wrap">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -143,8 +143,8 @@ <object class="GtkLabel" id="label9"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label9">Permission password set</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -155,8 +155,8 @@ <object class="GtkLabel" id="label11"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label11">PDF document will be restricted</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -178,8 +178,8 @@ <object class="GtkLabel" id="label12"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label12">No permission password set</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -190,8 +190,8 @@ <object class="GtkLabel" id="label13"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label13">PDF document will be unrestricted</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -213,9 +213,9 @@ <object class="GtkLabel" id="label14"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|label14">PDF document will not be restricted due to PDF/A export.</property> <property name="wrap">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -233,8 +233,8 @@ <object class="GtkLabel" id="setpasswordstitle"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pdfsecuritypage|setpasswordstitle">Set Passwords</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -295,7 +295,6 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">printlow</property> </object> <packing> <property name="left_attach">0</property> @@ -311,7 +310,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">printhigh</property> + <property name="group">printnone</property> </object> <packing> <property name="left_attach">0</property> @@ -382,7 +381,6 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">changeinsdel</property> </object> <packing> <property name="left_attach">0</property> @@ -398,7 +396,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">changeform</property> + <property name="group">changenone</property> </object> <packing> <property name="left_attach">0</property> @@ -414,7 +412,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">changecomment</property> + <property name="group">changenone</property> </object> <packing> <property name="left_attach">0</property> @@ -430,7 +428,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">changeany</property> + <property name="group">changenone</property> </object> <packing> <property name="left_attach">0</property> |