Kaydet (Commit) 8d4a44d1 authored tarafından Arnaud Versini's avatar Arnaud Versini Kaydeden (comit) Noel Grandin

Remove OCommonAccessibleText::getText and getCharacterCount.

No need to create helper for those methods.

Change-Id: I0505fe8141b1bad852b7f30aeb69628fb6a90071
Reviewed-on: https://gerrit.libreoffice.org/44649Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 102acb36
......@@ -39,7 +39,7 @@ namespace accessibility
protected:
// OCommonAccessibleText
virtual OUString implGetText() override;
virtual OUString implGetText() final override;
virtual css::lang::Locale implGetLocale() override;
virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override;
......@@ -112,7 +112,7 @@ namespace accessibility
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;
virtual OUString SAL_CALL getText() override;
virtual OUString SAL_CALL getText() final 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;
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
......
......@@ -51,7 +51,7 @@ protected:
virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override;
// OCommonAccessibleText
virtual OUString implGetText() override;
virtual OUString implGetText() final override;
virtual css::lang::Locale implGetLocale() override;
virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override;
......@@ -75,16 +75,16 @@ public:
// XAccessibleText
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 sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) final 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 getCharacterCount() final 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;
virtual OUString SAL_CALL getText() override;
virtual OUString SAL_CALL getText() final 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;
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
......
......@@ -124,6 +124,9 @@ public:
virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override;
virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual OUString SAL_CALL getText() override;
virtual sal_Int32 SAL_CALL getCharacterCount() override;
};
#endif // INCLUDED_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
......
......@@ -122,6 +122,8 @@ public:
virtual OUString SAL_CALL getToolTipText( ) override;
// XAccessibleText
virtual OUString SAL_CALL getText() override;
virtual sal_Int32 SAL_CALL getCharacterCount() override;
virtual sal_Int32 SAL_CALL getCaretPosition() override;
virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override;
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
......@@ -129,6 +131,7 @@ public:
virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override;
virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
};
#endif // INCLUDED_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLETABPAGE_HXX
......
......@@ -114,6 +114,8 @@ public:
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
// XAccessibleText
virtual OUString SAL_CALL getText() override;
virtual sal_Int32 SAL_CALL getCharacterCount() override;
virtual sal_Int32 SAL_CALL getCaretPosition() override;
virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override;
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
......
......@@ -246,7 +246,7 @@ namespace accessibility
{
SolarMethodGuard aGuard(getMutex());
return OCommonAccessibleText::getCharacterCount( );
return implGetText().getLength();
}
OUString SAL_CALL AccessibleBrowseBoxTableCell::getSelectedText( )
......
......@@ -253,7 +253,7 @@ namespace accessibility
{
SolarMutexGuard aSolarGuard;
return OCommonAccessibleText::getCharacterCount( );
return implGetText().getLength();
}
OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText( )
......
......@@ -422,7 +422,7 @@ namespace accessibility
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
if ( ( 0 > _nIndex ) || ( getCharacterCount() <= _nIndex ) )
if ( ( 0 > _nIndex ) || ( implGetText().getLength() <= _nIndex ) )
throw IndexOutOfBoundsException();
awt::Rectangle aBounds( 0, 0, 0, 0 );
......@@ -470,8 +470,9 @@ namespace accessibility
{
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
EnsureIsAlive();
OUString sText = getText();
OUString sText = implGetText();
if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex )
|| ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) )
throw IndexOutOfBoundsException();
......@@ -555,7 +556,7 @@ namespace accessibility
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
EnsureIsAlive();
return OCommonAccessibleText::getCharacterCount( );
return implGetText().getLength();;
}
OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectedText( )
......
......@@ -686,7 +686,7 @@ namespace accessibility
::osl::MutexGuard aGuard( m_aMutex );
EnsureIsAlive();
OUString sText = getText();
OUString sText = implGetText();
if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex )
|| ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) )
throw IndexOutOfBoundsException();
......@@ -1019,7 +1019,7 @@ namespace accessibility
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
EnsureIsAlive();
return OCommonAccessibleText::getCharacterCount( );
return implGetText().getLength();
}
OUString SAL_CALL AccessibleListBoxEntry::getSelectedText( )
......
......@@ -328,7 +328,7 @@ Paragraph::getCharacterBounds(::sal_Int32 nIndex)
::sal_Int32 SAL_CALL Paragraph::getCharacterCount()
{
checkDisposed();
return OCommonAccessibleText::getCharacterCount();
return implGetText().getLength();;
}
// virtual
......@@ -637,8 +637,7 @@ void Paragraph::implGetSelection(::sal_Int32 & rStartIndex,
void Paragraph::implGetParagraphBoundary( css::i18n::Boundary& rBoundary,
::sal_Int32 nIndex )
{
OUString sText( implGetText() );
::sal_Int32 nLength = sText.getLength();
::sal_Int32 nLength = implGetText().getLength();
if ( implIsValidIndex( nIndex, nLength ) )
{
......@@ -656,8 +655,7 @@ void Paragraph::implGetParagraphBoundary( css::i18n::Boundary& rBoundary,
void Paragraph::implGetLineBoundary( css::i18n::Boundary& rBoundary,
::sal_Int32 nIndex )
{
OUString sText( implGetText() );
::sal_Int32 nLength = sText.getLength();
::sal_Int32 nLength = implGetText().getLength();
if ( implIsValidIndex( nIndex, nLength ) || nIndex == nLength )
{
......
......@@ -242,7 +242,7 @@ OUString SAL_CALL VCLXAccessibleListItem::getAccessibleName( )
::osl::MutexGuard aGuard( m_aMutex );
// entry text == accessible name
return implGetText();
return m_sEntryText;
}
Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleListItem::getAccessibleRelationSet( )
......@@ -390,7 +390,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::setCaretPosition( sal_Int32 nIndex )
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
if ( !implIsValidRange( nIndex, nIndex, m_sEntryText.getLength() ) )
throw IndexOutOfBoundsException();
return false;
......@@ -409,8 +409,7 @@ Sequence< PropertyValue > SAL_CALL VCLXAccessibleListItem::getCharacterAttribute
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
OUString sText( implGetText() );
if ( !implIsValidIndex( nIndex, sText.getLength() ) )
if ( !implIsValidIndex( nIndex, m_sEntryText.getLength() ) )
throw IndexOutOfBoundsException();
return Sequence< PropertyValue >();
......@@ -421,8 +420,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nI
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
OUString sText( implGetText() );
if ( !implIsValidIndex( nIndex, sText.getLength() ) )
if ( !implIsValidIndex( nIndex, m_sEntryText.getLength() ) )
throw IndexOutOfBoundsException();
awt::Rectangle aBounds( 0, 0, 0, 0 );
......@@ -443,7 +441,7 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getCharacterCount()
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
return OCommonAccessibleText::getCharacterCount();
return m_sEntryText.getLength();
}
sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aPoint )
......@@ -495,7 +493,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::setSelection( sal_Int32 nStartIndex, s
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
if ( !implIsValidRange( nStartIndex, nEndIndex, m_sEntryText.getLength() ) )
throw IndexOutOfBoundsException();
return false;
......@@ -506,7 +504,7 @@ OUString SAL_CALL VCLXAccessibleListItem::getText()
SolarMutexGuard aSolarGuard;
::osl::MutexGuard aGuard( m_aMutex );
return implGetText();
return m_sEntryText;
}
OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
......
......@@ -203,7 +203,7 @@ sal_Bool VCLXAccessibleMenuItem::setCaretPosition( sal_Int32 nIndex )
OExternalLockGuard aGuard( this );
if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
if ( !implIsValidRange( nIndex, nIndex, m_sItemText.getLength() ) )
throw IndexOutOfBoundsException();
return false;
......@@ -222,9 +222,7 @@ Sequence< PropertyValue > VCLXAccessibleMenuItem::getCharacterAttributes( sal_In
{
OExternalLockGuard aGuard( this );
OUString sText( implGetText() );
if ( !implIsValidIndex( nIndex, sText.getLength() ) )
if ( !implIsValidIndex( nIndex, m_sItemText.getLength() ) )
throw IndexOutOfBoundsException();
vcl::Font aFont = Application::GetSettings().GetStyleSettings().GetMenuFont();
......@@ -239,7 +237,7 @@ awt::Rectangle VCLXAccessibleMenuItem::getCharacterBounds( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
if ( !implIsValidIndex( nIndex, m_sItemText.getLength() ) )
throw IndexOutOfBoundsException();
awt::Rectangle aBounds( 0, 0, 0, 0 );
......@@ -260,7 +258,7 @@ sal_Int32 VCLXAccessibleMenuItem::getCharacterCount()
{
OExternalLockGuard aGuard( this );
return OCommonAccessibleText::getCharacterCount();
return m_sItemText.getLength();
}
......@@ -312,7 +310,7 @@ sal_Bool VCLXAccessibleMenuItem::setSelection( sal_Int32 nStartIndex, sal_Int32
{
OExternalLockGuard aGuard( this );
if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
if ( !implIsValidRange( nStartIndex, nEndIndex, m_sItemText.getLength() ) )
throw IndexOutOfBoundsException();
return false;
......@@ -323,7 +321,7 @@ OUString VCLXAccessibleMenuItem::getText()
{
OExternalLockGuard aGuard( this );
return implGetText();
return m_sItemText;
}
......
......@@ -439,6 +439,19 @@ OUString VCLXAccessibleStatusBarItem::getToolTipText( )
// XAccessibleText
OUString VCLXAccessibleStatusBarItem::getText()
{
OExternalLockGuard aGuard( this );
return GetItemText();
}
sal_Int32 VCLXAccessibleStatusBarItem::getCharacterCount()
{
OExternalLockGuard aGuard( this );
return GetItemText().getLength();
}
sal_Int32 VCLXAccessibleStatusBarItem::getCaretPosition()
{
......@@ -452,7 +465,7 @@ sal_Bool VCLXAccessibleStatusBarItem::setCaretPosition( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
if ( !implIsValidRange( nIndex, nIndex, GetItemText().getLength() ) )
throw IndexOutOfBoundsException();
return false;
......
......@@ -517,6 +517,17 @@ OUString VCLXAccessibleTabPage::getToolTipText( )
// XAccessibleText
OUString VCLXAccessibleTabPage::getText()
{
OExternalLockGuard aGuard( this );
return GetPageText();
}
sal_Int32 VCLXAccessibleTabPage::getCharacterCount()
{
return GetPageText().getLength();
}
sal_Int32 VCLXAccessibleTabPage::getCaretPosition()
{
......@@ -530,7 +541,7 @@ sal_Bool VCLXAccessibleTabPage::setCaretPosition( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
if ( !implIsValidRange( nIndex, nIndex, GetPageText().getLength() ) )
throw IndexOutOfBoundsException();
return false;
......@@ -542,7 +553,7 @@ Sequence< PropertyValue > VCLXAccessibleTabPage::getCharacterAttributes( sal_Int
OExternalLockGuard aGuard( this );
Sequence< PropertyValue > aValues;
OUString sText( implGetText() );
OUString sText( GetPageText() );
if ( !implIsValidIndex( nIndex, sText.getLength() ) )
throw IndexOutOfBoundsException();
......@@ -564,7 +575,7 @@ awt::Rectangle VCLXAccessibleTabPage::getCharacterBounds( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
if ( !implIsValidIndex( nIndex, GetPageText().getLength() ) )
throw IndexOutOfBoundsException();
awt::Rectangle aBounds( 0, 0, 0, 0 );
......@@ -604,7 +615,7 @@ sal_Bool VCLXAccessibleTabPage::setSelection( sal_Int32 nStartIndex, sal_Int32 n
{
OExternalLockGuard aGuard( this );
if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
if ( !implIsValidRange( nStartIndex, nEndIndex, GetPageText().getLength() ) )
throw IndexOutOfBoundsException();
return false;
......
......@@ -255,7 +255,7 @@ sal_Int32 VCLXAccessibleTextComponent::getCharacterCount()
{
OExternalLockGuard aGuard( this );
return OCommonAccessibleText::getCharacterCount();
return implGetText().getLength();;
}
......
......@@ -421,6 +421,19 @@ Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessib
// XAccessibleText
OUString VCLXAccessibleToolBoxItem::getText()
{
OExternalLockGuard aGuard( this );
return GetText();
}
sal_Int32 VCLXAccessibleToolBoxItem::getCharacterCount()
{
return GetText().getLength();
}
sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getCaretPosition()
{
return -1;
......@@ -430,7 +443,7 @@ sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setCaretPosition( sal_Int32 nIndex
{
OExternalLockGuard aGuard( this );
if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
if ( !implIsValidRange( nIndex, nIndex, GetText().getLength() ) )
throw IndexOutOfBoundsException();
return false;
......
......@@ -234,12 +234,6 @@ namespace comphelper
}
sal_Int32 OCommonAccessibleText::getCharacterCount()
{
return implGetText().getLength();
}
OUString OCommonAccessibleText::getSelectedText()
{
OUString sText;
......@@ -774,14 +768,6 @@ namespace comphelper
}
sal_Int32 OAccessibleTextHelper::getCharacterCount()
{
OExternalLockGuard aGuard( this );
return OCommonAccessibleText::getCharacterCount();
}
OUString OAccessibleTextHelper::getSelectedText()
{
OExternalLockGuard aGuard( this );
......@@ -806,14 +792,6 @@ namespace comphelper
}
OUString OAccessibleTextHelper::getText()
{
OExternalLockGuard aGuard( this );
return implGetText();
}
OUString OAccessibleTextHelper::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
{
OExternalLockGuard aGuard( this );
......
......@@ -1338,7 +1338,7 @@ namespace accessibility
DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
"AccessibleEditableTextPara::getCharacterCount: index value overflow");
return OCommonAccessibleText::getCharacterCount();
return implGetText().getLength();
}
sal_Int32 SAL_CALL AccessibleEditableTextPara::getIndexAtPoint( const awt::Point& rPoint )
......
......@@ -69,8 +69,6 @@ namespace comphelper
*/
sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex );
/// @throws css::uno::RuntimeException
sal_Int32 SAL_CALL getCharacterCount();
/// @throws css::uno::RuntimeException
OUString SAL_CALL getSelectedText();
/// @throws css::uno::RuntimeException
sal_Int32 SAL_CALL getSelectionStart();
......@@ -137,11 +135,9 @@ namespace comphelper
// XAccessibleText
virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
virtual sal_Int32 SAL_CALL getCharacterCount() override;
virtual OUString SAL_CALL getSelectedText() override;
virtual sal_Int32 SAL_CALL getSelectionStart() override;
virtual sal_Int32 SAL_CALL getSelectionEnd() override;
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;
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
......@@ -161,11 +157,9 @@ namespace comphelper
// The following methods have a default implementation:
// getCharacter
// getCharacterCount
// getSelectedText
// getSelectionStart
// getSelectionEnd
// getText
// getTextRange
// getTextAtIndex
// getTextBeforeIndex
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment