xref: /AOO41X/main/chart2/source/controller/inc/AccessibleChartView.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
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 #ifndef _CHART2_ACCESSIBLE_CHART_VIEW_HXX
28 #define _CHART2_ACCESSIBLE_CHART_VIEW_HXX
29 
30 #include "AccessibleBase.hxx"
31 #include "MutexContainer.hxx"
32 #include "ServiceMacros.hxx"
33 #include <cppuhelper/implbase2.hxx>
34 // header for class WeakReference
35 #include <cppuhelper/weakref.hxx>
36 #include <com/sun/star/accessibility/XAccessible.hpp>
37 #include <com/sun/star/frame/XModel.hpp>
38 #include <com/sun/star/lang/XInitialization.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/uno/XComponentContext.hpp>
41 #include <com/sun/star/view/XSelectionSupplier.hpp>
42 #include <com/sun/star/view/XSelectionChangeListener.hpp>
43 #include <com/sun/star/awt/XWindow.hpp>
44 
45 #include <boost/shared_ptr.hpp>
46 
47 namespace accessibility
48 {
49 class IAccessibleViewForwarder;
50 }
51 
52 //.............................................................................
53 namespace chart
54 {
55 //.............................................................................
56 
57 class ExplicitValueProvider;
58 
59 namespace impl
60 {
61 typedef ::cppu::ImplInheritanceHelper2<
62         ::chart::AccessibleBase,
63         ::com::sun::star::lang::XInitialization,
64         ::com::sun::star::view::XSelectionChangeListener >
65     AccessibleChartView_Base;
66 }
67 
68 class AccessibleChartView :
69         public impl::AccessibleChartView_Base
70 {
71 public:
72     AccessibleChartView(
73         const ::com::sun::star::uno::Reference<
74             ::com::sun::star::uno::XComponentContext >& xContext, SdrView* pView );
75     virtual ~AccessibleChartView();
76 
77     // ____ WeakComponentHelper (called from XComponent::dispose()) ____
78     virtual void SAL_CALL disposing();
79 
80     // ____ lang::XInitialization ____
81     // 0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
82     // 1: frame::XModel representing the chart model - offers access to object data
83     // 2: lang::XInterface representing the normal chart view - offers access to some extra object data
84     // 3: accessibility::XAccessible representing the parent accessible
85     // 4: awt::XWindow representing the view's window (is a vcl Window)
86     // all arguments are only valid until next initialization - don't keep them longer
87     virtual void SAL_CALL initialize(
88         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
89         throw (::com::sun::star::uno::Exception,
90                ::com::sun::star::uno::RuntimeException);
91 
92     // ____ view::XSelectionChangeListener ____
93     virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
94 
95     // ________ XEventListener ________
96     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
97 
98     // ________ XAccessibleContext ________
99     virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
100         throw (::com::sun::star::uno::RuntimeException);
101     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent()
102         throw (::com::sun::star::uno::RuntimeException);
103     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
104         throw (::com::sun::star::uno::RuntimeException);
105     virtual ::rtl::OUString SAL_CALL getAccessibleName()
106         throw (::com::sun::star::uno::RuntimeException);
107     virtual sal_Int16 SAL_CALL getAccessibleRole()
108         throw (::com::sun::star::uno::RuntimeException);
109 
110     // ________ XAccessibleComponent ________
111     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
112     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
113 
114 protected:
115     // ________ AccessibleChartElement ________
116     virtual ::com::sun::star::awt::Point   GetUpperLeftOnScreen() const;
117 
118 private: // methods
119     /** @return the result that m_xWindow->getPosSize() _should_ return.  It
120                 returns (0,0) as upper left corner.  When calling
121                 getAccessibleParent, you get the parent's parent, which contains
122                 a decoration.  Thus you have an offset of (currently) (2,2)
123                 which isn't taken into account.
124      */
125     virtual ::com::sun::star::awt::Rectangle GetWindowPosSize() const;
126 
127     ExplicitValueProvider* getExplicitValueProvider();
128 
129 private: // members
130     ::com::sun::star::uno::Reference<
131                        ::com::sun::star::uno::XComponentContext>    m_xContext;
132     ::com::sun::star::uno::WeakReference<
133                        ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
134     ::com::sun::star::uno::WeakReference<
135                        ::com::sun::star::frame::XModel >            m_xChartModel;
136     ::com::sun::star::uno::WeakReference<
137                        ::com::sun::star::uno::XInterface >          m_xChartView;
138     ::com::sun::star::uno::WeakReference<
139                         ::com::sun::star::awt::XWindow >            m_xWindow;
140     ::com::sun::star::uno::WeakReference<
141                        ::com::sun::star::accessibility::XAccessible > m_xParent;
142 
143     ::boost::shared_ptr< ObjectHierarchy >                          m_spObjectHierarchy;
144     AccessibleUniqueId                                              m_aCurrentSelectionOID;
145     SdrView*                                                        m_pSdrView;
146     ::accessibility::IAccessibleViewForwarder*                      m_pViewForwarder;
147 
148     //no default constructor
149     AccessibleChartView();
150 };
151 
152 //.............................................................................
153 } //namespace chart
154 //.............................................................................
155 #endif
156