Issue 114097 - programmatically modifying the data of an embedded chart does not udate the chart's visual representation
Summary: programmatically modifying the data of an embedded chart does not udate the c...
Status: REOPENED
Alias: None
Product: Writer
Classification: Application
Component: programming (show other issues)
Version: OOO330m5
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-25 08:39 UTC by Frank Schönheit
Modified: 2017-05-20 11:19 UTC (History)
4 users (show)

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


Attachments
document to reproduce the bug case (15.18 KB, application/vnd.oasis.opendocument.text)
2010-08-26 13:56 UTC, Frank Schönheit
no flags Details
Writer document with a formula and a chart that get modified by a macro (18.41 KB, application/vnd.oasis.opendocument.text)
2012-04-25 00:37 UTC, Ariel Constenla-Haile
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Frank Schönheit 2010-08-25 08:39:13 UTC
open the attached document. It contains a chart with some simple data, and a
button. Press the button - it runs a macro which modifies the data of the
embedded chart. As you notice, the chart is not updated. Only if you force a
repaint - e.g. by moving another window over the chart and back -, the new chart
content is shown.

Effectively, this means that there's an invalidation missing in Writer, when an
embedded object is modified while not being activated.

Note that the problem does not happen in Calc. This is because Writer's OLE
object implementation differs from those of the other applications. The
important difference, with respect to this issue here, is the following:
An SdrOle2Obj object adds an XModifyListener to the XModel of the embedded
document - see SdrOle2Obj::AddListeners_Impl. In the call to
XModifyListener::modified, the SdrObject is invalidated, by calling its
SetChanged method (see SvxUnoShapeModifyListener::modified). This results in
repainting the object.

I'd say Writer should implement something similar for its own OLE object
implementation ...
Comment 1 eberlein 2010-08-26 09:33:32 UTC
may be this is an opportunity to fix issues 79127 (Writer doesn't support
XChartDataChangeEventListener) at the same time?
Comment 2 eberlein 2010-08-26 09:36:39 UTC
meant issue 79127
Comment 3 Frank Schönheit 2010-08-26 13:56:53 UTC
Created attachment 71411 [details]
document to reproduce the bug case
Comment 4 Oliver Specht 2010-08-26 14:18:16 UTC
There are two ways to update the window. 
One is to invalidate the controller window ( this could be more than one) 
This is equivalent to pressing Shift+Ctrl+R
thiscomponent.getcurrentcontroller.getframe.getcomponentwindow.invalidate( 1 )

the other is to refresh the model which is equivalent to Tools/Update/Page
formatting ( and takes longer )
thiscomponent.refresh

Comment 5 Frank Schönheit 2010-08-26 14:25:40 UTC
@os: you're not saying that this crappy workaround (invalidating the complete
window, or even refreshing the complete document) should be the responsibility
of each and every client of Writer, are you?
Comment 6 Oliver Specht 2010-08-26 15:05:16 UTC
What do you mean with "each and every client"? 
In general the application does not need to expect that _inactive_ OLE objects
are changing. You hopefully don't think that the repaint of the window takes
substantial resources compared to the resources needed for changing the chart
data, are you? 


Comment 7 Frank Schönheit 2010-08-27 08:24:29 UTC
"each and every client" means "each and every OOo API client which
programmatically modifies charts". In the other OOo applications, such
modifications are recognized by the application, and the respective shape is
repainted. Writer is the only app where this doesn't work.

My headache with invalidate is that it almost always means flickering, on some
platformats with some X-servers, with some <whatever> side conditions.
Invalidating the complete window would just not be needed, if Writer would fix
this properly.

> In general the application does not need to expect that _inactive_ OLE
> objects are changing

And that's the statement I'd like to challenge. What is our API good for, if we
put a "but don't do this!"-label on every second interface?
Comment 8 Oliver Specht 2010-08-27 08:44:06 UTC
->fs: Nobody said something about 'don't do this'.
At some point in the future the OLE objects of Writer might be replaced by OLE
shapes from the drawing engine. This should result in the behavior you request.
With more than 1600 open issues with targets 3.[3|4|x] ATM for Word processor I
consider this one as Worksforme.
Comment 9 Frank Schönheit 2010-08-27 08:50:00 UTC
"There exists a workaround" is not the same thing as "worksforme" (which would
mean: cannot reproduce).
Reopening, targeting to Later.
Comment 10 Regina Henschel 2012-04-24 23:45:07 UTC
I think, that the macro has an error.

After the lines
	data(0) = rowData()
	chart.Model.Data.setData( data() )
in sub modifyChartData
update is missing. That are the lines
	dim oXCOEO as variant
	oXCOEO = chart.ExtendedControlOverEmbeddedObject
	oXCOEO.update()

That is nesseccary for other OLE like formulas too, so nothing special for charts. I think, that it is no bug.
Comment 11 Ariel Constenla-Haile 2012-04-25 00:35:37 UTC
(In reply to comment #10)
> I think, that the macro has an error.
> 
> After the lines
>     data(0) = rowData()
>     chart.Model.Data.setData( data() )
> in sub modifyChartData
> update is missing. That are the lines
>     dim oXCOEO as variant
>     oXCOEO = chart.ExtendedControlOverEmbeddedObject
>     oXCOEO.update()
> 
> That is nesseccary for other OLE like formulas too, so nothing special for
> charts. I think, that it is no bug.

You shouldn't need to update anything, modifying the model should update the visual representation:

oChart is a chart	
	Dim oChartData, oData()
	oChartData = oChart.getData()
	oData = oChartData.getData()
	oData(0)(0) = oData(0)(0) * 0.95
	oChartData.setData(oData)
setData() should update the visual representation

oFormula is a math formula
	Dim sFormula$
	sFormula = oFormula.getPropertyValue("Formula")
	oFormula.setPropertyValue("Formula", sFormula + " newline " + sFormula )
setPropertyValue() should update the visual representation
Comment 12 Ariel Constenla-Haile 2012-04-25 00:37:39 UTC
Created attachment 77490 [details]
Writer document with a formula and a chart that get modified by a macro
Comment 13 Marcus 2017-05-20 11:19:33 UTC
Reset assigne to the default "issues@openoffice.apache.org".