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