Apache OpenOffice (AOO) Bugzilla – Issue 114097
programmatically modifying the data of an embedded chart does not udate the chart's visual representation
Last modified: 2017-05-20 11:19:33 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 ...
may be this is an opportunity to fix issues 79127 (Writer doesn't support XChartDataChangeEventListener) at the same time?
meant issue 79127
Created attachment 71411 [details] document to reproduce the bug case
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
@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?
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?
"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?
->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.
"There exists a workaround" is not the same thing as "worksforme" (which would mean: cannot reproduce). Reopening, targeting to Later.
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.
(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
Created attachment 77490 [details] Writer document with a formula and a chart that get modified by a macro
Reset assigne to the default "issues@openoffice.apache.org".