Issue 78849 - Writer: undo of charts when modifying tables needs better implementation
Summary: Writer: undo of charts when modifying tables needs better implementation
Status: CONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: 680m214
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
: 102990 (view as issue list)
Depends on:
Blocks:
 
Reported: 2007-06-25 12:26 UTC by thomas.lange
Modified: 2013-08-07 14:44 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
short sample document (12.08 KB, application/octet-stream)
2007-10-31 10:26 UTC, thomas.lange
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description thomas.lange 2007-06-25 12:26:16 UTC
Since the switch to chart2 the Undo for chart objects does not work as good as
with the old chart anymore.
This becomes increasingly obvious with fixing issue 75159. Where undo operations
may result in a chart that completely out of it's 'should be' state.

The undo operations for chart in sw should keep a clone of the 'old' chart
before the change happens in order to restore it later.
Comment 1 thomas.lange 2007-06-25 12:26:42 UTC
.
Comment 2 thomas.lange 2007-06-25 12:26:56 UTC
.
Comment 3 bjoern.milcke 2007-07-13 10:41:38 UTC
In CWS chart07 there is a new interface css::chart2::XUndoHelper. The chart's
XModel is a chart2::XUndoSupplier, that offers a method getUndoManager(). The
object returned is a chart2::XUndoManager which also implements XUndoHelper.

There are two methods at this interface:

1. XModel getModelCloneForUndo( [in] XModel xModelBeforeChange )

Call this method to get a clone of the model that you can store in an Undo-Action

2. void applyModelContent( [inout] XModel xModelToChange, [in] XModel
xModelToCopyFrom )

Call this in case you do an undo. the first parameter is the current XModel of
the chart, the second parameter is the XModel you remembered in the undo-action.

Note that the XModel you store still contains the XDataSequence objects the
writer's data provider created. So, when you delete a table and do an undo
afterward, I am not sure that the objects are still valid, because the data
sequence objects may have references to the table that was destroyed at one
point. The data sequences would have to be able to remember the ranges they use
and reconnect to the table that was created in undo. (Maybe this is not
necessary when the table itself was completely remembered in the undo action, I
don't know the details here).
Comment 4 thomas.lange 2007-07-30 10:28:03 UTC
As discussed with BM: changing target to OOo 2.4
Comment 5 thomas.lange 2007-10-31 10:17:49 UTC
unochart.hxx/cxx specific changes done.

Files changed:
- sw/inc/unochart.hxx
- sw/source/core/undo/untbl.cxx
- sw/source/core/unocore/unochart.cxx

TL->AMA:
untbl.cxx has now two new functions
- PrepareChartForUndo
- RestoreChartFromUndo
and a new member variable 
- m_xChartModelForUndo;
that can be used to copy and restore the chart data.
You will probably like to get rid of that new member when the implementation is
complete and that reference is stored in an undo object.

When adding the above functions where necessary please also have a break point
in SwDoc::UpdateCharts in docchart.cxx. That function should only be called once
per change/undo if possible. If it gets called more than once we should check
how to optimize that.
Comment 6 thomas.lange 2007-10-31 10:26:43 UTC
Created attachment 49289 [details]
short sample document
Comment 7 thomas.lange 2007-11-14 15:15:25 UTC
TL: cleaning up some older inconsistencies.
Files changed:
- unochart.hxx
- unochart.cxx
- unotbl.cxx
Comment 8 thomas.lange 2008-01-07 14:58:23 UTC
.
Comment 9 andreas.martens 2008-04-28 12:52:22 UTC
Set target OOo3.x
Comment 10 eric.savary 2009-06-22 11:19:11 UTC
*** Issue 102990 has been marked as a duplicate of this issue. ***