[WASTE-list] WERegisterCustomAttribute

Marco Piovanelli marco.piovanelli at pobox.com
Thu Jun 8 14:00:45 EDT 2006


On Mon, 5 Jun 2006 14:25:17 -0400,
Alfred Van Hoek (vanhoek at mac.com) wrote:



>I have in principle no problem using this api

>

>err = WERegisterCustomAttribute(childItem->tagUserID, childItem-

> >options, sizeof(Boolean), childItem->typeVariant, (WEReference)text);

>

>However, an additional call like:

>

>err = WERegisterCustomAttribute(childItem->tagUserID, childItem-

> >options, sizeof(SInt32), childItem->typeVariant, (WEReference)text);

>

>will lead to a paramErr:

>

>Exception thrown in function

>WE3_CustomAttributeTable::AddCustomAttribute(unsigned long, unsigned

>long, unsigned long, unsigned long) (WE3_CustomAttributes.cp, line

>32); error code = -50

>

>

>Note that tagUserID and typeVariant are different. If the first one

>is used or the second one, no exception thrown, but registering two

>attributes does not work.


By looking at the code, I see the above exception is thrown when
attempting to register a custom attribute selector more than once.
Are you sure the tagUserID changes between calls to WERegisterCustomAttribute?


>I do have some problems (given only one customAttribute is

>registered) when it comes to using this attribute. How would this

>attribute be displayed in an rtf file? I would like to know, in case

>my code is doing something wrong.


WASTE 3.0 saves custom attributes in RTF files using a
proprietary RTF keyword (\WECustomAttribute). Here's what
a WASTE-generated RTF file with custom attributes looks
like:

{\rtf1\mac
{\fonttbl
{\f0\fnil\fcharset77 Lucida Grande;}}
{\colortbl
\red0\green0\blue0;}
{\info}
\deftab720
{\pard\plain\uc0\f0\fs24\cf0\ql\qnatural Hello {{\*\WECustomAttribute
666f6f626c6f6e670000002a}Cruel} World.}}

The hexadecimal gibberish after \WECustomAttribute encodes
the attribute tag, type, and variable-length value. The
leading asterisk lets other RTF readers safely skip the
proprietary data without missing the attributed text ("Cruel"
in the above example).

Also, please keep in mind that custom attributes won't be saved
in RTF files unless you specify the weAttributeIsPersistent
option when calling WERegisterCustomAttribute().


-- marco

--
It's not the data universe only, it's human conversation.
They want to turn it into a one-way flow that they have entirely
monetized. I look at the collective human mind as a kind of
ecosystem. They want to clear cut it. They want to go into the
rainforest of human thought and mow the thing down.



More information about the WASTE-list mailing list