LibreOffice Module editeng (master) 1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
accessibility::AccessibleStaticTextBase Class Reference

Helper class for objects containing EditEngine/Outliner text. More...

#include <AccessibleStaticTextBase.hxx>

Inheritance diagram for accessibility::AccessibleStaticTextBase:
[legend]
Collaboration diagram for accessibility::AccessibleStaticTextBase:
[legend]

Public Member Functions

 AccessibleStaticTextBase (::std::unique_ptr< SvxEditSource > &&pEditSource)
 Create accessible text object for given edit source. More...
 
virtual ~AccessibleStaticTextBase ()
 
void SetEditSource (::std::unique_ptr< SvxEditSource > &&pEditSource)
 Set the current edit source. More...
 
void SetEventSource (const css::uno::Reference< css::accessibility::XAccessible > &rInterface)
 Set the event source. More...
 
void SetOffset (const Point &rPoint)
 Set offset of EditEngine from parent. More...
 
void Dispose ()
 Drop all references and enter disposed state. More...
 
virtual sal_Int32 SAL_CALL getCaretPosition () override
 
virtual sal_Bool SAL_CALL setCaretPosition (sal_Int32 nIndex) override
 
virtual sal_Unicode SAL_CALL getCharacter (sal_Int32 nIndex) override
 
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes (sal_Int32 nIndex, const css::uno::Sequence< OUString > &aRequestedAttributes) override
 
virtual css::awt::Rectangle SAL_CALL getCharacterBounds (sal_Int32 nIndex) override
 
virtual sal_Int32 SAL_CALL getCharacterCount () override
 
virtual sal_Int32 SAL_CALL getIndexAtPoint (const css::awt::Point &aPoint) override
 
virtual OUString SAL_CALL getSelectedText () override
 
virtual sal_Int32 SAL_CALL getSelectionStart () override
 
virtual sal_Int32 SAL_CALL getSelectionEnd () override
 
virtual sal_Bool SAL_CALL setSelection (sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
 This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode. More...
 
virtual OUString SAL_CALL getText () override
 
virtual OUString SAL_CALL getTextRange (sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
 
virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex (sal_Int32 nIndex, sal_Int16 aTextType) override
 Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) More...
 
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex (sal_Int32 nIndex, sal_Int16 aTextType) override
 Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) More...
 
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex (sal_Int32 nIndex, sal_Int16 aTextType) override
 Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine) More...
 
virtual sal_Bool SAL_CALL copyText (sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
 This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode. More...
 
virtual sal_Bool SAL_CALL scrollSubstringTo (sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override
 
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getDefaultAttributes (const css::uno::Sequence< OUString > &RequestedAttributes) override
 
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getRunAttributes (sal_Int32 Index, const css::uno::Sequence< OUString > &RequestedAttributes) override
 
virtual sal_Int64 SAL_CALL getAccessibleChildCount ()
 
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild (sal_Int64 i)
 
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint (const css::awt::Point &aPoint)
 
- Public Member Functions inherited from cppu::ImplHelper2< class Ifc1, class Ifc2 >
virtual css::uno::Any SAL_CALL queryInterface (css::uno::Type const &rType) SAL_OVERRIDE
 
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes () SAL_OVERRIDE
 
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId () SAL_OVERRIDE
 

Protected Member Functions

tools::Rectangle GetParagraphBoundingBox () const
 
- Protected Member Functions inherited from cppu::ImplHelper2< class Ifc1, class Ifc2 >
 ~ImplHelper2 () SAL_NOEXCEPT
 

Private Member Functions

 AccessibleStaticTextBase (const AccessibleStaticTextBase &)=delete
 
AccessibleStaticTextBaseoperator= (const AccessibleStaticTextBase &)=delete
 

Private Attributes

const std::unique_ptr< AccessibleStaticTextBase_ImplmpImpl
 @dyn More...
 

Detailed Description

Helper class for objects containing EditEngine/Outliner text.

This class implements the XAccessibleText interface for static text, somewhat similar to the children of the AccessibleTextHelper class. Currently, there are no children, i.e. the whole text is presented in one big chunk. This might change in the future, if a need for image bullets should arise. These, by convention, would be represented as children of the text.

You have to implement the SvxEditSource, SvxTextForwarder, SvxViewForwarder and SvxEditViewForwarder interfaces in order to enable your object to cooperate with this class. SvxTextForwarder encapsulates the fact that text objects do not necessarily have an EditEngine at their disposal, SvxViewForwarder and SvxEditViewForwarder do the same for the document and the edit view. The three mentioned forwarder objects are not stored by the AccessibleTextHelper, but fetched every time from the SvxEditSource. So you are best off making your SvxEditSource::Get*Forwarder methods cache the current forwarder.

As this class is intended for static (i.e. non-changing) text only, no event broadcasting is necessary. You must handle visibility by yourself, the bounding boxes returned by getCharacterBounds() are relative to your accessibility object.

Attention: \n All public non-UNO methods (those are the uppercase
ones) must not be called with any mutex hold, except when calling from the main thread (with holds the solar mutex), unless stated otherwise. This is because they themselves might need the solar mutex in addition to the object mutex, and the ordering of the locking must be: first solar mutex, then object mutex. Furthermore, state change events might be fired internally.
Derive: \n Use this class as a base for objects containing static
edit engine text. To avoid overwriting every interface method to intercept derived object defunc state, just set NULL as the edit source. Every interface method will then properly throw an exception.

Definition at line 89 of file AccessibleStaticTextBase.hxx.

Constructor & Destructor Documentation

◆ AccessibleStaticTextBase() [1/2]

accessibility::AccessibleStaticTextBase::AccessibleStaticTextBase ( ::std::unique_ptr< SvxEditSource > &&  pEditSource)
explicit

Create accessible text object for given edit source.

Parameters
pEditSourceThe edit source to use. Object ownership is transferred from the caller to the callee. The object listens on the SvxEditSource for object disposal, so no provisions have to be taken if the caller destroys the data (e.g. the model) contained in the given SvxEditSource.

◆ ~AccessibleStaticTextBase()

accessibility::AccessibleStaticTextBase::~AccessibleStaticTextBase ( )
virtual

Definition at line 435 of file AccessibleStaticTextBase.cxx.

◆ AccessibleStaticTextBase() [2/2]

accessibility::AccessibleStaticTextBase::AccessibleStaticTextBase ( const AccessibleStaticTextBase )
privatedelete

Member Function Documentation

◆ copyText()

sal_Bool SAL_CALL accessibility::AccessibleStaticTextBase::copyText ( sal_Int32  nStartIndex,
sal_Int32  nEndIndex 
)
overridevirtual

This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode.

Definition at line 869 of file AccessibleStaticTextBase.cxx.

References mpImpl, EPosition::nIndex, and EPosition::nPara.

◆ Dispose()

void accessibility::AccessibleStaticTextBase::Dispose ( )

Drop all references and enter disposed state.

This method drops all references to external objects (also the event source reference set via SetEventSource()) and sets the object into the disposed state (i.e. the methods return default values or throw a uno::DisposedException exception).

Definition at line 461 of file AccessibleStaticTextBase.cxx.

References mpImpl.

◆ getAccessibleAtPoint()

uno::Reference< XAccessible > accessibility::AccessibleStaticTextBase::getAccessibleAtPoint ( const css::awt::Point &  aPoint)
virtual
Exceptions
css::uno::RuntimeException

Definition at line 480 of file AccessibleStaticTextBase.cxx.

◆ getAccessibleChild()

uno::Reference< XAccessible > accessibility::AccessibleStaticTextBase::getAccessibleChild ( sal_Int64  i)
virtual
Exceptions
css::lang::IndexOutOfBoundsException
css::uno::RuntimeException

Definition at line 474 of file AccessibleStaticTextBase.cxx.

◆ getAccessibleChildCount()

sal_Int64 accessibility::AccessibleStaticTextBase::getAccessibleChildCount ( )
virtual
Exceptions
css::uno::RuntimeException

Definition at line 468 of file AccessibleStaticTextBase.cxx.

◆ getCaretPosition()

sal_Int32 SAL_CALL accessibility::AccessibleStaticTextBase::getCaretPosition ( )
overridevirtual

Definition at line 487 of file AccessibleStaticTextBase.cxx.

References i, mpImpl, and nPos.

◆ getCharacter()

sal_Unicode SAL_CALL accessibility::AccessibleStaticTextBase::getCharacter ( sal_Int32  nIndex)
overridevirtual

Definition at line 506 of file AccessibleStaticTextBase.cxx.

References mpImpl, nIndex, EPosition::nIndex, and EPosition::nPara.

◆ getCharacterAttributes()

uno::Sequence< beans::PropertyValue > SAL_CALL accessibility::AccessibleStaticTextBase::getCharacterAttributes ( sal_Int32  nIndex,
const css::uno::Sequence< OUString > &  aRequestedAttributes 
)
overridevirtual

Definition at line 515 of file AccessibleStaticTextBase.cxx.

References mpImpl, nIndex, EPosition::nIndex, and EPosition::nPara.

◆ getCharacterBounds()

awt::Rectangle SAL_CALL accessibility::AccessibleStaticTextBase::getCharacterBounds ( sal_Int32  nIndex)
overridevirtual

Definition at line 527 of file AccessibleStaticTextBase.cxx.

References mpImpl, nIndex, EPosition::nIndex, and EPosition::nPara.

◆ getCharacterCount()

sal_Int32 SAL_CALL accessibility::AccessibleStaticTextBase::getCharacterCount ( )
overridevirtual

Definition at line 545 of file AccessibleStaticTextBase.cxx.

References i, mpImpl, and nCount.

◆ getDefaultAttributes()

uno::Sequence< beans::PropertyValue > accessibility::AccessibleStaticTextBase::getDefaultAttributes ( const css::uno::Sequence< OUString > &  RequestedAttributes)
overridevirtual

Definition at line 889 of file AccessibleStaticTextBase.cxx.

References aSeq, comphelper::containerToSequence(), and mpImpl.

Referenced by getRunAttributes().

◆ getIndexAtPoint()

sal_Int32 SAL_CALL accessibility::AccessibleStaticTextBase::getIndexAtPoint ( const css::awt::Point &  aPoint)
overridevirtual

Definition at line 557 of file AccessibleStaticTextBase.cxx.

References i, mpImpl, and nIndex.

◆ GetParagraphBoundingBox()

tools::Rectangle accessibility::AccessibleStaticTextBase::GetParagraphBoundingBox ( ) const
protected

Definition at line 956 of file AccessibleStaticTextBase.cxx.

References mpImpl.

◆ getRunAttributes()

uno::Sequence< beans::PropertyValue > SAL_CALL accessibility::AccessibleStaticTextBase::getRunAttributes ( sal_Int32  Index,
const css::uno::Sequence< OUString > &  RequestedAttributes 
)
overridevirtual

◆ getSelectedText()

OUString SAL_CALL accessibility::AccessibleStaticTextBase::getSelectedText ( )
overridevirtual

◆ getSelectionEnd()

sal_Int32 SAL_CALL accessibility::AccessibleStaticTextBase::getSelectionEnd ( )
overridevirtual

Definition at line 612 of file AccessibleStaticTextBase.cxx.

References i, mpImpl, and nPos.

Referenced by getSelectedText().

◆ getSelectionStart()

sal_Int32 SAL_CALL accessibility::AccessibleStaticTextBase::getSelectionStart ( )
overridevirtual

Definition at line 598 of file AccessibleStaticTextBase.cxx.

References i, mpImpl, and nPos.

Referenced by getSelectedText().

◆ getText()

OUString SAL_CALL accessibility::AccessibleStaticTextBase::getText ( )
overridevirtual

Definition at line 637 of file AccessibleStaticTextBase.cxx.

References i, and mpImpl.

◆ getTextAtIndex()

css::accessibility::TextSegment SAL_CALL accessibility::AccessibleStaticTextBase::getTextAtIndex ( sal_Int32  nIndex,
sal_Int16  aTextType 
)
overridevirtual

Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)

Definition at line 731 of file AccessibleStaticTextBase.cxx.

References accessibility::cNewLine(), SvxAccessibleTextAdapter::GetAttributeRun(), getTextRange(), mpImpl, nIndex, EPosition::nIndex, and EPosition::nPara.

Referenced by getTextBeforeIndex().

◆ getTextBeforeIndex()

css::accessibility::TextSegment SAL_CALL accessibility::AccessibleStaticTextBase::getTextBeforeIndex ( sal_Int32  nIndex,
sal_Int16  aTextType 
)
overridevirtual

Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)

Definition at line 782 of file AccessibleStaticTextBase.cxx.

References getTextAtIndex(), mpImpl, nIndex, EPosition::nIndex, and EPosition::nPara.

◆ getTextBehindIndex()

css::accessibility::TextSegment SAL_CALL accessibility::AccessibleStaticTextBase::getTextBehindIndex ( sal_Int32  nIndex,
sal_Int16  aTextType 
)
overridevirtual

Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)

Definition at line 828 of file AccessibleStaticTextBase.cxx.

References accessibility::cNewLine(), mpImpl, nIndex, EPosition::nIndex, and EPosition::nPara.

◆ getTextRange()

OUString SAL_CALL accessibility::AccessibleStaticTextBase::getTextRange ( sal_Int32  nStartIndex,
sal_Int32  nEndIndex 
)
overridevirtual

◆ operator=()

AccessibleStaticTextBase & accessibility::AccessibleStaticTextBase::operator= ( const AccessibleStaticTextBase )
privatedelete

References Dispose().

◆ scrollSubstringTo()

sal_Bool SAL_CALL accessibility::AccessibleStaticTextBase::scrollSubstringTo ( sal_Int32  nStartIndex,
sal_Int32  nEndIndex,
css::accessibility::AccessibleScrollType  aScrollType 
)
overridevirtual

Definition at line 883 of file AccessibleStaticTextBase.cxx.

◆ setCaretPosition()

sal_Bool SAL_CALL accessibility::AccessibleStaticTextBase::setCaretPosition ( sal_Int32  nIndex)
overridevirtual

Definition at line 501 of file AccessibleStaticTextBase.cxx.

References nIndex, and setSelection().

◆ SetEditSource()

void accessibility::AccessibleStaticTextBase::SetEditSource ( ::std::unique_ptr< SvxEditSource > &&  pEditSource)

Set the current edit source.

Attention: \n You are required to have the solar mutex
locked, when calling this method. Thus, the method should only be called from the main office thread.

The EditSource set here is required to broadcast out the following hints: SfxHintId::EditSourceParasMoved, SfxHintId::EditSourceSelectionChanged, SfxHintId::TextModified, SfxHintId::TextParaInserted, SfxHintId::TextParaRemoved, SfxHintId::TextHeightChanged, SfxHintId::TextViewScrolled. Otherwise, not all state changes will get noticed by the accessibility object. Further more, when the corresponding core object or the model is dying, either the edit source must be set to NULL or it has to broadcast a SfxHintId::Dying hint.

This class does not have a dispose method, since it is not a UNO component. Nevertheless, it holds C++ references to several core objects, so you should issue a SetEditSource(::std::unique_ptr<SvxEditSource>()) in your dispose() method.

Parameters
pEditSourceThe new edit source to set. Object ownership is transferred from the caller to the callee.

Definition at line 439 of file AccessibleStaticTextBase.cxx.

References DBG_TESTSOLARMUTEX, and mpImpl.

◆ SetEventSource()

void accessibility::AccessibleStaticTextBase::SetEventSource ( const css::uno::Reference< css::accessibility::XAccessible > &  rInterface)

Set the event source.

Attention: \n When setting a reference here, you should call
Dispose() when you as the owner are disposing, since until then this object will hold that reference
Parameters
rInterfaceThe interface that should be set as the source for accessibility events sent by this object.

Definition at line 447 of file AccessibleStaticTextBase.cxx.

References mpImpl.

◆ SetOffset()

void accessibility::AccessibleStaticTextBase::SetOffset ( const Point rPoint)

Set offset of EditEngine from parent.

Attention: \n You are required to have the solar mutex
locked, when calling this method. Thus, the method should only be called from the main office thread.

If the origin of the underlying EditEngine does not correspond to the upper left corner of the object using this class, you have to specify the offset.

Parameters
rPointThe offset in screen coordinates (i.e. pixel)

Definition at line 453 of file AccessibleStaticTextBase.cxx.

References DBG_TESTSOLARMUTEX, and mpImpl.

◆ setSelection()

sal_Bool SAL_CALL accessibility::AccessibleStaticTextBase::setSelection ( sal_Int32  nStartIndex,
sal_Int32  nEndIndex 
)
overridevirtual

This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode.

Definition at line 626 of file AccessibleStaticTextBase.cxx.

References mpImpl, EPosition::nIndex, and EPosition::nPara.

Referenced by setCaretPosition().

Member Data Documentation

◆ mpImpl

const std::unique_ptr< AccessibleStaticTextBase_Impl > accessibility::AccessibleStaticTextBase::mpImpl
private

The documentation for this class was generated from the following files: