Issue 47079 - copying autotext from one group to another looses textables
Summary: copying autotext from one group to another looses textables
Status: CONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: 680m87
Hardware: All Windows XP
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
: 52347 (view as issue list)
Depends on:
Blocks:
 
Reported: 2005-04-09 10:19 UTC by Oliver Brinzing
Modified: 2013-08-07 14:38 UTC (History)
1 user (show)

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


Attachments
src autotext file (3.42 KB, application/octet-stream)
2005-04-09 10:20 UTC, Oliver Brinzing
no flags Details
dest autotext file (683 bytes, application/octet-stream)
2005-04-09 10:20 UTC, Oliver Brinzing
no flags Details
autotext test case ... (6.61 KB, application/octet-stream)
2006-12-20 08:51 UTC, Oliver Brinzing
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Oliver Brinzing 2005-04-09 10:19:14 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
Comment 1 Oliver Brinzing 2005-04-09 10:20:19 UTC
Created attachment 24856 [details]
src autotext file
Comment 2 Oliver Brinzing 2005-04-09 10:20:50 UTC
Created attachment 24857 [details]
dest autotext file
Comment 3 michael.ruess 2005-04-11 07:30:55 UTC
Reassigned to SBA.
Comment 4 eric.savary 2005-06-22 09:41:49 UTC
ES->JSK: please evaluate if it is a Basic problem or a Writer problem. Thanx!
Comment 5 joerg.skottke 2005-06-23 07:00:12 UTC
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? 
Comment 6 h.ilter 2005-06-23 09:02:01 UTC
It's SBA's area.
Comment 7 eric.savary 2005-06-23 10:19:11 UTC
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.
Comment 8 joerg.skottke 2005-06-24 11:20:06 UTC
jsk->ab: What is our current policy regarding "new" basic functionality?
Comment 9 ab 2005-06-24 11:49:02 UTC
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
Comment 10 thomas.lange 2005-06-29 09:53:16 UTC
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.
Comment 11 stephan.wunderlich 2005-07-28 13:22:10 UTC
*** Issue 52347 has been marked as a duplicate of this issue. ***
Comment 12 stephan.wunderlich 2005-07-28 13:24:01 UTC
setting owner to 'requirements' and changing type to "enhancement"
Comment 13 Oliver Brinzing 2006-12-20 08:50:03 UTC
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
Comment 14 Oliver Brinzing 2006-12-20 08:51:23 UTC
Created attachment 41582 [details]
autotext test case ...
Comment 15 joerg.skottke 2008-10-24 07:42:46 UTC
@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?
Comment 16 Oliver Brinzing 2009-05-19 10:57:13 UTC
verified in oo 3.1 - workaround macro seems to work 
Comment 17 bettina.haberer 2010-05-21 15:14:48 UTC
To grep the issues easier via "requirements" I put the issues currently lying on
my owner to the owner "requirements".