Resolves tdf#156337 - Keep warning label enabled on PDF security tab

Change-Id: Ifea77294825b987e4277e146cc34af120e38c8c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154712
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index a036d43..c7149b0 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -936,7 +936,7 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHa
    // set the security page status (and its controls as well)
    ImpPDFTabSecurityPage* pSecPage = mpParent ? mpParent->getSecurityPage() : nullptr;
    if (pSecPage)
        pSecPage->ImplPDFASecurityControl(!bIsPDFA);
        pSecPage->ImplPDFASecurityControl();

    mxCbTaggedPDF->set_sensitive(
        !bIsPDFA && !bIsPDFUA && !IsReadOnlyProperty("UseTaggedPDF"));
@@ -1315,6 +1315,7 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage(weld::Container* pPage, weld::Dialo
    , mxCbEnableCopy(m_xBuilder->weld_check_button("enablecopy"))
    , mxCbEnableAccessibility(m_xBuilder->weld_check_button("enablea11y"))
    , mxPasswordTitle(m_xBuilder->weld_label("setpasswordstitle"))
    , mxPermissionTitle(m_xBuilder->weld_label("label2"))
{
    msStrSetPwd = mxPasswordTitle->get_label();
    mxPbSetPwd->connect_clicked(LINK(this, ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl));
@@ -1411,7 +1412,7 @@ void ImpPDFTabSecurityPage::SetFilterConfigItem( const  ImpPDFTabDialog* pParent
    ImpPDFTabGeneralPage* pGeneralPage = pParent->getGeneralPage();

    if (pGeneralPage)
        ImplPDFASecurityControl(!pGeneralPage->IsPdfaSelected());
        ImplPDFASecurityControl();
}

IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl, weld::Button&, void)
@@ -1479,6 +1480,8 @@ void ImpPDFTabSecurityPage::enablePermissionControls()
    {
        mxCbEnableAccessibility->set_active(true);
    }
    mxPermissionTitle->set_sensitive(!bIsPDFASel);
    mxPbSetPwd->set_sensitive(!bIsPDFASel);
    mxCbEnableAccessibility->set_sensitive(!bIsPDFUASel);
    if (bIsPDFASel)
    {
@@ -1532,9 +1535,8 @@ void ImpPDFTabSecurityPage::enablePermissionControls()

// This tab page is under control of the PDF/A-1a checkbox:
// TODO: implement a method to do it.
void ImpPDFTabSecurityPage::ImplPDFASecurityControl( bool bEnableSecurity )
void ImpPDFTabSecurityPage::ImplPDFASecurityControl()
{
    m_xContainer->set_sensitive(bEnableSecurity);
    // after enable, check the status of control as if the dialog was initialized
    enablePermissionControls();
}
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 7a8985e..8cbfc0a 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -355,6 +355,7 @@ class ImpPDFTabSecurityPage : public SfxTabPage
    std::unique_ptr<weld::CheckButton> mxCbEnableCopy;
    std::unique_ptr<weld::CheckButton> mxCbEnableAccessibility;
    std::unique_ptr<weld::Label> mxPasswordTitle;
    std::unique_ptr<weld::Label> mxPermissionTitle;

    std::shared_ptr< SfxPasswordDialog > mpPasswordDialog;
    std::shared_ptr< weld::MessageDialog > mpUnsupportedMsgDialog;
@@ -371,7 +372,7 @@ public:

    void                        GetFilterConfigItem( ImpPDFTabDialog* paParent);
    void                        SetFilterConfigItem( const ImpPDFTabDialog* paParent );
    void                        ImplPDFASecurityControl( bool bEnableSecurity );
    void                        ImplPDFASecurityControl();
    bool                        hasPassword() const { return mbHaveOwnerPassword || mbHaveUserPassword; }
};