2002-06-24 05:13:56 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2002-06-24 05:13:56 +04:00
|
|
|
|
2012-05-23 22:05:57 +04:00
|
|
|
#ifndef mozilla_a11y_TextLeafAccessible_h__
|
|
|
|
#define mozilla_a11y_TextLeafAccessible_h__
|
2002-06-24 05:13:56 +04:00
|
|
|
|
2012-06-04 16:32:29 +04:00
|
|
|
#include "BaseAccessibles.h"
|
2003-03-24 05:09:55 +03:00
|
|
|
|
2012-05-23 22:05:57 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2009-10-28 13:42:36 +03:00
|
|
|
/**
|
|
|
|
* Generic class used for text nodes.
|
|
|
|
*/
|
2012-06-04 16:32:29 +04:00
|
|
|
class TextLeafAccessible : public LinkableAccessible
|
2002-06-24 05:13:56 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 13:01:40 +04:00
|
|
|
TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2012-05-23 22:05:57 +04:00
|
|
|
virtual ~TextLeafAccessible();
|
2007-04-11 08:17:33 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::a11y::role NativeRole() override;
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t aLength = UINT32_MAX) override;
|
|
|
|
virtual ENameValueFlag Name(nsString& aName) override;
|
2009-10-28 13:42:36 +03:00
|
|
|
|
2012-05-23 22:05:57 +04:00
|
|
|
// TextLeafAccessible
|
2011-01-31 18:53:09 +03:00
|
|
|
void SetText(const nsAString& aText) { mText = aText; }
|
|
|
|
const nsString& Text() const { return mText; }
|
2009-10-28 13:42:36 +03:00
|
|
|
|
2011-01-31 18:53:09 +03:00
|
|
|
protected:
|
|
|
|
nsString mText;
|
2002-06-24 05:13:56 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-31 07:04:32 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-05-29 05:18:45 +04:00
|
|
|
// Accessible downcast method
|
2011-01-31 07:04:32 +03:00
|
|
|
|
2012-11-18 06:01:44 +04:00
|
|
|
inline TextLeafAccessible*
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible::AsTextLeaf()
|
2011-01-31 07:04:32 +03:00
|
|
|
{
|
2012-12-18 09:22:26 +04:00
|
|
|
return IsTextLeaf() ? static_cast<TextLeafAccessible*>(this) : nullptr;
|
2011-01-31 07:04:32 +03:00
|
|
|
}
|
|
|
|
|
2012-11-18 06:01:44 +04:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2002-06-24 05:13:56 +04:00
|
|
|
#endif
|
|
|
|
|