[Libreoffice-commits] core.git: filter/Library_pdffilter.mk filter/source include/sfx2 sfx2/source sw/inc sw/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 9 16:05:39 UTC 2020
filter/Library_pdffilter.mk | 1 +
filter/source/pdf/impdialog.cxx | 18 ++++++++++++++++++
filter/source/pdf/impdialog.hxx | 4 ++++
include/sfx2/objsh.hxx | 4 ++++
sfx2/source/doc/objcont.cxx | 6 ++++++
sw/inc/docsh.hxx | 1 +
sw/source/uibase/app/docst.cxx | 8 ++++++++
7 files changed, 42 insertions(+)
New commits:
commit 08886d9d01eb5d3356290ba6d8eeca899cde45cc
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed Jan 8 16:19:36 2020 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Jan 9 17:05:05 2020 +0100
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 at gmail.com>
diff --git a/filter/Library_pdffilter.mk b/filter/Library_pdffilter.mk
index 21be2a1cd5ee..7076e762b131 100644
--- a/filter/Library_pdffilter.mk
+++ b/filter/Library_pdffilter.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Library_use_custom_headers,pdffilter,\
$(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 d19458a00e4d..0fe49d89b9cf 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 @@ using namespace ::com::sun::star::uno;
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 @@ short ImpPDFTabDialog::Ok( )
{
// 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 52a37ad5cf4a..97a7464ffa6d 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -58,6 +58,9 @@ class ImpPDFTabLinksPage;
/// 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 @@ public:
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 28aae49924e3..083ad2dc667d 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 @@ public:
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 9aa966384297..f5675528a956 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -295,6 +295,12 @@ std::set<Color> SfxObjectShell::GetDocColors()
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 b3a993488c20..a182cf8e8d60 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -252,6 +252,7 @@ public:
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 5c1d6af32462..61cb6a0df6cd 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 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
}
}
+sfx::AccessibilityIssueCollection SwDocShell::runAccessibilityCheck()
+{
+ sw::AccessibilityCheck aCheck(m_xDoc.get());
+ aCheck.check();
+ return aCheck.getIssueCollecton();
+}
+
std::set<Color> SwDocShell::GetDocColors()
{
return m_xDoc->GetDocColors();
More information about the Libreoffice-commits
mailing list