Bug 90105 - simplify drawing of presentation objects
Summary: simplify drawing of presentation objects
Status: RESOLVED FIXED
Alias: None
Product: Document Liberation Project
Classification: Unclassified
Component: libetonyek (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Anurag Kanungo
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillScript, topicCleanup
Depends on:
Blocks:
 
Reported: 2015-03-19 16:09 UTC by David Tardon
Modified: 2017-10-30 11:26 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Tardon 2015-03-19 16:09:41 UTC
The task is to simplify the code by removing one layer of indirection. There is an interface named IWORKObject, which originally served to save a part of input that could be later drawn to the RVNGPresentationInterface. This was then drawn to the output in one go. For that purpose, there are many subclasses of IWORKObject that wrap various kinds of objects, including their styles etc. Most of the original indirection is gone now, so this only adds extra code.

In the current code, output is generated on-the-fly during parsing. It still cannot be done directly to the passed RVNGPresentationInterface (because of master pages etc.), so it uses IWORKOutputElements (already used in various other libraries) to save the current "zone" (layer, notes,...)

The task is to go through all subclasses of IWORKObject and move the draw() code to the function in KEYCollector.cpp that creates (and draws) that object. This is mostly a straightforward copy; the only complication is that all calls of RVNGPresentationInterface functions (e.g., openParagraph(), drawPolyline(), etc.) on the painter object must be replaced by calls of IWORKOutputElements functions (e.g., addOpenParagraph(), addDrawPolyline(), etc.) on m_currentZone. 

This can be done in smaller chunks, preferably function-by-function.

There are objects that handle larger piece of input (like IWORKText or IWORKTable). For those, the drawing should probably remain internal, at least for now. But the respective drawing functions should be changed to take IWORKOutputElements argument instead of RVNGPresentationInterface.

There is a sample conversion in https://gerrit.libreoffice.org/gitweb?p=libetonyek.git;a=commit;h=b42f848f77727c678bbb67da9d4b1c3ba98d6f57 .

You should run the test suite (in libetonyek-test repo) after each commit to ensure there are no regressions.

When the last use of IWORKObject is dropped, the class itself should be removed. IWORKOutputElementsRedirector should be dropped too, as it is only a cludge to glue the old and new way together.
Comment 1 Robinson Tryon (qubit) 2015-12-18 10:07:26 UTC
Migrating Whiteboard tags to Keywords: (EasyHack DifficultyBeginner SkillScript TopicCleanup)
[NinjaEdit]