diff options
author | Arnaud Versini <arnaud.versini@gmail.com> | 2018-02-25 12:25:18 +0100 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-25 16:22:34 +0100 |
commit | 6d7c82a57377a6d8c13e3c990466232cbec7e4f9 (patch) | |
tree | 76685c96bbaa9512d0335ba9a93b7d79446a1c6a /accessibility/source | |
parent | 5fb3a3ef3ec37926c715c0944873f8612eb25519 (diff) |
accessibility : remove useless Impl pattern
Change-Id: I6a3744b742db12ded79d273d49b041c578eccab6
Reviewed-on: https://gerrit.libreoffice.org/50302
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'accessibility/source')
-rw-r--r-- | accessibility/source/extended/AccessibleBrowseBox.cxx | 67 | ||||
-rw-r--r-- | accessibility/source/extended/AccessibleGridControl.cxx | 116 |
2 files changed, 71 insertions, 112 deletions
diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx index 26cd089226aa..74f9f5903112 100644 --- a/accessibility/source/extended/AccessibleBrowseBox.cxx +++ b/accessibility/source/extended/AccessibleBrowseBox.cxx @@ -34,43 +34,24 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::accessibility; using namespace ::svt; - -class AccessibleBrowseBoxImpl -{ -public: - /// the css::accessibility::XAccessible which created the AccessibleBrowseBox - css::uno::WeakReference< css::accessibility::XAccessible > m_aCreator; - - /** The data table child. */ - rtl::Reference<AccessibleBrowseBoxTable> mxTable; - - /** The header bar for rows ("handle column"). */ - rtl::Reference<AccessibleBrowseBoxHeaderBar> mxRowHeaderBar; - - /** The header bar for columns (first row of the table). */ - rtl::Reference<AccessibleBrowseBoxHeaderBar> mxColumnHeaderBar; -}; - // Ctor/Dtor/disposing AccessibleBrowseBox::AccessibleBrowseBox( const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, const css::uno::Reference< css::accessibility::XAccessible >& _rxCreator, ::svt::IAccessibleTableProvider& _rBrowseBox ) - : AccessibleBrowseBoxBase( _rxParent, _rBrowseBox,nullptr, BBTYPE_BROWSEBOX ) + : AccessibleBrowseBoxBase( _rxParent, _rBrowseBox,nullptr, BBTYPE_BROWSEBOX ), + m_aCreator(_rxCreator) { - m_xImpl.reset( new AccessibleBrowseBoxImpl ); - m_xImpl->m_aCreator = _rxCreator; - m_xFocusWindow = VCLUnoHelper::GetInterface(mpBrowseBox->GetWindowInstance()); } void AccessibleBrowseBox::setCreator( const css::uno::Reference< css::accessibility::XAccessible >& _rxCreator ) { #if OSL_DEBUG_LEVEL > 0 - css::uno::Reference< css::accessibility::XAccessible > xCreator(m_xImpl->m_aCreator); + css::uno::Reference< css::accessibility::XAccessible > xCreator(m_aCreator); OSL_ENSURE( !xCreator.is(), "extended/AccessibleBrowseBox::setCreator: creator already set!" ); #endif - m_xImpl->m_aCreator = _rxCreator; + m_aCreator = _rxCreator; } @@ -83,22 +64,22 @@ void SAL_CALL AccessibleBrowseBox::disposing() { ::osl::MutexGuard aGuard( getMutex() ); - m_xImpl->m_aCreator.clear(); + m_aCreator.clear(); - if ( m_xImpl->mxTable.is() ) + if ( mxTable.is() ) { - m_xImpl->mxTable->dispose(); - m_xImpl->mxTable.clear(); + mxTable->dispose(); + mxTable.clear(); } - if ( m_xImpl->mxRowHeaderBar.is() ) + if ( mxRowHeaderBar.is() ) { - m_xImpl->mxRowHeaderBar->dispose(); - m_xImpl->mxRowHeaderBar.clear(); + mxRowHeaderBar->dispose(); + mxRowHeaderBar.clear(); } - if ( m_xImpl->mxColumnHeaderBar.is() ) + if ( mxColumnHeaderBar.is() ) { - m_xImpl->mxColumnHeaderBar->dispose(); - m_xImpl->mxColumnHeaderBar.clear(); + mxColumnHeaderBar->dispose(); + mxColumnHeaderBar.clear(); } AccessibleBrowseBoxBase::disposing(); @@ -209,12 +190,12 @@ tools::Rectangle AccessibleBrowseBox::implGetBoundingBoxOnScreen() css::uno::Reference< css::accessibility::XAccessible > AccessibleBrowseBox::implGetTable() { - if( !m_xImpl->mxTable.is() ) + if( !mxTable.is() ) { - m_xImpl->mxTable = createAccessibleTable(); + mxTable = createAccessibleTable(); } - return m_xImpl->mxTable.get(); + return mxTable.get(); } @@ -225,16 +206,16 @@ AccessibleBrowseBox::implGetHeaderBar( AccessibleBrowseBoxObjType eObjType ) rtl::Reference< AccessibleBrowseBoxHeaderBar >* pxMember = nullptr; if( eObjType == BBTYPE_ROWHEADERBAR ) - pxMember = &m_xImpl->mxRowHeaderBar; + pxMember = &mxRowHeaderBar; else if( eObjType == BBTYPE_COLUMNHEADERBAR ) - pxMember = &m_xImpl->mxColumnHeaderBar; + pxMember = &mxColumnHeaderBar; if( pxMember ) { if( !pxMember->is() ) { AccessibleBrowseBoxHeaderBar* pHeaderBar = new AccessibleBrowseBoxHeaderBar( - m_xImpl->m_aCreator, *mpBrowseBox, eObjType ); + m_aCreator, *mpBrowseBox, eObjType ); *pxMember = pHeaderBar; } xRet = pxMember->get(); @@ -264,16 +245,16 @@ AccessibleBrowseBox::implGetFixedChild( sal_Int32 nChildIndex ) AccessibleBrowseBoxTable* AccessibleBrowseBox::createAccessibleTable() { - css::uno::Reference< css::accessibility::XAccessible > xCreator(m_xImpl->m_aCreator); + css::uno::Reference< css::accessibility::XAccessible > xCreator(m_aCreator); OSL_ENSURE( xCreator.is(), "extended/AccessibleBrowseBox::createAccessibleTable: my creator died - how this?" ); return new AccessibleBrowseBoxTable( xCreator, *mpBrowseBox ); } void AccessibleBrowseBox::commitTableEvent(sal_Int16 _nEventId,const Any& _rNewValue,const Any& _rOldValue) { - if ( m_xImpl->mxTable.is() ) + if ( mxTable.is() ) { - m_xImpl->mxTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + mxTable->commitEvent(_nEventId,_rNewValue,_rOldValue); } } @@ -281,7 +262,7 @@ void AccessibleBrowseBox::commitHeaderBarEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue,bool _bColumnHeaderBar) { - rtl::Reference< AccessibleBrowseBoxHeaderBar >& xHeaderBar = _bColumnHeaderBar ? m_xImpl->mxColumnHeaderBar : m_xImpl->mxRowHeaderBar; + rtl::Reference< AccessibleBrowseBoxHeaderBar >& xHeaderBar = _bColumnHeaderBar ? mxColumnHeaderBar : mxRowHeaderBar; if ( xHeaderBar.is() ) xHeaderBar->commitEvent(_nEventId,_rNewValue,_rOldValue); } diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx index 696aa9de61ea..d9a2bd694d9f 100644 --- a/accessibility/source/extended/AccessibleGridControl.cxx +++ b/accessibility/source/extended/AccessibleGridControl.cxx @@ -39,34 +39,12 @@ using namespace ::com::sun::star::accessibility; using namespace ::svt; using namespace ::svt::table; - -class AccessibleGridControl_Impl -{ -public: - /// the css::accessibility::XAccessible which created the AccessibleGridControl - css::uno::WeakReference< css::accessibility::XAccessible > m_aCreator; - - /** The data table child. */ - rtl::Reference<AccessibleGridControlTable> m_xTable; - - /** The header bar for rows. */ - rtl::Reference<AccessibleGridControlHeader> m_xRowHeaderBar; - - /** The header bar for columns (first row of the table). */ - rtl::Reference<AccessibleGridControlHeader> m_xColumnHeaderBar; - - /** The table cell child. */ - rtl::Reference<AccessibleGridControlTableCell> m_xCell; - -}; - AccessibleGridControl::AccessibleGridControl( const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, const css::uno::Reference< css::accessibility::XAccessible >& _rxCreator, ::svt::table::IAccessibleTable& _rTable ) - : AccessibleGridControlBase( _rxParent, _rTable, TCTYPE_GRIDCONTROL ) + : AccessibleGridControlBase( _rxParent, _rTable, TCTYPE_GRIDCONTROL ), + m_aCreator(_rxCreator) { - m_xImpl.reset( new AccessibleGridControl_Impl ); - m_xImpl->m_aCreator = _rxCreator; } @@ -79,27 +57,27 @@ void SAL_CALL AccessibleGridControl::disposing() { SolarMutexGuard g; - m_xImpl->m_aCreator.clear(); + m_aCreator.clear(); - if ( m_xImpl->m_xTable.is() ) + if ( m_xTable.is() ) { - m_xImpl->m_xTable->dispose(); - m_xImpl->m_xTable.clear(); + m_xTable->dispose(); + m_xTable.clear(); } - if ( m_xImpl->m_xCell.is() ) + if ( m_xCell.is() ) { - m_xImpl->m_xCell->dispose(); - m_xImpl->m_xCell.clear(); + m_xCell->dispose(); + m_xCell.clear(); } - if ( m_xImpl->m_xRowHeaderBar.is() ) + if ( m_xRowHeaderBar.is() ) { - m_xImpl->m_xRowHeaderBar->dispose(); - m_xImpl->m_xRowHeaderBar.clear(); + m_xRowHeaderBar->dispose(); + m_xRowHeaderBar.clear(); } - if ( m_xImpl->m_xColumnHeaderBar.is() ) + if ( m_xColumnHeaderBar.is() ) { - m_xImpl->m_xColumnHeaderBar->dispose(); - m_xImpl->m_xColumnHeaderBar.clear(); + m_xColumnHeaderBar->dispose(); + m_xColumnHeaderBar.clear(); } AccessibleGridControlBase::disposing(); } @@ -128,27 +106,27 @@ AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex ) { if(nChildIndex == 0 && m_aTable.HasColHeader()) { - if(!m_xImpl->m_xColumnHeaderBar.is()) + if(!m_xColumnHeaderBar.is()) { - m_xImpl->m_xColumnHeaderBar = new AccessibleGridControlHeader(m_xImpl->m_aCreator, m_aTable, svt::table::TCTYPE_COLUMNHEADERBAR); + m_xColumnHeaderBar = new AccessibleGridControlHeader(m_aCreator, m_aTable, svt::table::TCTYPE_COLUMNHEADERBAR); } - xChild = m_xImpl->m_xColumnHeaderBar.get(); + xChild = m_xColumnHeaderBar.get(); } else if(m_aTable.HasRowHeader() && (nChildIndex == 1 || nChildIndex == 0)) { - if(!m_xImpl->m_xRowHeaderBar.is()) + if(!m_xRowHeaderBar.is()) { - m_xImpl->m_xRowHeaderBar = new AccessibleGridControlHeader(m_xImpl->m_aCreator, m_aTable, svt::table::TCTYPE_ROWHEADERBAR); + m_xRowHeaderBar = new AccessibleGridControlHeader(m_aCreator, m_aTable, svt::table::TCTYPE_ROWHEADERBAR); } - xChild = m_xImpl->m_xRowHeaderBar.get(); + xChild = m_xRowHeaderBar.get(); } else { - if(!m_xImpl->m_xTable.is()) + if(!m_xTable.is()) { - m_xImpl->m_xTable = new AccessibleGridControlTable(m_xImpl->m_aCreator, m_aTable); + m_xTable = new AccessibleGridControlTable(m_aCreator, m_aTable); } - xChild = m_xImpl->m_xTable.get(); + xChild = m_xTable.get(); } } return xChild; @@ -229,11 +207,11 @@ tools::Rectangle AccessibleGridControl::implGetBoundingBoxOnScreen() css::uno::Reference< css::accessibility::XAccessible > AccessibleGridControl::implGetTable() { - if( !m_xImpl->m_xTable.is() ) + if( !m_xTable.is() ) { - m_xImpl->m_xTable = createAccessibleTable(); + m_xTable = createAccessibleTable(); } - return m_xImpl->m_xTable.get(); + return m_xTable.get(); } @@ -244,16 +222,16 @@ AccessibleGridControl::implGetHeaderBar( AccessibleTableControlObjType eObjType rtl::Reference< AccessibleGridControlHeader >* pxMember = nullptr; if( eObjType == TCTYPE_ROWHEADERBAR ) - pxMember = &m_xImpl->m_xRowHeaderBar; + pxMember = &m_xRowHeaderBar; else if( eObjType == TCTYPE_COLUMNHEADERBAR ) - pxMember = &m_xImpl->m_xColumnHeaderBar; + pxMember = &m_xColumnHeaderBar; if( pxMember ) { if( !pxMember->is() ) { *pxMember = new AccessibleGridControlHeader( - m_xImpl->m_aCreator, m_aTable, eObjType ); + m_aCreator, m_aTable, eObjType ); } xRet = pxMember->get(); } @@ -284,7 +262,7 @@ AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex ) AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable() { - css::uno::Reference< css::accessibility::XAccessible > xCreator(m_xImpl->m_aCreator); + css::uno::Reference< css::accessibility::XAccessible > xCreator(m_aCreator); OSL_ENSURE( xCreator.is(), "extended/AccessibleGridControl::createAccessibleTable: my creator died - how this?" ); return new AccessibleGridControlTable( xCreator, m_aTable ); } @@ -297,30 +275,30 @@ void AccessibleGridControl::commitCellEvent(sal_Int16 _nEventId,const Any& _rNew for(sal_Int32 i=0;i<nChildCount;i++) { css::uno::Reference< css::accessibility::XAccessible > xAccessible = getAccessibleChild(i); - if(css::uno::Reference< css::accessibility::XAccessible >(m_xImpl->m_xTable.get()) == xAccessible) + if(css::uno::Reference< css::accessibility::XAccessible >(m_xTable.get()) == xAccessible) { std::vector< AccessibleGridControlTableCell* >& rCells = - m_xImpl->m_xTable->getCellVector(); + m_xTable->getCellVector(); size_t nIndex = m_aTable.GetCurrentRow() * m_aTable.GetColumnCount() + m_aTable.GetCurrentColumn(); if (nIndex < rCells.size() && rCells[nIndex]) { - m_xImpl->m_xCell = rCells[nIndex]; - m_xImpl->m_xCell->commitEvent( _nEventId, _rNewValue, _rOldValue ); + m_xCell = rCells[nIndex]; + m_xCell->commitEvent( _nEventId, _rNewValue, _rOldValue ); } } } } else { - if ( m_xImpl->m_xTable.is() ) - m_xImpl->m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + if ( m_xTable.is() ) + m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue); } } void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNewValue,const Any& _rOldValue) { - if ( m_xImpl->m_xTable.is() ) + if ( m_xTable.is() ) { if(_nEventId == AccessibleEventId::ACTIVE_DESCENDANT_CHANGED) { @@ -330,9 +308,9 @@ void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNe if (nCurrentRow > -1 && nCurrentCol > -1) { sal_Int32 nColumnCount = m_aTable.GetColumnCount(); - xChild = m_xImpl->m_xTable->getAccessibleChild(nCurrentRow * nColumnCount + nCurrentCol); + xChild = m_xTable->getAccessibleChild(nCurrentRow * nColumnCount + nCurrentCol); } - m_xImpl->m_xTable->commitEvent(_nEventId, Any(xChild),_rOldValue); + m_xTable->commitEvent(_nEventId, Any(xChild),_rOldValue); } else if(_nEventId == AccessibleEventId::TABLE_MODEL_CHANGED) { @@ -342,33 +320,33 @@ void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNe if(aChange.Type == AccessibleTableModelChangeType::DELETE) { std::vector< AccessibleGridControlTableCell* >& rCells = - m_xImpl->m_xTable->getCellVector(); + m_xTable->getCellVector(); std::vector< css::uno::Reference< css::accessibility::XAccessible > >& rAccCells = - m_xImpl->m_xTable->getAccessibleCellVector(); + m_xTable->getAccessibleCellVector(); int nColCount = m_aTable.GetColumnCount(); // check valid index - entries are inserted lazily size_t const nStart = nColCount * aChange.FirstRow; size_t const nEnd = nColCount * aChange.LastRow; if (nStart < rCells.size()) { - m_xImpl->m_xTable->getCellVector().erase( + m_xTable->getCellVector().erase( rCells.begin() + nStart, rCells.begin() + std::min(rCells.size(), nEnd)); } if (nStart < rAccCells.size()) { - m_xImpl->m_xTable->getAccessibleCellVector().erase( + m_xTable->getAccessibleCellVector().erase( rAccCells.begin() + nStart, rAccCells.begin() + std::min(rAccCells.size(), nEnd)); } - m_xImpl->m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue); } else - m_xImpl->m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue); } } else - m_xImpl->m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue); + m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue); } } |