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 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_editeng.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <editeng/AccessibleComponentBase.hxx> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleSelection.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/drawing/XShapeDescriptor.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #include <tools/color.hxx> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir using namespace ::rtl; 45*cdf0e10cSrcweir using namespace ::com::sun::star; 46*cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir namespace accessibility { 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir //===== internal ============================================================ 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir AccessibleComponentBase::AccessibleComponentBase (void) 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir } 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir AccessibleComponentBase::~AccessibleComponentBase (void) 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir } 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir //===== XAccessibleComponent ================================================ 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleComponentBase::containsPoint ( 69*cdf0e10cSrcweir const ::com::sun::star::awt::Point& aPoint) 70*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir awt::Size aSize (getSize()); 73*cdf0e10cSrcweir return (aPoint.X >= 0) 74*cdf0e10cSrcweir && (aPoint.X < aSize.Width) 75*cdf0e10cSrcweir && (aPoint.Y >= 0) 76*cdf0e10cSrcweir && (aPoint.Y < aSize.Height); 77*cdf0e10cSrcweir } 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir uno::Reference<XAccessible > SAL_CALL 83*cdf0e10cSrcweir AccessibleComponentBase::getAccessibleAtPoint ( 84*cdf0e10cSrcweir const awt::Point& /*aPoint*/) 85*cdf0e10cSrcweir throw (uno::RuntimeException) 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir return uno::Reference<XAccessible>(); 88*cdf0e10cSrcweir } 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir awt::Rectangle SAL_CALL AccessibleComponentBase::getBounds (void) 94*cdf0e10cSrcweir throw (uno::RuntimeException) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir return awt::Rectangle(); 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir awt::Point SAL_CALL AccessibleComponentBase::getLocation (void) 103*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir awt::Rectangle aBBox (getBounds()); 106*cdf0e10cSrcweir return awt::Point (aBBox.X, aBBox.Y); 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir awt::Point SAL_CALL AccessibleComponentBase::getLocationOnScreen (void) 113*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir return awt::Point(); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir ::com::sun::star::awt::Size SAL_CALL AccessibleComponentBase::getSize (void) 122*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir awt::Rectangle aBBox (getBounds()); 125*cdf0e10cSrcweir return awt::Size (aBBox.Width, aBBox.Height); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir void SAL_CALL AccessibleComponentBase::addFocusListener ( 132*cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 133*cdf0e10cSrcweir ::com::sun::star::awt::XFocusListener >& /*xListener*/) 134*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir // Ignored 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir void SAL_CALL AccessibleComponentBase::removeFocusListener (const ::com::sun::star::uno::Reference< 143*cdf0e10cSrcweir ::com::sun::star::awt::XFocusListener >& /*xListener*/ ) 144*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir // Ignored 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir void SAL_CALL AccessibleComponentBase::grabFocus (void) 153*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir uno::Reference<XAccessibleContext> xContext (this, uno::UNO_QUERY); 156*cdf0e10cSrcweir uno::Reference<XAccessibleSelection> xSelection ( 157*cdf0e10cSrcweir xContext->getAccessibleParent(), uno::UNO_QUERY); 158*cdf0e10cSrcweir if (xSelection.is()) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir // Do a single selection on this object. 161*cdf0e10cSrcweir xSelection->clearAccessibleSelection(); 162*cdf0e10cSrcweir xSelection->selectAccessibleChild (xContext->getAccessibleIndexInParent()); 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleComponentBase::getForeground (void) 170*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 171*cdf0e10cSrcweir { 172*cdf0e10cSrcweir return Color(COL_BLACK).GetColor(); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleComponentBase::getBackground (void) 179*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir return Color(COL_WHITE).GetColor(); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir //===== XAccessibleExtendedComponent ======================================== 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL 190*cdf0e10cSrcweir AccessibleComponentBase::getFont (void) 191*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir return uno::Reference<awt::XFont>(); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleComponentBase::getTitledBorderText (void) 200*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir return ::rtl::OUString::createFromAscii (""); 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleComponentBase::getToolTipText (void) 209*cdf0e10cSrcweir throw (::com::sun::star::uno::RuntimeException) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir return ::rtl::OUString::createFromAscii (""); 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir //===== XTypeProvider =================================================== 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir uno::Sequence<uno::Type> SAL_CALL 220*cdf0e10cSrcweir AccessibleComponentBase::getTypes (void) 221*cdf0e10cSrcweir throw (uno::RuntimeException) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir // Get list of types from the context base implementation... 224*cdf0e10cSrcweir uno::Sequence<uno::Type> aTypeList (2); 225*cdf0e10cSrcweir // ...and add the additional type for the component. 226*cdf0e10cSrcweir const uno::Type aComponentType = 227*cdf0e10cSrcweir ::getCppuType((const uno::Reference<XAccessibleComponent>*)0); 228*cdf0e10cSrcweir const uno::Type aExtendedComponentType = 229*cdf0e10cSrcweir ::getCppuType((const uno::Reference<XAccessibleExtendedComponent>*)0); 230*cdf0e10cSrcweir aTypeList[0] = aComponentType; 231*cdf0e10cSrcweir aTypeList[1] = aExtendedComponentType; 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir return aTypeList; 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir } // end of namespace accessibility 238