Index ¦ Archives ¦ RSS > Tag: en

Start of document themes in Impress: shape text

Estimated read time: 5 minutes

Impress now has the start of document theme support: it is possible to define a document theme on master pages and you can refer to the theme colors from shape text (including effects).

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

Motivation

PowerPoint users can attach a set of colors (and fonts, formattings) to master pages, and then refer to these in shape text, shape fill, shape geometry. You can even make the original color lighter and darker. These effects are preserved when you change the theme colors.

This is a larger feature, this blog post shows how theme colors can be defined and how to refer to those colors from Impress shape text. The rest of the feature is to be done in follow-up steps.

Results so far

Here is a demo that shows how it works:

Figure 1. Demo of theme support in Impress shape text

In other words, it consists of 2 parts on the UI:

  • You can define theme colors once you click on "Master View" in Impress, and then select the Slide → Slide properties menu item, and there choosing the new Theme tab. You can e.g. make "accent1" blue, "accent2" orange, and so on.

  • Then you can refer to these theme colors. Select some shape text, and then either use Format → Character → Font effects → Font color → Theme colors or use the sidebar to set the font color.

This later shows a grid of colors: each column is one theme color and then the column offers various lighter and darker variants of the color.

And the important bit: if you later change theme colors, then the color of shape text (using theme colors) is updated, even the effects (lighter or darker variants) are preserved.

To set expectations, this only works for shape text for now, and only in Impress, as a start.

How is this implemented?

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

As usual, the high-level problem was addressed by a series of small changes. The first step was to upstream work by Toma┼ż Vajngerl and Sarper Akdemir from the feature/themesupport2 feature branch:

The rest of the work was to go through the usual stages of document model, UNO API, rendering, ODP/PPTX filter and UI work to complete the work started on the branch:

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 intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release too (7.4).


Writer embedded objects: reliably update object previews

Estimated read time: 2 minutes

Embedded objects in Writer consist of a native data part and a preview part. Until now, there was no way to force the update of the preview part in case it was empty.

Now the Tools → Update → Update all menu item updates such previews as well. This is especially useful if you manipulate the ZIP/XML document directly to insert native data, then load it into Writer to generate a preview.

First, thanks Vector who made this work by Collabora possible.

Motivation

The Update all menu item already updates all sorts of generated content: fields, table of contents, charts, the document layout, but not the preview of embedded objects. You could work this around by double-clicking on the embedded object to re-generate the preview, but doing this manually for a larger document is not efficient. This is especially useful for hand-crafted documents which have proper native data, but no preview image yet.

Results so far

Here is how an embedded object without a preview looks like:

https://share.vmiklos.hu/blog/sw-ole-update/old.png
Figure 1. Writer embedded object with no preview

Now using the Update all menu item turns a sample document into this preview:

https://share.vmiklos.hu/blog/sw-ole-update/new.png
Figure 2. Writer embedded object with a preview

How is this implemented?

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

sw: update previews of OLE objects on "update all" is the change implementing this small feature. It works by:

  • Iterating over the frame formats ("special" formats) of the document

  • Filter out shapes

  • Filter out objects which are only reachable from the undo stack

  • Filter out objects which are not embedded ("OLE") objects

  • Once we have access to the OLE node, jump to its SwOLEObj, then to its svt::EmbeddedObjectRef, which knows how to re-calculate the preview bitmap

  • Finally notify the OLE node that the preview was updated, so the necessary repaint can happen

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.4).


Start of linked paragraph and character styles in Writer

Estimated read time: 2 minutes

Writer now has the start of linked character and paragraph styles. This improves DOCX compatibility, extends ODT and it’ll improve the style previews and the UI in the future, hopefully.

First, thanks Docmosis who made this work by Collabora possible.

Motivation

Word allows linking paragraph and character styles together, which means only the paragraph one will be present on the UI. Such a split has benefits if you customize the character properties on the UI and later you want to update the paragraph properties from a template, for example.

This is frequent markup in DOCX files, because Word defaults to splitting out the character properties of a Test paragraph style into a Test Char character style on editing.

Saving the document in Writer and then viewing it in Word lead to loosing these links, so their style pickers started to show unwanted Test Char rows.

Results so far

We used to preserve such linking information when doing DOCX → DOCX conversion for a while, since about 2013. But such preservation was in-memory, so if you saved the document to ODT, then such information was lost. This approach also lacked a real document model, which is necessary to incrementally build this feature into a complete solution.

Here is how the style picker in Word looks like now, after a DOCX → ODT → DOCX pipeline:

https://share.vmiklos.hu/blog/sw-linked-styles/new.png
Figure 1. Word’s style picker, new output: no unwanted additional character styles

Here is how this used to look like before the new changes (note the Heading 1 Char line between Heading and Index):

https://share.vmiklos.hu/blog/sw-linked-styles/old.png
Figure 2. Word’s style picker, old output: unwanted additional character styles

And here is how the input document looks like:

https://share.vmiklos.hu/blog/sw-linked-styles/ref.png
Figure 3. Word’s style picker, reference output: no unwanted additional character styles

How is this implemented?

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

Just to set expectations, this is currently an invisible feature, but unlike the old approach from 8 years ago, this one can be extended into a full feature, incrementally. It also survives ODT roundtrips.

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.3).


Transparent shadow for tables from PPTX in Impress

Estimated read time: 2 minutes

Impress is now able to correctly render shadows for table shapes, even if the shadow itself or the fill of the table cells have transparency. The result is now compatible with PowerPoint.

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

Motivation

We got a PPTX document, which has a table shape with pink background and a blurry shadow. Impress rendered a red background, making the text hard to read.

The request was to improve the shadow rendering to be PowerPoint-compatible and in general correctly support transparency when it comes to table cell fills and table shadows.

Results so far

The table shadow now looks like this:

https://share.vmiklos.hu/blog/sd-table-transparent-shadow/new.png
Figure 1. New render result in Impress

Matching the reference rendering:

https://share.vmiklos.hu/blog/sd-table-transparent-shadow/ref.png
Figure 2. Reference render result

While background was red previously:

https://share.vmiklos.hu/blog/sd-table-transparent-shadow/old.png
Figure 3. Old render result in Impress

You can see that not only the background in the top center cell is pink now, but the blurry table shadow is still correct.

How is this implemented?

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

As usual, the high-level problem was addressed by a series of fixes:

With these, it’s now possible to add transparency to both table cell fills and to table shadows, and the rendering will take both into account, correctly.

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 intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release too (7.3).


Start of list level support in Writer paragraph styles

Estimated read time: 2 minutes

Writer now has the start of list level support in Writer paragraph styles. This improves ODT and DOCX compatibility, and it’ll improve the style previews and the UI in the future.

First, thanks Docmosis who made this work by Collabora possible.

Motivation

A paragraph might have an associated list in Writer and that list can have multiple levels. This is direct formatting. When it comes to paragraph styles, referring to a list was already possible, but defining a custom list level was not.

Loosing this information in Word documents was quite annoying, and it turned out that ODF also has markup for this, just LibreOffice didn’t implement it.

This work is currently done for the document model, scripting API and file filters: style previews & UI still needs finishing.

Results so far

Writer can at the moment preserve list level info from ODT and DOCX files. Here is how a file written by Writer looks like in Word:

https://share.vmiklos.hu/blog/sw-parastyle-listlevel/parastyle-listlevel.png
Figure 1. Writer exporting a paragraph style with list level info

You can see that the style preview in Word takes the list level into account. Doing the same and applying the list level as part of applying the paragraph style on the Writer UI is still future work.

Thanks to Justin Luth who did the follow-up work to adapt the DOC filter accordingly, and also doing other related fixes.

How is this implemented?

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

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.3).


Unshare shape properties for the same type before insertion in Impress

Estimated read time: 2 minutes

Shape properties were shared by shape type (e.g. shared between group shapes) before insertion into a document model in Impress. This is now fixed: the property names and types are still shared to help performance, but their values are no longer shared. This helps matching the user expectation that separate opened documents don’t share information with each other.

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

Motivation

I was working on a testcase for tdf#132696 when I noticed that the existing CppunitTest_oox_drawingml testsuite runs fine before my changes, also a newly added testGroupShapeSmartArt testcase runs fine in isolation, but if I run the whole testsuite, then it breaks.

Further investigation revealed that in case testGroupShapeSmartArt is executed first, then testTdf131082 fails. This means:

  • the first document is opened

  • the first document is closed

  • the second document is opened

  • the second document is saved

And at this point information from the first document is leaked to the second document, even if the first document was already closed by the time we performed the save. It turns out the root cause was i#114206 (reported in 2010), i.e. group shapes shared their property values till they got inserted to the document model. The first document import did not consume pending SmartArt properties on a to-be-inserted group shape, the second import was looking for pending properties, found them. And then the second document’s save wrote those pending properties to the file, leading to this unexpected leak.

Here is how the first document looks like, containing the blue rectangles (a SmartArt):

https://share.vmiklos.hu/blog/sd-groupshape-unshare/first.png
Figure 1. First document with a SmartArt

Here is how the second document looks like, without a SmartArt:

https://share.vmiklos.hu/blog/sd-groupshape-unshare/second.png
Figure 2. Second document after loading, no SmartArt

And here is how the second document looks, after saving to PPTX and reloading:

https://share.vmiklos.hu/blog/sd-groupshape-unshare/second-saved.png
Figure 3. Second document after reloading, with a SmartArt

Results so far

The fix is to split out part of SvxItemPropertySet to a separate class, so that we can keep sharing SvxItemPropertySet between multiple instances of the same shape type (describing the name and type of the various properties), while introducing a new SvxItemPropertySetUsrAnys that is specific to each not-yet-inserted shape. This way each pending shape is independent, and in case they are not inserted to the document model later, that results in no side-effects.

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.3).


Calc buttons with macros: better XLSX support

Estimated read time: 2 minutes

Embedding macros to Calc documents and invoking them by clicking on buttons is a common use-case. There was also decent support for importing these from XLSX (XLSM to be precise), but the export side was not on par with the binary XLS export.

Calc now got a series of incremental improvements to map our form controls (buttons in particular) to OOXML’s form controls, especially when macros are assigned to such buttons.

This work is primarily for Collabora Online, but the feature is fully available in desktop Calc as well.

Motivation

Excel has both form controls and ActiveX controls, and tdf#106181 XLSX export: output form controls last year started adding support for form control export to XLSX.

Hoping that this will be mostly shared drawingML export code fixing (benefiting DOCX and PPTX as well), it seemed reasonable to assume that we can improve button handling from the "it’s lost" state to "it’s good enough" with some effort.

Results so far

Now Excel shows the button and you can click on it:

https://share.vmiklos.hu/blog/sc-xlsx-button-macro/new.png
Figure 1. Excel consuming our XLSM output with a button and a macro

While it used to just refuse our export result:

https://share.vmiklos.hu/blog/sc-xlsx-button-macro/old.png
Figure 2. Excel refusing bad XLSM output

How is this implemented?

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

As usual, the end goal was reached via a set of incremental commits:

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.3).


Writer line heights: removing a 16bit limit

Estimated read time: 2 minutes

Line heights in Writer are typically defined in points on the UI (e.g. 12pt), though they are measured in twips internally (1 point is 20 twips). This height was stored in a 16bit unsigned integer, so the maximum allowed height was 65536 twips, around 116 cm.

Now we track line heights with 32 bits ints, so this limitation is practically removed.

First, thanks Vector who made this work by Collabora possible.

Motivation

Once you insert an image to a Writer document, you can customize its anchor type. The as-char anchor type is handy if you don’t want text to flow around the image. This has the side effect that a large image significantly increases the nominal height of a line. The problematic document had an image height of 118.9 cm (46.81 inch), so the unsigned integer used to represent its height wrapped around, leading to an incorrect layout.

Results so far

Now it looks like the way you would expect it:

https://share.vmiklos.hu/blog/sw-line-height/sw-line-height.png
Figure 1. Writer as-char image with height that is larger than 65k twips

How is this implemented?

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

As usual, the end goal was reached via a set of incremental commits:

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.2).


Bibliography improvements in LibreOffice Writer: refer to a specific page

Estimated read time: 3 minutes

The bibliography feature in Writer allows authors of e.g. scientific papers to track sources: first you can insert bibliography entry fields, then at the end you can generate a bibliography table automatically.

Writer recently gained two improvements in this area, and now there is one more: the ability to refer to a specific page of a (potentially long) source.

First, thanks TUBITAK ULAKBIM who made this work by Collabora possible.

Motivation

The same feature in normal HTML linking / citation is well-known: you can place anchors in your document and then links can refer to not only to your page, but also can set the fragment part of the URL to jump to a specific section directly. E.g. this link will jump to the "Motivation" section of the above referred previous post.

Wouldn’t it be nice if you could also jump to a specific page of a scientific PDF?

Results so far

You can add such references by choosing the Insert → Table of Contents and Index → Bibliography Entry menu item. Set Bibliography Source to Document Content and press the New button. The appearing dialog now has widgets to set a specific page number:

https://share.vmiklos.hu/blog/sw-bibliography-page/page.png
Figure 1. Refer to a specic page of a bibliography source, user interface

This is then stored in the URL by setting its fragment to page=..., and typically PDF readers understand this syntax, so when you click on the URL, the PDF will open exactly on the cited page.

This also works the other way around: URLs with such syntax are presented to the user with the dedicated widget to see, edit or delete the page number of the URL.

Finally, if you refer to different pages of the same source, the bibliography text generator detects this and lists the source in the bibliography only once.

How is this implemented?

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

As usual, the high-level problem was addressed by a series of incremental development steps:

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.2).


Improving borders of merged table cells in Writer

Estimated read time: 2 minutes

Writer now has better support for Word-compatible border rending when it comes to vertically merged cells in tables.

First, thanks Docmosis who made this work by Collabora possible.

Motivation

Both Word and Writer allow specifying borders for any kind of table cells. When the user creates a vertically merged cell, there is a covering cell and there is one or more covered table cells.

The Writer approach is to render the cell borders according to the properties of the covering cell. This has the benefit that each edge of the table cell has a single border style (e.g. dashed or hairline).

The Word approach is to render the cell borders as if there would be no vertical merge, according to the properties of the covered cell. This has the benefit that merging the content of cells vertically doesn’t change the border rendering, but it also requires more complex code for painting.

Results so far

Writer can now detect that your tables originate from Word formats and render table borders the Word way in that case.

Here is how the new rendering result look like:

https://share.vmiklos.hu/blog/sw-merged-border/new.png
Figure 1. Writer rendering in compatibility mode, new output

And here is how it used to look like:

https://share.vmiklos.hu/blog/sw-merged-border/old.png
Figure 2. Writer rendering in compatibility mode, old output

And finally the reference rendering is:

https://share.vmiklos.hu/blog/sw-merged-border/ref.png
Figure 3. Writer rendering in compatibility mode, reference output

You can see that the B4 and B5 cells are covered, they had some unwanted border on their left side and this is now gone.

How is this implemented?

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

  • First, some building blocks were introduced: SwCellFrame::GetCoveredCellInRow() can look up a covered cell in a certain row, provided that this cell covers it

  • Building on top of this, SwCellFrame::GetCoveredCells() can provide a list of cell frames which are covered by the current cell, due to vertical merge. This is needed, because previously the layout didn’t have to consider properties of covered cells, so while the document model had this information, it was not visible to the layout in a convenient way

  • Using the above functionality, SwTabFramePainter::Insert() can suppress painting of certain border lines in Word compatibility mode

  • Finally, the code change can be covered with a test by recording the rendering and asserting the vertical positions of border points: we can check that all the positions belong to the 1st, 2nd or 3rd rows, and not to a row below them

Want to start using this?

Collabora intends to continue supporting and contributing to LibreOffice, the code is merged so we expect all of this work will be available in TDF’s next release (7.2).

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