diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-10-25 13:41:05 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-10-25 20:50:04 +0200 |
commit | fa3f04bdd4f73a1b3be70dfb709c44638ef7e3d9 (patch) | |
tree | f6b64a6f11acabe4b524bfed275a3ef30f96c21b /sd/source | |
parent | ee912e56d85345489234196266216e660a5dee46 (diff) |
tdf#148934 PDF/UA export: add Contents entry to Link annotations
* Specification: ISO 14289-1:2014, Clause: 7.18.5, Test number: 2
Links shall contain an alternate description via their Contents key as described in ISO 32000-1:2008, 14.9.3.
These links are created all over the code, in some cases it's a bit
dubious what the content/alt-text should be, but let's try to use the
most suitable looking bit of text in whatever the context is.
* Specification: ISO 14289-1:2014, Clause: 7.18.3, Test number: 1
Every page on which there is an annotation shall contain in its page dictionary the key Tabs, and its value shall be S.
Change-Id: I7b63feb759f0c75047f854ed9997918f829a537e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141826
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/dlg/tpaction.cxx | 21 | ||||
-rw-r--r-- | sd/source/ui/inc/tpaction.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 35 |
3 files changed, 31 insertions, 29 deletions
diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx index c5ccd758a321..f89fa51f5b5d 100644 --- a/sd/source/ui/dlg/tpaction.cxx +++ b/sd/source/ui/dlg/tpaction.cxx @@ -798,25 +798,4 @@ OUString SdTPAction::GetEditText( bool bFullDocDestination ) return aStr; } -TranslateId SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA ) -{ - switch( eCA ) - { - case presentation::ClickAction_NONE: return STR_CLICK_ACTION_NONE; - case presentation::ClickAction_PREVPAGE: return STR_CLICK_ACTION_PREVPAGE; - case presentation::ClickAction_NEXTPAGE: return STR_CLICK_ACTION_NEXTPAGE; - case presentation::ClickAction_FIRSTPAGE: return STR_CLICK_ACTION_FIRSTPAGE; - case presentation::ClickAction_LASTPAGE: return STR_CLICK_ACTION_LASTPAGE; - case presentation::ClickAction_BOOKMARK: return STR_CLICK_ACTION_BOOKMARK; - case presentation::ClickAction_DOCUMENT: return STR_CLICK_ACTION_DOCUMENT; - case presentation::ClickAction_PROGRAM: return STR_CLICK_ACTION_PROGRAM; - case presentation::ClickAction_MACRO: return STR_CLICK_ACTION_MACRO; - case presentation::ClickAction_SOUND: return STR_CLICK_ACTION_SOUND; - case presentation::ClickAction_VERB: return STR_CLICK_ACTION_VERB; - case presentation::ClickAction_STOPPRESENTATION: return STR_CLICK_ACTION_STOPPRESENTATION; - default: OSL_FAIL( "No StringResource for ClickAction available!" ); - } - return {}; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/inc/tpaction.hxx b/sd/source/ui/inc/tpaction.hxx index f04f50fddfce..893192d256f2 100644 --- a/sd/source/ui/inc/tpaction.hxx +++ b/sd/source/ui/inc/tpaction.hxx @@ -82,9 +82,9 @@ private: void SetActualClickAction( css::presentation::ClickAction eCA ); void SetEditText( OUString const & rStr ); OUString GetEditText( bool bURL = false ); - static TranslateId GetClickActionSdResId(css::presentation::ClickAction eCA); - public: + SD_DLLPUBLIC static TranslateId GetClickActionSdResId(css::presentation::ClickAction eCA); + SdTPAction(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); virtual ~SdTPAction() override; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 83d8e56dc91f..14eb0a38d279 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -44,6 +44,7 @@ #include <sal/log.hxx> #include <editeng/unofield.hxx> #include <notifydocumentevent.hxx> +#include <tpaction.hxx> #include <unomodel.hxx> #include "unopool.hxx" #include <sfx2/lokhelper.hxx> @@ -135,6 +136,27 @@ using namespace ::cppu; using namespace ::com::sun::star; using namespace ::sd; +TranslateId SdTPAction::GetClickActionSdResId( presentation::ClickAction eCA ) +{ + switch( eCA ) + { + case presentation::ClickAction_NONE: return STR_CLICK_ACTION_NONE; + case presentation::ClickAction_PREVPAGE: return STR_CLICK_ACTION_PREVPAGE; + case presentation::ClickAction_NEXTPAGE: return STR_CLICK_ACTION_NEXTPAGE; + case presentation::ClickAction_FIRSTPAGE: return STR_CLICK_ACTION_FIRSTPAGE; + case presentation::ClickAction_LASTPAGE: return STR_CLICK_ACTION_LASTPAGE; + case presentation::ClickAction_BOOKMARK: return STR_CLICK_ACTION_BOOKMARK; + case presentation::ClickAction_DOCUMENT: return STR_CLICK_ACTION_DOCUMENT; + case presentation::ClickAction_PROGRAM: return STR_CLICK_ACTION_PROGRAM; + case presentation::ClickAction_MACRO: return STR_CLICK_ACTION_MACRO; + case presentation::ClickAction_SOUND: return STR_CLICK_ACTION_SOUND; + case presentation::ClickAction_VERB: return STR_CLICK_ACTION_VERB; + case presentation::ClickAction_STOPPRESENTATION: return STR_CLICK_ACTION_STOPPRESENTATION; + default: OSL_FAIL( "No StringResource for ClickAction available!" ); + } + return {}; +} + namespace { class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable, @@ -1644,20 +1666,21 @@ static void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape uno::Any aAny( xShapePropSet->getPropertyValue( "OnClick" ) ); if ( aAny >>= eCa ) { + OUString const actionName(SdResId(SdTPAction::GetClickActionSdResId(eCa))); switch ( eCa ) { case presentation::ClickAction_LASTPAGE : { sal_Int32 nCount = rDoc.GetSdPageCount( PageKind::Standard ); sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::DestAreaType::FitRectangle ); - sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); + sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName); rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); } break; case presentation::ClickAction_FIRSTPAGE : { sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::DestAreaType::FitRectangle ); - sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); + sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName); rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); } break; @@ -1667,7 +1690,7 @@ static void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape if ( nDestPage ) nDestPage--; sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::DestAreaType::FitRectangle ); - sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); + sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName); rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); } break; @@ -1678,7 +1701,7 @@ static void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape if ( nDestPage > nLastPage ) nDestPage = nLastPage; sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::DestAreaType::FitRectangle ); - sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); + sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName); rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); } break; @@ -1696,7 +1719,7 @@ static void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape case presentation::ClickAction_DOCUMENT : case presentation::ClickAction_PROGRAM : { - sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); + sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName); rPDFExtOutDevData.SetLinkURL( nLinkId, aBookmark ); } break; @@ -1706,7 +1729,7 @@ static void ImplPDFExportShapeInteraction( const uno::Reference< drawing::XShape if ( nPage != -1 ) { sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::DestAreaType::FitRectangle ); - sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect ); + sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink(aLinkRect, actionName); rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); } } |