Bug 149483 - Copy/Paste of partial cell contents string with hyperlink in recent versions, string with link appears _twice_
Summary: Copy/Paste of partial cell contents string with hyperlink in recent versions,...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.3.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectNotNeeded, regression
: 142143 152602 (view as bug list)
Depends on:
Blocks: Hyperlink-Calc
  Show dependency treegraph
 
Reported: 2022-06-08 04:51 UTC by Rainer Bielefeld Retired
Modified: 2025-11-08 03:13 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
New Sample Document created with LibO 7.4 (8.66 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-06-08 04:51 UTC, Rainer Bielefeld Retired
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Bielefeld Retired 2022-06-08 04:51:49 UTC
Created attachment 180626 [details]
New Sample Document created with LibO 7.4

+++ This bug was initially created as a clone of Bug #113878 +++

Steps how to reproduce with Server Installation of Version: 7.4.0.0.alpha0+ (x64)  Build ID b871abad383583f02eb49c7e49aeae01f6941072
CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-US  |  Calc: CL  |  Auto Colibre Theme  |  Special devUserProfile based on my normal User Profile 

1. Open sample document attachment 137808 [details] from Bug 113878
2. Double click cell A1
3. select string "hyperlink" (from left to right, using only mouse)
4. rightclick selection → copy
5. Doubleclick cell A3 → past
   Expected: string with link pasted
   Actual: String appears 2 times 😥

Additional info:
a) Seems that Fix for "Bug 113878 - Copy/Paste of partial cell contents string with hyperlink - nothing happens or, in recent versions, string with link appears _twice_" onlysolved problem (a) from that bug
b) Same with newly created document (see attachment)
c) I did not test with LibO 5.3, but am pretty sure that this problem is remaining from Bug #113878 and not a new probem
Comment 1 Buovjaga 2022-06-08 05:41:06 UTC
Repro

Arch Linux 64-bit
Version: 7.4.0.0.alpha1+ / LibreOffice Community
Build ID: ff2b4bff61d2e1679bb525d754c960c48b81c495
CPU threads: 8; OS: Linux 5.17; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 25 May 2022
Comment 2 Rafael Lima 2022-06-09 00:56:08 UTC
Repro with

Version: 7.4.0.0.alpha1+ / LibreOffice Community
Build ID: 118bafcfd1ce4a26ec9df912197ebd466d1bd497
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: CL

Also repro in gen and gtk3
Comment 3 m_a_riosv 2022-12-20 00:41:43 UTC
*** Bug 152602 has been marked as a duplicate of this bug. ***
Comment 4 Justin L 2023-10-31 14:13:41 UTC
*** Bug 142143 has been marked as a duplicate of this bug. ***
Comment 5 Justin L 2023-11-08 00:02:25 UTC
Debug suggests that the ODS FLAT TEXT created has two a href= entries?

sax/source/fastparser/fastparser.cxx:332: ::callbackStartElement[body]
ax/source/fastparser/fastparser.cxx:332: ::callbackStartElement[p]
sax/source/fastparser/fastparser.cxx:332: ::callbackStartElement[a]
xmloff/source/text/txtfldi.cxx:2885: XMLUrlFieldImportContext::ProcessAttribute[https://bugs.documentfoundation.org/show_bug.cgi?id=115317] Token[459717][href]
xmloff/source/text/txtfldi.cxx:2885: XMLUrlFieldImportContext::ProcessAttribute[simple] Token[460728][type]\xmloff/source/text/txtfldi.cxx:2898: unknown attribute http://www.w3.org/1999/xlink xlink:type=simple
sax/source/fastparser/fastparser.cxx:332: ::callbackStartElement[a]
xmloff/source/text/txtfldi.cxx:2885: XMLUrlFieldImportContext::ProcessAttribute[https://bugs.documentfoundation.org/show_bug.cgi?id=115317] Token[459717][href]
xmloff/source/text/txtfldi.cxx:2885: XMLUrlFieldImportContext::ProcessAttribute[simple] Token[460728][type]
xmloff/source/text/txtfldi.cxx:2898: unknown attribute http://www.w3.org/1999/xlink xlink:type=simple
sc/source/ui/view/viewfunc.cxx:765: ::aEngine.GetText returned[isis]


It looks like this is going to get rather hairy. On the "export to clipboard" XMLTextParagraphExport::exportParagraph creates an enumeration that has TWO TextFields (if the selection ends on a textfield).

So I expect the problem to be in xTextEnum = xEA->createEnumeration();

Yup - there are three "portions" here. "This ", "is", " a link". So the enumeration (based on the selection) creates portions
 5 "" 5         (Text)
 5 "\x001" 6    (TextField)
 6 "" 6         (TextField)

If the selection had gone to 7, then the last portion would be 6 " " 7 and be considered a Text portion. So why would 6, 6 be considered a TextField? Well this is all UNO garbage, so it is a mystery as to what properties becomes what. And we immediately lose all knowledge of start/end/selection etc. Boy I HATE UNO.

make sd.check says that it isn't enough to say SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration
-       if( nEndPos < rSel.nStartPos )
+       if( nEndPos <= rSel.nStartPos )
            continue;

So, it looks like some hacky solution may be needed for XMLTextParagraphExport::exportTextRangeEnumeration.
Comment 6 Justin L 2023-11-08 00:14:40 UTC
We don't have much to work with in exportTextRangeEnumeration
-just some range properties with TextPortionType == TextField
-an XTextRange that can getString.

In the 6 "" 6 case the length is zero, but in the 5 "\x001" 6 case it is two, or "is". So what happens if the URL is empty? Probably a hacky solution would be to avoid exporting hyperlinks that are have an empty XTextRange.

But I think I'll just leave this bug for a UNO expert, so they can fix whatever fundamental problem underlies this.
Comment 7 QA Administrators 2025-11-08 03:13:48 UTC
Dear Rainer Bielefeld Retired,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug