1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
21 #define INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
23 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
24 #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
25 #include <comphelper/accessiblecontexthelper.hxx>
26 #include <cppuhelper/implbase1.hxx>
27 #include <comphelper/uno3.hxx>
28 #include <comphelper/comphelperdllapi.h>
36 //= OCommonAccessibleComponent
38 /** base class encapsulating common functionality for the helper classes implementing
39 the XAccessibleComponent respectively XAccessibleExtendendComponent
41 class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent
: public OAccessibleContextHelper
44 /// see the respective base class ctor for an extensive comment on this, please
45 OCommonAccessibleComponent( IMutex
* _pExternalLock
);
46 virtual ~OCommonAccessibleComponent();
49 /// implements the calculation of the bounding rectangle - still waiting to be overwritten
50 virtual css::awt::Rectangle
implGetBounds( ) throw (css::uno::RuntimeException
, std::exception
) = 0;
53 /** non-virtual versions of the methods which can be implemented using <method>implGetBounds</method>
54 note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()),
55 which itself implements XAccessibleComponent
57 bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
58 ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
);
59 ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
60 ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
);
61 ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
);
65 //= OAccessibleComponentHelper
68 struct OAccessibleComponentHelper_Base
:
69 public ::cppu::ImplHelper1
< ::com::sun::star::accessibility::XAccessibleComponent
>
72 ~OAccessibleComponentHelper_Base() {}
75 /** a helper class for implementing an AccessibleContext which at the same time
76 supports an XAccessibleComponent interface.
78 class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
79 :public OCommonAccessibleComponent
80 ,public OAccessibleComponentHelper_Base
83 /// see the respective base class ctor for an extensive comment on this, please
84 OAccessibleComponentHelper( IMutex
* _pExternalLock
);
89 DECLARE_XTYPEPROVIDER( )
91 // XAccessibleComponent - default implementations
92 virtual sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 //= OAccessibleExtendedComponentHelper
103 typedef ::cppu::ImplHelper1
< ::com::sun::star::accessibility::XAccessibleExtendedComponent
104 > OAccessibleExtendedComponentHelper_Base
;
106 /** a helper class for implementing an AccessibleContext which at the same time
107 supports an XAccessibleExtendedComponent interface.
109 class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
110 :public OCommonAccessibleComponent
111 ,public OAccessibleExtendedComponentHelper_Base
114 /// see the respective base class ctor for an extensive comment on this, please
115 OAccessibleExtendedComponentHelper( IMutex
* _pExternalLock
);
119 DECLARE_XINTERFACE( )
120 DECLARE_XTYPEPROVIDER( )
122 // XAccessibleComponent - default implementations
123 virtual sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
125 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 virtual ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
131 } // namespace comphelper
134 #endif // INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */