Apache OpenOffice (AOO) Bugzilla – Issue 47079
copying autotext from one group to another looses textables
Last modified: 2013-08-07 14:38:26 UTC
Hi, I tried to copy an autotext from one group to another with the following basic snippet. Seems not to work really, cause all text tables from the autotext are lost during the copy ... :-( does not work in oo 1.1.4 too ... No problems moving autotext via ui (drag & drop). I will create an attachment ... regards Oliver -- OPTION EXPLICIT Sub CopyAutotext Dim oATContainer as Object Dim oSrcGroup as Object ' contains an autotext with a text table Dim oDestGroup as Object ' is empty ... oATContainer = CreateUnoService( "com.sun.star.text.AutoTextContainer") oSrcGroup = oATContainer.getByName("src") oDestGroup = oATContainer.getByName("dest") oDestGroup.insertNewByName("xxx", "copy", oSrcGroup.getByIndex(0)) End Sub
Created attachment 24856 [details] src autotext file
Created attachment 24857 [details] dest autotext file
Reassigned to SBA.
ES->JSK: please evaluate if it is a Basic problem or a Writer problem. Thanx!
jsk->hi: I'm on vacation from next week and won't be able to take care of this task. Can you please take it?
It's SBA's area.
ES->JSK: do you park all your tasks elsewhere when you go on vacation??? ;) Sending back to you because it's not reproducible over the UI and it is probably a scripting problem.
jsk->ab: What is our current policy regarding "new" basic functionality?
ab->jsk: I don't know about such a policy, but this doesn't matter, as I see no connection between this problem and "new" Basic functionality, not even to Basic in general. This probably is an API problem and you should be able to see this, because there's no hint that this small pro- gramms fails because of any Basic core bug. Here obviously the imple- mentation of a service has to be checked. ab->tl: Please have a look
Well that's because of oSrcGroup and oDestGroup are both AutoTextContainer that are basically implementing the XAutoTextGroup interface (among some other, usually container interfaces). Especially they do not implement the XTextRange interface which is the required third argument type for the call to XAutoTextGroup::insertNewByName. That kind of use was originally never planned. If you feel this one should be implemented you may assign this one to 'requirements' as a request for enhancement.
*** Issue 52347 has been marked as a duplicate of this issue. ***
setting owner to 'requirements' and changing type to "enhancement"
Hi, i noticed that is seems to be possible to avoid the above mentioned problem by using the following code snippet. Can someone please verify/confirm this ? Is this maybe a solution for all kind of possible autotexts ? How does the gui drag & drop handle this case (cause moving via drag & drop always works ...) I will create a new attachment ... Oliver OPTION EXPLICIT Sub CopyAutotext() Dim oATContainer as Object Dim oSrcGroup as Object ' contains autotext with a text table Dim oDestGroup as Object ' empty container ... Dim oText as Object Dim oCursor as Object Dim i as Integer oATContainer = CreateUnoService( "com.sun.star.text.AutoTextContainer") oSrcGroup = oATContainer.getByName("src") oDestGroup = oATContainer.getByName("dst") For i = 0 To oSrcGroup.getCount()-1 oText = oSrcGroup.getByIndex(i).getText() oCursor = oText.createTextCursor() oCursor.gotoStart(False) oCursor.gotoEnd(True) oDestGroup.insertNewByName(CStr(i), "Copy " & CStr(i), oCursor) Next i End Sub
Created attachment 41582 [details] autotext test case ...
@bh: This issue is somewhat oldish now. My suggestion is to add the workaround sample to the API documentation, can you please take care of that?
verified in oo 3.1 - workaround macro seems to work
To grep the issues easier via "requirements" I put the issues currently lying on my owner to the owner "requirements".