LibreOffice Module dbaccess (master) 1
JAccess.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <JAccess.hxx>
21#include <JoinTableView.hxx>
22#include <TableWindow.hxx>
23#include <com/sun/star/accessibility/AccessibleRole.hpp>
24#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
25#include <TableConnection.hxx>
26#include <o3tl/safeint.hxx>
27
28namespace dbaui
29{
30 using namespace ::com::sun::star::accessibility;
31 using namespace ::com::sun::star::uno;
32 using namespace ::com::sun::star::beans;
33 using namespace ::com::sun::star::lang;
34
36 :ImplInheritanceHelper(_pTableView->GetComponentInterface().is() ? _pTableView->GetWindowPeer() : nullptr)
37 ,m_pTableView(_pTableView)
38 {
39 }
41 {
42 return "org.openoffice.comp.dbu.JoinViewAccessibility";
43 }
45 {
46 ::osl::MutexGuard aGuard( m_aMutex );
47 m_pTableView = nullptr;
48 }
49 // XAccessibleContext
51 {
52 // TODO may be this will change to only visible windows
53 // this is the same assumption mt implements
54 ::osl::MutexGuard aGuard( m_aMutex );
55 sal_Int64 nChildCount = 0;
56 if ( m_pTableView )
57 nChildCount = m_pTableView->GetTabWinCount() + m_pTableView->getTableConnections().size();
58 return nChildCount;
59 }
61 {
63 ::osl::MutexGuard aGuard( m_aMutex );
64 if(i < 0 || i >= getAccessibleChildCount() || !m_pTableView)
65 throw IndexOutOfBoundsException();
66 // check if we should return a table window or a connection
67 sal_Int64 nTableWindowCount = m_pTableView->GetTabWinCount();
68 if( i < nTableWindowCount )
69 {
70 OJoinTableView::OTableWindowMap::const_iterator aIter = std::next(m_pTableView->GetTabWinMap().begin(), i);
71 aRet = aIter->second->GetAccessible();
72 }
73 else if( o3tl::make_unsigned(i - nTableWindowCount) < m_pTableView->getTableConnections().size() )
74 aRet = m_pTableView->getTableConnections()[i - nTableWindowCount]->GetAccessible();
75 return aRet;
76 }
78 {
79 return AccessibleRole::VIEW_PORT;
80 }
82 {
83 return this;
84 }
85}
86
87/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
Definition: JAccess.cxx:81
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
Definition: JAccess.cxx:60
virtual OUString SAL_CALL getImplementationName() override
Definition: JAccess.cxx:40
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
Definition: JAccess.cxx:50
OJoinDesignViewAccess(OJoinTableView *_pTableView)
OJoinDesignViewAccess needs a valid view.
Definition: JAccess.cxx:35
virtual sal_Int16 SAL_CALL getAccessibleRole() override
Definition: JAccess.cxx:77
VclPtr< OJoinTableView > m_pTableView
Definition: JAccess.hxx:34
std::mutex m_aMutex
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)