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 24 25 #ifndef _SC_ACCESSIBLECELL_HXX 26 #define _SC_ACCESSIBLECELL_HXX 27 28 #include "AccessibleCellBase.hxx" 29 #include "global.hxx" 30 #include "viewdata.hxx" 31 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> 32 #include <unotools/accessiblerelationsethelper.hxx> 33 #include <editeng/AccessibleStaticTextBase.hxx> 34 #include <comphelper/uno3.hxx> 35 //IAccessibility2 Implementation 2009----- 36 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_ 37 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> 38 #endif 39 //-----IAccessibility2 Implementation 2009 40 41 class ScTabViewShell; 42 class ScAccessibleDocument; 43 44 typedef cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleExtendedAttributes> 45 ScAccessibleCellAttributeImpl; 46 47 /** @descr 48 This base class provides an implementation of the 49 <code>AccessibleCell</code> service. 50 */ 51 class ScAccessibleCell 52 : public ScAccessibleCellBase, 53 public accessibility::AccessibleStaticTextBase, 54 //IAccessibility2 Implementation 2009----- 55 public ScAccessibleCellAttributeImpl 56 //-----IAccessibility2 Implementation 2009 57 { 58 public: 59 //===== internal ======================================================== 60 ScAccessibleCell( 61 const ::com::sun::star::uno::Reference< 62 ::com::sun::star::accessibility::XAccessible>& rxParent, 63 ScTabViewShell* pViewShell, 64 ScAddress& rCellAddress, 65 sal_Int32 nIndex, 66 ScSplitPos eSplitPos, 67 ScAccessibleDocument* pAccDoc); 68 69 virtual void Init(); 70 71 using ScAccessibleCellBase::disposing; 72 virtual void SAL_CALL disposing(); 73 74 protected: 75 virtual ~ScAccessibleCell(); 76 77 using ScAccessibleCellBase::IsDefunc; 78 79 public: 80 ///===== XInterface ===================================================== 81 82 DECLARE_XINTERFACE() 83 84 ///===== XTypeProvider =================================================== 85 86 DECLARE_XTYPEPROVIDER() 87 88 ///===== XAccessibleComponent ============================================ 89 90 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > 91 SAL_CALL getAccessibleAtPoint( 92 const ::com::sun::star::awt::Point& rPoint ) 93 throw (::com::sun::star::uno::RuntimeException); 94 95 virtual void SAL_CALL grabFocus( ) 96 throw (::com::sun::star::uno::RuntimeException); 97 98 protected: 99 /// Return the object's current bounding box relative to the desktop. 100 virtual Rectangle GetBoundingBoxOnScreen(void) const 101 throw (::com::sun::star::uno::RuntimeException); 102 103 /// Return the object's current bounding box relative to the parent object. 104 virtual Rectangle GetBoundingBox(void) const 105 throw (::com::sun::star::uno::RuntimeException); 106 107 public: 108 ///===== XAccessibleContext ============================================== 109 110 /// Return the number of currently visible children. 111 // is overloaded to calculate this on demand 112 virtual sal_Int32 SAL_CALL 113 getAccessibleChildCount(void) 114 throw (::com::sun::star::uno::RuntimeException); 115 116 /// Return the specified child or NULL if index is invalid. 117 // is overloaded to calculate this on demand 118 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL 119 getAccessibleChild(sal_Int32 nIndex) 120 throw (::com::sun::star::uno::RuntimeException, 121 ::com::sun::star::lang::IndexOutOfBoundsException); 122 123 /// Return the set of current states. 124 virtual ::com::sun::star::uno::Reference< 125 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL 126 getAccessibleStateSet(void) 127 throw (::com::sun::star::uno::RuntimeException); 128 129 virtual ::com::sun::star::uno::Reference< 130 ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL 131 getAccessibleRelationSet(void) 132 throw (::com::sun::star::uno::RuntimeException); 133 134 ///===== XServiceInfo ==================================================== 135 136 /** Returns an identifier for the implementation of this object. 137 */ 138 virtual ::rtl::OUString SAL_CALL 139 getImplementationName(void) 140 throw (::com::sun::star::uno::RuntimeException); 141 142 /** Returns a list of all supported services. 143 */ 144 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 145 getSupportedServiceNames(void) 146 throw (::com::sun::star::uno::RuntimeException); 147 148 //IAccessibility2 Implementation 2009----- 149 virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 150 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; 151 152 // Override this method to handle cell's ParaIndent attribute specially. 153 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) 154 throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 155 //-----IAccessibility2 Implementation 2009 156 private: 157 ScTabViewShell* mpViewShell; 158 ScAccessibleDocument* mpAccDoc; 159 160 ScSplitPos meSplitPos; 161 162 sal_Bool IsDefunc( 163 const com::sun::star::uno::Reference< 164 ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); 165 virtual sal_Bool IsEditable( 166 const com::sun::star::uno::Reference< 167 ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); 168 sal_Bool IsOpaque( 169 const com::sun::star::uno::Reference< 170 ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); 171 sal_Bool IsSelected(); 172 173 ScDocument* GetDocument(ScTabViewShell* mpViewShell); 174 175 ::std::auto_ptr< SvxEditSource > CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos); 176 177 void FillDependends(utl::AccessibleRelationSetHelper* pRelationSet); 178 void FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet); 179 void AddRelation(const ScAddress& rCell, 180 const sal_uInt16 aRelationType, 181 ::utl::AccessibleRelationSetHelper* pRelationSet); 182 void AddRelation(const ScRange& rRange, 183 const sal_uInt16 aRelationType, 184 ::utl::AccessibleRelationSetHelper* pRelationSet); 185 //IAccessibility2 Implementation 2009----- 186 sal_Bool IsFormulaMode(); 187 sal_Bool IsDropdown(); 188 //-----IAccessibility2 Implementation 2009 189 }; 190 191 192 #endif 193