Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / winaccessibility / source / UAccCOM / AccImage.cxx
blobb4854f0d5c7856bddd554cb9a36dd225d7835fda
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>
34 #include <com/sun/star/accessibility/XAccessible.hpp>
35 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
37 using namespace css::accessibility;
38 using namespace css::uno;
40 /**
41 * Get description.
42 * @param description Variant to get description.
43 * @return Result.
45 STDMETHODIMP CAccImage::get_description(BSTR * description)
47 SolarMutexGuard g;
49 ENTER_PROTECTED_BLOCK
51 // #CHECK#
52 if (description == NULL)
53 return E_INVALIDARG;
54 if( !pRXImg.is() )
55 return E_FAIL;
57 ::rtl::OUString ouStr = GetXInterface()->getAccessibleImageDescription();
58 SAFE_SYSFREESTRING(*description);
59 *description = SysAllocString((OLECHAR*)ouStr.getStr());
61 return S_OK;
63 LEAVE_PROTECTED_BLOCK
66 STDMETHODIMP CAccImage::get_imagePosition(
67 /* [in] */ enum IA2CoordinateType,
68 /* [out] */ long __RPC_FAR *,
69 /* [retval][out] */ long __RPC_FAR *)
71 return E_NOTIMPL;
74 STDMETHODIMP CAccImage::get_imageSize(
75 /* [out] */ long __RPC_FAR *,
76 /* [retval][out] */ long __RPC_FAR *)
78 return E_NOTIMPL;
81 /**
82 * Put UNO interface.
83 * @param pXInterface UNO interface.
84 * @return Result.
86 STDMETHODIMP CAccImage::put_XInterface(hyper pXInterface)
88 // internal IUNOXWrapper - no mutex meeded
90 ENTER_PROTECTED_BLOCK
92 CUNOXWrapper::put_XInterface(pXInterface);
93 //special query.
94 if(pUNOInterface == NULL)
95 return E_FAIL;
97 Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
98 if( !pRContext.is() )
100 return E_FAIL;
102 Reference<XAccessibleImage> pRXI(pRContext,UNO_QUERY);
103 if( !pRXI.is() )
104 pRXImg = NULL;
105 else
106 pRXImg = pRXI.get();
107 return S_OK;
109 LEAVE_PROTECTED_BLOCK
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */