Hi, Michael: Thanks for your response! 2010/3/10 Michael Stahl <[email protected]>
> On 09/03/2010 08:27, fan Zheng wrote: > > Hi, All: > > > > I have a question about the Change Recording (Redline), would you pls > give > > me some tips on it? > > > > As all we know, under the redline mode "Show", the content of all changes > > with type "Delete" recorded in the redline table of current document will > > still be visible in the context. > > > > And if we change the redline mode from "Show" to "Hide", said "Delete" > typed > > changes related content will be invisible by moving said content from > main > > body of document into the segment of hided changes (SHC). > > > > Said operation Hide for "Delete" changes was designed in 2 ways > (Implemented > > in SwRedline::Hide()): > > A. Move delete changes related content from main body into SHC; > > B. Make a copy of delete changes related content in SHC, and remove the > > original content from main body; > > > > Said design B is for almost all invoking of SwRedline::Delete(). And > design > > A is only invoked in the SwDoc::CompressRedlines(), which is a method for > > combining the existed change records. > > > > My question is, what do we concerned about to make the design of Hide in > 2 > > different ways? > > this is a very interesting question. > in fact i have probably asked it myself :) > the problem is that nobody knows the answer... the original authors of the > sw redline code have left many years ago. > > i can only speculate that in some cases there can be a difference whether > some range is moved or copied and then deleted. > for example, if the range contains frames, or footnotes, which have a > special section at the beginning at the nodes array for their content. > or maybe the reason has something to do with undo. > Doing something with undo... Gash, that is my biggest headache currently. In OO, Some flying object related undo action in SW, for example the inherit class of SwFlyingUndoBase, refer a SwFlyFrmFmt pointer as a member data, all the recording modifications must be undone or redone on the flying object through said pointer. For maintaining the validate of the pointer, any user modification of flying object must have corresponding undo action to be recorded into undo list. Some special modifications, such as the deletion of flying object, will just remove the corresponding SwFlyFrmFmt from the flying frame format list of data module (SwDoc::pSpzFrmFmtTbl), and the exact memory alloced in heap is not actually destructed. The destruction of said flying frame format could be invoked inside the corresponding undo actions. But on the other side, in the process of changing redline mode from "Show" to "Hide", the Deleted sections will be copied into SHC (by SwRedline::CopyToSection) and the original parts will be deleted from data module (by SwRedline::DelCopyOfSection), which is the directly deletion without any corresponding undo action recorded in (of cause should be designed like this. For changing redline mode from Show to Hide is not exact a user modification). That means, if there is any flying object inside corresponding deletion range, it will be deleted directly (destructed already). Any said flying object related undo actions recorded in list become time bombs. Crash is just standing at the corner of the street. In general, this is a problem about a same data managed by different patterns. Obviously, the design of undo action and design of redline is made by different person or team, right? The best way for solving said problem should be: shift "copy/delete" way into "move" way. And that is why I asked the former question... Do you any better idea on it? Thanks alot ! Easyfan.Zheng > > maybe there was a reason many years ago, but today that reason no longer > exists? > > i guess the only way to find out would be to change the implementation to > do it only one way, and then test a lot to see what breaks. > > actually, imho, the redline design in writer is fundamentally broken, > because the redlines are really part of the document model. > the option to change the redline mode from "Show" to "Hide" is purely a > view option, and should not change the document model in any way. > > regards, > michael > > -- > "I conclude that there are two ways of constructing a software design: > One way is to make it so simple that there are obviously no deficiencies > and the other way is to make it so complicated that there are no obvious > deficiencies." -- C. A. R. Hoare (in "The Emperor's Old Clothes") > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
