Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / svx / source / inc / svxpixelctlaccessiblecontext.hxx
blob2e0f0abcf9314ac10ebbb095bc28a42cfef9b6e1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SVX_SOURCE_INC_SVXPIXELCTLACCESSIBLECONTEXT_HXX
20 #define INCLUDED_SVX_SOURCE_INC_SVXPIXELCTLACCESSIBLECONTEXT_HXX
22 #include <com/sun/star/accessibility/XAccessible.hpp>
23 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
25 #include <com/sun/star/uno/Reference.hxx>
26 #include <comphelper/accessibleselectionhelper.hxx>
28 #include <rtl/ref.hxx>
29 #include <tools/gen.hxx>
32 namespace com::sun::star::awt {
33 struct Point;
34 struct Rectangle;
35 struct Size;
36 class XFocusListener;
38 class SvxPixelCtl;
39 class SvxPixelCtlAccessible;
41 typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base;
43 class SvxPixelCtlAccessibleChild final : public ::comphelper::OAccessibleComponentHelper,
44 public OAccessibleHelper_Base
46 public:
47 SvxPixelCtlAccessibleChild(
48 SvxPixelCtl& rWindow,
49 bool bPixelColorOrBG,
50 const tools::Rectangle& rBounds,
51 const rtl::Reference<SvxPixelCtlAccessible>& xParent,
52 tools::Long nIndexInParent );
54 DECLARE_XINTERFACE( )
55 DECLARE_XTYPEPROVIDER( )
57 //XAccessibleComponent
58 virtual void SAL_CALL grabFocus( ) override;
59 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
61 //XAccessibleContext
62 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
63 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
64 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
65 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
66 virtual OUString SAL_CALL getAccessibleDescription( ) override;
67 virtual OUString SAL_CALL getAccessibleName( ) override;
68 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
69 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
71 //XAccessible
72 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
74 virtual sal_Int32 SAL_CALL getForeground( ) override;
75 virtual sal_Int32 SAL_CALL getBackground( ) override;
77 void CheckChild();
78 void SelectChild( bool bSelect);
79 void ChangePixelColorOrBG(bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;}
80 OUString GetName() const;
82 private:
83 virtual ~SvxPixelCtlAccessibleChild() override;
85 virtual void SAL_CALL disposing() override;
87 // OCommonAccessibleComponent
88 /// implements the calculation of the bounding rectangle
89 virtual css::awt::Rectangle implGetBounds( ) override;
91 SvxPixelCtl& mrParentWindow;
92 rtl::Reference<SvxPixelCtlAccessible> mxParent;
93 bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color
94 tools::Rectangle maBoundingBox;
95 /// index of child in parent
96 tools::Long mnIndexInParent;
99 class SvxPixelCtlAccessible final : public ::comphelper::OAccessibleSelectionHelper,
100 public OAccessibleHelper_Base
102 public:
103 SvxPixelCtlAccessible(SvxPixelCtl* pPixelCtl);
105 DECLARE_XINTERFACE( )
106 DECLARE_XTYPEPROVIDER( )
108 //XAccessibleComponent
109 virtual void SAL_CALL grabFocus( ) override;
110 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
112 //XAccessible
113 //XAccessibleContext
114 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
115 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
116 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
117 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
118 virtual OUString SAL_CALL getAccessibleDescription( ) override;
119 virtual OUString SAL_CALL getAccessibleName( ) override;
120 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
121 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
123 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
124 virtual sal_Int32 SAL_CALL getForeground( ) override;
125 virtual sal_Int32 SAL_CALL getBackground( ) override;
127 css::uno::Reference< css::accessibility::XAccessible >
128 CreateChild (tools::Long nIndex, Point mPoint);
130 private:
131 virtual ~SvxPixelCtlAccessible() override;
133 // OCommonAccessibleSelection
134 // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
135 virtual bool implIsSelected(sal_Int32 nAccessibleChildIndex) override;
137 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
138 virtual void implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect) override;
140 // OCommonAccessibleComponent
141 virtual css::awt::Rectangle implGetBounds() override;
143 virtual void SAL_CALL disposing() override;
145 SvxPixelCtl* mpPixelCtl;
146 css::uno::Reference< css::accessibility::XAccessible> m_xCurChild;
148 public:
149 void NotifyChild(tools::Long nIndex, bool bSelect, bool bCheck);
152 #endif
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */