[I've found a better way of getting the data from the clipboard. Use the following code instead of that described below: CPlainText* ptext = CPlainText::NewL();
ptext->PasteFromStoreL(cb->Store(), cb->StreamDictionary(), 0);
TUint16 *buffer = new TUint16[ptext->DocumentLength()];
TPtr16 *text = new TPtr16(buffer, ptext->DocumentLength());
ptext->Extract(*text); ]
I spent hours on Friday night working out how to get plain text out of the Nokia 9210 clipboard (Symbian OS) using C++. I couldn't find documentation anywhere on how to do it. There were examples of how to read data from the clipboard, but nothing on what 'id' was used for the plain text clipboard data other applications used, and what format the data is held in on the clipboard. Very painful.
For future reference, the TStreamId is KClipboardUidTypePlainText : TStreamId id = (cb->StreamDictionary()).At(KClipboardUidTypePlainText);
The data is stored in the stream with the length as a TInt32 , followed by the string data as array of TUint8 . Example code: RStoreReadStream stream;
stream.OpenL(cb->Store(), id);
TUint32 len = stream.ReadUint32L();
TUint8 *buffer = new TUint8[len];
Ptr8 text(buffer, len, len);
stream.ReadL(text, len);
I'm using this from Forth (Ficl) on the 9210 to enable to write forth code in the Nokia 9210 Word application, copy it and immediately execute it from the Forth application. Eventually I won't have to deal with C++ on the Nokia at all and just use Forth or Goo or Common Lisp on-board.
11:32:23 PM
|