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>
27 #include <cppuhelper/implbase.hxx>
29 #include <rtl/ref.hxx>
30 #include <tools/gen.hxx>
33 namespace com::sun::star::awt
{
40 class SvxPixelCtlAccessible
;
42 class SvxPixelCtlAccessibleChild final
: public cppu::ImplInheritanceHelper
<
43 ::comphelper::OAccessibleComponentHelper
,
44 css::accessibility::XAccessible
>
47 SvxPixelCtlAccessibleChild(
50 const tools::Rectangle
& rBounds
,
51 rtl::Reference
<SvxPixelCtlAccessible
> xParent
,
52 tools::Long nIndexInParent
);
54 //XAccessibleComponent
55 virtual void SAL_CALL
grabFocus( ) override
;
56 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) override
;
59 virtual sal_Int64 SAL_CALL
getAccessibleChildCount( ) override
;
60 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int64 i
) override
;
61 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) override
;
62 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) override
;
63 virtual OUString SAL_CALL
getAccessibleDescription( ) override
;
64 virtual OUString SAL_CALL
getAccessibleName( ) override
;
65 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) override
;
66 virtual sal_Int64 SAL_CALL
getAccessibleStateSet( ) override
;
69 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) override
;
71 virtual sal_Int32 SAL_CALL
getForeground( ) override
;
72 virtual sal_Int32 SAL_CALL
getBackground( ) override
;
75 void SelectChild( bool bSelect
);
76 void ChangePixelColorOrBG(bool bPixelColorOrBG
){ m_bPixelColorOrBG
= bPixelColorOrBG
;}
77 OUString
GetName() const;
80 virtual ~SvxPixelCtlAccessibleChild() override
;
82 virtual void SAL_CALL
disposing() override
;
84 // OCommonAccessibleComponent
85 /// implements the calculation of the bounding rectangle
86 virtual css::awt::Rectangle
implGetBounds( ) override
;
88 SvxPixelCtl
& mrParentWindow
;
89 rtl::Reference
<SvxPixelCtlAccessible
> mxParent
;
90 bool m_bPixelColorOrBG
;//Pixel Color Or BackGround Color
91 tools::Rectangle maBoundingBox
;
92 /// index of child in parent
93 tools::Long mnIndexInParent
;
96 class SvxPixelCtlAccessible final
: public cppu::ImplInheritanceHelper
<
97 ::comphelper::OAccessibleSelectionHelper
,
98 css::accessibility::XAccessible
>
101 SvxPixelCtlAccessible(SvxPixelCtl
* pPixelCtl
);
103 //XAccessibleComponent
104 virtual void SAL_CALL
grabFocus( ) override
;
105 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& aPoint
) override
;
109 virtual sal_Int64 SAL_CALL
getAccessibleChildCount( ) override
;
110 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleChild( sal_Int64 i
) override
;
111 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
getAccessibleParent( ) override
;
112 virtual sal_Int16 SAL_CALL
getAccessibleRole( ) override
;
113 virtual OUString SAL_CALL
getAccessibleDescription( ) override
;
114 virtual OUString SAL_CALL
getAccessibleName( ) override
;
115 virtual css::uno::Reference
< css::accessibility::XAccessibleRelationSet
> SAL_CALL
getAccessibleRelationSet( ) override
;
116 virtual sal_Int64 SAL_CALL
getAccessibleStateSet( ) override
;
118 virtual css::uno::Reference
< css::accessibility::XAccessibleContext
> SAL_CALL
getAccessibleContext( ) override
;
119 virtual sal_Int32 SAL_CALL
getForeground( ) override
;
120 virtual sal_Int32 SAL_CALL
getBackground( ) override
;
122 rtl::Reference
<SvxPixelCtlAccessibleChild
>
123 CreateChild (tools::Long nIndex
, Point mPoint
);
126 virtual ~SvxPixelCtlAccessible() override
;
128 // OCommonAccessibleSelection
129 // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
130 virtual bool implIsSelected(sal_Int64 nAccessibleChildIndex
) override
;
132 // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
133 virtual void implSelect(sal_Int64 nAccessibleChildIndex
, bool bSelect
) override
;
135 // OCommonAccessibleComponent
136 virtual css::awt::Rectangle
implGetBounds() override
;
138 virtual void SAL_CALL
disposing() override
;
140 SvxPixelCtl
* mpPixelCtl
;
141 rtl::Reference
<SvxPixelCtlAccessibleChild
> m_xCurChild
;
144 void NotifyChild(tools::Long nIndex
, bool bSelect
, bool bCheck
);
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */