diff options
Diffstat (limited to '')
22 files changed, 1431 insertions, 0 deletions
diff --git a/winaccessibility/inc/AccComponentEventListener.hxx b/winaccessibility/inc/AccComponentEventListener.hxx new file mode 100644 index 000000000..6c2683f8b --- /dev/null +++ b/winaccessibility/inc/AccComponentEventListener.hxx @@ -0,0 +1,68 @@ +/* -*- 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 <stdio.h> +#include "AccEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccComponentEventListener is inherited from AccEventListener. It handles the events + * generated by component controls. The accessible roles are: CHECK_BOX, ICON, LABEL, + * MENU_ITEM, PUSH_BUTTON, RADIO_BUTTON, SCROLL_BAR, SEPARATOR, TOGGLE_BUTTON, TOOL_TIP, SPIN_BOX. + * It defines the procedure of specific event handling related with components and provides + * the detailed support for some related methods. + */ +class AccComponentEventListener : public AccEventListener +{ +private: + static FILE *output, *output2, *output3, *outacc; //used for debugging +public: + AccComponentEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccComponentEventListener() override; + + // XAccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for value changed event + virtual void HandleValueChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + //for action changed event + virtual void HandleActionChangedEvent(); + + //for text changed event + virtual void HandleTextChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + //for caret changed event + virtual void HandleCaretChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + virtual void SetComponentState(short state, bool enable) override; + virtual void FireStatePropertyChange(short state, bool set) override; + virtual void FireStateFocusedChange(bool enable) override; + + void HandleSelectionChangedEventNoArgs(); + + //add TEXT_SELECTION_CHANGED event + void HandleTextSelectionChangedEvent(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccContainerEventListener.hxx b/winaccessibility/inc/AccContainerEventListener.hxx new file mode 100644 index 000000000..c880374fb --- /dev/null +++ b/winaccessibility/inc/AccContainerEventListener.hxx @@ -0,0 +1,99 @@ +/* -*- 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 + +enum class UnoMSAAEvent; + +#include <stdio.h> +#include "AccEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + + +/** + * AccContainerEventListener is inherited from AccEventListener. It handles the events + * generated by container controls. The accessible roles are: CANVAS, COMBO_BOX, DOCUMENT, + * EMBEDDED_OBJECT, END_NOTE, FILLER, FOOTNOTE, FOOTER, GRAPHIC, HEADER, LAYERED_PANE, + * MENU_BAR, POPUP_MENU, OPTION_PANE, PAGE_TAB, PAGE_TAB_LIST, PANEL, SCROLL_PANE, SPLIT_PANE, + * STATUS_BAR, TABLE_CELL, TEXT_FRAME, TOOL_BAR, VIEW_PORT. + * It defines the procedure of specific event handling related with containsers and provides + * the detailed support for some related methods. + */ +class AccContainerEventListener: public AccEventListener +{ +public: + AccContainerEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccContainerEventListener() override; + + //AccessibleEventListener + virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override; + + //for child changed event + virtual void HandleChildChangedEvent( + css::uno::Any oldValue, css::uno::Any newValue); + + //for selection changed event + virtual void HandleSelectionChangedEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + + //for all children changed event + virtual void HandleAllChildrenChangedEvent(); + + //for text changed event + virtual void HandleTextChangedEvent( + css::uno::Any oldValue, css::uno::Any newValue); + virtual void HandleStateChangedEvent( + css::uno::Any oldValue, css::uno::Any newValue) override; + + //for value changed event + virtual void HandleValueChangedEvent( + css::uno::Any oldValue, css::uno::Any newValue); + + //state changed + virtual void SetComponentState(short state, bool enable) override; + virtual void FireStatePropertyChange(short state, bool set) override; + virtual void FireStateFocusedChange(bool enable) override; + virtual bool IsEditable(css::uno::Reference<css::accessibility::XAccessibleContext> const & xContext); + + // update all children's state + void UpdateAllChildrenState( css::accessibility::XAccessible* pXAccessible); + + bool NotifyChildEvent(UnoMSAAEvent eWinEvent, const css::uno::Any& Value); + + virtual void HandleSelectionChangedAddEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + virtual void HandleSelectionChangedRemoveEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + virtual void HandleSelectionChangedWithinEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + + virtual void HandlePageChangedEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + + virtual void HandleSectionChangedEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + virtual void HandleColumnChangedEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + + //for name changed event + virtual void HandleNameChangedEvent(css::uno::Any name) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccDescendantManagerEventListener.hxx b/winaccessibility/inc/AccDescendantManagerEventListener.hxx new file mode 100644 index 000000000..669143a03 --- /dev/null +++ b/winaccessibility/inc/AccDescendantManagerEventListener.hxx @@ -0,0 +1,69 @@ +/* -*- 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 + +enum class UnoMSAAEvent; + +#include <stdio.h> +#include <vector> +#include "AccComponentEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccDescendantManagerEventListener is inherited from AccComponentEventListener. It handles + * the events generated by active descendant controls. They are: TREE, LIST, and TABLE. + * It defines the procedure of specific event handling related with active descendant components + * and provides the detailed support for some related methods. + */ +class AccDescendantManagerEventListener: public AccComponentEventListener +{ +private: + std::vector<com::sun::star::accessibility::XAccessible*> m_aUnselectedChildrenForDeletion; + +public: + AccDescendantManagerEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccDescendantManagerEventListener() override; + + // XAccessibleEventListener + virtual void SAL_CALL notifyEvent( const css::accessibility::AccessibleEventObject& aEvent ) override; + + //for selection changed event + virtual void HandleSelectionChangedEvent( + css::uno::Any oldValue, css::uno::Any newValue); + + //for child changed event + virtual void HandleChildChangedEvent( + css::uno::Any oldValue, css::uno::Any newValue); + + virtual void HandleChildChangedNoFocusEvent( + css::uno::Any oldValue, css::uno::Any newValue); + + bool NotifyChildEvent(UnoMSAAEvent eWinEvent, const css::uno::Any& Value); + + virtual void HandleSelectionChangedAddEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + virtual void HandleSelectionChangedRemoveEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); + virtual void HandleSelectionChangedWithinEvent( + const css::uno::Any &oldValue, const css::uno::Any &newValue); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccDialogEventListener.hxx b/winaccessibility/inc/AccDialogEventListener.hxx new file mode 100644 index 000000000..b8394f712 --- /dev/null +++ b/winaccessibility/inc/AccDialogEventListener.hxx @@ -0,0 +1,50 @@ +/* -*- 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 <stdio.h> +#include "AccEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccDialogEventListener is inherited from AccEventListener. It handles the events + * generated by Dialogs. The accessible role is: DIALOG. + * It defines the procedure of specific event handling related with dialogs and provides + * the detailed support for some related methods. + */ +class AccDialogEventListener : public AccEventListener +{ +public: + AccDialogEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccDialogEventListener() override; + + //AccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for child changed event + virtual void HandleChildChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + //state changed + virtual void SetComponentState(short state, bool enable) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccEventListener.hxx b/winaccessibility/inc/AccEventListener.hxx new file mode 100644 index 000000000..4e29e9f50 --- /dev/null +++ b/winaccessibility/inc/AccEventListener.hxx @@ -0,0 +1,79 @@ +/* -*- 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 <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include <cppuhelper/implbase.hxx> + +class AccObjectManagerAgent; + +/** + * AccEventListener is the general event listener for all controls. It defines the + * procedure of all the event handling and provides the basic support for some simple + * methods. + */ +class AccEventListener : public ::cppu::WeakImplHelper<css::accessibility::XAccessibleEventListener> +{ +protected: + //accessible owner's pointer + css::uno::Reference<css::accessibility::XAccessible> m_xAccessible; + //agent pointer for objects' manager + AccObjectManagerAgent* pAgent; + +public: + AccEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccEventListener() override; + + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + + // XAccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for name changed event + virtual void HandleNameChangedEvent(css::uno::Any name); + + //for description changed event + virtual void HandleDescriptionChangedEvent(); + + //for state changed event + virtual void HandleStateChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + virtual void SetComponentState(short state, bool enable); + virtual void FireStatePropertyChange(short state, bool set); + virtual void FireStateFocusedChange(bool enable); + + //for bound rect changed event + virtual void HandleBoundrectChangedEvent(); + + //for visible data changed event + virtual void HandleVisibleDataChangedEvent(); + + // get the accessible role of m_xAccessible + virtual short GetRole(); + //get the accessible parent's role + virtual short GetParentRole(); + + void RemoveMeFromBroadcaster(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccFrameEventListener.hxx b/winaccessibility/inc/AccFrameEventListener.hxx new file mode 100644 index 000000000..43f4fe393 --- /dev/null +++ b/winaccessibility/inc/AccFrameEventListener.hxx @@ -0,0 +1,50 @@ +/* -*- 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 <stdio.h> +#include "AccEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccFrameEventListener is inherited from AccEventListener. It handles the events + * generated by Dialogs. The accessible roles are: FRAME and ROOT_PANE. + * It defines the procedure of specific event handling related with frames and provides + * the detailed support for some related methods. + */ +class AccFrameEventListener : public AccEventListener +{ +public: + AccFrameEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccFrameEventListener() override; + + // XAccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for child changed event + virtual void HandleChildChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + //state changed + virtual void SetComponentState(short state, bool enable) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccListEventListener.hxx b/winaccessibility/inc/AccListEventListener.hxx new file mode 100644 index 000000000..bd75a977c --- /dev/null +++ b/winaccessibility/inc/AccListEventListener.hxx @@ -0,0 +1,49 @@ +/* -*- 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 <stdio.h> +#include "AccDescendantManagerEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccListEventListener is inherited from AccDescendantManagerEventListener. It handles + * the events generated by tree controls. The accessible role is: LIST. + * It defines the procedure of specific event handling related with list components + * and provides the detailed support for some related methods. + */ +class AccListEventListener : public AccDescendantManagerEventListener +{ +public: + AccListEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccListEventListener() override; + + // XAccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for active descendant changed event + virtual void HandleActiveDescendantChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + //for value changed event + virtual void HandleValueChangedEvent(css::uno::Any oldValue, css::uno::Any newValue) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccMenuEventListener.hxx b/winaccessibility/inc/AccMenuEventListener.hxx new file mode 100644 index 000000000..c0efc33fc --- /dev/null +++ b/winaccessibility/inc/AccMenuEventListener.hxx @@ -0,0 +1,53 @@ +/* -*- 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 <stdio.h> +#include "AccComponentEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccMenuEventListener is inherited from AccComponentEventListener. It handles the events + * generated by container controls. The accessible role is: MENU + * It defines the procedure of specific event handling related with menus and provides + * the detailed support for some related methods. + */ +class AccMenuEventListener : public AccComponentEventListener +{ +public: + AccMenuEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccMenuEventListener() override; + + //AccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for child changed event + virtual void HandleChildChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + //for selection changed event + virtual void HandleSelectionChangedEventNoArgs(); + + //for state changed event + virtual void FireStatePropertyChange(short state, bool set) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccObject.hxx b/winaccessibility/inc/AccObject.hxx new file mode 100644 index 000000000..a255f3626 --- /dev/null +++ b/winaccessibility/inc/AccObject.hxx @@ -0,0 +1,135 @@ +/* -*- 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 <vector> +#include <map> +#if !defined WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <oleacc.h> + +#include <rtl/ref.hxx> + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> + +#include "accHelper.hxx" + +#if defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif +#include <UAccCOM.h> +#if defined __clang__ +#pragma clang diagnostic pop +#endif + +class AccEventListener; +class AccObjectManagerAgent; +class AccObject; + +typedef std::map<const long, AccObject*> IAccSelectionList; +typedef std::vector<AccObject *> IAccChildList; + + +class AccObject +{ +private: + + short m_accRole; + long m_resID; + HWND m_pParantID; + IMAccessible* m_pIMAcc; + AccObject* m_pParentObj; + IAccChildList m_childrenList; + ::rtl::Reference<AccEventListener> m_pListener; + IAccSelectionList m_selectionList; + + css::uno::Reference < css::accessibility::XAccessible > m_xAccRef; + css::uno::Reference < css::accessibility::XAccessibleAction > m_xAccActionRef; + css::uno::Reference < css::accessibility::XAccessibleContext > m_xAccContextRef; + + void ImplInitializeCreateObj();//create COM object + + void UpdateActionDesc(); + void UpdateRole(); + + DWORD GetMSAAStateFromUNO(short xState);//translate state from UNO to MSAA value + css::accessibility::XAccessibleSelection* GetXAccessibleSelection(); + void GetExpandedState(sal_Bool* isExpandable, sal_Bool* isExpanded); + OUString GetMAccessibleValueFromAny(css::uno::Any pAny); + +public: + + AccObject ( css::accessibility::XAccessible* pXAcc = nullptr,AccObjectManagerAgent* pAgent = nullptr ,AccEventListener* accListener=nullptr); + virtual ~AccObject(); + + bool UpdateAccessibleInfoFromUnoToMSAA( ); //implement accessible information mapping + void UpdateDefaultAction(); + + IMAccessible* GetIMAccessible(); //return COM interface in acc object + css::uno::Reference<css::accessibility::XAccessible> const& GetXAccessible(); + + void SetResID(long id);//ResID means ChildID in MSAA + long GetResID(); + + + void SetParentHWND(HWND hWnd);//need to set top window handle when send event to AT + HWND GetParentHWND(); + + void SetListener(::rtl::Reference<AccEventListener> const& pListener); + AccEventListener* getListener(); + + void SetParentObj(AccObject* pParentAccObj); + AccObject* GetParentObj(); + + void InsertChild( AccObject* pChild,short pos = LAST_CHILD); + void DeleteChild( AccObject* pChild ); + AccObject* NextChild(); + + void NotifyDestroy(); + + void DecreaseState(short xState );//call COM interface DecreaseState method + void IncreaseState( short xState );//call COM interface IncreaseState method + + void SetName( css::uno::Any newName); + void SetValue( css::uno::Any pAny ); + + short GetRole() const; + + void UpdateState(); + void UpdateName(); + void UpdateValue(); + void UpdateAction(); + void UpdateValidWindow(); + void UpdateLocation(); + + void setFocus(); + void unsetFocus(); + + void AddSelect(long index, AccObject* accObj); + IAccSelectionList& GetSelection(); + void setLocalizedResourceString(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccObjectContainerEventListener.hxx b/winaccessibility/inc/AccObjectContainerEventListener.hxx new file mode 100644 index 000000000..41baf99b4 --- /dev/null +++ b/winaccessibility/inc/AccObjectContainerEventListener.hxx @@ -0,0 +1,47 @@ +/* -*- 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 <stdio.h> +#include "AccContainerEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + + +/** + * AccObjectContainerEventListener is inherited from AccContainerEventListener. It handles the events + * generated by container controls. The accessible role is: SHAPE + * It defines the procedure of specific event handling related with shapes and provides + * the detailed support for some related methods. + */ +class AccObjectContainerEventListener: public AccContainerEventListener +{ +public: + AccObjectContainerEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccObjectContainerEventListener() override; + + virtual void HandleStateChangedEvent( + css::uno::Any oldValue, css::uno::Any newValue) override; + + //for visible data changed event, for shapes, the visibledatachanged should be mapped to LOCATION_CHANGED + virtual void HandleVisibleDataChangedEvent() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccObjectManagerAgent.hxx b/winaccessibility/inc/AccObjectManagerAgent.hxx new file mode 100644 index 000000000..d91f33ef1 --- /dev/null +++ b/winaccessibility/inc/AccObjectManagerAgent.hxx @@ -0,0 +1,103 @@ +/* -*- 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 <memory> + +#include <prewin.h> +#include <Windows.h> +#include <postwin.h> + +#include <com/sun/star/accessibility/XAccessible.hpp> + +struct IMAccessible; +struct IAccessible; +class AccObjectWinManager; +enum class UnoMSAAEvent; + +/**************************************************************** +AccObjectManagerAgent is used for managing AccObjects, which encapsulates +platform differences,and call AccObjectWinManager for Windows platform. To do for +Linux platform +*****************************************************************/ +class AccObjectManagerAgent +{ +private: + + std::unique_ptr<AccObjectWinManager> pWinManager; + +public: + + AccObjectManagerAgent(); + virtual ~AccObjectManagerAgent(); + + virtual bool InsertAccObj(css::accessibility::XAccessible* pXAcc, + css::accessibility::XAccessible* pParentXAcc, + HWND hWnd = nullptr); + virtual void GetIAccessibleFromResID(long childID,IMAccessible**); + virtual bool GetIAccessibleFromXAccessible(css::accessibility::XAccessible* pXAcc, IAccessible** ppIA); + + virtual void DeleteAccObj( css::accessibility::XAccessible* pXAcc ); + virtual IMAccessible* GetIMAccByXAcc(css::accessibility::XAccessible* pXAcc); + + bool NotifyAccEvent(UnoMSAAEvent eEvent, css::accessibility::XAccessible* pXAcc = nullptr); + + bool InsertChildrenAccObj(css::accessibility::XAccessible* pXAcc, + HWND hWnd = nullptr); + void DeleteChildrenAccObj( css::accessibility::XAccessible* pXAcc ); + + void DecreaseState( css::accessibility::XAccessible* pXAcc,unsigned short pState ); + void IncreaseState( css::accessibility::XAccessible* pXAcc,unsigned short pState ); + void UpdateState( css::accessibility::XAccessible* pXAcc ); + + static void UpdateLocation( css::accessibility::XAccessible* pXAcc, + long Top = 0,long left = 0,long width = 0,long height = 0 ); + void UpdateAction( css::accessibility::XAccessible* pXAcc ); + + void UpdateValue( css::accessibility::XAccessible* pXAcc ); + void UpdateValue( css::accessibility::XAccessible* pXAcc, css::uno::Any ); + + void UpdateAccName( css::accessibility::XAccessible* pXAcc, css::uno::Any newName); + void UpdateAccName( css::accessibility::XAccessible* pXAcc); + + void NotifyDestroy(css::accessibility::XAccessible* pXAcc); + + css::accessibility::XAccessible* GetParentXAccessible( css::accessibility::XAccessible* pXAcc ); + short GetParentRole(css::accessibility::XAccessible* pXAcc ); + bool IsContainer(css::accessibility::XAccessible* pXAcc); + + void SaveTopWindowHandle(HWND hWnd, css::accessibility::XAccessible* pXAcc); + + void UpdateChildState(css::accessibility::XAccessible* pXAcc); + + bool IsSpecialToolbarItem(css::accessibility::XAccessible* pXAcc); + + short GetRole(css::accessibility::XAccessible* pXAcc); + + css::accessibility::XAccessible* GetAccDocByAccTopWin( css::accessibility::XAccessible* pXAcc ); + bool IsTopWinAcc( css::accessibility::XAccessible* pXAcc ); + + bool IsStateManageDescendant(css::accessibility::XAccessible* pXAcc); + + sal_Int64 Get_ToATInterface(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccObjectWinManager.hxx b/winaccessibility/inc/AccObjectWinManager.hxx new file mode 100644 index 000000000..342d2278d --- /dev/null +++ b/winaccessibility/inc/AccObjectWinManager.hxx @@ -0,0 +1,153 @@ +/* -*- 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 <map> +#if !defined WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include <windows.h> +#include <rtl/ref.hxx> +#include "ResIDGenerator.hxx" + +#if defined __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif +#include <UAccCOM.h> +#if defined __clang__ +#pragma clang diagnostic pop +#endif + +namespace com::sun::star::accessibility { +class XAccessible; +} +class ResIDGenerator; +class AccObjectManagerAgent; +class AccEventListener; +class AccObject; +enum class UnoMSAAEvent; + +/******************************************************************* +AccObjectWinManager complete the functions: +1. Insert, delete,query,update Acc objects +2. Create, delete,fire AccEventLister, the lifecycle of AccEventListener is as same as + Acc Object + 3.Return COM interface for AT,by the call back in salframe + 4.Pass accessible information to Acc objects + *******************************************************************/ +class AccObjectWinManager +{ + friend class AccObjectManagerAgent; + +private: + typedef std::map<com::sun::star::accessibility::XAccessible*, AccObject> XIdToAccObjHash; + typedef std::map<HWND, com::sun::star::accessibility::XAccessible*> XHWNDToXAccHash; + typedef std::map<const long, AccObject*> XResIdToAccObjHash; + + typedef std::map<const HWND, css::accessibility::XAccessible* > + XHWNDToDocumentHash; + + //XAccessible to AccObject + XIdToAccObjHash XIdAccList; + + //HWND to All XAccessible pointer + XHWNDToXAccHash HwndXAcc; + + //id_Child to AccObject + XResIdToAccObjHash XResIdAccList; + + //for file name support + XHWNDToDocumentHash XHWNDDocList; + + css::accessibility::XAccessible* oldFocus; + + AccObjectManagerAgent* pAgent; + ResIDGenerator ResIdGen; + + AccObjectWinManager(AccObjectManagerAgent* Agent=nullptr); + +private: + long ImpleGenerateResID(); + AccObject* GetAccObjByXAcc( css::accessibility::XAccessible* pXAcc); + + AccObject* GetTopWindowAccObj(HWND hWnd); + + css::accessibility::XAccessible* GetAccDocByHWND(HWND hWnd); + + static void DeleteAccListener( AccObject* pAccObj ); + static void InsertAccChildNode(AccObject* pCurObj,AccObject* pParentObj,HWND pWnd); + static void DeleteAccChildNode(AccObject* pChild); + void DeleteFromHwndXAcc(css::accessibility::XAccessible const * pXAcc ); + int UpdateAccSelection(css::accessibility::XAccessible* pXAcc); + + ::rtl::Reference<AccEventListener> CreateAccEventListener( + css::accessibility::XAccessible* pXAcc); +public: + virtual ~AccObjectWinManager(); + bool InsertAccObj( css::accessibility::XAccessible* pXAcc,css::accessibility::XAccessible* pParentXAcc,HWND pWnd); + bool InsertChildrenAccObj( css::accessibility::XAccessible* pXAcc,HWND pWnd=nullptr); + void DeleteAccObj( css::accessibility::XAccessible* pXAcc ); + void DeleteChildrenAccObj(css::accessibility::XAccessible* pAccObj); + + bool NotifyAccEvent(css::accessibility::XAccessible* pXAcc, UnoMSAAEvent eEvent); + + LRESULT Get_ToATInterface(HWND hWnd, long lParam, WPARAM wParam); + + void DecreaseState( css::accessibility::XAccessible* pXAcc,unsigned short pState ); + void IncreaseState( css::accessibility::XAccessible* pXAcc,unsigned short pState ); + void UpdateState( css::accessibility::XAccessible* pXAcc ); + void SetLocation( css::accessibility::XAccessible* pXAcc, + long Top = 0,long left = 0,long width = 0,long height = 0); + + void SetValue( css::accessibility::XAccessible* pXAcc, css::uno::Any pAny ); + void UpdateValue( css::accessibility::XAccessible* pXAcc ); + + void SetAccName( css::accessibility::XAccessible* pXAcc, css::uno::Any newName); + void UpdateAccName( css::accessibility::XAccessible* pXAcc ); + + void UpdateAccFocus( css::accessibility::XAccessible* newFocus ); + void UpdateAction( css::accessibility::XAccessible* pXAcc ); + + static bool IsContainer( css::accessibility::XAccessible* pAccessible ); + + IMAccessible* GetIMAccByXAcc( css::accessibility::XAccessible* pXAcc ); + IMAccessible* GetIAccessibleFromResID(long resID); + + void NotifyDestroy( css::accessibility::XAccessible* pXAcc ); + css::accessibility::XAccessible* GetParentXAccessible( css::accessibility::XAccessible* pXAcc ); + short GetParentRole( css::accessibility::XAccessible* pXAcc ); + + void SaveTopWindowHandle(HWND hWnd, css::accessibility::XAccessible* pXAcc); + + void UpdateChildState(css::accessibility::XAccessible* pXAcc); + + bool IsSpecialToolbarItem(css::accessibility::XAccessible* pXAcc); + + static short GetRole(css::accessibility::XAccessible* pXAcc); + + css::accessibility::XAccessible* GetAccDocByAccTopWin( css::accessibility::XAccessible* pXAcc ); + bool IsTopWinAcc( css::accessibility::XAccessible* pXAcc ); + + static bool IsStateManageDescendant(css::accessibility::XAccessible* pAccessible); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccParagraphEventListener.hxx b/winaccessibility/inc/AccParagraphEventListener.hxx new file mode 100644 index 000000000..7204839e3 --- /dev/null +++ b/winaccessibility/inc/AccParagraphEventListener.hxx @@ -0,0 +1,52 @@ +/* -*- 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 <stdio.h> +#include "AccContainerEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccParagraphEventListener is inherited from AccContainerEventListener. It handles the events + * generated by container controls. The accessible roles are: PARAGRAPH and HEADING. + * It defines the procedure of specific event handling related with text containsers and provides + * the detailed support for some related methods. + */ +class AccParagraphEventListener : public AccContainerEventListener +{ +public: + AccParagraphEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccParagraphEventListener() override; + + //AccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for caret changed event + virtual void HandleCaretChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + virtual void SetComponentState(short state, bool enable) override; + + //add TEXT_SELECTION_CHANGED event + void HandleTextSelectionChangedEvent(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccTableEventListener.hxx b/winaccessibility/inc/AccTableEventListener.hxx new file mode 100644 index 000000000..01871e35e --- /dev/null +++ b/winaccessibility/inc/AccTableEventListener.hxx @@ -0,0 +1,49 @@ +/* -*- 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 <stdio.h> +#include "AccDescendantManagerEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccTableEventListener is inherited from AccDescendantManagerEventListener. It handles + * the events generated by tree controls. The accessible role is: TABLE. + * It defines the procedure of specific event handling related with table components + * and provides the detailed support for some related methods. + */ +class AccTableEventListener : public AccDescendantManagerEventListener +{ +public: + AccTableEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccTableEventListener() override; + + // XAccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for active descendant changed event + virtual void HandleActiveDescendantChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + void HandleTableModelChangeEvent(css::uno::Any newValue); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccTextComponentEventListener.hxx b/winaccessibility/inc/AccTextComponentEventListener.hxx new file mode 100644 index 000000000..f1e49097e --- /dev/null +++ b/winaccessibility/inc/AccTextComponentEventListener.hxx @@ -0,0 +1,43 @@ +/* -*- 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 <stdio.h> +#include "AccComponentEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccTextComponentEventListener is inherited from AccComponentEventListener. It handles the events + * generated by container controls. The accessible role is: TEXT + * It defines the procedure of specific event handling related with text components and provides + * the detailed support for some related methods. + */ +class AccTextComponentEventListener : public AccComponentEventListener +{ +public: + AccTextComponentEventListener(css::accessibility::XAccessible* pAcc, + AccObjectManagerAgent* Agent); + virtual ~AccTextComponentEventListener() override; + + virtual void SetComponentState(short state, bool enable) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccTopWindowListener.hxx b/winaccessibility/inc/AccTopWindowListener.hxx new file mode 100644 index 000000000..c88ce5085 --- /dev/null +++ b/winaccessibility/inc/AccTopWindowListener.hxx @@ -0,0 +1,66 @@ +/* -*- 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 <com/sun/star/awt/XTopWindowListener.hpp> +#include <com/sun/star/awt/XExtendedToolkit.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> + +#include <cppuhelper/implbase.hxx> + +#include "AccObjectManagerAgent.hxx" + +/** + * AccEventListener is the general event listener for all top windows. The top windows defined + * in UNO are: FRAME, WINDOW, DIALOG, MENU, TOOLTIP. + * It implements the methods of XTopWindowListener and the most important method is windowOpened(). + * In this method, all the accessible objects (including COM object and Uno objects) are created and + * cached into bridge managers, and they are monitored by listeners for later accessible event handling. + */ +class AccTopWindowListener : public ::cppu::WeakImplHelper<css::awt::XTopWindowListener> +{ +private: + AccObjectManagerAgent accManagerAgent; + +public: + AccTopWindowListener(); + virtual ~AccTopWindowListener() override; + + // XTopWindowListener + virtual void SAL_CALL windowOpened(const css::lang::EventObject& e) override; + virtual void SAL_CALL windowClosing(const css::lang::EventObject& e) override; + virtual void SAL_CALL windowClosed(const css::lang::EventObject& e) override; + virtual void SAL_CALL windowMinimized(const css::lang::EventObject& e) override; + virtual void SAL_CALL windowNormalized(const css::lang::EventObject& e) override; + virtual void SAL_CALL windowActivated(const css::lang::EventObject& e) override; + virtual void SAL_CALL windowDeactivated(const css::lang::EventObject& e) override; + + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + + virtual void AddAllListeners(css::accessibility::XAccessible* pAccessible, + css::accessibility::XAccessible* pParentXAcc, HWND pWND); + //for On-Demand load. + virtual void HandleWindowOpened(css::accessibility::XAccessible* pAccessible); + + sal_Int64 GetMSComPtr(sal_Int64 hWnd, sal_Int64 lParam, sal_Int64 wParam); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccTreeEventListener.hxx b/winaccessibility/inc/AccTreeEventListener.hxx new file mode 100644 index 000000000..bb3574bf0 --- /dev/null +++ b/winaccessibility/inc/AccTreeEventListener.hxx @@ -0,0 +1,47 @@ +/* -*- 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 <stdio.h> +#include "AccDescendantManagerEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccTreeEventListener is inherited from AccDescendantManagerEventListener. It handles + * the events generated by tree controls. The accessible role is: TREE. + * It defines the procedure of specific event handling related with tree components + * and provides the detailed support for some related methods. + */ +class AccTreeEventListener : public AccDescendantManagerEventListener +{ +public: + AccTreeEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccTreeEventListener() override; + + // XAccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for active descendant changed event + virtual void HandleActiveDescendantChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/AccWindowEventListener.hxx b/winaccessibility/inc/AccWindowEventListener.hxx new file mode 100644 index 000000000..a4995e343 --- /dev/null +++ b/winaccessibility/inc/AccWindowEventListener.hxx @@ -0,0 +1,50 @@ +/* -*- 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 <stdio.h> +#include "AccEventListener.hxx" +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +/** + * AccWindowEventListener is inherited from AccEventListener. It handles the events + * generated by Dialogs. The accessible role is: WINDOW. + * It defines the procedure of specific event handling related with windows and provides + * the detailed support for some related methods. + */ +class AccWindowEventListener : public AccEventListener +{ +public: + AccWindowEventListener(css::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent); + virtual ~AccWindowEventListener() override; + + // XAccessibleEventListener + virtual void SAL_CALL + notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) override; + + //for child changed event + virtual void HandleChildChangedEvent(css::uno::Any oldValue, css::uno::Any newValue); + + //state changed + virtual void SetComponentState(short state, bool enable) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/ResIDGenerator.hxx b/winaccessibility/inc/ResIDGenerator.hxx new file mode 100644 index 000000000..400f58a2e --- /dev/null +++ b/winaccessibility/inc/ResIDGenerator.hxx @@ -0,0 +1,45 @@ +/* -*- 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 <deque> + +//ResID i.e. MSAA child ID, +//this class is responsible for generating a child ID +// +// In IAccessible2, negative child IDs are commonly used to +// indicate unique resource IDs. +class ResIDGenerator +{ +private: + long m_nMin; + std::deque<long> subList; + +public: + ResIDGenerator() + : m_nMin(-1) + { + } + ~ResIDGenerator(); + long GenerateNewResID(); + void SetSub(long number) { subList.push_back(number); }; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/UAccCOMdllapi.h b/winaccessibility/inc/UAccCOMdllapi.h new file mode 100644 index 000000000..50f705c6d --- /dev/null +++ b/winaccessibility/inc/UAccCOMdllapi.h @@ -0,0 +1,20 @@ +/* -*- 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/. + */ + +#pragma once + +#include <sal/types.h> + +#if defined(UACCCOM_DLLIMPLEMENTATION) +#define UACCCOM_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define UACCCOM_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/accHelper.hxx b/winaccessibility/inc/accHelper.hxx new file mode 100644 index 000000000..4e2d941c4 --- /dev/null +++ b/winaccessibility/inc/accHelper.hxx @@ -0,0 +1,37 @@ +/* -*- 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 "UAccCOMdllapi.h" + +enum DIRECTION +{ + FIRST_CHILD = 0, + LAST_CHILD = -1, + BEFORE_CHILD = 1, + AFTER_CHILD = 2 +}; + +#define UNO_MSAA_UNMAPPING 0x00000000 + +struct IMAccessible; +UACCCOM_DLLPUBLIC IMAccessible* UAccCOMCreateInstance(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/winaccessibility/inc/unomsaaevent.hxx b/winaccessibility/inc/unomsaaevent.hxx new file mode 100644 index 000000000..e8d77d7cd --- /dev/null +++ b/winaccessibility/inc/unomsaaevent.hxx @@ -0,0 +1,67 @@ +/* -*- 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 + +enum class UnoMSAAEvent +{ + STATE_FOCUSED, + STATE_CHECKED, + STATE_ARMED, + STATE_PRESSED, + STATE_SELECTED, + STATE_SHOWING, + MENU_START, + MENU_END, + MENUPOPUPSTART, + MENUPOPUPEND, + SELECTION_CHANGED, + INVALIDATE_ALL_CHILDREN, + OBJECT_VALUECHANGE, + OBJECT_NAMECHANGE, + OBJECT_DESCRIPTIONCHANGE, + OBJECT_DEFACTIONCHANGE, + OBJECT_CARETCHANGE, + OBJECT_TEXTCHANGE, + ACTIVE_DESCENDANT_CHANGED, + BOUNDRECT_CHANGED, + VISIBLE_DATA_CHANGED, + SHOW, + STATE_BUSY, + TABLE_CAPTION_CHANGED, + TABLE_COLUMN_DESCRIPTION_CHANGED, + TABLE_COLUMN_HEADER_CHANGED, + TABLE_MODEL_CHANGED, + TABLE_ROW_HEADER_CHANGED, + TABLE_SUMMARY_CHANGED, + OBJECT_REORDER, + PAGE_CHANGED, + CHILD_ADDED, + CHILD_REMOVED, + TABLE_ROW_DESCRIPTION_CHANGED, + SELECTION_CHANGED_ADD, + SELECTION_CHANGED_REMOVE, + SELECTION_CHANGED_WITHIN, + OBJECT_PAGECHANGED, + TEXT_SELECTION_CHANGED, + SECTION_CHANGED, + COLUMN_CHANGED +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |