1*190118d0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*190118d0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*190118d0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*190118d0SAndrew Rist * distributed with this work for additional information 6*190118d0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*190118d0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*190118d0SAndrew Rist * "License"); you may not use this file except in compliance 9*190118d0SAndrew Rist * with the License. You may obtain a copy of the License at 10*190118d0SAndrew Rist * 11*190118d0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*190118d0SAndrew Rist * 13*190118d0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*190118d0SAndrew Rist * software distributed under the License is distributed on an 15*190118d0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*190118d0SAndrew Rist * KIND, either express or implied. See the License for the 17*190118d0SAndrew Rist * specific language governing permissions and limitations 18*190118d0SAndrew Rist * under the License. 19*190118d0SAndrew Rist * 20*190118d0SAndrew Rist *************************************************************/ 21*190118d0SAndrew Rist 22*190118d0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_editeng.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <editeng/AccessibleComponentBase.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 31cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 32cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 33cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 34cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp> 35cdf0e10cSrcweir #include <com/sun/star/drawing/XShapeDescriptor.hpp> 36cdf0e10cSrcweir #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <tools/color.hxx> 39cdf0e10cSrcweir 40cdf0e10cSrcweir using namespace ::rtl; 41cdf0e10cSrcweir using namespace ::com::sun::star; 42cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace accessibility { 45cdf0e10cSrcweir 46cdf0e10cSrcweir //===== internal ============================================================ 47cdf0e10cSrcweir AccessibleComponentBase(void)48cdf0e10cSrcweirAccessibleComponentBase::AccessibleComponentBase (void) 49cdf0e10cSrcweir { 50cdf0e10cSrcweir } 51cdf0e10cSrcweir 52cdf0e10cSrcweir 53cdf0e10cSrcweir 54cdf0e10cSrcweir ~AccessibleComponentBase(void)55cdf0e10cSrcweirAccessibleComponentBase::~AccessibleComponentBase (void) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir } 58cdf0e10cSrcweir 59cdf0e10cSrcweir 60cdf0e10cSrcweir 61cdf0e10cSrcweir 62cdf0e10cSrcweir //===== XAccessibleComponent ================================================ 63cdf0e10cSrcweir containsPoint(const::com::sun::star::awt::Point & aPoint)64cdf0e10cSrcweirsal_Bool SAL_CALL AccessibleComponentBase::containsPoint ( 65cdf0e10cSrcweir const ::com::sun::star::awt::Point& aPoint) 66cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 67cdf0e10cSrcweir { 68cdf0e10cSrcweir awt::Size aSize (getSize()); 69cdf0e10cSrcweir return (aPoint.X >= 0) 70cdf0e10cSrcweir && (aPoint.X < aSize.Width) 71cdf0e10cSrcweir && (aPoint.Y >= 0) 72cdf0e10cSrcweir && (aPoint.Y < aSize.Height); 73cdf0e10cSrcweir } 74cdf0e10cSrcweir 75cdf0e10cSrcweir 76cdf0e10cSrcweir 77cdf0e10cSrcweir 78cdf0e10cSrcweir uno::Reference<XAccessible > SAL_CALL getAccessibleAtPoint(const awt::Point &)79cdf0e10cSrcweir AccessibleComponentBase::getAccessibleAtPoint ( 80cdf0e10cSrcweir const awt::Point& /*aPoint*/) 81cdf0e10cSrcweir throw (uno::RuntimeException) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir return uno::Reference<XAccessible>(); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir 87cdf0e10cSrcweir 88cdf0e10cSrcweir getBounds(void)89cdf0e10cSrcweirawt::Rectangle SAL_CALL AccessibleComponentBase::getBounds (void) 90cdf0e10cSrcweir throw (uno::RuntimeException) 91cdf0e10cSrcweir { 92cdf0e10cSrcweir return awt::Rectangle(); 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir 96cdf0e10cSrcweir 97cdf0e10cSrcweir getLocation(void)98cdf0e10cSrcweirawt::Point SAL_CALL AccessibleComponentBase::getLocation (void) 99cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir awt::Rectangle aBBox (getBounds()); 102cdf0e10cSrcweir return awt::Point (aBBox.X, aBBox.Y); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105cdf0e10cSrcweir 106cdf0e10cSrcweir 107cdf0e10cSrcweir getLocationOnScreen(void)108cdf0e10cSrcweirawt::Point SAL_CALL AccessibleComponentBase::getLocationOnScreen (void) 109cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 110cdf0e10cSrcweir { 111cdf0e10cSrcweir return awt::Point(); 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir 115cdf0e10cSrcweir 116cdf0e10cSrcweir getSize(void)117cdf0e10cSrcweir::com::sun::star::awt::Size SAL_CALL AccessibleComponentBase::getSize (void) 118cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir awt::Rectangle aBBox (getBounds()); 121cdf0e10cSrcweir return awt::Size (aBBox.Width, aBBox.Height); 122cdf0e10cSrcweir } 123cdf0e10cSrcweir 124cdf0e10cSrcweir 125cdf0e10cSrcweir 126cdf0e10cSrcweir addFocusListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XFocusListener> &)127cdf0e10cSrcweirvoid SAL_CALL AccessibleComponentBase::addFocusListener ( 128cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 129cdf0e10cSrcweir ::com::sun::star::awt::XFocusListener >& /*xListener*/) 130cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir // Ignored 133cdf0e10cSrcweir } 134cdf0e10cSrcweir 135cdf0e10cSrcweir 136cdf0e10cSrcweir 137cdf0e10cSrcweir removeFocusListener(const::com::sun::star::uno::Reference<::com::sun::star::awt::XFocusListener> &)138cdf0e10cSrcweirvoid SAL_CALL AccessibleComponentBase::removeFocusListener (const ::com::sun::star::uno::Reference< 139cdf0e10cSrcweir ::com::sun::star::awt::XFocusListener >& /*xListener*/ ) 140cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir // Ignored 143cdf0e10cSrcweir } 144cdf0e10cSrcweir 145cdf0e10cSrcweir 146cdf0e10cSrcweir 147cdf0e10cSrcweir grabFocus(void)148cdf0e10cSrcweirvoid SAL_CALL AccessibleComponentBase::grabFocus (void) 149cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir uno::Reference<XAccessibleContext> xContext (this, uno::UNO_QUERY); 152cdf0e10cSrcweir uno::Reference<XAccessibleSelection> xSelection ( 153cdf0e10cSrcweir xContext->getAccessibleParent(), uno::UNO_QUERY); 154cdf0e10cSrcweir if (xSelection.is()) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir // Do a single selection on this object. 157cdf0e10cSrcweir xSelection->clearAccessibleSelection(); 158cdf0e10cSrcweir xSelection->selectAccessibleChild (xContext->getAccessibleIndexInParent()); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir } 161cdf0e10cSrcweir 162cdf0e10cSrcweir 163cdf0e10cSrcweir 164cdf0e10cSrcweir getForeground(void)165cdf0e10cSrcweirsal_Int32 SAL_CALL AccessibleComponentBase::getForeground (void) 166cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 167cdf0e10cSrcweir { 168cdf0e10cSrcweir return Color(COL_BLACK).GetColor(); 169cdf0e10cSrcweir } 170cdf0e10cSrcweir 171cdf0e10cSrcweir 172cdf0e10cSrcweir 173cdf0e10cSrcweir getBackground(void)174cdf0e10cSrcweirsal_Int32 SAL_CALL AccessibleComponentBase::getBackground (void) 175cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 176cdf0e10cSrcweir { 177cdf0e10cSrcweir return Color(COL_WHITE).GetColor(); 178cdf0e10cSrcweir } 179cdf0e10cSrcweir 180cdf0e10cSrcweir 181cdf0e10cSrcweir 182cdf0e10cSrcweir 183cdf0e10cSrcweir //===== XAccessibleExtendedComponent ======================================== 184cdf0e10cSrcweir 185cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont(void)186cdf0e10cSrcweir AccessibleComponentBase::getFont (void) 187cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir return uno::Reference<awt::XFont>(); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir 192cdf0e10cSrcweir 193cdf0e10cSrcweir 194cdf0e10cSrcweir getTitledBorderText(void)195cdf0e10cSrcweir::rtl::OUString SAL_CALL AccessibleComponentBase::getTitledBorderText (void) 196cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir return ::rtl::OUString::createFromAscii (""); 199cdf0e10cSrcweir } 200cdf0e10cSrcweir 201cdf0e10cSrcweir 202cdf0e10cSrcweir 203cdf0e10cSrcweir getToolTipText(void)204cdf0e10cSrcweir::rtl::OUString SAL_CALL AccessibleComponentBase::getToolTipText (void) 205cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir return ::rtl::OUString::createFromAscii (""); 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir 211cdf0e10cSrcweir 212cdf0e10cSrcweir 213cdf0e10cSrcweir //===== XTypeProvider =================================================== 214cdf0e10cSrcweir 215cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL getTypes(void)216cdf0e10cSrcweir AccessibleComponentBase::getTypes (void) 217cdf0e10cSrcweir throw (uno::RuntimeException) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir // Get list of types from the context base implementation... 220cdf0e10cSrcweir uno::Sequence<uno::Type> aTypeList (2); 221cdf0e10cSrcweir // ...and add the additional type for the component. 222cdf0e10cSrcweir const uno::Type aComponentType = 223cdf0e10cSrcweir ::getCppuType((const uno::Reference<XAccessibleComponent>*)0); 224cdf0e10cSrcweir const uno::Type aExtendedComponentType = 225cdf0e10cSrcweir ::getCppuType((const uno::Reference<XAccessibleExtendedComponent>*)0); 226cdf0e10cSrcweir aTypeList[0] = aComponentType; 227cdf0e10cSrcweir aTypeList[1] = aExtendedComponentType; 228cdf0e10cSrcweir 229cdf0e10cSrcweir return aTypeList; 230cdf0e10cSrcweir } 231cdf0e10cSrcweir 232cdf0e10cSrcweir 233cdf0e10cSrcweir } // end of namespace accessibility 234