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 COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
21 #define COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_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"
30 //.........................................................................
33 //.........................................................................
35 //=====================================================================
36 //= OCommonAccessibleComponent
37 //=====================================================================
38 /** base class encapsulating common functionality for the helper classes implementing
39 the XAccessibleComponent respectively XAccessibleExtendendComponent
41 class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent
: public OAccessibleContextHelper
44 OCommonAccessibleComponent();
45 /// see the respective base class ctor for an extensive comment on this, please
46 OCommonAccessibleComponent( IMutex
* _pExternalLock
);
47 ~OCommonAccessibleComponent();
50 /// implements the calculation of the bounding rectangle - still waiting to be overwritten
51 virtual ::com::sun::star::awt::Rectangle SAL_CALL
implGetBounds( ) throw (::com::sun::star::uno::RuntimeException
) = 0;
54 /** non-virtual versions of the methods which can be implemented using <method>implGetBounds</method>
55 note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()),
56 which itself implements XAccessibleComponent
58 sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
59 ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
);
60 ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
61 ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
);
62 ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
);
65 //=====================================================================
66 //= OAccessibleComponentHelper
67 //=====================================================================
69 struct OAccessibleComponentHelper_Base
:
70 public ::cppu::ImplHelper1
< ::com::sun::star::accessibility::XAccessibleComponent
>
73 ~OAccessibleComponentHelper_Base() {}
76 /** a helper class for implementing an AccessibleContext which at the same time
77 supports an XAccessibleComponent interface.
79 class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
80 :public OCommonAccessibleComponent
81 ,public OAccessibleComponentHelper_Base
84 OAccessibleComponentHelper( );
85 /// see the respective base class ctor for an extensive comment on this, please
86 OAccessibleComponentHelper( IMutex
* _pExternalLock
);
91 DECLARE_XTYPEPROVIDER( )
93 // XAccessibleComponent - default implementations
94 virtual sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
95 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
);
96 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
97 virtual ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
);
98 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
);
101 //=====================================================================
102 //= OAccessibleExtendedComponentHelper
103 //=====================================================================
105 typedef ::cppu::ImplHelper1
< ::com::sun::star::accessibility::XAccessibleExtendedComponent
106 > OAccessibleExtendedComponentHelper_Base
;
108 /** a helper class for implementing an AccessibleContext which at the same time
109 supports an XAccessibleExtendedComponent interface.
111 class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
112 :public OCommonAccessibleComponent
113 ,public OAccessibleExtendedComponentHelper_Base
116 OAccessibleExtendedComponentHelper( );
117 /// see the respective base class ctor for an extensive comment on this, please
118 OAccessibleExtendedComponentHelper( IMutex
* _pExternalLock
);
122 DECLARE_XINTERFACE( )
123 DECLARE_XTYPEPROVIDER( )
125 // XAccessibleComponent - default implementations
126 virtual sal_Bool SAL_CALL
containsPoint( const ::com::sun::star::awt::Point
& aPoint
) throw (::com::sun::star::uno::RuntimeException
);
127 virtual ::com::sun::star::awt::Point SAL_CALL
getLocation( ) throw (::com::sun::star::uno::RuntimeException
);
128 virtual ::com::sun::star::awt::Point SAL_CALL
getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException
);
129 virtual ::com::sun::star::awt::Size SAL_CALL
getSize( ) throw (::com::sun::star::uno::RuntimeException
);
130 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getBounds( ) throw (::com::sun::star::uno::RuntimeException
);
133 //.........................................................................
134 } // namespace comphelper
135 //.........................................................................
137 #endif // COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */