diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index ba0b5a4a7536..a514e70dd524 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -28,10 +28,12 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -261,9 +263,10 @@ class SVT_DLLPUBLIC BrowseBox ,public vcl::IAccessibleTableProvider { friend class BrowserDataWin; - friend class ::svt::BrowseBoxImpl; public: + typedef ::std::map> THeaderCellMap; + static const sal_uInt16 HandleColumnId = 0; private: @@ -342,12 +345,16 @@ private: std::stack m_aGotoStack; - ::std::unique_ptr< ::svt::BrowseBoxImpl > m_pImpl; // impl structure of the BrowseBox object - bool m_bFocusOnlyCursor; // hide cursor if we don't have the focus Color m_aCursorColor; // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor BrowserMode m_nCurrentMode; // last argument of SetMode (redundant, as our other members represent the current settings, too) + vcl::AccessibleFactoryAccess m_aFactoryAccess; + rtl::Reference m_pAccessible; + + THeaderCellMap m_aColHeaderCellMap; + THeaderCellMap m_aRowHeaderCellMap; + private: SVT_DLLPRIVATE void ExpandRowSelection( const BrowserMouseEvent& rEvt ); SVT_DLLPRIVATE void ToggleSelection(); @@ -381,6 +388,14 @@ private: SAL_DLLPRIVATE sal_uInt16 ToggleSelectedColumn(); SAL_DLLPRIVATE void SetToggledSelectedColumn(sal_uInt16 _nSelectedColumnId); + /// @see AccessibleBrowseBox::getHeaderBar + css::uno::Reference + getAccessibleHeaderBar(AccessibleBrowseBoxObjType _eObjType); + + /// @see AccessibleBrowseBox::getTable + css::uno::Reference + getAccessibleTable(); + protected: /// retrieves the XAccessible implementation associated with the BrowseBox instance SAL_DLLPRIVATE ::vcl::IAccessibleFactory& getAccessibleFactory(); diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index a368eab2407a..11f750b96b5c 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -17,12 +17,14 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include #include #include #include "datwin.hxx" +#include #include #include #include @@ -34,8 +36,8 @@ #include #include #include +#include #include -#include "brwimpl.hxx" #define SCROLL_FLAGS (ScrollFlags::Clip | ScrollFlags::NoChildren) @@ -50,7 +52,7 @@ namespace { struct THeaderCellMapFunctorDispose { - void operator()(const svt::BrowseBoxImpl::THeaderCellMap::value_type& _aType) + void operator()(const BrowseBox::THeaderCellMap::value_type& _aType) { css::uno::Reference xComp(_aType.second, css::uno::UNO_QUERY); OSL_ENSURE(xComp.is() || !_aType.second.is(), "THeaderCellMapFunctorDispose: invalid accessible cell (no XComponent)!"); @@ -66,7 +68,7 @@ namespace } }; - void disposeAndClearHeaderCell(::svt::BrowseBoxImpl::THeaderCellMap& _rHeaderCell) + void disposeAndClearHeaderCell(BrowseBox::THeaderCellMap& _rHeaderCell) { ::std::for_each( _rHeaderCell.begin(), @@ -142,7 +144,6 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode ) pColSel = nullptr; pVScroll = nullptr; pDataWin = VclPtr::Create( this ).get(); - m_pImpl.reset( new ::svt::BrowseBoxImpl() ); InitSettings_Impl( this ); InitSettings_Impl( pDataWin ); @@ -194,12 +195,12 @@ BrowseBox::~BrowseBox() void BrowseBox::DisposeAccessible() { - if (m_pImpl->m_pAccessible ) + if (m_pAccessible ) { - disposeAndClearHeaderCell(m_pImpl->m_aColHeaderCellMap); - disposeAndClearHeaderCell(m_pImpl->m_aRowHeaderCellMap); - m_pImpl->m_pAccessible->dispose(); - m_pImpl->m_pAccessible = nullptr; + disposeAndClearHeaderCell(m_aColHeaderCellMap); + disposeAndClearHeaderCell(m_aRowHeaderCellMap); + m_pAccessible->dispose(); + m_pAccessible = nullptr; } } @@ -819,13 +820,13 @@ void BrowseBox::RemoveColumns() commitBrowseBoxEvent( AccessibleEventId::CHILD, Any(), - Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)) + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)) ); // and now append it again commitBrowseBoxEvent( AccessibleEventId::CHILD, - Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)), + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar)), Any() ); @@ -1139,13 +1140,13 @@ void BrowseBox::Clear() commitBrowseBoxEvent( AccessibleEventId::CHILD, Any(), - Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ) + Any(getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar)) ); // and now append it again commitBrowseBoxEvent( AccessibleEventId::CHILD, - Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ), + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)), Any() ); @@ -1382,25 +1383,25 @@ void BrowseBox::RowRemoved( sal_Int32 nRow, sal_Int32 nNumRows, bool bDoPaint ) commitBrowseBoxEvent( AccessibleEventId::CHILD, Any(), - Any( m_pImpl->getAccessibleHeaderBar( AccessibleBrowseBoxObjType::RowHeaderBar ) ) + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)) ); // and now append it again commitBrowseBoxEvent( AccessibleEventId::CHILD, - Any(m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)), + Any(getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar)), Any() ); commitBrowseBoxEvent( AccessibleEventId::CHILD, Any(), - Any( m_pImpl->getAccessibleTable() ) + Any(getAccessibleTable()) ); // and now append it again commitBrowseBoxEvent( AccessibleEventId::CHILD, - Any( m_pImpl->getAccessibleTable() ), + Any(getAccessibleTable()), Any() ); } diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 1237060a1b89..be1a1b268c21 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -17,13 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include #include #include #include -#include "brwimpl.hxx" #include // Accessibility ============================================================== @@ -35,7 +35,7 @@ using namespace ::com::sun::star::accessibility; namespace svt { - static Reference< XAccessible > getHeaderCell( BrowseBoxImpl::THeaderCellMap& _raHeaderCells, + static Reference< XAccessible > getHeaderCell(BrowseBox::THeaderCellMap& _raHeaderCells, sal_Int32 _nPos, AccessibleBrowseBoxObjType _eType, const Reference< XAccessible >& _rParent, @@ -44,7 +44,7 @@ namespace svt ) { Reference< XAccessible > xRet; - BrowseBoxImpl::THeaderCellMap::iterator aFind = _raHeaderCells.find( _nPos ); + BrowseBox::THeaderCellMap::iterator aFind = _raHeaderCells.find(_nPos); if ( aFind == _raHeaderCells.end() ) { Reference< XAccessible > xAccessible = rFactory.createAccessibleBrowseBoxHeaderCell( @@ -60,42 +60,39 @@ namespace svt xRet = aFind->second; return xRet; } - - - Reference< XAccessible > BrowseBoxImpl::getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType ) - { - if ( m_pAccessible && m_pAccessible->isAlive() ) - return m_pAccessible->getHeaderBar( _eObjType ); - return nullptr; - } - - - Reference< XAccessible > BrowseBoxImpl::getAccessibleTable( ) - { - if ( m_pAccessible && m_pAccessible->isAlive() ) - return m_pAccessible->getTable( ); - return nullptr; - } } +Reference BrowseBox::getAccessibleHeaderBar(AccessibleBrowseBoxObjType _eObjType) +{ + if (m_pAccessible && m_pAccessible->isAlive()) + return m_pAccessible->getHeaderBar(_eObjType); + return nullptr; +} + +Reference BrowseBox::getAccessibleTable() +{ + if (m_pAccessible && m_pAccessible->isAlive()) + return m_pAccessible->getTable(); + return nullptr; +} Reference< XAccessible > BrowseBox::CreateAccessible() { vcl::Window* pParent = GetAccessibleParentWindow(); DBG_ASSERT( pParent, "BrowseBox::CreateAccessible - parent not found" ); - if( pParent && !m_pImpl->m_pAccessible) + if (pParent && !m_pAccessible) { Reference< XAccessible > xAccParent = pParent->GetAccessible(); if( xAccParent.is() ) { - m_pImpl->m_pAccessible = getAccessibleFactory().createAccessibleBrowseBox( + m_pAccessible = getAccessibleFactory().createAccessibleBrowseBox( xAccParent, *this ); } } - return m_pImpl->m_pAccessible; + return m_pAccessible; } @@ -104,10 +101,10 @@ Reference< XAccessible > BrowseBox::CreateAccessible() Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) { // BBINDEX_TABLE must be the table - OSL_ENSURE(m_pImpl->m_pAccessible,"Invalid call: Accessible is null"); + OSL_ENSURE(m_pAccessible,"Invalid call: Accessible is null"); - return m_pImpl->m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell( - m_pImpl->getAccessibleTable(), + return m_aFactoryAccess.getFactory().createAccessibleBrowseBoxTableCell( + getAccessibleTable(), *this, nullptr, _nRow, @@ -120,12 +117,12 @@ Reference< XAccessible > BrowseBox::CreateAccessibleCell( sal_Int32 _nRow, sal_u Reference< XAccessible > BrowseBox::CreateAccessibleRowHeader( sal_Int32 _nRow ) { return svt::getHeaderCell( - m_pImpl->m_aRowHeaderCellMap, + m_aRowHeaderCellMap, _nRow, AccessibleBrowseBoxObjType::RowHeaderCell, - m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar), + getAccessibleHeaderBar(AccessibleBrowseBoxObjType::RowHeaderBar), *this, - m_pImpl->m_aFactoryAccess.getFactory() + m_aFactoryAccess.getFactory() ); } @@ -133,12 +130,12 @@ Reference< XAccessible > BrowseBox::CreateAccessibleRowHeader( sal_Int32 _nRow ) Reference< XAccessible > BrowseBox::CreateAccessibleColumnHeader( sal_uInt16 _nColumnPos ) { return svt::getHeaderCell( - m_pImpl->m_aColHeaderCellMap, + m_aColHeaderCellMap, _nColumnPos, AccessibleBrowseBoxObjType::ColumnHeaderCell, - m_pImpl->getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar), + getAccessibleHeaderBar(AccessibleBrowseBoxObjType::ColumnHeaderBar), *this, - m_pImpl->m_aFactoryAccess.getFactory() + m_aFactoryAccess.getFactory() ); } @@ -398,30 +395,30 @@ void BrowseBox::commitHeaderBarEvent(sal_Int16 nEventId, const Any& rNewValue, const Any& rOldValue, bool _bColumnHeaderBar ) { if ( isAccessibleAlive() ) - m_pImpl->m_pAccessible->commitHeaderBarEvent( nEventId, + m_pAccessible->commitHeaderBarEvent( nEventId, rNewValue, rOldValue, _bColumnHeaderBar ); } void BrowseBox::commitTableEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) { if ( isAccessibleAlive() ) - m_pImpl->m_pAccessible->commitTableEvent( _nEventId, _rNewValue, _rOldValue ); + m_pAccessible->commitTableEvent(_nEventId, _rNewValue, _rOldValue); } void BrowseBox::commitBrowseBoxEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) { if ( isAccessibleAlive() ) - m_pImpl->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); + m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue); } ::vcl::IAccessibleFactory& BrowseBox::getAccessibleFactory() { - return m_pImpl->m_aFactoryAccess.getFactory(); + return m_aFactoryAccess.getFactory(); } bool BrowseBox::isAccessibleAlive( ) const { - return m_pImpl->m_pAccessible && m_pImpl->m_pAccessible->isAlive(); + return m_pAccessible && m_pAccessible->isAlive(); } // IAccessibleTableProvider diff --git a/svtools/source/brwbox/brwimpl.hxx b/svtools/source/brwbox/brwimpl.hxx deleted file mode 100644 index 6ce6fee6ed3c..000000000000 --- a/svtools/source/brwbox/brwimpl.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- 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 . - */ -#pragma once - -#include -#include -#include -#include -#include -#include - -#include - -namespace svt -{ - class BrowseBoxImpl - { - // member - public: - typedef ::std::map< sal_Int32, css::uno::Reference< css::accessibility::XAccessible > > THeaderCellMap; - - public: - vcl::AccessibleFactoryAccess m_aFactoryAccess; - rtl::Reference m_pAccessible; - THeaderCellMap m_aColHeaderCellMap; - THeaderCellMap m_aRowHeaderCellMap; - - public: - BrowseBoxImpl() - { - } - - - /// @see AccessibleBrowseBox::getHeaderBar - css::uno::Reference< css::accessibility::XAccessible > - getAccessibleHeaderBar( AccessibleBrowseBoxObjType _eObjType ); - - /// @see AccessibleBrowseBox::getTable - css::uno::Reference< css::accessibility::XAccessible > - getAccessibleTable( ); - - }; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */