[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - drawinglayer/source include/drawinglayer svx/source vcl/qa
drawinglayer/source/primitive2d/controlprimitive2d.cxx |4 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 20 include/drawinglayer/primitive2d/controlprimitive2d.hxx|8 + svx/source/sdr/contact/viewcontactofunocontrol.cxx |9 + svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx | 10 +- vcl/qa/cppunit/pdfexport/pdfexport.cxx | 63 + 6 files changed, 109 insertions(+), 5 deletions(-) New commits: commit 2dbbc200e87b472e7a6daf1e1f658496fd569813 Author: Michael Stahl AuthorDate: Wed Oct 11 19:13:53 2023 +0200 Commit: Caolán McNamara CommitDate: Wed Oct 18 22:23:44 2023 +0200 drawinglayer,svx: PDF/UA export: put Form SE into anchor paragraph SE This is like commit d467f1aa3d028f399826c97e2eecedcd79efcf65 and commit 6e5d59c2ca6969e9491f97cd7a00d094fc62cfb3 but for the form controls, which have their own special ControlPrimitive2D. Change-Id: I4b4ac45e81f490a7b625acd9e8753300d10bf119 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157847 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d5c19ef9d30cde052e8cd2486ac9395e62d9c9a9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157874 Reviewed-by: Caolán McNamara diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 372fb61244a0..c8448efa981f 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -243,10 +243,12 @@ namespace drawinglayer::primitive2d uno::Reference< awt::XControlModel > xControlModel, uno::Reference xXControl, ::std::u16string_view const rTitle, -::std::u16string_view const rDescription) +::std::u16string_view const rDescription, +void const*const pAnchorKey) : maTransform(std::move(aTransform)), mxControlModel(std::move(xControlModel)), mxXControl(std::move(xXControl)) +, m_pAnchorStructureElementKey(pAnchorKey) { ::rtl::OUStringBuffer buf(rTitle); if (!rTitle.empty() && !rDescription.empty()) diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index a5882e8b95cb..5b853d8152c1 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -1101,6 +1101,18 @@ void VclMetafileProcessor2D::processControlPrimitive2D( if (!bIsPrintableControl) return; +::std::optional oAnchorParent; +if (mpPDFExtOutDevData) +{ +if (rControlPrimitive.GetAnchorStructureElementKey()) +{ +sal_Int32 const id = mpPDFExtOutDevData->EnsureStructureElement( +rControlPrimitive.GetAnchorStructureElementKey()); + oAnchorParent.emplace(mpPDFExtOutDevData->GetCurrentStructureElement()); +mpPDFExtOutDevData->SetCurrentStructureElement(id); +} +} + const bool bPDFExport(mpPDFExtOutDevData && mpPDFExtOutDevData->GetIsExportFormFields()); bool bDoProcessRecursively(true); @@ -1153,6 +1165,10 @@ void VclMetafileProcessor2D::processControlPrimitive2D( } mpPDFExtOutDevData->CreateControl(*pPDFControl); mpPDFExtOutDevData->EndStructureElement(); +if (oAnchorParent) +{ +mpPDFExtOutDevData->SetCurrentStructureElement(*oAnchorParent); +} // no normal paint needed (see original UnoControlPDFExportContact::do_PaintObject); // do not process recursively @@ -1235,6 +1251,10 @@ void VclMetafileProcessor2D::processControlPrimitive2D( if (mpPDFExtOutDevData) { mpPDFExtOutDevData->EndStructureElement(); +if (oAnchorParent) +{ +mpPDFExtOutDevData->SetCurrentStructureElement(*oAnchorParent); +} } } diff --git a/include/drawinglayer/primitive2d/controlprimitive2d.hxx b/include/drawinglayer/primitive2d/controlprimitive2d.hxx index e33c26886cd9..a7128b7f7322 100644 --- a/include/drawinglayer/primitive2d/controlprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/controlprimitive2d.hxx @@ -58,6 +58,9 @@ private: /// yet another special snowflake way to generate PDF Alt text OUString m_AltText; +/// anchor structure element (Writer) +void const* const m_pAnchorStructureElementKey; + /** used from getXControl() to create a local awt::XControl which is remembered in mxXControl and from thereon always used and returned by getXControl() */ @@ -81,7 +84,8 @@ public: ControlPrimitive2D(basegfx::B2DHomMatrix aTransform, css::uno::Reference xControlModel,
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - drawinglayer/source include/drawinglayer include/svx svx/source sw/inc sw/source vcl/inc vcl/qa vcl/source
drawinglayer/source/primitive2d/structuretagprimitive2d.cxx |4 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 27 +-- include/drawinglayer/primitive2d/structuretagprimitive2d.hxx |6 include/svx/svdobj.hxx |2 svx/source/sdr/contact/viewobjectcontact.cxx |6 svx/source/svdraw/svdobj.cxx |4 sw/inc/EnhancedPDFExportHelper.hxx |6 sw/inc/dcontact.hxx |2 sw/source/core/text/EnhancedPDFExportHelper.cxx | 86 +-- vcl/inc/pdf/pdfwriter_impl.hxx |2 vcl/qa/cppunit/pdfexport/data/tdf154982.odt |binary vcl/qa/cppunit/pdfexport/pdfexport.cxx | 83 ++ vcl/source/gdi/pdfwriter_impl.cxx|5 13 files changed, 152 insertions(+), 81 deletions(-) New commits: commit 30bb38b041a44f6c30fcf0475b3cf2432dc7f5cb Author: Michael Stahl AuthorDate: Wed Jul 12 18:34:24 2023 +0200 Commit: خالد حسني CommitDate: Wed Jul 26 14:40:24 2023 +0200 tdf#154982 drawinglayer,svx,sw,vcl: PDF export: hell flys and shapes... ... should be below their anchor paragraph in the structure tree. Refactor SwEnhancedPDFExportHelper (etc.) to use the new EnsureStructureElement()/InitStructureElement() functions instead of SetCurrentStructureElement() for the frames, and allow it for flys that don't have their anchor paragraphs created yet because the hell layer is exported before the document body. Change-Id: I1be3b54002e8196772e6f9d81dd0fd0c85b6e34b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154399 Tested-by: Jenkins Reviewed-by: Michael Stahl (cherry picked from commit d467f1aa3d028f399826c97e2eecedcd79efcf65) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154427 Reviewed-by: خالد حسني diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx index 62da91ecc00f..47af55ab9b57 100644 --- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx @@ -31,13 +31,13 @@ namespace drawinglayer::primitive2d bool bBackground, bool bIsImage, Primitive2DContainer&& aChildren, -sal_Int32 const nAnchorStructureElementId, +void const*const pAnchorStructureElementKey, ::std::vector const*const pAnnotIds) : GroupPrimitive2D(std::move(aChildren)), maStructureElement(rStructureElement), mbBackground(bBackground), mbIsImage(bIsImage) -, m_nAnchorStructureElementId(nAnchorStructureElementId) +, m_pAnchorStructureElementKey(pAnchorStructureElementKey) { if (pAnnotIds) { diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 5e7b5523bad9..7f25b44e1761 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -2520,7 +2520,7 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( // structured tag primitive const vcl::PDFWriter::StructElement& rTagElement(rStructureTagCandidate.getStructureElement()); bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement)); -sal_Int32 nPreviousElement(-1); +bool bNeedEndAnchor(false); if (!rStructureTagCandidate.isTaggedSdrObject()) { @@ -2532,19 +2532,12 @@ void VclMetafileProcessor2D::processStructureTagPrimitive2D( // foreground object: tag as regular structure element if (!rStructureTagCandidate.isBackground()) { -if (rStructureTagCandidate.GetAnchorStructureElementId() != -1) +if (rStructureTagCandidate.GetAnchorStructureElementKey() != nullptr) { -auto const nTemp = mpPDFExtOutDevData->GetCurrentStructureElement(); -bool const bSuccess = mpPDFExtOutDevData->SetCurrentStructureElement( -rStructureTagCandidate.GetAnchorStructureElementId()); -if (bSuccess) -{ -nPreviousElement = nTemp; -} -else -{ -SAL_WARN("drawinglayer", "anchor structure element not found?"); -} +sal_Int32 const id = mpPDFExtOutDevData->EnsureStructureElement( +rStructureTagCandidate.GetAnchorStructureElementKey()); +mpPDFExtOutDevData->BeginStructureElement(id); +bNeedEndAnchor = true; }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - drawinglayer/source include/drawinglayer
drawinglayer/source/processor2d/hittestprocessor2d.cxx | 36 include/drawinglayer/processor2d/hittestprocessor2d.hxx | 10 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) New commits: commit 8224430181eb2255edcb8e73f892313ce9c37168 Author: Sarper Akdemir AuthorDate: Fri Jul 21 13:47:21 2023 +0300 Commit: Sarper Akdemir CommitDate: Mon Jul 24 09:14:38 2023 +0200 related tdf#152992: rename HitTolerance to HitTolerancePerAxis Rename ...HitTolerance instances to ...HitTolerancePerAxis as suggested by Noel on: https://gerrit.libreoffice.org/c/core/+/154694/2/include/drawinglayer/processor2d/hittestprocessor2d.hxx#45 Change-Id: I9c5b69218a4809f795c9a6324d76b2e2c1b12343 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154716 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Sarper Akdemir (cherry picked from commit 2acfc1448facebd254bda18b2bf286a29be636a7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154705 diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index 6e624fa4ef97..77b396f60f5d 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -41,25 +41,25 @@ namespace drawinglayer::processor2d { HitTestProcessor2D::HitTestProcessor2D(const geometry::ViewInformation2D& rViewInformation, const basegfx::B2DPoint& rLogicHitPosition, -const basegfx::B2DVector& rLogicHitTolerance, +const basegfx::B2DVector& rLogicHitTolerancePerAxis, bool bHitTextOnly) : BaseProcessor2D(rViewInformation), -maDiscreteHitTolerance(rLogicHitTolerance), +maDiscreteHitTolerancePerAxis(rLogicHitTolerancePerAxis), mbCollectHitStack(false), mbHit(false), mbHitTextOnly(bHitTextOnly) { // ensure input parameters for hit tolerance is >= 0.0 -if (maDiscreteHitTolerance.getX() < 0.0) -maDiscreteHitTolerance.setX(0.0); -if (maDiscreteHitTolerance.getY() < 0.0) -maDiscreteHitTolerance.setY(0.0); +if (maDiscreteHitTolerancePerAxis.getX() < 0.0) +maDiscreteHitTolerancePerAxis.setX(0.0); +if (maDiscreteHitTolerancePerAxis.getY() < 0.0) +maDiscreteHitTolerancePerAxis.setY(0.0); -if (!maDiscreteHitTolerance.equalZero()) +if (!maDiscreteHitTolerancePerAxis.equalZero()) { // generate discrete hit tolerance -maDiscreteHitTolerance -= getViewInformation2D().getObjectToViewTransformation() * rLogicHitTolerance; +maDiscreteHitTolerancePerAxis += getViewInformation2D().getObjectToViewTransformation() * rLogicHitTolerancePerAxis; } // generate discrete hit position @@ -72,7 +72,7 @@ namespace drawinglayer::processor2d bool HitTestProcessor2D::checkHairlineHitWithTolerance( const basegfx::B2DPolygon& rPolygon, -const basegfx::B2DVector& rDiscreteHitTolerance) const +const basegfx::B2DVector& rDiscreteHitTolerancePerAxis) const { basegfx::B2DPolygon aLocalPolygon(rPolygon); aLocalPolygon.transform(getViewInformation2D().getObjectToViewTransformation()); @@ -80,9 +80,9 @@ namespace drawinglayer::processor2d // get discrete range basegfx::B2DRange aPolygonRange(aLocalPolygon.getB2DRange()); -if(rDiscreteHitTolerance.getX() > 0 || rDiscreteHitTolerance.getY() > 0) +if(rDiscreteHitTolerancePerAxis.getX() > 0 || rDiscreteHitTolerancePerAxis.getY() > 0) { -aPolygonRange.grow(rDiscreteHitTolerance); +aPolygonRange.grow(rDiscreteHitTolerancePerAxis); } // do rough range test first @@ -92,7 +92,7 @@ namespace drawinglayer::processor2d return basegfx::utils::isInEpsilonRange( aLocalPolygon, getDiscreteHitPosition(), -std::max(rDiscreteHitTolerance.getX(), rDiscreteHitTolerance.getY())); +std::max(rDiscreteHitTolerancePerAxis.getX(), rDiscreteHitTolerancePerAxis.getY())); } return false; @@ -100,7 +100,7 @@ namespace drawinglayer::processor2d bool HitTestProcessor2D::checkFillHitWithTolerance( const basegfx::B2DPolyPolygon& rPolyPolygon, -const basegfx::B2DVector& rDiscreteHitTolerance) const +const basegfx::B2DVector& rDiscreteHitTolerancePerAxis) const { bool bRetval(false); basegfx::B2DPolyPolygon aLocalPolyPolygon(rPolyPolygon); @@ -109,12 +109,12 @@ namespace