diff options
-rw-r--r-- | filter/source/pdf/impdialog.cxx | 42 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 3 |
3 files changed, 36 insertions, 10 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 03250388c5d6..fa1d634d6192 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -535,6 +535,13 @@ bool ImpPDFTabGeneralPage::IsPdfaSelected() const aVersion == u"4"_ustr; } +bool ImpPDFTabGeneralPage::IsPDFAVersionSelected(sal_Int32 nInputVersion) const +{ + OUString aVersion = mxRbPDFVersion->get_active_id(); + sal_Int32 nSelectedVersion = aVersion.toInt32(); + return nSelectedVersion == nInputVersion; +} + void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent) { mpParent = pParent; @@ -626,6 +633,12 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent) mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDFUserSelection; mxCbExportBookmarks->set_active(pParent->mbExportBookmarksUserSelection); + + mxCbAddStream->show(); + mxCbAddStream->set_active(pParent->mbAddStream); + mxCbAddStream->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleAddStreamHdl)); + ToggleAddStreamHdl(*mxCbAddStream); // init addstream dependencies + thePDFVersionChanged(); mxCbExportFormFields->set_active(pParent->mbExportFormFields); @@ -718,13 +731,6 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent) mxCbExportPlaceholders->set_active(pParent->mbIsExportPlaceholders); mxCbExportPlaceholders->set_sensitive( mbIsWriter && !pParent->maConfigItem.IsReadOnly(u"ExportPlaceholders"_ustr)); - - mxCbAddStream->show(); - mxCbAddStream->set_active(pParent->mbAddStream); - mxCbAddStream->set_sensitive(!pParent->maConfigItem.IsReadOnly(u"IsAddStream"_ustr)); - - mxCbAddStream->connect_toggled(LINK(this, ImpPDFTabGeneralPage, ToggleAddStreamHdl)); - ToggleAddStreamHdl(*mxCbAddStream); // init addstream dependencies } void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent ) @@ -940,9 +946,6 @@ void ImpPDFTabGeneralPage::thePDFVersionChanged() if (pSecPage) pSecPage->ImplPDFASecurityControl(); - mxCbTaggedPDF->set_sensitive( - !bIsPDFA && !bIsPDFUA && !IsReadOnlyProperty(u"UseTaggedPDF"_ustr)); - mxRbPDFVersion->set_sensitive(!IsReadOnlyProperty(u"SelectPdfVersion"_ustr)); if (bIsPDFA || bIsPDFUA) @@ -950,6 +953,7 @@ void ImpPDFTabGeneralPage::thePDFVersionChanged() // store the users selection of subordinate controls and set required PDF/A values mbUseTaggedPDFUserSelection = mxCbTaggedPDF->get_active(); mxCbTaggedPDF->set_active(true); + mxCbTaggedPDF->set_sensitive(false); // if a password was set, inform the user that this will not be used if (bIsPDFA && pSecPage && pSecPage->hasPassword()) @@ -965,6 +969,24 @@ void ImpPDFTabGeneralPage::thePDFVersionChanged() { // restore the users values of subordinate controls mxCbTaggedPDF->set_active(mbUseTaggedPDFUserSelection); + mxCbTaggedPDF->set_sensitive(!IsReadOnlyProperty(u"UseTaggedPDF"_ustr)); + } + + if (IsPDFAVersionSelected(1) || IsPDFAVersionSelected(2)) + { + if (mxCbAddStream->get_sensitive()) + { + if (mpParent) + mpParent->mbAddStream = mxCbAddStream->get_active(); + + mxCbAddStream->set_active(false); + mxCbAddStream->set_sensitive(false); + } + } + else if (mpParent && !mxCbAddStream->get_sensitive()) + { + mxCbAddStream->set_active(mpParent->mbAddStream); + mxCbAddStream->set_sensitive(!mpParent->maConfigItem.IsReadOnly(u"IsAddStream"_ustr)); } if (bIsPDFUA) diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index 1b697b257ece..fba49c8f0301 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -259,6 +259,7 @@ public: void GetFilterConfigItem(ImpPDFTabDialog* paParent); void SetFilterConfigItem(ImpPDFTabDialog* paParent); bool IsPdfaSelected() const; + bool IsPDFAVersionSelected(sal_Int32 nVersion) const; bool IsPdfUaSelected() const { return mxCbPDFUA->get_active(); } }; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 387edb5e2594..6816fca77bd5 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -3510,6 +3510,9 @@ bool PDFWriterImpl::appendDest( sal_Int32 nDestID, OStringBuffer& rBuffer ) void PDFWriterImpl::addDocumentAttachedFile(OUString const& rFileName, OUString const& rMimeType, OUString const& rDescription, std::unique_ptr<PDFOutputStream> rStream) { + if (m_nPDFA_Version == 1 || m_nPDFA_Version == 2) + return; + sal_Int32 nObjectID = addEmbeddedFile(std::move(rStream), rMimeType); auto& rAttachedFile = m_aDocumentAttachedFiles.emplace_back(); rAttachedFile.maFilename = rFileName; |