Commit cdc57e72 authored by roger_fong@apple.com's avatar roger_fong@apple.com

<https://bugs.webkit.org/show_bug.cgi?id=119829> Add IAccessibleText and...

<https://bugs.webkit.org/show_bug.cgi?id=119829> Add IAccessibleText and IAccessibleEditableText interfaces and implementation to AppleWin port.

Reviewed by Chris Fleizach.

* AccessibleBase.cpp:
(AccessibleBase::createInstance): Create an AccessibleText instance when necessary.
(AccessibleBase::QueryService):
* AccessibleBase.h:
* AccessibleTextImpl.cpp: Added.
(AccessibleText::AccessibleText):
(AccessibleText::addSelection):
(AccessibleText::get_attributes): Not Implemented
(AccessibleText::get_caretOffset):
(AccessibleText::get_characterExtents):
(AccessibleText::get_nSelections):
(AccessibleText::get_offsetAtPoint):
(AccessibleText::get_selection):
(AccessibleText::get_text):
(AccessibleText::get_textBeforeOffset): Not Implemented
(AccessibleText::get_textAfterOffset): Not Implemented
(AccessibleText::get_textAtOffset): Not Implemented
(AccessibleText::removeSelection):
(AccessibleText::setCaretOffset):
(AccessibleText::setSelection):
(AccessibleText::get_nCharacters):
(AccessibleText::scrollSubstringTo):
(AccessibleText::scrollSubstringToPoint):
(AccessibleText::get_newText): Not Implemented
(AccessibleText::get_oldText): Not Implemented
(AccessibleText::get_attributeRange): Not Implemented
(AccessibleText::copyText):
(AccessibleText::deleteText):
(AccessibleText::insertText):
(AccessibleText::cutText):
(AccessibleText::pasteText):
(AccessibleText::replaceText):
(AccessibleText::setAttributes): Not Implemented
(AccessibleText::QueryInterface):
(AccessibleText::Release):
(AccessibleText::convertSpecialOffset):
(AccessibleText::initialCheck):
* AccessibleTextImpl.h: Added.
(AccessibleText::~AccessibleText):
(AccessibleText::AddRef):
* WebKit.vcxproj/Interfaces/Interfaces.vcxproj:
* WebKit.vcxproj/Interfaces/Interfaces.vcxproj.filters:
* WebKit.vcxproj/WebKit/WebKit.vcxproj:
* WebKit.vcxproj/WebKit/WebKit.vcxproj.filters:
* WebKit.vcxproj/WebKitGUID/WebKitGUID.vcxproj:
* WebKit.vcxproj/WebKitGUID/WebKitGUID.vcxproj.filters:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent fbef8ed9
2013-08-21 Roger Fong <roger_fong@apple.com>
<https://bugs.webkit.org/show_bug.cgi?id=119829> IAccessibleText and IAccessibleEditableText implementation for AppleWindows port.
Reviewed by Chris Fleizach.
* WebKit.vcxproj/Interfaces/Interfaces.vcxproj:
* WebKit.vcxproj/Interfaces/Interfaces.vcxproj.filters:
* WebKit.vcxproj/WebKit/WebKit.vcxproj:
* WebKit.vcxproj/WebKit/WebKit.vcxproj.filters:
* WebKit.vcxproj/WebKitGUID/WebKitGUID.vcxproj:
* WebKit.vcxproj/WebKitGUID/WebKitGUID.vcxproj.filters:
2013-08-26 Brent Fulgham <bfulgham@apple.com>
[Windows] Build fix after r154541.
......
......@@ -326,8 +326,11 @@
<Midl Include="..\..\win\Interfaces\Accessible2\Accessible2.idl" />
<Midl Include="..\..\win\Interfaces\Accessible2\Accessible2_2.idl" />
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleApplication.idl" />
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleEditableText.idl" />
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleRelation.idl" />
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleStates.idl" />
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleText.idl" />
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleText2.idl" />
<Midl Include="..\..\win\Interfaces\AccessibleComparable.idl">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
......
......@@ -277,6 +277,15 @@
<Midl Include="..\..\win\Interfaces\AccessibilityDelegate.idl">
<Filter>IDL</Filter>
</Midl>
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleText.idl">
<Filter>IDL\Accessibility2</Filter>
</Midl>
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleText2.idl">
<Filter>IDL\Accessibility2</Filter>
</Midl>
<Midl Include="..\..\win\Interfaces\Accessible2\AccessibleEditableText.idl">
<Filter>IDL\Accessibility2</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<None Include="InterfacesPostBuild.cmd" />
......
......@@ -269,6 +269,7 @@
<ClCompile Include="..\..\win\AccessibleBase.cpp" />
<ClCompile Include="..\..\win\AccessibleDocument.cpp" />
<ClCompile Include="..\..\win\AccessibleImage.cpp" />
<ClCompile Include="..\..\win\AccessibleTextImpl.cpp" />
<ClCompile Include="..\..\win\CFDictionaryPropertyBag.cpp" />
<ClCompile Include="..\..\win\DefaultDownloadDelegate.cpp" />
<ClCompile Include="..\..\win\DefaultPolicyDelegate.cpp" />
......@@ -416,6 +417,7 @@
<ClInclude Include="..\..\win\AccessibleBase.h" />
<ClInclude Include="..\..\win\AccessibleDocument.h" />
<ClInclude Include="..\..\win\AccessibleImage.h" />
<ClInclude Include="..\..\win\AccessibleTextImpl.h" />
<ClInclude Include="..\..\win\CFDictionaryPropertyBag.h" />
<ClInclude Include="..\..\win\CodeAnalysisConfig.h" />
<ClInclude Include="..\..\win\COMEnumVariant.h" />
......
......@@ -275,6 +275,9 @@
<ClCompile Include="..\..\cf\WebCoreSupport\WebInspectorClientCF.cpp">
<Filter>WebCoreSupport</Filter>
</ClCompile>
<ClCompile Include="..\..\win\AccessibleTextImpl.cpp">
<Filter>Sources</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\win\WebCoreSupport\EmbeddedWidget.h">
......@@ -536,6 +539,9 @@
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\win\WebKitPrefix.h" />
<ClInclude Include="..\..\win\AccessibleTextImpl.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="WebKitPostBuild.cmd" />
......@@ -628,4 +634,4 @@
<Filter>Resources</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
</Project>
\ No newline at end of file
......@@ -268,6 +268,9 @@
<ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebKit\Interfaces\Accessible2_2_i.c" />
<ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebKit\Interfaces\AccessibleApplication_i.c" />
<ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebKit\Interfaces\AccessibleRelation_i.c" />
<ClCompile Include="..\..\..\..\WebKitBuild\Release\obj32\WebKit\Interfaces\AccessibleEditableText_i.c" />
<ClCompile Include="..\..\..\..\WebKitBuild\Release\obj32\WebKit\Interfaces\AccessibleText2_i.c" />
<ClCompile Include="..\..\..\..\WebKitBuild\Release\obj32\WebKit\Interfaces\AccessibleText_i.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
......
......@@ -10,5 +10,8 @@
<ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebKit\Interfaces\Accessible2_2_i.c" />
<ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebKit\Interfaces\AccessibleApplication_i.c" />
<ClCompile Include="$(ConfigurationBuildDir)\obj$(PlatformArchitecture)\WebKit\Interfaces\AccessibleRelation_i.c" />
<ClCompile Include="..\..\..\..\WebKitBuild\Release\obj32\WebKit\Interfaces\AccessibleEditableText_i.c" />
<ClCompile Include="..\..\..\..\WebKitBuild\Release\obj32\WebKit\Interfaces\AccessibleText_i.c" />
<ClCompile Include="..\..\..\..\WebKitBuild\Release\obj32\WebKit\Interfaces\AccessibleText2_i.c" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -29,6 +29,7 @@
#include "AccessibleBase.h"
#include "AccessibleImage.h"
#include "AccessibleTextImpl.h"
#include "WebView.h"
#include <WebCore/AccessibilityListBox.h>
#include <WebCore/AccessibilityMenuListPopup.h>
......@@ -78,6 +79,8 @@ AccessibleBase* AccessibleBase::createInstance(AccessibilityObject* obj, HWND wi
if (obj->isImage())
return new AccessibleImage(obj, window);
else if (obj->isStaticText() || obj->isTextControl() || (obj->node() && obj->node()->isTextNode()))
return new AccessibleText(obj, window);
return new AccessibleBase(obj, window);
}
......@@ -88,7 +91,10 @@ HRESULT AccessibleBase::QueryService(REFGUID guidService, REFIID riid, void **pp
&& !IsEqualGUID(guidService, IID_IAccessible2_2)
&& !IsEqualGUID(guidService, IID_IAccessible2)
&& !IsEqualGUID(guidService, IID_IAccessibleApplication)
&& !IsEqualGUID(guidService, IID_IAccessible)) {
&& !IsEqualGUID(guidService, IID_IAccessible)
&& !IsEqualGUID(guidService, IID_IAccessibleText)
&& !IsEqualGUID(guidService, IID_IAccessibleText2)
&& !IsEqualGUID(guidService, IID_IAccessibleEditableText)) {
*ppvObject = 0;
return E_INVALIDARG;
}
......
......@@ -26,6 +26,9 @@
#ifndef AccessibleBase_h
#define AccessibleBase_h
#include "AccessibleEditableText.h"
#include "AccessibleText.h"
#include "AccessibleText2.h"
#include "WebKit.h"
#include <WebCore/AccessibilityObject.h>
#include <WebCore/AccessibilityObjectWrapperWin.h>
......
/*
* Copyright (C) 2013 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR
* PROFITS OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "AccessibleTextImpl.h"
#include "WebKitDLL.h"
#include "WebView.h"
#include <WebCore/Document.h>
#include <WebCore/Editor.h>
#include <WebCore/Frame.h>
#include <WebCore/FrameSelection.h>
#include <WebCore/HTMLTextFormControlElement.h>
#include <WebCore/Node.h>
#include <WebCore/Page.h>
#include <WebCore/Position.h>
#include <WebCore/RenderTextControl.h>
#include <WebCore/VisibleSelection.h>
#include <WebCore/htmlediting.h>
using namespace WebCore;
AccessibleText::AccessibleText(WebCore::AccessibilityObject* obj, HWND window)
: AccessibleBase(obj, window)
{
ASSERT_ARG(obj, obj->isStaticText() || obj->isTextControl() || (obj->node() && obj->node()->isTextNode()));
ASSERT_ARG(obj, obj->isAccessibilityRenderObject());
}
// IAccessibleText
HRESULT AccessibleText::addSelection(long startOffset, long endOffset)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
startOffset = convertSpecialOffset(startOffset);
endOffset = convertSpecialOffset(endOffset);
m_object->setSelectedTextRange(PlainTextRange(startOffset, endOffset-startOffset));
return S_OK;
}
HRESULT AccessibleText::get_attributes(long offset, long* startOffset, long* endOffset, BSTR* textAttributes)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
offset = convertSpecialOffset(offset);
return E_NOTIMPL;
}
HRESULT AccessibleText::get_caretOffset(long* offset)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
VisiblePosition caretPosition = m_object->visiblePositionForPoint(m_object->document()->frame()->selection().absoluteCaretBounds().center());
int caretOffset = caretPosition.deepEquivalent().offsetInContainerNode();
if (caretOffset < 0)
return E_FAIL;
*offset = caretOffset;
return S_OK;
}
HRESULT AccessibleText::get_characterExtents(long offset, enum IA2CoordinateType coordType, long* x, long* y, long* width, long* height)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
offset = convertSpecialOffset(offset);
Node* node = m_object->node();
if (!node)
return E_POINTER;
IntRect boundingRect = m_object->boundsForVisiblePositionRange(VisiblePositionRange(VisiblePosition(Position(node, offset, Position::PositionIsOffsetInAnchor)), VisiblePosition(Position(node, offset+1, Position::PositionIsOffsetInAnchor))));
*width = boundingRect.width();
*height = boundingRect.height();
switch (coordType) {
case IA2_COORDTYPE_SCREEN_RELATIVE:
POINT points[1];
points[0].x = boundingRect.x();
points[0].y = boundingRect.y();
MapWindowPoints(m_window, 0, points, 1);
*x = points[0].x;
*y = points[0].y;
break;
case IA2_COORDTYPE_PARENT_RELATIVE:
*x = boundingRect.x();
*y = boundingRect.y();
break;
default:
return E_INVALIDARG;
}
return S_OK;
}
HRESULT AccessibleText::get_nSelections(long* nSelections)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
if (m_object->document()->frame()->selection().isNone())
*nSelections = 0;
else
*nSelections = 1;
return S_OK;
}
HRESULT AccessibleText::get_offsetAtPoint(long x, long y, enum IA2CoordinateType coordType, long* offset)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
Node* node = m_object->node();
if (!node)
return E_POINTER;
VisiblePosition vpos;
switch (coordType) {
case IA2_COORDTYPE_SCREEN_RELATIVE:
POINT points[1];
points[0].x = x;
points[0].y = y;
MapWindowPoints(0, m_window, points, 1);
vpos = m_object->visiblePositionForPoint(IntPoint(points[0].x, points[0].y));
break;
case IA2_COORDTYPE_PARENT_RELATIVE:
vpos = m_object->visiblePositionForPoint(IntPoint(x, y));
break;
default:
return E_INVALIDARG;
}
int caretPosition = vpos.deepEquivalent().offsetInContainerNode();
if (caretPosition < 0 || caretPosition > m_object->stringValue().length())
return S_FALSE;
return S_OK;
}
HRESULT AccessibleText::get_selection(long selectionIndex, long* startOffset, long* endOffset)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
long selections;
get_nSelections(&selections);
if (selectionIndex < 0 || selectionIndex >= selections)
return E_INVALIDARG;
PlainTextRange selectionRange = m_object->selectedTextRange();
*startOffset = selectionRange.start;
*endOffset = selectionRange.length;
return S_OK;
}
HRESULT AccessibleText::get_text(long startOffset, long endOffset, BSTR* text)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
startOffset = convertSpecialOffset(startOffset);
endOffset = convertSpecialOffset(endOffset);
WTF::String substringText = m_object->stringValue().substring(startOffset, endOffset - startOffset);
*text = SysAllocStringLen(substringText.characters(), substringText.length());
if (substringText.length() && !*text)
return E_OUTOFMEMORY;
return S_OK;
}
HRESULT AccessibleText::get_textBeforeOffset(long offset, enum IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, BSTR* text)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
return E_NOTIMPL;
}
HRESULT AccessibleText::get_textAfterOffset(long offset, enum IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, BSTR* text)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
return E_NOTIMPL;
}
HRESULT AccessibleText::get_textAtOffset(long offset, enum IA2TextBoundaryType boundaryType, long* startOffset, long* endOffset, BSTR* text)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
return E_NOTIMPL;
}
HRESULT AccessibleText::removeSelection(long selectionIndex)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
long selections;
get_nSelections(&selections);
if (selectionIndex < 0 || selectionIndex >= selections)
return E_INVALIDARG;
m_object->document()->frame()->selection().clear();
return S_OK;
}
HRESULT AccessibleText::setCaretOffset(long offset)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
offset = convertSpecialOffset(offset);
Node* node = m_object->node();
if (!node)
return E_POINTER;
m_object->document()->frame()->selection().setSelection(VisibleSelection(VisiblePosition(Position(node, offset, Position::PositionIsOffsetInAnchor))));
return S_OK;
}
HRESULT AccessibleText::setSelection(long selectionIndex, long startOffset, long endOffset)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
long selections;
get_nSelections(&selections);
if (selectionIndex < 0 || selectionIndex >= selections)
return E_INVALIDARG;
m_object->setSelectedTextRange(PlainTextRange(startOffset, endOffset - startOffset));
return S_OK;
}
HRESULT AccessibleText::get_nCharacters(long* characters)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
int length = m_object->stringValue().length();
if (length < 0)
return E_FAIL;
*characters = length;
return S_OK;
}
HRESULT AccessibleText::scrollSubstringTo(long startIndex, long endIndex, enum IA2ScrollType scrollType)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
startIndex = convertSpecialOffset(startIndex);
endIndex = convertSpecialOffset(endIndex);
VisiblePositionRange textRange = m_object->visiblePositionRangeForRange(PlainTextRange(startIndex, endIndex-startIndex));
if (textRange.start.isNull() || textRange.end.isNull())
return S_FALSE;
IntRect boundingBox = makeRange(textRange.start, textRange.end)->boundingBox();
switch (scrollType) {
case IA2_SCROLL_TYPE_TOP_LEFT:
m_object->scrollToGlobalPoint(boundingBox.minXMinYCorner());
break;
case IA2_SCROLL_TYPE_BOTTOM_RIGHT:
m_object->scrollToGlobalPoint(boundingBox.maxXMaxYCorner());
break;
case IA2_SCROLL_TYPE_TOP_EDGE:
m_object->scrollToGlobalPoint(IntPoint((boundingBox.x() + boundingBox.maxX()) / 2, boundingBox.y()));
break;
case IA2_SCROLL_TYPE_BOTTOM_EDGE:
m_object->scrollToGlobalPoint(IntPoint((boundingBox.x() + boundingBox.maxX()) / 2, boundingBox.maxY()));
break;
case IA2_SCROLL_TYPE_LEFT_EDGE:
m_object->scrollToGlobalPoint(IntPoint(boundingBox.x(), (boundingBox.y() + boundingBox.maxY()) / 2));
break;
case IA2_SCROLL_TYPE_RIGHT_EDGE:
m_object->scrollToGlobalPoint(IntPoint(boundingBox.maxX(), (boundingBox.y() + boundingBox.maxY()) / 2));
break;
case IA2_SCROLL_TYPE_ANYWHERE:
m_object->scrollToGlobalPoint(boundingBox.center());
break;
default:
return E_INVALIDARG;
}
return S_OK;
}
HRESULT AccessibleText::scrollSubstringToPoint(long startIndex, long endIndex, enum IA2CoordinateType coordinateType, long x, long y)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
startIndex = convertSpecialOffset(startIndex);
endIndex = convertSpecialOffset(endIndex);
switch (coordinateType) {
case IA2_COORDTYPE_SCREEN_RELATIVE:
POINT points[1];
points[0].x = x;
points[0].y = y;
MapWindowPoints(0, m_window, points, 1);
m_object->scrollToGlobalPoint(IntPoint(points[0].x, points[0].y));
break;
case IA2_COORDTYPE_PARENT_RELATIVE:
m_object->scrollToGlobalPoint(IntPoint(x, y));
break;
default:
return E_INVALIDARG;
}
return S_OK;
}
HRESULT AccessibleText::get_newText(IA2TextSegment* newText)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
return E_NOTIMPL;
}
HRESULT AccessibleText::get_oldText(IA2TextSegment* oldText)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
return E_NOTIMPL;
}
// IAccessibleText2
HRESULT AccessibleText::get_attributeRange(long offset, BSTR filter, long* startOffset, long* endOffset, BSTR* attributeValues)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
return E_NOTIMPL;
}
HRESULT AccessibleText::copyText(long startOffset, long endOffset)
{
if (initialCheck() == E_POINTER)
return E_POINTER;
startOffset = convertSpecialOffset(startOffset);
endOffset = convertSpecialOffset(endOffset);
Frame* frame = m_object->document()->frame();
if (!frame)
return E_POINTER;
addSelection(startOffset, endOffset);
frame->editor().copy();
return S_OK;
}
HRESULT AccessibleText::deleteText(long startOffset, long endOffset)
{
if (m_object->isReadOnly())
return S_FALSE;
if (initialCheck() == E_POINTER)
return E_POINTER;
Frame* frame = m_object->document()->frame();
if (!frame)
return E_POINTER;
addSelection(startOffset, endOffset);
frame->editor().deleteSelectionWithSmartDelete(false);
return S_OK;
}
HRESULT AccessibleText::insertText(long offset, BSTR* text)
{
if (m_object->isReadOnly())
return S_FALSE;
if (initialCheck() == E_POINTER)
return E_POINTER;
offset = convertSpecialOffset(offset);
Frame* frame = m_object->document()->frame();
if (!frame)
return E_POINTER;
addSelection(offset, offset);
frame->editor().insertText(*text, 0);
return S_OK;
}
HRESULT AccessibleText::cutText(long startOffset, long endOffset)
{
if (m_object->isReadOnly())
return S_FALSE;
if (initialCheck() == E_POINTER)
return E_POINTER;
startOffset = convertSpecialOffset(startOffset);
endOffset = convertSpecialOffset(endOffset);
Frame* frame = m_object->document()->frame();
if (!frame)
return E_POINTER;
addSelection(startOffset, endOffset);
frame->editor().cut();
return S_OK;
}
HRESULT AccessibleText::pasteText(long offset)
{
if (m_object->isReadOnly())
return S_FALSE;
if (initialCheck() == E_POINTER)
return E_POINTER;
offset = convertSpecialOffset(offset);
Frame* frame = m_object->document()->frame();
if (!frame)
return E_POINTER;
addSelection(offset, offset);
frame->editor().paste();
return S_OK;
}
HRESULT AccessibleText::replaceText(long startOffset, long endOffset, BSTR* text)
{
if (m_object->isReadOnly())