Files
loongoffice/winaccessibility/source/service/AccObjectManagerAgent.cxx
Stephan Bergmann 4521cb0c40 Drop redundant -Wnon-virtual-dtor
Inspired by
<https://gcc.gnu.org/pipermail/gcc-patches/2022-November/607102.html> "[PATCH]
doc: -Wdelete-non-virtual-dtor supersedes -Wnon-virtual-dtor", drop explicitly
enabling -Wnon-virtual-dtor in favor of -Wdelete-non-virtual-dtor, which is
already enabled by -Wall.

(-Wdelete-non-virtual-dtor first appeared in Clang 3.0,
<8bd428574c>
"Add new warning that warns when invoking 'delete' on a polymorphic, non-final,
class without a virtual destructor", and GCC 4.7,
<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=014ab419efc12a59efebd2720d79e1c055675c85>
"invoke.texi: Document -Wdelete-non-virtual-dtor. [...]")

Dropping the explicit setting of -Wnon-virtual-dtor (and nowhere setting it
implicitly via -Weffc++) means we can get rid of lots of places that either set
-Wno-non-virtual-dtor or use some pragma to ignore -Wnon-virtual-dtor.

(In various places across extensions/source/activex/ and winaccessibility/, the
commits f26996bd3398afa789a5491968244563ccf70908 "Silence
-Werror,-Wnon-virtual-dtor in generated so_activex.h (clang-cl)" and
c6086ca6535692496fbd718d174d8eb5a5dea7c7 "Silence -Werror,-Wnon-virtual-dtor in
generated UAccCOM.h (clang-cl)" had singled out some includes to wrap them in
pragmas.  Now that those pragmas are gone again, move those includes back to
where they had been prior to being singled out.  And the -Wno-non-virtual-dtor
in external/firebird/macos-arm64.patch.0 appeared first in
ccd0e5f445d4a7d0e7aca6c23c02c61bf14510b2 "Make firebird build for macOS on
arm64", which, though it doesn't state it explicitly, apparently created that
patch's builds/posix/prefix.darwin_arm64 as a copy of firebird's already
existing builds/posix/prefix.* files, which routinely include that warning
option too, so keep it there too even if it is probably irrelevant throughout.)

Change-Id: I7e4fa9f2c07e267b2ed15607905027f6b78142f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143182
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-24 10:38:28 +01:00

360 lines
9.6 KiB
C++

