Questions about Domain Mapper

Adam Fyne adam.fyne at cloudon.com
Sun Nov 24 08:14:13 PST 2013


*And some more elaboration on that:*
I just checked a simple DOCX that had some text in 'bold' and 'italic'. I
then turned ON the 'track changes' and removed the 'bold' and 'italic'.
When I round-tripped the DOCX through LO - the outputted file *had* the
'bold' and 'italic' turned on.
This means that the nodes that were inside the 'r->rPrChange->rPr' were
treated as if they were simply inside the 'r'->'rPr' (which is wrong).
This ephasises the need to detect when 'r->rPrChange->rPr' are being
analyzed in the importer - and to *not* analyze them normally on the run
itself, but to store them in the 'RedlineParams' somehow.


On Sun, Nov 24, 2013 at 6:06 PM, Adam Fyne <adam.fyne at cloudon.com> wrote:

> Hi Miklos,
>
>
> On Thu, Nov 21, 2013 at 10:55 AM, Miklos Vajna <vmiklos at collabora.co.uk>wrote:
>
>> Hi Adam,
>>
>> > When I look at the code that processes these nodes - I see that all of
>> > these parameters
>> > are being processed here
>> >
>> http://opengrok.libreoffice.org/xref/core/writerfilter/source/dmapper/DomainMapper.cxx#2114
>> > and all are being inserted to the 'rContext' or used with
>> 'appendGrabBag'.
>> > So it seems like I should add a flag that is turned on when 'rPrChange'
>> is
>> > entered,
>> > and add a lot of 'if-else' statements in the code that processes all the
>> > 'italic', 'bold' etc
>> > to check - if the flag is 'on' - insert the property to the
>> 'RedlineParams'
>> > structure,
>> > otherwise - insert the property to the 'rContext'.
>> > Is this the right approach? It will dirty the code...
>>
>> You don't have to deal with each property individually, you can just
>> handle the collected properties. Have a look at text::XRedline, its
>> makeRedline() method takes a beans::PropertyValues, which is a
>> string-any map in practice. You can add a new "RedlineOldformat" (or
>> similar) key to that map, and the value of that key can be your property
>> list. When you handle that property in sw core, you can convert that to
>> an SfxItemset. (Have a look at how to code handles the "property list"
>> -> SfxItemSet conversion when you append a new text portion with a given
>> set of properties.)
>>
>
> I think I was misunderstood.
> I think you thought I was asking : "I need to add each property like
> bold\italic\underline separatly to the RedlineParams".
> What I actually meant to ask was:
> Currently there are a lot of XML nodes that might appear under 'rPr' node
> (that is under the 'rPrChange').
> For example: 'bold', 'boldbidi', 'italic', 'italicbidi', language, etc.
> Currently each of these XML nodes is handled by different code in the
> 'DomainMapper.cxx' file
> (here is some of it:
> http://opengrok.libreoffice.org/xref/core/writerfilter/source/dmapper/DomainMapper.cxx#2100
> )
>
> So I am asking - do I have to go node-by-node and add it to the
> 'property-list' that will be in the 'RedlineParams'?
> Or is there any smart way of turning on some flag when the
> 'rPrChange->rPr' tag is entered,
> and checking at the end of the 'rPrChange->rPr' tag which properties were
> inserted to the 'rContext' and add those properties to the 'RedlineParams'.
>
>
-- 

[image: appicon.png]


*Adam Fyne*

Twitter <http://www.twitter.com/cloudoninc> |
LinkedIn<http://www.linkedin.com/company/cloudon>
 | Facebook <http://www.facebook.com/cloudoninc> |
Blog<http://site.cloudon.com/blog>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20131124/09f154cf/attachment.html>


More information about the LibreOffice mailing list