1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
{
39 class SvxPixelCtlAccessible
;
41 typedef ::cppu::ImplHelper1
<css::accessibility::XAccessible
> OAccessibleHelper_Base
;
43 class SvxPixelCtlAccessibleChild final
: public ::comphelper::OAccessibleComponentHelper
,
44 public OAccessibleHelper_Base
47 SvxPixelCtlAccessibleChild(
50 const tools::Rectangle
& rBounds
,
51 const rtl::Reference
<SvxPixelCtlAccessible
>& xParent
,
52 tools::Long nIndexInParent
);
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
;
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
;
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
;
78 void SelectChild( bool bSelect
);
79 void ChangePixelColorOrBG(bool bPixelColorOrBG
){ m_bPixelColorOrBG
= bPixelColorOrBG
;}
80 OUString
GetName() const;
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
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
;
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
);
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
;
149 void NotifyChild(tools::Long nIndex
, bool bSelect
, bool bCheck
);
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */