| View previous topic :: View next topic |
| Author |
Message |
Peter OOo Enthusiast

Joined: 28 May 2004 Posts: 105 Location: Berlin / Germany
|
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1313
|
Posted: Wed Jul 05, 2006 1:09 pm Post subject: |
|
|
Take this as a starter - it is rather straightforward
Good luck,
ms777
| Code: | Private oTRX
Sub Main
Dim null as Object
oClip = createUnoService("com.sun.star.datatransfer.clipboard.SystemClipboard")
oTRX = createUnoListener("TR_", "com.sun.star.datatransfer.XTransferable")
oClipContents = oClip.setContents(oTRX, null)
End Sub
function TR_getTransferData( aFlavor as com.sun.star.datatransfer.DataFlavor ) as Any
if (aFlavor.MimeType = "text/plain;charset=utf-16") then
TR_getTransferData = "From OO with love ..."
endif
end function
function TR_getTransferDataFlavors() as any
Dim aF as new com.sun.star.datatransfer.DataFlavor
aF.MimeType = "text/plain;charset=utf-16"
aF.HumanPresentableName = "Unicode-Text"
TR_getTransferDataFlavors = Array(aF)
end function
function TR_isDataFlavorSupported( aFlavor as com.sun.star.datatransfer.DataFlavor ) as Boolean
'call MyPlaySoundSystem("SystemAsterisk", true) 'My XP system beep - shows that this routine is called every 2 seconds
TR_isDataFlavorSupported = (aFlavor.MimeType = "text/plain;charset=utf-16")
end function |
|
|
| Back to top |
|
 |
Peter OOo Enthusiast

Joined: 28 May 2004 Posts: 105 Location: Berlin / Germany
|
Posted: Mon Jul 10, 2006 3:19 am Post subject: |
|
|
Thanks, you helped me again a lot.
But - I have a generally understanding question. How can I see, which interfaces can work as listeners and which not?
Regards
Peter |
|
| Back to top |
|
 |
ms777 Super User


Joined: 07 Feb 2004 Posts: 1313
|
Posted: Mon Jul 10, 2006 7:24 am Post subject: |
|
|
Hi,
all interfaces can be used with the createUnoListener method. I am quite sure that this is not really the intended use of createUnoListener, but it works ...
ms777 |
|
| Back to top |
|
 |
xuedm General User


Joined: 25 Sep 2006 Posts: 7
|
Posted: Sun Feb 11, 2007 2:34 am Post subject: |
|
|
Dear both,
Thanks for your code. I can modify text in clipboard.
Now, I have another question. How to set a textfield or checkbox into clipboard like your code?
Any hints?
Dingmeng |
|
| Back to top |
|
 |
|