Index ¦ Archives ¦ RSS > Tag: en

Commenting on images and charts in Writer

Estimated read time: 1 minutes

The problem

Years ago I posted about work to attach comments to text ranges. This improved compatibility with Word greatly, but it was always a piece of text that was commented, never frames. If you just selected a frame and tried to comment by selecting the menu entry or the Ctrl-Alt-C shortcut, nothing happened, because frame selection did not interpret comment insertion.

Result

https://lh3.googleusercontent.com/PvlDM6Ox1UBEXj57F4SyBN5hlv1sjJHjI4VjmwIoM-3btxSR1Uh5HAwch_tw95vDOhdSZnEbDPkuYYAU2iiHvSeHafFtToGQzntEqO8wGgkDgmIOxGBXWw6vdTPQlgPPF3lFd0ES8Q=w640
Figure 1. Comment on an at-char anchored image in Writer

Examples for frames are images or charts. This needs explicit handling, so at the moment the at-char and as-char anchor types are supported, and you can simply insert the comment to a frame once the frame is selected. This works in both desktop Writer and Online.

Want to start using this?

You can get a snapshot / demo of Collabora Office and try it out yourself right now: try unstable snapshot. Collabora is a major contributor to LibreOffice and all of this work will be available in TDF’s next release too (6.4).


btLr text direction in Writer, part 3

Estimated read time: 2 minutes

I already wrote about the btLr text direction in the context of Writer table cells as a result of a Collabora hack week (part 1, part 2). The next step in this journey is btLr text direction of Writer Text Frames, and building on top of that: DOCX Text Boxes. Here is a series of screenshots showing the result:

https://lh3.googleusercontent.com/mHrS3KHuLf4tnWOZTw83jJiF3bJ6Ti8fiHXSJlqBFwrdDEpCdS9m_mTfHQPhOXNbZ5atXkagrGO7fSAJPSUo9pEm73UMr_kT6oVwOLCjZwxR9NB_EsLxHUXmUtUiSq0Zr-C0_TNLMg=w640
Figure 1. tdf104353.docx, baseline
https://lh3.googleusercontent.com/haH8Tu0CiUQ9OHWn3Pc9PJ8pP6fEwpGZtrtYUrtkYLYH_BLnLknIA5hBruslE2XIJnuoFjGxYhuFj3GqH4Peu2slIH83ss9vIPMXSn_E5q2Lr80cz2_h7rPuI1DRgJYou6AaOQzAaw=w640
Figure 2. tdf104353.docx, current
https://lh3.googleusercontent.com/ZZKDSlC3-VmuVbvvR7nlsNUi6A-mWAj6wJgg2TMzBMg0MQ01kN0iwnHvw_16GDopYT2hNuJwUKWZ5ugbg6TjkJWJ_V5rHwv2fpwumuGLLF29hYYtEPOb0v2en5UHY5p8kHyxTWtYZA=w640
Figure 3. tdf104353.docx, reference

You can see that the bug document is some kind of card you can print and fold in the middle: no matter if you are in front of the card or you are behind it, you always see the name and details of the person. Sure, you can do the same with a table with no borders, but using a Text Frame for this purpose is a sane use-case.

The text from the 3 paragraphs used to have the same horizontal position, and now it’s laid out the same way as Word does it.

Technically, this result is just the last commit in a series. I fixed the following problems since the last blog post on this topic:

All this is available in LibreOffice master (towards 6.4), so you can try it out right now, if interested.


Importing charts from DOCX drawingML group shapes in Writer

Estimated read time: 1 minutes

https://lh3.googleusercontent.com/Jw_BHWWDubfGASjfFszFu6q9VRXaELjjLun974YCt7pQv3P-WIKqkISu5GHwTNndCHi8jGqv_FvYTZFXdWfxASIzXbgw0Et-7rAQZ3LzxA5Ntxx0GTxRH3y4m3hOYVLMKAyXtCQECQ=w640
Figure 1. Chart in drawingML group shape in DOCX, imported into Writer

Years ago I posted about a large rework to where Collabora helped a customer to make Writer read the drawingML markup for DOCX shapes. You can read the various benefits of this switch in that article — but similar to other large reworks, this also broke some previously working corner-cases, where test coverage lacked.

One of these is charts in group shapes. This needs explicit handling, as Writer normally handles charts as TextEmbeddedObjects, while code that imports charts from OOXML is not specific to Writer. The fix just tells the generic drawingML import to use a Writer-specific service name for the charts.

This is available in LibreOffice master (towards 6.3).


btLr text direction in Writer, part 2

Estimated read time: 1 minutes

I already wrote about the btLr text direction in the context of Writer table cells as a result of a Collabora hack week. This is meant to be an update to present what happened in the past 2 months. Here is a video showing the results:

Figure 1. Before / after screen recording for the below mentioned changes

I fixed the following problems since the last blog post on this topic:

All this is available in LibreOffice master (towards 6.3), so you can try it out right now, if interested.


SmartArt improvements in LibreOffice, part 4

Estimated read time: 2 minutes

I recently dived into the SmartArt support of LibreOffice, which is the component responsible for displaying complex diagrams from PPTX. I focus on the case when only the document model and the layout constraints are given, not a pre-rendered result.

First, thanks to our partner SUSE for working with Collabora to make this possible.

Organization Chart, Cycle Matrix and Picture Strip

In this post I would like to present the progress done earlier this year regarding the above mentioned diagram types — these are used in many documents.

The improvement (as always) come in small incremental steps:

  • Organization Chart is the most complex type I dealt with so far. I fixed several issues (font color, vertical ordering, multiple paragraphs in a data node, size of layout nodes, better support for hierBranch conditions, the type of connector shapes). This allows giving readable result for diagrams which are more complex than the simple 3-node one presented in the previous post.

  • Cycle Matrix: there were missing child nodes here, the composite algorithm needed improved handling of position / size from constraints and the ordering / fill / line properties of actual content also needed fixing.

  • Picture Strip: the biggest problem here was the lack of pictures, but also the existing snake algorithm needed improvements (size, positioning, spacing and margins of the child shapes were not great).

With all these fixed, we reach a much better state for the mentioned diagram types.

Results so far

The SmartArt test documents from sd/qa/unit/data/pptx/ is what I used for testing this work.

Here is how the baseline, the current and the reference rendering of Organization Chart looks like:

smartart-org-chart.pptx, baseline

smartart-org-chart.pptx, current

smartart-org-chart.pptx, reference

And here is how the baseline, the current and the reference rendering of Cycle Matrix looks like:

smartart-cycle-matrix.pptx, baseline

smartart-cycle-matrix.pptx, current

smartart-cycle-matrix.pptx, reference

And finally here is how the baseline, the current and the reference rendering of Picture Strip looks like:

smartart-picture-strip.pptx, baseline

smartart-picture-strip.pptx, current

smartart-picture-strip.pptx, reference

This is not not perfect yet, but it’s clearly a large improvement, all text is now readable from the diagrams and pictures are no longer missing!

All this is available in master (towards LibreOffice 6.3), so you can grab a daily build and try it out right now. :-)


My hack week at Collabora: btLr text direction in Writer

Estimated read time: 4 minutes

As mentioned in my previous such report, a hack week is when we are allowed to hack on anything we want in LibreOffice for a few days at Collabora. I used this time to implement core support for the btLr text direction in Writer.

Motivation

If you work with tables in Word, it’s very easy to create this writing direction: the context menu in a table cell has a menu item to set the direction of the text, where you can rotate the text by 90 degrees counter-clockwise or clockwise. The counter-clockwise btLr direction is the problematic one. Support for tbRl was fine already, since that is needed typically for Chinese/Japanese scripts as well.

Results so far

Here is how the baseline, the current and the reference rendering of btLr text looks like:

https://lh3.googleusercontent.com/o5t6-JQeeNaZpx0YURMvS6xUJv7L4KbkbKnn6VPQ0yzULxHFI15ufkwaw_m0FVY7B2tv8gOnTw1CEY2Uxq6BFTgXHlcorXS52J8X1-mNjsyHKYDmoNG-MQ9X1LtdUWmrLl_W3b2ifQ=w640
Figure 1. btlr-cell.docx, baseline
https://lh3.googleusercontent.com/Y8jXvq7TFyNoKVjwWd_QvJNJaOySZdKZE_HqqBaTwGoi_rExCee3eDAHx4AS49E7d7bcjG8SEgxnXOmdKFXaJx0MzmadungQ7D0SVqdSqC2trMC9InsHdKUTq1iwu5p8bDwUfIizng=w640
Figure 2. btlr-cell.docx, current
https://lh3.googleusercontent.com/KYSBaOiAMdy_U8shsb4zoS8J5uyZzwkFPZY4qIKTrHKlo-M-pCdiHHBUxZ9OmQ-uv_QkBiktXeprTQD6gANDvzDVi8JWs4-Ng2RL-uoMcQCrQNL6Hk7tjXSJBaaqxc2skfZzmepkqA=w640
Figure 3. btlr-cell.docx, reference

You can see how the second paragraph in the cell was missing from the rendered result and now we basically pixel-by-pixel match the reference.

How is this implemented?

If you would like to know a bit more about how this works, continue reading… :-)

The document model and UNO API were reasonably straightforward to implement, but the layout was much more challenging. Writer already supported 3 writing directions:

  • typically used for Latin (left to right, top to bottom)

  • Chinese/Japanese (top to bottom, right to left)

  • Mongolian (top to bottom, left to right) text.

This new one is also a vertical direction, also left to right, but bottom to top. The initial layout contained code to read the new enumerator from doc model, extend the SwFrame class to handle this new bottom to top mode, some handling of switching between horizontal/vertical mode and at the end mapping from Writer layout’s direction to VCL’s "900" font orientation. There are more things to handle in layout, but this was good enough to look at other areas as well.

The ODF filter required updating, which was a bit challenging as it was necessary to write different attribute names depending on which enumerator is used from an emumeration, and we don’t have good support for this. Once the filter code was in place, I could write some layout-level tests as well.

Since we have .ui files for UI descriptions, adding UI support was really easy.

Time came to step away from coding for a moment and write up paperwork to propose this feature to be part of the next ODF version (thanks to Andras for the help there!).

Finally I went back to layout, and improved things a bit more: after fixing baseline offsets, the positioning of the text was exactly matching what Word does. How do I know? I used this little script:

gs -dNOPROMPT -dBATCH -sDEVICE=jpeg -r75 -dNOPAUSE -sOutputFile=btlr.jpg btlr.pdf
gs -dNOPROMPT -dBATCH -sDEVICE=jpeg -r75 -dNOPAUSE -sOutputFile=btlr-word.jpg btlr-word.pdf
composite -compose difference btlr-word.jpg btlr.jpg out.jpg

Which allows seeing the differences between our and Word’s PDF output. Additional work was needed to handle multiple paragraphs in a table cell. At this stage I was happy enough with the rendering result, so finally pulled the trigger and replaced the old DOCX filter hack (using character-level rotation) with simple DOCX filter mapping from OOXML’s btLr direction to Writer’s btLr direction — i.e. what was already done for the tbRl case.

Future work

The feature works good enough already so that this new core feature can be used by the DOCX filter by default, but there are still a few rough edges:

  • the shell code (cursor travelling, selection painting, etc) only has partial support for this new direction

  • RTF and DOC filters are not yet updated

  • the ODF proposal has a list of contexts other than table cells where the new writing direction could be used, which lack UI/filter support/etc at the moment.

All this is available in master (towards LibreOffice 6.3), so you can grab a daily build and try it out right now. :-)


Improving SmartArt import in Impress FOSDEM talk

Estimated read time: 1 minutes

(via cor4office)

The next step in the recent SmartArt story is my Improving SmartArt import in Impress talk at FOSDEM 2019, in the Open Document Editors devroom. The room was a bit far away from the popular places, but the livestream worked out nicely.

There was also a hackfest before the conference, I looked at RTF export of rotated Writer pictures.


SmartArt improvements in LibreOffice, part 3

Estimated read time: 2 minutes

I recently dived into the SmartArt support of LibreOffice, which is the component responsible for displaying complex diagrams from PPTX. I focus on the case when only the document model and the layout constraints are given, not a pre-rendered result.

First, thanks to our partner SUSE for working with Collabora to make this possible.

Continuous Block Process, Accent Process and Organization Chart

In this post I would like to present the progress done last month regarding the above mentioned diagram types — these are used in many documents.

The improvement (as always) come in small incremental steps:

  • Continuous Block Process now reads space width from constraints.

  • Accent Process now has the missing bullets and fixes an incorrect large paragraph-level indent.

  • Organization Chart now has an initial implementation of the hierRoot and hierChild algorithms.

  • Organization Chart now handles multiple employees for a manager.

With all these fixed, we reach a much better state for the mentioned diagram types.

Results so far

The SmartArt test documents from sd/qa/unit/data/pptx/ is what I used for testing this work.

Here is how the baseline, the current and the reference rendering of Accent Process looks like:

smartart-accent-process.pptx, baseline

smartart-accent-process.pptx, current

smartart-accent-process.pptx, reference

And here is how the baseline, the current and the reference rendering of Organization Chart looks like:

smartart-org-chart.pptx, baseline

smartart-org-chart.pptx, current

smartart-org-chart.pptx, reference

This is not not perfect yet, but it’s clearly a large improvement, all text is now readable from the diagrams and bullets are no longer missing!

All this is available in master (towards LibreOffice 6.3), so you can grab a daily build and try it out right now. :-)


SmartArt improvements in LibreOffice, part 2

Estimated read time: 2 minutes

I recently dived into the SmartArt support of LibreOffice, which is the component responsible for displaying complex diagrams from PPTX. I focused especially on the case when only document model and the layout constraints are given, not a pre-rendered result.

First, thanks to our partner SUSE for working with Collabora to make this possible.

Accent Process

In this post I would like to present the progress regarding the Accent Process preset, available in PowerPoint — which is used in many documents.

This exposed several shortcomings of the current diagram layout we have in LibreOffice:

  • Values are not read from constraints (there was a reason for this, they can be complex, given that depending on the context, the unit is points or millimeters and the unit is always implicit).

  • ZOrder offsets were ignored.

  • Linear algorithm did not take size from constraints when it came to recursing into child algorithms.

  • Data point assumed that all text for it is a single "run" (i.e. either all text is bold or nothing, not half of it).

  • followSib axis was not implemented for forEach, so when you have arrow shapes between objects, we created N arrows, not N - 1 ones.

  • Connectors were created as invisible shapes and had the wrong width/height aspect.

With all these fixed, we reach a much better state for handling accent process.

Results so far

smartart-accent-process.pptx is what I used for testing of this work.

Here is how the baseline, the current and the reference rendering of the test documents look like:

smartart-accent-process.pptx, baseline

smartart-accent-process.pptx, current

smartart-accent-process.pptx, reference

This is not not perfect yet, but it’s clearly a large improvement, all text is now readable from the diagram!

All this is available in master (towards LibreOffice 6.3), so you can grab a daily build and try it out right now. :-)


SmartArt improvements in LibreOffice

Estimated read time: 2 minutes

I recently dived into the SmartArt support of LibreOffice, which is the component responsible for displaying complex diagrams from PPTX, especially in case only document model and the layout constraints are given, not a pre-rendered result.

First, thanks to our partner SUSE for working with Collabora to make this possible.

The problem

There are several ones. :-) If you are just interested in high quality viewing of PPTX files, then your problem started with PowerPoint 2007 not writing a pre-rendered drawingML markup of the diagram to the files, only PowerPoint 2010 started behaving like this. Additionally, if a diagram is not edited, then re-saving with PowerPoint 2010 doesn’t seem to generate the drawingML markup, either. This means that data + constraints cases are quite frequent even today.

Also, one day Impress should be able to actually edit these SmartArts as well, so having the knowledge how to lay out SmartArt (even if it’s import-time-only at the moment) is a good thing.

Results so far

I always write cppunit tests when I work on filter code (in this case OOXML), so far all fixes were visible in just two test files: smartart-vertial-box-list.pptx and vertical-bracket-list.pptx.

Here is how the baseline, the current and the reference rendering of these test documents look like:

smartart-vertial-box-list.pptx, baseline

smartart-vertial-box-list.pptx, current

smartart-vertial-box-list.pptx, reference

vertical-bracket-list.pptx, baseline

vertical-bracket-list.pptx, current

vertical-bracket-list.pptx, reference

In terms of code commits, the fixes are split into several ones:

Clearly the results are not perfect yet, but in both cases nothing was visible, and now all text is readable, so we’re moving in the right direction!

All this is available in master (towards LibreOffice 6.2), so you can grab a daily build and try it out right now. :-)

© Miklos Vajna. Built using Pelican. Theme by Giulio Fidente on github.