a year in libreoffice’s rtf support · libreoffice conference 2016, brno | miklos vajna 18 / 20...

20
A year in LibreOffice’s RTF support By Miklos Vajna Senior Software Engineer at Collabora Productivity 2016-09-08 @CollaboraOffice www.CollaboraOffice.com

Upload: others

Post on 21-Sep-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

A year in LibreOffice’sRTF supportBy Miklos Vajna

Senior Software Engineer at Collabora Productivity

2016-09-08

@CollaboraOffice www.CollaboraOffice.com

Page 2: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

2 / 20 LibreOffice Conference 2016, Brno | 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 Sept 2013

Page 3: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

Writer RTFfilter maintenance

Page 4: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

4 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

New features #1

● Maintenance is mostly about bug-fixing, but…

● User-defined properties:● Both RTF import and

export

Page 5: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

5 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

New features #2

● Classification support: copy&paste

● Provide the info on export

● Parse and limit on import

Page 6: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

6 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #1

● tdf#92521 RTF export: handle section break right after a tableOriginal

Before / bad

After / good

Page 7: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

7 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #2

● tdf#94043 RTF filter: implement column separator handling

Original

Before / bad

After / good

Page 8: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

8 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #3

● tdf#94377 RTF export: support comment formatting

Original Before / bad After / good

Page 9: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

9 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #4

● tdf#61511 RTF export: handle page background solid color fill

Original Before / bad After / good

Page 10: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

10 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #5

● tdf#59699 RTF import: handle INCLUDEPICTURE field

Before / bad After / good

Page 11: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

11 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #6

● tdf#65642 RTF filter: import \pgnrestart and \pgnucltr + \pgnlcltr + \pgnucrm + \pgnlcrm + \pgndec

Before / bad

After / good

Page 12: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

12 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #7

● tdf#90097 RTF import: handle fRelFlipV property for line shapes

Original Before / bad After / good

Page 13: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

13 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #8

● tdf#91684 RTF import: fix scaling of group shape children

Original Before / bad Fixed scaling

Page 14: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

14 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #9

● tdf#91684 RTF import: handle fFlipH and fFlipV shape props

Original Fixed scaling

After / good

Page 15: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

15 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Bugfixes #10

● tdf#100507 RTF import: don't set default para style to the 0th character style

Original Before / bad After / good

Page 16: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

Technical details

Page 17: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

17 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Show me the code!

● Code is mostly at:● sw/source/filter/{rtf,ww8/rtf*} – export● writerfilter/source/rtftok/ – import

● 69 commits:● 31 bugfixes● 38 new feature / refactor

Page 18: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

18 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Testing

● 37 new tests● No single bugfix without a matching unit

test in the last year!● 0 regressions in the bugzilla:

● RTF in the summary, keywords: regression● And no resolution

● Sample one-liner regression test:

CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6618), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));

Page 19: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

19 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Refactor

● std::lround()● Consistent prefixes● Cross-directory includes● C++11 auto

vs

for (std::vector<std::pair<Id, RTFValue::Pointer_t>>::const_iterator i = m_pSprms→begin(); i != m_pSprms->end(); ++i)

for (auto& rSprm : *m_pSprms)

Page 20: A year in LibreOffice’s RTF support · LibreOffice Conference 2016, Brno | Miklos Vajna 18 / 20 Testing 37 new tests No single bugfix without a matching unit test in the last year!

20 / 20 LibreOffice Conference 2016, Brno | Miklos Vajna

Summary

● The LibreOffice Writer RTF filter keeps improving● New features from time to time● Regular bugfixes● 0 known regressions

● Thanks for listening! :-)● Slides: http://vmiklos.hu/odp