1190118d0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3190118d0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4190118d0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5190118d0SAndrew Rist * distributed with this work for additional information 6190118d0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7190118d0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8190118d0SAndrew Rist * "License"); you may not use this file except in compliance 9190118d0SAndrew Rist * with the License. You may obtain a copy of the License at 10190118d0SAndrew Rist * 11190118d0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12190118d0SAndrew Rist * 13190118d0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14190118d0SAndrew Rist * software distributed under the License is distributed on an 15190118d0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16190118d0SAndrew Rist * KIND, either express or implied. See the License for the 17190118d0SAndrew Rist * specific language governing permissions and limitations 18190118d0SAndrew Rist * under the License. 19190118d0SAndrew Rist * 20190118d0SAndrew Rist *************************************************************/ 21190118d0SAndrew Rist 22190118d0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_editeng.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/uno/Any.hxx> 28cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 29cdf0e10cSrcweir #include <comphelper/accessiblekeybindinghelper.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "AccessibleHyperlink.hxx" 32cdf0e10cSrcweir #include "editeng/unoedprx.hxx" 33cdf0e10cSrcweir #include <editeng/flditem.hxx> 34cdf0e10cSrcweir #include <vcl/keycodes.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir using namespace ::com::sun::star; 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39cdf0e10cSrcweir //------------------------------------------------------------------------ 40cdf0e10cSrcweir // 41cdf0e10cSrcweir // AccessibleHyperlink implementation 42cdf0e10cSrcweir // 43cdf0e10cSrcweir //------------------------------------------------------------------------ 44cdf0e10cSrcweir 45cdf0e10cSrcweir namespace accessibility 46cdf0e10cSrcweir { 47cdf0e10cSrcweir AccessibleHyperlink(SvxAccessibleTextAdapter & r,SvxFieldItem * p,sal_uInt16 nP,sal_uInt16 nR,sal_Int32 nStt,sal_Int32 nEnd,const::rtl::OUString & rD)48cdf0e10cSrcweir AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, sal_uInt16 nP, sal_uInt16 nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ) 49cdf0e10cSrcweir : rTA( r ) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir pFld = p; 52cdf0e10cSrcweir nPara = nP; 53cdf0e10cSrcweir nRealIdx = nR; 54cdf0e10cSrcweir nStartIdx = nStt; 55cdf0e10cSrcweir nEndIdx = nEnd; 56cdf0e10cSrcweir aDescription = rD; 57cdf0e10cSrcweir } 58cdf0e10cSrcweir ~AccessibleHyperlink()59cdf0e10cSrcweir AccessibleHyperlink::~AccessibleHyperlink() 60cdf0e10cSrcweir { 61cdf0e10cSrcweir delete pFld; 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir // XAccessibleAction getAccessibleActionCount()65cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleHyperlink::getAccessibleActionCount() throw (uno::RuntimeException) 66cdf0e10cSrcweir { 67cdf0e10cSrcweir return isValid() ? 1 : 0; 68cdf0e10cSrcweir } 69cdf0e10cSrcweir doAccessibleAction(sal_Int32 nIndex)70cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir sal_Bool bRet = sal_False; 73cdf0e10cSrcweir if ( isValid() && ( nIndex == 0 ) ) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir rTA.FieldClicked( *pFld, nPara, nRealIdx ); 76cdf0e10cSrcweir bRet = sal_True; 77cdf0e10cSrcweir } 78cdf0e10cSrcweir return bRet; 79cdf0e10cSrcweir } 80cdf0e10cSrcweir getAccessibleActionDescription(sal_Int32 nIndex)81cdf0e10cSrcweir ::rtl::OUString SAL_CALL AccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir ::rtl::OUString aDesc; 84cdf0e10cSrcweir 85cdf0e10cSrcweir if ( isValid() && ( nIndex == 0 ) ) 86cdf0e10cSrcweir aDesc = aDescription; 87cdf0e10cSrcweir 88cdf0e10cSrcweir return aDesc; 89cdf0e10cSrcweir } 90cdf0e10cSrcweir getAccessibleActionKeyBinding(sal_Int32 nIndex)91cdf0e10cSrcweir uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > xKeyBinding; 94cdf0e10cSrcweir 95cdf0e10cSrcweir if( isValid() && ( nIndex == 0 ) ) 96cdf0e10cSrcweir { 97cdf0e10cSrcweir ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper(); 98cdf0e10cSrcweir xKeyBinding = pKeyBindingHelper; 99cdf0e10cSrcweir 100cdf0e10cSrcweir awt::KeyStroke aKeyStroke; 101cdf0e10cSrcweir aKeyStroke.Modifiers = 0; 102cdf0e10cSrcweir aKeyStroke.KeyCode = KEY_RETURN; 103cdf0e10cSrcweir aKeyStroke.KeyChar = 0; 104cdf0e10cSrcweir aKeyStroke.KeyFunc = 0; 105cdf0e10cSrcweir pKeyBindingHelper->AddKeyBinding( aKeyStroke ); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir return xKeyBinding; 109cdf0e10cSrcweir } 110cdf0e10cSrcweir 111cdf0e10cSrcweir // XAccessibleHyperlink getAccessibleActionAnchor(sal_Int32)112cdf0e10cSrcweir uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionAnchor( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir return uno::Any(); 115cdf0e10cSrcweir } 116cdf0e10cSrcweir getAccessibleActionObject(sal_Int32)117cdf0e10cSrcweir uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionObject( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir return uno::Any(); 120cdf0e10cSrcweir } 121cdf0e10cSrcweir getStartIndex()122cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleHyperlink::getStartIndex() throw (uno::RuntimeException) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir return nStartIdx; 125cdf0e10cSrcweir } 126cdf0e10cSrcweir getEndIndex()127cdf0e10cSrcweir sal_Int32 SAL_CALL AccessibleHyperlink::getEndIndex() throw (uno::RuntimeException) 128cdf0e10cSrcweir { 129cdf0e10cSrcweir return nEndIdx; 130cdf0e10cSrcweir } 131cdf0e10cSrcweir isValid()132cdf0e10cSrcweir sal_Bool SAL_CALL AccessibleHyperlink::isValid( ) throw (uno::RuntimeException) 133cdf0e10cSrcweir { 134cdf0e10cSrcweir return rTA.IsValid(); 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir } // end of namespace accessibility 138cdf0e10cSrcweir 139cdf0e10cSrcweir //------------------------------------------------------------------------ 140*9b8096d0SSteve Yin 141*9b8096d0SSteve Yin // MT IA2: Accessiblehyperlink.hxx from IA2 CWS - meanwhile we also introduced one in DEV300 (above) 142*9b8096d0SSteve Yin // Keeping this for reference - we probably should get support for image maps in our implementation... 143*9b8096d0SSteve Yin 144*9b8096d0SSteve Yin 145*9b8096d0SSteve Yin /* 146*9b8096d0SSteve Yin 147*9b8096d0SSteve Yin class SVX_DLLPUBLIC SvxAccessibleHyperlink : 148*9b8096d0SSteve Yin public ::cppu::WeakImplHelper1< 149*9b8096d0SSteve Yin ::com::sun::star::accessibility::XAccessibleHyperlink > 150*9b8096d0SSteve Yin { 151*9b8096d0SSteve Yin SvxURLField* mpField; 152*9b8096d0SSteve Yin sal_Int32 nStartIdx; 153*9b8096d0SSteve Yin sal_Int32 nEndIdx; 154*9b8096d0SSteve Yin 155*9b8096d0SSteve Yin ImageMap* mpImageMap; 156*9b8096d0SSteve Yin SdrObject* m_pShape; 157*9b8096d0SSteve Yin ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > shapeParent; 158*9b8096d0SSteve Yin 159*9b8096d0SSteve Yin public: 160*9b8096d0SSteve Yin 161*9b8096d0SSteve Yin SvxAccessibleHyperlink(){}; 162*9b8096d0SSteve Yin //SvxAccessibleHyperlink(::rtl::OUString name, const Imagemap* pImageMap); 163*9b8096d0SSteve Yin SvxAccessibleHyperlink(const SvxURLField* p, sal_Int32 nStt, sal_Int32 nEnd); 164*9b8096d0SSteve Yin SvxAccessibleHyperlink(SdrObject* p, ::accessibility::AccessibleShape* pAcc); 165*9b8096d0SSteve Yin virtual ~SvxAccessibleHyperlink(); 166*9b8096d0SSteve Yin //void setImageMap(ImageMap* pMap); 167*9b8096d0SSteve Yin //void setXAccessibleImage(::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > parent); 168*9b8096d0SSteve Yin ::rtl::OUString GetHyperlinkURL(sal_Int32 nIndex) throw (::com::sun::star::lang::IndexOutOfBoundsException); 169*9b8096d0SSteve Yin sal_Bool IsValidHyperlink(); 170*9b8096d0SSteve Yin 171*9b8096d0SSteve Yin // XAccessibleAction 172*9b8096d0SSteve Yin virtual sal_Int32 SAL_CALL getAccessibleActionCount() 173*9b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException); 174*9b8096d0SSteve Yin virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) 175*9b8096d0SSteve Yin throw (::com::sun::star::lang::IndexOutOfBoundsException, 176*9b8096d0SSteve Yin ::com::sun::star::uno::RuntimeException); 177*9b8096d0SSteve Yin virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( 178*9b8096d0SSteve Yin sal_Int32 nIndex ) 179*9b8096d0SSteve Yin throw (::com::sun::star::lang::IndexOutOfBoundsException, 180*9b8096d0SSteve Yin ::com::sun::star::uno::RuntimeException); 181*9b8096d0SSteve Yin virtual ::com::sun::star::uno::Reference< 182*9b8096d0SSteve Yin ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL 183*9b8096d0SSteve Yin getAccessibleActionKeyBinding( sal_Int32 nIndex ) 184*9b8096d0SSteve Yin throw (::com::sun::star::lang::IndexOutOfBoundsException, 185*9b8096d0SSteve Yin ::com::sun::star::uno::RuntimeException); 186*9b8096d0SSteve Yin 187*9b8096d0SSteve Yin // XAccessibleHyperlink 188*9b8096d0SSteve Yin virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( 189*9b8096d0SSteve Yin sal_Int32 nIndex ) 190*9b8096d0SSteve Yin throw (::com::sun::star::lang::IndexOutOfBoundsException, 191*9b8096d0SSteve Yin ::com::sun::star::uno::RuntimeException); 192*9b8096d0SSteve Yin virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( 193*9b8096d0SSteve Yin sal_Int32 nIndex ) 194*9b8096d0SSteve Yin throw (::com::sun::star::lang::IndexOutOfBoundsException, 195*9b8096d0SSteve Yin ::com::sun::star::uno::RuntimeException); 196*9b8096d0SSteve Yin virtual sal_Int32 SAL_CALL getStartIndex() 197*9b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException); 198*9b8096d0SSteve Yin virtual sal_Int32 SAL_CALL getEndIndex() 199*9b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException); 200*9b8096d0SSteve Yin virtual sal_Bool SAL_CALL isValid( ) 201*9b8096d0SSteve Yin throw (::com::sun::star::uno::RuntimeException); 202*9b8096d0SSteve Yin }; 203*9b8096d0SSteve Yin 204*9b8096d0SSteve Yin 205*9b8096d0SSteve Yin SvxAccessibleHyperlink::SvxAccessibleHyperlink( const SvxURLField *p, 206*9b8096d0SSteve Yin sal_Int32 nStt, sal_Int32 nEnd ) : 207*9b8096d0SSteve Yin nStartIdx( nStt ), 208*9b8096d0SSteve Yin nEndIdx( nEnd ), 209*9b8096d0SSteve Yin m_pShape(NULL), 210*9b8096d0SSteve Yin shapeParent(NULL) 211*9b8096d0SSteve Yin { 212*9b8096d0SSteve Yin if(p) 213*9b8096d0SSteve Yin mpField = (SvxURLField*)p->Clone(); 214*9b8096d0SSteve Yin else 215*9b8096d0SSteve Yin mpField = NULL; 216*9b8096d0SSteve Yin } 217*9b8096d0SSteve Yin 218*9b8096d0SSteve Yin SvxAccessibleHyperlink::SvxAccessibleHyperlink(SdrObject* p, 219*9b8096d0SSteve Yin ::accessibility::AccessibleShape* pAcc) : 220*9b8096d0SSteve Yin nStartIdx( -1 ), 221*9b8096d0SSteve Yin nEndIdx( -1 ), 222*9b8096d0SSteve Yin mpField(NULL), 223*9b8096d0SSteve Yin m_pShape(p) 224*9b8096d0SSteve Yin { 225*9b8096d0SSteve Yin mpImageMap = m_pShape->GetModel()->GetImageMapForObject(m_pShape); 226*9b8096d0SSteve Yin shapeParent = dynamic_cast< XAccessible* >(pAcc); 227*9b8096d0SSteve Yin } 228*9b8096d0SSteve Yin 229*9b8096d0SSteve Yin SvxAccessibleHyperlink::~SvxAccessibleHyperlink() 230*9b8096d0SSteve Yin { 231*9b8096d0SSteve Yin if(mpField) 232*9b8096d0SSteve Yin delete mpField; 233*9b8096d0SSteve Yin } 234*9b8096d0SSteve Yin 235*9b8096d0SSteve Yin ::rtl::OUString SvxAccessibleHyperlink::GetHyperlinkURL(sal_Int32 nIndex) throw (::com::sun::star::lang::IndexOutOfBoundsException) 236*9b8096d0SSteve Yin { 237*9b8096d0SSteve Yin if( mpField ) 238*9b8096d0SSteve Yin { 239*9b8096d0SSteve Yin if (nIndex != 0) 240*9b8096d0SSteve Yin throw ::com::sun::star::lang::IndexOutOfBoundsException(); 241*9b8096d0SSteve Yin return ::rtl::OUString( mpField->GetURL() ); 242*9b8096d0SSteve Yin } 243*9b8096d0SSteve Yin else if (mpImageMap) 244*9b8096d0SSteve Yin { 245*9b8096d0SSteve Yin if (nIndex < 0 || nIndex >=mpImageMap->GetIMapObjectCount()) 246*9b8096d0SSteve Yin throw IndexOutOfBoundsException(); 247*9b8096d0SSteve Yin 248*9b8096d0SSteve Yin IMapObject* pMapObj = mpImageMap->GetIMapObject(sal_uInt16(nIndex)); 249*9b8096d0SSteve Yin if (pMapObj->GetURL().Len()) 250*9b8096d0SSteve Yin return ::rtl::OUString( pMapObj->GetURL() ); 251*9b8096d0SSteve Yin } 252*9b8096d0SSteve Yin else 253*9b8096d0SSteve Yin { 254*9b8096d0SSteve Yin if (nIndex != 0) 255*9b8096d0SSteve Yin throw ::com::sun::star::lang::IndexOutOfBoundsException(); 256*9b8096d0SSteve Yin 257*9b8096d0SSteve Yin SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( m_pShape ); 258*9b8096d0SSteve Yin 259*9b8096d0SSteve Yin if(pUnoCtrl) 260*9b8096d0SSteve Yin { 261*9b8096d0SSteve Yin try 262*9b8096d0SSteve Yin { 263*9b8096d0SSteve Yin uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW ); 264*9b8096d0SSteve Yin uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW ); 265*9b8096d0SSteve Yin uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW ); 266*9b8096d0SSteve Yin 267*9b8096d0SSteve Yin form::FormButtonType eButtonType = form::FormButtonType_URL; 268*9b8096d0SSteve Yin const ::rtl::OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ); 269*9b8096d0SSteve Yin if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) ) 270*9b8096d0SSteve Yin { 271*9b8096d0SSteve Yin ::rtl::OUString aString; 272*9b8096d0SSteve Yin 273*9b8096d0SSteve Yin // URL 274*9b8096d0SSteve Yin const ::rtl::OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" )); 275*9b8096d0SSteve Yin if(xPropInfo->hasPropertyByName(sTargetURL)) 276*9b8096d0SSteve Yin { 277*9b8096d0SSteve Yin if( xPropSet->getPropertyValue(sTargetURL) >>= aString ) 278*9b8096d0SSteve Yin return aString; 279*9b8096d0SSteve Yin } 280*9b8096d0SSteve Yin } 281*9b8096d0SSteve Yin } 282*9b8096d0SSteve Yin catch( uno::Exception& ) 283*9b8096d0SSteve Yin { 284*9b8096d0SSteve Yin } 285*9b8096d0SSteve Yin } 286*9b8096d0SSteve Yin // If hyperlink can't be got from sdrobject, query the corresponding document to retrieve the link info 287*9b8096d0SSteve Yin uno::Reference< XAccessibleGroupPosition > xGroupPosition (shapeParent, uno::UNO_QUERY); 288*9b8096d0SSteve Yin if (xGroupPosition.is()) 289*9b8096d0SSteve Yin return xGroupPosition->getObjectLink( uno::makeAny( shapeParent ) ); 290*9b8096d0SSteve Yin } 291*9b8096d0SSteve Yin return ::rtl::OUString(); 292*9b8096d0SSteve Yin } 293*9b8096d0SSteve Yin 294*9b8096d0SSteve Yin // Just check whether the first hyperlink is valid 295*9b8096d0SSteve Yin sal_Bool SvxAccessibleHyperlink::IsValidHyperlink() 296*9b8096d0SSteve Yin { 297*9b8096d0SSteve Yin ::rtl::OUString url = GetHyperlinkURL(0); 298*9b8096d0SSteve Yin if (url.getLength() > 0) 299*9b8096d0SSteve Yin return sal_True; 300*9b8096d0SSteve Yin else 301*9b8096d0SSteve Yin return sal_False; 302*9b8096d0SSteve Yin } 303*9b8096d0SSteve Yin // XAccessibleAction 304*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxAccessibleHyperlink::getAccessibleActionCount() 305*9b8096d0SSteve Yin throw (RuntimeException) 306*9b8096d0SSteve Yin { 307*9b8096d0SSteve Yin if (mpImageMap) 308*9b8096d0SSteve Yin return mpImageMap->GetIMapObjectCount(); 309*9b8096d0SSteve Yin else 310*9b8096d0SSteve Yin return 1; // only shape link or url field 311*9b8096d0SSteve Yin 312*9b8096d0SSteve Yin //return mpField ? 1 : (mpImageMap ? mpImageMap->GetIMapObjectCount() : 0); 313*9b8096d0SSteve Yin } 314*9b8096d0SSteve Yin 315*9b8096d0SSteve Yin sal_Bool SAL_CALL SvxAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) 316*9b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException) 317*9b8096d0SSteve Yin { 318*9b8096d0SSteve Yin vos::OGuard aGuard(Application::GetSolarMutex()); 319*9b8096d0SSteve Yin 320*9b8096d0SSteve Yin sal_Bool bRet = sal_False; 321*9b8096d0SSteve Yin 322*9b8096d0SSteve Yin OUString url = GetHyperlinkURL(nIndex); 323*9b8096d0SSteve Yin 324*9b8096d0SSteve Yin if( url.getLength() > 0 ) 325*9b8096d0SSteve Yin { 326*9b8096d0SSteve Yin SfxStringItem aStrItem(SID_FILE_NAME, url); 327*9b8096d0SSteve Yin const SfxObjectShell* pDocSh = SfxObjectShell::Current(); 328*9b8096d0SSteve Yin if( pDocSh ) 329*9b8096d0SSteve Yin { 330*9b8096d0SSteve Yin SfxMedium* pSfxMedium = pDocSh->GetMedium(); 331*9b8096d0SSteve Yin if( pSfxMedium) 332*9b8096d0SSteve Yin { 333*9b8096d0SSteve Yin SfxStringItem aReferer(SID_REFERER, pSfxMedium->GetName()); 334*9b8096d0SSteve Yin SfxBoolItem aBrowseItem( SID_BROWSE, TRUE ); 335*9b8096d0SSteve Yin SfxViewFrame* pFrame = SfxViewFrame::Current(); 336*9b8096d0SSteve Yin if( pFrame ) 337*9b8096d0SSteve Yin { 338*9b8096d0SSteve Yin pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, 339*9b8096d0SSteve Yin &aStrItem, &aBrowseItem, &aReferer, 0L); 340*9b8096d0SSteve Yin bRet = sal_True; 341*9b8096d0SSteve Yin } 342*9b8096d0SSteve Yin } 343*9b8096d0SSteve Yin } 344*9b8096d0SSteve Yin } 345*9b8096d0SSteve Yin 346*9b8096d0SSteve Yin return bRet; 347*9b8096d0SSteve Yin } 348*9b8096d0SSteve Yin 349*9b8096d0SSteve Yin OUString SAL_CALL SvxAccessibleHyperlink::getAccessibleActionDescription( 350*9b8096d0SSteve Yin sal_Int32 nIndex ) 351*9b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException) 352*9b8096d0SSteve Yin { 353*9b8096d0SSteve Yin return GetHyperlinkURL(nIndex); 354*9b8096d0SSteve Yin } 355*9b8096d0SSteve Yin 356*9b8096d0SSteve Yin ::com::sun::star::uno::Reference< XAccessibleKeyBinding > SAL_CALL 357*9b8096d0SSteve Yin SvxAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 ) 358*9b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException) 359*9b8096d0SSteve Yin { 360*9b8096d0SSteve Yin ::com::sun::star::uno::Reference< XAccessibleKeyBinding > xKeyBinding; 361*9b8096d0SSteve Yin 362*9b8096d0SSteve Yin if( mpField || m_pShape) 363*9b8096d0SSteve Yin { 364*9b8096d0SSteve Yin ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = 365*9b8096d0SSteve Yin new ::comphelper::OAccessibleKeyBindingHelper(); 366*9b8096d0SSteve Yin xKeyBinding = pKeyBindingHelper; 367*9b8096d0SSteve Yin 368*9b8096d0SSteve Yin ::com::sun::star::awt::KeyStroke aKeyStroke; 369*9b8096d0SSteve Yin aKeyStroke.Modifiers = 0; 370*9b8096d0SSteve Yin aKeyStroke.KeyCode = KEY_RETURN; 371*9b8096d0SSteve Yin aKeyStroke.KeyChar = 0; 372*9b8096d0SSteve Yin aKeyStroke.KeyFunc = 0; 373*9b8096d0SSteve Yin pKeyBindingHelper->AddKeyBinding( aKeyStroke ); 374*9b8096d0SSteve Yin } 375*9b8096d0SSteve Yin 376*9b8096d0SSteve Yin return xKeyBinding; 377*9b8096d0SSteve Yin } 378*9b8096d0SSteve Yin 379*9b8096d0SSteve Yin // XAccessibleHyperlink 380*9b8096d0SSteve Yin Any SAL_CALL SvxAccessibleHyperlink::getAccessibleActionAnchor( 381*9b8096d0SSteve Yin sal_Int32 nIndex ) 382*9b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException) 383*9b8096d0SSteve Yin { 384*9b8096d0SSteve Yin Any aRet; 385*9b8096d0SSteve Yin 386*9b8096d0SSteve Yin ::rtl::OUString retText; 387*9b8096d0SSteve Yin if(mpField && nIndex == 0) 388*9b8096d0SSteve Yin { 389*9b8096d0SSteve Yin retText = mpField->GetRepresentation(); 390*9b8096d0SSteve Yin aRet <<= retText; 391*9b8096d0SSteve Yin return aRet; 392*9b8096d0SSteve Yin } 393*9b8096d0SSteve Yin else if(mpImageMap) 394*9b8096d0SSteve Yin { 395*9b8096d0SSteve Yin IMapObject* pMapObj = mpImageMap->GetIMapObject(sal_uInt16(nIndex)); 396*9b8096d0SSteve Yin if(pMapObj && pMapObj->GetURL().Len()) 397*9b8096d0SSteve Yin aRet <<= shapeParent; 398*9b8096d0SSteve Yin return aRet; 399*9b8096d0SSteve Yin } 400*9b8096d0SSteve Yin else if (nIndex == 0) 401*9b8096d0SSteve Yin { 402*9b8096d0SSteve Yin aRet <<= shapeParent; 403*9b8096d0SSteve Yin return aRet; 404*9b8096d0SSteve Yin } 405*9b8096d0SSteve Yin return aRet; 406*9b8096d0SSteve Yin } 407*9b8096d0SSteve Yin 408*9b8096d0SSteve Yin Any SAL_CALL SvxAccessibleHyperlink::getAccessibleActionObject( 409*9b8096d0SSteve Yin sal_Int32 nIndex ) 410*9b8096d0SSteve Yin throw (IndexOutOfBoundsException, RuntimeException) 411*9b8096d0SSteve Yin { 412*9b8096d0SSteve Yin ::rtl::OUString retText = GetHyperlinkURL(nIndex); 413*9b8096d0SSteve Yin Any aRet; 414*9b8096d0SSteve Yin aRet <<= retText; 415*9b8096d0SSteve Yin return aRet; 416*9b8096d0SSteve Yin } 417*9b8096d0SSteve Yin 418*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxAccessibleHyperlink::getStartIndex() 419*9b8096d0SSteve Yin throw (RuntimeException) 420*9b8096d0SSteve Yin { 421*9b8096d0SSteve Yin return nStartIdx; 422*9b8096d0SSteve Yin } 423*9b8096d0SSteve Yin 424*9b8096d0SSteve Yin sal_Int32 SAL_CALL SvxAccessibleHyperlink::getEndIndex() 425*9b8096d0SSteve Yin throw (RuntimeException) 426*9b8096d0SSteve Yin { 427*9b8096d0SSteve Yin return nEndIdx; 428*9b8096d0SSteve Yin } 429*9b8096d0SSteve Yin 430*9b8096d0SSteve Yin sal_Bool SAL_CALL SvxAccessibleHyperlink::isValid( ) 431*9b8096d0SSteve Yin throw (RuntimeException) 432*9b8096d0SSteve Yin { 433*9b8096d0SSteve Yin vos::OGuard aGuard(Application::GetSolarMutex()); 434*9b8096d0SSteve Yin //return mpField ? sal_True: ( mpImageMap ? sal_True : sal_False ); 435*9b8096d0SSteve Yin if (mpField || m_pShape) 436*9b8096d0SSteve Yin return sal_True; 437*9b8096d0SSteve Yin else 438*9b8096d0SSteve Yin return sal_False; 439*9b8096d0SSteve Yin } 440*9b8096d0SSteve Yin 441*9b8096d0SSteve Yin */ 442*9b8096d0SSteve Yin 443*9b8096d0SSteve Yin 444*9b8096d0SSteve Yin 445