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 .
21 #include "AccComponentBase.h"
22 #include <com/sun/star/accessibility/XAccessible.hpp>
23 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
24 #include <vcl/svapp.hxx>
25 #include "MAccessible.h"
27 using namespace com::sun::star::accessibility
;
28 using namespace com::sun::star::uno
;
31 // Construction/Destruction
34 CAccComponentBase::CAccComponentBase()
37 CAccComponentBase::~CAccComponentBase()
42 * Returns the location of the upper left corner of the object's bounding
43 * box relative to the parent.
45 * @param Location the upper left corner of the object's bounding box.
47 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccComponentBase::get_locationInParent(long *x
, long *y
)
53 if (x
== nullptr || y
== nullptr)
59 const css::awt::Point
& pt
= GetXInterface()->getLocation();
71 * Returns the location of the upper left corner of the object's bounding
74 * @param Location the upper left corner of the object's bounding
75 * box in screen coordinates.
77 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccComponentBase::get_locationOnScreen(long *x
, long *y
)
83 if (x
== nullptr || y
== nullptr)
89 const css::awt::Point
& pt
= GetXInterface()->getLocationOnScreen();
102 * Grabs the focus to this object.
104 * @param success the boolean result to be returned.
106 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccComponentBase::grabFocus(boolean
* success
)
110 ENTER_PROTECTED_BLOCK
112 if (success
== nullptr)
114 // #CHECK XInterface#
119 GetXInterface()->grabFocus();
124 LEAVE_PROTECTED_BLOCK
128 * Returns the foreground color of this object.
130 * @param Color the color of foreground.
132 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccComponentBase::get_foreground(IA2Color
* foreground
)
136 ENTER_PROTECTED_BLOCK
138 if (foreground
== nullptr)
140 // #CHECK XInterface#
145 *foreground
= static_cast<long>(GetXInterface()->getForeground());
149 LEAVE_PROTECTED_BLOCK
153 * Returns the background color of this object.
155 * @param Color the color of background.
157 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccComponentBase::get_background(IA2Color
* background
)
161 ENTER_PROTECTED_BLOCK
163 if (background
== nullptr)
165 // #CHECK XInterface#
170 *background
= static_cast<long>(GetXInterface()->getBackground());
174 LEAVE_PROTECTED_BLOCK
178 * Override of IUNOXWrapper.
180 * @param pXInterface the pointer of UNO interface.
182 COM_DECLSPEC_NOTHROW STDMETHODIMP
CAccComponentBase::put_XInterface(hyper pXInterface
)
184 // internal IUNOXWrapper - no mutex meeded
186 ENTER_PROTECTED_BLOCK
188 CUNOXWrapper::put_XInterface(pXInterface
);
190 if(pUNOInterface
== nullptr)
192 Reference
<XAccessibleContext
> pRContext
= pUNOInterface
->getAccessibleContext();
193 if( !pRContext
.is() )
197 Reference
<XAccessibleComponent
> pRXI(pRContext
,UNO_QUERY
);
201 pRXComp
= pRXI
.get();
205 LEAVE_PROTECTED_BLOCK
208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */