Hi Niklas, Thank you very much for your reply.:) maoyg wrote: > I am working Issue88467# about Undo question in page preview. > I have some questions about it. If the Undo or Redo is possible in page > preview. > when I create a spreadsheet doc, I input some characters in cell, > the undo list have recorded input operation. it display "input" string. > when I switch from normal mode to page preview mode. the undo button can use, > but the undo list can't display any string. I don't know why it can't display > string in undo list?
> SID_UNDO is disabled in ScPreviewShell::GetState. Unless you change all > the undo action implementations, it has to stay that way. I have removed SID_UNDO and SID_REDO in ScPreviewShell::GetState, Meanwhile added two new methods ExecuteUndo(...) and GetUndoState(...) in ScPreviewShell, as two new methods are used to handle SID_UNDO and SID_REDO. > I have called the method SetWidthOrHeight(...) in > ScPreview::MouseButtonUp(...), the undo can work, > but the undo list also can't display any string. > > I think I will revise the Redo method in ScUndoWidthOrHeight, when I call > Redo method in page preview mode, > because of the pViewShell is empty, it call SetWidthOrHeight(...) method, > enentually it will cause program crash. > It's not enough to change only ScUndoWidthOrHeight. Any other undo > action may already be in the undo list. I have some questions about Undo which hover in my mind these days. I have two rough ideas in mind... First idea: I don't completely understand the specificaton on Undo. I make some operations in normol mode,for example,I input some characters in cell,or I change the column widths. the undo remembers these operations. when I switch from normal mode to page preview mode. Should operations that are recorded in Undo list in normol mode be used in page preview mode ? on the contrary, Should operations that are recorded in Undo list in page preview mode be used in normol mode ? e.g. I change the column widths in page preview mode. My thought is that operations that are recorded in Undo list in normol mode can't be used in page preview mode or operations that are recorded in Undo list in page preview mode can't be used in normol mode. Second idea: I trace the code, debug the application, find it's difficult for me to distingush the two mode accurrately. I add "SfxViewShell* pCur = SfxViewShell::Current(); ScPreviewShell* pViewSh = PTR_CAST(ScPreviewShell,pCur); SfxUndoManager* pUndoManager=pViewSh->GetUndoManager();" to distingush the two mode in ScPreviewShell::ExecuteUndo(...), But pUndoManager is null, I found pUndoMgr is null too in SfxShell::GetUndoManager(), the reason is when switching from normal mode to page preview mode, the SfxUndoManager has been deconstructed. Do you think whether I am in the right direction? Do you have any material about Undo? Sincerely, maoyg 2008.6.3
