14c5491eaSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 34c5491eaSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 44c5491eaSAndrew Rist * or more contributor license agreements. See the NOTICE file 54c5491eaSAndrew Rist * distributed with this work for additional information 64c5491eaSAndrew Rist * regarding copyright ownership. The ASF licenses this file 74c5491eaSAndrew Rist * to you under the Apache License, Version 2.0 (the 84c5491eaSAndrew Rist * "License"); you may not use this file except in compliance 94c5491eaSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 114c5491eaSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 134c5491eaSAndrew Rist * Unless required by applicable law or agreed to in writing, 144c5491eaSAndrew Rist * software distributed under the License is distributed on an 154c5491eaSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 164c5491eaSAndrew Rist * KIND, either express or implied. See the License for the 174c5491eaSAndrew Rist * specific language governing permissions and limitations 184c5491eaSAndrew Rist * under the License. 19cdf0e10cSrcweir * 204c5491eaSAndrew Rist *************************************************************/ 214c5491eaSAndrew Rist 224c5491eaSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX 25cdf0e10cSrcweir #define _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/gen.hxx> 28cdf0e10cSrcweir #include <tools/string.hxx> 29cdf0e10cSrcweir #include <cppuhelper/weakref.hxx> 30cdf0e10cSrcweir #include <cppuhelper/compbase9.hxx> 31cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 32cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 35cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 36cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp> 37cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleContext.hpp> 38cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp> 39cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEditableText.hpp> 40cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> 41cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleHypertext.hpp> 42cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> 43cdf0e10cSrcweir 44cdf0e10cSrcweir #include <comphelper/accessibletexthelper.hxx> 45cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx> 46cdf0e10cSrcweir #include "editeng/AccessibleParaManager.hxx" 47cdf0e10cSrcweir #include "editeng/AccessibleImageBullet.hxx" 48cdf0e10cSrcweir #include "editeng/unoedprx.hxx" 49cdf0e10cSrcweir #include "editeng/editengdllapi.h" 50cdf0e10cSrcweir 51cdf0e10cSrcweir namespace accessibility 52cdf0e10cSrcweir { 53cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible, 54cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleContext, 55cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleComponent, 56cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEditableText, 57cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleEventBroadcaster, 58cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleTextAttributes, 59cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleHypertext, 60cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessibleMultiLineText, 61cdf0e10cSrcweir ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase; 62cdf0e10cSrcweir 63cdf0e10cSrcweir /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA 64cdf0e10cSrcweir */ 65cdf0e10cSrcweir class EDITENG_DLLPUBLIC AccessibleEditableTextPara : public ::comphelper::OBaseMutex, public AccessibleTextParaInterfaceBase, public ::comphelper::OCommonAccessibleText 66cdf0e10cSrcweir { 67cdf0e10cSrcweir 68cdf0e10cSrcweir protected: 69cdf0e10cSrcweir // override OCommonAccessibleText methods 70cdf0e10cSrcweir virtual ::rtl::OUString implGetText(); 71cdf0e10cSrcweir virtual ::com::sun::star::lang::Locale implGetLocale(); 72cdf0e10cSrcweir virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); 73cdf0e10cSrcweir virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); 74cdf0e10cSrcweir virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); 75cdf0e10cSrcweir 76cdf0e10cSrcweir public: 77cdf0e10cSrcweir /// Create accessible object for given parent 78cdf0e10cSrcweir // --> OD 2006-01-11 #i27138# 79cdf0e10cSrcweir // - add parameter <_pParaManager> (default value NULL) 80cdf0e10cSrcweir // This has to be the the instance of <AccessibleParaManager>, which 81cdf0e10cSrcweir // created and manages this accessible paragraph. 82cdf0e10cSrcweir AccessibleEditableTextPara ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent, 83cdf0e10cSrcweir const AccessibleParaManager* _pParaManager = NULL ); 84cdf0e10cSrcweir // <-- 85cdf0e10cSrcweir 86cdf0e10cSrcweir virtual ~AccessibleEditableTextPara (); 87cdf0e10cSrcweir 88cdf0e10cSrcweir // XInterface 89cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException); 90cdf0e10cSrcweir 91cdf0e10cSrcweir // XComponent 92cdf0e10cSrcweir 93cdf0e10cSrcweir using WeakComponentImplHelperBase::addEventListener; 94cdf0e10cSrcweir using WeakComponentImplHelperBase::removeEventListener; 95cdf0e10cSrcweir 96cdf0e10cSrcweir // XAccessible 97cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); 98cdf0e10cSrcweir 99cdf0e10cSrcweir // XAccessibleContext 100cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException); 101cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 102cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException); 103cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException); 104cdf0e10cSrcweir virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException); 105cdf0e10cSrcweir /// Maximal length of text returned by getAccessibleDescription() 106cdf0e10cSrcweir enum { MaxDescriptionLen = 40 }; 107cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException); 108cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException); 109cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException); 110cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException); 111cdf0e10cSrcweir virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); 112cdf0e10cSrcweir 113cdf0e10cSrcweir // XAccessibleEventBroadcaster 114cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 115cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 116cdf0e10cSrcweir 117cdf0e10cSrcweir // XAccessibleComponent 118cdf0e10cSrcweir virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 119cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 120cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException); 121cdf0e10cSrcweir virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException); 122cdf0e10cSrcweir virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); 123cdf0e10cSrcweir virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); 124cdf0e10cSrcweir virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); 125cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); 126cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); 127cdf0e10cSrcweir 128cdf0e10cSrcweir // XAccessibleText (this comes implicitely inherited by XAccessibleEditableText AND by XAccessibleMultiLineText) 129cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); 130cdf0e10cSrcweir virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 131cdf0e10cSrcweir virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 132cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 133cdf0e10cSrcweir virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 134cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); 135cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); 136cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); 137cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); 138cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); 139cdf0e10cSrcweir virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 140cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); 141cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 142cdf0e10cSrcweir /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) 143cdf0e10cSrcweir virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 144cdf0e10cSrcweir /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) 145cdf0e10cSrcweir virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 146cdf0e10cSrcweir /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) 147cdf0e10cSrcweir virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 148cdf0e10cSrcweir virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 149cdf0e10cSrcweir 150cdf0e10cSrcweir // XAccessibleEditableText 151cdf0e10cSrcweir virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 152cdf0e10cSrcweir virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 153cdf0e10cSrcweir virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 154cdf0e10cSrcweir virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 155cdf0e10cSrcweir virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 156cdf0e10cSrcweir virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 157cdf0e10cSrcweir virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText ) throw (::com::sun::star::uno::RuntimeException); 158cdf0e10cSrcweir 159cdf0e10cSrcweir // XAccessibleTextAttributes 160cdf0e10cSrcweir 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); 161cdf0e10cSrcweir 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); 162cdf0e10cSrcweir 163cdf0e10cSrcweir // XAccessibleHypertext 164cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException); 165cdf0e10cSrcweir 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); 166cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 167cdf0e10cSrcweir 168cdf0e10cSrcweir // XAccessibleMultiLineText 169cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 170cdf0e10cSrcweir virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 171cdf0e10cSrcweir virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException); 172cdf0e10cSrcweir virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException); 173cdf0e10cSrcweir 174cdf0e10cSrcweir // XServiceInfo 175cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException); 176cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService (const ::rtl::OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException); 177cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException); 178cdf0e10cSrcweir 179cdf0e10cSrcweir // XServiceName 180cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException); 181cdf0e10cSrcweir 182cdf0e10cSrcweir /** Set the current index in the accessibility parent 183cdf0e10cSrcweir 184cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 185cdf0e10cSrcweir leaving that to the calling code. This is because only 186cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 187cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 188cdf0e10cSrcweir */ 189cdf0e10cSrcweir void SetIndexInParent( sal_Int32 nIndex ); 190cdf0e10cSrcweir 191cdf0e10cSrcweir /** Get the current index in the accessibility parent 192cdf0e10cSrcweir 193cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 194cdf0e10cSrcweir leaving that to the calling code. This is because only 195cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 196cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 197cdf0e10cSrcweir */ 198cdf0e10cSrcweir sal_Int32 GetIndexInParent() const; 199cdf0e10cSrcweir 200cdf0e10cSrcweir /** Set the current paragraph number 201cdf0e10cSrcweir 202cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 203cdf0e10cSrcweir leaving that to the calling code. This is because only 204cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 205cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 206cdf0e10cSrcweir */ 207cdf0e10cSrcweir void SetParagraphIndex( sal_Int32 nIndex ); 208cdf0e10cSrcweir 209cdf0e10cSrcweir /** Query the current paragraph number (0 - nParas-1) 210cdf0e10cSrcweir 211cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 212cdf0e10cSrcweir leaving that to the calling code. This is because only 213cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 214cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 215cdf0e10cSrcweir */ 216cdf0e10cSrcweir sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 217cdf0e10cSrcweir 218cdf0e10cSrcweir /** Set the edit engine offset 219cdf0e10cSrcweir 220cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 221cdf0e10cSrcweir leaving that to the calling code. This is because only 222cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 223cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 224cdf0e10cSrcweir */ 225cdf0e10cSrcweir void SetEEOffset( const Point& rOffset ); 226cdf0e10cSrcweir 227cdf0e10cSrcweir /** Set the EditEngine offset 228cdf0e10cSrcweir 229cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 230cdf0e10cSrcweir leaving that to the calling code. This is because only 231cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 232cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 233cdf0e10cSrcweir */ 234cdf0e10cSrcweir void SetEditSource( SvxEditSourceAdapter* pEditSource ); 235cdf0e10cSrcweir 236cdf0e10cSrcweir /** Dispose this object 237cdf0e10cSrcweir 238cdf0e10cSrcweir Notifies and deregisters the listeners, drops all references. 239cdf0e10cSrcweir */ 240cdf0e10cSrcweir void Dispose(); 241cdf0e10cSrcweir 242cdf0e10cSrcweir /// Calls all Listener objects to tell them the change. Don't hold locks when calling this! 243cdf0e10cSrcweir virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const; 244cdf0e10cSrcweir 245cdf0e10cSrcweir /// Queries the given state on the internal state set 246cdf0e10cSrcweir bool HasState( const sal_Int16 nStateId ); 247cdf0e10cSrcweir /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this! 248cdf0e10cSrcweir void SetState( const sal_Int16 nStateId ); 249cdf0e10cSrcweir /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this! 250cdf0e10cSrcweir void UnSetState( const sal_Int16 nStateId ); 251cdf0e10cSrcweir 252cdf0e10cSrcweir static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder ); 253cdf0e10cSrcweir 254cdf0e10cSrcweir SvxEditSourceAdapter& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 255cdf0e10cSrcweir 256cdf0e10cSrcweir /** Query the SvxTextForwarder for EditEngine access. 257cdf0e10cSrcweir 258cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 259cdf0e10cSrcweir leaving that to the calling code. This is because only 260cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 261cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 262cdf0e10cSrcweir */ 263cdf0e10cSrcweir SvxAccessibleTextAdapter& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 264cdf0e10cSrcweir 265cdf0e10cSrcweir /** Query the SvxViewForwarder for EditEngine access. 266cdf0e10cSrcweir 267cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 268cdf0e10cSrcweir leaving that to the calling code. This is because only 269cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 270cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 271cdf0e10cSrcweir */ 272cdf0e10cSrcweir SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 273cdf0e10cSrcweir 274cdf0e10cSrcweir /** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder 275cdf0e10cSrcweir 276cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 277cdf0e10cSrcweir leaving that to the calling code. This is because only 278cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 279cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 280cdf0e10cSrcweir */ 281cdf0e10cSrcweir sal_Bool HaveEditView() const; 282cdf0e10cSrcweir 283cdf0e10cSrcweir /** Query the SvxEditViewForwarder for EditEngine access. 284cdf0e10cSrcweir 285cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 286cdf0e10cSrcweir leaving that to the calling code. This is because only 287cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 288cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 289cdf0e10cSrcweir */ 290cdf0e10cSrcweir SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( sal_Bool bCreate = sal_False ) const SAL_THROW((::com::sun::star::uno::RuntimeException)); 291cdf0e10cSrcweir 292cdf0e10cSrcweir /** Send a TEXT_CHANGED event for this paragraph 293cdf0e10cSrcweir 294cdf0e10cSrcweir This method internally caters for calculating text 295cdf0e10cSrcweir differences, and sends the appropriate Anys in the 296cdf0e10cSrcweir Accessibility::TEXT_CHANGED event 297cdf0e10cSrcweir */ 298cdf0e10cSrcweir void TextChanged(); 299cdf0e10cSrcweir 300cdf0e10cSrcweir private: 301cdf0e10cSrcweir 302cdf0e10cSrcweir // declared, but not defined 303cdf0e10cSrcweir AccessibleEditableTextPara( const AccessibleEditableTextPara& ); 304cdf0e10cSrcweir AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& ); 305cdf0e10cSrcweir 306cdf0e10cSrcweir /** Calculate character range of similar attributes 307cdf0e10cSrcweir 308cdf0e10cSrcweir @param nStartIndex 309cdf0e10cSrcweir Therein, the start of the character range with the same attributes is returned 310cdf0e10cSrcweir 311cdf0e10cSrcweir @param nEndIndex 312cdf0e10cSrcweir Therein, the end (exclusively) of the character range with the same attributes is returned 313cdf0e10cSrcweir 314cdf0e10cSrcweir @param nIndex 315cdf0e10cSrcweir The character index at where to look for similar character attributes 316cdf0e10cSrcweir 317cdf0e10cSrcweir @return sal_False, if the method was not able to determine the range 318cdf0e10cSrcweir */ 319cdf0e10cSrcweir sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex ); 320cdf0e10cSrcweir 321cdf0e10cSrcweir // syntactic sugar for FireEvent 322cdf0e10cSrcweir void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const; 323cdf0e10cSrcweir void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const; 324cdf0e10cSrcweir 325cdf0e10cSrcweir /** Query the visibility state 326cdf0e10cSrcweir 327cdf0e10cSrcweir @attention This method does not lock the SolarMutex, 328cdf0e10cSrcweir leaving that to the calling code. This is because only 329cdf0e10cSrcweir there potential deadlock situations can be resolved. Thus, 330cdf0e10cSrcweir make sure SolarMutex is locked when calling this. 331cdf0e10cSrcweir 332cdf0e10cSrcweir @return the visibility state. Per definition, a defunc object is no longer visible 333cdf0e10cSrcweir */ 334cdf0e10cSrcweir sal_Bool IsVisible() const; 335cdf0e10cSrcweir 336cdf0e10cSrcweir int getNotifierClientId() const; 337cdf0e10cSrcweir 338cdf0e10cSrcweir // retrieve text interface for given paragraph index 339cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleText > GetParaInterface( sal_Int32 nIndex ); 340cdf0e10cSrcweir 341cdf0e10cSrcweir /// Do we have children? This is the case for image bullets 342cdf0e10cSrcweir sal_Bool HaveChildren(); 343cdf0e10cSrcweir 344cdf0e10cSrcweir /// Is the underlying object in edit mode 345cdf0e10cSrcweir sal_Bool IsActive() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 346cdf0e10cSrcweir 347cdf0e10cSrcweir const Point& GetEEOffset() const; 348cdf0e10cSrcweir 349cdf0e10cSrcweir // Get text from forwarder 350cdf0e10cSrcweir String GetText( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 351cdf0e10cSrcweir String GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 352cdf0e10cSrcweir sal_uInt16 GetTextLen() const SAL_THROW((::com::sun::star::uno::RuntimeException)); 353cdf0e10cSrcweir 354cdf0e10cSrcweir /** Get the current selection of this paragraph 355cdf0e10cSrcweir 356cdf0e10cSrcweir @return sal_False, if nothing in this paragraph is selected 357cdf0e10cSrcweir */ 358cdf0e10cSrcweir sal_Bool GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((::com::sun::star::uno::RuntimeException)); 359cdf0e10cSrcweir 360cdf0e10cSrcweir /** create selection from Accessible selection. 361cdf0e10cSrcweir 362cdf0e10cSrcweir */ 363cdf0e10cSrcweir ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex ); 364cdf0e10cSrcweir ESelection MakeSelection( sal_Int32 nEEIndex ); 365cdf0e10cSrcweir ESelection MakeCursor( sal_Int32 nEEIndex ); 366cdf0e10cSrcweir 367cdf0e10cSrcweir // check whether index value is within permitted range 368cdf0e10cSrcweir 369cdf0e10cSrcweir /// Check whether 0<=nIndex<=n-1 370cdf0e10cSrcweir void CheckIndex( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); 371cdf0e10cSrcweir /// Check whether 0<=nIndex<=n 372cdf0e10cSrcweir void CheckPosition( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); 373cdf0e10cSrcweir /// Check whether 0<=nStart<=n and 0<=nEnd<=n 374cdf0e10cSrcweir void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)); 375cdf0e10cSrcweir 376*9b8096d0SSteve Yin void _correctValues( const sal_Int32 nIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues ); 377*9b8096d0SSteve Yin sal_Int32 SkipField(sal_Int32 nIndex, sal_Bool bForward); 378*9b8096d0SSteve Yin // get overlapped field, extend return string. Only extend forward for now 379*9b8096d0SSteve Yin sal_Bool ExtendByField( ::com::sun::star::accessibility::TextSegment& Segment ); 380*9b8096d0SSteve Yin String GetFieldTypeNameAtIndex(sal_Int32 nIndex); 381cdf0e10cSrcweir // the paragraph index in the edit engine (guarded by solar mutex) 382cdf0e10cSrcweir sal_Int32 mnParagraphIndex; 383cdf0e10cSrcweir 384cdf0e10cSrcweir // our current index in the parent (guarded by solar mutex) 385cdf0e10cSrcweir sal_Int32 mnIndexInParent; 386cdf0e10cSrcweir 387cdf0e10cSrcweir // the current edit source (guarded by solar mutex) 388cdf0e10cSrcweir SvxEditSourceAdapter* mpEditSource; 389cdf0e10cSrcweir 390cdf0e10cSrcweir // the possible child (for image bullets, guarded by solar mutex) 391cdf0e10cSrcweir typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleImageBullet > WeakBullet; 392cdf0e10cSrcweir WeakBullet maImageBullet; 393cdf0e10cSrcweir 394cdf0e10cSrcweir // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex) 395cdf0e10cSrcweir ::rtl::OUString maLastTextString; 396cdf0e10cSrcweir 397cdf0e10cSrcweir // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex) 398cdf0e10cSrcweir Point maEEOffset; 399cdf0e10cSrcweir 400cdf0e10cSrcweir // the current state set (updated from SetState/UnSetState and guarded by solar mutex) 401cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet; 402cdf0e10cSrcweir 403cdf0e10cSrcweir /// The shape we're the accessible for (unguarded) 404cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent; 405cdf0e10cSrcweir 406cdf0e10cSrcweir /// Our listeners (guarded by maMutex) 407cdf0e10cSrcweir int mnNotifierClientId; 408*9b8096d0SSteve Yin public: SetParagraphBackColorAccessible(const::com::sun::star::uno::Reference<::com::sun::star::accessibility::XAccessible> & ref)409*9b8096d0SSteve Yin void SetParagraphBackColorAccessible(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > & ref) 410*9b8096d0SSteve Yin { m_xAccInfo = ref ;} 411*9b8096d0SSteve Yin private: 412*9b8096d0SSteve Yin ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAccInfo; 413*9b8096d0SSteve Yin //virtual sal_Bool IsShapeParaFocusable( ); 414cdf0e10cSrcweir 415cdf0e10cSrcweir // --> OD 2006-01-11 #i27138# 416cdf0e10cSrcweir // the paragraph manager, which created this instance - is NULL, if 417cdf0e10cSrcweir // instance isn't created by AccessibleParaManager. 418cdf0e10cSrcweir // Needed for method <getAccessibleRelationSet()> to retrieve predecessor 419cdf0e10cSrcweir // paragraph and the successor paragraph. 420cdf0e10cSrcweir const AccessibleParaManager* mpParaManager; 421cdf0e10cSrcweir }; 422cdf0e10cSrcweir 423cdf0e10cSrcweir } // end of namespace accessibility 424cdf0e10cSrcweir 425cdf0e10cSrcweir #endif 426cdf0e10cSrcweir 427