summaryrefslogtreecommitdiffstats
path: root/accessible/windows/msaa/MsaaRootAccessible.h
blob: efc42bc094966091edbe00b0f32a93a6270f458c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */

#ifndef mozilla_a11y_MsaaRootAccessible_h__
#define mozilla_a11y_MsaaRootAccessible_h__

#include "mozilla/mscom/Aggregation.h"
#include "MsaaDocAccessible.h"
#include "UiaRoot.h"

namespace mozilla {

namespace a11y {
class RootAccessible;

class MsaaRootAccessible : public MsaaDocAccessible, public UiaRoot {
 public:
  explicit MsaaRootAccessible(Accessible* aAcc)
      : MsaaDocAccessible(aAcc), mOuter(&mInternalUnknown) {}

  /**
   * This method enables a RootAccessibleWrap to be wrapped by a
   * LazyInstantiator.
   *
   * @param aOuter The IUnknown of the object that is wrapping this
   *               RootAccessibleWrap, or nullptr to unwrap the aOuter from
   *               a previous call.
   * @return This objects own IUnknown (as opposed to aOuter's IUnknown).
   */
  already_AddRefed<IUnknown> Aggregate(IUnknown* aOuter);

  /**
   * @return This object's own IUnknown, as opposed to its wrapper's IUnknown
   *         which is what would be returned by QueryInterface(IID_IUnknown).
   */
  already_AddRefed<IUnknown> GetInternalUnknown();

 private:
  // DECLARE_AGGREGATABLE declares the internal IUnknown methods as well as
  // mInternalUnknown.
  DECLARE_AGGREGATABLE(MsaaRootAccessible);
  IUnknown* mOuter;

  RootAccessible* RootAcc();
};

}  // namespace a11y
}  // namespace mozilla

#endif