On 23.08.22 13:12, Michael Stahl wrote:
On 19.08.22 15:41, Phillips Rogfield wrote:
Dear developers,
I would like to fix bug 81720
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.
Basically when you insert a ReferenceMark, if you put the cursor at
the edge of it (start or end), and type something, it will expand on
the reference mark instead of writing it as a “normal text”.
You can find how to reproduce it in comment 22
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.
I have set up my environment, but I’m not sure where is the code that
“checks” if something is a ReferenceMark, if anything.
Can you point me in the right direction, please?
so firstly, while cross references are fields, the reference marks are
not fields in Writer.
there are 2 different kinds of reference mark, both represented by a
SwTextAttr with ID RES_TXTATR_REFMARK.
one has a dummy character in the text, CH_TXTATR_INWORD, and behaves
similar to a field - it does not have an end position, so it cannot mark
text, it only contains its dummy character.
the other has a start and end position, but no dummy character - this is
the one you're concerned about.
these SwTextAttr all exist in a SwpHints array that is a member
SwTextNode::m_pSwpHints, sorted in multiple different ways.
when editing the text, the hints start and end positions are adjusted in
SwTextNode::Update() and its base class SwContentIndexReg::Update() -
it's rather complex code but i think you need to tweak these functions
to fix the problem.
forgot one thing: bookmark positions already work in the way that you
want reference marks to work, text is always inserted outside the
bookmark - maybe you could find out how that is implemented in the
Update functions.