/* -*- 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 . */ #include #include #include #include #include #include #include #include #include #include #include #include #include using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using namespace ::comphelper; using namespace ::vcl; using namespace ::vcl::table; namespace accessibility { using namespace com::sun::star::accessibility::AccessibleStateType; AccessibleGridControlBase::AccessibleGridControlBase( css::uno::Reference< css::accessibility::XAccessible > xParent, ::vcl::table::IAccessibleTable& rTable, ::vcl::table::AccessibleTableControlObjType eObjType ) : AccessibleGridControlImplHelper( m_aMutex ), m_xParent(std::move( xParent )), m_aTable( rTable), m_eObjType( eObjType ), m_aClientId(0) { } AccessibleGridControlBase::~AccessibleGridControlBase() { if( isAlive() ) { // increment ref count to prevent double call of Dtor osl_atomic_increment( &m_refCount ); dispose(); } } void SAL_CALL AccessibleGridControlBase::disposing() { SolarMutexGuard g; if ( getClientId( ) ) { AccessibleEventNotifier::TClientId nId( getClientId( ) ); setClientId( 0 ); AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this ); } m_xParent = nullptr; //m_aTable = NULL; } // css::accessibility::XAccessibleContext css::uno::Reference< css::accessibility::XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleParent() { SolarMutexGuard g; ensureIsAlive(); return m_xParent; } sal_Int64 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent() { SolarMutexGuard g; ensureIsAlive(); // -1 for child not found/no parent (according to specification) sal_Int64 nRet = -1; css::uno::Reference< uno::XInterface > xMeMyselfAndI( static_cast< css::accessibility::XAccessibleContext* >( this ), uno::UNO_QUERY ); // iterate over parent's children and search for this object if( m_xParent.is() ) { css::uno::Reference< css::accessibility::XAccessibleContext > xParentContext( m_xParent->getAccessibleContext() ); if( xParentContext.is() ) { css::uno::Reference< uno::XInterface > xChild; sal_Int64 nChildCount = xParentContext->getAccessibleChildCount(); for( sal_Int64 nChild = 0; nChild < nChildCount; ++nChild ) { xChild.set(xParentContext->getAccessibleChild( nChild ), css::uno::UNO_QUERY); if ( xMeMyselfAndI.get() == xChild.get() ) { nRet = nChild; break; } } } } return nRet; } OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription() { SolarMutexGuard g; ensureIsAlive(); return m_aTable.GetAccessibleObjectDescription(m_eObjType); } OUString SAL_CALL AccessibleGridControlBase::getAccessibleName() { SolarMutexGuard g; ensureIsAlive(); return m_aTable.GetAccessibleObjectName(m_eObjType, 0, 0); } css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL AccessibleGridControlBase::getAccessibleRelationSet() { SolarMutexGuard g; ensureIsAlive(); // GridControl does not have relations. return new utl::AccessibleRelationSetHelper; } sal_Int64 SAL_CALL AccessibleGridControlBase::getAccessibleStateSet() { SolarMutexGuard aSolarGuard; // don't check whether alive -> StateSet may contain DEFUNC return implCreateStateSet(); } lang::Locale SAL_CALL AccessibleGridControlBase::getLocale() { SolarMutexGuard g; ensureIsAlive(); if( m_xParent.is() ) { css::uno::Reference< css::accessibility::XAccessibleContext > xParentContext( m_xParent->getAccessibleContext() ); if( xParentContext.is() ) return xParentContext->getLocale(); } throw IllegalAccessibleComponentStateException(); } // css::accessibility::XAccessibleComponent sal_Bool SAL_CALL AccessibleGridControlBase::containsPoint( const awt::Point& rPoint ) { return tools::Rectangle(Point(), getBoundingBox().GetSize()) .Contains(VCLUnoHelper::ConvertToVCLPoint(rPoint)); } awt::Rectangle SAL_CALL AccessibleGridControlBase::getBounds() { return VCLUnoHelper::ConvertToAWTRect(getBoundingBox()); } awt::Point SAL_CALL AccessibleGridControlBase::getLocation() { return VCLUnoHelper::ConvertToAWTPoint(getBoundingBox().TopLeft()); } awt::Point SAL_CALL AccessibleGridControlBase::getLocationOnScreen() { return VCLUnoHelper::ConvertToAWTPoint(getBoundingBoxOnScreen().TopLeft()); } awt::Size SAL_CALL AccessibleGridControlBase::getSize() { return VCLUnoHelper::ConvertToAWTSize(getBoundingBox().GetSize()); } // css::accessibility::XAccessibleEventBroadcaster void SAL_CALL AccessibleGridControlBase::addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener>& _rxListener ) { if ( _rxListener.is() ) { SolarMutexGuard g; if ( !getClientId( ) ) setClientId( AccessibleEventNotifier::registerClient( ) ); AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener ); } } void SAL_CALL AccessibleGridControlBase::removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener>& _rxListener ) { if( !(_rxListener.is() && getClientId( )) ) return; SolarMutexGuard g; sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener ); if ( !nListenerCount ) { // no listeners anymore // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), // and at least to us not firing any events anymore, in case somebody calls // NotifyAccessibleEvent, again AccessibleEventNotifier::TClientId nId( getClientId( ) ); setClientId( 0 ); AccessibleEventNotifier::revokeClient( nId ); } } // XTypeProvider Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId() { return css::uno::Sequence(); } // XServiceInfo sal_Bool SAL_CALL AccessibleGridControlBase::supportsService( const OUString& rServiceName ) { return cppu::supportsService(this, rServiceName); } Sequence< OUString > SAL_CALL AccessibleGridControlBase::getSupportedServiceNames() { return { u"com.sun.star.accessibility.AccessibleContext"_ustr }; } // internal virtual methods bool AccessibleGridControlBase::implIsShowing() { bool bShowing = false; if( m_xParent.is() ) { css::uno::Reference< css::accessibility::XAccessibleComponent > xParentComp( m_xParent->getAccessibleContext(), uno::UNO_QUERY ); if( xParentComp.is() ) bShowing = implGetBoundingBox().Overlaps( VCLUnoHelper::ConvertToVCLRect(xParentComp->getBounds())); } return bShowing; } sal_Int64 AccessibleGridControlBase::implCreateStateSet() { sal_Int64 nStateSet = 0; if( isAlive() ) { // SHOWING done with m_xParent if( implIsShowing() ) nStateSet |= AccessibleStateType::SHOWING; // GridControl fills StateSet with states depending on object type m_aTable.FillAccessibleStateSet( nStateSet, getType() ); } else nStateSet |= AccessibleStateType::DEFUNC; return nStateSet; } // internal helper methods bool AccessibleGridControlBase::isAlive() const { ::osl::MutexGuard g(m_aMutex); // guards rBHelper members return !rBHelper.bDisposed && !rBHelper.bInDispose; } void AccessibleGridControlBase::ensureIsAlive() const { if( !isAlive() ) throw lang::DisposedException(); } tools::Rectangle AccessibleGridControlBase::getBoundingBox() { SolarMutexGuard aSolarGuard; ensureIsAlive(); tools::Rectangle aRect = implGetBoundingBox(); if ( aRect.Left() == 0 && aRect.Top() == 0 && aRect.Right() == 0 && aRect.Bottom() == 0 ) { SAL_WARN( "accessibility", "rectangle doesn't exist" ); } return aRect; } AbsoluteScreenPixelRectangle AccessibleGridControlBase::getBoundingBoxOnScreen() { SolarMutexGuard aSolarGuard; ensureIsAlive(); AbsoluteScreenPixelRectangle aRect = implGetBoundingBoxOnScreen(); if ( aRect.Left() == 0 && aRect.Top() == 0 && aRect.Right() == 0 && aRect.Bottom() == 0 ) { SAL_WARN( "accessibility", "rectangle doesn't exist" ); } return aRect; } void AccessibleGridControlBase::commitEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue ) { SolarMutexGuard g; if ( !getClientId( ) ) // if we don't have a client id for the notifier, then we don't have listeners, then // we don't need to notify anything return; // build an event object AccessibleEventObject aEvent(*this, _nEventId, _rNewValue, _rOldValue, -1); // let the notifier handle this event AccessibleEventNotifier::addEvent( getClientId( ), aEvent ); } sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole() { ensureIsAlive(); sal_Int16 nRole = AccessibleRole::UNKNOWN; switch ( m_eObjType ) { case AccessibleTableControlObjType::ROWHEADERCELL: nRole = AccessibleRole::ROW_HEADER; break; case AccessibleTableControlObjType::COLUMNHEADERCELL: nRole = AccessibleRole::COLUMN_HEADER; break; case AccessibleTableControlObjType::COLUMNHEADERBAR: case AccessibleTableControlObjType::ROWHEADERBAR: case AccessibleTableControlObjType::TABLE: nRole = AccessibleRole::TABLE; break; case AccessibleTableControlObjType::TABLECELL: nRole = AccessibleRole::TABLE_CELL; break; case AccessibleTableControlObjType::GRIDCONTROL: nRole = AccessibleRole::PANEL; break; } return nRole; } css::uno::Reference SAL_CALL AccessibleGridControlBase::getAccessibleAtPoint( const css::awt::Point& ) { return nullptr; } sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) { SolarMutexGuard aSolarGuard; ensureIsAlive(); Color nColor; vcl::Window* pInst = m_aTable.GetWindowInstance(); if ( pInst ) { if ( pInst->IsControlForeground() ) nColor = pInst->GetControlForeground(); else { vcl::Font aFont; if ( pInst->IsControlFont() ) aFont = pInst->GetControlFont(); else aFont = pInst->GetFont(); nColor = aFont.GetColor(); } } return sal_Int32(nColor); } sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) { SolarMutexGuard aSolarGuard; ensureIsAlive(); Color nColor; vcl::Window* pInst = m_aTable.GetWindowInstance(); if ( pInst ) { if ( pInst->IsControlBackground() ) nColor = pInst->GetControlBackground(); else nColor = pInst->GetBackground().GetColor(); } return sal_Int32(nColor); } GridControlAccessibleElement::GridControlAccessibleElement( const css::uno::Reference< css::accessibility::XAccessible >& rxParent, ::vcl::table::IAccessibleTable& rTable, ::vcl::table::AccessibleTableControlObjType eObjType ) :AccessibleGridControlBase( rxParent, rTable, eObjType ) { } // XInterface IMPLEMENT_FORWARD_XINTERFACE2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base) // XTypeProvider IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base ) // css::accessibility::XAccessible css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccessibleContext() { SolarMutexGuard g; ensureIsAlive(); return this; } GridControlAccessibleElement::~GridControlAccessibleElement( ) { } } // namespace accessibility /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ion value='feature/cib_contract49'>feature/cib_contract49 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-09-04tdf#124176 Use #pragma once in cppcanvasGeorge Bateman
This commit was carried out by a Python script, source of which is at https://bugs.documentfoundation.org/show_bug.cgi?id=124176#c97. Change-Id: I984bb1056da13d163f7fe654d780502a6d34231f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100253 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2020-07-16compact namespace: cppcanvasNoel Grandin
Change-Id: I53826803bd7749b7fead5e464e2dc65212d5bb9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98908 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-23loplugin:includeform: cppucanvasStephan Bergmann
Change-Id: I83da2a535f89dfaa675629ca3dc2a6cefc334443
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-04-14loplugin:passstuffbyref in variousNoel Grandin
Change-Id: I80070c83204e531c2f599f8a56193d6ffe0e5022
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-10-12Replace "SAL_DELETED_FUNCTION" with "= delete" in LIBO_INTERNAL_ONLY codeStephan Bergmann
Change-Id: I328ac7a95ccc87732efae48b567a0556865928f3
2015-09-14boost->stdCaolán McNamara
Change-Id: I3fd9e1599c5ad812879a58cf1dabbcd393105e1c Reviewed-on: https://gerrit.libreoffice.org/18564 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-08-05loplugin:unusedmethodsNoel Grandin
Change-Id: I6801618efb5a66d24156fa429e026acb6ca03aba Reviewed-on: https://gerrit.libreoffice.org/17506 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-28Whitespace cleanup / re-alignment.Thorsten Behrens
Get alignment back after various cleanups, including a99520eb0a0ccb5a03e85c697d38eb6520ec403c Change-Id: I8a9004a600a04318ab8c1514f9b48c8b73fa9d70
2015-07-28com::sun::star->css in cppcanvasNoel Grandin
Change-Id: Ibb7493456c20600fe3e823c74af6e572d9577817 Reviewed-on: https://gerrit.libreoffice.org/17379 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-02-07loplugin:deletedspecialStephan Bergmann
Change-Id: I988d7cdfa048a3b093ebc34f9016ac42440daa4b
2014-06-17improve the inlinesimplememberfunctions clang pluginNoel Grandin
Change-Id: I6d5a952901648e01904ef5c37f953c517304d31e
2014-05-15Resolves fdo#70681: fixincludeguards.pl: all that's leftThomas Arnhold
Change-Id: I3e51a62710bb46c8255fd228d41d9300c90a1fb5 Reviewed-on: https://gerrit.libreoffice.org/9360 Reviewed-by: Thomas Arnhold <thomas@arnhold.org> Tested-by: Thomas Arnhold <thomas@arnhold.org>
2014-03-26First batch of adding SAL_OVERRRIDE to overriding function declarationsStephan Bergmann
...mostly done with a rewriting Clang plugin, with just some manual tweaking necessary to fix poor macro usage. Change-Id: I71fa20213e86be10de332ece0aa273239df7b61a
2013-11-29Revert "Resolves: fdo#71527 make presenter console not crash/useless"Thorsten Behrens
This reverts commit 639aa8e72639fd01e9004977f1cfaafc13b1e45f. Change-Id: I0ac1a7ada530791e2d34d2f0802213c869ea48a1
2013-11-28Resolves: fdo#71527 make presenter console not crash/uselessCaolán McNamara
Basically reverts the pieces of 21ec9beae29b19b8ec6f0a16fd0e708e4f210208 to make XSpriteCanvas a XBitmapCanvas again Otherwise PresenterHelper::loadBitmap is not an XBitmapCanvas and so VclFactory::createBitmap cannot succeed Change-Id: I197adf98e915102f383ee050a8ea16d1e41cecf2