2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 import com
.sun
.star
.accessibility
.XAccessible
;
20 import com
.sun
.star
.accessibility
.XAccessibleContext
;
21 import com
.sun
.star
.accessibility
.AccessibleEventObject
;
22 import com
.sun
.star
.uno
.UnoRuntime
;
24 import java
.io
.PrintStream
;
26 import tools
.NameProvider
;
28 /** Base class for handling of accessibility events.
32 public EventHandler (AccessibleEventObject aEvent
, AccessibilityTreeModel aTreeModel
)
35 maTreeModel
= aTreeModel
;
37 mnEventId
= aEvent
.EventId
;
39 mxEventSource
= UnoRuntime
.queryInterface(
40 XAccessibleContext
.class, aEvent
.Source
);
41 if (mxEventSource
== null)
43 XAccessible xAccessible
= UnoRuntime
.queryInterface(
44 XAccessible
.class, aEvent
.Source
);
45 if (xAccessible
!= null)
46 mxEventSource
= xAccessible
.getAccessibleContext();
50 public void Print (PrintStream out
)
52 out
.println ("Event id is " + mnEventId
53 + " (" + NameProvider
.getEventName(mnEventId
)+")"
54 + " for " + mxEventSource
.getAccessibleName() + " / "
55 + NameProvider
.getRoleName (mxEventSource
.getAccessibleRole()));
59 public void PrintOldAndNew (PrintStream out
)
61 out
.println (" old value is " + maEvent
.OldValue
);
62 out
.println (" new value is " + maEvent
.NewValue
);
65 public void Process ()
67 System
.out
.println ("processing of event " + maEvent
+ " not implemented");
70 protected AccessibleEventObject maEvent
;
71 protected AccessibilityTreeModel maTreeModel
;
73 protected int mnEventId
;
74 protected XAccessibleContext mxEventSource
;