summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorArnaud Versini <arnaud.versini@libreoffice.org>2019-09-20 19:01:34 +0200
committerArnaud Versini <arnaud.versini@libreoffice.org>2020-02-08 15:03:07 +0100
commita795886762a6a4aabd601183598c4e6c819bcb1f (patch)
tree93a58d738bf27a0c5f75f80dc7e651763916ee5f /filter
parenta2f62a861ba7036e689070c47f72214b1bdd49d4 (diff)
Add minimum support for PDF/A3
Change-Id: I6ce3a3dbe71df1d3f56279879e3f91bd7c82f784 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84687 Tested-by: Jenkins Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/pdf/impdialog.cxx27
-rw-r--r--filter/source/pdf/impdialog.hxx3
-rw-r--r--filter/source/pdf/pdfexport.cxx7
-rw-r--r--filter/uiconfig/ui/pdfgeneralpage.ui106
4 files changed, 99 insertions, 44 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 0fe49d89b9cf..2abce8fdeb08 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -390,10 +390,9 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
// always write the user selection, never the overridden value
const bool bIsPDFUA = mbPDFUACompliance;
- const bool bIsPDFA = (1 == mnPDFTypeSelection) || (2 == mnPDFTypeSelection);
+ const bool bIsPDFA = (1 == mnPDFTypeSelection) || (2 == mnPDFTypeSelection) || (3 == mnPDFTypeSelection);
const bool bUserSelectionTags = bIsPDFA || bIsPDFUA;
maConfigItem.WriteBool("UseTaggedPDF", bUserSelectionTags ? mbUseTaggedPDFUserSelection : mbUseTaggedPDF);
-
maConfigItem.WriteInt32("SelectPdfVersion", mnPDFTypeSelection );
maConfigItem.WriteBool("PDFUACompliance", mbPDFUACompliance);
@@ -493,9 +492,8 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(weld::Container* pPage, weld::DialogC
, mxCbReduceImageResolution(m_xBuilder->weld_check_button("reduceresolution"))
, mxCoReduceImageResolution(m_xBuilder->weld_combo_box("resolution"))
, mxCbPDFA(m_xBuilder->weld_check_button("pdfa"))
- , mxRbPDFA1b(m_xBuilder->weld_radio_button("pdfa1"))
- , mxRbPDFA2b(m_xBuilder->weld_radio_button("pdfa2"))
, mxCbPDFUA(m_xBuilder->weld_check_button("pdfua"))
+ , mxRbPDFAVersion(m_xBuilder->weld_combo_box("pdfaversion"))
, mxCbTaggedPDF(m_xBuilder->weld_check_button("tagged"))
, mxCbExportFormFields(m_xBuilder->weld_check_button("forms"))
, mxFormsFrame(m_xBuilder->weld_widget("formsframe"))
@@ -567,18 +565,19 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem(ImpPDFTabDialog* pParent)
mxEdWatermark->set_sensitive( false );
mxCbPDFA->connect_toggled(LINK(this, ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHandle));
- const bool bIsPDFA = (1 == pParent->mnPDFTypeSelection) || (2 == pParent->mnPDFTypeSelection);
+ const bool bIsPDFA = (pParent->mnPDFTypeSelection>=1) && (pParent->mnPDFTypeSelection <= 3);
mxCbPDFA->set_active(bIsPDFA);
switch( pParent->mnPDFTypeSelection )
{
case 1: // PDF/A-1
- mxRbPDFA1b->set_active(true);
- mxRbPDFA2b->set_active(false);
+ mxRbPDFAVersion->set_active_id("1");
break;
case 2: // PDF/A-2
+ mxRbPDFAVersion->set_active_id("2");
+ break;
+ case 3: // PDF/A-3
default: // PDF 1.x
- mxRbPDFA1b->set_active(false);
- mxRbPDFA2b->set_active(true);
+ mxRbPDFAVersion->set_active_id("3");
break;
}
@@ -709,9 +708,12 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* pParent )
if (bIsPDFA)
{
- pParent->mnPDFTypeSelection = 2;
- if( mxRbPDFA1b->get_active() )
+ pParent->mnPDFTypeSelection = 3;
+ OUString currentPDFAMode = mxRbPDFAVersion->get_active_id();
+ if( currentPDFAMode == "1" )
pParent->mnPDFTypeSelection = 1;
+ else if(currentPDFAMode == "2")
+ pParent->mnPDFTypeSelection = 2;
}
pParent->mbPDFUACompliance = bIsPDFUA;
@@ -831,8 +833,7 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, TogglePDFVersionOrUniversalAccessibilityHa
pSecPage->ImplPDFASecurityControl(!bIsPDFA);
mxCbTaggedPDF->set_sensitive(!bIsPDFA && !bIsPDFUA);
- mxRbPDFA1b->set_sensitive(bIsPDFA);
- mxRbPDFA2b->set_sensitive(bIsPDFA);
+ mxRbPDFAVersion->set_sensitive(bIsPDFA);
if (bIsPDFA || bIsPDFUA)
{
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 97a7464ffa6d..17fb57890655 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -191,9 +191,8 @@ class ImpPDFTabGeneralPage : public SfxTabPage
std::unique_ptr<weld::CheckButton> mxCbReduceImageResolution;
std::unique_ptr<weld::ComboBox> mxCoReduceImageResolution;
std::unique_ptr<weld::CheckButton> mxCbPDFA;
- std::unique_ptr<weld::RadioButton> mxRbPDFA1b;
- std::unique_ptr<weld::RadioButton> mxRbPDFA2b;
std::unique_ptr<weld::CheckButton> mxCbPDFUA;
+ std::unique_ptr<weld::ComboBox> mxRbPDFAVersion;
std::unique_ptr<weld::CheckButton> mxCbTaggedPDF;
std::unique_ptr<weld::CheckButton> mxCbExportFormFields;
std::unique_ptr<weld::Widget> mxFormsFrame;
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index a4e4549b631f..758c7e786114 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -607,6 +607,13 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
mbEncrypt = false; // no encryption
xEnc.clear();
break;
+ case 3:
+ aContext.Version = vcl::PDFWriter::PDFVersion::PDF_A_3;
+ mbUseTaggedPDF = true; // force the tagged PDF as well
+ mbRemoveTransparencies = false; // does allow transparencies
+ mbEncrypt = false; // no encryption
+ xEnc.clear();
+ break;
case 16:
aContext.Version = vcl::PDFWriter::PDFVersion::PDF_1_6;
break;
diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui
index 9f469063edb5..02bef0174279 100644
--- a/filter/uiconfig/ui/pdfgeneralpage.ui
+++ b/filter/uiconfig/ui/pdfgeneralpage.ui
@@ -2,6 +2,7 @@
<!-- Generated with glade 3.22.1 -->
<interface domain="flt">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkSizeGroup"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">100</property>
@@ -517,17 +518,19 @@
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
- <object class="GtkLabel" id="label7">
+ <object class="GtkCheckButton" id="allowdups">
+ <property name="label" translatable="yes" context="pdfgeneralpage|allowdups">Allow duplicate field _names</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
<property name="halign">start</property>
- <property name="label" translatable="yes" context="pdfgeneralpage|label7">Submit _format:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">format</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
</packing>
</child>
<child>
@@ -547,19 +550,33 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="allowdups">
- <property name="label" translatable="yes" context="pdfgeneralpage|allowdups">Allow duplicate field _names</property>
+ <object class="GtkBox" id="submitformatbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="halign">start</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">baseline</property>
+ <property name="margin_top">1</property>
+ <property name="vexpand">True</property>
+ <property name="label" translatable="yes" context="pdfgeneralpage|label7">Submit _format:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">format</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">2</property>
+ <property name="top_attach">0</property>
</packing>
</child>
</object>
@@ -602,31 +619,50 @@
<property name="can_focus">False</property>
<property name="column_spacing">14</property>
<child>
- <object class="GtkRadioButton" id="pdfa2">
- <property name="label" context="pdfgeneralpage|pdfa">PDF/A-2b</property>
+ <object class="GtkComboBoxText" id="pdfaversion">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
+ <property name="can_focus">False</property>
+ <property name="active">3</property>
+ <items>
+ <item id="1" context="pdfgeneralpage|pdfaversion">PDF/A-1b</item>
+ <item id="2" context="pdfgeneralpage|pdfaversion">PDF/A-2b</item>
+ <item id="3" context="pdfgeneralpage|pdfaversion">PDF/A-3b</item>
+ </items>
+ <accessibility>
+ <relation type="labelled-by" target="pdfaversionlabel"/>
+ </accessibility>
</object>
<packing>
- <property name="left_attach">0</property>
+ <property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="pdfa1">
- <property name="label" context="pdfgeneralpage|pdfa">PDF/A-1b</property>
+ <object class="GtkBox" id="pdfabox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <property name="group">pdfa2</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="pdfaversionlabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">baseline</property>
+ <property name="vexpand">True</property>
+ <property name="label" translatable="yes" context="pdfgeneralpage|pdfaversion">PDF/A _version:</property>
+ <property name="use_underline">True</property>
+ <accessibility>
+ <relation type="label-for" target="pdfaversion"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="left_attach">1</property>
+ <property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
@@ -868,6 +904,18 @@
</packing>
</child>
</object>
+ <object class="GtkSizeGroup" id="comboBoxSizegroup">
+ <widgets>
+ <widget name="format"/>
+ <widget name="pdfaversion"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup" id="pdfSizeGroup">
+ <widgets>
+ <widget name="submitformatbox"/>
+ <widget name="pdfabox"/>
+ </widgets>
+ </object>
<object class="GtkSizeGroup" id="sizegroupLabel">
<widgets>
<widget name="all"/>