/* -*- 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 <AccObjectManagerAgent.hxx>
#include <AccObjectWinManager.hxx>
#include <UAccCOM.h>
using namespace com::sun::star::uno;
using namespace com::sun::star::accessibility;
/**
* Construction/Destruction.
* @param
* @return
*/
AccObjectManagerAgent::AccObjectManagerAgent()
: pWinManager(new AccObjectWinManager(this))
{
}
AccObjectManagerAgent::~AccObjectManagerAgent()
{
}
/**
* Interface of updating MSAA name when UNO name_changed event occurs.
* @param pXAcc Uno XAccessible interface of control.
* @return
*/
void AccObjectManagerAgent::UpdateAccName( XAccessible* pXAcc )
{
if( pWinManager )
pWinManager->UpdateAccName( pXAcc );
}
/**
* Interface of updating MSAA name when UNO action changed event occurs.
* @param pXAcc Uno XAccessible interface of control.
* @return
*/
void AccObjectManagerAgent::UpdateAction( XAccessible* pXAcc )
{
if( pWinManager )
pWinManager->UpdateAction( pXAcc );
}
/**
* Interface of updating MSAA value when UNO value_changed event occurs.
* @param pXAcc Uno XAccessible interface of control.
* @param pAny New value.
* @return
*/
void AccObjectManagerAgent::UpdateValue( XAccessible* pXAcc, Any pAny )
{
if( pWinManager )
pWinManager->SetValue( pXAcc, pAny );
}
/**
* Interface of updating MSAA value when UNO value_changed event occurs. If we can not
* find new value, we'll get new value from pXAcc to update com value.
* @param pXAcc Uno XAccessible interface of control.
* @return
*/
void AccObjectManagerAgent::UpdateValue( XAccessible* pXAcc )
{
if( pWinManager )
pWinManager->UpdateValue( pXAcc );
}
/**
* Interface of updating MSAA name when UNO name_changed event occurs.
* @param pXAcc Uno XAccessible interface of control.
* @param newName New UNO accessible name.
* @return
*/
void AccObjectManagerAgent::UpdateAccName( XAccessible* pXAcc, Any newName)
{
if( pWinManager )
pWinManager->SetAccName( pXAcc, newName );
}
/**
* When a new UNO XAccessible object is found by listener, we create a corresponding
* com object and insert it to our manager list.
* @param pXAcc Uno XAccessible interface of control.
* @param pWnd The top window handle containing control.
* @return If the method is correctly processed.
*/
bool AccObjectManagerAgent::InsertAccObj(
XAccessible* pXAcc, XAccessible* pParentXAcc, HWND hWnd)
{
if( pWinManager )
return pWinManager->InsertAccObj(pXAcc, pParentXAcc, hWnd);
return false;
}
/**
* save the pair <topwindowhandle, XAccessible>
* @param hWnd, top window handle
* @param pXAcc XAccessible interface for top window
* @return void
*/
void
AccObjectManagerAgent::SaveTopWindowHandle(HWND hWnd, XAccessible* pXAcc)
{
if( pWinManager )
pWinManager->SaveTopWindowHandle(hWnd, pXAcc);
}
/**
* When a UNO XAccessible object's new children are found by listener, we create
* corresponding com objects and insert them to our manager list.
* @param pXAcc Uno XAccessible interface of control.
* @param pWnd The top window handle containing control.
* @return If the method is correctly processed.
*/
bool
AccObjectManagerAgent::InsertChildrenAccObj(XAccessible* pXAcc, HWND hWnd)
{
if( pWinManager )
return pWinManager->InsertChildrenAccObj(pXAcc, hWnd);
return false;
}
/**
* When a new UNO XAccessible object is destroyed, we delete its corresponding
* com object and remove it from our manager list.
* @param pXAcc Uno XAccessible interface of control.
* @return
*/
void AccObjectManagerAgent::DeleteAccObj( XAccessible* pXAcc )
{
if( pWinManager )
pWinManager->DeleteAccObj( pXAcc );
}
/**
* When new UNO children XAccessible objects are destroyed, we delete their
* corresponding com objects and remove them from our manager list.
* @param pXAcc Uno XAccessible interface of control.
* @return
*/
void AccObjectManagerAgent::DeleteChildrenAccObj( XAccessible* pXAcc )
{
if( pWinManager )
pWinManager->DeleteChildrenAccObj( pXAcc );
}
/**
* Interface of decreasing MSAA state when some UNO state is decreased.
* @param pXAcc Uno XAccessible interface of control.
* @param pState The lost state of control.
* @return
*/
void AccObjectManagerAgent::DecreaseState( XAccessible* pXAcc, sal_Int64 pState )
{
if(pWinManager)
{
pWinManager->DecreaseState( pXAcc, pState );
}
}
/**
* Interface of increasing MSAA name when some UNO state is increased.
* @param pXAcc Uno XAccessible interface of control.
* @param pState The new state of control.
* @return
*/
void AccObjectManagerAgent::IncreaseState( XAccessible* pXAcc, sal_Int64 pState )
{
if(pWinManager)
{
pWinManager->IncreaseState( pXAcc, pState );
}
}
void AccObjectManagerAgent::UpdateState( css::accessibility::XAccessible* pXAcc )
{
if(pWinManager)
pWinManager->UpdateState(pXAcc);
}
/**
* Interface of notify MSAA event when some UNO event occurred.
* @param pXAcc Uno XAccessible interface of control.
* @param eEvent event type.
* @return If the method is correctly processed.
*/
bool AccObjectManagerAgent::NotifyAccEvent(UnoMSAAEvent eEvent, XAccessible* pXAcc)
{
if(pWinManager)
return pWinManager->NotifyAccEvent(pXAcc, eEvent);
return false;
}
/**
* Judge whether a XAccessible object is a container object.
* @param pXAcc Uno XAccessible interface of control.
* @return If the method is correctly processed.
*/
bool AccObjectManagerAgent::IsContainer( XAccessible* pXAcc )
{
if(pWinManager)
return AccObjectWinManager::IsContainer(pXAcc);
return false;
}
/**
* Return com object interface by querying XAccessible interface.
* @param pXAcc Uno XAccessible interface of control.
* @return Com interface.
*/
IMAccessible* AccObjectManagerAgent::GetIMAccByXAcc(XAccessible* pXAcc)
{
if(pWinManager)
return pWinManager->GetIMAccByXAcc(pXAcc);
return nullptr;
}
/**
* Notify manager when a XAccessible object is destroying.
* @param pXAcc Uno XAccessible interface of control.
* @return.
*/
void AccObjectManagerAgent::NotifyDestroy(XAccessible* pXAcc)
{
if(pWinManager)
pWinManager->NotifyDestroy(pXAcc);
}
/**
* Return com object interface by querying child id.
* @param pXAcc Uno XAccessible interface of control.
* @return Com interface.
*/
void AccObjectManagerAgent::GetIAccessibleFromResID(long childID,IMAccessible** pIMAcc)
{
if(pWinManager)
*pIMAcc = pWinManager->GetIAccessibleFromResID(childID);
}
/**
* Return object interface by querying interface.
* @param pXAcc Uno XAccessible interface of control.
* @return Com interface.
*/
bool AccObjectManagerAgent::GetIAccessibleFromXAccessible(
XAccessible* pXAcc, IAccessible** ppXI)
{
if(pWinManager)
{
*ppXI = pWinManager->GetIMAccByXAcc(pXAcc);
if(*ppXI)
return true;
}
return false;
}
XAccessible* AccObjectManagerAgent::GetParentXAccessible( XAccessible* pXAcc )
{
if(pWinManager)
return pWinManager->GetParentXAccessible( pXAcc );
return nullptr;
}
short AccObjectManagerAgent::GetParentRole( XAccessible* pXAcc )
{
if(pWinManager)
return pWinManager->GetParentRole( pXAcc );
return -1;
}
void AccObjectManagerAgent::UpdateChildState(XAccessible* pXAcc)
{
if(pWinManager)
pWinManager->UpdateChildState( pXAcc );
}
bool AccObjectManagerAgent::IsSpecialToolbarItem(XAccessible* pXAcc)
{
if(pWinManager)
return pWinManager->IsSpecialToolbarItem(pXAcc);
return false;
}
short AccObjectManagerAgent::GetRole(XAccessible* pXAcc)
{
if(pWinManager)
return AccObjectWinManager::GetRole( pXAcc );
return -1;
}
XAccessible* AccObjectManagerAgent::GetAccDocByAccTopWin( XAccessible* pXAcc )
{
if (pWinManager)
{
return pWinManager->GetAccDocByAccTopWin( pXAcc );
}
return nullptr;
}
bool AccObjectManagerAgent::IsTopWinAcc(XAccessible* pXAcc)
{
if (pWinManager)
{
return pWinManager->IsTopWinAcc( pXAcc );
}
return false;
}
bool AccObjectManagerAgent::IsStateManageDescendant(XAccessible* pXAcc)
{
if(pWinManager)
return AccObjectWinManager::IsStateManageDescendant( pXAcc );
return false;
}
/**
* Implementation of interface XMSAAService's method getAccObjectPtr()
* that returns the corresponding COM interface with the MS event.
* @return Com interface.
*/
sal_Int64 AccObjectManagerAgent::Get_ToATInterface(
sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam)
{
return static_cast<sal_Int64>(pWinManager->Get_ToATInterface(
static_cast<HWND>(reinterpret_cast<void*>(hWnd)), lParam, wParam));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */