Hi,
I solved my problem using the XTransferableSupplier interface at the
document
controller. But I was lucky, because I've to copy/paste text or table blocks
loading
document in hidden mode.
If I launched my java application that loads a document with
some text and table blocks to copy/ paste (using only the
XTransferableSupplier interface at the controller) and my application shows
the writer gui using OOoBeanViewer (no hidden mode), it happens something
strange:
if I open another document, using the writer while my java application is
running the copy / paste task, I can use clipboard to access what
my java application is coping (I succeded in pasting it).
This is an unexpected behaviour and it only happens if I open a writer
document,
I'm not able to cause the same from an external application (i.e.
notepad).
If I load the document in hidden mode, no content is
loaded into clipboard and I've no errors, even editing another writer
document. Is it possible?
Thanks
Filippo Machi
----- Original Message -----
From: "Mathias Bauer" <[EMAIL PROTECTED]>
To: <[email protected]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, November 30, 2007 9:27 AM
Subject: Re: [dev] Using clipboard to copy / paste formatted text
Filippo Machi wrote:
Hi,
I'm Filippo Machi. I've to copy portions of formatted text and/or table
rows in writer document, using java. These portions are defined using
user text fields. I succeded in that selecting portions and dispatching
copy / paste commands.
However, since my program performs a lot of these copies, if the user
changes the content of the clipboard when my program is running, he makes
copy/paste activity go wrong.
Now I'm wondering wheter...
1) is there another way to copy/paste text and rows keeping formatting?
(Autotext works with text but when I try to use it with table rows I copy
table structure too)
2) can I use another clipboard? A local clipboard in order to prevent
user activity to change chipboard content?
Thanks a lot
Kind regards
Filippo Machi
This is what the interface
com.sun.star.datatransfer.XTransferableSupplier is for.
It is implemented at the Controller object of a document view. You can
retrieve the current selection from a view and paste it somewhere else
and it will work exactly as if you had used the clipboard functions. You
can see it as a kind of "local clipboard".
This interface is implemented in Writer since several versions and in
Calc since 2.3 (IIRC). Draw/Impress is still missing.
Ciao,
Mathias
--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]