In my long running battle to get the actual height of
a frame with dynamic content, I figured out how to
read the contents of the status bar (see below).

But unfortunately this doesn't always work, because
the information in the status bar is sometimes wrong.

I am observing this strange effect. I render autosize
frames, I look in the status bar the size is wrong, so
I toggle autosize off, and then on and then it is
correct. I close the document. I render again and now
the value is always correct.

To me it looks like openoffice is switching into some
sort of modus which is the correct modus. Is there any
way I can do this programmatically (ie switch into
this modus)

regards.

# How to read height from the status bar #
Function GetActualHeight(oDocument as Object) as
double
        oAC =
ThisComponent.CurrentController.Frame.ContainerWindow.AccessibleContext
        oACStatusbar = SearchOneSecForChild(oAC, "", "",
com.sun.star.accessibility.AccessibleRole.STATUS_BAR)
        oACSize = SearchOneSecForChild(oACStatusbar, "Size",
"", com.sun.star.accessibility.AccessibleRole.LABEL)
        sText = oACSize.Text
        sDum = Split(sText,"x")
        GetActualHeight =  CDbl(sDum(1))
End Function


function SearchOneSecForChild(oAC as Object, sName as
String, sDescription as String, lRole as Long) as
Object
for k=1 to 50
  oRes = SearchForChild(oAC, sName, sDescription,
lRole)
  if not IsNull(oRes) then
    SearchOneSecForChild = oRes
    exit function
    endif
  wait(20)
  next k
end function


function SearchForChild(oAC as Object, sName as
String, sDescription as String, lRole as Long) as
Object
if HasUnoInterfaces(oAC,
"com.sun.star.accessibility.XAccessibleContext") then
  oAC1 = oAC
  else
  if HasUnoInterfaces(oAC,
"com.sun.star.accessibility.XAccessible") then
    oAC1 = oAC.AccessibleContext
    else
    exit function '    unexpected situation, maybe
caused by some intermediate state
    endif
  endif

for k=0 to oAC.AccessibleChildCount-1
  oACChild = oAC.getAccessibleChild(k)
  if not HasUnoInterfaces(oACChild,
"com.sun.star.accessibility.XAccessibleContext") then
    if HasUnoInterfaces(oACChild,
"com.sun.star.accessibility.XAccessible") then
      oACChild = oACChild.AccessibleContext
      else
      exit function '    unexpected situation, maybe
caused by some intermediate state
      endif
    endif
  boFound = true
 
  if sName<>""        then boFound = boFound and
(oACChild.AccessibleName = sName) 
  if sDescription<>"" then boFound = boFound and
(oACChild.AccessibleDescription = sDescription) 
  if lRole > -1       then boFound = boFound and
(oACChild.AccessibleRole = lRole) 

  if boFound then
    SearchForChild = oACChild
    exit function
    endif
  next k
end function

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to