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