Avoid potential negative array index access to cached text.
[LibreOffice.git] / accessibility / inc / extended / accessibleeditbrowseboxcell.hxx
blob615266637b32d73235f325f470a4747b5d568720
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 #pragma once
21 #include <extended/accessiblebrowseboxcell.hxx>
22 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
23 #include <comphelper/compbase.hxx>
24 #include <comphelper/accessiblewrapper.hxx>
26 namespace accessibility
29 // = EditBrowseBoxTableCell
31 class EditBrowseBoxTableCell final : public AccessibleBrowseBoxCell
32 ,public ::comphelper::OAccessibleContextWrapperHelper
34 public:
35 EditBrowseBoxTableCell(
36 const css::uno::Reference< css::accessibility::XAccessible >& _rxParent,
37 const css::uno::Reference< css::accessibility::XAccessible >& _rxOwningAccessible,
38 const css::uno::Reference< css::accessibility::XAccessibleContext >& _xControlChild,
39 ::vcl::IAccessibleTableProvider& _rBrowseBox,
40 const css::uno::Reference< css::awt::XWindow >& _xFocusWindow,
41 sal_Int32 _nRowPos,
42 sal_uInt16 _nColPos
45 private:
46 virtual ~EditBrowseBoxTableCell() override;
48 // XAccessibleComponent
49 virtual sal_Int32 SAL_CALL getForeground( ) override ;
50 virtual sal_Int32 SAL_CALL getBackground( ) override ;
52 // XServiceInfo
53 virtual OUString SAL_CALL getImplementationName() override;
55 // XInterface
56 DECLARE_XINTERFACE( )
57 // XTypeProvider
58 DECLARE_XTYPEPROVIDER( )
60 // XAccessibleContext
61 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
62 virtual OUString SAL_CALL getAccessibleDescription( ) override;
63 virtual OUString SAL_CALL getAccessibleName( ) override;
64 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
65 virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override;
67 sal_Int16 SAL_CALL getAccessibleRole() override;
69 virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
70 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
72 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
74 // OComponentHelper
75 virtual void SAL_CALL disposing() override;
77 // XComponent/OComponentProxyAggregationHelper (needs to be disambiguated)
78 virtual void SAL_CALL dispose() final override;
80 // OAccessibleContextWrapperHelper();
81 void notifyTranslatedEvent( const css::accessibility::AccessibleEventObject& _rEvent ) override;
83 EditBrowseBoxTableCell( const EditBrowseBoxTableCell& ) = delete;
84 EditBrowseBoxTableCell& operator=( const EditBrowseBoxTableCell& ) = delete;
88 // = EditBrowseBoxTableCell
90 // XAccessible providing an EditBrowseBoxTableCell
91 class EditBrowseBoxTableCellAccess final :
92 public comphelper::WeakComponentImplHelper<css::accessibility::XAccessible>
94 css::uno::WeakReference< css::accessibility::XAccessibleContext >
95 m_aContext;
96 css::uno::Reference< css::accessibility::XAccessible >
97 m_xParent;
98 css::uno::Reference< css::accessibility::XAccessible >
99 m_xControlAccessible;
100 css::uno::Reference< css::awt::XWindow >
101 m_xFocusWindow;
102 ::vcl::IAccessibleTableProvider* m_pBrowseBox;
103 sal_Int32 m_nRowPos;
104 sal_uInt16 m_nColPos;
106 public:
107 EditBrowseBoxTableCellAccess(
108 css::uno::Reference< css::accessibility::XAccessible > _xParent,
109 css::uno::Reference< css::accessibility::XAccessible > _xControlAccessible,
110 css::uno::Reference< css::awt::XWindow > _xFocusWindow,
111 ::vcl::IAccessibleTableProvider& _rBrowseBox,
112 sal_Int32 _nRowPos,
113 sal_uInt16 _nColPos
116 private:
117 virtual ~EditBrowseBoxTableCellAccess() override;
119 // XAccessible
120 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
122 // XComponent/WeakComponentImplHelper
123 virtual void disposing(std::unique_lock<std::mutex>&) override;
125 EditBrowseBoxTableCellAccess( const EditBrowseBoxTableCellAccess& ) = delete;
126 EditBrowseBoxTableCellAccess& operator=( const EditBrowseBoxTableCellAccess& ) = delete;
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */