https://bugs.documentfoundation.org/show_bug.cgi?id=170602

--- Comment #5 from Justin L <[email protected]> ---
This is going to be extremely tricky.

IIUC, SdtBlockHelper m_aParagraphSdt only handles these grabbagged SDTs. It
STARTS on the paragraph that has the SdtPr grabbag property. However, since
blockSDTs can contain multiple paragraphs, it does not necessarily end in that
paragraph. (Rather, we have m_aParagraphSdt.m_bStartedSdt as the only flag that
this w:sdt needs to be closed.)

It ends when we get to a paragraph that contains the grabbag property
'ParaSdtEndBefore' (or we reach something that scares us and we end it early).
So before starting that w:p, we call EndParaSdtBlock.

Nested SDTs cause a bit of a problem with this. We'll start at the initial SDT,
and end at the earliest nested SDT I expect. (Further 'ParaSdtEndBefore' are
ignored because m_bStartedSdt is no longer true.)

I also expect that a grabbag-SDT containing a fly-with-a-nested-grabbag-SDT
will end up creating a corrupt result, but that is a teeny edge-case.

So, based on this logic, we need something like this:
-when m_bSdtStarted becomes true, cache the m_nSdtPrToken
-any bookmarkEnds not allowed for nSdtPrToken get stored while m_bSdtStarted
-and written when EndParaSdtBlock

That sounds good in theory, but the problem is that (for the first paragraph)
we have already processed ALL of the bookmarks even before we check for
'SdtPr'. So that means I also need to re-write the entire caching mechanism.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to