tdf#45636 trigger accessibility check when exporting as PDF/UA
This triggers the accessibility check, when we want to export
the PDF with PDF/UA functionallity. If issues are found, it will
show the issues. OK will continue with export despite the issues
and cancel will cancel the whole PDF export.
Change-Id: I2fde97381e08e9c2c79473888caa36e8dd828979
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86387
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
diff --git a/filter/Library_pdffilter.mk b/filter/Library_pdffilter.mk
index 21be2a1..7076e76 100644
--- a/filter/Library_pdffilter.mk
+++ b/filter/Library_pdffilter.mk
@@ -36,6 +36,7 @@
$(eval $(call gb_Library_use_libraries,pdffilter,\
svt \
svx \
sfx \
tk \
vcl \
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index d19458a..0fe49d8 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -26,6 +26,8 @@
#include <sfx2/passwd.hxx>
#include <unotools/resmgr.hxx>
#include <tools/diagnose_ex.h>
#include <sfx2/objsh.hxx>
#include <svx/AccessibilityCheckDialog.hxx>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
@@ -55,6 +57,8 @@
ImpPDFTabDialog::ImpPDFTabDialog(weld::Window* pParent, Sequence< PropertyValue >& rFilterData,
const Reference< XComponent >& rxDoc)
: SfxTabDialogController(pParent, "filter/ui/pdfoptionsdialog.ui", "PdfOptionsDialog"),
mrDoc(rxDoc),
mpParent(pParent),
maConfigItem( "Office.Common/Filter/PDF/Export/", &rFilterData ),
maConfigI18N( "Office.Common/I18N/CTL/" ),
mbIsPresentation( false ),
@@ -345,6 +349,20 @@
{
// here the whole mechanism of the base class is not used
// when Ok is hit, the user means 'convert to PDF', so simply close with ok
if (getGeneralPage()->IsPdfUaSelected())
{
SfxObjectShell* pShell = SfxObjectShell::GetShellFromComponent(mrDoc);
if (pShell)
{
sfx::AccessibilityIssueCollection aCollection = pShell->runAccessibilityCheck();
if (!aCollection.getIssues().empty())
{
svx::AccessibilityCheckDialog aDialog(mpParent, aCollection);
return aDialog.run();
}
}
}
return RET_OK;
}
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 52a37ad..97a7464 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -58,6 +58,9 @@
/// Class tabbed dialog
class ImpPDFTabDialog final : public SfxTabDialogController
{
css::uno::Reference<css::lang::XComponent> mrDoc;
weld::Window* mpParent;
FilterConfigItem maConfigItem;
FilterConfigItem maConfigI18N;
@@ -238,6 +241,7 @@
void GetFilterConfigItem(ImpPDFTabDialog* paParent);
void SetFilterConfigItem(ImpPDFTabDialog* paParent);
bool IsPdfaSelected() const { return mxCbPDFA->get_active(); }
bool IsPdfUaSelected() const { return mxCbPDFUA->get_active(); }
};
/// Class tab page viewer
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index 28aae49..083ad2d 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -39,6 +39,7 @@
#include <set>
#include <o3tl/typed_flags_set.hxx>
#include <functional>
#include <sfx2/AccessibilityIssue.hxx>
class SbxValue;
class SbxArray;
@@ -553,6 +554,9 @@
virtual std::set<Color> GetDocColors();
// Accessibility Check
virtual sfx::AccessibilityIssueCollection runAccessibilityCheck();
// Documents, for which to format the view size
virtual SfxObjectShell* GetObjectShell() override;
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 9aa9663..f567552 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -295,6 +295,12 @@
return empty;
}
sfx::AccessibilityIssueCollection SfxObjectShell::runAccessibilityCheck()
{
sfx::AccessibilityIssueCollection aCollection;
return aCollection;
}
SfxStyleSheetBasePool* SfxObjectShell::GetStyleSheetPool()
{
return nullptr;
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index b3a99348..a182cf8e 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -252,6 +252,7 @@
bool bTemplate = false ) const override;
virtual std::set<Color> GetDocColors() override;
sfx::AccessibilityIssueCollection runAccessibilityCheck() override;
virtual void LoadStyles( SfxObjectShell& rSource ) override;
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 5c1d6af..61cb6a0 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -76,6 +76,7 @@
#include <sfx2/watermarkitem.hxx>
#include <SwUndoFmt.hxx>
#include <strings.hrc>
#include <AccessibilityCheck.hxx>
using namespace ::com::sun::star;
@@ -1468,6 +1469,13 @@
}
}
sfx::AccessibilityIssueCollection SwDocShell::runAccessibilityCheck()
{
sw::AccessibilityCheck aCheck(m_xDoc.get());
aCheck.check();
return aCheck.getIssueCollecton();
}
std::set<Color> SwDocShell::GetDocColors()
{
return m_xDoc->GetDocColors();