Hi Rony,
Rony G. Flatscher wrote:
Hi Stephan,
just got to see your answer, hence my rather late answer:
maybe a very stupid question, still wondering whether constants
wrapped as "Any" were intended. Using reflection via Java the
following constants employ Any (for unsigned long):
What kind of reflection do you mean---Java reflection or UNO
reflection? Please give some example code snippet.
Java reflection, here's the snippet dumping CONSTANTS:
--------------- cut here -------------
static void dumpConstants(XTypeDescription xtd)
{
TypeClass tc=xtd.getTypeClass();
XConstantsTypeDescription xitd = (XConstantsTypeDescription)
UnoRuntime.queryInterface(XConstantsTypeDescription.class, xtd);
XConstantTypeDescription ximtd [] = xitd.getConstants();
int i2=0;
String type="", name="";
for (i2=0; i2<ximtd.length; i2++)
{
name = getUnqualifiedName(ximtd[i2].getName());
Object rgfConstType = ximtd[i2].getConstantValue();
say("\t\t\t"+i2+": "+name+" - "+ximtd[i2].getConstantValue()
+ " - " + pp(rgfConstType.getClass())
XContantTypeDescription.getConstantValue() returns an Any, so everything
seems to be ok. Use the com.sun.star.uno.AnyConverter to extract the
value -> long l = AnyConverter.toLong(rgfConstType)
Any is mapped to Object in Java which is maybe cobnfusing here but at
this generic API it is still one indirection more to get the real
constant value.
Juergen
);
}
say("");
}
--------------- cut here -------------
and here's the output for <com.sun.star.sync.SyncOptions>:
--------------- cut here ---------------
0: NONE - Any[Type[unsigned long], 0] - <class
com.sun.star.uno.Any>
1: DONT_COPY - Any[Type[unsigned long], 1] - <class
com.sun.star.uno.Any>
2: DONT_REMOVE - Any[Type[unsigned long], 2] - <class
com.sun.star.uno.Any>
3: SERVER_WINS - Any[Type[unsigned long], 256] - <class
com.sun.star.uno.Any>
4: CLIENT_WINS - Any[Type[unsigned long], 512] - <class
com.sun.star.uno.Any>
5: CREATE_BACKUP - Any[Type[unsigned long], 65536] - <class
com.sun.star.uno.Any>
--------------- cut here ---------------
Dumping the entire module "com.sun.star" the following constants are the
only ones which show up as Any, if I am not mistaken:
* <com.sun.star.sync.SyncOptions>
* <com.sun.star.sync.SyncAction>
* <com.sun.star.sync.SyncType>
* <com.sun.star.sync.SyncMode>
* <com.sun.star.sync.SyncEvent>
* <com.sun.star.corba.iop.ServiceIdGroup>
* <com.sun.star.corba.iop.ProfileIdGroup>
These constant groups have members of UNO type UNSIGNED LONG. They
are represented in Java as final fields of Java type int (and you have
to know that the values have to be interpreted as unsigned when you
use them), no Any involved.
Hmm, I see. However, there are no "int", but "java.lang.Integer" datatypes.
There are two constants groups with java.lang.Long:
<com.sun.star.embed.Aspects> and <com.sun.star.embed.EmbedMisc>.
------------------- cut here ------------------
xtd=[<com.sun.star.embed.Aspects>: <CONSTANTS>
0: MSOLE_CONTENT - 1 - <class java.lang.Long>
1: MSOLE_THUMBNAIL - 2 - <class java.lang.Long>
2: MSOLE_ICON - 4 - <class java.lang.Long>
3: MSOLE_DOCPRINT - 8 - <class java.lang.Long>
xtd=[<com.sun.star.embed.EmbedMisc>: <CONSTANTS>
0: MS_EMBED_RECOMPOSEONRESIZE - 1 - <class java.lang.Long>
1: MS_EMBED_ONLYICONIC - 2 - <class java.lang.Long>
2: MS_EMBED_INSERTNOTREPLACE - 4 - <class java.lang.Long>
3: MS_EMBED_STATIC - 8 - <class java.lang.Long>
4: MS_EMBED_CANTLINKINSIDE - 16 - <class java.lang.Long>
5: MS_EMBED_CANLINKBYOLE1 - 32 - <class java.lang.Long>
6: MS_EMBED_ISLINKOBJECT - 64 - <class java.lang.Long>
7: MS_EMBED_INSIDEOUT - 128 - <class java.lang.Long>
8: MS_EMBED_ACTIVATEWHENVISIBLE - 256 - <class java.lang.Long>
9: MS_EMBED_RENDERINGISDEVICEINDEPENDENT - 512 - <class
java.lang.Long>
10: MS_EMBED_INVISIBLEATRUNTIME - 1024 - <class java.lang.Long>
11: MS_EMBED_ALWAYSRUN - 2048 - <class java.lang.Long>
12: MS_EMBED_ACTSLIKEBUTTON - 4096 - <class java.lang.Long>
13: MS_EMBED_ACTSLIKELABEL - 8192 - <class java.lang.Long>
14: MS_EMBED_NOUIACTIVATE - 16384 - <class java.lang.Long>
15: MS_EMBED_ALIGNABLE - 32768 - <class java.lang.Long>
16: MS_EMBED_SIMPLEFRAME - 65536 - <class java.lang.Long>
17: MS_EMBED_SETCLIENTSITEFIRST - 131072 - <class
java.lang.Long>
18: MS_EMBED_IMEMODE - 262144 - <class java.lang.Long>
19: MS_EMBED_IGNOREACTIVATEWHENVISIBLE - 524288 - <class
java.lang.Long>
20: MS_EMBED_WANTSTOMENUMERGE - 1048576 - <class
java.lang.Long>
21: MS_EMBED_SUPPORTSMULTILEVELUNDO - 2097152 - <class
java.lang.Long>
22: EMBED_ACTIVATEIMMEDIATELY - 4294967296 - <class
java.lang.Long>
23: EMBED_NEVERRESIZE - 8589934592 - <class java.lang.Long>
------------------- cut here ------------------
Regards,
---rony
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]