1*de7b3f82SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*de7b3f82SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*de7b3f82SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*de7b3f82SAndrew Rist  * distributed with this work for additional information
6*de7b3f82SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*de7b3f82SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*de7b3f82SAndrew Rist  * "License"); you may not use this file except in compliance
9*de7b3f82SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*de7b3f82SAndrew Rist  *
11*de7b3f82SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*de7b3f82SAndrew Rist  *
13*de7b3f82SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*de7b3f82SAndrew Rist  * software distributed under the License is distributed on an
15*de7b3f82SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*de7b3f82SAndrew Rist  * KIND, either express or implied.  See the License for the
17*de7b3f82SAndrew Rist  * specific language governing permissions and limitations
18*de7b3f82SAndrew Rist  * under the License.
19*de7b3f82SAndrew Rist  *
20*de7b3f82SAndrew Rist  *************************************************************/
21*de7b3f82SAndrew Rist 
22*de7b3f82SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CHART2_ACCESSIBLE_CHART_VIEW_HXX
24cdf0e10cSrcweir #define _CHART2_ACCESSIBLE_CHART_VIEW_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "AccessibleBase.hxx"
27cdf0e10cSrcweir #include "MutexContainer.hxx"
28cdf0e10cSrcweir #include "ServiceMacros.hxx"
29cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
30cdf0e10cSrcweir // header for class WeakReference
31cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
32cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
33cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
34cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
36cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
37cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp>
38cdf0e10cSrcweir #include <com/sun/star/view/XSelectionChangeListener.hpp>
39cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace accessibility
44cdf0e10cSrcweir {
45cdf0e10cSrcweir class IAccessibleViewForwarder;
46cdf0e10cSrcweir }
47cdf0e10cSrcweir 
48cdf0e10cSrcweir //.............................................................................
49cdf0e10cSrcweir namespace chart
50cdf0e10cSrcweir {
51cdf0e10cSrcweir //.............................................................................
52cdf0e10cSrcweir 
53cdf0e10cSrcweir class ExplicitValueProvider;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir namespace impl
56cdf0e10cSrcweir {
57cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper2<
58cdf0e10cSrcweir         ::chart::AccessibleBase,
59cdf0e10cSrcweir         ::com::sun::star::lang::XInitialization,
60cdf0e10cSrcweir         ::com::sun::star::view::XSelectionChangeListener >
61cdf0e10cSrcweir     AccessibleChartView_Base;
62cdf0e10cSrcweir }
63cdf0e10cSrcweir 
64cdf0e10cSrcweir class AccessibleChartView :
65cdf0e10cSrcweir         public impl::AccessibleChartView_Base
66cdf0e10cSrcweir {
67cdf0e10cSrcweir public:
68cdf0e10cSrcweir     AccessibleChartView(
69cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
70cdf0e10cSrcweir             ::com::sun::star::uno::XComponentContext >& xContext, SdrView* pView );
71cdf0e10cSrcweir     virtual ~AccessibleChartView();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     // ____ WeakComponentHelper (called from XComponent::dispose()) ____
74cdf0e10cSrcweir     virtual void SAL_CALL disposing();
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     // ____ lang::XInitialization ____
77cdf0e10cSrcweir     // 0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
78cdf0e10cSrcweir     // 1: frame::XModel representing the chart model - offers access to object data
79cdf0e10cSrcweir     // 2: lang::XInterface representing the normal chart view - offers access to some extra object data
80cdf0e10cSrcweir     // 3: accessibility::XAccessible representing the parent accessible
81cdf0e10cSrcweir     // 4: awt::XWindow representing the view's window (is a vcl Window)
82cdf0e10cSrcweir     // all arguments are only valid until next initialization - don't keep them longer
83cdf0e10cSrcweir     virtual void SAL_CALL initialize(
84cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
85cdf0e10cSrcweir         throw (::com::sun::star::uno::Exception,
86cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     // ____ view::XSelectionChangeListener ____
89cdf0e10cSrcweir     virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
90cdf0e10cSrcweir 
91cdf0e10cSrcweir     // ________ XEventListener ________
92cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     // ________ XAccessibleContext ________
95cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
96cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent()
98cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
100cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleName()
102cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
103cdf0e10cSrcweir     virtual sal_Int16 SAL_CALL getAccessibleRole()
104cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     // ________ XAccessibleComponent ________
107cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
108cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
109cdf0e10cSrcweir 
110cdf0e10cSrcweir protected:
111cdf0e10cSrcweir     // ________ AccessibleChartElement ________
112cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point   GetUpperLeftOnScreen() const;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir private: // methods
115cdf0e10cSrcweir     /** @return the result that m_xWindow->getPosSize() _should_ return.  It
116cdf0e10cSrcweir                 returns (0,0) as upper left corner.  When calling
117cdf0e10cSrcweir                 getAccessibleParent, you get the parent's parent, which contains
118cdf0e10cSrcweir                 a decoration.  Thus you have an offset of (currently) (2,2)
119cdf0e10cSrcweir                 which isn't taken into account.
120cdf0e10cSrcweir      */
121cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle GetWindowPosSize() const;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     ExplicitValueProvider* getExplicitValueProvider();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir private: // members
126cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
127cdf0e10cSrcweir                        ::com::sun::star::uno::XComponentContext>    m_xContext;
128cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
129cdf0e10cSrcweir                        ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
130cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
131cdf0e10cSrcweir                        ::com::sun::star::frame::XModel >            m_xChartModel;
132cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
133cdf0e10cSrcweir                        ::com::sun::star::uno::XInterface >          m_xChartView;
134cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
135cdf0e10cSrcweir                         ::com::sun::star::awt::XWindow >            m_xWindow;
136cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
137cdf0e10cSrcweir                        ::com::sun::star::accessibility::XAccessible > m_xParent;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     ::boost::shared_ptr< ObjectHierarchy >                          m_spObjectHierarchy;
140cdf0e10cSrcweir     AccessibleUniqueId                                              m_aCurrentSelectionOID;
141cdf0e10cSrcweir     SdrView*                                                        m_pSdrView;
142cdf0e10cSrcweir     ::accessibility::IAccessibleViewForwarder*                      m_pViewForwarder;
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     //no default constructor
145cdf0e10cSrcweir     AccessibleChartView();
146cdf0e10cSrcweir };
147cdf0e10cSrcweir 
148cdf0e10cSrcweir //.............................................................................
149cdf0e10cSrcweir } //namespace chart
150cdf0e10cSrcweir //.............................................................................
151cdf0e10cSrcweir #endif
152