Copy and Paste without closing tags?

From: Ben Martin <monkeyiq_at_users.sourceforge.net>
Date: Tue Sep 20 2011 - 04:25:50 CEST

Hi,
  Looking at the copy and paste paths, using trunk, if one has a
document fragment as:

foo 'bar' baz

where 'bar' is a bookmark and the selection extends from foo through to
the first b in 'bar', when doing a copy one doesn't get a bookmark close
in the RTF on the clipboard:

...
{\f0\fs24\lang3081{\*\listtag0}\abinodiroverride\ltrch foo \uc1\u8216
\'91}
{\*\bkmkstart bar}
{\f0\fs24\lang3081{\*\listtag0}b}
}

For the benefit of all, see IE_Exp::copyToBuffer() to enable such RTF
dumps. This lack of close tag holds in the document after the RTF is
pasted.

I have added some smarts to ~s_RTF_ListenerWriteDoc to create matching
tags for text:meta (RDF Links) but this seems like a general problem
where a general solution would be more useful.

I am thinking of something like a PL_Listener subclass that tracks open
elements and fires synthetic close elements when the document fragment
at hand is been explicitly seen. This new listener could be inserted
where the s_RTF_ListenerWriteDoc currently is and the new listener could
call the real s_RTF_ListenerWriteDoc. ie, the new object sits between as
a shim.

In the case above a call to
populate( PL_StruxFmtHandle sfh, const PX_ChangeRecord * pcr);
would be made by the new listener would with a synthetic pcr (or a
matching one from later in the real document), to close the bookmark.

The PL_Listener subclass could track the ordering of text:meta, link,
bookmark et al tags and close them in an appropriate order by emitting
the synthetic events at closing time.

Of course, I might be missing things so I thought I'd ping the list to
see what the thoughts are.

Received on Tue Sep 20 04:26:09 2011

This archive was generated by hypermail 2.1.8 : Tue Sep 20 2011 - 04:26:09 CEST