[Libreoffice] Need some informations on format attributes

Michael Stahl mstahl at redhat.com
Thu Nov 24 06:09:25 PST 2011


On 23/11/11 19:06, Maxime de Roucy wrote:
> Hello
> 
> I am the author of the bug number 43067
> ( https://bugs.freedesktop.org/show_bug.cgi?id=43067 ).
> 
> I am trying to solve that bug.
> I tried to insert
> "rWrtShell.ResetAttr();" 
> just before the 
> "rWrtShell.SetAttr(*pTemplateItemSet);"
> line.
> 
> It works but only when I just apply text formatting (hold Ctrl when you
> select the text to format).

i believe the merging is intentional; resetting the attributes is not
desired: think about what should happen if you apply the formatting to a
selection that has non-uniform formatting, surely we want to retain e.g.
different font sizes when the style that is painted only says "bold".

> I would like to know how to differentiate formatting attributes that
> come from style:family="paragraph" and those that come from
> style:family="text".

the paragraph formatting attributes are SfxPoolItems with WhichIds
RES_CHARATR_* contained directly in the SfxItemPool (or was it a writer
specific subclass?) that is stored in the SwTxtNode; there are various
SwTxtNode methods to get/set them, but the UI should not call those
directly.

for spans with automatic styles, we create a text hint SwTxtAttr that
contains a SfxPoolItem with WhichId RES_TXTATR_AUTOFMT, which in turn
contains an SfxItemSet that contains the SfxPoolItems with WhichId
RES_CHARATR_*.
for spans with non-automatic text styles, we create a text hint
SwTxtCharFmt with WhichId  RES_TXTATR_CHARFMT.

the text hints live in the SwpHints instance of the SwTxtNode (a.k.a the
hints array).

regards,
 michael



More information about the LibreOffice mailing list