OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

OO crash on accessing "Font name" accessibile cont

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
yajva
General User
General User


Joined: 30 Jan 2009
Posts: 8

PostPosted: Mon Mar 02, 2009 5:58 am    Post subject: OO crash on accessing "Font name" accessibile cont Reply with quote

Hi

I am trying to get accessible context of 'Font name' combo in OO 'writer'. The moment the accessibility context is referenced, the combo turns gray (disabled). Choosing a different apply style enables the combo. However, changing font from the 'font name' combo crashes OO. Am I doing something wrong or is this an OO bug ?


Regards
Yajva
Code:

REM  *****  BASIC  *****
option explicit

Sub   M7_SetupWinLinks

   dim      oDocWin, oAC, oACFontCbox

   oDocWin = M7_GetWindowOpen(com.sun.star.accessibility.AccessibleRole.ROOT_PANE, ThisComponent.Title, oAC)
   oACFontCbox = oDocWin.AccessibleContext.getAccessibleChild(1).AccessibleContext.getAccessibleChild(1).AccessibleContext.getAccessibleChild(4).AccessibleContext.getAccessibleChild(0).AccessibleContext
End Sub




Function M7_GetWindowOpen(role, sTitle as String, oACofWin) As Object
  Dim oToolkit
  Dim lCount As Long
  Dim k As Long
  Dim oWin
  Dim   oAC, tmp

'  oToolkit = Stardesktop.ActiveFrame.ContainerWindow.Toolkit
   oToolkit = ThisComponent.CurrentController.Frame.ContainerWindow.Toolkit
  lCount = oToolkit.TopWindowCount

   ON  local ERROR GOTO TooBad

  For k= 0 To lCount -1
    oWin = oToolkit.getTopWindow(k)
    If HasUnoInterfaces(oWin, "com.sun.star.accessibility.XAccessibleContext") Then
      oAC = oWin
   ElseIf HasUnoInterfaces(oWin, "com.sun.star.accessibility.XAccessible") Then
      oAC = oWin.AccessibleContext
   Else
      goto here
   End If

'   If oAC.getAccessibleRole() = com.sun.star.accessibility.AccessibleRole.DIALOG  and oAC.getAccessibleName() = "Find & Replace" Then
'tmp = oAC.getAccessibleName()
'msgbox tmp
      If (oAC.getAccessibleRole() = role) and (left(oAC.getAccessibleName(), len(sTitle)) = sTitle) Then
         M7_GetWindowOpen = oWin
         oACofWin = oAC
         Exit Function
       EndIf
here:
  Next k

TooBad:
if err <>  0 then
goto again
again:
   ON  ERROR GOTO TooBad
goto here
end if

End Function

Back to top
View user's profile Send private message
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Mon Mar 02, 2009 1:52 pm    Post subject: Reply with quote

Hi,

what value has ThisComponent.title, when you run your program ? Which dialog is open ? Which version of OO are you at ?

ms777
Back to top
View user's profile Send private message
yajva
General User
General User


Joined: 30 Jan 2009
Posts: 8

PostPosted: Mon Mar 02, 2009 11:19 pm    Post subject: Reply with quote

Hi

The doument open was AndrewMacro.odt. ThisComponent.title = "AndrewMacro.odt". No other dialog is open. I open the document, open macro editpr, run the macro and that's it.
The situation is perfectly repeatable with any writer (even 'untitled') document open. I am using OO 3.0.1, OOO300m15 (Build:9379)

Regards
Yajva
Back to top
View user's profile Send private message
yajva
General User
General User


Joined: 30 Jan 2009
Posts: 8

PostPosted: Mon Mar 02, 2009 11:36 pm    Post subject: OO crash on accessing "Font name" accessibile cont Reply with quote

Hi

... and my OS is Windows XP Professional.

Yajva
Back to top
View user's profile Send private message
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Tue Mar 03, 2009 2:10 pm    Post subject: Reply with quote

Hi,

It took some time to understand your code. See below a rewrite ... please note that I am still on OO 2.4

Yes, I can reproduce the behavior, and no, I do not see a solution. You can consider filing an issue ...

Good luck,

ms777

Code:
Sub   M7_SetupWinLinks

   oACContWin = ThisComponent.CurrentController.Frame.ContainerWindow.AccessibleContext
'   xray oACContWin
   
'the first panel is the Toolbar panel   
   for k=0 to oACContWin.AccessibleChildCount-1
     oAC = oACContWin.getAccessibleChild(k).AccessibleContext
     if oAC.AccessibleRole = com.sun.star.accessibility.AccessibleRole.PANEL then
       oACToolbar = oAC
       exit for
     endif
   next k
   if IsEmpty(oACToolbar) then
     msgbox "Toolbar not found"
     exit sub
   endif

'search for the toolbar with the name "Formatting"   
   for k=0 to oACToolbar.AccessibleChildCount-1
     oAC = oACToolbar.getAccessibleChild(k).AccessibleContext
     if (oAC.AccessibleRole = com.sun.star.accessibility.AccessibleRole.TOOL_BAR) and (oAC.AccessibleName = "Formatting")then
       oACToolbarFormatting = oAC
       exit for
     endif
   next k
   if IsEmpty(oACToolbarFormatting) then
     msgbox "ToolbarFormatting not found"
     exit sub
   endif

'search for the panel with the name "Font Name"   
   for k=0 to oACToolbarFormatting.AccessibleChildCount-1
     oAC = oACToolbarFormatting.getAccessibleChild(k).AccessibleContext
     if (oAC.AccessibleRole = com.sun.star.accessibility.AccessibleRole.PANEL) and (oAC.AccessibleName = "Font Name")then
       oACToolbarFormattingFontName = oAC
       exit for
     endif
   next k
   if IsEmpty(oACToolbarFormattingFontName) then
     msgbox "oACToolbarFormattingFontName not found"
     exit sub
   endif

'first child is the combobox
   oACToolbarFormattingFontNameCombobox = oACToolbarFormattingFontName.getAccessibleChild(0).AccessibleContext

'the following line is equivalent to pressing the drop down button and indeed grays the resulting list. I would consider that a bug
   oACToolbarFormattingFontNameCombobox.doAccessibleAction(0)

'   call AnalyzeCreateSxc(oACToolbarFormattingFontNameCombobox)
End Sub
Back to top
View user's profile Send private message
yajva
General User
General User


Joined: 30 Jan 2009
Posts: 8

PostPosted: Tue Mar 03, 2009 11:17 pm    Post subject: Reply with quote

Hi

Thanks ms77 for confirming that it's a bug. I will file bug report with OO.

Regards
Yajva
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group