Avoid potential negative array index access to cached text.
[LibreOffice.git] / winaccessibility / source / UAccCOM / AccImage.h
blob4e0708a180669828da2f258246537517097cc90b
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 #pragma once
22 #include "Resource.h" // main symbols
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/accessibility/XAccessibleImage.hpp>
26 #include "UNOXWrapper.h"
28 /**
29 * CAccImage implements IAccessibleImage interface.
31 class ATL_NO_VTABLE CAccImage :
32 public CComObjectRoot,
33 public CComCoClass<CAccImage,&CLSID_AccImage>,
34 public IAccessibleImage,
35 public CUNOXWrapper
37 public:
38 CAccImage()
41 virtual ~CAccImage()
44 BEGIN_COM_MAP(CAccImage)
45 COM_INTERFACE_ENTRY(IAccessibleImage)
46 COM_INTERFACE_ENTRY(IUNOXWrapper)
47 COM_INTERFACE_ENTRY_FUNC_BLIND(0,SmartQI_)
48 #if defined __clang__
49 #pragma clang diagnostic push
50 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
51 #endif
52 END_COM_MAP()
53 #if defined __clang__
54 #pragma clang diagnostic pop
55 #endif
57 static HRESULT WINAPI SmartQI_(void* pv,
58 REFIID iid, void** ppvObject, DWORD_PTR)
60 return static_cast<CAccImage*>(pv)->SmartQI(iid,ppvObject);
63 HRESULT SmartQI(REFIID iid, void** ppvObject)
65 if( m_pOuterUnknown )
66 return OuterQueryInterface(iid,ppvObject);
67 return E_FAIL;
70 DECLARE_NO_REGISTRY()
72 public:
73 // IAccessibleImage
75 // Gets the description of the image.
76 STDMETHOD(get_description)(BSTR * description) override;
78 STDMETHOD(get_imagePosition)( enum IA2CoordinateType coordinateType,
79 long __RPC_FAR *x,
80 long __RPC_FAR *y) override;
82 STDMETHOD(get_imageSize)(
83 long __RPC_FAR *height,
84 long __RPC_FAR *width) override;
86 // Override of IUNOXWrapper.
87 STDMETHOD(put_XInterface)(hyper pXInterface) override;
89 private:
91 css::uno::Reference<css::accessibility::XAccessibleImage> pRXImg;
93 css::accessibility::XAccessibleImage* GetXInterface()
95 return pRXImg.get();
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */