2233 Commits
Author SHA1 Message Date
Andrea Gelmini daa89fdb7f Fix typos
Change-Id: I0e2b8adff439cf24155505746233fe6d1481a193
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211779
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-10-03 20:14:06 +02:00
Mike Kaganski 24f40c4b11 tdf#163272 sw,drawinglayer,vcl: give anchored content its own /Lang
With Tagged PDF on, a paragraph in a language other than the document's
gets /Lang on its structure element. What is anchored in the paragraph
is tagged inside that same element and inherits the attribute, so a
frame's text and its description would be declared the paragraph's
language.

0d2d9e656d87647f904f1a463ed9b879c2bfb10c (tdf#163272 sw: give a
paragraph its own /Lang, 2026-09-21) avoided that by putting no /Lang on
such a paragraph, on a check of one node of a text frame that can cover
several. Its text still carried the language, on a Span, while what was
anchored in it specified none and inherited the document's. In a German
document that declared a shape's English text German. See
https://gerrit.collaboraoffice.com/c/online/+/13117/comment/89a7866d_907a2957/

The paragraph specifies its own language now, and a frame anchored in it
no longer inherits it. A Figure, a Formula and a frame's Division
specify the document's where the paragraph's differs, which is what the
frame's own paragraphs are measured against. A drawing shape's text is
tagged by drawinglayer, which takes the locale of the drawn portions and
specifies it where they agree; such a shape is nested in its anchor
paragraph in Writer and in no such paragraph elsewhere, so there is
nothing to compare against.

A drawing shape's own element specifies the document's language too. svx
anchors it under the anchor paragraph, drawinglayer opens it there, and
it carries the shape's title and description. Without the attribute, a
described shape in a paragraph that specifies one would have its
description declared the paragraph's language, and its text likewise
where the portions disagree.

testParagraphLanguage compared a structure type against a language and
quoted no text, so nothing identified the words affected. It lists every
element holding text or a description now, against the language it
specifies, an entry reading "P de-DE: Ein deutscher Absatz mit einem
Bild."; one specifying none is listed without a language, so correct
inheritance is asserted too. PDFiumPageObject gained getMarkedContentID
to join a page object's text to its element.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I1eecf0b56f09fc6d144894910a9037d89884dd3b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13239
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 898a2e1b3a6fc07d7b43315b2f4781b32f1a20d3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211609
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-10-01 10:25:19 +02:00
Caolán McNamara 3f2e68ce5f ofz#566780367 Out-of-memory
the stream that collects the parts of a multipart object is writable,
so a seek past its end while reading the object grows it to fit

so read the finished object from a read-only view of the parts written

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0e615e28a7ddd540d84f84e9cf542b29aa68ba57
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13724
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 793c9cfb7fac082ffead5d1726b1e3f92a00090f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211561
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-29 17:00:47 +02:00
Caolán McNamara 99e022072c ofz#552117139 Out-of-memory
the count in the file can be far more rectangles than the rest of
the record could hold

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I220e5eb3c5a99f7a7d6114aaa429234fa4a31906
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12357
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f92f34584421532774a762ec98688db7196badb0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211408
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-24 11:01:11 +02:00
Caolán McNamara 5e82ea09ca emf+: limit the bezier points to what the record holds
The count comes straight from the file, so take the bytes left in the
record as the upper bound on it.

Thanks to Manan Patel (0xManan).

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia803201408a3f2f886af257941afd33edecebd46
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/13225
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 6159c54074e7dbda025f5bf4f6a6a0f8bab26ca7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211317
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-22 20:49:50 +02:00
Andreas Heinisch e1fe3c74f9 tdf#152997 - Duplicate an odd length dash array to meet the spec
An odd-length array will be drawn as one dash spanning the entire path.
The specifications under
https://www.w3.org/TR/svg-strokes/#StrokeDashing state: "If the list has
an odd number of values, then it is repeated to yield an even number of
values. Thus, the rendering behaviour of stroke-array: 5,4,2 is
equivalent to stroke-dasharray: 5,4,2,5,4,2."

Change-Id: I8f233c4cec5c85f5ab1096b032cbb8743715f14d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211062
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Tested-by: Jenkins
2026-09-21 12:28:00 +02:00
Mike Kaganski c3cae7d482 drawinglayer,svx: ask for an artifact instead of faking a tag
I9431c460cade3d432cb7abf76930e23f8106a7f1 ("tdf#168462 svx: mark the
slide background as an artifact") left page decoration reaching its
/Artifact by a lie: VclMetafileProcessor2D emitted one only for a
background image, and dropped a tag naming NonStructElement, so the
tag claimed to be a Division and an image. Decoration now says so
itself: the artifact decision reads the decorative flag, and the
caller passes NonStructElement and no image and means them. A
background image keeps its own path to an artifact.
isTaggedSdrObject() becomes opensStructureElement(); its comment
still claimed every one of these primitives comes from an SdrObject.

The exported file is unchanged. The one call that goes away with the
old predicate, alternative text on a tag that opens an artifact,
could not reach the file either: setAlternateText writes nothing
without m_bEmitStructure, and checkEmitStructure() is false inside a
NonStructElement. operator== now compares the element and the
decorative flag, which decide what comes out and were not compared.

Letting a master slide's own shapes out as artifacts does not follow
from treating every background as decoration. A background object can
hold tagged children, and a Paragraph begun inside an artifact opens
no marked content at all; tried on testTdf135192, three pieces of its
content came out in no marked-content section. Something narrower has
to tell the two apart.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Id0fc0d9bee36e8182702d77e9ac9647709a63f68
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/12321
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 9353a1cac3e8056d175acc29dbeecc79ff1cdcd4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211170
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-21 00:20:39 +02:00
Andrea Gelmini be7ff6a857 Fix typos in code and comments + some reformatting
Change-Id: Ic6fe197734655a2591a6730d07f23d4222a278f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210564
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-09-10 22:06:44 +02:00
Caolán McNamara e65a82d91b ofz#550481740 not a valid value for type EmfPlusHatchStyle
drawinglayer/source/tools/emfphelperdata.cxx:771:32: runtime error: load of value 4280295456, which is not a valid value for type 'EmfPlusHatchStyle'
     #0 0x7b14dd7d4d02 in emfplushelper::EmfPlusHelperData::EMFPPlusFillPolygon(basegfx::B2DPolyPolygon const&, bool, unsigned int) drawinglayer/source/tools/emfphelperdata.cxx:771:32
     #1 0x7b14dd7f903a in emfplushelper::EmfPlusHelperData::processEmfPlusData(SvMemoryStream&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/emfphelperdata.cxx:1776:29
     #2 0x7b14dd7c020c in emfplushelper::EmfPlusHelper::processEmfPlusData(SvMemoryStream&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/emfplushelper.cxx:41:14
     #3 0x7b14dd932d9d in wmfemfhelper::implInterpretMetafile(GDIMetaFile const&, wmfemfhelper::TargetHolders&, wmfemfhelper::PropertyHolders&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/wmfemfhelper.cxx:2957:43
     #4 0x7b14dd919d51 in wmfemfhelper::interpretMetafile(GDIMetaFile const&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/wmfemfhelper.cxx:2993:9
     #5 0x7b14dd470d93 in drawinglayer::primitive2d::MetafilePrimitive2D::create2DDecomposition(drawinglayer::geometry::ViewInformation2D const&) const drawinglayer/source/primitive2d/metafileprimitive2d.cxx:42:42
     #6 0x7f14fb527e4f in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:90:41
     #7 0x7b14dd4727d5 in TestImportWMF drawinglayer/source/primitive2d/metafileprimitive2d.cxx:149:16

so keep the hatch style as the value read from the stream, and an
unknown one then reaches the switch default

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I9725f2f80d3a00fbf82ac5a84cf55b5c071af68b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11529
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 906c713f2cdd05372db04c1d807d31b1fff5377a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210589
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-09-09 15:55:23 +02:00
Caolán McNamara fe9db2c8e1 ofz#557542656 negation of -2147483648 cannot be represented
drawinglayer/source/tools/emfphelperdata.cxx:451:83: runtime error: negation of -2147483648 cannot be represented in type 'sal_Int32' (aka 'int'); cast to an unsigned type to negate this value to itself
     #0 0x7b71c0dc8ec7 in emfplushelper::EmfPlusHelperData::mappingChanged() drawinglayer/source/tools/emfphelperdata.cxx:451:83
     #1 0x7b71c0de6a2d in emfplushelper::EmfPlusHelperData::EmfPlusHelperData(SvMemoryStream&, wmfemfhelper::TargetHolders&, wmfemfhelper::PropertyHolders&) drawinglayer/source/tools/emfphelperdata.cxx:1503:9
     #2 0x7b71c0dc0059 in emfplushelper::EmfPlusHelper::EmfPlusHelper(SvMemoryStream&, wmfemfhelper::TargetHolders&, wmfemfhelper::PropertyHolders&) drawinglayer/source/tools/emfplushelper.cxx:29:17
     #3 0x7b71c0f31dc6 in wmfemfhelper::implInterpretMetafile(GDIMetaFile const&, wmfemfhelper::TargetHolders&, wmfemfhelper::PropertyHolders&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/wmfemfhelper.cxx:2923:37
     #4 0x7b71c0f19d51 in wmfemfhelper::interpretMetafile(GDIMetaFile const&, drawinglayer::geometry::ViewInformation2D const&) drawinglayer/source/tools/wmfemfhelper.cxx:2993:9
     #5 0x7b71c0a70d93 in drawinglayer::primitive2d::MetafilePrimitive2D::create2DDecomposition(drawinglayer::geometry::ViewInformation2D const&) const drawinglayer/source/primitive2d/metafileprimitive2d.cxx:42:42
     #6 0x7f71deb27e4f in drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor&, drawinglayer::geometry::ViewInformation2D const&) const drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx:90:41
     #7 0x7b71c0a727d5 in TestImportWMF drawinglayer/source/primitive2d/metafileprimitive2d.cxx:149:16

so negate the frame offsets as doubles

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I2cf478245f30f4573bfa5ccb2c6dcbe5c603e38b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/11528
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit f6f1f208a87c2a725e5c20c6a7453fa5679eca76)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210540
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-09-08 16:16:21 +02:00
Samuel Mehrbrodt 9fc9e5bc9e tdf#173381 PDF export: Make sure that link contents are always set
Use name, link text or the link itself - depending on what is available.

Change-Id: Iea6654e2aae22d39c031b2cb953c34a5a1ce42ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210458
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@collabora.com>
2026-09-07 08:07:57 +02:00
Xisco Fauli 37b8c9fe6b cid#1697494: silence Overflowed constant
Change-Id: I678b844b9904015602cbcdab3bfbd7176ae3d0c0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210281
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-31 16:07:37 +02:00
Andrea Gelmini f5b75e07cc Fix typos
Change-Id: Ic9fd01f3387234155ef4c4b62a0939fb05aba28c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210046
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-27 20:42:29 +02:00
Andrea Gelmini 0c48ac2f19 Fix typos
Change-Id: I998817b5b92aa3b372dec4906b3b980355d4e34e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210069
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-27 14:12:54 +02:00
Andrea Gelmini c62535aa01 Fix typos
Change-Id: Id5cfaa1e76ea5bbcc0c70a5d376d7b957f042ae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210068
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-08-27 10:52:45 +02:00
Khaled Hosny c172d7fcae drawinglayer: Compare the font variations of a text primitive
Two text portions that differ only in their variation settings compared
equal.

Change-Id: Ieea2cc7f4459865e1ec8c4cea2ab3e2b9bd2dce5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209995
Tested-by: Jenkins
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
2026-08-26 10:26:43 +02:00
Andrea Gelmini 6ca8e86e63 Fix typos
Change-Id: I9d690ba450f2cb1c40eab2bb5dbe6149cd0d9eba

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209800
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 15:51:18 +02:00
Andrea Gelmini f601ff00db Fix typos
Change-Id: I548322572d506e7adaab54f49ff53b248bb4fd0a

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209804
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-08-25 15:13:53 +02:00
Andrea Gelmini e933a74013 Fix typos
Change-Id: I9d690ba450f2cb1c40eab2bb5dbe6149cd0d9ebb

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209799
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 15:09:54 +02:00
Andrea Gelmini ac73a753e7 Fix typos
Change-Id: I27311db087861b13fd5df93fa20d6f1931a56cac

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209802
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 15:01:25 +02:00
Andrea Gelmini 07f953efe1 Fix typos
Change-Id: I548322572d506e7adaab54f49ff53b248bb4fd01

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209803
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 14:58:15 +02:00
Andrea Gelmini e57fdd4fa1 Fix typos
Change-Id: Ic69c2708f39865cf567648cbed4ee0ae03b4ee22

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209801
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 14:56:02 +02:00
Mike Kaganski 60c92f9752 CreateAlphaMask + CreateColorBitmap -> SplitIntoColorAndAlpha
See commit f7b67e6c8c5981790fb9ac162dcc68e470b53112 (pdfexport: reduce
the number of times we split images, 2026-08-19) for rationale.

While at that: drop the check added in commit
e06456180a (crashtesting: crash on export
of forum-en-41439.odp to pdf, 2023-07-27), which was obsoleted by commit
4942aa1533 (tdf#156808 force an alpha mask
to be created even if it has no alpha, 2023-09-14).

Change-Id: I318c24629676b115c34cc42333bdcb136c420bd9
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9510
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 69c9ed699924b40cd05f08bca30cce115bb629ff)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209509
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-23 13:27:34 +02:00
Mike Kaganski d385b81da3 Avoid second call to CreateAlphaMask
This is an expensive operation.

Change-Id: I4ffd17de84d324dcb091905927d9ef7423fdb1c9
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9505
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 9e2d6727f27caa7663a18564f46bb4a90b3b87a3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209508
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-23 13:27:29 +02:00
Caolán McNamara 1f486a45b1 emf+: read path gradient boundary points without point types
This is the variant of an array with no point-type bytes, but by default
EMFPPath::Read consumed trailing bytes as point types.

EMFPPath already has a way to set that the points are a plain
EmfPlusPointF array with no point-type bytes. So use that.

Then the GetRawPointsPolygon workaround is no longer needed.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I0cfb9730efd2e9b638da9b2dc5118e4f05293fed
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9133
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 14c378ac439cdc0525d3f76509ca59090aa3b253)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209311
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-19 12:29:51 +02:00
Caolán McNamara ea81d3165e rename the somewhat misleading EMFPPath "Lines" argument to HasPointTypes
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I12d8440f32bf7dd0f6de14e0a4e2603f0223f39d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9132
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 0cb865c311aa8a4c2001411df6162ecdc6b226ad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209310
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-19 12:29:46 +02:00
Caolán McNamara 78bb27842a ofz#542668507 Integer-overflow
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I66dc24b6e788c886f6039603dd445bcbcf50b2d7
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9105
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit dc07a9597ee8f60ff0691b82ef7e461adce29f19)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209309
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-08-19 12:29:37 +02:00
Masayuki Iizuka e689d08f44 tdf#169919: apply current transformation to PDF link clickable rectangles
Otherwise the clickable rectangle does not enclose the link text.

Change-Id: I3f5a4aa90b1dc0268ea53f6c2ff2940b009d15ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208866
Tested-by: Jenkins
Reviewed-by: Dan Williams <dcbw@libreoffice.org>
2026-08-12 17:00:37 +02:00
Jonathan Clark d2951c2b45 tdf#170126 drawinglayer: Restore deleted transformation from refactor
Partially reverts a commit that was causing incorrect SVG rendering,
depending on VCL backend. This commit deleted code that translated
clipping rects from view space into device space. It seems like this
change was made intentionally, but it doesn't work correctly, and
reverting it doesn't seem to affect the behavior of the linked bug.

Regression from commit f5b8ec6b3f
Author: Noel Grandin <noelgrandin@gmail.com>
Date:   Fri Oct 17 13:25:32 2025 +0200

    tdf#168730 impBufferDevice and caller should have the same mask rect

Change-Id: I7c83a5c372557f658df9ece65cbc6c142a4983ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209070
Tested-by: Jenkins
Reviewed-by: Jonathan Clark <jonathan@libreoffice.org>
2026-08-11 04:56:40 +02:00
Caolán McNamara ba86bd3b0f emf+: give the stream-read locals a starting value
ReadUInt32 leaves the variable alone if the record ends early.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Id619384f2a266f14de73f7e49e01a160caa51245
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7868
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f2871abc29f699763afc17b993a9b382cf0ffae4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208700
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-28 10:13:34 +02:00
Caolán McNamara 540baf585d ofz: drawing, check if offset is correct
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5567d1cced44649487d7feb687651dae710b2641
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7832
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 5df4ccaf0d6603fc777c72838dc8076328eaf567)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208695
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-28 10:13:04 +02:00
Caolán McNamara 737a85d616 ofz: emf+, null deref
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ibd0bce6bf34a1a8cb3d992b6abb2a9266c944e3f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7830
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit a5c4b3644049e877722dbc2add0f999e4eb827ac)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208694
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-28 10:12:59 +02:00
Caolán McNamara d39f37dfed ofz: drawing, better calculation for how many points could be in the stream
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I1ca0dee6ce15e3d3f62583fbc21791d014c42da0
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7847
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f0fab8f1ff45394eac5341de889348a1e052c52a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208691
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-28 10:12:40 +02:00
Caolán McNamara a553f7cd17 ofz: drawing, don't allow pops past starting depth
since:

commit bf86607081
Date:   Fri Jun 4 14:34:23 2010 +0200

    #i112117# changed the Metafile primitive decomposition to better handle sub-metafile contents

which moved the pop out of the flags check that paired it with the push, so an
empty PUSH, or more POPs than PUSHes, drains the stack and Current() hands
back its fallback static

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ide76ca082d0bdbdf391ab72da23d87e8d85c7348
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7839
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit f67519fde47d9613e8362a5cf02c46b7e9fb47bd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208690
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-28 10:12:27 +02:00
Caolán McNamara f22a3013d3 ofz: emf+, check if enough data is available
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I91eab7d3067d9d151c420fb77054f12ed3d014c7
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7821
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit ec87afa008bbb1122059b5b3bcb5308b1b193a80)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208624
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-27 21:23:45 +02:00
Caolán McNamara b12197e31c ofz: emf+, return early on short read
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia609e3586f9939db0e0a8166096f8d04c2437104
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7802
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 2d02e31e2320495e1eb5e562a1da002bf74f2a7d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208623
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-27 11:04:18 +02:00
Caolán McNamara ccbc76815c ofz: extend fuzzer to decompose the result for more coverage
put the read and decompose in a shared TestImportWMF so the fftester
tool and the fuzzer exercise the same path and cannot drift

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: If1d95f78bb31a0e4f4b39a94cbed487d2fedf068
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7801
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 0be46fce12fecd6814727e6d8592dcf099082de3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208622
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-27 11:04:06 +02:00
Julien Nabet d6257f44f4 Related tdf#149890: add missing part from fixes in VclPixelProcessor2D
+ add some spaces to improve readability and comparison with VclPixelProcessor2D

Change-Id: I8607d7f97087671fd5d44645fa90ff3c90e69143
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208396
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-07-21 21:48:04 +02:00
Julien Nabet 5f0cf799b3 Related tdf#149890: SVG: pattern is displayed with black fill
Regression from 5707b5dce7
tdf#101083 speed up SVG rendering with pattern fill (2)
This is the same thing I did in

     commit 3cbe3a0259
     Author: Noel Grandin <noel.grandin@collabora.co.uk>
     Date:   Mon Jun 14 15:05:59 2021 +0200
     tdf#101083 speed up SVG rendering with pattern fill

but cut and paste from the VclPixelProcessor2D to the CairoPixelProcessor2D code.

Which makes this SVG render in reasonable time when using the cairo backend.

We can probably do even better by cutting out the usage of VCL here, but this
is good enough for now.

+ apply the same as af2175bb87
    crashtesting: divide by zero

    since:

    commit 7b807a6b79
    Date:   Fri Jun 21 12:28:30 2024 +0200

        tdf#161086 bitmap location wrong with SVG with an embedded PNG

    bodge it by using the requested width/height and not the possibly
    zero on fail actual sizes

Change-Id: Ie0e0462e564a568f99d1c5b9c62f71049f71f9b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208275
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-07-20 21:30:55 +02:00
Khaled Hosny aa1e992c23 vcl: Scale stretched fonts relative to the height on Windows
The font width used to mean the average character width on Windows,
like GDI’s LOGFONT lfWidth. This complicates things cross-platform, and
also DirectWrite does not expose such info.

Drop the whole average character width nonsense and align Windows to
other platforms, keeping the already existing cross-platforms
workarounds for EMF/WMF that are now applied also to Windows.

Change-Id: I750d42ad090bb9d0f776e80609b7a67b8ac38aac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207990
Reviewed-by: Khaled Hosny <khaled@libreoffice.org>
Tested-by: Jenkins
2026-07-14 00:16:49 +02:00
Christopher Sherlock c928d5bc07 vcl: Rename Y-axis origin methods to Get/SetDeviceOriginY
Completes the deprecation of legacy coordinate subsystem naming by
renaming GetOutOffYPixel() and SetOutOffYPixel() to
GetDeviceOriginY() and SetDeviceOriginY() across OutputDevice,
Window, and CoordinateMapper.

This unifies axis naming conventions following previous X-axis
refactoring passes, clarifying that these fields represent the
physical origin offsets of the device rendering canvas.

This patch also moves view transformation logic inline from outdev/map
to CoordinateMapper, and wraps sprawling multi-line logic formulas
across mapping routines to clean up formatting boundaries.

Key changes:
* include/vcl/outdev.hxx / window.hxx: Updated public declarations
  to replace GetOutOffYPixel with GetDeviceOriginY.
* vcl/inc/CoordinateMapper.hxx: Migrated view transformation cache State
  members and mapping calculation methods into the mapper object.
* Global adjustments: Patched all related coordinate offset reads
  and tracking writes throughout desktop, editeng, sc, svx, and vcl.

Change-Id: I28fec54a7f3312cc41ada2de38b26351c0a65527
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203646
Tested-by: Jenkins
Reviewed-by: Dan Williams <dcbw@libreoffice.org>
2026-07-07 14:22:05 +02:00
Christopher Sherlock 90951d958c vcl: rename X-axis origin methods to Get/SetDeviceOriginX
Rename GetOutOffXPixel() and SetOutOffXPixel() to GetDeviceOriginX()
and SetDeviceOriginX() across OutputDevice, Window, and CoordinateMapper.

The legacy "OutOff" naming convention obscured the difference between
system-level window positioning offsets and internal content scrolling
(SetPixelOffset). The new nomenclature explicitly communicates that
these metrics strictly govern the device coordinate space origin.

This patch focuses strictly on the X-axis coordinate reads and cleans
up duplicated formatting signatures inside the CoordinateMapper header.

Impacted modules:
* include/vcl: Update public declarations in outdev.hxx and window.hxx.
* vcl/inc: Clean up CoordinateMapper.hxx whitespace and scaling hooks.
* Global: Patch dependent pixel coordinate reads across desktop, editeng,
  sc, sfx2, svx, and vcl.

Change-Id: I546e1d255887e3b280ff15caca2e27ef10de52d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206509
Reviewed-by: Dan Williams <dcbw@libreoffice.org>
Tested-by: Jenkins
2026-07-07 14:14:50 +02:00
Caolán McNamara 36b3eb054b add a recursion depth to ReadRegionNode
Change-Id: I6e17304405af5e6260ebe9c78ff344101a7c0060
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/762
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 4cebc4ad8b977959430829223b10309df8601d1c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206667
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2026-06-16 07:50:11 +02:00
Armin Le Grand (collabora) 3b0aa2199e SmartArt: Calc Diagram Im/Export improvements
Calc imported Diagrams due to using mainly DrawingLayer
oox import code, but export, even of the unchanged
DomTrees, was missing (just never done). Thus in
versions before this being a Diagram was lost, it
just always was converted to a GroupHierarchy containing
the Shapes that were part of the Diagram.

Added to read the Diagram's name at Import at all for Calc
oox import, set and used now at the created Diagram.

Added to secure/save the DomTrees for the imported
ReplacementGraphic when importing oxx Calc, that was just
also never done, so it could not be exported as unchanged/
original data (and was not, so that was never noticed).

Added complete export of oox Diagram to Calc. This includes
unchanged versions, but also changed/added versions. This
may need more work, but own turn-around works already.
This mainly uses the same ExportContent, but that needed
some adaptions.

Doing this I also changed the ShapeImport of Calc to use
a single oox::drawingml::ShapeExport, before it created
a separate temporary one for every Shape that was imported.

Also added the checkMinimalDataDoms check to Calc oox
export that is already used in the other apps. As always,
there are huge differences in oox im/export for Calc
compared to the other apps, e.g. a completely different
Group ImportContext is used compared to Impress and I have
no idea why that is done.

Signed-off-by: Armin Le Grand (collabora) <Armin.LeGrand@collabora.com>
Change-Id: Ib7c1b73f7f72599f6054d0cf9203f46980eec5cf
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1887
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Armin Le Grand <armin.legrand@collabora.com>
(cherry picked from commit b1fbe49401e5e4dbe62ff25580ec7252c0376e88)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206019
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-05 12:42:07 +02:00
Armin Le Grand (collabora) 52ec9f11d8 CairoSDPR: Improve buffering of huge BitmapData
We already did some improvements, but I wanted to clean
this up somewhat. Reason for the needed corrections was
in principle the sqrt()-based general calculation of
the HoldTime in the default implementation of
calculateCombinedHoldCyclesInSeconds. The original idea
was to hold huge data shorter due to memory constraints.
To solve that we added an adapted version to
CairoPixelProcessor2D.

With lessons learned I decided to remove that and
provide a revised general implementation based on linear
scaling of the HoldTime. Based on assuming the seen
huge Bitmap and estimating 20min for it, just create a
factor and multiply with SizeInBytes.

I checked that and it works as intended. It will spare
us from this problem re-occurring with future SDPRs.

NOTE: This still keeps the CairoSDPR-specific avoiding
of buffering of small Bitmaps when these are available
from Bitmap directly. This stays useful and is
Cairo-specific.

Signed-off-by: Armin Le Grand (collabora) <Armin.LeGrand@collabora.com>
Change-Id: I30c7361c6fbfaf0be90be353091cbaf831db5cd2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2005
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit a3d3ae5e931a04ff5718382ccffe9f16de336a42)
(cherry picked from commit 7550c6ea0bb82f7574e4b974f8d24bd1662a878b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205991
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-05 08:43:16 +02:00
Noel Grandin f87c623b4e lsan:fix leak in CairoPixelProcessor2D::getOrCreateCairoSurfaceHelper
shows up when running CppunitTest_sc_shapetest

probably from the recent changes here, when calling tryToGetCairoSurface.

Rather than doing explicit cleanup, lets follow the same path used in
  include/vcl/cairo.hxx
and pass around a shared_ptr that makes cleanup automatic.

Change-Id: I1bec6f579af182b259cb0edbd86192627e5c61ea
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1858
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 70966239f816d81cb9dcb208e7c02e08339da28c)
(cherry picked from commit ee2349dba8aa282e30ae65cbf5ffbb27b707e0ec)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205990
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-05 08:43:09 +02:00
Armin Le Grand (collabora) df1ae71700 CairoSDPR: allow direct use of small cairo_surface_t
When isCairoCompatible and we can get cairo_surface_t
directly from Bitmap for small instances (used 160x100
here, can be adapted) use directly. There is no need to
prepare for MipMapping, so spare the
SystemDependentDataHolder buffering for that cases.
For more information, see comments in commit.

Change-Id: Ia9d51a5749124d7001daf2e5355ceec5afccb264
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1384
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Armin Le Grand <armin.legrand@collabora.com>
(cherry picked from commit 62dbd904fbea0dee4d54f1bb75601af40c6b91c4)
(cherry picked from commit a23e06360e796e1264f40d31c818d3ac3a5a1f54)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205989
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-05 08:43:03 +02:00
Armin Le Grand (collabora) 66a0927a68 CairoSDPR: Force keeping CairoSurfaceHelper for huge PixelData
If we have a really 'big' pixel-based graphic the cost for creating
the mip-map entries is high. If that is the case, force keeping this
entry alive and not getting flushed by using a large number of
seconds. In that case the local MipMap is more important than the
memory kept allocated for fast repaints.

To detect 'big' graphics, compare to an assumed ScreenSize (may also
be fetched from real screen if needed). To react, create a buffer
residing time of one hour (increase if needed).

NOTE: This will increase MemoryFootPrint if isCairoCompatible
is false by holding the local cairo_surface_t in CairoSurfaceHelper
longer than before.

Change-Id: I1cf726f00d459bc0cb19bb1d202e64e010061426
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1134
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 2e1b0a51a745e615ed7e2f22666cc4aa4e005451)
(cherry picked from commit c2c58c177ae822906fe2c558546851643fe54247)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205988
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-05 08:42:55 +02:00
Tomaž Vajngerl 36e700d618 Cache mipmap surfaces for cairo-backed bitmaps
The tryToGetCairoSurface() path created a new CairoSurfaceHelper on
every call, bypassing the SystemDependentData cache, so mipmap surfaces
were recomputed per tile paint. Move zero-copy into the CairoSurfaceHelper
constructor so all bitmaps go through the caching path.

Also fix estimateUsageInBytes to account for bytes per pixel.

Change-Id: Ie21b12e92b07a43f4b34f13d22b3aeeaf34534ea
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1105
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Armin Le Grand <armin.legrand@collabora.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 09cad228f400e5dd7f3e06509a35c3c1729c41b9)
(cherry picked from commit ffc9820016c54d3c6d420a778eb8d0886e1cf36b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205987
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-04 19:05:20 +02:00
Tomaž Vajngerl 95df1960a8 fix bitmap render - don't set device scale on the mip-map surface
We shouldn't set the device scale for the mip-map surface, as it
will cause scaling issues.

Change-Id: Icde1d889d386f3c2e78b0c186cac0864b499e77a
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1104
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit f1163666de0e5ac2b40fb27546c36f6192a4e6d9)
(cherry picked from commit f429c0ed5e6f04c3d783d1311b43830d8bbd2e38)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205986
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-04 19:05:11 +02:00