LibreOffice Module winaccessibility (master) 1
AccImage.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include "stdafx.h"
21#include <UAccCOM.h>
22#include "AccImage.h"
23
24#include <vcl/svapp.hxx>
26
27#include <com/sun/star/accessibility/XAccessible.hpp>
28#include <com/sun/star/accessibility/XAccessibleContext.hpp>
29
30using namespace css::accessibility;
31using namespace css::uno;
32
38COM_DECLSPEC_NOTHROW STDMETHODIMP CAccImage::get_description(BSTR* description)
39{
41
42 try
43 {
44 // #CHECK#
45 if (description == nullptr)
46 return E_INVALIDARG;
47 if (!pRXImg.is())
48 return E_FAIL;
49
50 OUString ouStr = GetXInterface()->getAccessibleImageDescription();
51 SysFreeString(*description);
52 *description = SysAllocString(o3tl::toW(ouStr.getStr()));
53
54 return S_OK;
55 }
56 catch (...)
57 {
58 return E_FAIL;
59 }
60}
61
62COM_DECLSPEC_NOTHROW STDMETHODIMP CAccImage::get_imagePosition(
63 /* [in] */ enum IA2CoordinateType,
64 /* [out] */ long __RPC_FAR*,
65 /* [retval][out] */ long __RPC_FAR*)
66{
67 return E_NOTIMPL;
68}
69
70COM_DECLSPEC_NOTHROW STDMETHODIMP CAccImage::get_imageSize(
71 /* [out] */ long __RPC_FAR*,
72 /* [retval][out] */ long __RPC_FAR*)
73{
74 return E_NOTIMPL;
75}
76
82COM_DECLSPEC_NOTHROW STDMETHODIMP CAccImage::put_XInterface(hyper pXInterface)
83{
84 // internal IUNOXWrapper - no mutex meeded
85
86 try
87 {
89 //special query.
90 if (pUNOInterface == nullptr)
91 return E_FAIL;
92
93 Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
94 if (!pRContext.is())
95 {
96 return E_FAIL;
97 }
98 Reference<XAccessibleImage> pRXI(pRContext, UNO_QUERY);
99 if (!pRXI.is())
100 pRXImg = nullptr;
101 else
102 pRXImg = pRXI.get();
103 return S_OK;
104 }
105 catch (...)
106 {
107 return E_FAIL;
108 }
109}
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHOD() get_description(BSTR *description) override
Get description.
Definition: AccImage.cxx:38
STDMETHOD() get_imageSize(long __RPC_FAR *height, long __RPC_FAR *width) override
Definition: AccImage.cxx:70
STDMETHOD() put_XInterface(hyper pXInterface) override
Put UNO interface.
Definition: AccImage.cxx:82
css::uno::Reference< css::accessibility::XAccessibleImage > pRXImg
Definition: AccImage.h:91
css::accessibility::XAccessibleImage * GetXInterface()
Definition: AccImage.h:93
STDMETHOD() get_imagePosition(enum IA2CoordinateType coordinateType, long __RPC_FAR *x, long __RPC_FAR *y) override
Definition: AccImage.cxx:62
STDMETHOD() put_XInterface(hyper pXInterface) override
Definition: UNOXWrapper.cxx:27
css::accessibility::XAccessible * pUNOInterface
Definition: UNOXWrapper.h:34
IA2CoordinateType
These constants define which coordinate system a point is located in.
BSTR description
Returns the localized description of the image.