Bump version to 6.4.7.2.M8
[LibreOffice.git] / winaccessibility / source / UAccCOM / AccImage.cxx
blobd9fe6a3c4c385cba9d176784d17617602194a7e2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include "stdafx.h"
21 #include "AccImage.h"
23 #if defined __clang__
24 #pragma clang diagnostic push
25 #pragma clang diagnostic ignored "-Wnon-virtual-dtor"
26 #endif
27 #include <UAccCOM.h>
28 #if defined __clang__
29 #pragma clang diagnostic pop
30 #endif
32 #include <vcl/svapp.hxx>
33 #include <o3tl/char16_t2wchar_t.hxx>
35 #include <com/sun/star/accessibility/XAccessible.hpp>
36 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
38 using namespace css::accessibility;
39 using namespace css::uno;
41 /**
42 * Get description.
43 * @param description Variant to get description.
44 * @return Result.
46 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccImage::get_description(BSTR * description)
48 SolarMutexGuard g;
50 ENTER_PROTECTED_BLOCK
52 // #CHECK#
53 if (description == nullptr)
54 return E_INVALIDARG;
55 if( !pRXImg.is() )
56 return E_FAIL;
58 OUString ouStr = GetXInterface()->getAccessibleImageDescription();
59 SAFE_SYSFREESTRING(*description);
60 *description = SysAllocString(o3tl::toW(ouStr.getStr()));
62 return S_OK;
64 LEAVE_PROTECTED_BLOCK
67 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccImage::get_imagePosition(
68 /* [in] */ enum IA2CoordinateType,
69 /* [out] */ long __RPC_FAR *,
70 /* [retval][out] */ long __RPC_FAR *)
72 return E_NOTIMPL;
75 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccImage::get_imageSize(
76 /* [out] */ long __RPC_FAR *,
77 /* [retval][out] */ long __RPC_FAR *)
79 return E_NOTIMPL;
82 /**
83 * Put UNO interface.
84 * @param pXInterface UNO interface.
85 * @return Result.
87 COM_DECLSPEC_NOTHROW STDMETHODIMP CAccImage::put_XInterface(hyper pXInterface)
89 // internal IUNOXWrapper - no mutex meeded
91 ENTER_PROTECTED_BLOCK
93 CUNOXWrapper::put_XInterface(pXInterface);
94 //special query.
95 if(pUNOInterface == nullptr)
96 return E_FAIL;
98 Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
99 if( !pRContext.is() )
101 return E_FAIL;
103 Reference<XAccessibleImage> pRXI(pRContext,UNO_QUERY);
104 if( !pRXI.is() )
105 pRXImg = nullptr;
106 else
107 pRXImg = pRXI.get();
108 return S_OK;
110 LEAVE_PROTECTED_BLOCK
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */