Commit Graph
100 Commits
Author SHA1 Message Date
Mike Kaganski 104d56c090 writerperfect: parenthesize the REQUIRE_VERSION expansion
The macro expands to an unparenthesized a || (b && c), so a caller appending
&& binds it to the second operand only, leaving the first to decide alone.
Every current caller uses it standalone, where this changes nothing.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I304b5bbc5e4e921ee843cbfec07685a5686b55b4
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8118
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit a5a814883eff59db39fea75675958cdf49e0c3a2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208844
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-30 18:07:30 +02:00
Mike Kaganski d87b16c676 tdf#171959 sw: keep a trailing blank's decorations out of a wrap area
A blank at the end of a line hangs outside the line by design, and the
justification of the line can leave it in the space that an object
reserved for its wrap: the text is stretched right up to the object, and
the blank starts where the reserved space begins. Its underline was then
drawn beside the object, which is no better than drawing it on the
margin.

The room such a blank was formatted against is measured before the line
is adjusted, so the check that keeps it inside the line cannot see this
coming, and the clamp that runs after the adjustment does not reach it:
the blank keeps no width of its own here, neither its own nor an extra
blank width, so there is nothing to compare a remaining room with.

Take the position instead, which is what the question really is: while
painting, the blank's own place in the line and the offset where the
object's reserved space starts are both known, so drop the decorations
of a blank that begins at or after that offset. A blank before an object
that still has room in front of it keeps them, as does one that Word
writes with its "underline trailing space" option on.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I1d23a77b7b6767e82eb64ad76335f06f57ebe193
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7881
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit f42c56ae45f98e5081825ac0329226a175b9ed12)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208757
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 10:00:16 +02:00
Mike Kaganski f7b776fc31 tdf#171688 sw: paint a trailing blank with its own font
A hyperlink at the end of a line looked like its underline reached past
the word. The blank after it is not part of the link and carries no
underline of its own, so nothing should have been drawn under it.

The blanks that a line break leaves over go into a hole portion, and the
painter only picks up character attributes for the text, field and tab
groups, which a hole portion belongs to none of. It was therefore painted
with whatever font the portion in front of it had left behind, in this
case the underlined one of the link, and the blank showed decorations
that the document never gave it. Seek the attributes for a hole portion
as well, so it is drawn with the font of the blanks it holds.

The hole was always painted with the wrong font, but it used to make no
difference: 90a83191a4 (Resolves: #i68503#
a SwHolePortion must not be decorated, 2013-01-03) took the decorations
off the hole's font again before drawing it. Since
b36f181bb7 (tdf#168777: Trailing space must
show all decorations, also for ODF, 2025-10-11) the blank keeps them, and
the wrong font became visible.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ie7cd9a5780dc449e12a2b4585c8f0b0c80e94235
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7877
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 84746ca8ab0725d55980a027e4c2744de47a8f94)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208756
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 10:00:09 +02:00
Mike Kaganski fd6b07150a tdf#168777: also decorate a trailing blank that comes before a fly
A blank at the end of a line ends up in a hole portion, and it can be
made in two places: SwTextPortion::Format_ splits off the blanks that no
longer fit the line, while SwTextPortion::FormatEOL peels off a blank
that did fit, which is what happens when text wraps around an object and
the line continues after it. Only the first one was taught to show the
blank's decorations, so the blank before such an object stayed bare while
Word underlines it. The test document, saved by Word with its
"underline trailing space" option on, shows both in one line: the blank
before the rectangle was not underlined, the ones at the end of the line
were.

The blank cannot end up decorated outside the space available to it. The
one Format_ makes is only decorated as far as it fits, and the one
FormatEOL makes was part of a portion that already fitted on the line, so
its room is there by construction. Checked against a rectangle moved past
the end of a line in steps of a fraction of a blank: decorations switch
off exactly when the remaining room drops below the blank's width.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I8f3ba57bbb8f00b30b9798cba1ac64270b87c197
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7866
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit b3d35b9d0f907b7b2446c8ae26a53c382919e43b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208755
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-29 10:00:03 +02:00
Mike Kaganski a07b3ece98 tdf#171253: close socket gracefully
I believe that the problem was closing the socket too fast, before OS
could finish its IO; that resulted in TCP Reset (RST) instead of FIN,
and browser showed connection error.

This change implements a graceful shutdown, by closing the sending
half, then using an expiring wait for the peer's ACK/FIN. I suppose
that 5 s timeout is reasonable for local operations.

In fact, I wasn't able to reproduce the problem after commit id
I16efa58ba90b98e71b13a0081dcdcc9d660db0b6 (tdf#101630: Make local
HTTP server cross-platform, using boost/beast); but it could be only
because of HW performance, and I hope the change follows "best
practices".

Change-Id: Ic3e9cf4e841d254197129ea7905527e97cae481a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201715
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 40a71882e983ac28782293cc036479e405e66a1c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201821
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-28 23:23:47 +02:00
Mike Kaganski 645df7d9b7 tdf#101630: Make local HTTP server cross-platform, using boost/beast
Allows proper Google Drive authentication e.g. on Linux.

Change-Id: I16efa58ba90b98e71b13a0081dcdcc9d660db0b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201714
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201820
2026-07-28 23:23:28 +02:00
Mike Kaganski 5e5bdfcca9 tdf#171692 sw: leave every trailing blank out of the unshrunk line width
Bolding a word in the attached document scrambled its line: the words were
drawn on top of each other, and walking right through the text took the
cursor backwards at every space.

A line's terminating blank hangs outside the line (see
853e13f914, tdf#57187: make sure to put
trailing blanks to hole portion in narrow lines, 2023-12-30), so it must
not count towards the width the line would have without shrinking. That
was done by leaving out a hole portion with nothing after it, which is
only ever the last one. Since b36f181bb7
(tdf#168777: Trailing space must show all decorations, also for ODF,
2025-10-11) the blank is split in two - the part that may show its
decorations, and the rest - so the first of them was counted.

The line then looked wider than the text area, the last line of a
justified paragraph was block formatted after all, and the shrinking that
follows took the spaces well past zero width: a space of 60 twips ended up
advancing the cursor by -399.

Leave out every hole portion that has nothing of substance after it, not
only the last one, at both places that measure the line this way.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I7895492a20cc1bc3426da983abf298de935010ad
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7843
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 7ec0c8f3b4decace423eabbdb31269b5597c4747)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208742
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-28 20:02:26 +02:00
Mike Kaganski 9e11a7494b tdf#171959 sw: keep trailing blank decorations inside the text area
Commit b36f181bb7 (tdf#168777: Trailing
space must show all decorations, also for ODF, 2025-10-11) made the
trailing blank of a line show its underline by default. In a justified
paragraph that underline is drawn past the right margin.

A line's trailing blank lives in a hole portion, which deliberately takes
no part in the layout (see 853e13f914,
tdf#57187: make sure to put trailing blanks to hole portion in narrow
lines, 2023-12-30), so it hangs outside the line. When the blank is
formatted, its decorated part is limited to the room then left on the
line - but adjustment happens afterwards, and justification hands exactly
that room to the glue between the words. The blank ends up beyond the
text area with its decorations still on. Right-aligned text has the same
problem, and centred text has it on lines that nearly fill the width.

Reconsider the decorated part once the line is adjusted. The room still
available is the width of the trailing margin portion(s), which is where
adjustment parks whatever is left of the line, so no coordinates are
needed. Lines that need no adjustment at all - left-aligned ones - get no
margin portion, and keep the room they were formatted against.

Where the room no longer fits the whole blank, the hole is split: the
first part is decorated and as wide as the room, a plain hole carries the
rest. A hole holds nothing but blanks, so the characters divide between
the two in proportion to the width, and the cursor still travels over the
whole blank.

The blank also took a share of the justification stretch while being
painted, which made the overshoot about twice the width of a space. It
is not part of the line's content, so exclude it.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I82dfe55a10f7b15969bc4561f8f2f04eb7eeee52
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7834
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 6ebdd28de79e412501152305b48a64d25b3609c5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208741
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-28 20:02:15 +02:00
Mike Kaganski 554e287252 Skip -debug:fastlink with the VS 2026 toolset, which removed it
/DEBUG:FASTLINK was available from VS 2017 through VS 2022 and is gone in the
VS 2026 toolset:
https://learn.microsoft.com/en-us/cpp/build/reference/debug-generate-debug-info?view=msvc-180
Its link.exe (14.51) answers the flag with "LNK4315: /DEBUG:FASTLINK is no
longer supported. Using /DEBUG:FULL instead." and links on, so a dbgutil build
would get that warning once per linked target - exactly what
b14cffdc89f9f38e05f346a9051d3420ee3b45cf ("Only use -debug:fastlink with
linkers that support it", 2026-07-17 11:51:25 +0500) set out to avoid for
lld-link.

That probe short-circuited to "supported" whenever the MSVC linker was
selected, so it never got to see this. Run it against the linker that will
actually be used in all cases (link.exe next to cl.exe, when lld-link is not
selected).

While at it, treat any mention of the flag in the probe output as "unusable",
instead of matching the -debug:full fallback wording alone. A linker that
takes the flag says nothing about it, so any complaint, however phrased, is
reason enough not to pass it.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I125a3000ab82aa4b9371069cf4f5fd814a11f599
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7818
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 3af47b423bbd0bb1882547e394b0b4c37e92de44)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208662
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-27 21:33:37 +02:00
Mike Kaganski e3a8b92b40 Skip -debug:fastlink for managed links instead of filtering its warning
link.exe supports -debug:fastlink for native code, but for a managed/CLR
image it cannot apply it: it prints "/debug:fastlink unsupported; using
/debug:full" and falls back, once per such link. Until now that warning was
swallowed by filter-creatingLibrary.awk (the FASTLINK_IN_CLR_MESSAGE branch).

Handle it the same way the linker-capability and setup_native cases are
handled: simply don't pass the flag where it isn't usable. A target that
produces a managed image carries CXXCLROBJECTS/GENCXXCLROBJECTS at link
scope, so gate -debug:fastlink off when either is set (cli_uno,
cli_cppuhelper, climaker). No warning is emitted, so the awk branch that
filtered it - and the keep_firstline machinery that existed only to serve it
- are removed. This reverts commit
39d1838412 ("Suppress linker warnings for CLR
objects", 2024-02-23), which introduced the awk changes dropped here.

While here, split the decision by when its inputs are known: the static part
(a dbgutil build and a linker that supports the flag, HAVE_LINK_DEBUG_FASTLINK
probed at configure time) becomes a parse-time variable, and the per-target
carve-outs (managed images, setup_native DLLs) stay in an expansion-time
function that can see the target-scoped variables. This also lets the
ENABLE_DBGUTIL ifeq go away.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Idc15341b48d8781698afb1357539539a923fda6c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7223
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 235296b3302d5667c1a78f8cdffd4e03063e883e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208661
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-27 21:32:30 +02:00
Mike Kaganski 9cff0b60ce Only use -debug:fastlink with linkers that support it
fastlink speeds up debug-build links, and MSVC link.exe supports it, but
lld-link does not: it prints "/debug:fastlink unsupported; using /debug:full"
on every link and falls back anyway, cluttering the build output with a
warning per linked target.

Add a configure probe (HAVE_LINK_DEBUG_FASTLINK) that checks whether the
selected linker actually supports the flag, and only pass -debug:fastlink
when it does. The probe tests the linker rather than hardcoding "lld has no
fastlink", so a future lld-link that gains support starts using it
automatically, with no further build-system change.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I9f2638449909d75e6e627ca1d53ac56ff8035cca
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7156
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit b14cffdc89f9f38e05f346a9051d3420ee3b45cf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208660
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-27 21:32:23 +02:00
Mike Kaganski 15e902e893 tdf#104020: centre an object on the text frame when its paragraph is empty
The images in the bug document are anchored to a paragraph that holds nothing
else, inside a text frame of a fixed height, and are centred vertically on
their paragraph's content. Such a paragraph has no text of its own, so its
height is whatever the object's own wrap gives it: the position and the area
it is measured against depend on each other. That circle has no solution
here, because a centred object needs a line of space above and below it
inside the paragraph (2 * 276 + 2400 = 2952 twips), more than the 2880 twips
of the frame. Layout alternated between a paragraph of a single line, with
the object ending up above the frame, and a paragraph filling the frame with
the object centred in it, and kept whichever of the two the pending
invalidations left behind. That is also why the same document changed its
appearance on a refresh and with the window size.

Take the content area of the text frame as the area to centre on, when the
anchor paragraph is the frame's only content and holds nothing but the
object. That is the space the paragraph can occupy, and unlike the paragraph
it does not follow the object, so there is one solution and layout reaches it
in a single pass. An object that fits into its anchor paragraph keeps using
the paragraph, so one placed next to the paragraph's own line stays there.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I8d642ea7328fde505a33d0fad727bc4b7fd2c457
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7833
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 7d264c9f67515623e0152515d00e07f20960d97c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208654
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-27 16:21:57 +02:00
Mike Kaganski 4b3c62f257 Import inline formulas in text mode
In Word, an equation that shares its paragraph with other content is
an inline equation, which is typeset in non-display ("text") style:
fraction numerators and denominators (and n-ary limits) are drawn at
a reduced size. Math renders formulas in display style by default, so
an imported inline equation was noticeably taller than in the source;
in a tightly filled document the extra height pushed the following
content onto a new page.

Whether an equation is inline or a display equation (a paragraph's only
content) is not reliably marked in the file: Word decides it from the
paragraph content, and e.g. the RTF export drops the \moMathPara wrapper
that would otherwise flag a display equation. So the writerfilter now
decides it the same way, in one place for both the OOXML and RTF imports.
DomainMapper collects the formulas of each paragraph and, once the
paragraph is finished, puts them into Math text mode (re-fetching their
size) unless the formula was the paragraph's only content.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ia43118f49e0d1ac8f0dea653bf7a61c9063e8996
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7571
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit a555fecc5d5546b15b854b7400589e8010c01310)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208652
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-27 15:13:51 +02:00
Mike Kaganski f198ec4944 cool#16036: only at-page flys trigger another FormatObjsAtFrame pass
The at-page reformatting loop added in 15c89cf1b7
("tdf#169158: Call FormatObjsAtFrame again, when at-page fly needs that",
2025-11-02) recorded the need for another pass with a page flag that was set by
SwPageFrame::InvalidateFlyLayout whenever it was called while the at-page objects
were being formatted. That also caught invalidations originating from
at-paragraph objects nested inside an at-page fly's content. For a document where
that content does not converge (a nearly frame-wide object centered on an empty
paragraph in a fixed-size at-page frame), those invalidations never stop, so the
flag was set on every pass and the loop never terminated: opening the document
hung.

Pass the invalidated anchored object to InvalidateFlyLayout, and set the flag
only when that object is anchored at the page.

Note that this deliberately narrows the trigger: the object is passed only from
SwFrame::InvalidatePage, the path these invalidations take; the other
InvalidateFlyLayout callers keep the default argument, so at-page invalidations
reaching the page through them no longer request another pass. This covers the
tdf#169158 case and this one; a future at-page scenario that needs the extra pass
through a different path must teach that caller to pass its object too. The
argument type is the SwAnchoredObject base so drawing objects can be passed as
well.

The in-formatting flag (m_bInAtPageFlyFormatting) becomes redundant and is
dropped: the at-page flag is cleared right before FormatObjsAtFrame and read
right after, which already scopes it to that call.

Change-Id: I294fc0e24a9a60bc82db08ba48047b8359d05b4c
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7701
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 0f6e508896252771857c65641b6676bf4a64acdb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208653
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-27 13:58:36 +02:00
Mike Kaganski 35a685a006 tdf#123974 tdf#150910 sc: keep the target's direct cell protection on paste
A Ctrl+V changes a cell's content, not whether it is locked. Copying a
protected cell onto a cell the user had directly unprotected used to carry
the Protected flag along, so the target could no longer be edited, the
opposite of what Excel does and what tdf#123974 asks for.

Throughout this change "the cell's protection" means the protection set as
direct formatting on the cell itself. Protection can also come from a cell
style, and conditional formatting sets protection precisely by applying
such a style; those two are one and the same mechanism and, as noted at
the end, are deliberately left untouched here.

The two reports in this area pull in opposite directions: tdf#123974 wants
the direct flag dropped on paste, tdf#150910 wants it always retained, and
they were noted as contradictory. A rule gated on sheet protection (drop
the direct flag only when the sheet is protected and the target was
unprotected) was considered and rejected, because its outcome depends on
the order of otherwise unrelated steps: directly unprotecting a cell,
pasting into it, then protecting the sheet would re-lock it, while
protecting the sheet first and pasting after would not. That is impossible
to explain to a user.

Instead treat a cell's direct protection as a property of the cell that an
interactive paste never changes. Snapshot the destination's directly set
cell protection before the paste and restore it afterwards, so the pasted
attributes overwrite everything except that lock state. Routing both the
replicated-single-row fast path and the general path through the same
restore also removes the single-row versus multi-row inconsistency of
tdf#150910, which shared the same root cause.

Only directly applied protection is preserved. Protection that instead
comes from a cell style, including a style applied dynamically by
conditional formatting, is not touched and keeps following the usual paste
(in theory this could be extended to the effective protection if a need
shows up). The programmatic copyRange path is left unchanged and still
copies attributes verbatim; only an interactive paste opts in. A moved
cell (cut and paste) keeps its own protection and is excluded.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I3a1ec141c3ec698858ca8d058e6d9b1e9126402f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7069
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 39f30bd4b532f7575957210b644216afa14ac28b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208344
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-22 14:01:57 +02:00
Mike Kaganski 26b8e7da32 tdf#163949 Find Previous now highlights text in every frame
When a document had several frames each containing a match, using Find
Previous only ever selected the match in the last frame; earlier frames
were skipped ("Find Next" and "Find All" were fine).

Backward text search walks the node array through SwNodes::GoPrevSection.
Since 691cfd22c6 ("tdf#159565: make sure to
handle leading hidden section correctly", 2024-02-14) that function stops
at the start of the current global section (here, a fly's start node), so
once the search stepped into a frame it could not move back into an
earlier one and got stuck in the last frame reached. GoPrevious got an
opt-in canCrossBoundary flag back then, but GoPrevSection did not.

Give GoPrevSection the same canCrossBoundary flag (default false, so plain
backward moves keep respecting section boundaries), and let the search
iterator in GetNode() opt in: it walks a range that is already bounded by
the PaM's mark, so crossing fly / header / footer / footnote boundaries
within that range is both wanted and safe. This also restores backward
Find across multiple headers, footers and footnotes. Forward search uses
GoNextSection, which was never limited - which is why Find Next and Find
All kept working.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I0c0971013d2fab19dac1de1e252586d7ea554c2b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/7060
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 051e00083683db002942b94d0323c5d8fd13e6d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208242
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-19 02:08:36 +02:00
Mike Kaganski f7421e4df0 tdf#159450 Keep axis title centered on plot area with data table
When a chart shows a data table, it is drawn as a strip at the bottom of
the diagram, so the plot-area-plus-axes rectangle grows to include it. The
vertical axis title was centered on that rectangle and thus ended up shifted
downwards compared to MS Office, which centers it on the plot area alone.

Center the left- and right-aligned axis titles on the plot area rectangle
(which already excludes the data table) instead of on the plot area plus
axes, so the title stays centered on the axis.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: If21ba0938cea16abc382e686b9c4e2b84caf2dca
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6978
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 48953636f24d522426d5f5e4ed9f0fc5ec6f30f5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208241
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-19 02:08:32 +02:00
Mike Kaganski 0aff8e29b2 tdf#154074 PPTX import: keep authored path of free bent connectors
A bent connector (bentConnector3/4/5) that is not glued to a shape at both of
its ends has its path fully defined in the file: the preset geometry and its
adjustment values, in a bounding box that may have been resized by hand. Such a
path has to be kept as authored - re-routing it from the endpoints yields a
different shape, because orthogonal routing is heuristic and differs between
applications and over time (PowerPoint likewise keeps the drawn path and does
not reroute these connectors when they are moved or resized).

So far every bent connector was imported as a routed edge and the authored
handle positions were transferred onto the route as EdgeLine deltas. That is
reliable only when both ends are glued, where the route follows from the two
endpoints. With a free end the route escaped in the wrong direction and dropped
a corner, so e.g. a bentConnector4 arrived with two corners instead of three
and its arrow ended in empty space.

Now a connector that is not glued at both ends gets its authored OOXML path
imposed directly on the edge object via SetEdgeTrackPath, which svx then keeps
as a user-defined track instead of re-routing.

To build that path, the point computation that getOOXHandlePositionsHmm already
performed is extracted into a shared helper getOOXConnectorPointsHmm and reused
both to impose the path and to derive the handles, which are simply the
midpoints of its inner segments; this also drops the duplicated
adjustment/size/transform code.

The changed existing connector tests were checked against PowerPoint:
testTdf164623 and testTdf165180 render visually unchanged (their free connectors
already routed correctly, so only the import mechanism changed), while the newly
handled cases are improved.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I468b341c088f33ec7055747d18fe526975ef16e1
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6813
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 20bf9a09d9e19055f8d1d1da383c44c92585e733)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208152
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-07-18 11:35:25 +02:00
Mike Kaganski f3ccb1c1bd Simplify a bit
Move the strip code right to the place where we detect
the "fully spans" condition.

Change-Id: Ib26d95d0d4cd008de05254a0a63a76748a765be4
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5673
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit b47309d37986f33cd66b0c15f89c670aa7805010)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207895
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-10 01:06:33 +02:00
Mike Kaganski 3b84edeeca Fix crash in ScHTMLLayoutParser::Image
After commit dfb400a2eb7574b474e2227dd3c911651543f153 (sc: pasting html
with embedded images fails, 2026-03-23), images with data protocol and
invalid base64 payload (ending with an incomplete group) would end up
dereferencing nulptr. This fixes that.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I283ddcb5b98c504417025f292e5860cd128a7853
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6212
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 5cb710cf0d12a1fb5b016e14ee67c06c7ad2104d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207720
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-07-07 21:28:24 +02:00
Mike Kaganski 50935f0fd9 vcl, sd: import PDF /IRT threaded comments and /State resolved flag
Extend PDFGraphicAnnotation with the raw PDF fields — /IRT, /RT,
/State, /StateModel, and /F plus each annotation's pdfium index —
that are needed to reconstruct a thread on the sd side.

The sd PDF filter uses them to:
  - mark every imported PDF annotation as threaded (any PDF comment
    can be replied to / resolved);
  - link replies to their parent via /IRT (page-scoped per spec);
  - collapse Acrobat-style state-change annotations into the target's
    IsResolved flag — /IRT + /State + /StateModel, with /F carrying
    the Hidden | NoZoom | NoRotate bits.

Only /StateModel = "Review" with /State = "Completed" maps to
resolved; other state models are discarded. /RT = "Group" is honoured
as a grouping relationship, not a reply. Acrobat's per-user state
model (each reviewer maintains their own state-change pointing at the
same target) is collapsed to a single boolean per comment — resolved
if any reviewer's latest state is Completed. The mapping is lossy;
the in-code comment on StateChange documents the trade-off.

Also make newly added comments threaded (allowing to resolve), when
the document is PDF.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I88e2bbe1202ada7b2e21a3ed90f2eb28760dcd6f
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1455
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 72a729882982ebf29cbbc5bdf5000621b53b2d8a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207212
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-06-28 13:38:25 +02:00
Mike Kaganski 73df128943 Use osl::File methods to remove / rename, instead of C functions
Makes it safer (encoding-wise) on our side (even though afdko itself
is unsafe, using that standard library API internally).

Change-Id: I130aab793784a5e127c867fe513149212c485e6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201596
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 718d4adc39f0d6c0f5f0af1c4c8d1b603f5652cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207284
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-26 00:04:08 +02:00
Mike Kaganski 5f28a317f4 Move command line creation into '#if USE_AFDKO_PROGRAMS'
They were added in commit 9e18540c73
(implement system afdko, 2025-11-04).

Change-Id: I09974c120d3e6128b3420750bb01939e655b6402
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201595
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 3058edc8c2b81cdfbdb0e41b51ae0b2abf2a476f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207283
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-25 18:28:17 +02:00
Mike Kaganski c64fc39bf3 Use NameContainer's owner as event source
The owner is set since commit 0f3f371028
(NameContainer need not be an UNO object itself, 2024-12-01), and is
the same object that was used to set event source. Drop the redundancy.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ie6d50696781395136349ad8084653e624437533d
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5026
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 6a5646b1abcdc9e61cf9b5ca42d65280bc520b39)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207165
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-23 17:21:33 +02:00
Mike Kaganski db79242098 svx, sd: add threaded fields to Draw annotation model
Extend sdr::annotation::Annotation and AnnotationData with m_Threaded,
m_Resolved, and m_ParentId so a Draw annotation can carry a reply/resolve
relationship. The three fields are propagated by toData / fromData and
by sd::Annotation::clone; when IsThreaded() is true they are emitted
from Annotation::ToJSON and SdXImpressDocument::getPostIts under the
same keys (threaded, resolved, parentId) that ScModelObj::getPostIts
already uses for Calc.

The fields will be used by the PDF filter (follow-up commits) and left
at their defaults elsewhere; ODP, PPTX and ODF exporters are unchanged
and continue to ignore them. Support for [MS-PPTX] extensions [1] for
comments that introduce state and replies is not in the scope of this
patch series.

[1] https://learn.microsoft.com/en-us/openspecs/office_standards/ms-pptx/161bc2c9-98fc-46b7-852b-ba7ee77e2e54

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I49594e1e4698bfd541f4c5041362a52b675683fd
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1454
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit bbde910405829527c92c406a82f75743bc4416c2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207199
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-06-23 17:16:44 +02:00
Mike Kaganski 6601fe8419 cool#15956: keep insertion order in NameContainer's getElementNames
This is required to keep content of Basic/script-lc.xml and each
Basic/<lib>/script-lb.xml byte-identical on round-trip, which is
necessary for signatures to stay valid; this broke after commit
ea2a974386 (Simplify NameContainer,
2024-12-01).

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ib30b701dce8bbcb919c88f5b66f5134150ded575
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5025
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit bfe67bc782cf89e944324042c8e53c42f4b6421b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207164
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-23 16:48:18 +02:00
Mike Kaganski 197c836739 Set modified flag and register undo for InsertThreadedComment
Calc's .uno:InsertThreadedComment slot mutated the note model directly
(GetOrCreateNote, SetText, SetThreadedCommentData, KitCommentNotify) and
never set the document-modified flag, so SFX did not broadcast
.uno:ModifiedStatus. The handler also did not register undo, so the
insert could not be rolled back. The same handler dropped the
SvtUserOptions fallback when the Author arg was passed but empty (the
ternary checked has-arg, not non-empty-value), letting the author land
as "Unknown Author" instead of the per-view WOPI UserFriendlyName.

Mirror ScDocFunc::ReplaceNote: a new InsertThreadedCommentOperation
runs inside ScDocShellModificator, releases any existing note (rescuing
its ScNoteData and a clone of its threaded payload), creates the new
note, builds the threaded payload plus the person-list entry, registers
ScUndoReplaceNote, and does the necessary finalizing calls. The author
resolution now uses the default-then-fallback chain so an empty Author
arg still routes through SvtUserOptions before the catch-all.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I42304b9467e8b290316b0fa8ba3c80c8fc0d9c35
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4142
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit d0935091c608f7184d00669b85f98e5b4b5fe1b4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207111
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-23 09:55:02 +02:00
Mike Kaganski ae87e35826 cool#15942: consider last-in-cell line's lower space when joining to precede
When a cell spans across pages, and its text has a "below paragraph" spacing,
that spacing is included into the last follow text frame's bottom margin, not
into precede's. Reformat will check if the follow text could be joined back;
and in that check, it checked if the space available on the previous page was
enough for text height plus the existing bottom margin of the precede. That
could lead to oscillation, when the following join would add the spacing to
the precede, and then the frame became too tall, causing split; in the end,
a loop guard would stop the layout and produce inconsistent result.

This change takes the lower spacing into account. To check that the line is
indeed the last line in cell, it uses a call to GetIndNext(), as already done
in other places. This is only an approximation: GetIndNext() returns the next
sibling within the same cell frame, so it cannot see a following paragraph
that has moved wholly to a later page. It seems acceptable: it is likely that
if a line from the following page will fit to the previous one, then its next
paragraph's line (if any) already were on the same page as that line.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ifc3b9487a85fdd373c92187064b99ebfb65b68a4
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4733
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 459f7b6e4c532cf7abd2acb3975e380b90bdc5a0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206995
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-19 16:47:26 +02:00
Mike Kaganski 2851604e32 Clarify expected values
The expression calculates needed narrow blanks, after wide blanks
were calculated. The calculation assumes narrow blank 1/4th of a
wide blank; the possible result is 0 to 3.

Also: drop the variable for 0.5, used once. The operation here is
"multiply by 2"; using "divide by 0.5" for that is confusing, and
unless there is some rationale behind that (like IEEE-754-specific
details giving different results here), better use simpler form.
In this case, the variable came from commit
074f0ab1d7 (tdf#76296 Import MathML's
<mspace>, 2016-11-15), and back then, it was Fraction; there seems
to be no specific need for division here.

Change-Id: I0260580023af005efb00eaba06ab6497cc269d43
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1111
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1169
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit ccf247612e1cfaaf7cd53f250f4a2719a10fa524)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206654
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-16 01:22:52 +02:00
Mike Kaganski 73309dca77 Fix Windows build of python3
Seen on my VS2026 build:

 "C:\lo\online.build\workdir\UnpackedTarball\python3\PCBuild\pcbuild.sln" (Build target) (1) ->
 "C:\lo\online.build\workdir\UnpackedTarball\python3\PCBuild\pythonw_uwp.vcxproj" (default target) (42) ->
 (ClCompile target) ->
   C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.51.36231\include\experimental\coroutine(37,1): error C2338: static assertion failed: 'error STL1011: The /await compiler option, <experimental/coroutine>, <experimental/generator>, and <experimental/resumable> are deprecated by Microsoft and will be REMOVED SOON. They are superseded by the C++20 <coroutine> and C++23 <generator> headers. You can define _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS to suppress this error for now.' [C:\lo\online.build\workdir\UnpackedTarball\python3\PCBuild\pythonw_uwp.vcxproj]

Use CL env variable to pass the define through MSBuild to cl.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Id9658290bfcd52150e5e1465a8c3f7e7e84de886
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2647
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 2157c69794264ff0567c7327509fb1a2d4fc5cb6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206340
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-11 09:02:00 +02:00
Mike Kaganski 1614a4e1ee cool#15754: Fix PPTX round-trip of empty picture placeholders
An empty picture placeholder on a slide used to export as <p:pic>
with the internal "Insert Image" icon embedded as
<a:blipFill><a:stretch/>, which PowerPoint stretched across the
whole slide. Emit it as <p:sp> with <p:ph type="pic"/> and an empty
<p:spPr/> so geometry, fill and any custGeom from the layout get
inherited.

The layout-side <p:ph type="pic"/> used to be mapped to a
presentation.OutlinerShape and re-exported as <p:ph type="body"/>,
breaking slide-side inheritance on round-trip (the slide's
<p:ph type="pic"/> couldn't find a matching pic placeholder on the
layout and ended up 0x0 and invisible). Map XML_pic to
presentation.GraphicObjectShape on layouts too, matching the slide.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ie21f7dfe6822b8ddf00a443c523db89d926dcadc
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3068
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 73f1e76b1760d4e936aa22627623c922dcda964b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205693
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-26 09:02:07 +02:00
Mike Kaganski 315349828a Fix --enable-werror gcc build on Linux
Commit 8ed30e4a243a3efdfe380852d20910bc4a02e181 (Move ToolboxController
to use OPropertyContainerImplHelper, 2026-04-10) introduced cases similar
to the problem handled in commit 3917b082b9f4530d305cd947ab47658f6883c4f1
(Fix --enable-werror gcc build on Linux, 2026-04-09).

In file included from /home/mk/core/framework/inc/uielement/complextoolbarcontroller.hxx:28,
                 from /home/mk/core/framework/inc/uielement/comboboxtoolbarcontroller.hxx:24,
                 from /home/mk/core/framework/source/uielement/comboboxtoolbarcontroller.cxx:20:
/home/mk/core/include/svtools/toolboxcontroller.hxx:86:31: error: ‘virtual void svt::ToolboxController::disposing(const com::sun::star::lang::EventObject&)’ was hidden [-Werror=overloaded-virtual=]
   86 |         virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
      |                               ^~~~~~~~~
/home/mk/core/framework/inc/uielement/comboboxtoolbarcontroller.hxx:44:22: note:   by ‘virtual void framework::ComboboxToolbarController::disposing(std::unique_lock<std::mutex>&)’
   44 |         virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
      |                      ^~~~~~~~~

Change-Id: Ic41be4d39b032864c3427d17a85502e36f31dce9
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/757
Reviewed-by: Justin Luth <justin.luth@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit e95308f8dc2e5c1088686eaa1552126eea9745d0)
(cherry picked from commit d6a555ec61272006e801764dd46a493bbbf3e90a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205689
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-26 00:41:16 +02:00
Mike Kaganski bce4bc55f9 Move ToolboxController to use OPropertyContainerImplHelper
Quite a large inheritance chain, which all needed replace dispose
with disposing, and make sure the locking is correct.

Introduce comphelper::unique_unlock, RAII class for scoped release
of std::unique_lock, to help ensure the invariant established in
commit 4fc1ab0ca8d9bb0f0b8344d0537882aab1d6d2c0 (add assert to keep
WeakComponentImplHelperBase::disposing callees honest, 2026-04-04).

Change-Id: I72c98c25c01b8042428ef2376c6aba3c6b15ec87
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/248
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 8ed30e4a243a3efdfe380852d20910bc4a02e181)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205688
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-26 00:41:07 +02:00
Mike Kaganski 79ec708230 Fix --enable-werror gcc build on Linux
... after changes that introduced and used OPropertyContainerHelper.

In file included from /home/mk/core/include/comphelper/propcontainerimplhelper.hxx:18,
                 from /home/mk/core/sc/inc/chartuno.hxx:34,
                 from /home/mk/core/sc/source/ui/unoobj/cellsuno.cxx:83:
/home/mk/core/include/comphelper/propcontainerimplhelper.hxx: In instantiation of ‘class comphelper::OPropertyContainerImplHelper<comphelper::WeakComponentImplHelper<com::sun::star::table::XTableChart, com::sun::star::document::XEmbeddedObjectSupplier, com::sun::star::container::XNamed, com::sun::star::lang::XServiceInfo>, ScChartObj>’:
/home/mk/core/sc/inc/chartuno.hxx:98:14:   required from here
   98 |       public SfxListener
      |              ^~~~~~~~~~~
/home/mk/core/include/comphelper/propimplhelper.hxx:499:1: error: ‘com::sun::star::uno::Any comphelper::OPropertyImplHelper<BaseClass, Ifc>::getFastPropertyValue(sal_Int32) [with BaseClass = comphelper::WeakComponentImplHelper<com::sun::star::table::XTableChart, com::sun::star::document::XEmbeddedObjectSupplier, com::sun::star::container::XNamed, com::sun::star::lang::XServiceInfo>; Ifc = {}; sal_Int32 = int]’ was hidden [-Werror=overloaded-virtual=]
  499 | OPropertyImplHelper<BaseClass, Ifc...>::getFastPropertyValue(sal_Int32 nHandle)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mk/core/include/comphelper/propcontainerimplhelper.hxx:66:10: note:   by ‘void comphelper::OPropertyContainerImplHelper<BaseClass, Derived, Ifc>::getFastPropertyValue(std::unique_lock<std::mutex>&, com::sun::star::uno::Any&, sal_Int32) const [with BaseClass = comphelper::WeakComponentImplHelper<com::sun::star::table::XTableChart, com::sun::star::document::XEmbeddedObjectSupplier, com::sun::star::container::XNamed, com::sun::star::lang::XServiceInfo>; Derived = ScChartObj; Ifc = {}; sal_Int32 = int]’
   66 |     void getFastPropertyValue(std::unique_lock<std::mutex>&, css::uno::Any& rValue,
      |          ^~~~~~~~~~~~~~~~~~~~

and

/home/mk/core/chart2/source/tools/CachedDataSequence.cxx: In copy constructor ‘chart::CachedDataSequence::CachedDataSequence(const chart::CachedDataSequence&)’:
/home/mk/core/chart2/source/tools/CachedDataSequence.cxx:70:51: error: expected class-name before ‘(’ token
   70 |         : comphelper::OPropertyContainerImplHelper(),
      |                                                   ^
/home/mk/core/chart2/source/tools/CachedDataSequence.cxx:69:1: error: base class ‘class comphelper::OPropertyContainerImplHelper<comphelper::WeakComponentImplHelper<com::sun::star::chart2::data::XDataSequence, com::sun::star::chart2::data::XNumericalDataSequence, com::sun::star::chart2::data::XTextualDataSequence, com::sun::star::util::XCloneable, com::sun::star::util::XModifyBroadcaster, com::sun::star::lang::XInitialization, com::sun::star::lang::XServiceInfo>, chart::CachedDataSequence>’ should be explicitly initialized in the copy constructor [-Werror=extra]
   69 | CachedDataSequence::CachedDataSequence( const CachedDataSequence & rSource )
      | ^~~~~~~~~~~~~~~~~~

and similar.

Change-Id: I913e139744a452ea992d9f574997353a760f4722
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/642
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 3917b082b9f4530d305cd947ab47658f6883c4f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205669
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:34:21 +02:00
Mike Kaganski 350c6c5333 Drop OPropertyContainer2
Unused since I4e54547df46feed01613ebe0766c53be3c06de17 (Move EventListener
to use OPropertyContainerImplHelper).

Change-Id: Iad4efd1df433c77f4a5df20caa7a7b35558ab7e5
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/247
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 51be9cb71c55b72b61720c38295a62b127c83290)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205668
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:34:09 +02:00
Mike Kaganski 85e3e0facd Move EventListener to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: I4e54547df46feed01613ebe0766c53be3c06de17
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/246
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 5368ec1c2b6a1d67f4b23c2ce75482993ca263f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205665
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:33:55 +02:00
Mike Kaganski d59fed102e Move BasicScriptImpl to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: I5ec16fee95fa7180e8551b7eeca3d80b829e044b
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/245
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 834e3df39cf1abe87957f9a589916fb90783ec37)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205664
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:33:46 +02:00
Mike Kaganski ca02ecc4f6 Move BasicMethodNodeImpl to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: Idf7ca45d428c09ad18c6af2663f18f306a14bad1
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/244
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 122cecfefb8302f43d4dc6fa8911b96c4d18be3c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205663
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:33:29 +02:00
Mike Kaganski 5d046e926f Move OCellListSource to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: Ib46e35f8ab3293b9ea4c081fcc50848390ef7b6e
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/243
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit dd1eeedd23e18a26850e6ad5b331747db7875899)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205640
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:33:24 +02:00
Mike Kaganski 473fa49632 Move OCellValueBinding to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: I5b27255026c61b5b91ad84befbb094c185dd2ff4
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/242
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit b6a8b72a6bbd0dd98852f07c322be45649a2a285)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205639
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:33:19 +02:00
Mike Kaganski af25b2836c Move SwarmSolver to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: Icc1b4fa10d963b99c2ca82898ea7555a1d00a147
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/240
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit ef6225edad6b277b112901091e4437c7a9ad8914)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205662
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:33:14 +02:00
Mike Kaganski 2197da017d Move SolverComponent to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: I0c7e0f81163da04f9186401b22b1b852629f5cce
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/239
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 86fa394c6ab19dd071d518ea59d2518000a7f693)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205661
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:33:08 +02:00
Mike Kaganski 084e6e1ac7 Move ODatabaseMetaDataResultSet to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: Ic3b0d27178ba730144afadbab9a15b40719320d8
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/238
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit ed7d521ba17e11d281e1819078423897c349b5f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205660
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:33:03 +02:00
Mike Kaganski f54986e41f Move ScChartObj to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: If9170d5356156e3f23f3ef2ca4e8d8d7ccbd8f47
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/237
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit ab16841ac4ced45d8611866a300f8d6bf38d6d33)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205638
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:32:58 +02:00
Mike Kaganski f138be4686 Move UncachedDataSequence to use OPropertyContainerImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: I6746c75ac6a884db525defeb25557d4e8d6f3d03
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/236
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit a0ff800a69ccb7898043c294ba9a13016f176a58)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205659
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:32:53 +02:00
Mike Kaganski 31fecb70d0 Introduce OPropertyContainerImplHelper as replacement for OPropertyContainer2
Combines OPropertyImplHelper with OPropertyContainerHelper and
OPropertyArrayUsageHelper. Derived classes only need to implement
createArrayHelper() and call registerProperty().

Migrate CachedDataSequence to use it.

Change-Id: I7c9077f412303ab3ba4d2541c2b6673813193d5a
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/235
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 480f2837def56b24b0c3b50dcd559dc785b59631)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205658
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:32:47 +02:00
Mike Kaganski 38ad50ebf4 Move OXSDDataType to use OPropertyImplHelper
Simplifies the implementation, removing boilerplate.

Change-Id: I56942a0b847995d680f65387b314c6eb27199198
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/241
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit dbb5e6bcd8e8edb3ed3346fb331cb6d38f1f5252)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205666
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-25 14:32:41 +02:00
Mike Kaganski 852d2107bc Introduce OPropertyImplHelper as a replacement for OPropertySetHelper
It is intended to work conveniently with cppu::ImplInheritanceHelper,
without XInterface diamond and without a need to write queryInterface/
getTypes/acquire/release boilerplate.

Migrate PathSettings as first user.

+ try to please gcc13 by calling reserve before insert

Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/234
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit e7d0265cbf6219e8b111dd0f98bf293d66bbba97)
Change-Id: I11e6f2d63dbe751fd3acca4ade34f8511775ee47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205649
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-25 11:47:15 +02:00
Mike Kaganski 61e749ba2a Fix ThreadedCommentsFragment::onCharacters to handle multiple calls
... per characters content, as is usual for SAX parsing.
Thanks Miklos for spotting this in
https://gerrit.collaboraoffice.com/c/core/+/801/comment/9e3a60ba_b69d538f/

Change-Id: Iabfb44dcd56364b708f0c933c7cd32a9a11ebaf4
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/911
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 4c475432ca1c001d1d041b47595f6ec7c58e87fa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205633
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-05-25 09:02:09 +02:00
Mike Kaganski 6116db6154 Introduce OPropertyImplHelper as a replacement for OPropertySetHelper
It is intended to work conveniently with cppu::ImplInheritanceHelper,
without XInterface diamond and without a need to write queryInterface/
getTypes/acquire/release boilerplate.

Migrate PathSettings as first user.

Change-Id: Ieee0e3bf8ec8313a19e1475375c4007977fef08f
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/234
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit e7d0265cbf6219e8b111dd0f98bf293d66bbba97)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205218
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-25 09:01:36 +02:00
Mike Kaganski 93c9d17c5a Add core-side unit test for Calc threaded comments
... after commit 894a2346a3fd37f9404147137f6bc5fe94c2fc99 (sc: COKit
support for resolving and inserting Calc threaded comments, 2026-04-14).

Change-Id: Ida1b107265aa2998e04a9ffb612c3b487f92a57f
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/934
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 46e68ccc4baf4ff1ce4181bf4399f87220be40c4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205475
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-05-21 15:27:45 +02:00
Mike Kaganski b916aae469 sc: COKit support for resolving and inserting Calc threaded comments
Add SID_INSERT_THREADED_COMMENT slot (.uno:InsertThreadedComment) and
SID_RESOLVE_THREADED_COMMENT slot (.uno:ResolveComment) to the Calc cell
shell. The insert handler creates a note with ScThreadedCommentData,
generates a random GUID for the comment and a deterministic UUID v5
(SHA-1, RFC 4122) for the person entry. The resolve handler toggles the
resolved state.

Include "threaded" and "resolved" fields in the COKit comment JSON
payload; when COKit is active, send the actual threaded root text
instead of the legacy fallback.

Rename .uno:InsertAnnotation label to "Insert Note" in Calc, and add
.uno:InsertThreadedComment as "Insert Comment" — matching Excel's
terminology where Notes are the old-style and Comments are threaded.

The unit test for this is on the Online side (cypress).

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I398ee844d8706626eb859447021c4d4630d48631
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/804
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 894a2346a3fd37f9404147137f6bc5fe94c2fc99)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205352
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-20 09:45:48 +02:00
Mike Kaganski 27584318ae Fix MSVC 14.51 build of breakpad
C:/lo/online.build/workdir/UnpackedTarball/breakpad/src/client/windows/crash_generation/minidump_generator.cc(180): error C2653: 'stdext': is not a class or namespace name
 C:/lo/online.build/workdir/UnpackedTarball/breakpad/src/client/windows/crash_generation/minidump_generator.cc(180): error C2059: syntax error: '>'
 make[1]: *** [C:/lo/online/engine/solenv/gbuild/LinkTarget.mk:398: C:/lo/online.build/workdir/GenCxxObject/UnpackedTarball/breakpad/src/client/windows/crash_generation/minidump_generator.o] Error 2

As documented at https://learn.microsoft.com/en-us/cpp/porting/features-deprecated-in-visual-studio,
the class checked_array_iterator is dropped in MSVC 14.51 (it was deprecated since VS 2022 17.8).

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I29ad7dcf10a6ccc79e66dd21a96d80a69d8f0f99
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2683
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 2450d80b2790bd47c534bdf45e0e839839e9cf64)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205370
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-05-19 20:29:20 +02:00
Mike Kaganski a9026d4d17 xmloff, sc: ODS import/export of threaded comment data
Store the full threaded comment data as loext: extension elements inside
office:annotation: root text, GUID, person-id, datetime, resolved flag,
and replies. The person list is written as a separate loext:persons
element at the spreadsheet body level, referenced by person-id from
each annotation.

The loext:resolved attribute on office:annotation is not used for Calc
annotations, since resolving only applies to threaded comments; the
flag is an attribute on loext:threaded-comment instead.

Extend the libreoffice ODF schema with loext:threaded-comment,
loext:reply, loext:persons, and related attributes. Add xmloff tokens
for the new element and attribute names.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ibdb6cca545c853b196a8ec234b26542d392967bb
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/803
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 8cddb66d12942025e223d0d54f6bca03ac3b7f94)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205296
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-19 09:28:04 +02:00
Mike Kaganski f31a5ce377 oox, sc: export xlsx threaded comments and persons
Write xl/threadedComments/threadedComment*.xml per sheet and
xl/persons/person.xml at the workbook level. Add Relationship enum
entries for THREADEDCOMMENT and PERSON. Link the legacy <comment> to its
threaded counterpart via the guid attribute. Use sax_fastparser::UseIf
for optional attributes.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I53ac1e4ce761956201d09cf96376a79b6d041e1b
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/802
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit cfdad0c5ad529ecbfef4237850dbfa31ac0e4937)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205295
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-19 09:27:53 +02:00
Mike Kaganski d6611c3ccc oox, sc: import xlsx threaded comments and persons
Register the threadedcomments namespace and tokens in oox. Add
PersonsFragment (workbook-level) to import xl/persons/person.xml and
ThreadedCommentsFragment (worksheet-level) to import
xl/threadedComments/threadedComment*.xml. The fragment runs after
CommentsBuffer::finalizeImport() so that ScPostIt objects already exist;
it attaches ScThreadedCommentData with root text, reply chain, and
resolved flag to matching notes. Both the legacy fallback text and the
actual threaded comment text are preserved in the document model.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I0a47c74dc31ae8bb008d2a8da76a97ae3957dcc0
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/801
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 205ea7e4fb13b18b1940f287f4cbad60c8aee9cc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205294
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-19 09:27:46 +02:00
Mike Kaganski 5ab6a58968 sc: add threaded comment data model for Calc annotations
Add ScThreadedCommentData, ScThreadedCommentEntry, and ScPersonData
structs to support the Excel "threaded comments" feature ([MS-XLSX]
sections 2.3.7, 2.6.205). ScPostIt gains an optional
mpThreadedCommentData member with IsResolved()/SetResolved() accessors
for the "done" flag, and ScDocument gains a person list (AddPerson,
GetPersonById). Clone() preserves threaded data in both code paths.

This is the document model foundation for comment resolution in Calc;
import/export/LOK/Online follow separately.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ic782f9126c38088292b068066ba0de3889563531
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/800
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 3f8cd9c6ab6738a434788cb9280373413a0b7205)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205293
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-19 09:27:39 +02:00
Mike Kaganski ff6dea0a32 Move DynCastFlyAtContentFrame to SwAnchoredObject
Allows to simplify the repeated "first cast to SwFlyFrame, then to
SwFlyAtContentFrame" pattern.

Change-Id: Ia89e2591e818a2466e4d134602ade305a696535e
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/205
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 7a4df69e327a88223b35d2ad83e9590b90243bd5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205268
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-05-18 09:43:31 +02:00
Mike Kaganski 84759dfd69 cool#15338: floattable: make sure to initiate move-to-next-page or split
In this case, a floating table had too large row height to fit on page;
an attempt to split failed, but the table didn't move to the next page,
because the height of the fly was limited to the bottom of the page, so
fitted.

This change adds a special handling of the anchor frame for floating
tables. When the floating table is too high (taller than its fly, which
is limited to the page's available space), the anchor height itself is
increased to match the table height. This would initiate a split of the
frame, or its move to the next page, as appropriate.

This fixes both the hang in testSplitFlyInTextSection, and its layout.

Change-Id: I8d2353a6b978fcf885d409726377b59a37ada435
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/164
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 2396da33a195e9f4468377fa9c44c24f2bf74157)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205208
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-05-15 08:30:33 +02:00
Mike Kaganski 5062e5faaf cool#15331: add a unit test
Change-Id: I31f0618717ac7c54bde598bf08653b33dc7a807f
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/204
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 170391fc3cf26c48647681cb7a5d9f861df99309)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203635
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-04-16 08:57:42 +02:00
Mike Kaganski d7b5a9deea cool#15331: use follow frame with actual reference to SwParaPortion
Split floating tables (or rather, their flys) anchor to a single split
paragraph (so there is a sequence of follows), where the whole content
of the anchor paragraph is in the last follow frame. All the previous
text frames have empty m_xParaPortion.

SwTextIter requires a frame with non-empty m_xParaPortion.

SwEditShell::GetCurWord gets current cursor, then its point's node;
and finally, the node's layout frame - the first in the sequence. This
commit avoids the crash by getting the correct follow frame.

Change-Id: I8bf0025144642127057c0bdeab0a4dfcd798c261
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/48
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit ae632b50ef91d64a8aa84b9c9c80d8217e4d8e50)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203634
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-04-16 08:57:35 +02:00
Mike Kaganski 8a5f3cc219 Simplify a bit
Change-Id: Iec41c755f76e39a7e15eab9dd1821aa6e9533794
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202645
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit d8532c689593bc0ab8f9fcdf5538b8875fff475b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202668
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-25 20:49:11 +01:00
Mike Kaganski 646e8af7a3 Don't claim XComponent for WeakImplHelper
Likely a copypasta from WeakComponentImplHelper

Change-Id: I6263487a22593c6b97844d46de2c2f15ab6d0029
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202646
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit c509bbbb99d696ff8c918c74075324ce4fa6c55a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202669
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-25 15:46:47 +01:00
Mike Kaganski f5e3ba8714 Drop WeakImplHelperBase::queryInterface
It did nothing that the inherited method wouldn't do.

Change-Id: Ifc796723149c3d6b4823795c81af69ac79254bbc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202597
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-24 18:16:47 +01:00
Mike Kaganski 165a0990a0 Use comphelper::WeakImplHelper in AnimationNode
Simplifies the implementation a bit.

Change-Id: Idd63f0447b2362e29d29a4d99749205053e0b29f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202596
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-24 16:55:01 +01:00
Mike Kaganski e1ace8b26a tdf#163343: ignore smil:keyTimes when smil:values is empty/missing
This is safe to ignore both, when one of them empty, as opposed to a
case when both are non-empty, but have different number of elements.
Allows to read some broken real-life documents.

A possible TODO: maybe consider to warn about a broken package, and
only open in repair mode?

Change-Id: I0697dcc73933aa1761ba59a766a519965872a0ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202552
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-24 10:14:45 +01:00
Mike Kaganski 31820f4fbc tdf#165348: release the lock on original file before clearing URL
Commit 92e7f28f9a (Related: tdf#104718
Use package repair request and behavior, 2023-11-29) made repaired
documents behave like templates, requiring user to explicitly choose
a name on save.

Since switching to template mode happens in this case rather late in
the loading procedure, at this point, lock file is already created
for the original file. Switching to template mode clears media URL;
and after that, media can't remove the lockfile.

This change releases the lock (and removes the lockfile) prior to
clearing URL.

Change-Id: Ibd4794e2b82dc8e1b1c96e22fa2089b9dd597744
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202521
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-24 09:50:11 +01:00
Mike Kaganski e39a2d201e tdf#134614: defer closing TOC field after the last contained \par
When EndTOX() closed the TOC field during the last paragraph's run, the }}}
went into m_aRunText and ended up before \par, putting the \par outside the
field result. Word then ignored paragraph properties for that last paragraph.

This change defers outputting the closing braces until after \par is written.

Change-Id: I6d7ab3b516e725938fc2151f8ec4f4b834f33068
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202379
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-23 15:46:12 +01:00
Mike Kaganski 55c62bf611 tdf#145542: DOCX export: also handle rotated+stretched case
Commit Ic9da5b2f8b47818a47e03cac620440108e0ca595 handled the non-rotated case
by using LayoutSize instead of the Size property. But for images that are both
rotated AND scaled (e.g., relative width + rotation), Size still gave the
unstretched unrotated dimensions — wrong for both wp:extent and a:xfrm/a:ext.

Derive the scale factor from the bounding box (LayoutSize), the unscaled size
(Size property), and the rotation angle. Get the stretched-but-unrotated size
scaling Size by it. This handles all three cases.

There is some difference how rotated+scaled objects are layed out by Writer
and Word. This change improves the export to DOCX, but not perfectly.

Change-Id: I013659d324b9f3e9f5f2e9ee737544ea5610bd17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202408
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-23 14:00:56 +01:00
Mike Kaganski b0e71064d1 tdf#145542: DOCX export: use layout size for non-rotated images
The fix for tdf#138953 changed the DOCX image export to always use the
UNO Size property (unrotated dimensions) instead of the frame LayoutSize.
This is correct for rotated unstretched images, where LayoutSize includes
the rotation bounding box. But for non-rotated images where Size differs
from LayoutSize (e.g., frames with style:rel-width="100%" imported from
HTML or saved by older LO versions), it used the unstretched size, giving
wrong image size.

Only use the Size property when the image is actually rotated.

Note: if an image is both rotated AND scaled, Size still gives the wrong
(unstretched unrotated) dimensions. The correct fix for that case would
require deriving the scale factor from Size, LayoutSize, and the rotation
angle.

Change-Id: Ic9da5b2f8b47818a47e03cac620440108e0ca595
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202386
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-23 08:16:06 +01:00
Mike Kaganski f798d1ef8e Use enum to clarify meaning of constants
Not enum class, to minimize the change

Change-Id: I62ec6f57a05db2f8edf1ced718533aec5826b47b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202365
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-23 05:35:17 +01:00
Mike Kaganski 7bdc993668 tdf#170961: Make sure to redraw dialog after its recreation
Also move the functions eventually calling VCL operations (ResetDialog,
Invalidate) to main thread.

Change-Id: I532052fab2c58e732ca0591c567d54fe1d468a75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202300
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-22 11:59:20 +01:00
Mike Kaganski 3dc55faf9b tdf#170961: Don't hold mutex when calling component's setPropertyValue
A deadlock seen with the following call stacks.

Main thread is trying to paint in a timer event, and is waiting for
the FormComponentPropertyHandler's mutex:

  ntdll.dll!NtWaitForAlertByThreadId()
  ntdll.dll!RtlpWaitOnCriticalSection()
  ntdll.dll!RtlpEnterCriticalSectionContended()
  ntdll.dll!RtlEnterCriticalSection()
  sal3.dll!osl_acquireMutex(_oslMutexImpl * Mutex) Line 65
  pcrlo.dll!osl::Mutex::acquire() Line 63
  pcrlo.dll!osl::Guard<osl::Mutex>::Guard<osl::Mutex>(osl::Mutex & t) Line 144
• pcrlo.dll!pcr::FormComponentPropertyHandler::getPropertyValue(const rtl::OUString & _rPropertyName) Line 307
  pcrlo.dll!pcr::OPropertyBrowserController::impl_getPropertyValue_throw(const rtl::OUString & _rPropertyName) Line 907
  pcrlo.dll!pcr::OPropertyBrowserController::propertyChange(const com::sun::star::beans::PropertyChangeEvent & _rEvent) Line 661
  cppuhelper3MSC.dll!cppu::OPropertySetHelper::fire(long * pnHandles, const com::sun::star::uno::Any * pNewValues, const com::sun::star::uno::Any * pOldValues, long nHandles, unsigned char bVetoable) Line 733
  comphelper.dll!comphelper::OPropertySetAggregationHelper::propertiesChange(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> & _rEvents) Line 420
  cppuhelper3MSC.dll!cppu::OPropertySetHelper::firePropertiesChangeEvent(const com::sun::star::uno::Sequence<rtl::OUString> & rPropertyNames, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertiesChangeListener> & rListener) Line 961
  tklo.dll!ControlContainerBase::ImplUpdateResourceResolver() Line 1698
  tklo.dll!ControlContainerBase::ImplStartListingForResourceEvents() Line 1675
  tklo.dll!ControlContainerBase::setModel(const com::sun::star::uno::Reference<com::sun::star::awt::XControlModel> & rxModel) Line 1428
  tklo.dll!UnoDialogControl::setModel(const com::sun::star::uno::Reference<com::sun::star::awt::XControlModel> & rxModel) Line 348
  svxcorelo.dll!sdr::contact::`anonymous namespace'::ControlHolder::setModel(const com::sun::star::uno::Reference<com::sun::star::awt::XControlModel> & _m) Line 186
  svxcorelo.dll!sdr::contact::ViewObjectContactOfUnoControl_Impl::createControlForDevice(const sdr::contact::`anonymous-namespace'::IPageViewAccess & _rPageView, const OutputDevice & _rDevice, const SdrUnoObj & _rUnoObject, const basegfx::B2DHomMatrix & _rInitialViewTransformation, const basegfx::B2DHomMatrix & _rInitialZoomNormalization, sdr::contact::`anonymous-namespace'::ControlHolder & _out_rControl) Line 1097
  svxcorelo.dll!sdr::contact::ViewObjectContactOfUnoControl_Impl::impl_ensureControl_nothrow(const sdr::contact::`anonymous-namespace'::IPageViewAccess & _rPageView, const OutputDevice & _rDevice, const basegfx::B2DHomMatrix & _rInitialViewTransformation) Line 1037
  svxcorelo.dll!sdr::contact::ViewObjectContactOfUnoControl_Impl::ensureControl(const basegfx::B2DHomMatrix * _pInitialViewTransformationOrNULL) Line 963
  svxcorelo.dll!sdr::contact::`anonymous namespace'::LazyControlCreationPrimitive2D::create2DDecomposition(const drawinglayer::geometry::ViewInformation2D & _rViewInformation) Line 1539
  drawinglayercorelo.dll!drawinglayer::primitive2d::BufferedDecompositionPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor, const drawinglayer::geometry::ViewInformation2D & rViewInformation) Line 79
  svxcorelo.dll!sdr::contact::`anonymous namespace'::LazyControlCreationPrimitive2D::get2DDecomposition(drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor, const drawinglayer::geometry::ViewInformation2D & _rViewInformation) Line 1523
  drawinglayerlo.dll!drawinglayer::processor2d::BaseProcessor2D::process(const drawinglayer::primitive2d::BasePrimitive2D & rCandidate) Line 43
  drawinglayerlo.dll!drawinglayer::processor2d::VclPixelProcessor2D::processBasePrimitive2D(const drawinglayer::primitive2d::BasePrimitive2D & rCandidate) Line 374
  drawinglayerlo.dll!drawinglayer::processor2d::BaseProcessor2D::process(const drawinglayer::primitive2d::Primitive2DContainer & rSource) Line 67
  svxcorelo.dll!sdr::contact::ObjectContactOfPageView::DoProcessDisplay(sdr::contact::DisplayInfo & rDisplayInfo) Line 303
  svxcorelo.dll!sdr::contact::ObjectContactOfPageView::ProcessDisplay(sdr::contact::DisplayInfo & rDisplayInfo) Line 128
  svxcorelo.dll!SdrPageWindow::RedrawLayer(const o3tl::strong_int<short,SdrLayerIDTag> * pId, sdr::contact::ViewObjectContactRedirector * pRedirector, const basegfx::B2IRange * pPageFrame) Line 422
  svxcorelo.dll!SdrPageView::DrawLayer(o3tl::strong_int<short,SdrLayerIDTag> nID, OutputDevice * pGivenTarget, sdr::contact::ViewObjectContactRedirector * pRedirector, const tools::Rectangle & rRect, const basegfx::B2IRange * pPageFrame) Line 304
  svxcorelo.dll!SdrPaintView::ImpFormLayerDrawing(SdrPaintWindow & rPaintWindow, sdr::contact::ViewObjectContactRedirector * pRedirector) Line 798
  svxcorelo.dll!SdrPaintView::EndCompleteRedraw(SdrPaintWindow & rPaintWindow, bool bPaintFormLayer, sdr::contact::ViewObjectContactRedirector * pRedirector) Line 653
  svxcorelo.dll!SdrPaintView::EndDrawLayers(SdrPaintWindow & rPaintWindow, bool bPaintFormLayer, sdr::contact::ViewObjectContactRedirector * pRedirector) Line 726
  basctllo.dll!basctl::DlgEditor::Paint(OutputDevice & rRenderContext, const tools::Rectangle & rRect) Line 547
  basctllo.dll!basctl::DialogWindow::Paint(OutputDevice & rRenderContext, const tools::Rectangle & rRect) Line 124
  vcllo.dll!PaintHelper::DoPaint(const vcl::Region * pRegion) Line 316
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 618
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!vcl::Window::ImplCallOverlapPaint() Line 645
  vcllo.dll!vcl::Window::ImplHandlePaintHdl(Timer * __formal) Line 668
  vcllo.dll!vcl::Window::LinkStubImplHandlePaintHdl(void * instance, Timer * data) Line 649
  vcllo.dll!Link<Timer *,void>::Call(Timer * data) Line 105
  vcllo.dll!Timer::Invoke() Line 75
  vcllo.dll!Scheduler::CallbackTaskScheduling() Line 615
  vcllo.dll!SalTimer::CallCallback() Line 53
  vclplug_winlo.dll!WinSalTimer::ImplHandleElapsedTimer() Line 169
  vclplug_winlo.dll!ImplSalYield(bool bWait, bool bHandleAllCurrentEvents) Line 443
  vclplug_winlo.dll!WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) Line 499
  vcllo.dll!InnerYield(bool i_bWait, bool i_bAllEvents) Line 389
  vcllo.dll!Application::Yield() Line 502
  vcllo.dll!Application::Execute() Line 365
  sofficeapp.dll!desktop::Desktop::Main() Line 1681
  vcllo.dll!ImplSVMain() Line 230
  vcllo.dll!SVMain() Line 249
  sofficeapp.dll!soffice_main() Line 122
  soffice.bin!sal_main() Line 51
  soffice.bin!main(int argc, char * * argv) Line 49
  soffice.bin!invoke_main() Line 79
  soffice.bin!__scrt_common_main_seh() Line 288
  soffice.bin!__scrt_common_main() Line 331
  soffice.bin!mainCRTStartup(void * __formal) Line 17
  kernel32.dll!BaseThreadInitThunk()
  ntdll.dll!RtlUserThreadStart()

while the worker thread is holding the mutex and is sending a message
to the main thread synchronously:

  win32u.dll!NtUserMessageCall()
  user32.dll!SendMessageWorker()
  user32.dll!SendMessageInternal(struct HWND__ *,unsigned int,unsigned __int64,__int64,int)
  user32.dll!SendMessageW()
  vclplug_winlo.dll!WinSalInstance::SendWndMessage_impl(HWND__ * hWnd, unsigned int Msg, unsigned __int64 wParam, __int64 lParam) Line 689
  vclplug_winlo.dll!WinSalInstance::SendComWndMessage(unsigned int Msg, unsigned __int64 wParam, __int64 lParam) Line 700
  vclplug_winlo.dll!WinSalFrame::ReleaseGraphics(SalGraphics * pGraphics) Line 1052
  vcllo.dll!vcl::WindowOutputDevice::ReleaseGraphics(bool bRelease) Line 905
  vcllo.dll!vcl::Window::dispose() Line 487
  vcllo.dll!ImplBorderWindow::dispose() Line 1614
  vcllo.dll!VclReferenceBase::disposeOnce() Line 38
  vcllo.dll!VclPtr<ImplBorderWindow>::disposeAndClear() Line 224
  vcllo.dll!ScopedVclPtr<ImplBorderWindow>::~ScopedVclPtr<ImplBorderWindow>() Line 351
  vcllo.dll!ScopedVclPtrInstance<ImplBorderWindow>::~ScopedVclPtrInstance<ImplBorderWindow>()
  vcllo.dll!Dialog::GetDrawWindowBorder(long & rLeftBorder, long & rTopBorder, long & rRightBorder, long & rBottomBorder) Line 1389
  tklo.dll!VCLXDialog::getInfo() Line 2302
  basctllo.dll!basctl::DlgEdForm::getDeviceInfo() Line 1642
  basctllo.dll!basctl::DlgEdObj::TransformFormToSdrCoordinates(long nXIn, long nYIn, long nWidthIn, long nHeightIn, long & nXOut, long & nYOut, long & nWidthOut, long & nHeightOut) Line 351
  basctllo.dll!basctl::DlgEditor::AdjustPageSize() Line 1182
  basctllo.dll!basctl::DlgEditor::SetDialog(const com::sun::star::uno::Reference<com::sun::star::container::XNameContainer> & xUnoControlDialogModel) Line 351
  basctllo.dll!basctl::DlgEditor::ResetDialog() Line 409
  basctllo.dll!basctl::DlgEdObj::_propertyChange(const com::sun::star::beans::PropertyChangeEvent & evt) Line 1147
  basctllo.dll!basctl::DlgEdPropListenerImpl::propertyChange(const com::sun::star::beans::PropertyChangeEvent & evt) Line 44
  cppuhelper3MSC.dll!cppu::OPropertySetHelper::fire(long * pnHandles, const com::sun::star::uno::Any * pNewValues, const com::sun::star::uno::Any * pOldValues, long nHandles, unsigned char bVetoable) Line 733
  comphelper.dll!comphelper::OPropertySetAggregationHelper::propertiesChange(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> & _rEvents) Line 398
  comphelper.dll!comphelper::OPropertySetHelper::fire(std::unique_lock<std::mutex> & rGuard, const long * pnHandles, const com::sun::star::uno::Any * pNewValues, const com::sun::star::uno::Any * pOldValues, long nHandles, bool bVetoable) Line 594
  comphelper.dll!comphelper::OPropertySetHelper::impl_fireAll(std::unique_lock<std::mutex> & rGuard, long * i_handles, const com::sun::star::uno::Any * i_newValues, const com::sun::star::uno::Any * i_oldValues, long i_count) Line 487
  comphelper.dll!comphelper::OPropertySetHelper::setFastPropertyValues(std::unique_lock<std::mutex> & rGuard, long nSeqLen, long * pHandles, const com::sun::star::uno::Any * pValues, long nHitCount) Line 748
  tklo.dll!UnoControlModel::setFastPropertyValueImpl(std::unique_lock<std::mutex> & rGuard, long nPropId, const com::sun::star::uno::Any & rValue) Line 1247
  comphelper.dll!comphelper::OPropertySetHelper::setFastPropertyValue(long nHandle, const com::sun::star::uno::Any & rValue) Line 393
  comphelper.dll!comphelper::OPropertySetAggregationHelper::setFastPropertyValue(long _nHandle, const com::sun::star::uno::Any & _rValue) Line 528
  cppuhelper3MSC.dll!cppu::OPropertySetHelper::setPropertyValue(const rtl::OUString & rPropertyName, const com::sun::star::uno::Any & rValue) Line 264
• pcrlo.dll!pcr::FormComponentPropertyHandler::setPropertyValue(const rtl::OUString & _rPropertyName, const com::sun::star::uno::Any & _rValue) Line 465
  pcrlo.dll!pcr::OPropertyBrowserController::Commit(const rtl::OUString & rName, const com::sun::star::uno::Any & _rValue) Line 1326
  pcrlo.dll!pcr::OBrowserListBox::valueChanged(const com::sun::star::uno::Reference<com::sun::star::inspection::XPropertyControl> & _rxControl) Line 637
  pcrlo.dll!pcr::PropertyControlContext_Impl::impl_processEvent_throw(const comphelper::AnyEvent & _rEvent) Line 291
  pcrlo.dll!pcr::PropertyControlContext_Impl::processEvent(const comphelper::AnyEvent & _rEvent) Line 272
  comphelper.dll!comphelper::AsyncEventNotifierBase::execute() Line 138
  comphelper.dll!comphelper::AsyncEventNotifier::execute() Line 155
  salhelper3MSC.dll!salhelper::Thread::run() Line 40
  salhelper3MSC.dll!threadFunc(void * param) Line 190
  sal3.dll!oslWorkerWrapperFunction(void * pData) Line 67
  ucrtbased.dll!thread_start<unsigned int (__cdecl*)(void *),1>(void * const parameter) Line 97
  kernel32.dll!BaseThreadInitThunk()
  ntdll.dll!RtlUserThreadStart()

In this case, there is no reason to hold the mutex so long. It is only
needed to get copies of the object state, so only lock the mutex for
that necessary time frame.

Change-Id: Iab8bedb901295a6936d85de1cfb20efa2ce8a4f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202299
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-22 11:59:13 +01:00
Mike Kaganski 114eaf82fd tdf#170961: unlock guard during UnoControl::createPeer
A deadlock seen with the following call stacks.

Main thread is trying to paint in a timer event, and is waiting for
the UnoControl's mutex:

  ntdll.dll!NtWaitForAlertByThreadId()
  ntdll.dll!RtlpWaitOnCriticalSection()
  ntdll.dll!RtlpEnterCriticalSectionContended()
  ntdll.dll!RtlEnterCriticalSection()
  sal3.dll!osl_acquireMutex(_oslMutexImpl * Mutex) Line 65
  tklo.dll!osl::Mutex::acquire() Line 63
  tklo.dll!osl::Guard<osl::Mutex>::Guard<osl::Mutex>(osl::Mutex & t) Line 144
• tklo.dll!UnoControl::getPosSize() Line 745
  tklo.dll!UnoDialogControl::getPosSize() Line 104
  svxcorelo.dll!sdr::contact::`anonymous namespace'::ControlHolder::getPosSize() Line 234
  svxcorelo.dll!sdr::contact::`anonymous namespace'::ControlHolder::setPosSize(const tools::Rectangle & _rPosSize) Line 220
  svxcorelo.dll!sdr::contact::UnoControlContactHelper::adjustControlGeometry_throw(const sdr::contact::`anonymous-namespace'::ControlHolder & _rControl, const tools::Rectangle & _rLogicBoundingRect, const basegfx::B2DHomMatrix & _rViewTransformation, const basegfx::B2DHomMatrix & _rZoomLevelNormalization) Line 316
  svxcorelo.dll!sdr::contact::ViewObjectContactOfUnoControl_Impl::positionAndZoomControl(const basegfx::B2DHomMatrix & _rViewTransformation) Line 940
  svxcorelo.dll!sdr::contact::ViewObjectContactOfUnoControl::isPrimitiveVisible(const sdr::contact::DisplayInfo & _rDisplayInfo) Line 1717
  svxcorelo.dll!sdr::contact::ViewObjectContact::getPrimitive2DSequenceHierarchy(sdr::contact::DisplayInfo & rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor) Line 559
  svxcorelo.dll!sdr::contact::ViewContact::getPrimitive2DSequenceHierarchyOfIndex(unsigned long a, sdr::contact::DisplayInfo & rDisplayInfo, sdr::contact::ObjectContact & rObjectContact, drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor) Line 324
  svxcorelo.dll!sdr::contact::ViewObjectContact::getPrimitive2DSequenceSubHierarchy(sdr::contact::DisplayInfo & rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor) Line 594
  svxcorelo.dll!sdr::contact::ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy(sdr::contact::DisplayInfo & rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor) Line 371
  svxcorelo.dll!sdr::contact::ViewContact::getPrimitive2DSequenceHierarchyOfIndex(unsigned long a, sdr::contact::DisplayInfo & rDisplayInfo, sdr::contact::ObjectContact & rObjectContact, drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor) Line 324
  svxcorelo.dll!sdr::contact::ViewObjectContact::getPrimitive2DSequenceSubHierarchy(sdr::contact::DisplayInfo & rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor) Line 594
  svxcorelo.dll!sdr::contact::ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy(sdr::contact::DisplayInfo & rDisplayInfo, drawinglayer::primitive2d::Primitive2DDecompositionVisitor & rVisitor) Line 569
  svxcorelo.dll!sdr::contact::ObjectContactOfPageView::DoProcessDisplay(sdr::contact::DisplayInfo & rDisplayInfo) Line 252
  svxcorelo.dll!sdr::contact::ObjectContactOfPageView::ProcessDisplay(sdr::contact::DisplayInfo & rDisplayInfo) Line 128
  svxcorelo.dll!SdrPageWindow::RedrawLayer(const o3tl::strong_int<short,SdrLayerIDTag> * pId, sdr::contact::ViewObjectContactRedirector * pRedirector, const basegfx::B2IRange * pPageFrame) Line 422
  svxcorelo.dll!SdrPageView::DrawLayer(o3tl::strong_int<short,SdrLayerIDTag> nID, OutputDevice * pGivenTarget, sdr::contact::ViewObjectContactRedirector * pRedirector, const tools::Rectangle & rRect, const basegfx::B2IRange * pPageFrame) Line 304
  svxcorelo.dll!SdrPaintView::ImpFormLayerDrawing(SdrPaintWindow & rPaintWindow, sdr::contact::ViewObjectContactRedirector * pRedirector) Line 798
  svxcorelo.dll!SdrPaintView::EndCompleteRedraw(SdrPaintWindow & rPaintWindow, bool bPaintFormLayer, sdr::contact::ViewObjectContactRedirector * pRedirector) Line 653
  svxcorelo.dll!SdrPaintView::EndDrawLayers(SdrPaintWindow & rPaintWindow, bool bPaintFormLayer, sdr::contact::ViewObjectContactRedirector * pRedirector) Line 726
  basctllo.dll!basctl::DlgEditor::Paint(OutputDevice & rRenderContext, const tools::Rectangle & rRect) Line 564
  basctllo.dll!basctl::DialogWindow::Paint(OutputDevice & rRenderContext, const tools::Rectangle & rRect) Line 124
  vcllo.dll!PaintHelper::DoPaint(const vcl::Region * pRegion) Line 316
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 618
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!PaintHelper::~PaintHelper() Line 553
  vcllo.dll!vcl::Window::ImplCallPaint(const vcl::Region * pRegion, ImplPaintFlags nPaintFlags) Line 624
  vcllo.dll!vcl::Window::ImplCallOverlapPaint() Line 645
  vcllo.dll!vcl::Window::ImplHandlePaintHdl(Timer * __formal) Line 668
  vcllo.dll!vcl::Window::LinkStubImplHandlePaintHdl(void * instance, Timer * data) Line 649
  vcllo.dll!Link<Timer *,void>::Call(Timer * data) Line 105
  vcllo.dll!Timer::Invoke() Line 75
  vcllo.dll!Scheduler::CallbackTaskScheduling() Line 615
  vcllo.dll!SalTimer::CallCallback() Line 53
  vclplug_winlo.dll!WinSalTimer::ImplHandleElapsedTimer() Line 169
  vclplug_winlo.dll!ImplSalYield(bool bWait, bool bHandleAllCurrentEvents) Line 443
  vclplug_winlo.dll!WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) Line 499
  vcllo.dll!InnerYield(bool i_bWait, bool i_bAllEvents) Line 389
  vcllo.dll!Application::Yield() Line 502
  vcllo.dll!Application::Execute() Line 365
  sofficeapp.dll!desktop::Desktop::Main() Line 1681
  vcllo.dll!ImplSVMain() Line 230
  vcllo.dll!SVMain() Line 249
  sofficeapp.dll!soffice_main() Line 122
  soffice.bin!sal_main() Line 51
  soffice.bin!main(int argc, char * * argv) Line 49
  soffice.bin!invoke_main() Line 79
  soffice.bin!__scrt_common_main_seh() Line 288
  soffice.bin!__scrt_common_main() Line 331
  soffice.bin!mainCRTStartup(void * __formal) Line 17
  kernel32.dll!BaseThreadInitThunk()
  ntdll.dll!RtlUserThreadStart()

while the worker thread is in UnoControl::createPeer, holding the mutex
(and its calling UnoControlContainer::createPeer is holding the same
mutex), and is sending a message to the main thread synchronously:

  win32u.dll!NtUserMessageCall()
  user32.dll!SendMessageWorker()
  user32.dll!SendMessageInternal(struct HWND__ *,unsigned int,unsigned __int64,__int64,int)
  user32.dll!SendMessageW()
  vclplug_winlo.dll!WinSalInstance::SendWndMessage_impl(HWND__ * hWnd, unsigned int Msg, unsigned __int64 wParam, __int64 lParam) Line 689
  vclplug_winlo.dll!WinSalInstance::SendComWndMessage(unsigned int Msg, unsigned __int64 wParam, __int64 lParam) Line 700
  vclplug_winlo.dll!WinSalFrame::AcquireGraphics() Line 1015
  vcllo.dll!vcl::WindowOutputDevice::AcquireGraphics() Line 838
  vcllo.dll!OutputDevice::IsNativeControlSupported(ControlType nType, ControlPart nPart) Line 140
  vcllo.dll!vcl::Window::IsNativeControlSupported(ControlType nType, ControlPart nPart) Line 78
  vcllo.dll!Dialog::ImplInitSettings() Line 526
  vcllo.dll!Dialog::ImplInitDialog(vcl::Window * pParent, __int64 nStyle, Dialog::InitFlag eFlag) Line 497
  vcllo.dll!Dialog::Dialog(vcl::Window * pParent, __int64 nStyle, Dialog::InitFlag eFlag) Line 588
  tklo.dll!toolkit::ScrollableDialog::ScrollableDialog(vcl::Window * pParent, __int64 nStyle, Dialog::InitFlag eFlag) Line 33
  tklo.dll!VclPtr<toolkit::ScrollableDialog>::Create<vcl::Window * &,__int64 &>(vcl::Window * & <arg_0>, __int64 & <arg_1>) Line 153
  tklo.dll!`anonymous namespace'::VCLXToolkit::ImplCreateWindow(rtl::Reference<VCLXWindow> * ppNewComp, const com::sun::star::awt::WindowDescriptor & rDescriptor, vcl::Window * pParent, __int64 nWinBits, MessBoxStyle nMessBoxStyle) Line 1501
  tklo.dll!`anonymous namespace'::VCLXToolkit::ImplCreateWindow(const com::sun::star::awt::WindowDescriptor & rDescriptor, MessBoxStyle nForceMessBoxStyle) Line 1822
  tklo.dll!`anonymous namespace'::VCLXToolkit::createWindow(const com::sun::star::awt::WindowDescriptor & rDescriptor) Line 965
• tklo.dll!UnoControl::createPeer(const com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> & rxToolkit, const com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> & rParentPeer) Line 1262
  tklo.dll!UnoControlContainer::createPeer(const com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> & rxToolkit, const com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> & rParent) Line 727
  tklo.dll!UnoDialogControl::createPeer(const com::sun::star::uno::Reference<com::sun::star::awt::XToolkit> & rxToolkit, const com::sun::star::uno::Reference<com::sun::star::awt::XWindowPeer> & rParentPeer) Line 357
  tklo.dll!UnoControl::ImplModelPropertiesChanged(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> & rEvents) Line 610
  tklo.dll!ControlContainerBase::ImplModelPropertiesChanged(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> & rEvents) Line 1567
  tklo.dll!UnoDialogControl::ImplModelPropertiesChanged(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> & rEvents) Line 650
  tklo.dll!UnoControl::propertiesChange(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> & rEvents) Line 420
  cppuhelper3MSC.dll!cppu::OPropertySetHelper::fire(long * pnHandles, const com::sun::star::uno::Any * pNewValues, const com::sun::star::uno::Any * pOldValues, long nHandles, unsigned char bVetoable) Line 779
  comphelper.dll!comphelper::OPropertySetAggregationHelper::propertiesChange(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyChangeEvent> & _rEvents) Line 398
  comphelper.dll!comphelper::OPropertySetHelper::fire(std::unique_lock<std::mutex> & rGuard, const long * pnHandles, const com::sun::star::uno::Any * pNewValues, const com::sun::star::uno::Any * pOldValues, long nHandles, bool bVetoable) Line 594
  comphelper.dll!comphelper::OPropertySetHelper::impl_fireAll(std::unique_lock<std::mutex> & rGuard, long * i_handles, const com::sun::star::uno::Any * i_newValues, const com::sun::star::uno::Any * i_oldValues, long i_count) Line 487
  comphelper.dll!comphelper::OPropertySetHelper::setFastPropertyValues(std::unique_lock<std::mutex> & rGuard, long nSeqLen, long * pHandles, const com::sun::star::uno::Any * pValues, long nHitCount) Line 748
  tklo.dll!UnoControlModel::setFastPropertyValueImpl(std::unique_lock<std::mutex> & rGuard, long nPropId, const com::sun::star::uno::Any & rValue) Line 1247
  comphelper.dll!comphelper::OPropertySetHelper::setFastPropertyValue(long nHandle, const com::sun::star::uno::Any & rValue) Line 393
  comphelper.dll!comphelper::OPropertySetAggregationHelper::setFastPropertyValue(long _nHandle, const com::sun::star::uno::Any & _rValue) Line 528
  cppuhelper3MSC.dll!cppu::OPropertySetHelper::setPropertyValue(const rtl::OUString & rPropertyName, const com::sun::star::uno::Any & rValue) Line 264
  pcrlo.dll!pcr::EditPropertyHandler::setPropertyValue(const rtl::OUString & _rPropertyName, const com::sun::star::uno::Any & _rValue) Line 147
  pcrlo.dll!pcr::OPropertyBrowserController::Commit(const rtl::OUString & rName, const com::sun::star::uno::Any & _rValue) Line 1326
  pcrlo.dll!pcr::OBrowserListBox::valueChanged(const com::sun::star::uno::Reference<com::sun::star::inspection::XPropertyControl> & _rxControl) Line 637
  pcrlo.dll!pcr::PropertyControlContext_Impl::impl_processEvent_throw(const comphelper::AnyEvent & _rEvent) Line 291
  pcrlo.dll!pcr::PropertyControlContext_Impl::processEvent(const comphelper::AnyEvent & _rEvent) Line 272
  comphelper.dll!comphelper::AsyncEventNotifierBase::execute() Line 138
  comphelper.dll!comphelper::AsyncEventNotifier::execute() Line 155
  salhelper3MSC.dll!salhelper::Thread::run() Line 40
  salhelper3MSC.dll!threadFunc(void * param) Line 190
  sal3.dll!oslWorkerWrapperFunction(void * pData) Line 67
  ucrtbased.dll!thread_start<unsigned int (__cdecl*)(void *),1>(void * const parameter) Line 97
  kernel32.dll!BaseThreadInitThunk()
  ntdll.dll!RtlUserThreadStart()

Change-Id: Ie36fe63b7de9cd04570a3ca625ff5ffa13806d91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202298
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-22 11:59:02 +01:00
Mike Kaganski 0b35782617 tdf#171340: use UTF-8 on Windows 10 (1903) and newer
Since Windows 10 version 1903, it is possible to opt-in for a program
to set its active codepage (ACP) to UTF-8 [1], using a manifest.

This change implements that. The hope is, that now we can finally use
the standard file API taking 8-bit-string filenames, and have Unicode
support.

[1] https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page

Change-Id: I3603ecab4a2fc7724bbfbabfbb775861a1905596
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201793
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@iki.fi>
(cherry picked from commit 7fb24bcebf8753fdad34f0933e089896c69dda9b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201842
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-17 13:12:03 +01:00
Mike Kaganski dc4f4b85c5 tdf#171337: improve prefix generation to guarantee uniqueness
Commit b3bfae88b6 (separate ImpSdrPdfImport's
by prefix, 2025-10-17) introduced a prefix to font filenames, apparently
to avoid same filenames in different imports. It used ImpSdrPdfImport's
pointer for that. However, it may happen that the next time it imports, the
new instance of ImpSdrPdfImport may get allocated at exactly same address.
Then afdko's cbConvert may abort because of failed fileopen.

This adds a static counter to the prefix string. I decided to keep also
the pointer, to avoid a hypothetical clash in case of a font name statring
with a short number like 0 or 1. In theory, we should use methods that
create unique temporary names instead.

Change-Id: Ia52b45002d3fe9e008bed33bc90cec190929e519
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201785
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-16 13:41:54 +01:00
Mike Kaganski 8ed084b733 Copypasta: it obviously intended to run txCommand
From commit 9e18540c73 (implement system
afdko, 2025-11-04).

Change-Id: Ib1b7f3671ea581bd1b41705d2d4ea3ebf2febca4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201612
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2026-03-13 17:21:13 +01:00
Mike Kaganski 251d494c6e Fix no-pch Windows build
C:/lo/core/sw/source/uibase/misc/glosdoc.cxx(452): error C3083: 'FileBase': the symbol to the left of a '::' must be a type
 C:/lo/core/sw/source/uibase/misc/glosdoc.cxx(452): error C2039: 'getSystemPathFromFileURL': is not a member of 'osl'
 C:\lo\core\include\osl/getglobalmutex.hxx(29): note: see declaration of 'osl'
 C:/lo/core/sw/source/uibase/misc/glosdoc.cxx(452): error C3861: 'getSystemPathFromFileURL': identifier not found
 C:/lo/core/sw/source/uibase/misc/glosdoc.cxx(452): error C3083: 'FileBase': the symbol to the left of a '::' must be a type
 C:/lo/core/sw/source/uibase/misc/glosdoc.cxx(452): error C2039: 'E_None': is not a member of 'osl'
 C:\lo\core\include\osl/getglobalmutex.hxx(29): note: see declaration of 'osl'
 C:/lo/core/sw/source/uibase/misc/glosdoc.cxx(452): error C2065: 'E_None': undeclared identifier

Change-Id: I96d48b961522c508a71c99d3046046842b2ad865
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201535
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-12 18:59:48 +01:00
Mike Kaganski 22b73695f3 Firebird: decrease Windows build time even more by reduced cygpath use
A follow-up to commit 309461e70e.

Thanks cloph for the := immediate assignment idea. Additionally, no
need to spawn inner shells to cd and pwd.

On my system, running 'make firebird.clean && time make firebird',
without the patch, I see

real    8m15.444s
user    0m0.109s
sys     0m0.062s

and with the patch:

real    2m48.370s
user    0m0.015s
sys     0m0.015s

Change-Id: If299139372b3c20d791f4dc1b77a9b127c478384
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201534
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-12 14:58:17 +01:00
Mike Kaganski 309461e70e Firebird: decrease Windows build time by reduced cygpath use
The patch relies on $(ROOT) being an absolute mixed (using /) path.
With that assumption, it's enough to replace / with \, without a
need to start a shell and call cygpath.

On my system, running 'make firebird.clean && time make firebird',
without the patch, I see

real    15m9.346s
user    0m0.015s
sys     0m0.015s

and with the patch:

real    8m15.444s
user    0m0.109s
sys     0m0.062s

Change-Id: I72866a92e88a6977339e447b7d9ab1a9b1be84fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201527
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-12 13:12:51 +01:00
Mike Kaganski 44bc72607e Simplify a bit
Change-Id: I00490588dbc48d72c7fca55747a4a6fa3912170d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201425
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-11 09:35:18 +01:00
Mike Kaganski 59b1236c1b Use assertXPathDoubleValue instead of CPPUNIT_ASSERT_DOUBLES_EQUAL
... in the two unit tests I modified / created recently.

Change-Id: Ib3598e94a3116522d31588e757388d4ffc8031ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201387
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-11 03:42:04 +01:00
Mike Kaganski 6686f02308 tdf#128206, tdf#139808: avoid negative distance
When e.g. fTextLeftDistance was 0, and fTextRightDistance was large,
the old code made fTextLeftDistance negative.

Interestingly, a scale-to-textsize approach does not work, I tried this:

 const double correctionFactor = fWidthForText / (fTextLeftDistance + fTextRightDistance);
 fTextLeftDistance *= correctionFactor;
 fTextRightDistance *= correctionFactor;

which correctly gave non-negative distances with their sum equal to
fHeightForText; but the text was still not positioned correctly. But
this change puts the text to the expected position, despite the sum
of the distances is still greater than text size.

The numbers in the unit test reflect correct rendering using current
method.

Change-Id: Ie6fab6570a4a5675d4356c074d5f7eb54e6b5026
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201337
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-10 14:27:27 +01:00
Mike Kaganski 40cef27c6f Use createScaleB2DHomMatrix to simplify code
Change-Id: If2e259a2a37974e041f49a868e1b8ba385b406d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201320
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-10 11:08:59 +01:00
Mike Kaganski 04bc53cd7e tdf#171225: don't lose camera rotation angle for mnShapePresetType < 0
For the case when mnShapePresetType >= 0, the code setting it was added
in commit c50e44b270 (tdf#126060 Handle
text camera z rotation while pptx import., 2019-10-16). But it omitted
the other case.

This change also improves positioning of the rotated text, initially
implemented in that commit. The rotation is now added to the block text
decomposition as a separate transform primitive. The text center is now
obtained directly from the decomposition. After the change, I see about
1-pixel difference compared to PowerPoint render at 100% zoom (before
that, the offset was tens of millimeters).

testTdf128212 had to be corrected, because the metafile now has a new
element in the parsed XML, and the final positioning has changed (it is
better now). Unfortunately, I don't know what would it now produce if
the fix is broken, so I had to remove respective comment.

This change does not fix tdf#128206.

Change-Id: I86cbd0710744b14e8b9b68a436affc5b08703a12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201286
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-10 07:01:48 +01:00
Mike Kaganski 373e102b2e tdf#171174: also correct target index for Move/Copy Sheet dialog
See also: I13504468119706597ca25c14309e6548ea4ca588.

Change-Id: I7fe2e58b78d808a195b0ad45fc8e132993ea04f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201210
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-08 18:47:41 +01:00
Mike Kaganski 5eeba2e25f tdf#171174: the target position is one less when moving to the right
Change-Id: I13504468119706597ca25c14309e6548ea4ca588
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201207
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-08 18:47:31 +01:00
Mike Kaganski 3f27118832 Drop unneeded intermediate variable
No need to copy size data to awt::Size, just to construct Size later.

Change-Id: Ie8d491a4bc4a926d84416a02ff56e7b495494128
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201208
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-08 18:47:12 +01:00
Mike Kaganski 015861bbf4 tdf#156893: in ScPrintFunc::DrawToDev, row count is not a hint
Before this, the function created at most 1024 rows in ScTableInfo,
which is OK for notmal pages, but is limiting whole sheet export.

Change-Id: Ie1663147476f56e879673a7532ec9ae8bb28ac68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201204
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-08 10:49:30 +01:00
Mike Kaganski a68832695d Fix test on Windows
The assertion added in commit 58f2c1e6ab
(tdf#135413: sw: Add UItest, 2025-03-04) used page count 16, obviously
because that is what Writer shows opening the file. But the number is
caused by a wrong layout; the table in the document unexpectedly takes
two pages.

Testing the UI test on Windows, I see

AssertionError: '16' != '15'

and that's the same what Stephan reported on
https://gerrit.libreoffice.org/c/core/+/130940/comment/5a512c89_ff82b3a3.
So let the test assert on "no less than 15".

Change-Id: I3df87d40eb4b7e810f30123683e91f85f9632588
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201176
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-07 18:30:56 +01:00
Mike Kaganski df93f66bb8 Use std::pair instead of ad-hoc struct
Change-Id: Icd9607a2d86def60dafd857bcb39b1355f523691
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201173
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-07 15:23:03 +01:00
Mike Kaganski 20549379e8 tdf#171165: fix handling of SMP characters in "byte string" functions
This patch removes surrogates and PUA from scriptList, to match how
Excel calculates.

It also simplifies implementations of lcl_RightB / lcl_LeftB.

Change-Id: I4af1069eda790df0dda7f402fe4b5f3c47c42c34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201161
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-07 13:23:31 +01:00
Mike Kaganski af1af15aff Simplify getLengthB
Merge it with lcl_getLengthB; let its callers pass correct string views.

Change-Id: Id577bd18d9cc93e45024052da9f034a8d64e94a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201157
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-07 13:23:26 +01:00
Mike Kaganski 53c1a74233 Improve IsDBCS
Introduced in commit 0946de1e2f
(Resolves: #i121120 Support RightB(), LeftB(), LenB() and MidB(),
2013-06-11), it assumed that scriptList (added in the same commit)
was strictly sorted. However, that wasn't enforced. This change
adds a couple of static asserts, making sure that each pair is
strictly ordered ('from', 'to'); and all pairs have 'to' of the
previous pair less than 'from' of the next.

The complex check in 'is_sorted' is because at least on Windows,
simple "l.to < r.from" predicate returns 'sorted' for overlapping
ranges, because it only checks that negation of the predicate is
false for the pair "next, prev".

That discovered an element in the array, that was most definitely a
leftover from development: the element with index 2 had 'from' and
'to' in reverse. The interesting thing is, that if reversed back,
they form a range completely covering from element index 1 to index
3. It is likely that the element index 2 was intentionally reverted
(and put in that position) - to not participate in the search. This
change drops that leftover.

Two elements - index 2 and index 4 - had overlapping ranges. That
meant that they actually formed a single large range; this change
merges them. Important to notice, that this range includes blocks
with surrogates and PUA; that explains handling of SMP characters
(tdf#171165): the two UTF-16 code units, which are surrogates, are
checked, instead of the code point.

This patch is not expected change the result from the function.

The single place where scriptList was used was simplified.

Change-Id: I8c94265c1faa21a26f66317eff5627681f511aaf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201151
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-07 13:23:16 +01:00
Mike Kaganski 3dba60b256 Make sure that connection is disposed also on exception
An omission from commit f5d97d14a2
(uitest: add a way to optionally use the same soffice process for
a testsuite, 2023-03-20).

When testing locally, on some exceptions, soffice process was left
running, and following attempts to run the test failed because of
that.

Change-Id: I3f24c7756020835182dc53565e0be7660ee9f040
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201003
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-05 12:41:30 +01:00
Mike Kaganski c5174cb759 tdf#170205: drop NoYieldLock mode
Added in commit 4baec725e0 (WIN run
main thread redirects ignoring SolarMutex, 2017-09-26), it tried to
handle SendMessage calls without releasing SolarMutex in the calling
code. The idea seemed to be, that the calling thread keeps holding
SolarMutex while waiting for the main thread, and main thread has
this mode that turns all calls to acquire/release/test solar mutex
to noop (which was safe, since the thread holding the mutex is known
to be blocked).

Unfortunately, that doesn't work. The many hangs discovered since
then (e.g., commit 1e2e51607a - Try
to use CoWaitForMultipleHandles magic to handle COM message loop,
2025-01-10) required to unlock solar mutex when calling SendMessage
(implemented in commit 23afeaedf4 -
tdf#168431: Release solar mutex when sending window message to main
thread, 2025-09-09). It made it possibe, that SolarMutex::doRelease
called from non-main thread got false from IsCurrentThread, because
the NoYieldLock mode was active, and SalYieldMutex::IsCurrentThread
only checked that current thread is main; that caused abort().

This change removes this special mode. The intention is, that every
call to SendMessage must release solar mutex, and allow main thread
to lock it. Hope this is a reasonable approach.

Change-Id: I838be4d366b24727cd93610d9cacfbe14992923e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201007
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-05 11:28:00 +01:00
Mike Kaganski 14db4e103b Fix UITest on Windows
No idea why it passes elsewhere; the problem was, that the top focus
window changes when activating the chart.

Change-Id: Iaf96103cd6a4e91e3e06af4aea49a898ffb9251b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201000
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-05 10:03:44 +01:00
Mike Kaganski c404df3e0d Fix a UITest on Windows - again
Previously changed in commits 9f428717f9
(Fix a UITest on Windows, 2024-03-11),
and 2642643ec0 (tdf#160622: Let
SalLayout::GetBoundRect return basegfx::B2DRectangle, 2024-04-19).

I re-run the test, and it changed again - and again, no idea why.

Change-Id: I1ca63fc4908f92c5d5b7f47619d6fae8fe60390b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200997
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-05 08:48:41 +01:00
Mike Kaganski 095b7b36f7 Let test_tdf170386 work on Windows
After commit 54b76f7ca0
(Avoid parameter introduced in Python 3.12, 2026-02-13), it failed
on Windows with

Traceback (most recent call last):
  File "C:\lo\build\instdir\program\python-core-3.13.12\lib\contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
  File "C:\lo\core\uitest\uitest\test.py", line 220, in create_doc_in_start_center
    yield component
  File "C:/lo/core/sd/qa/uitest/impress_tests2/tdf170386.py", line 55, in test_tdf170386
    xModel.storeAsURL(url, [])
    ~~~~~~~~~~~~~~~~~^^^^^^^^^
tdf170386.com.sun.star.task.ErrorCodeIOException: SfxBaseModel::impl_store <file:///C:/lo/build/tmp/tmp8d1tnp7g.odg> failed: 0x507(Error Area:Io Class:Access Code:7) at C:/lo/core/sfx2/source/doc/sfxbasemodel.cxx:3304

That was because tempfile.NamedTemporaryFile locks the created file
on Windows, unless some specific conditions are true (documented at
https://docs.python.org/3/library/tempfile.html).

Fix it by creating a custom context manager, which checks platform,
and calls tempfile.NamedTemporaryFile with delete_on_close=False on
Windows.

Change-Id: I122fabc89e469a02802c1e5237052d71cdf8bcdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200994
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2026-03-05 08:07:55 +01:00
Mike Kaganski f0cd2794e7 Fix Windows build
After commit 9e67072a21
(tdf#153368: Support optical size for variable fonts, part 1,
2023-03-02).

 C:/lo/core/vcl/qa/cppunit/complextext.cxx(885): error C3861:
 'addFont': identifier not found

If the test is expected to run on Windows, the definition of
`addFont` must be made available there.

Change-Id: I184f0dc1cc6363faba4c2ca147a812ddd4a98c2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200872
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2026-03-03 09:13:57 +01:00