Bug 118139 - FILEOPEN: Incorrect height of textboxes
Summary: FILEOPEN: Incorrect height of textboxes
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Armin Le Grand
URL:
Whiteboard: target:6.2.0 target:6.1.3
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Regressions-AW080
  Show dependency treegraph
 
Reported: 2018-06-13 11:39 UTC by Xisco Faulí
Modified: 2018-10-04 11:41 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
sample file (24.00 KB, application/msword)
2018-06-13 11:39 UTC, Xisco Faulí
Details
comparison MSO 2010 and LibreOffice 6.2 (77.49 KB, image/png)
2018-06-13 11:40 UTC, Xisco Faulí
Details
sample 2 (23.50 KB, application/msword)
2018-06-13 11:42 UTC, Xisco Faulí
Details
File in doc and docx, and screenshot of file in Word 365 (89.58 KB, application/x-zip-compressed)
2018-07-04 22:49 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2018-06-13 11:39:46 UTC
Created attachment 142698 [details]
sample file

Steps to reproduce:
1. Open attached document

Observed behaviour: all textboxes have an incorrect height. See attached screenshot.

Reproduced in

Version: 6.2.0.0.alpha0+
Build ID: 4c6e11886a9d396bf7be18e9e3209a73c6e303ad
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2018-06-13 11:40:26 UTC
Created attachment 142699 [details]
comparison MSO 2010 and LibreOffice 6.2
Comment 2 Xisco Faulí 2018-06-13 11:41:40 UTC
Regression introduced by:

author	Armin Le Grand <Armin.Le.Grand@cib.de>	2018-04-16 22:34:50 +0200
committer	Armin Le Grand <Armin.Le.Grand@cib.de>	2018-05-25 12:31:32 +0200
commit 4b4942224b550235da228655677b5c068a053254 (patch)
tree a660a04a1f7a3eee910da780ece271d68942201d
parent f8edef392245c292398a80f6a858ca19f32df9c3 (diff)
SOSAW080: Derive SdrObjGroup from SdrObjList

Bisected with:

Adding Cc: to Armin Le Grand
Comment 3 Xisco Faulí 2018-06-13 11:42:42 UTC
Created attachment 142700 [details]
sample 2

another file affected by the same problem
Comment 4 Armin Le Grand 2018-07-03 07:24:03 UTC
Confirmed.

Just wondering about the Shapes imported. It *seems* to be a GroupObject containing DrawObjects, but in context menu 'Group' commands are not allowed.

To do anything with these I have to copy/paste them to Draw, can ungroup there. Can then select a single one and use context menu 'Text...' to get some values about text frame formatting of the draw object (seems to have to do with text formatting).

When doing the same with libreoffice-6-0 (alaso no active 'group' commands, copy/pasting to draw, ungrouping, selecting one object) and looking at the values I get exactly the same settings - VERY strange.

Thus it might have to do with 'internal' flags/settings which have no representation at UI and are only used for *.doc imports like here.

To find that I will have to debug step-by-step the import of such a DrawObject. Thus:

- How was the example created?
- Is there a more simple one with e.g. a single such DrawObject?
- Is there a way to create a bugdoc with minimal content (step-by-step)?

That would make looking into much easier.
Comment 5 Xisco Faulí 2018-07-04 14:53:11 UTC
> To find that I will have to debug step-by-step the import of such a
> DrawObject. Thus:
> 
> - How was the example created?
> - Is there a more simple one with e.g. a single such DrawObject?
> - Is there a way to create a bugdoc with minimal content (step-by-step)?
> 
> That would make looking into much easier.

Hi Armin, I've tried to recreate how the document were created with MSO 2010 but I couldn't find the way to do it. The document attached were extracted from different bug-trackers by the office-interoperability-tools scripts.

@Regina, I thought this issue could be of interested to you
Comment 6 Regina Henschel 2018-07-04 22:45:56 UTC
(In reply to Xisco Faulí from comment #5)
> @Regina, I thought this issue could be of interested to you

But I do not really no the Word formats. Nevertheless, I have a little bit investigated.

(In reply to Armin Le Grand (CIB) from comment #4)
> Confirmed.
> 
> Just wondering about the Shapes imported. It *seems* to be a GroupObject
> containing DrawObjects, but in context menu 'Group' commands are not allowed.

That is a bug in LibreOffice, inherited from OpenOffice.org. If the shape is anchored as character, you cannot enter the group or ungroup it. https://bz.apache.org/ooo/show_bug.cgi?id=83498 and for the special case of Word import https://bz.apache.org/ooo/show_bug.cgi?id=54325

To examine the shape, you have to change the anchor "to character" or "to paragraph" e.g.

> 
> To find that I will have to debug step-by-step the import of such a
> DrawObject. Thus:
> 
> - How was the example created?

The old Word version had a feature to insert an "AutoShape" and then add text boxes to it. That had automatically generate a group containing the AutoShape itself and the text boxes. Word had this feature, because in the beginning the AutoShapes where not able to have text themselves. This auto-grouping is no longer available in current Word versions.

> - Is there a more simple one with e.g. a single such DrawObject?

It makes no real difference, whether you have one or four text boxes. You have always a "canvas" (that is the group) and therein the Autoshape and the text boxes. The group has wrap and anchor properties and can have a custom name. I was only once able to name a text box, but cannot reproduce it.

The AutoShape has the fill and line properties. Size and position are coupled between group and AutoShape and you can use one or the other the change it.

> - Is there a way to create a bugdoc with minimal content (step-by-step)?
> 
> That would make looking into much easier.
https://www.youtube.com/watch?v=hfbXtylMlWY
You need e.g. Word 2003.

I have made a screenshot from Word 365, and will attach it together with the used files.
Besides the wrong height, there are additional problems:
The borders are missing.
All shapes are named in Word, but the names are not imported and therefore the shapes are not visible in the Navigator.

The import of the compatible docx has additional errors: The AutoShape is missing. The text boxes are inserted as custom shapes and have "resize to text". But as custom shapes they need "wrap", because in contrast to text boxes the custom shapes have wrap not automatically. I have no strong opinion, whether a solution with custom shape is better than a solution with a text box. It might be, that the import of docx does not consider, that the document is in "Compatability mode".
Comment 7 Regina Henschel 2018-07-04 22:49:40 UTC
Created attachment 143312 [details]
File in doc and docx, and screenshot of file in Word 365
Comment 8 Armin Le Grand 2018-07-17 08:24:56 UTC
@Regina: Thanks, will have a look!
Comment 9 Armin Le Grand 2018-07-17 15:03:14 UTC
Compared with liberoffice-6-1, except the 2nd text box being smaller (the task of this bug) looks the same. Borders are the same. Re-checked with lo-5-2 (to be on the safe side), the same.
I will concentrate on the change I issued with my changes - the TextBoxes height change...
Comment 10 Armin Le Grand 2018-07-17 15:39:53 UTC
Comparing with lo-6-1 - SdrTextObj::AdjustTextFrameWidthAndHeight is *not* called there, but in current master. When suppressing, objects look as before...
Comment 11 Armin Le Grand 2018-07-17 16:44:36 UTC
Decided to suppress SetStyleSheet in BaseProperties::applyDefaultStyleSheetFromSdrModel when default StyleSheet to-be-set is equal to already set one. This includes both being nullptr and is a arguable case where setting it is not needed. Thus, the calls down the derived classes is not done and NbcAdjustTextFrameWidthAndHeight in TextProperties::SetStyleSheet is not triggered.
This is a little bit strange since NbcAdjustTextFrameWidthAndHeight *should* be callable anytime since it is the central method to do the needed adjustments dependent of the set items and stuff. I am not sure if not calling this is a long-term solution. It will e.g. be called when you *edit* the TextBox involved and will then probably 'snap' to where it would be when it would be completety layouted...
Comment 12 Commit Notification 2018-07-18 08:47:08 UTC
Armin Le Grand committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7d2668517b68f9a7f056a993e53b4dd80838a4f9

tdf#118139 Set Default StyleSheet only when available

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Xisco Faulí 2018-07-24 10:22:01 UTC
Verified in

Version: 6.2.0.0.alpha0+
Build ID: dcbb65f2a4a3ee70ccd4896d7a5e975dbd9e6509
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

@Armin, Thanks for fixing this!! Should it be backported to 6-1 branch ?
Comment 14 Xisco Faulí 2018-07-27 10:15:47 UTC
@Armin, should it be cherry-picked to 6-1 ?
Comment 15 Armin Le Grand 2018-08-01 18:13:10 UTC
@Xisco: No, the mechanism was different. Not sure if the error was in lo-6-1 at all.
Comment 16 Xisco Faulí 2018-08-01 18:27:19 UTC
(In reply to Armin Le Grand (CIB) from comment #15)
> @Xisco: No, the mechanism was different. Not sure if the error was in lo-6-1
> at all.

Indeed, the issue is not reproducible in

Versión: 6.1.0.2
Id. de compilación: b3972dcf1284967612d5ee04fea9d15bcf0cc106
Subprocs. CPU: 1; SO: Windows 6.1; Repres. IU: predet.; 
Configuración regional: es-ES (es_ES); Calc: group threaded

Sorry for the noise!!
Comment 17 Xisco Faulí 2018-10-01 15:53:58 UTC
Hi Armin, after https://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-6-1&id=1ebb77fd17b417d92ab48fcef56a0230c5750de2, this should be backported to 6-1. I've tried to cherry-pick it but there was a merge conflict.

Would you mind backporting it?
Comment 18 Xisco Faulí 2018-10-03 15:47:16 UTC
(In reply to Xisco Faulí from comment #17)
> Hi Armin, after
> https://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-6-
> 1&id=1ebb77fd17b417d92ab48fcef56a0230c5750de2, this should be backported to
> 6-1. I've tried to cherry-pick it but there was a merge conflict.
> 
> Would you mind backporting it?

https://gerrit.libreoffice.org/#/c/61315/
Comment 19 Commit Notification 2018-10-04 09:07:17 UTC
Armin Le Grand committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ffdf0f99bd459e0f422592de373d0ec6a0d9926c&h=libreoffice-6-1

tdf#118139 Set Default StyleSheet only when available

It will be available in 6.1.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.