Getting PropertyValue values from an object

The Application Programming Interface and the OASIS Open Document Format

Getting PropertyValue values from an object

Postby Tim Grantham » Tue Jul 23, 2013 11:03 pm

I'm trying to get the LevelFormat properties from an existing DocumentIndex in a Writer document.

The Developer Guide says:
LevelFormat contains the various levels as a com.sun.star.container.XIndexReplace object. Each level is a sequence of com.sun.star.beans.PropertyValues which are defined in the service com.sun.star.text.DocumentIndexLevelFormat.


This is what I've got so far that works:
Code: Select all   Expand viewCollapse view
XPropertySet xIndexProperties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDocIndex);

XIndexReplace xLevelFormats = (XIndexReplace) UnoRuntime.queryInterface(XIndexReplace.class, xIndexProperties.getPropertyValue("LevelFormat"));

// get the format properties of the top level of the Index
Object aLevelProps = xLevelFormats.getByIndex(0);


Now, how do I access aLevelProps as a PropertyValue object? I know it's a PropertyValue object, because aLevelProps.getClass() returns "com.sun.star.beans.PropertyValue". When I inspect aLevelProps in the debugger Variables window, it also says it's a PropertyValue object, and I can drill down through the various members. But I don't know how to access aLevelProps from my code.

This is probably a newbie question, but I do appreciate your help.

Thanks,
Tim.
OpenOffice 4.1
Windows 7 Professional
Tim Grantham
 
Posts: 32
Joined: Thu Jan 06, 2011 12:03 am

Re: Getting PropertyValue values from an object

Postby RPG » Wed Jul 24, 2013 12:24 am

Hello

Search on this forum for the property and you can find two threads with code.
I have no idea how it works.

Romke
LibreOffice 6.3.3.2 on openSUSE Leap 15
RPG
Volunteer
 
Posts: 2204
Joined: Tue Apr 14, 2009 7:15 pm
Location: Netherlands

Re: Getting PropertyValue values from an object

Postby hanya » Thu Jul 25, 2013 2:23 pm

Use com.sun.star.uno.AnyConverter class to convert from the value returned by some method returns "any" type value to real type holed by the value.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
hanya
Volunteer
 
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest