Bug 134369 - Enable word-wrap by default for shapes
Summary: Enable word-wrap by default for shapes
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Rafael Lima
URL:
Whiteboard: target:7.2.0
Keywords:
: 115207 138926 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-06-28 18:48 UTC by Rafael Lima
Modified: 2021-09-07 01:19 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Zip file containing all tests (250.00 KB, application/zip)
2020-12-07 22:31 UTC, Rafael Lima
Details
Word Wrap Test File (82.80 KB, application/vnd.oasis.opendocument.presentation)
2021-03-20 13:50 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2020-06-28 18:48:29 UTC
Text wrapping in Impress is only working in basic shapes as rectangles. However, on other shapes as Callouts it does not work, even when I check the "Word wrap text in shape" option.

I posted a video on Youtube showing the problem.
https://youtu.be/SzBm5gq1ym0
Comment 1 Telesto 2020-06-29 11:42:26 UTC
Repro
Version: 7.1.0.0.alpha0+ (x64)
Build ID: 006c65bbd472cb1d7d44e095714e28190b76be0d
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL

also with
6.0

and with
4.4.7.2

and with
LibreOffice 3.5.7.2 
Build ID: 3215f89-f603614-ab984f2-7348103-1225a5b


It works using a different route
1. Inserting a shape
2. Entering the shape
3. Right Click context menu -> Text
4. Text tab -> Wrap
Comment 2 Rafael Lima 2020-06-29 19:08:17 UTC
I tried this route and indeed it worked. However, I find it counter-intuitive to have "Word wrap" disabled by default. Most users (including myself) will have trouble finding out that this is the way to wrap text in shapes.

I would recommend LO enabling "Word Wrap" by default in all shapes. Also, a more intuitive way to switch "Word Wrap" could be implemented.

My suggestion is to add to the shape's context menu a "Text Area Properties" function that would appear without having to "enter the shape" before right-clicking it.
Comment 3 Heiko Tietze 2020-06-30 10:21:05 UTC
Any potential side-effect of having word wrap on by default?
Comment 4 Regina Henschel 2020-06-30 12:35:40 UTC
If word wrap is enabled in the default-style, then it would likely solve bug 113926 too. [It is not duplicate, because different kind of shapes are affected.]

ODF has no explicit default value, the underlying XSL has "wrap" as initial value. Current MS Office uses "wrap" as default. I think, it would be good to use "wrap" as default in LibreOffice too.

(In reply to Heiko Tietze from comment #3)
> Any potential side-effect of having word wrap on by default?

I don't know. But fixing the problem should include examining the imports/exports, especially with OOXML and with binary MS Office formats, whether they presume any default.
Comment 5 V Stuart Foote 2020-06-30 13:42:08 UTC
Wait, for these controls on all Draw shape objects, their Text... dialog, Text tab, Custom Shape text--doesn't the outcome of 'Word wrap text in shape' interact with 'Resize shape to fit text' control?

Both are disabled by default for new draw shape text.
Comment 6 Cor Nouws 2020-07-02 12:13:32 UTC
I think it is more occurring that people want text wrapped, also in shapes, then run out. So IMO good to change this.
Comment 7 Heiko Tietze 2020-07-02 15:29:04 UTC
We discussed the RFE in the design meeting and agree that having text wrapped by default makes sense. It might be an easyhack. Implementation should check the patch to not affect existing documents.
Comment 8 Rafael Lima 2020-11-25 13:08:44 UTC
Hi! I am interested in fixing this issue. I just need some help with code pointers.

I was browsing the code to search where the default template is located. At first I was looking for some .otp file (Impress Template File), but could not find any.

After some searching, it seems that the template is actually hard-coded at:
/core/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx

Can anyone confirm if this is the file I should be working on to fix this issue?
Comment 9 Heiko Tietze 2020-11-25 14:22:24 UTC
(In reply to Rafael Lima from comment #8)
> Hi! I am interested in fixing this issue. I just need some help with code
> pointers.

Described my approach in https://design.blog.documentfoundation.org/2018/02/22/easyhacking-set-environment/

I search for the string "_Word wrap text in shape", find cui/uiconfig/ui/textattrtabpage.ui, search for TSB_WORDWRAP_TEXT and find m_xTsbWordWrapText, get its state from SDRATTR_TEXT_WORDWRAP. Atr this point it becomes a bit time-consuming, for example this is misleading svx/source/svdraw/svdattr.cxx has rPoolDefaults[SDRATTR_TEXT_WORDWRAP         -SDRATTR_START]=new SdrOnOffItem(SDRATTR_TEXT_WORDWRAP, true);

Not sure if all this helps ;-)
Comment 10 Rafael Lima 2020-11-25 22:49:10 UTC
> Not sure if all this helps ;-)

It helped me start from a different angle, then after a some time I managed to find where it is. Thanks!

Actually the code that creates the default template is hard-coded in the method SdDrawDocument::CreateLayoutTemplates() inside the file:
/core/sd/source/core/drawdoc4.cxx

I changed the default template and tested if it breaks compatibility with files created with the current build. Fortunately the styles are saved inside the .odp file and compatibility is not broken.

I'll submit the patch to Gerrit for review.
Comment 11 Regina Henschel 2020-11-26 00:22:07 UTC
Please examine imports/exports, especially with OOXML and with binary MS Office formats, whether the filters presume any default.
Comment 12 Rafael Lima 2020-12-07 22:31:33 UTC
Created attachment 167920 [details]
Zip file containing all tests

> Please examine imports/exports, especially with OOXML and with binary MS Office formats, whether the filters presume any default.

In response to Regina Henschel, I ran some tests and none of them resulted in import/export errors (see the attached ZIP file with all the tests).

The tests were made considering MS Office 365 desktop installation and two different builds of LibreOffice:
- The official LibreOffice Impress 7.0.3.1, referred to as Impress Official.
- The patched build of LibreOffice Impress with Word-wrap enabled by default, referred to as Impress WW.

Test #1: Verifies compatibility of PPTX files created on MS Office and opened in LibreOffice Impress.
- Test1a.pptx: Original PPTX file created in MS PowerPoint.
- Test1b.odp: I opened the PPTX file on Impress Official, took a screenshot of what was shown and saved it as ODP.
- Test1c.odp: I opened the PPTX file on Impress WW, took a screenshot of what was shown and saved it as ODP.

Test #2: I created a presentation in LO Impress WW and saved it as PPTX.
- Test2a.pptx: Original PPTX file created with LO Impress WW.
- Test2b.odp: I opened the PPTX file on Impress Official, took a screenshot of what was shown and saved it as ODP.
- Test1c.odp: I opened the PPTX file on Impress WW, took a screenshot of what was shown and saved it as ODP.

Test #3: I created a presentation in LO Impress WW and saved it as ODP to test compatibility with the official version.
- Test3a.odp: Original ODP file created with Impress WW.
- Test3b.odp: I opened the ODP file on Impress Official, took a screenshot of what was shown and saved it as ODP.

Test #4: I created a presentation in LO Impress Official and saved it as ODP to test compatibility with the WW build.
- Test4a.odp: Original ODP file created with Impress Official.
- Test4b.odp: I opened the ODP file on Impress WW, took a screenshot of what was shown and saved it as ODP.
Comment 13 Regina Henschel 2020-12-08 18:20:07 UTC
I have looked a little bit, why the Callout does not follow the settings in the default style. I have found this:

Some custom shapes get direct formatting while creating. That happens in FuConstructCustomShape::SetAttributes in sd/source/ui/ func/fuconcs.cxx. In case the shape type in included in the Gallery theme GALLERY_THEME_POWERPOINT, the to be constructed shape gets some properties from the corresponding shape in the Gallery theme.

This theme is a hidden theme. You can make it visible with setting the environment variable GALLERY_SHOW_HIDDEN_THEMES (https://wiki.documentfoundation.org/Development/Environment_variables) The theme itself is in /core/extras/source/gallery/gallery_system/. Unfortunately it is all binary encoded. There had been a GSoC project about the Gallery format this year. But I don't know, whether it had some usable results.

The custom shapes in the UI of LibreOffice do not directly correspond to the preset shapes of OOXML, but they correspond to the shapes of the MS binary format. Import/export tests would have to be done against the binary format too.
Comment 14 Regina Henschel 2020-12-15 22:10:04 UTC
*** Bug 138926 has been marked as a duplicate of this bug. ***
Comment 15 Christian 2020-12-16 10:57:21 UTC
*** Bug 115207 has been marked as a duplicate of this bug. ***
Comment 16 Rafael Lima 2021-03-20 13:50:26 UTC
Created attachment 170586 [details]
Word Wrap Test File

Hi! I'd like to report on the tests carried out with the current patch proposed in Gerrit for this bug.

Basically, in the "Word Wrap Test File" I've just attached, all shapes are fixed, except for the Circle Segment shape.

Almost all shapes are fixed with the changes in sd/source/core/drawdoc4.cxx, except for the Callouts shapes that are fixed only with the changes in sd/source/ui/func/fuconcs.cxx.

Also, the changes in sd/source/ui/func/fuconcs.cxx made word-wrap by default for some shape groups in the Gallery as well, as shown in the attached test file.

Although this patch doesn't fix all shapes, it fixes those shapes that are probably most frequently used by LO users.
Comment 17 Commit Notification 2021-04-12 07:09:03 UTC
Rafael Lima committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8f9b4464ad5bf3dd235e89982454e9aee3c8ea5e

Partially resolves tdf#134369: Enable word-wrap by default for shapes in sd

It will be available in 7.2.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 18 Stéphane Guillou (stragu) 2021-09-07 01:19:43 UTC
Verified as fixed in 7.2 (word-wrap is the default):

Version: 7.2.0.4 / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded