tdf#118418 implement scrollSubstringTo() for gtk

Define & use new accessibility scroll type compatible with IAccessible2
and extend the XAccessibleText interface to require scrollSubstringTo().

Co-authored-by: Martin Pieuchot <mpi@grenadille.net>
Change-Id: Id3b2e8616892d7dcbfb41a14b72a8a457fd1dbf6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89851
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Colomban Wendling 2020-04-30 10:49:37 +02:00 committed by Stephan Bergmann
parent e420b89a69
commit b46a0a7f9f
43 changed files with 365 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include <extended/accessiblebrowseboxcell.hxx>
#include <comphelper/accessibletexthelper.hxx>
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
namespace accessibility
{
@ -114,6 +115,7 @@ namespace accessibility
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
};
}

View File

@ -22,6 +22,7 @@
#include <cppuhelper/implbase2.hxx>
#include <extended/AccessibleGridControlBase.hxx>
#include <vcl/accessibletable.hxx>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
namespace accessibility
{
@ -138,6 +139,7 @@ namespace accessibility
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
};
}

View File

@ -19,6 +19,7 @@
#pragma once
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@ -157,6 +158,7 @@ namespace accessibility
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleEventBroadcaster
virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;

View File

@ -20,6 +20,7 @@
#pragma once
#include <deque>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@ -181,6 +182,7 @@ namespace accessibility
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleEventBroadcaster
virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;

View File

@ -25,6 +25,7 @@
#include <vcl/texteng.hxx>
#include <vcl/textview.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
@ -229,6 +230,8 @@ private:
virtual sal_Bool SAL_CALL setSelection(::sal_Int32 nStartIndex,
::sal_Int32 nEndIndex) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
virtual OUString SAL_CALL getText() override;
virtual OUString SAL_CALL getTextRange(::sal_Int32 nStartIndex,

View File

@ -20,6 +20,7 @@
#pragma once
#include <standard/vclxaccessibletextcomponent.hxx>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
@ -92,6 +93,7 @@ public:
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleEditableText
virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;

View File

@ -19,6 +19,7 @@
#pragma once
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@ -144,6 +145,7 @@ public:
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleEventBroadcaster
virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;

View File

@ -21,6 +21,7 @@
#include <standard/accessiblemenuitemcomponent.hxx>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
#include <com/sun/star/accessibility/XAccessibleValue.hpp>
@ -87,6 +88,7 @@ public:
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleAction
virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) final override;

View File

@ -19,6 +19,7 @@
#pragma once
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <comphelper/accessibletexthelper.hxx>
@ -124,6 +125,7 @@ public:
virtual sal_Int32 SAL_CALL getCharacterCount() override;
virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
};

View File

@ -19,6 +19,7 @@
#pragma once
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <comphelper/accessibletexthelper.hxx>
@ -133,6 +134,7 @@ public:
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 getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
};

View File

@ -19,6 +19,7 @@
#pragma once
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <comphelper/accessibletexthelper.hxx>
@ -74,6 +75,7 @@ public:
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
};

View File

@ -18,6 +18,7 @@
*/
#pragma once
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@ -120,6 +121,7 @@ public:
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 getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleComponent
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;

View File

@ -322,6 +322,10 @@ namespace accessibility
//!!! don't know how to put a string into the clipboard
return false;
}
sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
void AccessibleBrowseBoxTableCell::disposing( const EventObject& _rSource )
{
if ( _rSource.Source == mxParent )

View File

@ -320,6 +320,10 @@ namespace accessibility
//!!! don't know how to put a string into the clipboard
return false;
}
sal_Bool SAL_CALL AccessibleGridControlTableCell::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
tools::Rectangle AccessibleGridControlTableCell::implGetBoundingBox()
{

View File

@ -474,6 +474,11 @@ namespace accessibility
return true;
}
sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
// XAccessibleEventBroadcaster
void SAL_CALL AccessibleIconChoiceCtrlEntry::addAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener )

View File

@ -695,6 +695,11 @@ namespace accessibility
return true;
}
sal_Bool SAL_CALL AccessibleListBoxEntry::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
// XAccessibleEventBroadcaster
void SAL_CALL AccessibleListBoxEntry::addAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener )

View File

@ -430,6 +430,12 @@ sal_Bool SAL_CALL Paragraph::copyText(::sal_Int32 nStartIndex,
return true;
}
// virtual
sal_Bool SAL_CALL Paragraph::scrollSubstringTo( sal_Int32, sal_Int32, css::accessibility::AccessibleScrollType )
{
return false;
}
// virtual
sal_Bool SAL_CALL Paragraph::cutText(::sal_Int32 nStartIndex,
::sal_Int32 nEndIndex)

View File

@ -487,6 +487,10 @@ sal_Bool VCLXAccessibleEdit::copyText( sal_Int32 nStartIndex, sal_Int32 nEndInde
return VCLXAccessibleTextComponent::copyText( nStartIndex, nEndIndex );
}
sal_Bool VCLXAccessibleEdit::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
// XAccessibleEditableText

View File

@ -560,6 +560,11 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_I
return bRet;
}
sal_Bool VCLXAccessibleListItem::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
// XAccessibleEventBroadcaster
void SAL_CALL VCLXAccessibleListItem::addAccessibleEventListener( const Reference< XAccessibleEventListener >& xListener )

View File

@ -383,6 +383,11 @@ sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEnd
return bReturn;
}
sal_Bool VCLXAccessibleMenuItem::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
// XAccessibleAction

View File

@ -582,4 +582,9 @@ sal_Bool VCLXAccessibleStatusBarItem::copyText( sal_Int32 nStartIndex, sal_Int32
}
sal_Bool VCLXAccessibleStatusBarItem::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -669,5 +669,10 @@ sal_Bool VCLXAccessibleTabPage::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
return bReturn;
}
sal_Bool VCLXAccessibleTabPage::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -368,5 +368,9 @@ sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32
return bReturn;
}
sal_Bool VCLXAccessibleTextComponent::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -555,6 +555,11 @@ sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sa
return bReturn;
}
sal_Bool VCLXAccessibleToolBoxItem::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
// XAccessibleComponent
Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleAtPoint( const awt::Point& )

View File

@ -2113,6 +2113,11 @@ namespace accessibility
}
}
sal_Bool SAL_CALL AccessibleEditableTextPara::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
// XAccessibleEditableText
sal_Bool SAL_CALL AccessibleEditableTextPara::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
{

View File

@ -883,6 +883,11 @@ namespace accessibility
aEndIndex.nPara, aEndIndex.nIndex );
}
sal_Bool SAL_CALL AccessibleStaticTextBase::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
// XAccessibleTextAttributes
uno::Sequence< beans::PropertyValue > AccessibleStaticTextBase::getDefaultAttributes( const uno::Sequence< OUString >& RequestedAttributes )
{

View File

@ -28,6 +28,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
@ -139,6 +140,7 @@ namespace accessibility
/// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleEditableText
virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;

View File

@ -24,6 +24,7 @@
#include <tools/gen.hxx>
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
#include <com/sun/star/accessibility/TextSegment.hpp>
@ -198,6 +199,7 @@ namespace accessibility
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
/// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleTextAttributes
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getDefaultAttributes( const css::uno::Sequence< OUString >& RequestedAttributes ) override;

View File

@ -21,6 +21,7 @@
#ifndef INCLUDED_SVX_ACCESSIBLESHAPE_HXX
#define INCLUDED_SVX_ACCESSIBLESHAPE_HXX
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/TextSegment.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
@ -350,6 +351,7 @@ public:
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
//===== Misc ========================================================

View File

@ -1621,6 +1621,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/accessibility,\
AccessibleRelation \
AccessibleRelationType \
AccessibleRole \
AccessibleScrollType \
AccessibleStateType \
AccessibleTableModelChange \
AccessibleTableModelChangeType \

View File

@ -0,0 +1,81 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_accessibility_AccessibleScrollType_idl__
#define __com_sun_star_accessibility_AccessibleScrollType_idl__
module com { module sun { module star { module accessibility {
/** Scroll types
<p>Describes the type of scrolling that are available for the methods of
the XAccessibleScrollableText interface.</p>
@since LibreOffice 7.0
*/
enum AccessibleScrollType
{
/**
Scroll the top left corner of the object or string such that the
top left corner is within the top level window.
*/
SCROLL_TOP_LEFT,
/**
Scroll the bottom right corner of the object or string such that the
bottom right corner is within the top level window.
*/
SCROLL_BOTTOM_RIGHT,
/**
Scroll the top edge of the object or string such that the top edge is
within the top level window.
*/
SCROLL_TOP_EDGE,
/**
Scroll the bottom edge of the object or string such that the bottom
edge is within the top level window.
*/
SCROLL_BOTTOM_EDGE,
/**
Scroll the left edge of the object or string such that the left edge
is within the top level window.
*/
SCROLL_LEFT_EDGE,
/**
Scroll the right edge of the object or string such that the right edge
is within the top level window.
*/
SCROLL_RIGHT_EDGE,
/**
Scroll the object or string such that as much as possible of the
object or string is within the top level window.
*/
SCROLL_ANYWHERE
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -491,6 +491,33 @@ interface XAccessibleText : ::com::sun::star::uno::XInterface
boolean copyText ([in] long nStartIndex, [in] long nEndIndex)
raises (::com::sun::star::lang::IndexOutOfBoundsException);
/** Scroll the specified text to make it visible on screen.
@param nStartIndex
Start index of the text to scroll.
The valid range is 0..length.
@param nEndIndex
End index of the text to scroll.
The valid range is nStartIndex..length.
@param aScrollType
Type of scroll to perform. See AccessibleScrollType for the
complete list.
@return
Returns `TRUE` if the specified text has been scrolled
successfully.
@throws ::com::sun::star::lang::IndexOutOfBoundsException
if the indices are invalid
@since LibreOffice 7.0
*/
boolean
scrollSubstringTo ([in] long nStartIndex, [in] long nEndIndex,
[in] AccessibleScrollType aScrollType)
raises (::com::sun::star::lang::IndexOutOfBoundsException);
};
}; }; }; };

View File

@ -608,6 +608,11 @@ sal_Bool SAL_CALL ScAccessibleCsvRuler::copyText( sal_Int32 /* nStartIndex */, s
return false;
}
sal_Bool SAL_CALL ScAccessibleCsvRuler::scrollSubstringTo( sal_Int32 /* nStartIndex */, sal_Int32/* nEndIndex */, AccessibleScrollType /* aScrollType */ )
{
return false;
}
// XInterface -----------------------------------------------------------------
Any SAL_CALL ScAccessibleCsvRuler::queryInterface( const css::uno::Type& rType )

View File

@ -22,6 +22,7 @@
#include <memory>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
@ -175,6 +176,8 @@ public:
/** Copies the specified text range into the clipboard (ruler does nothing). */
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XInterface -------------------------------------------------------------
DECLARE_XINTERFACE()

View File

@ -28,6 +28,7 @@
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@ -324,6 +325,11 @@ public:
virtual sal_Bool SAL_CALL copyText (sal_Int32 nStartIndex, sal_Int32 nEndIndex) override;
virtual sal_Bool SAL_CALL scrollSubstringTo(
sal_Int32 nStartIndex,
sal_Int32 nEndIndex,
css::accessibility::AccessibleScrollType aScrollType) override;
protected:
virtual awt::Point GetRelativeLocation() override;
virtual awt::Size GetSize() override;
@ -1575,6 +1581,14 @@ sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::copyText (
return false;
}
sal_Bool SAL_CALL PresenterAccessible::AccessibleParagraph::scrollSubstringTo(
sal_Int32,
sal_Int32,
AccessibleScrollType)
{
return false;
}
//----- protected -------------------------------------------------------------
awt::Point PresenterAccessible::AccessibleParagraph::GetRelativeLocation()

View File

@ -718,6 +718,11 @@ sal_Bool SAL_CALL SmGraphicAccessible::copyText(
return bReturn;
}
sal_Bool SAL_CALL SmGraphicAccessible::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
{
return false;
}
OUString SAL_CALL SmGraphicAccessible::getImplementationName()
{
return "SmGraphicAccessible";

View File

@ -20,6 +20,7 @@
#ifndef INCLUDED_STARMATH_SOURCE_ACCESSIBILITY_HXX
#define INCLUDED_STARMATH_SOURCE_ACCESSIBILITY_HXX
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
@ -128,6 +129,7 @@ public:
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;

View File

@ -1336,6 +1336,7 @@ css::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBehindIndex( sa
return aResult;
}
sal_Bool SAL_CALL AccessibleShape::copyText( sal_Int32, sal_Int32 ){return true;}
sal_Bool SAL_CALL AccessibleShape::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ){return false;}
} // end of namespace accessibility

View File

@ -259,6 +259,7 @@ css::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBehindI
}
sal_Bool SAL_CALL SwAccessibleNoTextFrame::copyText( sal_Int32, sal_Int32 ){return true;}
sal_Bool SAL_CALL SwAccessibleNoTextFrame::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ){return false;}
// XAccessibleHyperText

View File

@ -21,6 +21,7 @@
#define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCNOTEXTFRAME_HXX
#include "accframebase.hxx"
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessibleImage.hpp>
#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
@ -104,6 +105,7 @@ public:
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleHypertext
virtual sal_Int32 SAL_CALL getHyperLinkCount() override;

View File

@ -21,6 +21,7 @@
#include <numeric>
#include <txtfrm.hxx>
#include <flyfrm.hxx>
#include <mdiexp.hxx>
#include <ndtxt.hxx>
#include <pam.hxx>
#include <unotextrange.hxx>
@ -34,6 +35,7 @@
#include <vcl/window.hxx>
#include <sal/log.hxx>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleTextType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
@ -2492,6 +2494,71 @@ sal_Bool SwAccessibleParagraph::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
return true;
}
sal_Bool SwAccessibleParagraph::scrollSubstringTo( sal_Int32 nStartIndex,
sal_Int32 nEndIndex, AccessibleScrollType aScrollType )
{
SolarMutexGuard aGuard;
ThrowIfDisposed();
// parameter checking
sal_Int32 nLength = GetString().getLength();
if ( ! IsValidRange( nStartIndex, nEndIndex, nLength ) )
throw lang::IndexOutOfBoundsException();
vcl::Window *pWin = GetWindow();
if ( ! pWin )
throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
/* Start and end character bounds, in pixels, relative to the paragraph */
awt::Rectangle startR, endR;
startR = getCharacterBounds(nStartIndex);
endR = getCharacterBounds(nEndIndex);
/* Adjust points to fit the bounding box of both bounds. */
Point sP(std::min(startR.X, endR.X), startR.Y);
Point eP(std::max(startR.X + startR.Width, endR.X + endR.Width), endR.Y + endR.Height);
/* Offset the values relative to the view shell frame */
SwRect aFrameLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
Point aFramePixPos( GetMap()->CoreToPixel( aFrameLogBounds.SVRect() ).TopLeft() );
sP += aFramePixPos;
eP += aFramePixPos;
Point startPoint(GetMap()->PixelToCore(sP));
Point endPoint(GetMap()->PixelToCore(eP));
switch (aScrollType)
{
#ifdef notyet
case AccessibleScrollType_SCROLL_TOP_LEFT:
break;
case AccessibleScrollType_SCROLL_BOTTOM_RIGHT:
break;
case AccessibleScrollType_SCROLL_TOP_EDGE:
break;
case AccessibleScrollType_SCROLL_BOTTOM_EDGE:
break;
case AccessibleScrollType_SCROLL_LEFT_EDGE:
break;
case AccessibleScrollType_SCROLL_RIGHT_EDGE:
break;
#endif
case AccessibleScrollType_SCROLL_ANYWHERE:
break;
default:
return false;
}
const SwRect aRect(startPoint, endPoint);
SwViewShell* pViewShell = GetMap()->GetShell();
OSL_ENSURE( pViewShell != nullptr, "View shell expected!" );
ScrollMDI(pViewShell, aRect, USHRT_MAX, USHRT_MAX);
return true;
}
// XAccessibleEditableText
sal_Bool SwAccessibleParagraph::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )

View File

@ -20,6 +20,7 @@
#define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCPARA_HXX
#include "acccontext.hxx"
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
@ -313,6 +314,7 @@ public:
virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override;
// XAccessibleEditableText
virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;

View File

@ -23,12 +23,14 @@
#include <osl/diagnose.h>
#include <com/sun/star/accessibility/AccessibleScrollType.hpp>
#include <com/sun/star/accessibility/AccessibleTextType.hpp>
#include <com/sun/star/accessibility/TextSegment.hpp>
#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
#include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp>
#include <com/sun/star/lang/NoSupportException.hpp>
#include <com/sun/star/text/TextMarkupType.hpp>
using namespace ::com::sun::star;
@ -56,6 +58,34 @@ text_type_from_boundary(AtkTextBoundary boundary_type)
/*****************************************************************************/
#if ATK_CHECK_VERSION(2,32,0)
static accessibility::AccessibleScrollType
scroll_type_from_scroll_type(AtkScrollType type)
{
switch(type)
{
case ATK_SCROLL_TOP_LEFT:
return accessibility::AccessibleScrollType_SCROLL_TOP_LEFT;
case ATK_SCROLL_BOTTOM_RIGHT:
return accessibility::AccessibleScrollType_SCROLL_BOTTOM_RIGHT;
case ATK_SCROLL_TOP_EDGE:
return accessibility::AccessibleScrollType_SCROLL_TOP_EDGE;
case ATK_SCROLL_BOTTOM_EDGE:
return accessibility::AccessibleScrollType_SCROLL_BOTTOM_EDGE;
case ATK_SCROLL_LEFT_EDGE:
return accessibility::AccessibleScrollType_SCROLL_LEFT_EDGE;
case ATK_SCROLL_RIGHT_EDGE:
return accessibility::AccessibleScrollType_SCROLL_RIGHT_EDGE;
case ATK_SCROLL_ANYWHERE:
return accessibility::AccessibleScrollType_SCROLL_ANYWHERE;
default:
throw lang::NoSupportException();
}
}
#endif
/*****************************************************************************/
static gchar *
adjust_boundaries( css::uno::Reference<css::accessibility::XAccessibleText> const & pText,
accessibility::TextSegment const & rTextSegment,
@ -812,6 +842,29 @@ text_wrapper_set_selection (AtkText *text,
return FALSE;
}
#if ATK_CHECK_VERSION(2,32,0)
static gboolean
text_wrapper_scroll_substring_to(AtkText *text,
gint start_offset,
gint end_offset,
AtkScrollType scroll_type)
{
try {
css::uno::Reference<css::accessibility::XAccessibleText> pText
= getText( text );
if( pText.is() )
return pText->scrollSubstringTo( start_offset, end_offset,
scroll_type_from_scroll_type( scroll_type ) );
}
catch(const uno::Exception&) {
g_warning( "Exception in scrollSubstringTo()" );
}
return FALSE;
}
#endif
} // extern "C"
void
@ -836,6 +889,9 @@ textIfaceInit (AtkTextIface *iface)
iface->get_default_attributes = text_wrapper_get_default_attributes;
iface->get_character_extents = text_wrapper_get_character_extents;
iface->get_offset_at_point = text_wrapper_get_offset_at_point;
#if ATK_CHECK_VERSION(2,32,0)
iface->scroll_substring_to = text_wrapper_scroll_substring_to;
#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */