diff options
author | sb <sb@openoffice.org> | 2010-04-07 13:14:23 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-04-07 13:14:23 +0200 |
commit | a28edb7950d225af13b0107f529efd2cefaad213 (patch) | |
tree | a48cdb9e86d45dc49015b1dcd7abb8053fcc7ca8 /editeng | |
parent | 9207e47b5eea02b02abcf6450a990992d677c750 (diff) | |
parent | a39db3bbdbfa3867733328b4e36bd45c23d95b1d (diff) |
sb118: merged in re/DEV300_next towards DEV300_m76
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/AccessibleEditableTextPara.hxx | 11 | ||||
-rw-r--r-- | editeng/inc/editeng/unoedprx.hxx | 9 | ||||
-rw-r--r-- | editeng/inc/editeng/unoedsrc.hxx | 5 | ||||
-rw-r--r-- | editeng/inc/editeng/unofored.hxx | 3 | ||||
-rw-r--r-- | editeng/inc/editeng/unoforou.hxx | 2 | ||||
-rw-r--r-- | editeng/inc/editeng/unotext.hxx | 4 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleEditableTextPara.cxx | 98 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleHyperlink.cxx | 146 | ||||
-rw-r--r-- | editeng/source/accessibility/AccessibleHyperlink.hxx | 82 | ||||
-rw-r--r--[-rwxr-xr-x] | editeng/source/accessibility/makefile.mk | 1 | ||||
-rw-r--r-- | editeng/source/uno/unoedprx.cxx | 27 | ||||
-rw-r--r-- | editeng/source/uno/unofored.cxx | 5 | ||||
-rw-r--r-- | editeng/source/uno/unoforou.cxx | 5 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 4 |
14 files changed, 390 insertions, 12 deletions
diff --git a/editeng/inc/editeng/AccessibleEditableTextPara.hxx b/editeng/inc/editeng/AccessibleEditableTextPara.hxx index a2173fbb5d..3bf863862a 100644 --- a/editeng/inc/editeng/AccessibleEditableTextPara.hxx +++ b/editeng/inc/editeng/AccessibleEditableTextPara.hxx @@ -31,7 +31,7 @@ #include <tools/gen.hxx> #include <tools/string.hxx> #include <cppuhelper/weakref.hxx> -#include <cppuhelper/compbase8.hxx> +#include <cppuhelper/compbase9.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/interfacecontainer.hxx> @@ -42,6 +42,7 @@ #include <com/sun/star/accessibility/XAccessibleComponent.hpp> #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/XAccessibleHypertext.hpp> #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> #include <comphelper/accessibletexthelper.hxx> @@ -53,12 +54,13 @@ namespace accessibility { - typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::accessibility::XAccessible, + typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleComponent, ::com::sun::star::accessibility::XAccessibleEditableText, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, ::com::sun::star::accessibility::XAccessibleTextAttributes, + ::com::sun::star::accessibility::XAccessibleHypertext, ::com::sun::star::accessibility::XAccessibleMultiLineText, ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase; @@ -161,6 +163,11 @@ namespace accessibility // XAccessibleTextAttributes virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleHypertext + virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); // XAccessibleMultiLineText virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); diff --git a/editeng/inc/editeng/unoedprx.hxx b/editeng/inc/editeng/unoedprx.hxx index 29fbaf8bba..162a75ee95 100644 --- a/editeng/inc/editeng/unoedprx.hxx +++ b/editeng/inc/editeng/unoedprx.hxx @@ -49,8 +49,11 @@ public: virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; - - virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; + + virtual sal_Int32 CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ); + virtual USHORT CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ); + + virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; virtual void QuickInsertText( const String& rText, const ESelection& rSel ); @@ -61,6 +64,8 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual BOOL IsValid() const; virtual LanguageType GetLanguage( USHORT, USHORT ) const; diff --git a/editeng/inc/editeng/unoedsrc.hxx b/editeng/inc/editeng/unoedsrc.hxx index 7bf2af6872..c7ba241a6b 100644 --- a/editeng/inc/editeng/unoedsrc.hxx +++ b/editeng/inc/editeng/unoedsrc.hxx @@ -152,7 +152,7 @@ class EDITENG_DLLPUBLIC SvxTextForwarder { public: virtual ~SvxTextForwarder(); - + virtual USHORT GetParagraphCount() const = 0; virtual USHORT GetTextLen( USHORT nParagraph ) const = 0; virtual String GetText( const ESelection& rSel ) const = 0; @@ -161,7 +161,7 @@ public: virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ) = 0; virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0; virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const = 0; - + virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const = 0; virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const = 0; @@ -171,6 +171,7 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0; + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) = 0; virtual SfxItemPool* GetPool() const = 0; diff --git a/editeng/inc/editeng/unofored.hxx b/editeng/inc/editeng/unofored.hxx index 59a357c24a..be8d27eb80 100644 --- a/editeng/inc/editeng/unofored.hxx +++ b/editeng/inc/editeng/unofored.hxx @@ -51,7 +51,7 @@ public: virtual void SetParaAttribs( USHORT nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); virtual void GetPortions( USHORT nPara, SvUShorts& rList ) const; - + virtual USHORT GetItemState( const ESelection& rSel, USHORT nWhich ) const; virtual USHORT GetItemState( USHORT nPara, USHORT nWhich ) const; @@ -63,6 +63,7 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); virtual BOOL IsValid() const; virtual LanguageType GetLanguage( USHORT, USHORT ) const; diff --git a/editeng/inc/editeng/unoforou.hxx b/editeng/inc/editeng/unoforou.hxx index 8b441656a2..aa0b9ed90c 100644 --- a/editeng/inc/editeng/unoforou.hxx +++ b/editeng/inc/editeng/unoforou.hxx @@ -81,6 +81,8 @@ public: virtual SfxItemPool* GetPool() const; virtual XubString CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual BOOL IsValid() const; Outliner& GetOutliner() const { return rOutliner; } diff --git a/editeng/inc/editeng/unotext.hxx b/editeng/inc/editeng/unotext.hxx index abe3c5a9d6..965a8d5d65 100644 --- a/editeng/inc/editeng/unotext.hxx +++ b/editeng/inc/editeng/unotext.hxx @@ -195,7 +195,7 @@ public: virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ); virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ); virtual void GetPortions( sal_uInt16 nPara, SvUShorts& rList ) const; - + sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const; sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const; @@ -207,6 +207,8 @@ public: virtual void QuickInsertLineBreak( const ESelection& rSel ); virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ); + virtual void FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ); + virtual sal_Bool IsValid() const; virtual void SetNotifyHdl( const Link& ); diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index 4175896eb4..89917d77a8 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -40,6 +40,7 @@ #include <vos/mutex.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> +#include <editeng/flditem.hxx> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/awt/Point.hpp> @@ -52,11 +53,8 @@ #include <comphelper/accessibleeventnotifier.hxx> #include <comphelper/sequenceashashmap.hxx> #include <unotools/accessiblestatesethelper.hxx> - -// --> OD 2006-01-11 #i27138# #include <unotools/accessiblerelationsethelper.hxx> #include <com/sun/star/accessibility/AccessibleRelationType.hpp> -// <-- #include <vcl/unohelp.hxx> #include <editeng/editeng.hxx> #include <editeng/unoprnms.hxx> @@ -70,9 +68,16 @@ //------------------------------------------------------------------------ #include <com/sun/star/beans/PropertyState.hpp> + +//!!!#include <svx/unoshape.hxx> +//!!!#include <svx/dialmgr.hxx> +//!!!#include "accessibility.hrc" + #include <editeng/unolingu.hxx> #include <editeng/unopracc.hxx> #include "editeng/AccessibleEditableTextPara.hxx" +#include "AccessibleHyperlink.hxx" + #include <svtools/colorcfg.hxx> @@ -525,7 +530,9 @@ namespace accessibility { uno::Reference< XAccessible > xPara = xParentContext->getAccessibleChild( nIndex ); if( xPara.is() ) + { return uno::Reference< XAccessibleText > ( xPara, uno::UNO_QUERY ); + } } } @@ -811,6 +818,11 @@ namespace accessibility uno::Reference< XAccessibleEditableText > aAccEditText = this; aRet <<= aAccEditText; } + else if ( rType == ::getCppuType((uno::Reference< XAccessibleHypertext > *)0) ) + { + uno::Reference< XAccessibleHypertext > aAccHyperText = this; + aRet <<= aAccHyperText; + } else { aRet = AccessibleTextParaInterfaceBase::queryInterface(rType); @@ -1434,7 +1446,7 @@ namespace accessibility ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getText() throw (uno::RuntimeException) { DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); - + ::vos::OGuard aGuard( Application::GetSolarMutex() ); DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, @@ -2062,7 +2074,85 @@ namespace accessibility return aOutSequence; } + + // XAccessibleHypertext + ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException) + { + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + const sal_Int32 nPara = GetParagraphIndex(); + + USHORT nHyperLinks = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + nHyperLinks++; + } + return nHyperLinks; + } + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL AccessibleEditableTextPara::getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > xRef; + + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + const sal_Int32 nPara = GetParagraphIndex(); + + USHORT nHyperLink = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + { + if ( nHyperLink == nLinkIndex ) + { + USHORT nEEStart = aField.aPosition.nIndex; + // Translate EE Index to accessible index + USHORT nStart = rT.CalcEditEngineIndex( nPara, nEEStart ); + USHORT nEnd = nStart + aField.aCurrentText.Len(); + xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText ); + break; + } + nHyperLink++; + } + } + + return xRef; + } + + ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + const sal_Int32 nPara = GetParagraphIndex(); + SvxAccessibleTextAdapter& rT = GetTextForwarder(); + +// SvxAccessibleTextIndex aIndex; +// aIndex.SetIndex(nPara, nCharIndex, rT); +// const USHORT nEEIndex = aIndex.GetEEIndex(); + + const USHORT nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex ); + sal_Int32 nHLIndex = 0; + USHORT nHyperLink = 0; + USHORT nFields = rT.GetFieldCount( nPara ); + for ( USHORT n = 0; n < nFields; n++ ) + { + EFieldInfo aField = rT.GetFieldInfo( nPara, n ); + if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) + { + if ( aField.aPosition.nIndex == nEEIndex ) + { + nHLIndex = nHyperLink; + break; + } + nHyperLink++; + } + } + + return nHLIndex; + } + // XAccessibleMultiLineText sal_Int32 SAL_CALL AccessibleEditableTextPara::getLineNumberAtIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) { diff --git a/editeng/source/accessibility/AccessibleHyperlink.cxx b/editeng/source/accessibility/AccessibleHyperlink.cxx new file mode 100644 index 0000000000..8fa1c93ad4 --- /dev/null +++ b/editeng/source/accessibility/AccessibleHyperlink.cxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleEditableTextPara.cxx,v $ + * $Revision: 1.53 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_editeng.hxx" + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <comphelper/accessiblekeybindinghelper.hxx> + +#include "AccessibleHyperlink.hxx" +#include "editeng/unoedprx.hxx" +#include <editeng/flditem.hxx> +#include <vcl/keycodes.hxx> + +using namespace ::com::sun::star; + + +//------------------------------------------------------------------------ +// +// AccessibleHyperlink implementation +// +//------------------------------------------------------------------------ + +namespace accessibility +{ + + AccessibleHyperlink::AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ) + : rTA( r ) + { + pFld = p; + nPara = nP; + nRealIdx = nR; + nStartIdx = nStt; + nEndIdx = nEnd; + aDescription = rD; + } + + AccessibleHyperlink::~AccessibleHyperlink() + { + delete pFld; + } + + // XAccessibleAction + sal_Int32 SAL_CALL AccessibleHyperlink::getAccessibleActionCount() throw (uno::RuntimeException) + { + return isValid() ? 1 : 0; + } + + sal_Bool SAL_CALL AccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + sal_Bool bRet = sal_False; + if ( isValid() && ( nIndex == 0 ) ) + { + rTA.FieldClicked( *pFld, nPara, nRealIdx ); + bRet = sal_True; + } + return bRet; + } + + ::rtl::OUString SAL_CALL AccessibleHyperlink::getAccessibleActionDescription( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + ::rtl::OUString aDesc; + + if ( isValid() && ( nIndex == 0 ) ) + aDesc = aDescription; + + return aDesc; + } + + uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL AccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > xKeyBinding; + + if( isValid() && ( nIndex == 0 ) ) + { + ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new ::comphelper::OAccessibleKeyBindingHelper(); + xKeyBinding = pKeyBindingHelper; + + awt::KeyStroke aKeyStroke; + aKeyStroke.Modifiers = 0; + aKeyStroke.KeyCode = KEY_RETURN; + aKeyStroke.KeyChar = 0; + aKeyStroke.KeyFunc = 0; + pKeyBindingHelper->AddKeyBinding( aKeyStroke ); + } + + return xKeyBinding; + } + + // XAccessibleHyperlink + uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionAnchor( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + return uno::Any(); + } + + uno::Any SAL_CALL AccessibleHyperlink::getAccessibleActionObject( sal_Int32 /*nIndex*/ ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) + { + return uno::Any(); + } + + sal_Int32 SAL_CALL AccessibleHyperlink::getStartIndex() throw (uno::RuntimeException) + { + return nStartIdx; + } + + sal_Int32 SAL_CALL AccessibleHyperlink::getEndIndex() throw (uno::RuntimeException) + { + return nEndIdx; + } + + sal_Bool SAL_CALL AccessibleHyperlink::isValid( ) throw (uno::RuntimeException) + { + return rTA.IsValid(); + } + +} // end of namespace accessibility + +//------------------------------------------------------------------------ diff --git a/editeng/source/accessibility/AccessibleHyperlink.hxx b/editeng/source/accessibility/AccessibleHyperlink.hxx new file mode 100644 index 0000000000..e0d607f6f3 --- /dev/null +++ b/editeng/source/accessibility/AccessibleHyperlink.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleEditableTextPara.hxx,v $ + * $Revision: 1.22 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SVX_ACCESSIBLE_HYPERLINK_HXX +#define _SVX_ACCESSIBLE_HYPERLINK_HXX + +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/compbase1.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp> + +#include <tools/solar.h> + +class SvxFieldItem; +class SvxAccessibleTextAdapter; + +namespace accessibility +{ + + class AccessibleHyperlink : public ::cppu::WeakImplHelper1< ::com::sun::star::accessibility::XAccessibleHyperlink > + { + private: + + SvxAccessibleTextAdapter& rTA; + SvxFieldItem* pFld; + USHORT nPara, nRealIdx; // EE values + sal_Int32 nStartIdx, nEndIdx; // translated values + ::rtl::OUString aDescription; + + public: + AccessibleHyperlink( SvxAccessibleTextAdapter& r, SvxFieldItem* p, USHORT nP, USHORT nR, sal_Int32 nStt, sal_Int32 nEnd, const ::rtl::OUString& rD ); + ~AccessibleHyperlink(); + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleHyperlink + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getStartIndex() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getEndIndex() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isValid() throw (::com::sun::star::uno::RuntimeException); + }; + +} // end of namespace accessibility + +#endif + diff --git a/editeng/source/accessibility/makefile.mk b/editeng/source/accessibility/makefile.mk index e29b6477f6..80cb6df746 100755..100644 --- a/editeng/source/accessibility/makefile.mk +++ b/editeng/source/accessibility/makefile.mk @@ -50,6 +50,7 @@ SLOFILES = \ $(SLO)$/AccessibleStaticTextBase.obj \ $(SLO)$/AccessibleParaManager.obj \ $(SLO)$/AccessibleEditableTextPara.obj \ + $(SLO)$/AccessibleHyperlink.obj \ $(SLO)$/AccessibleImageBullet.obj # --- Tagets ------------------------------------------------------- diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index f8cf3068d2..1068049d8a 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -687,6 +687,33 @@ XubString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, return mrTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + mrTextForwarder->FieldClicked( rField, nPara, nPos ); +} + +sal_Int32 SvxAccessibleTextAdapter::CalcLogicalIndex( USHORT nPara, USHORT nEEIndex ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + SvxAccessibleTextIndex aIndex; + aIndex.SetEEIndex(nPara, nEEIndex, *mrTextForwarder); + return aIndex.GetIndex(); +} + +USHORT SvxAccessibleTextAdapter::CalcEditEngineIndex( USHORT nPara, sal_Int32 nLogicalIndex ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + SvxAccessibleTextIndex aIndex; + aIndex.SetIndex(nPara, nLogicalIndex, *mrTextForwarder); + return aIndex.GetEEIndex(); +} + + + BOOL SvxAccessibleTextAdapter::IsValid() const { DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index b64855dc87..46c1703655 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -171,6 +171,11 @@ XubString SvxEditEngineForwarder::CalcFieldValue( const SvxFieldItem& rField, US return rEditEngine.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxEditEngineForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + rEditEngine.FieldClicked( rField, nPara, nPos ); +} + USHORT GetSvxEditEngineItemState( EditEngine& rEditEngine, const ESelection& rSel, USHORT nWhich ) { EECharAttribArray aAttribs; diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx index df31b81e7f..215d2ec552 100644 --- a/editeng/source/uno/unoforou.cxx +++ b/editeng/source/uno/unoforou.cxx @@ -241,6 +241,11 @@ XubString SvxOutlinerForwarder::CalcFieldValue( const SvxFieldItem& rField, USHO return rOutliner.CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor ); } +void SvxOutlinerForwarder::FieldClicked( const SvxFieldItem& rField, USHORT nPara, xub_StrLen nPos ) +{ + rOutliner.FieldClicked( rField, nPara, nPos ); +} + BOOL SvxOutlinerForwarder::IsValid() const { // cannot reliably query outliner state diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index f7bb37eac0..9a4a888afa 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -2588,6 +2588,10 @@ XubString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_uInt16, s return XubString(); } +void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, USHORT, xub_StrLen ) +{ +} + sal_Bool SvxDummyTextSource::IsValid() const { return sal_False; |