filter/source/pdf/impdialog.cxx | 110 ++++++++++++++++++++------------------ filter/source/pdf/impdialog.hxx | 4 + filter/source/pdf/pdfexport.cxx | 1 sw/source/core/bastyp/swcache.cxx | 2 4 files changed, 65 insertions(+), 52 deletions(-)
New commits: commit f94a50f0556bc0c6e18ad390af589b9521ceb28c Author: Jan-Marek Glogowski <jan-marek.glogow...@extern.cib.de> AuthorDate: Wed Aug 7 10:18:06 2019 +0000 Commit: Jan-Marek Glogowski <jan-marek.glogow...@extern.cib.de> CommitDate: Wed Aug 7 10:33:39 2019 +0000 Explicitly disable form export for PDF/A-2 Give BRZ some time to actually adapt their scripts. They'll have to set ExportFormFields for LO >= 6.3 in any way, as general from export was enabled by commit c864d894a901 ("tdf#126642 always allow PDF/A form export"), which will be backported for 6.3 too to have a consistent state. Change-Id: I16b476a4b51b654161efe5f6f92420f76db1e294 diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 387e2307ae9a..d17fffc7a120 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -575,6 +575,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& case 2: aContext.Version = vcl::PDFWriter::PDFVersion::PDF_A_2; mbUseTaggedPDF = true; // force the tagged PDF as well + mbExportFormFields = false; // force disabling of form conversion mbRemoveTransparencies = false; // PDF/A-2 does allow transparencies mbEncrypt = false; // no encryption xEnc.clear(); commit 599447d56e3b2625f5e6d843b77b41ffd4b4f1f2 Author: Jan-Marek Glogowski <jan-marek.glogow...@extern.cib.de> AuthorDate: Thu Aug 1 14:10:05 2019 +0000 Commit: Jan-Marek Glogowski <jan-marek.glogow...@extern.cib.de> CommitDate: Wed Aug 7 10:33:39 2019 +0000 tdf#126642 correctly handle the PDF/A settings This is in the spirit of the master fix. But instead of enabling broken PDF/A form handling, which would eventually require many more fixes, this correctly handles the user setting and disables the form export for PDF/A. The code therefore is almost the same, minus the radio button PDF/A type handling plus disabling the form frame. This includes some adaptions, as the customer branch just contains the first commit from tdf#62728. Reviewed-on: https://gerrit.libreoffice.org/76820 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> (cherry picked from commit aac306e7ea42eeac3d6c1860f25061148ba2f547) Change-Id: I31f96a36d776468a5547042fb9e4c0605751fbba diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 372505851e33..e55e9f10c33a 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -70,6 +70,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue mbReduceImageResolution( false ), mnMaxImageResolution( 300 ), mbUseTaggedPDF( false ), + mbUseTaggedPDFUserSelection( false ), mbExportNotes( true ), mbViewPDF( false ), mbUseReferenceXObject( false ), @@ -81,6 +82,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue mbAddStream( false ), mnFormsType( 0 ), mbExportFormFields( true ), + mbExportFormFieldsUserSelection( true ), mbAllowDuplicateFieldNames( false ), mbExportBookmarks( true ), mbExportHiddenSlides ( false), @@ -181,7 +183,10 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue mbReduceImageResolution = maConfigItem.ReadBool( "ReduceImageResolution", false ); mnMaxImageResolution = maConfigItem.ReadInt32( "MaxImageResolution", 300 ); + // this is always the user selection, independent from the PDF/A forced selection mbUseTaggedPDF = maConfigItem.ReadBool( "UseTaggedPDF", false ); + mbUseTaggedPDFUserSelection = mbUseTaggedPDF; + mnPDFTypeSelection = maConfigItem.ReadInt32( "SelectPdfVersion", 0 ); if ( mbIsPresentation ) { @@ -200,8 +205,11 @@ ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue mbIsExportPlaceholders = maConfigItem.ReadBool( "ExportPlaceholders", false ); mbAddStream = maConfigItem.ReadBool( "IsAddStream", false ); - mnFormsType = maConfigItem.ReadInt32( "FormsType", 0 ); + // this is always the user selection, independent from the PDF/A forced selection mbExportFormFields = maConfigItem.ReadBool( "ExportFormFields", true ); + mbExportFormFieldsUserSelection = mbExportFormFields; + + mnFormsType = maConfigItem.ReadInt32( "FormsType", 0 ); if ( ( mnFormsType < 0 ) || ( mnFormsType > 3 ) ) mnFormsType = 0; mbAllowDuplicateFieldNames = maConfigItem.ReadBool( "AllowDuplicateFieldNames", false ); @@ -365,7 +373,9 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() maConfigItem.WriteBool( "ReduceImageResolution", mbReduceImageResolution ); maConfigItem.WriteInt32("MaxImageResolution", mnMaxImageResolution ); - maConfigItem.WriteBool( "UseTaggedPDF", mbUseTaggedPDF ); + // always write the user selection, never the overridden PDF/A value + const bool bIsPDFA = (1 == mnPDFTypeSelection) || (2 == mnPDFTypeSelection); + maConfigItem.WriteBool("UseTaggedPDF", bIsPDFA ? mbUseTaggedPDFUserSelection : mbUseTaggedPDF); maConfigItem.WriteInt32("SelectPdfVersion", mnPDFTypeSelection ); if ( mbIsPresentation ) @@ -389,7 +399,8 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() * ever be an additional form submit format this could get invalid. */ maConfigItem.WriteInt32( "FormsType", mnFormsType ); - maConfigItem.WriteBool( "ExportFormFields", mbExportFormFields ); + // always write the user selection, never the overridden PDF/A value + maConfigItem.WriteBool("ExportFormFields", bIsPDFA ? mbExportFormFieldsUserSelection : mbExportFormFields); maConfigItem.WriteBool( "AllowDuplicateFieldNames", mbAllowDuplicateFieldNames ); maConfigItem.WriteBool( "HideViewerToolbar", mbHideViewerToolbar ); @@ -445,7 +456,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(TabPageParent pParent, const SfxItemSet& rCoreSet) : SfxTabPage(pParent, "filter/ui/pdfgeneralpage.ui", "PdfGeneralPage", &rCoreSet) - , mbTaggedPDFUserSelection(false) + , mbUseTaggedPDFUserSelection(false) , mbExportFormFieldsUserSelection(false) , mbIsPresentation(false) , mbIsSpreadsheet(false) @@ -539,24 +550,25 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent) case 2: mxCbPDFA2b->set_active(true); // PDF/A-2a break; } - ToggleExportPDFAHdl( *mxCbPDFA2b ); - - mxCbExportFormFields->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) ); - - // get the form values, for use with PDF/A-1 selection interface - mbTaggedPDFUserSelection = pParent->mbUseTaggedPDF; - mbExportFormFieldsUserSelection = pParent->mbExportFormFields; - if( !mxCbPDFA2b->get_active() ) + // the ToggleExportPDFAHdl handler will read or write the *UserSelection variables based + // on the mxCbPDFA2b state, so we have to prepare the correct input state. + if (mxCbPDFA2b->get_active()) { - // the value for PDF/A set by the ToggleExportPDFAHdl method called before - mxCbTaggedPDF->set_active( mbTaggedPDFUserSelection ); - mxCbExportFormFields->set_active( mbExportFormFieldsUserSelection ); + mxCbTaggedPDF->set_active(pParent->mbUseTaggedPDFUserSelection); + mxCbExportFormFields->set_active(pParent->mbExportFormFieldsUserSelection); } + else + { + mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDFUserSelection; + mbExportFormFieldsUserSelection = pParent->mbExportFormFieldsUserSelection; + } + ToggleExportPDFAHdl( *mxCbPDFA2b ); + + mxCbExportFormFields->connect_toggled( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) ); mxLbFormsFormat->set_active(static_cast<sal_uInt16>(pParent->mnFormsType)); mxCbAllowDuplicateFieldNames->set_active( pParent->mbAllowDuplicateFieldNames ); - mxFormsFrame->set_sensitive( pParent->mbExportFormFields ); mxCbExportBookmarks->set_active( pParent->mbExportBookmarks ); @@ -643,17 +655,18 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent ) } pParent->mnPDFTypeSelection = 0; + pParent->mbUseTaggedPDF = mxCbTaggedPDF->get_active(); + pParent->mbExportFormFields = mxCbExportFormFields->get_active(); + if( mxCbPDFA2b->get_active() ) - { pParent->mnPDFTypeSelection = 2; - pParent->mbUseTaggedPDF = mbTaggedPDFUserSelection; - pParent->mbExportFormFields = mbExportFormFieldsUserSelection; - } else { - pParent->mbUseTaggedPDF = mxCbTaggedPDF->get_active(); - pParent->mbExportFormFields = mxCbExportFormFields->get_active(); + mbUseTaggedPDFUserSelection = pParent->mbUseTaggedPDF; + mbExportFormFieldsUserSelection = pParent->mbExportFormFields; } + pParent->mbUseTaggedPDFUserSelection = mbUseTaggedPDFUserSelection; + pParent->mbExportFormFieldsUserSelection = mbExportFormFieldsUserSelection; if( mxCbWatermark->get_active() ) pParent->maWatermarkText = mxEdWatermark->get_text(); @@ -755,49 +768,46 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleAddStreamHdl, weld::ToggleButton&, v IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl, weld::ToggleButton&, void) { + const bool bIsPDFA = mxCbPDFA2b->get_active(); + // set the security page status (and its controls as well) ImpPDFTabSecurityPage* pSecPage = mpParent ? mpParent->getSecurityPage() : nullptr; if (pSecPage) - { - pSecPage->ImplPDFASecurityControl(!mxCbPDFA2b->get_active()); - } + pSecPage->ImplPDFASecurityControl(!bIsPDFA); + + mxCbTaggedPDF->set_sensitive(!bIsPDFA); + mxCbExportFormFields->set_sensitive(!bIsPDFA); + mxFormsFrame->set_sensitive(!bIsPDFA); - // PDF/A-1 needs tagged PDF, so force disable the control, will be forced in pdfexport. - bool bPDFA1Sel = mxCbPDFA2b->get_active(); - mxFormsFrame->set_sensitive(bPDFA1Sel); - if(bPDFA1Sel) + if (bIsPDFA) { - // store the values of subordinate controls - mbTaggedPDFUserSelection = mxCbTaggedPDF->get_active(); - mxCbTaggedPDF->set_active(true); - mxCbTaggedPDF->set_sensitive(false); + // store the users selection of subordinate controls and set required PDF/A values + mbUseTaggedPDFUserSelection = mxCbTaggedPDF->get_active(); mbExportFormFieldsUserSelection = mxCbExportFormFields->get_active(); + + mxCbTaggedPDF->set_active(true); mxCbExportFormFields->set_active(false); - mxCbExportFormFields->set_sensitive(false); + + // if a password was set, inform the user that this will not be used + if (pSecPage && pSecPage->hasPassword()) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xContainer.get(), + VclMessageType::Warning, VclButtonsType::Ok, + PDFFilterResId(STR_WARN_PASSWORD_PDFA))); + xBox->run(); + } } else { - // retrieve the values of subordinate controls - mxCbTaggedPDF->set_sensitive(true); - mxCbTaggedPDF->set_active(mbTaggedPDFUserSelection); + // restore the users values of subordinate controls + mxCbTaggedPDF->set_active(mbUseTaggedPDFUserSelection); mxCbExportFormFields->set_active(mbExportFormFieldsUserSelection); - mxCbExportFormFields->set_sensitive(true); } - // PDF/A-2 doesn't allow launch action, so enable/disable the selection on - // Link page + // PDF/A doesn't allow launch action, so enable/disable the selection on Link page ImpPDFTabLinksPage* pLinksPage = mpParent ? mpParent->getLinksPage() : nullptr; if (pLinksPage) - pLinksPage->ImplPDFALinkControl(!mxCbPDFA2b->get_active()); - - // if a password was set, inform the user that this will not be used in PDF/A case - if( mxCbPDFA2b->get_active() && pSecPage && pSecPage->hasPassword() ) - { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xContainer.get(), - VclMessageType::Warning, VclButtonsType::Ok, - PDFFilterResId(STR_WARN_PASSWORD_PDFA))); - xBox->run(); - } + pLinksPage->ImplPDFALinkControl(!bIsPDFA); } /// The option features tab page diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index 6381c554bc47..c9d205a4a063 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -81,6 +81,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController bool mbReduceImageResolution; sal_Int32 mnMaxImageResolution; bool mbUseTaggedPDF; + bool mbUseTaggedPDFUserSelection; sal_Int32 mnPDFTypeSelection; bool mbExportNotes; bool mbViewPDF; @@ -93,6 +94,7 @@ class ImpPDFTabDialog final : public SfxTabDialogController bool mbAddStream; sal_Int32 mnFormsType; bool mbExportFormFields; + bool mbExportFormFieldsUserSelection; bool mbAllowDuplicateFieldNames; bool mbExportBookmarks; bool mbExportHiddenSlides; @@ -172,7 +174,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage { friend class ImpPDFTabLinksPage; - bool mbTaggedPDFUserSelection; + bool mbUseTaggedPDFUserSelection; bool mbExportFormFieldsUserSelection; bool mbIsPresentation; bool mbIsSpreadsheet; commit dc9bd8f552cc2960784ee9d2d0edf20810ed2a8c Author: Jan-Marek Glogowski <jan-marek.glogow...@extern.cib.de> AuthorDate: Fri Aug 2 14:22:10 2019 +0000 Commit: Jan-Marek Glogowski <jan-marek.glogow...@extern.cib.de> CommitDate: Wed Aug 7 12:12:36 2019 +0200 Fix build with enabled asserts Regression from commit 774a0185fb47 ("tdf#125475 sw: update SwTextFrames when SwTextLine cache shrinks"). Change-Id: Iaab0ede4e993a8cebd56115d3345092529d48e3b diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx index 69f5bc91d586..513381512a7d 100644 --- a/sw/source/core/bastyp/swcache.cxx +++ b/sw/source/core/bastyp/swcache.cxx @@ -299,7 +299,7 @@ void SwCache::DeleteObj( SwCacheObj *pObj ) pObj->GetNext()->SetPrev( pObj->GetPrev() ); m_aFreePositions.push_back( pObj->GetCachePos() ); - assert(m_aCacheObjects[pObj->GetCachePos()].get() == pObj); + assert(m_aCacheObjects[pObj->GetCachePos()] == pObj); m_aCacheObjects[pObj->GetCachePos()] = nullptr; delete pObj; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits