1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir #ifndef _CHART2_ACCESSIBLE_CHART_VIEW_HXX
28*cdf0e10cSrcweir #define _CHART2_ACCESSIBLE_CHART_VIEW_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include "AccessibleBase.hxx"
31*cdf0e10cSrcweir #include "MutexContainer.hxx"
32*cdf0e10cSrcweir #include "ServiceMacros.hxx"
33*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
34*cdf0e10cSrcweir // header for class WeakReference
35*cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
36*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/view/XSelectionChangeListener.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir namespace accessibility
48*cdf0e10cSrcweir {
49*cdf0e10cSrcweir class IAccessibleViewForwarder;
50*cdf0e10cSrcweir }
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir //.............................................................................
53*cdf0e10cSrcweir namespace chart
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir //.............................................................................
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir class ExplicitValueProvider;
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir namespace impl
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper2<
62*cdf0e10cSrcweir         ::chart::AccessibleBase,
63*cdf0e10cSrcweir         ::com::sun::star::lang::XInitialization,
64*cdf0e10cSrcweir         ::com::sun::star::view::XSelectionChangeListener >
65*cdf0e10cSrcweir     AccessibleChartView_Base;
66*cdf0e10cSrcweir }
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir class AccessibleChartView :
69*cdf0e10cSrcweir         public impl::AccessibleChartView_Base
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir public:
72*cdf0e10cSrcweir     AccessibleChartView(
73*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
74*cdf0e10cSrcweir             ::com::sun::star::uno::XComponentContext >& xContext, SdrView* pView );
75*cdf0e10cSrcweir     virtual ~AccessibleChartView();
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir     // ____ WeakComponentHelper (called from XComponent::dispose()) ____
78*cdf0e10cSrcweir     virtual void SAL_CALL disposing();
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir     // ____ lang::XInitialization ____
81*cdf0e10cSrcweir     // 0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
82*cdf0e10cSrcweir     // 1: frame::XModel representing the chart model - offers access to object data
83*cdf0e10cSrcweir     // 2: lang::XInterface representing the normal chart view - offers access to some extra object data
84*cdf0e10cSrcweir     // 3: accessibility::XAccessible representing the parent accessible
85*cdf0e10cSrcweir     // 4: awt::XWindow representing the view's window (is a vcl Window)
86*cdf0e10cSrcweir     // all arguments are only valid until next initialization - don't keep them longer
87*cdf0e10cSrcweir     virtual void SAL_CALL initialize(
88*cdf0e10cSrcweir         const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
89*cdf0e10cSrcweir         throw (::com::sun::star::uno::Exception,
90*cdf0e10cSrcweir                ::com::sun::star::uno::RuntimeException);
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     // ____ view::XSelectionChangeListener ____
93*cdf0e10cSrcweir     virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir     // ________ XEventListener ________
96*cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir     // ________ XAccessibleContext ________
99*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
100*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
101*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent()
102*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
103*cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
104*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
105*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getAccessibleName()
106*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
107*cdf0e10cSrcweir     virtual sal_Int16 SAL_CALL getAccessibleRole()
108*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     // ________ XAccessibleComponent ________
111*cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
112*cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir protected:
115*cdf0e10cSrcweir     // ________ AccessibleChartElement ________
116*cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point   GetUpperLeftOnScreen() const;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir private: // methods
119*cdf0e10cSrcweir     /** @return the result that m_xWindow->getPosSize() _should_ return.  It
120*cdf0e10cSrcweir                 returns (0,0) as upper left corner.  When calling
121*cdf0e10cSrcweir                 getAccessibleParent, you get the parent's parent, which contains
122*cdf0e10cSrcweir                 a decoration.  Thus you have an offset of (currently) (2,2)
123*cdf0e10cSrcweir                 which isn't taken into account.
124*cdf0e10cSrcweir      */
125*cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle GetWindowPosSize() const;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     ExplicitValueProvider* getExplicitValueProvider();
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir private: // members
130*cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
131*cdf0e10cSrcweir                        ::com::sun::star::uno::XComponentContext>    m_xContext;
132*cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
133*cdf0e10cSrcweir                        ::com::sun::star::view::XSelectionSupplier > m_xSelectionSupplier;
134*cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
135*cdf0e10cSrcweir                        ::com::sun::star::frame::XModel >            m_xChartModel;
136*cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
137*cdf0e10cSrcweir                        ::com::sun::star::uno::XInterface >          m_xChartView;
138*cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
139*cdf0e10cSrcweir                         ::com::sun::star::awt::XWindow >            m_xWindow;
140*cdf0e10cSrcweir     ::com::sun::star::uno::WeakReference<
141*cdf0e10cSrcweir                        ::com::sun::star::accessibility::XAccessible > m_xParent;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir     ::boost::shared_ptr< ObjectHierarchy >                          m_spObjectHierarchy;
144*cdf0e10cSrcweir     AccessibleUniqueId                                              m_aCurrentSelectionOID;
145*cdf0e10cSrcweir     SdrView*                                                        m_pSdrView;
146*cdf0e10cSrcweir     ::accessibility::IAccessibleViewForwarder*                      m_pViewForwarder;
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir     //no default constructor
149*cdf0e10cSrcweir     AccessibleChartView();
150*cdf0e10cSrcweir };
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir //.............................................................................
153*cdf0e10cSrcweir } //namespace chart
154*cdf0e10cSrcweir //.............................................................................
155*cdf0e10cSrcweir #endif
156