1  /*************************************************************************
2   *
3   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4   *
5   * Copyright 2000, 2010 Oracle and/or its affiliates.
6   *
7   * OpenOffice.org - a multi-platform office productivity suite
8   *
9   * This file is part of OpenOffice.org.
10   *
11   * OpenOffice.org is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Lesser General Public License version 3
13   * only, as published by the Free Software Foundation.
14   *
15   * OpenOffice.org is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18   * GNU Lesser General Public License version 3 for more details
19   * (a copy is included in the LICENSE file that accompanied this code).
20   *
21   * You should have received a copy of the GNU Lesser General Public License
22   * version 3 along with OpenOffice.org.  If not, see
23   * <http://www.openoffice.org/license.html>
24   * for a copy of the LGPLv3 License.
25   *
26   ************************************************************************/
27  
28  #ifndef SDEXT_PRESENTER_PRESENTER_ACCESSIBILITY_HXX
29  #define SDEXT_PRESENTER_PRESENTER_ACCESSIBILITY_HXX
30  
31  #include "PresenterPaneContainer.hxx"
32  
33  #include <com/sun/star/accessibility/AccessibleStateType.hpp>
34  #include <com/sun/star/accessibility/TextSegment.hpp>
35  #include <com/sun/star/accessibility/XAccessible.hpp>
36  #include <com/sun/star/awt/XFocusListener.hpp>
37  #include <com/sun/star/awt/XWindow2.hpp>
38  #include <com/sun/star/awt/WindowEvent.hpp>
39  #include <com/sun/star/beans/XPropertySet.hpp>
40  #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
41  #include <com/sun/star/drawing/framework/XPane.hpp>
42  #include <com/sun/star/drawing/framework/XPane2.hpp>
43  #include <com/sun/star/lang/XInitialization.hpp>
44  #include <com/sun/star/uno/XComponentContext.hpp>
45  #include <cppuhelper/compbase3.hxx>
46  #include <cppuhelper/basemutex.hxx>
47  #include <rtl/ref.hxx>
48  #include <boost/shared_ptr.hpp>
49  
50  namespace css = ::com::sun::star;
51  namespace cssu = ::com::sun::star::uno;
52  namespace cssa = ::com::sun::star::accessibility;
53  
54  
55  namespace sdext { namespace presenter {
56  
57  class PresenterController;
58  class PresenterTextView;
59  
60  namespace {
61      typedef ::cppu::WeakComponentImplHelper3 <
62          css::accessibility::XAccessible,
63          css::lang::XInitialization,
64          css::awt::XFocusListener
65      > PresenterAccessibleInterfaceBase;
66  }
67  
68  class PresenterAccessible
69      : public ::cppu::BaseMutex,
70        public PresenterAccessibleInterfaceBase
71  {
72  public:
73      PresenterAccessible (
74          const css::uno::Reference<css::uno::XComponentContext>& rxContext,
75          const ::rtl::Reference<PresenterController>& rpPresenterController,
76          const css::uno::Reference<css::drawing::framework::XPane>& rxMainPane);
77      virtual ~PresenterAccessible (void);
78  
79      void SetAccessibleParent (const cssu::Reference<cssa::XAccessible>& rxAccessibleParent);
80  
81      void UpdateAccessibilityHierarchy (void);
82  
83      void NotifyCurrentSlideChange (
84          const sal_Int32 nCurrentSlideIndex,
85          const sal_Int32 nSlideCount);
86  
87      /** Return whether accessibility support is active, i.e. whether
88          somebody has called getAccessibleContext() yet.
89      */
90      bool IsAccessibilityActive (void) const;
91  
92      virtual void SAL_CALL disposing (void);
93  
94  
95      //----- XAccessible -------------------------------------------------------
96  
97      virtual cssu::Reference<cssa::XAccessibleContext> SAL_CALL
98          getAccessibleContext (void)
99          throw (cssu::RuntimeException);
100  
101  
102      //----- XFocusListener ----------------------------------------------------
103  
104      virtual void SAL_CALL focusGained (const css::awt::FocusEvent& rEvent)
105          throw (cssu::RuntimeException);
106  
107      virtual void SAL_CALL focusLost (const css::awt::FocusEvent& rEvent)
108          throw (cssu::RuntimeException);
109  
110  
111      //----- XEventListener ----------------------------------------------------
112  
113      virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
114          throw (cssu::RuntimeException);
115  
116  
117      //----- XInitialization ---------------------------------------------------
118  
119      virtual void SAL_CALL initialize (const cssu::Sequence<cssu::Any>& rArguments)
120          throw (cssu::RuntimeException);
121  
122  
123      class AccessibleObject;
124      class AccessibleParagraph;
125  
126  private:
127      const css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
128      ::rtl::Reference<PresenterController> mpPresenterController;
129      css::uno::Reference<css::drawing::framework::XResourceId> mxMainPaneId;
130      css::uno::Reference<css::drawing::framework::XPane2> mxMainPane;
131      css::uno::Reference<css::awt::XWindow> mxMainWindow;
132      css::uno::Reference<css::awt::XWindow> mxPreviewContentWindow;
133      css::uno::Reference<css::awt::XWindow> mxPreviewBorderWindow;
134      css::uno::Reference<css::awt::XWindow> mxNotesContentWindow;
135      css::uno::Reference<css::awt::XWindow> mxNotesBorderWindow;
136      ::rtl::Reference<AccessibleObject> mpAccessibleConsole;
137      ::rtl::Reference<AccessibleObject> mpAccessiblePreview;
138      ::rtl::Reference<AccessibleObject> mpAccessibleNotes;
139      css::uno::Reference<css::accessibility::XAccessible> mxAccessibleParent;
140  
141      void UpdateAccessibilityHierarchy (
142          const css::uno::Reference<css::awt::XWindow>& rxPreviewContentWindow,
143          const css::uno::Reference<css::awt::XWindow>& rxPreviewBorderWindow,
144          const ::rtl::OUString& rsTitle,
145          const css::uno::Reference<css::awt::XWindow>& rxNotesContentWindow,
146          const css::uno::Reference<css::awt::XWindow>& rxNotesBorderWindow,
147          const ::boost::shared_ptr<PresenterTextView>& rpNotesTextView);
148      PresenterPaneContainer::SharedPaneDescriptor GetPreviewPane (void) const;
149  };
150  
151  
152  
153  
154  } } // end of namespace ::sd::presenter
155  
156  #endif
157