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>
35 //= OCommonAccessibleComponent
37 /** base class encapsulating common functionality for the helper classes implementing
38 the XAccessibleComponent respectively XAccessibleExtendendComponent
40 class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent
: public OAccessibleContextHelper
43 /// see the respective base class ctor for an extensive comment on this, please
44 OCommonAccessibleComponent( IMutex
* _pExternalLock
);
45 virtual ~OCommonAccessibleComponent() override
;
48 /// implements the calculation of the bounding rectangle - still waiting to be overwritten
49 virtual css::awt::Rectangle
implGetBounds( ) throw (css::uno::RuntimeException
, std::exception
) = 0;
52 /** non-virtual versions of the methods which can be implemented using <method>implGetBounds</method>
53 note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()),
54 which itself implements XAccessibleComponent
56 bool SAL_CALL
containsPoint( const css::awt::Point
& aPoint
) throw (css::uno::RuntimeException
);
57 css::awt::Point SAL_CALL
getLocation( ) throw (css::uno::RuntimeException
);
58 css::awt::Point SAL_CALL
getLocationOnScreen( ) throw (css::uno::RuntimeException
);
59 css::awt::Size SAL_CALL
getSize( ) throw (css::uno::RuntimeException
);
60 css::awt::Rectangle SAL_CALL
getBounds( ) throw (css::uno::RuntimeException
);
64 //= OAccessibleComponentHelper
67 struct OAccessibleComponentHelper_Base
:
68 public ::cppu::ImplHelper1
< css::accessibility::XAccessibleComponent
>
71 ~OAccessibleComponentHelper_Base() {}
74 /** a helper class for implementing an AccessibleContext which at the same time
75 supports an XAccessibleComponent interface.
77 class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
78 :public OCommonAccessibleComponent
79 ,public OAccessibleComponentHelper_Base
82 /// see the respective base class ctor for an extensive comment on this, please
83 OAccessibleComponentHelper( IMutex
* _pExternalLock
);
88 DECLARE_XTYPEPROVIDER( )
90 // XAccessibleComponent - default implementations
91 virtual sal_Bool SAL_CALL
containsPoint( const css::awt::Point
& aPoint
) throw (css::uno::RuntimeException
, std::exception
) override
;
92 virtual css::awt::Point SAL_CALL
getLocation( ) throw (css::uno::RuntimeException
, std::exception
) override
;
93 virtual css::awt::Point SAL_CALL
getLocationOnScreen( ) throw (css::uno::RuntimeException
, std::exception
) override
;
94 virtual css::awt::Size SAL_CALL
getSize( ) throw (css::uno::RuntimeException
, std::exception
) override
;
95 virtual css::awt::Rectangle SAL_CALL
getBounds( ) throw (css::uno::RuntimeException
, std::exception
) override
;
99 //= OAccessibleExtendedComponentHelper
102 typedef ::cppu::ImplHelper1
< css::accessibility::XAccessibleExtendedComponent
103 > OAccessibleExtendedComponentHelper_Base
;
105 /** a helper class for implementing an AccessibleContext which at the same time
106 supports an XAccessibleExtendedComponent interface.
108 class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
109 :public OCommonAccessibleComponent
110 ,public OAccessibleExtendedComponentHelper_Base
113 /// see the respective base class ctor for an extensive comment on this, please
114 OAccessibleExtendedComponentHelper( IMutex
* _pExternalLock
);
118 DECLARE_XINTERFACE( )
119 DECLARE_XTYPEPROVIDER( )
121 // XAccessibleComponent - default implementations
122 virtual sal_Bool SAL_CALL
containsPoint( const css::awt::Point
& aPoint
) throw (css::uno::RuntimeException
, std::exception
) override
;
123 virtual css::awt::Point SAL_CALL
getLocation( ) throw (css::uno::RuntimeException
, std::exception
) override
;
124 virtual css::awt::Point SAL_CALL
getLocationOnScreen( ) throw (css::uno::RuntimeException
, std::exception
) override
;
125 virtual css::awt::Size SAL_CALL
getSize( ) throw (css::uno::RuntimeException
, std::exception
) override
;
126 virtual css::awt::Rectangle SAL_CALL
getBounds( ) throw (css::uno::RuntimeException
, std::exception
) override
;
130 } // namespace comphelper
133 #endif // INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */