/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX #define INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX #include #include #include #include #include #include namespace comphelper { //= OCommonAccessibleComponent /** base class encapsulating common functionality for the helper classes implementing the XAccessibleComponent respectively XAccessibleExtendendComponent */ class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent : public OAccessibleContextHelper { protected: /// see the respective base class ctor for an extensive comment on this, please OCommonAccessibleComponent(); virtual ~OCommonAccessibleComponent() override; protected: /// implements the calculation of the bounding rectangle - still waiting to be overwritten /// /// @throws css::uno::RuntimeException virtual css::awt::Rectangle implGetBounds( ) = 0; protected: /** non-virtual versions of the methods which can be implemented using implGetBounds note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()), which itself implements XAccessibleComponent @throws css::uno::RuntimeException */ bool containsPoint( const css::awt::Point& aPoint ); /// @throws css::uno::RuntimeException css::awt::Point getLocation( ); /// @throws css::uno::RuntimeException css::awt::Point getLocationOnScreen( ); /// @throws css::uno::RuntimeException css::awt::Size getSize( ); /// @throws css::uno::RuntimeException css::awt::Rectangle getBounds( ); }; //= OAccessibleComponentHelper struct OAccessibleComponentHelper_Base : public ::cppu::ImplHelper1< css::accessibility::XAccessibleComponent > { protected: ~OAccessibleComponentHelper_Base() {} }; /** a helper class for implementing an AccessibleContext which at the same time supports an XAccessibleComponent interface. */ class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper :public OCommonAccessibleComponent ,public OAccessibleComponentHelper_Base { protected: OAccessibleComponentHelper(); public: // XInterface DECLARE_XINTERFACE( ) DECLARE_XTYPEPROVIDER( ) // XAccessibleComponent - default implementations virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override; virtual css::awt::Point SAL_CALL getLocation( ) override; virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; virtual css::awt::Size SAL_CALL getSize( ) override; virtual css::awt::Rectangle SAL_CALL getBounds( ) override; }; //= OAccessibleExtendedComponentHelper typedef ::cppu::ImplHelper1 < css::accessibility::XAccessibleExtendedComponent > OAccessibleExtendedComponentHelper_Base; /** a helper class for implementing an AccessibleContext which at the same time supports an XAccessibleExtendedComponent interface. */ class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper :public OCommonAccessibleComponent ,public OAccessibleExtendedComponentHelper_Base { protected: OAccessibleExtendedComponentHelper( ); public: // XInterface DECLARE_XINTERFACE( ) DECLARE_XTYPEPROVIDER( ) // XAccessibleComponent - default implementations virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override; virtual css::awt::Point SAL_CALL getLocation( ) override; virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; virtual css::awt::Size SAL_CALL getSize( ) override; virtual css::awt::Rectangle SAL_CALL getBounds( ) override; }; } // namespace comphelper #endif // INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ion> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2025-01-02Drop unneeded forward declarations from chart2 moduleGabor Kelemen
test drive the new bin/find-unneeded-includes --fwdecl mode Change-Id: I9fd1148e8cff3ebda4595820af5fc824f530245c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178967 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2023-09-02use more concrete type in AccessibleChartViewNoel Grandin
Change-Id: I1ec6c7bdd0f7ab487ba1ade89cd545f5bc97f540 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156466 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-14use more concrete types in chartNoel Grandin
Change-Id: I23888f636e36f6163405603a542a2f2f12eefa1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145488 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-02[API CHANGE] tdf#150683 a11y: Switch a11y child index to 64 bitMichael Weghorn
With 16k column support in Calc enabled by default in commit 4c5f8ccf0a2320432b8fe91add1dcadf54d9fd58 Date: Tue Mar 8 12:44:49 2022 +0100 change default Calc number of columns to 16384 (tdf#50916) , the number of Calc cells in a spreadsheet is larger than SAL_MAX_INT32, meaning that a 32-bit a11y child index is no more enough and using it resulted in integer overflows in methods handling corresponding Calc cells in the a11y layer. This e.g. had the effect of the Orca and NVDA screen readers not announcing focused or selected cells properly when their a11y child index was out of the 32-bit integer range. Switch the internal a11y child indices to 64 bit to be able to handle this properly internally. Since the platform APIs (at least AT-SPI on Linux and IAccessible2 on Windows; from what I can see LO's macOS a11y bridge doesn't directly expose the child index) are still restricted to 32 bit, larger child indices still cannot be exposed via the platform APIs. As a consequence, use of the the IAccessible2 and AT-SPI methods that use the child index remains problematic in those cases where the child index is larger. However, as an alternative to using the AT-SPI Table interface and the IAccessibleTable/ IAccessibleTable2 interfaces with the child index to retrieve information about a specific cell, both AT-SPI and IAccessible2 also provide interfaces to retrieve that information directly from the cell object (TableCell interface for AT-SPI, IAccessibleTableCell for IAccessible2). Those interfaces are already implemented/exposed for winaccessibility (s. `CAccTable`) and the qt5/qt6/kf5 VCL plugins (s. the `QAccessibleTableCellInterface` methods implemented in `QtAccessibleInterface`). With the switch to 64-bit internal a11y child indices, these now behave correctly for cells with a child index that doesn't fit into 32 bit as well. NVDA on Windows already uses the IAccessibleTableCell interface and thus announcing focused cells works fine with this change in place. Orca on Linux currently doesn't make use of the AT-SPI TableCell interface yet, but with a suggested change to do so [1], announcement of selected cells works with the qt6 VCL plugin with a current qtbase dev branch as well - when combined with the suggested changes to implement support for the AT-SPI TableCell interface in Qt [2] [3] and the LO change based on that [4] and a fix for a nullptr dereference [5]. The gtk3 VCL plugin doesn't expose the AT-SPI TableCell interface yet, but once it does so (via `AtkTableCell`), it also works with the suggested Orca change [1] in place. (Adding that is planned for an upcoming change, works with a local WIP patch.) For handling return values that are larger than what platform APIs support, the following approach has been chosen for now: 1) When the return value is for the count of (selected) children, the maximum value N supported by the platform API is returned. (This is what `ScAccessibleTableBase::getAccessibleChildCount` did previously.) The first N elements can be accessed by their actual (selection) indices. 2) When the return value is the child/cell index, -2 is returned for objects whose index is greater than the maximum value supported by the platform API. Using a non-negative value would mean that the index would refer to *another* actually existing child. A child index of -1 on the other hand tends to be interpreted as "child is invalid" or "object isn't actually a child of its (previous) parent any more)". For the Orca case, this would result in objects with a child index of -1 not being announced, as they are considered "zombies" [6]. What's still somewhat problematic is the case where more than 2^31 children are *selected*, since access to those children still happens by the index into the selection in the platform APIs, and not all selected items are accessible this way. (Screen readers usually just retrieve the first and last element from the selection and announce those.) Orca already seems to apply different handling for the case for fully selected rows and columns, so "All cells selected" or "Columns ... to ... selected" is announced just fine even if more than 2^31 cells are selected. (Side note: While Microsoft User Interface Automation - UIA - also uses 32-bit indices, it also has specific methods in the ISelectionProvider2 interface that allow to explicitly retrieve the first and last selected item, `ISelectionProvider2::get_FirstSelectedItem` and `ISelectionProvider2::get_LastSelectedItem`, but we currently don't support UIA on Windows.) Bound checks at the beginning of the methods from the `XAccessibleContext`, `XAccessibleSelection` and `XAccessibleTable` interfaces that take a child index (or in helper methods called by those) should generally already prevent too large indices from being passed to the methods in the lower layer code that take smaller integer types. Such bound checking has been been added in various places where it wasn't present yet. If there any remaining issues of this kind that show after this commit, they can probably be solved in a similar way (s.e.g. the change to `AccessibleBrowseBox::getAccessibleChild` in this commit). A few asserts were also added at places where my understanding is that values shouldn't be larger than what is supported by a called method anyway. A test case will be added in a following change. [1] https://gitlab.gnome.org/GNOME/orca/-/merge_requests/131 [2] https://codereview.qt-project.org/c/qt/qtbase/+/428566 [3] https://codereview.qt-project.org/c/qt/qtbase/+/428567 [4] https://gerrit.libreoffice.org/c/core/+/138750 [5] https://codereview.qt-project.org/c/qt/qtbase/+/430157 [6] https://gitlab.gnome.org/GNOME/orca/-/blob/82c8542002e36e0d3d918088d583162d25136143/src/orca/script_utilities.py#L5155 Change-Id: I3af590c988b0e6754fc72545918412f39e8fea07 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139258 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2022-01-21use more concrete types in chart2, ChartModelNoel Grandin
Change-Id: I6930e09ed471592d7c8b8fb16565b355b17bffc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128731 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-01-17loplugin:finalclasses in chart2Noel Grandin
Change-Id: I6cc88d50df7a6c77285f8534de43fd0c8d251bf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128505 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-09-04tdf#124176 Use #pragma once in chart2George Bateman
This commit was carried out mostly by a Python script, source of which is at https://bugs.documentfoundation.org/show_bug.cgi?id=124176#c97. Change-Id: Ifee23b494264f895e5612952d0875cac064e4132 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100181 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-05-08compact namespace in canvas..cuiNoel Grandin
Change-Id: I7bd0c2a55b936896fcfe7e1a374871008a18618f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93706 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-06-09tdf#42949 Fix IWYU warnings in chart2/source/controller/inc/[A-G]*Gabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. A bit of fallout management was needed. Change-Id: Ibbd16ba39d58891b834ae83feaa03f0522bdbb76 Reviewed-on: https://gerrit.libreoffice.org/55241 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-10-23loplugin:includeform: chart2Stephan Bergmann
Change-Id: I5b455c684e7cd689d5160135246f3400363c7d40
2017-01-26Remove dynamic exception specificationsStephan Bergmann
...(for now, from LIBO_INTERNAL_CODE only). See the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-January/076665.html> "Dynamic Exception Specifications" for details. Most changes have been done automatically by the rewriting loplugin:dynexcspec (after enabling the rewriting mode, to be committed shortly). The way it only removes exception specs from declarations if it also sees a definition, it identified some dead declarations-w/o-definitions (that have been removed manually) and some cases where a definition appeared in multiple include files (which have also been cleaned up manually). There's also been cases of macro paramters (that were used to abstract over exception specs) that have become unused now (and been removed). Furthermore, some code needed to be cleaned up manually (avmedia/source/quicktime/ and connectivity/source/drivers/kab/), as I had no configurations available that would actually build that code. Missing @throws documentation has not been applied in such manual clean-up. Change-Id: I3408691256c9b0c12bc5332de976743626e13960 Reviewed-on: https://gerrit.libreoffice.org/33574 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-16new loplugin: useuniqueptr: chart2Noel Grandin
Change-Id: Ic029ed28fd6de8cf4ee204585c1c6e0c8a4b67ff Reviewed-on: https://gerrit.libreoffice.org/32960 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-11loplugin:expandablemethods in chart2Noel Grandin
Change-Id: Ie6650628683ec7c67359351eec0e09033f2b50cb Reviewed-on: https://gerrit.libreoffice.org/30750 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-13loplugin:override: No more need for the "MSVC dtor override" workaroundStephan Bergmann
The issue of 362d4f0cd4e50111edfae9d30c90602c37ed65a2 "Explicitly mark overriding destructors as 'virtual'" appears to no longer be a problem with MSVC 2013. (The little change in the rewriting code of compilerplugins/clang/override.cxx was necessary to prevent an endless loop when adding "override" to OOO_DLLPUBLIC_CHARTTOOLS virtual ~CloseableLifeTimeManager(); in chart2/source/inc/LifeTime.hxx, getting stuck in the leading OOO_DLLPUBLIC_CHARTTOOLS macro. Can't remember what that isAtEndOfImmediateMacroExpansion thing was originally necessary for, anyway.) Change-Id: I534c634504d7216b9bb632c2775c04eaf27e927e
2016-07-15new loplugin unnecessary overrideNoel Grandin
Change-Id: I88d3e33823d68745b98625050a8a274f9ef04bcb Reviewed-on: https://gerrit.libreoffice.org/27135 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-04-08tdf#94306 replace boost::noncopyable in chart2Jochen Nitschke
Replace with C++11 delete copy-constructur and copy-assignment. Delete default-constructors when comments suggested it. Change-Id: Ieeaf6ca998a4165d6eacf5e900c6a09aafdcfbe6 Reviewed-on: https://gerrit.libreoffice.org/23903 Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
2016-03-14com::sun::star->css in chart2Noel Grandin
Change-Id: I04320d32d6d5c54e461cfabef58645f8b772bc69
2015-12-23loplugin:unusedfields in chart2Noel Grandin
Change-Id: I8203f84ad8b138932c990032e17ea5d2daf384bb
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274