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 28 29 #ifndef _SD_ACCESSIBILITY_ACCESSIBLE_PAGE_SHAPE_HXX 30 #define _SD_ACCESSIBILITY_ACCESSIBLE_PAGE_SHAPE_HXX 31 32 #include <svx/AccessibleShape.hxx> 33 #include <svx/AccessibleShapeTreeInfo.hxx> 34 #include <svx/IAccessibleViewForwarderListener.hxx> 35 #include <com/sun/star/accessibility/XAccessible.hpp> 36 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> 37 #include <com/sun/star/accessibility/AccessibleRole.hpp> 38 #include <com/sun/star/drawing/XDrawPage.hpp> 39 #include <com/sun/star/lang/XEventListener.hpp> 40 41 #include <svx/AccessibleTextHelper.hxx> 42 43 namespace accessibility { 44 45 /** A page shape represents the actual page as seen on the screen. 46 */ 47 class AccessiblePageShape 48 : public AccessibleShape 49 { 50 public: 51 //===== internal ======================================================== 52 53 /** Create a new accessible object that makes the given shape accessible. 54 @param rxParent 55 The accessible parent object. It will be used, for example when 56 the <member>getIndexInParent</member> method is called. 57 @param rShapeTreeInfo 58 Bundel of information passed to this shape and all of its desendants. 59 @param nIndex 60 Index used to disambiguate between objects that have the same 61 name. Passing a value of -1 leads to the use of the object's 62 z-order instead. Because that is not a good substitute, better 63 pass an ever increasing counter. 64 @attention 65 Always call the <member>init</member> method after creating a 66 new accessible shape. This is one way to overcome the potential 67 problem of registering the new object with e.g. event 68 broadcasters. That would delete the new object if a broadcaster 69 would not keep a strong reference to the new object. 70 */ 71 AccessiblePageShape ( 72 const ::com::sun::star::uno::Reference< 73 ::com::sun::star::drawing::XDrawPage>& rxPage, 74 const ::com::sun::star::uno::Reference< 75 ::com::sun::star::accessibility::XAccessible>& rxParent, 76 const AccessibleShapeTreeInfo& rShapeTreeInfo, 77 long nIndex = -1); 78 79 virtual ~AccessiblePageShape (void); 80 81 /** Initialize a new shape. See the documentation of the constructor 82 for the reason of this method's existence. 83 */ 84 virtual void Init (void); 85 86 //===== XAccessibleContext ============================================== 87 88 /// Returns always 0 because there can be no children. 89 virtual sal_Int32 SAL_CALL 90 getAccessibleChildCount (void) 91 throw (); 92 93 /** Return the specified child. 94 @param nIndex 95 Index of the requested child. 96 @return 97 Reference of the requested child which is the accessible object 98 of a visible shape. 99 @raises IndexOutOfBoundsException 100 Throws always an exception because there are no children. 101 */ 102 virtual ::com::sun::star::uno::Reference< 103 ::com::sun::star::accessibility::XAccessible> SAL_CALL 104 getAccessibleChild (sal_Int32 nIndex) 105 throw (::com::sun::star::uno::RuntimeException); 106 107 108 //===== XAccessibleComponent ============================================ 109 110 virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void) 111 throw (::com::sun::star::uno::RuntimeException); 112 113 virtual sal_Int32 SAL_CALL getForeground (void) 114 throw (::com::sun::star::uno::RuntimeException); 115 116 virtual sal_Int32 SAL_CALL getBackground (void) 117 throw (::com::sun::star::uno::RuntimeException); 118 119 //===== XComponent ====================================================== 120 121 virtual void SAL_CALL 122 dispose (void) 123 throw (::com::sun::star::uno::RuntimeException); 124 125 126 //===== XServiceInfo ==================================================== 127 128 virtual ::rtl::OUString SAL_CALL 129 getImplementationName (void) 130 throw (::com::sun::star::uno::RuntimeException); 131 132 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL 133 getSupportedServiceNames (void) 134 throw (::com::sun::star::uno::RuntimeException); 135 136 137 //===== lang::XEventListener ============================================ 138 139 virtual void SAL_CALL 140 disposing (const ::com::sun::star::lang::EventObject& Source) 141 throw (::com::sun::star::uno::RuntimeException); 142 143 144 using AccessibleShape::disposing; 145 146 protected: 147 /** Create a base name string that contains the accessible name. 148 */ 149 virtual ::rtl::OUString 150 CreateAccessibleBaseName (void) 151 throw (::com::sun::star::uno::RuntimeException); 152 153 virtual ::rtl::OUString 154 CreateAccessibleName (void) 155 throw (::com::sun::star::uno::RuntimeException); 156 157 /// Create a description string that contains the accessible description. 158 virtual ::rtl::OUString 159 CreateAccessibleDescription (void) 160 throw (::com::sun::star::uno::RuntimeException); 161 162 private: 163 ::com::sun::star::uno::Reference< 164 ::com::sun::star::drawing::XDrawPage> mxPage; 165 166 /** Don't use the default constructor. Use the public constructor that 167 takes the original shape and the parent as arguments instead. 168 */ 169 explicit AccessiblePageShape (void); 170 /// Don't use the copy constructor. Is there any use for it? 171 explicit AccessiblePageShape (const AccessiblePageShape&); 172 /// Don't use the assignment operator. Do we need this? 173 AccessibleShape& operator= (const AccessiblePageShape&); 174 }; 175 176 } // end of namespace accessibility 177 178 #endif 179