Slide 1

Slide 1 text

TextBoxes in LibreOffice Writer Miklos Vajna 2015­01­31

Slide 2

Slide 2 text

2 / 19 FOSDEM 2015, Brussels | Miklos Vajna About Miklos ● From Hungary ● More blurb: http://vmiklos.hu/ ● Google Summer of Code 2010/2011 ● Rewrite of the Writer RTF import/export ● Writer developer since Feb 2012 ● Contractor at Collabora since Sep 2013

Slide 3

Slide 3 text

Complex shapes with complex content

Slide 4

Slide 4 text

4 / 19 FOSDEM 2015, Brussels | Miklos Vajna Complex shape ● Anything that is more than a plain rectangle: ● Callouts ● Rectangles with special corners ● Pentagons ● SdrObjCustomShape internally

Slide 5

Slide 5 text

5 / 19 FOSDEM 2015, Brussels | Miklos Vajna Complex content ● Anything that is more advanced than editengine ● Table in the shape text ● As-character charts ● Tracked changes ● Writer fields

Slide 6

Slide 6 text

6 / 19 FOSDEM 2015, Brussels | Miklos Vajna Result #1 ● Chart inside a left arrow callout:

Slide 7

Slide 7 text

7 / 19 FOSDEM 2015, Brussels | Miklos Vajna Result #2 ● Tracked changes inside a cloud callout:

Slide 8

Slide 8 text

8 / 19 FOSDEM 2015, Brussels | Miklos Vajna Result #3 ● Tracked changes inside a fixed cloud callout:

Slide 9

Slide 9 text

9 / 19 FOSDEM 2015, Brussels | Miklos Vajna Result #4 ● SmartArt inside a snip diagonal corner rectangle:

Slide 10

Slide 10 text

10 / 19 FOSDEM 2015, Brussels | Miklos Vajna Result #5 ● Table of Contents inside a pentagon:

Slide 11

Slide 11 text

How is this implemented?

Slide 12

Slide 12 text

12 / 19 FOSDEM 2015, Brussels | Miklos Vajna Situation in 4.3 ● Getting rid of the VML fallback:

Slide 13

Slide 13 text

13 / 19 FOSDEM 2015, Brussels | Miklos Vajna Document model ● SdrObject (svx) ↔ TextFrame (sw) ● Both have an SwFrmFmt ● So far unused RES_CNTNT ("content") property in the SdrObject's SwFrmFmt ● Pairing them if both the draw and the fly format point to the same content ● Properties of the TextFrame are generated (position, size, etc.)

Slide 14

Slide 14 text

14 / 19 FOSDEM 2015, Brussels | Miklos Vajna UNO API ● Hides the detail that the TextFrame and the SdrObject are in fact two objects. ● When the draw shape has TextBox attached, the editeng text is unused. ● A new optional boolean property to see who provides the text. ● Everything else is fully transparent. ● In contrast with the previous sw vs svx API differences

Slide 15

Slide 15 text

15 / 19 FOSDEM 2015, Brussels | Miklos Vajna Layout ● “Put TextFrame into an SdrObj as a TextBox” design → not much to be done ● Positioning of as-character anchored shapes having TextBoxes is still a challenge ● See SwFlyCntPortion::SetBase() ● Be careful about layout modifying doc model

Slide 16

Slide 16 text

16 / 19 FOSDEM 2015, Brussels | Miklos Vajna Filters ● #1 use case: improve Word (and in particular DOCX) compatibility ● But now we got much more, e.g. multi-column text could be added easily that's not available in Word, either ● DOCX import now avoids setting service name from original to css.text.TextFrame in case shape has shape text ● ODF had implicit support already ● Except: tables, in extension namespace for now

Slide 17

Slide 17 text

17 / 19 FOSDEM 2015, Brussels | Miklos Vajna User interface ● Just do the right thing: ● Moving, resizing, deletion, copy&paste, … ● Context menu to add/remove TextBox:

Slide 18

Slide 18 text

18 / 19 FOSDEM 2015, Brussels | Miklos Vajna Thanks ● Collabora is an open source consulting company ● What we do and share with the community has to be paid by someone ● CloudOn sponsored this work

Slide 19

Slide 19 text

19 / 19 FOSDEM 2015, Brussels | Miklos Vajna Summary ● Writer Textboxes allow complex shapes with complex content ● Available in LibreOffice 4.4 ● Improves DOCX experience of out the box ● Optionally available in every other document ● One more long-standing problem solved ● Thanks for listening! :-) ● Slides: http://vmiklos.hu/odp