Re: Copy textstring to Clipboard <SOLVED>

steb <[email protected]> Wed, 19 Jan 2011 12:53:31 +0100
Newsgroups gmane.comp.openoffice.devel.api
Message-ID <[email protected]>
  Hello Ariel,

Am 02.12.2010 14:03, schrieb Ariel Constenla-Haile:
> Hello steb,
>
> On Thursday 02 December 2010, 09:44, steb wrote:
>>    Hi Fernand,
>>
>> i wonder which method to copy contents is recommended. I achieve the
>> same but I use a different approach with XSelectionSupplier in
>> combination with XDispatchHelper and the XTextViewCursor. Code is
>> similar to:
>>
>>       public void copyContent(XCellRange cellRange, XTextRange textRange)
> this is Java! so why are you using the dispatch API?
> Look at the Developer's Guide
> http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Common_Application_Features
> and the example in the OOo SDK
> </opt/openoffice.org/basis3.4/>sdk/examples/DevelopersGuide/OfficeDev/Clipboard/
>
> Regards
I'm sorry for not answering sooner, but I had some extended vacation :) 
. Well at least from work, had to study for my exams anyway ;).
But back on topic:

I do use this approach because I didn't find information on how to copy 
complex cell ranges with formatting inside the cells etc. All the 
examples I found where for text/strings only. But that's not something 
of interest for me.
I need a method to copy a whole table row with different content types, 
for example XTables, XTextFields (with different formatting like size or 
color) in it.

The only thing I could come up with, was the dispatch API since that can 
copy selections "as is" instead of merely copying strings. The forum , 
SDK and the wiki couldn't show me a way to use the SystemClipboard with 
more complex data structures. (or I wasn't capable of recognizing how to 
use it properply.)
If you know how to copy for example XCellRanges with all content 
"untouched" inside of it, without the dispatch API , I would love to 
know how since my code is really executing poorly if used on a few 
hundred/thousand copy actions.

@ Fernand
Thank you for sharing your code, but it's the same problem as described 
above: it's just copying strings, not generally XSelectable Objects.

Regards,

Steffen Börsig