Вопрос

I'm developing a simple script in OpenOffice Basic for Writer. I have a code like this:

vText = ThisComponent.Text
vc = ThisComponent.CurrentController.getViewCursor()
c = vText.createTextCursorByRange(vc.getstart())
baseM = c.ParaLeftMargin

Accoring to http://www.openoffice.org/api/docs/common/ref/com/sun/star/text/XSimpleText.html#createTextCursorByRange createTextCursorByRange returns an object of type XTextCursor. ParaLeftMargin is a property of service ParagraphProperties. But I cannot find how XTextCursor is connected to ParagraphProperties in this documentation.

My question is - why can I access ParaLeftMargin on cursor object?

Это было полезно?

Решение

You claim that com.sun.star.text.XTextCursor has a ParaLeftMargin property, but this is just an accident, actually.

com.sun.star.text.XTextCursor is an interface, implemented by SwXTextCursor. This implementation also supports the com.sun.star.style.ParagraphProperties service, which provides the ParaLeftMargin property.

If you want to find out a given UNO object supports which interfaces / services, a debugger is the best tool, like xray:

http://wiki.openoffice.org/wiki/Extensions_development_basic#Xray_tool

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top