Hi,

you may be on a wild goose hunt there and worse, it may be that I sent you there, sorry. GetPrimarySelection() will basically work only on the X11 platforms (and probably if you configure "Paste Clipboard" for middle mousebutton in Tools->Options->View). What you actually want to use is most likely GetClipboard() instead, which will give you also an instance of datatransfer::clipboard::XClipboard, but the one for the system clipboard, not the system primary selection.

I'm sorry to have led you on a false trail, please accept my apologies.

Kind regards, pl

Maximilian Odendahl wrote:
Hi,

I am trying to get the selection of the current window starting from AquaSalFrame, with this line:

uno::Reference<datatransfer::clipboard::XClipboard> aSelection(pWin2->GetPrimarySelection());

but aSelection.is() is always false.

I tried a lot of different stuff for pWin2, including:

1) looping over GetSalData()->maFrames...->GetWindow();

2) pWin2 = mpFrame->GetWindow()

3) Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), UNO_QUERY );

if ( xDesktop.is() )
{
    Reference< XFrame > xFrame = xDesktop->getCurrentFrame();
        if ( xFrame.is() )
    {
            Reference< XWindow > xWindow = xFrame->getComponentWindow();
if ( xWindow.is() ) pWin2 = VCLUnoHelper::GetWindow( xWindow );

When selection a word in writer, GetPrimarySelection is also called and I copied the this pointer manually to pwin2, but this as well did not work.

Could someone explain to me what the different window pointers refer to exactly and how I can get the selection to work?

Best regards
Max

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Someone told me: "Smile and be happy, it could be worse"
And I smiled and was happy and things became worse.
     -- Author unknown

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to